-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
47 lines (38 loc) · 1.19 KB
/
main.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
46
47
import argparse
from utils.PortParser import *
from Scanner.TcpConnect import *
from Scanner.TcpSyn import *
from Scanner.Ping import *
from Scanner.Udp import *
from Scanner.TcpFin import *
def main():
parser = argparse.ArgumentParser(
description="Xscan_python - A simple port scanner written in Python"
)
parser.add_argument("-t", "--target", help="Target Ip")
parser.add_argument("-p", "--ports", nargs="+", type=str)
parser.add_argument(
"-s",
"--scan",
choices=["connect", "syn", "udp", "fin", "ping"],
default="connect",
)
args = parser.parse_args()
target_ip = args.target
scan_type = args.scan
if scan_type == "connect":
ports = parse_ports(args.ports)
tcp_connect_scan(target_ip, ports)
elif scan_type == "syn":
ports = parse_ports(args.ports)
tcp_syn_scan(target_ip, ports)
elif scan_type == "udp":
ports = parse_ports(args.ports)
udp_scan(target_ip, ports)
elif scan_type == "fin":
ports = parse_ports(args.ports)
tcp_fin_scan(target_ip, ports)
elif scan_type == "ping":
ping(target_ip)
if __name__ == "__main__":
main()