-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcfg_worker.py
More file actions
43 lines (36 loc) · 1.03 KB
/
Copy pathcfg_worker.py
File metadata and controls
43 lines (36 loc) · 1.03 KB
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
import xbin
"""
xbin Standalone CFG Plugin Example
==================================
This is a truly standalone worker that can live in its own repository.
"""
@xbin.plugin(
name="external_cfg",
category="cfg_generation",
version="1.0"
)
class ExternalCFGWorker:
def on_new_binary(self, path, analyses):
# Category-aware: only run if relevant
if "cfg_generation" not in analyses:
return
print(f"[*] Generating CFG for: {path}")
# Mock CFG data
cfg_data = {
"nodes": [
{"id": "0x401000", "label": "main"},
{"id": "0x401010", "label": "init_session"}
],
"edges": [
{"source": "0x401000", "target": "0x401010"}
]
}
# Use the clean module-level API
xbin.post_result(
item_key="0x401000",
data=cfg_data,
confidence=0.85
)
print("[+] CFG posted.")
if __name__ == "__main__":
xbin.start_worker()