Skip to content

Formatting changes on Scanner.py #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions Scanner.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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")


Expand Down