hypnguyen1209/offensive-claude / skills/malware-analysis
malware-analysis
UnverifiedUse when reverse-engineering or detecting malware — static triage + capa/YARA-X, emulation/DBI/.NET unpacking, dynamic/fileless/Volatility 3 memory analysis, C2 config extraction (Cobalt Strike/CAPE), C2 traffic detection (JA4+, beaconing)
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.0 KB |
| references/config-c2-extraction.md | markdown | 7.6 KB |
| references/dynamic-fileless-memory.md | markdown | 7.9 KB |
| references/network-c2-detection.md | markdown | 6.8 KB |
| references/static-triage-capa.md | markdown | 7.2 KB |
| references/unpacking-deobfuscation.md | markdown | 7.8 KB |
| references/yara-detection-engineering.md | markdown | 6.5 KB |
| scripts/auto_unpack.py | script | 6.8 KB |
| scripts/beacon_profiler.py | script | 4.6 KB |
| scripts/cs_config_extract.py | script | 5.0 KB |
| scripts/frida_unpack.js | script | 4.5 KB |
| scripts/mem_triage.py | script | 6.0 KB |
| scripts/triage.py | script | 9.0 KB |
| scripts/yara_gen.py | script | 5.9 KB |
scripts/beacon_profiler.py
View on GitHub#!/usr/bin/env python3
r"""
beacon_profiler.py - C2 beacon detection from PCAP / conn logs.
Identifies regular-interval beaconing by clustering inter-arrival times per
(src,dst,dport) flow and scoring periodicity (low coefficient of variation =
machine cadence). Surfaces sleep/jitter estimates, JA4-style TLS notes, and
flags long-lived low-volume outbound flows (classic implant behaviour).
Works on:
- .pcap/.pcapng (needs scapy)
- Zeek conn.log (--zeek conn.log) -> uses ts,id.orig_h,id.resp_h,id.resp_p
USAGE:
python3 beacon_profiler.py capture.pcap --min-beacons 6
python3 beacon_profiler.py --zeek conn.log
DEPENDENCIES: scapy (for pcap). Zeek mode is stdlib-only.
OPSEC (defensive use): purely passive analysis of captured traffic.
"""
import argparse
import statistics
import sys
from collections import defaultdict
def load_pcap(path):
try:
from scapy.all import rdpcap, IP, TCP, UDP
except ImportError:
sys.exit("pip install scapy (or use --zeek)")
flows = defaultdict(list)
sizes = defaultdict(list)
for pkt in rdpcap(path):
if IP not in pkt:
continue
ip = pkt[IP]
if TCP in pkt:
dport = pkt[TCP].dport
proto = "tcp"
elif UDP in pkt:
dport = pkt[UDP].dport
proto = "udp"
else:
continue
key = (ip.src, ip.dst, dport, proto)
flows[key].append(float(pkt.time))
sizes[key].append(len(pkt))
return flows, sizes
def load_zeek(path):
flows = defaultdict(list)
sizes = defaultdict(list)
cols = None
with open(path) as f:
for line in f:
if line.startswith("#fields"):
cols = line.strip().split("\t")[1:]
continue
if line.startswith("#") or not line.strip():
continue
if not cols:
continue
parts = line.rstrip("\n").split("\t")
row = dict(zip(cols, parts))
try:
ts = float(row["ts"])
key = (row["id.orig_h"], row["id.resp_h"], int(row["id.resp_p"]), row.get("proto", "tcp"))
except (KeyError, ValueError):
continue
flows[key].append(ts)
sizes[key].append(int(row.get("orig_bytes", 0) or 0))
return flows, sizes
def score_flow(times):
if len(times) < 3:
return None
times = sorted(times)
deltas = [b - a for a, b in zip(times, times[1:]) if (b - a) > 0.05]
if len(deltas) < 2:
return None
mean = statistics.mean(deltas)
if mean <= 0:
return None
stdev = statistics.pstdev(deltas)
cv = stdev / mean # coefficient of variation; low = periodic
# jitter estimate: CS jitter is +/- pct around sleep; approximate from spread
jitter_pct = min(99, round((stdev / mean) * 100)) if mean else 0
score = max(0.0, 1.0 - cv) # 1.0 = perfectly periodic
return {"count": len(deltas) + 1, "interval_s": round(mean, 2),
"stdev_s": round(stdev, 2), "cv": round(cv, 3),
"est_jitter_pct": jitter_pct, "beacon_score": round(score, 3)}
def main():
ap = argparse.ArgumentParser()
ap.add_argument("pcap", nargs="?")
ap.add_argument("--zeek")
ap.add_argument("--min-beacons", type=int, default=6)
ap.add_argument("--score-threshold", type=float, default=0.6)
a = ap.parse_args()
if a.zeek:
flows, sizes = load_zeek(a.zeek)
elif a.pcap:
flows, sizes = load_pcap(a.pcap)
else:
sys.exit("provide a pcap or --zeek conn.log")
results = []
for key, times in flows.items():
if len(times) < a.min_beacons:
continue
sc = score_flow(times)
if not sc or sc["beacon_score"] < a.score_threshold:
continue
sc["flow"] = f"{key[0]} -> {key[1]}:{key[2]}/{key[3]}"
szlist = sizes.get(key, [])
sc["avg_bytes"] = round(statistics.mean(szlist), 1) if szlist else 0
results.append(sc)
results.sort(key=lambda r: r["beacon_score"], reverse=True)
if not results:
print("[-] no periodic beaconing detected above threshold")
return
print(f"[+] {len(results)} suspected beacon flow(s):\n")
for r in results:
print(f" {r['flow']}")
print(f" score={r['beacon_score']} interval~{r['interval_s']}s "
f"jitter~{r['est_jitter_pct']}% beacons={r['count']} avg_bytes={r['avg_bytes']}")
if r["beacon_score"] > 0.9:
print(" [!] near-perfect cadence - low/no jitter implant or scheduled task")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |