This repository was archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseOptionsSimple.py
More file actions
66 lines (51 loc) · 1.68 KB
/
Copy pathparseOptionsSimple.py
File metadata and controls
66 lines (51 loc) · 1.68 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import getopt
import sys
import configurationScannerTCP
# vettore di stringhe per evitare type di attacchi non riconosciuti
tipoAttacchi=["SYN","FIN/ACK","ACK","XmasTREE","NULL"]
# type SYN
# type FIN/ACK
# type ACK
# type XmasTREE
# type NULL
def help():
print """
SCANNER TCP written by Dado1513
for usage must be Super User, based on scapy
[usage] sudo python -p PORT --type=typeOfAttack <target>
type:
- SYN
- FIN/ACK
- ACK
- XmasTREE
- NULL
"""
# p seguito dalle porte che si vogliono interrogare
def parsingOptions(args):
options,target=getopt.getopt(args,"hp:",['type='])
if target is not None and len(target) > 0:
configurationScannerTCP.destination=target
for opt in options:
if(opt[0]=="--type"):
if(str(opt[1]) in tipoAttacchi):
#imposto il tipo di attacco
configurationScannerTCP.typeOfScanning=opt[1]
else:
print(configurationScannerTCP.bcolors.WARNING+"Type of attack not recognize"+configurationScannerTCP.bcolors.ENDC)
help()
sys.exit(0)
elif(opt[0]=="-p"):
#le porte che si vogliono scansionare
#print (opt[1])
porte=str(opt[1]).split(",")
configurationScannerTCP.topports=[int(port) for port in porte]
#print configuration.topports;
elif(opt[0]=="-h"):
help()
sys.exit(0)
else:
help()
sys.exit(0)
else:
help()
sys.exit(0)