Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for huorong sysdiag version 6 & some rule tweak #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rules/Suspicious.RunFromSusPath/auto.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"action_type": 16,
"treatment": 0
}
],
"*\\Windows\\system32\\svchost.exe": [
{
"res_path": "*\\ProgramData\\MEGAsync\\MEGAupdater.exe",
"montype": 0,
"action_type": 16,
"treatment": 0,
"cmdline": "*\\Windows\\system32\\svchost.exe -k netsvcs -p -s Schedule",
"p_procname": "*\\Windows\\System32\\services.exe"
}
]
}
}
13 changes: 12 additions & 1 deletion rules/Suspicious.ScriptHost/auto.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
"action_type": 16,
"treatment": 0
}
]
],
"*\\Windows\\system32\\svchost.exe": [
{
"res_path": "*\\Windows\\Sys?????\\wscript.exe",
"res_cmdline": "*:\\Windows\\System????\\Wscript.exe /B /NoLogo *\\Program Files\\Intel\\SUR\\QUEENCREEK\\x64\\task.vbs",
"montype": 0,
"action_type": 16,
"treatment": 0,
"cmdline": "*\\Windows\\system32\\svchost.exe -k netsvcs -p -s Schedule",
"p_procname": "*\\Windows\\System32\\services.exe"
}
]
}
}
17 changes: 15 additions & 2 deletions scripts/merge_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def main(input_path:str, output_path:str):
"""
# sum of rules and auto
rule_sum_dict = dict(json.loads(
'{"ver":"5.0","tag":"hipsuser","data":[]}'))
'{"ver":"6.0","tag":"hipsuser","data":[]}'))
auto_sum_dict = dict(json.loads(
'{"ver":"5.0","tag":"hipsuser_auto","data":{}}'))
'{"ver":"6.0","tag":"hipsuser_auto","data":{}}'))

for path, dirs, files in sorted(os.walk(input_path)):
for filename in files:
Expand All @@ -36,6 +36,13 @@ def main(input_path:str, output_path:str):
print("Merging file: %s" % rule_full_path)
# loop each rule in sub rule files
for each_rule in rule_dict["data"]:
# fix the blanks(v6)
each_rule.setdefault("cmdline", "*")
each_rule.setdefault("p_procname", "*")
each_rule.setdefault("p_cmdline", "*")
for policy in each_rule["policies"]:
policy.setdefault("res_cmdline", "*")

rule_sum_dict["data"] = rule_sum_dict["data"] + \
[each_rule] # add them up

Expand All @@ -45,6 +52,12 @@ def main(input_path:str, output_path:str):
print("Merging file: %s" % auto_full_path)
# loop each auto in sub auto files
for each_key in dict(auto_dict["data"]).keys():
# fix the blanks(v6)
for task in auto_dict["data"][each_key]:
task.setdefault("res_cmdline", "*")
task.setdefault("cmdline", '*')
task.setdefault("p_procname",'*')
task.setdefault("p_cmdline",'*')
# check if key already exist
if dict(auto_sum_dict["data"]).get(each_key) is None:
# frist one
Expand Down