This repository has been archived by the owner on Jun 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
nmap.py
46 lines (41 loc) · 1.54 KB
/
nmap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
from termcolor import colored
import socket
import re
def url2ip(url):
return socket.gethostbyname(url)
def nmap(host,s_type,os_detection=False):
print(colored("[+]Scanning {}".format(host),"green",attrs=["reverse","blink"]))
table = {1:"-sT",2:"-sU",3:"-sV",4:"-sS",5:"-sX",6:"-sC"}
if os_detection:
os.system("nmap {} -sC -O -Pn {}".format(table[s_type],host))
else:
os.system("nmap {} -sC -Pn {}".format(table[s_type],host))
def main():
print('''
============== Nmap ================
Note: It relies on nmap, since it teaches begineers about it's usage.
=============== Arguments =================
-sT, -sV, -sU, -sS, -sX: TCP, UDP, Version, TCP SYN, Xmas
-A: Enable OS detection, version detection, script scanning, and traceroute
-Pn: Treat all hosts as online
-sC: Run all lua scripts for vulnerabilty scanning
============================================
1: TCP Scan
2: UDP Scan
3: Version Scan
4: TCP SYN Scan
5: Xmas Scan
======================================
Usage: Type nmap to invoke and after that enter host then the number shown above to scan for respective scan.
======================================
Example:
<Alfred>nmap
Enter Host: <ip address>
Scan Type: <index of scan>''')
try:
host = input("Enter Host address: ")
choice = int(input("Which type of scan?: "))
nmap(host,choice)
except:
print(colored("[!]Error Occured, try again","red",attrs=["reverse","underline"]))