forked from Mr-Un1k0d3r/EDRs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParse.py
39 lines (32 loc) · 828 Bytes
/
Parse.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
#!/usr/bin/python3
# Usage: python3 Parse.py > out.csv
from os import listdir
from os.path import isfile, join
import os,sys
import tabulate
mypath = '.'
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
txtfiles = [f for f in onlyfiles if (".txt" in f)]
hooks = []
super = {}
for f in txtfiles:
j = open(f, 'r')
for i in j.readlines():
z = i.split(' ')[0]
if(not(z.strip() in hooks)):
hooks.append(z.strip())
# prepare array
hooks.sort()
for f in txtfiles:
j = open(f, 'r')
edr = f.split('.')[0]
super[edr] = {}
for h in hooks:
super[edr][h.strip()] = "FALSE"
for i in j.readlines():
z = i.split(' ')[0]
super[edr][z.strip()] = "TRUE"
header = "{},{}".format('EDR',','.join(hooks))
print(header)
for edr in super.keys():
print('{},{}'.format(edr,','.join(super[edr].values())))