import nmap

nm=nmap.PortScanner()
print('This is a simple NMAP SCANNER that enables automation')
print('<--------------------------------------------------->')

ip_address=input('Please enter the IP ADDRESS you wish to scan:')
print(f'The IP Address you entered is: {ip_address}')
type(ip_address)

response=input('''\nPlease enter the type of scan you want to run
               1. SYN ACK SCAN
               2. UDP SCAN
               3. COMPREHENSIVE SCAN
               4. OPERATING SYSTEM\n''')
print(f"You have selected option {response}")

if response=="1":
     print(f'NMAP Version: {nm.nmap_version()}')
     nm.scan(ip_address,'1-1024','-v -sS')
     print(nm.scaninfo())
     print(f'IP Status: {nm[ip_address].state()}')
     print(nm[ip_address].all_protocols())
     print(f"Open Ports: {nm[ip_address]['tcp'].keys()}")
elif response=="2":
     print(f'NMAP Version: {nm.nmap_version()}')
     nm.scan(ip_address,'1-1024','-v -sU')
     print(nm.scaninfo())
     print(f'IP Status: {nm[ip_address].state()}')
     print(nm[ip_address].all_protocols())
     print(f"Open Ports: {nm[ip_address]['udp'].keys()}")
elif response=="3":
     print(f'NMAP Version: {nm.nmap_version()}')
     nm.scan(ip_address,'1-1024','-v -sS -sV -sC -A -O')
     print(nm.scaninfo())
     print(f'IP Status: {nm[ip_address].state()}')
     print(nm[ip_address].all_protocols())
     print(f"Open Ports: {nm[ip_address]['udp'].keys()}")
elif response>="4":
     print(f'Please enter a valid option')