-
Notifications
You must be signed in to change notification settings - Fork 2
/
binetflowtosigs
executable file
·49 lines (37 loc) · 1.82 KB
/
binetflowtosigs
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
#!/usr/bin/env python
from __future__ import absolute_import, division
__author__ = "Jing Zhang"
__email__ = "[email protected]"
__status__ = "Development"
import sys
import os
import argparse
ROOT = os.environ.get("binetflowtosigs_ROOT")
if ROOT is None:
print("Please set <binetflowtosigs_ROOT> variable in bash.")
sys.exit()
if not ROOT.endswith("BiNetflowToSIGs"):
print("Please set <binetflowtosigs_ROOT> path variable correctly. "
"Please change the name of the <ROOT> folder to BiNetflowToSIGs. Other name(s) "
"will cause import problem.")
sys.exit()
sys.path.insert(0, ROOT)
sys.path.insert(0, ROOT.rstrip("BiNetflowToSIGs"))
from BiNetflowToSIGs.main.genSigs import convertBinetflowToSigs
parser = argparse.ArgumentParser()
parser.add_argument("-w", default=1, type=float, help="window size; default=1")
parser.add_argument("-p",
default="/home/jzh/Dropbox/Research/Botnet_detection/BiNetflowToSIGs_Data/capture20110816.binetflow.sample",
type=str, help="path to raw data; \
default='/home/jzh/Dropbox/Research/Botnet_detection/BiNetflowToSIGs_Data/capture20110816.binetflow.sample'")
parser.add_argument("-d", default="/home/jzh/Dropbox/Research/Botnet_detection/BiNetflowToSIGs_Data/", type=str, \
help="folder for saving output SIGs file; \
default='/home/jzh/Dropbox/Research/Botnet_detection/BiNetflowToSIGs_Data/'")
parser.add_argument("-s", default="result.sigs", type=str, \
help="name of standard output SIGs file; default='result.sigs'")
parser.add_argument("-e", default=False, action="store_true", \
help="whether or not to enable the botnet_nodes output; default=False")
args = parser.parse_args()
if args.w <= 0:
raise Exception("Invalid window size; please specify -w to be a positive number.")
convertBinetflowToSigs(args).run()