From db58981414cc58f9ae5992257f48eaedd5255d21 Mon Sep 17 00:00:00 2001 From: EggMan Date: Thu, 25 Apr 2024 10:40:45 -0400 Subject: [PATCH] finished network.py --- .idea/CNSA-266-Personal.iml | 2 +- .idea/misc.xml | 2 +- FileFinder.py | 0 network.py | 18 ++++++++++++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 FileFinder.py diff --git a/.idea/CNSA-266-Personal.iml b/.idea/CNSA-266-Personal.iml index 6f1ddae..85bdc0b 100644 --- a/.idea/CNSA-266-Personal.iml +++ b/.idea/CNSA-266-Personal.iml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 1ce53be..14c577e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/FileFinder.py b/FileFinder.py new file mode 100644 index 0000000..e69de29 diff --git a/network.py b/network.py index 225ba2f..4957cb9 100644 --- a/network.py +++ b/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) @@ -34,4 +37,15 @@ 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") \ No newline at end of file +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) \ No newline at end of file