-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_engine_invoke.py
116 lines (109 loc) · 4.31 KB
/
test_engine_invoke.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python
import logging
import time
from engine.engine import Engine
import sys
import os
TSHARK_DIR = '/tmp/tshark'
PYKEYLOGGER_DIR = '/tmp/pykeylogger'
NMAP_DIR = '/tmp/nmap'
AUDITD_DIR = '/tmp/auditd'
def execute_tshark_test():
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("Starting Program")
logging.debug("Engine_invoker: getting engine instance")
engine = Engine()
logging.debug("Engine_invoker: Removing all previous data")
#engine.delete_all()
logging.debug("Engine_invoker: invoking print_collector_names")
engine.print_collector_names()
logging.debug("Engine_invoker: obtaining tshark collector")
c = engine.get_collector("tshark")
logging.debug("Engine_invoker: starting collector")
engine.start_collector(c)
logging.debug("Engine_invoker: waiting 10 seconds")
time.sleep(10)
logging.debug("Engine_invoker: stopping collector")
engine.stop_collector(c)
logging.debug("Engine_invoker: parsing data")
engine.parser(c)
logging.debug("Engine_invoker: exporting data")
os.makedirs(TSHARK_DIR, exist_ok=True)
engine.export(TSHARK_DIR)
logging.debug("Engine_invoker: Tshark Complete.")
def execute_pykeylogger_test():
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("Starting Program")
logging.debug("Engine_invoker: getting engine instance")
engine = Engine()
logging.debug("Engine_invoker: Removing all previous data")
#engine.delete_all()
logging.debug("Engine_invoker: invoking print_collector_names")
engine.print_collector_names()
logging.debug("Engine_invoker: obtaining pykeylogger collector")
c = engine.get_collector("pykeylogger")
logging.debug("Engine_invoker: starting collector")
engine.start_collector(c)
logging.debug("Engine_invoker: waiting 10 seconds")
time.sleep(10)
logging.debug("Engine_invoker: stopping collector")
engine.stop_collector(c)
logging.debug("Engine_invoker: parsing data")
engine.parser(c)
logging.debug("Engine_invoker: exporting data")
os.makedirs(PYKEYLOGGER_DIR, exist_ok=True)
engine.export(PYKEYLOGGER_DIR)
logging.debug("Engine_invoker: PyKeylogger Complete.")
#def execute_nmap_test():
#logging.getLogger().setLevel(logging.DEBUG)
#logging.debug("Starting Program")
#logging.debug("Engine_invoker: getting engine instance")
#engine = Engine()
#logging.debug("Engine_invoker: Removing all previous data")
#engine.delete_all()
#logging.debug("Engine_invoker: invoking print_collector_names")
#engine.print_collector_names()
#logging.debug("Engine_invoker: obtaining nmap collector")
#c = engine.get_collector("nmap")
#logging.debug("Engine_invoker: starting collector")
#engine.start_collector(c)
#logging.debug("Engine_invoker: waiting 10 seconds")
#time.sleep(10)
#logging.debug("Engine_invoker: stopping collector")
#engine.stop_collector(c)
#logging.debug("Engine_invoker: parsing data")
#engine.parser(c)
#logging.debug("Engine_invoker: exporting data")
#os.makedirs(NMAP_DIR, exist_ok=True)
#engine.export(NMAP_DIR)
#logging.debug("Engine_invoker: Nmap Complete.")
#def execute_auditd_test():
#logging.getLogger().setLevel(logging.DEBUG)
#logging.debug("Starting Program")
#logging.debug("Engine_invoker: getting engine instance")
#engine = Engine()
#logging.debug("Engine_invoker: Removing all previous data")
#engine.delete_all()
#logging.debug("Engine_invoker: invoking print_collector_names")
#engine.print_collector_names()
#logging.debug("Engine_invoker: obtaining auditd collector")
#c = engine.get_collector("auditd")
#logging.debug("Engine_invoker: starting collector")
#engine.start_collector(c)
#logging.debug("Engine_invoker: waiting 10 seconds")
#time.sleep(30)
#logging.debug("Engine_invoker: stopping collector")
#engine.stop_collector(c)
#logging.debug("Engine_invoker: parsing data")
#engine.parser(c)
#logging.debug("Engine_invoker: exporting data")
#os.makedirs(AUDITD_DIR, exist_ok=True)
#engine.export(AUDITD_DIR)
#logging.debug("Engine_invoker: Auditd Complete.")
if __name__ == "__main__":
engine = Engine()
engine.delete_all()
execute_tshark_test()
execute_pykeylogger_test()
#execute_nmap_test()
#execute_auditd_test()