finished network.py
This commit is contained in:
parent
5842024abf
commit
db58981414
@ -4,7 +4,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</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" />
|
||||
</component>
|
||||
</module>
|
@ -3,5 +3,5 @@
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.11 (CNSA-266-Personal)" />
|
||||
</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>
|
0
FileFinder.py
Normal file
0
FileFinder.py
Normal file
16
network.py
16
network.py
@ -1,5 +1,7 @@
|
||||
import socket
|
||||
import time
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
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: ")
|
||||
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)):
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
@ -35,3 +38,14 @@ for port in closedPorts:
|
||||
for port in openPorts:
|
||||
print("Port " + str(port) + " is 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)
|
Loading…
Reference in New Issue
Block a user