12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #!env/bin/python
- import nmap
- from time import sleep
- import readline
- def print_logo(logo: str):
- for line in logo.split("\n"):
- print(line)
- sleep(.1)
- logo = """
- ╔═══╗ ╔════╗
- ║╔═╗║ ║╔╗╔╗║
- ║╚═╝║╔══╗ ╔╗╔╗╚╝║║╚╝╔══╗╔═╗
- ║╔══╝╚ ╗║ ║╚╝║ ║║ ║╔╗║║╔╗╗
- ║║ ║╚╝╚╗║║║║ ╔╝╚╗ ║╚╝║║║║║
- ╚╝ ╚═══╝╚╩╩╝ ╚══╝ ╚══╝╚╝╚╝
- """
-
- scanner = nmap.PortScanner()
- print("Wellcome, this is a simple nmap automation tool")
- print("<--------------------------------------------------->")
- print_logo(logo)
- ip_addr = input("Please enter th IP address you want to scan: ")
- print("The IP you entered is: ", ip_addr)
- type(ip_addr)
- resp = input("""\nPlease enter the type of scan you want to run
- 1) SYN ACK Scan
- 2) UDP Scan
- 3) Comprehansive Scan
- : """)
- print("You have selected option: ", resp)
- if resp == '1':
- print("Nmap Version:", scanner,nmap.__version__)
- scanner.scan(ip_addr, '1-1024', '-v -sS')
- print("Scan info:", scanner.scaninfo())
- print("IP status:", scanner[ip_addr].state())
- print("Protocols:", list(scanner[ip_addr].all_protocols()))
- try:
- print("Open ports:", list(scanner[ip_addr]['tcp'].keys()))
- except KeyError:
- print(f"It seems like host witn IP address {ip_addr} is down")
- elif resp == '2':
- print("Nmap Version:", scanner,nmap.__version__)
- scanner.scan(ip_addr, '1-1024', '-v -sU')
- print("Scan info:", scanner.scaninfo())
- print("IP status:", scanner[ip_addr].state())
- print("Protocols:", list(scanner[ip_addr].all_protocols()))
- try:
- print("Open ports:", list(scanner[ip_addr]['udp'].keys()))
- except KeyError:
- print(f"It seems like host witn IP address {ip_addr} is down")
- elif resp == '3':
- print("Nmap Version:", scanner,nmap.__version__)
- scanner.scan(ip_addr, '1-9000', '-v -sS -sV -A -O')
- print("Scan info:", scanner.scaninfo())
- print("IP status:", scanner[ip_addr].state())
- print("Protocols:", list(scanner[ip_addr].all_protocols()))
- try:
- print("Open ports:", list(scanner[ip_addr]['tcp'].keys()))
- except KeyError:
- print(f"It seems like host witn IP address {ip_addr} is down")
- else:
- print("Please enter a valide option")
- exit()
|