From 56ec331250b2d1598a5803e7a1a4b473e3a49140 Mon Sep 17 00:00:00 2001 From: Baby-McBabyFace <32679064+Baby-McBabyFace@users.noreply.github.com> Date: Mon, 21 Jan 2019 20:38:41 +0800 Subject: [PATCH] Update Scanner.py Mostly formatting changes --- Scanner.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Scanner.py b/Scanner.py index d174c55..0d38b97 100644 --- a/Scanner.py +++ b/Scanner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python #Using this shebang ensures Python can be found on each linux distributions. import nmap @@ -8,37 +8,39 @@ print("<----------------------------------------------------->") ip_addr = input("Please enter the IP address you want to scan: ") -print("The IP you entered is: ", ip_addr) +print("The IP you entered is:", ip_addr) #Edited formatting type(ip_addr) resp = input("""\nPlease enter the type of scan you want to run 1)SYN ACK Scan 2)UDP Scan - 3)Comprehensive Scan \n""") -print("You have selected option: ", resp) + 3)Comprehensive Scan + +Enter your option: """) #Edited formatting +print("You have selected option:", resp) #Edited formatting if resp == '1': - print("Nmap Version: ", scanner.nmap_version()) + print("Nmap Version:", scanner.nmap_version()) #Edited formatting scanner.scan(ip_addr, '1-1024', '-v -sS') print(scanner.scaninfo()) - print("Ip Status: ", scanner[ip_addr].state()) + print("Ip Status:", scanner[ip_addr].state()) #Edited formatting print(scanner[ip_addr].all_protocols()) - print("Open Ports: ", scanner[ip_addr]['tcp'].keys()) + print("Open Ports:", scanner[ip_addr]['tcp'].keys()) #Edited formatting elif resp == '2': - print("Nmap Version: ", scanner.nmap_version()) + print("Nmap Version:", scanner.nmap_version()) #Edited formatting scanner.scan(ip_addr, '1-1024', '-v -sU') print(scanner.scaninfo()) - print("Ip Status: ", scanner[ip_addr].state()) + print("Ip Status:", scanner[ip_addr].state()) #Edited formatting print(scanner[ip_addr].all_protocols()) - print("Open Ports: ", scanner[ip_addr]['udp'].keys()) + print("Open Ports:", scanner[ip_addr]['udp'].keys()) #Edited formatting elif resp == '3': - print("Nmap Version: ", scanner.nmap_version()) + print("Nmap Version:", scanner.nmap_version()) #Edited formatting scanner.scan(ip_addr, '1-1024', '-v -sS -sV -sC -A -O') print(scanner.scaninfo()) - print("Ip Status: ", scanner[ip_addr].state()) + print("Ip Status:", scanner[ip_addr].state()) #Edited formatting print(scanner[ip_addr].all_protocols()) - print("Open Ports: ", scanner[ip_addr]['tcp'].keys()) -elif resp >= '4': + print("Open Ports:", scanner[ip_addr]['tcp'].keys()) #Edited formatting +else: #removed elif to catch more invalid options (e.g. negative numbers, strings) print("Please enter a valid option")