finished network.py

This commit is contained in:
EggMan 2024-04-25 10:40:45 -04:00
parent 5842024abf
commit db58981414
4 changed files with 18 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" /> <excludeFolder url="file://$MODULE_DIR$/.venv" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.11 (CNSA-266-Personal)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.11 (CNSA-266-Personal)" /> <option name="sdkName" value="Python 3.11 (CNSA-266-Personal)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (CNSA-266-Personal)" project-jdk-type="Python SDK" />
</project> </project>

0
FileFinder.py Normal file
View File

View File

@ -1,5 +1,7 @@
import socket import socket
import time import time
import platform
import subprocess
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80)) s.connect(("8.8.8.8", 80))
@ -14,7 +16,8 @@ host = input("Please enter the IP address of the host you would like to scan: ")
start = input("Please enter the starting port you would like to scan: ") start = input("Please enter the starting port you would like to scan: ")
end = input("Please enter the ending port you would like to scan: ") end = input("Please enter the ending port you would like to scan: ")
timeout = input("Please enter the timeout in seconds you would like to set for each port scan: ") timeout = input("Please enter the timeout in seconds you would like to set for each port scan (0.1 for external hosts "
"(WAN), 0.01 for internal hosts (LAN)): ")
for i in range(int(start), int(end)): for i in range(int(start), int(end)):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@ -34,4 +37,15 @@ for port in closedPorts:
for port in openPorts: for port in openPorts:
print("Port " + str(port) + " is open") print("Port " + str(port) + " is open")
print(str(len(closedPorts)) + " ports are closed; " + str(len(openPorts)) + " ports are open") print(str(len(closedPorts)) + " ports are closed; " + str(len(openPorts)) + " ports are open")
print("Starting Ping Monitor (x8): ")
time.sleep(2)
parameter = "-c"
command = ["ping", parameter, "8", host]
response = subprocess.call(command)
print(response == 0)