-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyzer.py
More file actions
27 lines (20 loc) · 722 Bytes
/
analyzer.py
File metadata and controls
27 lines (20 loc) · 722 Bytes
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
from sus import SUSPICIOUS_RELATIONS
def analyze_process_list(df):
alerts = []
pid_to_name = dict(zip(df['PID'], df['Process Name']))
df['Parent Name'] = df['PPID'].map(pid_to_name).fillna('Unknown')
# Anomalies scan
for _, row in df.iterrows():
parent = row['Parent Name'].lower()
child = row['Process Name'].lower()
pid = row['PID']
ppid = row['PPID']
if parent in SUSPICIOUS_RELATIONS:
if child in SUSPICIOUS_RELATIONS[parent]:
alerts.append({
'Parent': parent,
'Child': child,
'PID': pid,
'PPID': ppid
})
return alerts, df