5 from switzerland
.common
import Protocol
7 if platform
.system() != "Windows":
8 default_pcap_logdir
= "/var/log/switzerland-pcaps"
9 default_logfile
= "/var/log/switzerland-server.log"
11 default_pcap_logdir
= "c:\switzerland\pcaplogs"
12 default_logfile
= "c:\switzerland\serverlog"
15 class SwitzerlandConfig
:
18 port
=Protocol
.default_port
,
22 keep_reconciliators
=False,
24 logfile
=default_logfile
,
25 pcap_logdir
=default_pcap_logdir
,
27 send_flow_status_updates
=True,
28 client_contact_period
=45 # controls pings to clients
31 self
.sloppy
= sloppy
# Yes if we expect clients to send us flows that
32 # shouldn't be here. True for some test cases
33 # perhaps, but not True in general.
34 self
.keep_threads
= keep_threads
# (Keep threads around even after they've
35 # finished ; used for unit tests)
36 self
.keep_reconciliators
= keep_reconciliators
37 self
.seriousness_threshold
= seriousness
38 self
.logging
= logging
39 self
.pcap_logdir
= pcap_logdir
40 self
.logfile
= logfile
41 self
.allow_fake_ips
= allow_fake_ips
42 self
.send_flow_status_updates
= send_flow_status_updates
43 self
.client_contact_period
= client_contact_period
48 def get_options(self
):
51 getopt
.gnu_getopt(sys
.argv
[1:], 'p:hL:P:', \
57 if opt
[0] == '-p' or opt
[0] == '--port':
58 self
.port
= int(opt
[1])
59 elif opt
[0] == '-h' or opt
[0] == '--help':
61 elif opt
[0] == '-L' or opt
[0] == '--logfile':
63 elif opt
[0] == '-P' or opt
[0] == '--pcap-logs':
64 self
.pcap_logdir
= opt
[1]
68 print "%s [OPTIONS]" % sys
.argv
[0]
69 print "server for switzerland network traffic auditing system"
71 print " -h, --help print usage info"
72 print " -p, --port <port number> port to listen on"
73 print ' -L, --logfile <file> Write a copy of the output to <file>. "-" for none'
74 print " (defaults to " + default_logfile
+ ")"
75 print " -P, --pcap-logs <dir> Sets the directory to which PCAPs of modified"
76 print ' packets will be written. "-" for none.'
77 print " (defaults to " + default_pcap_logdir
+ ")"