-
Notifications
You must be signed in to change notification settings - Fork 37
/
stegosip.py
46 lines (35 loc) · 1.22 KB
/
stegosip.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
#!/usr/bin/python
import asyncore, sys, os
import core.nf_pkt_dispatcher
import core.dissector_dict
from core.options import conf, debug
from optparse import OptionParser
if __name__ == '__main__':
if os.getuid()!=0:
print '[ERR] Retry as root.'
sys.exit(1)
proto = conf.get('global', 'protocol')
if not proto:
print '[ERR] Parameter in stegosip.conf \'protocol\' is mandatory.'
sys.exit(1)
try:
core.dissector_dict.dissd.loadDissectorsInstances([proto,])
try:
core.nf_pkt_dispatcher.nf_pkt_dispatcher()
except Exception, e:
print '[ERR] Error loading netfilter queue. Have you loaded the kernel module? Try running \'modprobe nfnetlink_queue\'.'
raise
asyncore.loop()
except KeyboardInterrupt:
print 'Quitting.'
if core.dissector_dict.dissd:
core.dissector_dict.dissd.unloadDissectorsInstances()
sys.exit(0)
except Exception, e:
print 'Error: ', str(e)
if core.dissector_dict.dissd:
core.dissector_dict.dissd.unloadDissectorsInstances()
if debug:
print 'Raised exception:'
raise
sys.exit(1)