CAPE-parsers 0.1.51__tar.gz → 0.1.53__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/PKG-INFO +1 -1
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/MonsterV2.py +6 -9
- cape_parsers-0.1.53/cape_parsers/CAPE/community/MyKings.py +52 -0
- cape_parsers-0.1.53/cape_parsers/CAPE/community/WinosStager.py +75 -0
- cape_parsers-0.1.53/cape_parsers/CAPE/core/Rhadamanthys.py +296 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/pyproject.toml +1 -1
- cape_parsers-0.1.51/cape_parsers/CAPE/core/Rhadamanthys.py +0 -190
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/LICENSE +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/README.md +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/AgentTesla.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Amadey.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Arkei.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/AsyncRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/AuroraStealer.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Carbanak.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/CobaltStrikeBeacon.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/CobaltStrikeStager.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/DCRat.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Fareit.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/KoiLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/LokiBot.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Lumma.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/NanoCore.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Nighthawk.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Njrat.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/PhemedroneStealer.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/QuasarRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/README.md +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Snake.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/SparkRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/Stealc.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/VenomRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/XWorm.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/XenoRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/AdaptixBeacon.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/AuraStealer.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Azorult.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/BitPaymer.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/BlackDropper.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Blister.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/BruteRatel.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/BumbleBee.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/DarkGate.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/DoppelPaymer.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/DridexLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Formbook.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/GuLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/IcedID.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/IcedIDLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Latrodectus.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Oyster.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/PikaBot.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/PlugX.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/QakBot.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Quickbind.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/README.md +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/RedLine.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Remcos.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/SmokeLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Socks5Systemz.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/SquirrelWaffle.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Strrat.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/WarzoneRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/Zloader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/core/test_cape.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/RATDecoders/README.md +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/RATDecoders/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/RATDecoders/test_rats.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/BackOffLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/BackOffPOS.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/BlackNix.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/BuerLoader.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/ChChes.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Emotet.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Enfal.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/EvilGrab.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Greame.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Hancitor.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/HttpBrowser.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/JavaDropper.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Nymaim.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Pandora.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/PoisonIvy.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/PredatorPain.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Punisher.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/RCSession.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/REvil.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/RedLeaf.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Retefe.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/Rozena.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/SmallNet.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/TSCookie.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/TrickBot.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/UrsnifV3.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/_ShadowTech.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/_VirusRat.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/_jRat.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/unrecom.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/deprecated/xRAT.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/malduck/LICENSE +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/malduck/README.md +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/malduck/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/malduck/test_malduck.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/mwcp/README.md +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/mwcp/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/mwcp/test_mwcp.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/__init__.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/aplib.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/blzpack.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/blzpack_lib.so +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/dotnet_utils.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/lznt1.py +0 -0
- {cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/utils/strings.py +0 -0
|
@@ -14,15 +14,12 @@ RULE_SOURCE = """rule MonsterV2Config
|
|
|
14
14
|
author = "doomedraven,YungBinary"
|
|
15
15
|
strings:
|
|
16
16
|
$chunk_1 = {
|
|
17
|
-
41 B8
|
|
18
|
-
48 8D 15 ?? ?? ??
|
|
19
|
-
48 8B
|
|
20
|
-
E8 ?? ?? ?? ??
|
|
21
|
-
|
|
22
|
-
48
|
|
23
|
-
48 89 6C 24 ??
|
|
24
|
-
4C 8B C7
|
|
25
|
-
48 8D 54 24 ??
|
|
17
|
+
41 B8 0E 04 00 00
|
|
18
|
+
48 8D 15 ?? ?? ?? 00
|
|
19
|
+
48 8B C?
|
|
20
|
+
E8 ?? ?? ?? ?? [3-17]
|
|
21
|
+
4C 8B C?
|
|
22
|
+
48 8D 54 24 28
|
|
26
23
|
48 8B CE
|
|
27
24
|
E8 ?? ?? ?? ??
|
|
28
25
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Description: MyKings AKA Smominru config parser
|
|
3
|
+
Author: x.com/YungBinary
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from contextlib import suppress
|
|
7
|
+
import json
|
|
8
|
+
import re
|
|
9
|
+
import base64
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def contains_non_printable(byte_array):
|
|
13
|
+
for byte in byte_array:
|
|
14
|
+
if not chr(byte).isprintable():
|
|
15
|
+
return True
|
|
16
|
+
return False
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def extract_base64_strings(data: bytes, minchars: int, maxchars: int) -> list:
|
|
20
|
+
pattern = b"([A-Za-z0-9+/=]{" + str(minchars).encode() + b"," + str(maxchars).encode() + b"})\x00{4}"
|
|
21
|
+
strings = []
|
|
22
|
+
for string in re.findall(pattern, data):
|
|
23
|
+
decoded_string = base64_and_printable(string.decode())
|
|
24
|
+
if decoded_string:
|
|
25
|
+
strings.append(decoded_string)
|
|
26
|
+
return strings
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def base64_and_printable(b64_string: str):
|
|
30
|
+
with suppress(Exception):
|
|
31
|
+
decoded_bytes = base64.b64decode(b64_string)
|
|
32
|
+
if not contains_non_printable(decoded_bytes):
|
|
33
|
+
return decoded_bytes.decode('ascii')
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def extract_config(data: bytes) -> dict:
|
|
37
|
+
config_dict = {}
|
|
38
|
+
with suppress(Exception):
|
|
39
|
+
cncs = extract_base64_strings(data, 12, 60)
|
|
40
|
+
if cncs:
|
|
41
|
+
# as they don't have schema they going under raw
|
|
42
|
+
config_dict["raw"] = {"CNCs": cncs}
|
|
43
|
+
return config_dict
|
|
44
|
+
|
|
45
|
+
return {}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
import sys
|
|
50
|
+
|
|
51
|
+
with open(sys.argv[1], "rb") as f:
|
|
52
|
+
print(json.dumps(extract_config(f.read()), indent=4))
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Description: Winos 4.0 "OnlineModule" config parser
|
|
3
|
+
Author: x.com/YungBinary
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from contextlib import suppress
|
|
7
|
+
import re
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
CONFIG_KEY_MAP = {
|
|
11
|
+
"dd": "execution_delay_seconds",
|
|
12
|
+
"cl": "communication_interval_seconds",
|
|
13
|
+
"bb": "version",
|
|
14
|
+
"bz": "comment",
|
|
15
|
+
"jp": "keylogger",
|
|
16
|
+
"bh": "end_bluescreen",
|
|
17
|
+
"ll": "anti_traffic_monitoring",
|
|
18
|
+
"dl": "entrypoint",
|
|
19
|
+
"sh": "process_daemon",
|
|
20
|
+
"kl": "process_hollowing"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def find_config(data):
|
|
25
|
+
start = ":db|".encode("utf-16le")
|
|
26
|
+
end = ":1p|".encode("utf-16le")
|
|
27
|
+
pattern = re.compile(re.escape(start) + b".*?" + re.escape(end), re.DOTALL)
|
|
28
|
+
match = pattern.search(data)
|
|
29
|
+
if match:
|
|
30
|
+
return match.group(0).decode("utf-16le")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def extract_config(data: bytes) -> dict:
|
|
34
|
+
config_dict = {}
|
|
35
|
+
final_config = {}
|
|
36
|
+
|
|
37
|
+
with suppress(Exception):
|
|
38
|
+
config = find_config(data)
|
|
39
|
+
if not config:
|
|
40
|
+
return config_dict
|
|
41
|
+
|
|
42
|
+
# Reverse the config string, which is delimited by '|'
|
|
43
|
+
config = config[::-1]
|
|
44
|
+
# Remove leading/trailing pipes and split into key/value pairs
|
|
45
|
+
elements = [element for element in config.strip('|').split('|') if ':' in element]
|
|
46
|
+
# Split each element for key : value in a dictionary
|
|
47
|
+
config_dict = dict(element.split(':', 1) for element in elements)
|
|
48
|
+
if config_dict:
|
|
49
|
+
# Handle extraction and formatting of CNCs
|
|
50
|
+
for i in range(1, 4):
|
|
51
|
+
p, o, t = config_dict.get(f"p{i}"), config_dict.get(f"o{i}"), config_dict.get(f"t{i}")
|
|
52
|
+
if p and p != "127.0.0.1" and o:
|
|
53
|
+
protocol = {"0": "udp", "1": "tcp"}.get(t)
|
|
54
|
+
if protocol:
|
|
55
|
+
cnc = f"{protocol}://{p}:{o}"
|
|
56
|
+
final_config.setdefault("CNCs", []).append(cnc)
|
|
57
|
+
|
|
58
|
+
if "CNCs" not in final_config:
|
|
59
|
+
return {}
|
|
60
|
+
|
|
61
|
+
final_config["CNCs"] = list(set(final_config["CNCs"]))
|
|
62
|
+
# Extract campaign ID
|
|
63
|
+
final_config["campaign_id"] = "default" if config_dict["fz"] == "\u9ed8\u8ba4" else config_dict["fz"]
|
|
64
|
+
|
|
65
|
+
# Map keys, e.g. dd -> execution_delay_seconds
|
|
66
|
+
final_config["raw"] = {v: config_dict[k] for k, v in CONFIG_KEY_MAP.items() if k in config_dict}
|
|
67
|
+
|
|
68
|
+
return final_config
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
import sys
|
|
73
|
+
|
|
74
|
+
with open(sys.argv[1], "rb") as f:
|
|
75
|
+
print(extract_config(f.read()))
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import struct
|
|
2
|
+
import base64
|
|
3
|
+
import re
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
DESCRIPTION = "Rhadamanthys parser"
|
|
8
|
+
AUTHOR = "kevoreilly, YungBinary"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def mask32(x):
|
|
12
|
+
return x & 0xFFFFFFFF
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def add32(x, y):
|
|
16
|
+
return mask32(x + y)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def left_rotate(x, n):
|
|
20
|
+
return mask32(x << n) | (x >> (32 - n))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def quarter_round(block, a, b, c, d):
|
|
24
|
+
block[a] = add32(block[a], block[b])
|
|
25
|
+
block[d] ^= block[a]
|
|
26
|
+
block[d] = left_rotate(block[d], 16)
|
|
27
|
+
block[c] = add32(block[c], block[d])
|
|
28
|
+
block[b] ^= block[c]
|
|
29
|
+
block[b] = left_rotate(block[b], 12)
|
|
30
|
+
block[a] = add32(block[a], block[b])
|
|
31
|
+
block[d] ^= block[a]
|
|
32
|
+
block[d] = left_rotate(block[d], 8)
|
|
33
|
+
block[c] = add32(block[c], block[d])
|
|
34
|
+
block[b] ^= block[c]
|
|
35
|
+
block[b] = left_rotate(block[b], 7)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def chacha20_permute(block):
|
|
39
|
+
for doubleround in range(10):
|
|
40
|
+
quarter_round(block, 0, 4, 8, 12)
|
|
41
|
+
quarter_round(block, 1, 5, 9, 13)
|
|
42
|
+
quarter_round(block, 2, 6, 10, 14)
|
|
43
|
+
quarter_round(block, 3, 7, 11, 15)
|
|
44
|
+
quarter_round(block, 0, 5, 10, 15)
|
|
45
|
+
quarter_round(block, 1, 6, 11, 12)
|
|
46
|
+
quarter_round(block, 2, 7, 8, 13)
|
|
47
|
+
quarter_round(block, 3, 4, 9, 14)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def words_from_bytes(b):
|
|
51
|
+
assert len(b) % 4 == 0
|
|
52
|
+
return [int.from_bytes(b[4 * i : 4 * i + 4], "little") for i in range(len(b) // 4)]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def bytes_from_words(w):
|
|
56
|
+
return b"".join(word.to_bytes(4, "little") for word in w)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def chacha20_block(key, nonce, blocknum):
|
|
60
|
+
# This implementation doesn't support 16-byte keys.
|
|
61
|
+
assert len(key) == 32
|
|
62
|
+
assert len(nonce) == 12
|
|
63
|
+
assert blocknum < 2**32
|
|
64
|
+
constant_words = words_from_bytes(b"expand 32-byte k")
|
|
65
|
+
key_words = words_from_bytes(key)
|
|
66
|
+
nonce_words = words_from_bytes(nonce)
|
|
67
|
+
# fmt: off
|
|
68
|
+
original_block = [
|
|
69
|
+
constant_words[0], constant_words[1], constant_words[2], constant_words[3],
|
|
70
|
+
key_words[0], key_words[1], key_words[2], key_words[3],
|
|
71
|
+
key_words[4], key_words[5], key_words[6], key_words[7],
|
|
72
|
+
mask32(blocknum), nonce_words[0], nonce_words[1], nonce_words[2],
|
|
73
|
+
]
|
|
74
|
+
# fmt: on
|
|
75
|
+
permuted_block = list(original_block)
|
|
76
|
+
chacha20_permute(permuted_block)
|
|
77
|
+
for i in range(len(permuted_block)):
|
|
78
|
+
permuted_block[i] = add32(permuted_block[i], original_block[i])
|
|
79
|
+
return bytes_from_words(permuted_block)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def chacha20_stream(key, nonce, length, blocknum):
|
|
83
|
+
output = bytearray()
|
|
84
|
+
while length > 0:
|
|
85
|
+
block = chacha20_block(key, nonce, blocknum)
|
|
86
|
+
take = min(length, len(block))
|
|
87
|
+
output.extend(block[:take])
|
|
88
|
+
length -= take
|
|
89
|
+
blocknum += 1
|
|
90
|
+
return output
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def decrypt_config(data):
|
|
94
|
+
decrypted_config = b""
|
|
95
|
+
data_len = len(data)
|
|
96
|
+
v3 = 0
|
|
97
|
+
while True:
|
|
98
|
+
v8 = 4
|
|
99
|
+
while v8:
|
|
100
|
+
if data_len <= (v3 + 4):
|
|
101
|
+
return decrypted_config
|
|
102
|
+
a = data[v3]
|
|
103
|
+
b = data[v3 + 4]
|
|
104
|
+
c = a ^ b
|
|
105
|
+
decrypted_config += bytes([c])
|
|
106
|
+
v8 -= 1
|
|
107
|
+
v3 += 1
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def chacha20_xor(custom_b64_decoded, key, nonce):
|
|
111
|
+
message_len = len(custom_b64_decoded)
|
|
112
|
+
key_stream = chacha20_stream(key, nonce, message_len, 0x80)
|
|
113
|
+
|
|
114
|
+
xor_key = bytearray()
|
|
115
|
+
for i in range(message_len):
|
|
116
|
+
xor_key.append(custom_b64_decoded[i] ^ key_stream[i])
|
|
117
|
+
|
|
118
|
+
return xor_key
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def extract_base64_strings(data, minchars, maxchars):
|
|
122
|
+
apat = b"([A-Za-z0-9-|]{" + str(minchars).encode() + b"," + str(maxchars).encode() + b"})\x00"
|
|
123
|
+
strings = [s.decode() for s in re.findall(apat, data)]
|
|
124
|
+
upat = b"((?:[A-Za-z0-9-|]\x00){" + str(minchars).encode() + b"," + str(maxchars).encode() + b"})\x00\x00"
|
|
125
|
+
strings.extend(ws.decode("utf-16le") for ws in re.findall(upat, data))
|
|
126
|
+
return strings
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def extract_c2_url(data):
|
|
130
|
+
pattern = b"(http[\x20-\x7e]+)\x00"
|
|
131
|
+
match = re.search(pattern, data)
|
|
132
|
+
if match:
|
|
133
|
+
return match.group(1).decode()
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def custom_b64decode(data: bytes, custom_alphabet: bytes):
|
|
137
|
+
"""Decodes base64 data using a custom alphabet."""
|
|
138
|
+
standard_alphabet = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
|
139
|
+
# Translate the data back to the standard alphabet before decoding
|
|
140
|
+
table = bytes.maketrans(custom_alphabet, standard_alphabet)
|
|
141
|
+
return base64.b64decode(data.translate(table), validate=True)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def lzo_noheader_decompress(data: bytes, decompressed_size: int):
|
|
145
|
+
src = 0
|
|
146
|
+
dst = bytearray()
|
|
147
|
+
length = len(data)
|
|
148
|
+
|
|
149
|
+
while src < length:
|
|
150
|
+
ctrl = data[src]
|
|
151
|
+
src += 1
|
|
152
|
+
|
|
153
|
+
if ctrl == 0x20:
|
|
154
|
+
match_len = data[src]
|
|
155
|
+
src += 1
|
|
156
|
+
start = len(dst) - match_len - 1
|
|
157
|
+
end = start + 3
|
|
158
|
+
#print(f"Control code: {hex(ctrl)}, Offset backtrack length: {hex(match_len)}, Current offset: {hex(len(dst))}, New offset: {hex(start)}")
|
|
159
|
+
dst.extend(dst[start:end])
|
|
160
|
+
|
|
161
|
+
elif ctrl >= 0xE0 or ctrl == 0x40:
|
|
162
|
+
x = ((ctrl >> 5) - 1) + 3
|
|
163
|
+
if ctrl >= 0xE0:
|
|
164
|
+
copy_len = data[src] + x
|
|
165
|
+
elif ctrl == 0x40:
|
|
166
|
+
copy_len = x
|
|
167
|
+
start = data[src + 1]
|
|
168
|
+
if ctrl == 0x40:
|
|
169
|
+
start = data[src]
|
|
170
|
+
if ctrl >= 0xE0:
|
|
171
|
+
src += 2
|
|
172
|
+
elif ctrl == 0x40:
|
|
173
|
+
src += 1
|
|
174
|
+
offset = len(dst) - start - 1
|
|
175
|
+
#print(f"Control code: {hex(ctrl)}, Offset backtrack length: {hex(start)}, Current offset: {hex(len(dst))}, New offset: {hex(len(dst) - start)}, Length to copy: {hex(copy_len)}")
|
|
176
|
+
dst.extend(dst[offset:offset+copy_len])
|
|
177
|
+
|
|
178
|
+
else:
|
|
179
|
+
# Literal run
|
|
180
|
+
literal_len = (ctrl & 0x1F) + 1
|
|
181
|
+
#print(f"Control code: {hex(ctrl)}, Literal length: {hex(literal_len)}")
|
|
182
|
+
dst.extend(data[src:src+literal_len])
|
|
183
|
+
src += literal_len
|
|
184
|
+
|
|
185
|
+
if len(dst) == decompressed_size:
|
|
186
|
+
return bytes(dst)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def parse_compression_header(config: bytes):
|
|
190
|
+
"""Parse compressed size, decompressed size, and data offset from config"""
|
|
191
|
+
|
|
192
|
+
# 0x2A when looking at the config in memory
|
|
193
|
+
base_offset = 0x26
|
|
194
|
+
|
|
195
|
+
# Compressed data offset field, for calculating the offset to the compressed buffer
|
|
196
|
+
comp_offset_field = config[base_offset]
|
|
197
|
+
# Number of bytes the field spans
|
|
198
|
+
comp_offset_size_len = (comp_offset_field & 3) + 1
|
|
199
|
+
for i in range(1, comp_offset_size_len):
|
|
200
|
+
comp_offset_field |= config[base_offset + i] << (8 * i)
|
|
201
|
+
|
|
202
|
+
comp_size_offset = comp_offset_field >> 2
|
|
203
|
+
|
|
204
|
+
# Compressed size field, for finding the size of the compressed buffer
|
|
205
|
+
comp_offset = base_offset + comp_offset_size_len
|
|
206
|
+
comp_size_field = config[comp_offset]
|
|
207
|
+
# Number of bytes the field spans
|
|
208
|
+
comp_size_len = (comp_size_field & 3) + 1
|
|
209
|
+
for i in range(1, comp_size_len):
|
|
210
|
+
comp_size_field |= config[comp_offset + i] << (8 * i)
|
|
211
|
+
|
|
212
|
+
# Decompressed size field
|
|
213
|
+
decomp_field_offset = base_offset + comp_offset_size_len + comp_size_len
|
|
214
|
+
decomp_size_field = config[decomp_field_offset]
|
|
215
|
+
# Number of bytes the field spans
|
|
216
|
+
decomp_field_len = (decomp_size_field & 3) + 1
|
|
217
|
+
for i in range(1, decomp_field_len):
|
|
218
|
+
decomp_size_field |= config[decomp_field_offset + i] << (8 * i)
|
|
219
|
+
|
|
220
|
+
# Calculate return values
|
|
221
|
+
decompressed_size = decomp_size_field >> 2
|
|
222
|
+
compressed_data_offset = decomp_field_offset + decomp_field_len + comp_size_offset
|
|
223
|
+
compressed_size_key = config[0x28] << 8
|
|
224
|
+
compressed_size = (compressed_size_key | comp_size_field) >> 2
|
|
225
|
+
compressed_data = config[compressed_data_offset : compressed_data_offset + compressed_size]
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
"compressed_size": compressed_size,
|
|
229
|
+
"decompressed_size": decompressed_size,
|
|
230
|
+
"compressed_data": compressed_data
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def extract_config(data):
|
|
235
|
+
config_dict = {}
|
|
236
|
+
magic = struct.unpack("I", data[:4])[0]
|
|
237
|
+
if magic == 0x59485221:
|
|
238
|
+
config_dict["CNCs"] = [data[24:].split(b"\0", 1)[0].decode()]
|
|
239
|
+
return config_dict
|
|
240
|
+
else:
|
|
241
|
+
key = b"\x52\xAB\xDF\x06\xB6\xB1\x3A\xC0\xDA\x2D\x22\xDC\x6C\xD2\xBE\x6C\x20\x17\x69\xE0\x12\xB5\xE6\xEC\x0E\xAB\x4C\x14\x73\x4A\xED\x51"
|
|
242
|
+
nonce = b"\x5F\x14\xD7\x9C\xFC\xFC\x43\x9E\xC3\x40\x6B\xBA"
|
|
243
|
+
|
|
244
|
+
custom_alphabets = [
|
|
245
|
+
b"ABC1fghijklmnop234NOPQRSTUVWXY567DEFGHIJKLMZ089abcdeqrstuvwxyz-|",
|
|
246
|
+
b"4NOPQRSTUVWXY567DdeEqrstuvwxyz-ABC1fghop23Fijkbc|lmnGHIJKLMZ089a"
|
|
247
|
+
]
|
|
248
|
+
|
|
249
|
+
# Extract base64 strings
|
|
250
|
+
extracted_strings = extract_base64_strings(data, 140, 256)
|
|
251
|
+
if not extracted_strings:
|
|
252
|
+
return config_dict
|
|
253
|
+
|
|
254
|
+
pattern = re.compile(b'.\x80')
|
|
255
|
+
for string in extracted_strings:
|
|
256
|
+
try:
|
|
257
|
+
custom_b64_decoded = custom_b64decode(string, custom_alphabets[0])
|
|
258
|
+
|
|
259
|
+
xor_key = chacha20_xor(custom_b64_decoded, key, nonce)
|
|
260
|
+
|
|
261
|
+
# Decrypted, but may still be the compressed malware configuration
|
|
262
|
+
config = decrypt_config(xor_key)
|
|
263
|
+
# Attempt to extract C2 url, only works in version prior to 0.9.2
|
|
264
|
+
c2_url = extract_c2_url(config)
|
|
265
|
+
if c2_url:
|
|
266
|
+
config_dict = {"CNCs": [c2_url]}
|
|
267
|
+
return config_dict
|
|
268
|
+
else:
|
|
269
|
+
# Handle new variants that compress the Command and Control server(s)
|
|
270
|
+
custom_b64_decoded = custom_b64decode(string, custom_alphabets[1])
|
|
271
|
+
xor_key = chacha20_xor(custom_b64_decoded, key, nonce)
|
|
272
|
+
config = decrypt_config(xor_key)
|
|
273
|
+
|
|
274
|
+
parsed = parse_compression_header(config)
|
|
275
|
+
if not parsed:
|
|
276
|
+
return config_dict
|
|
277
|
+
|
|
278
|
+
decompressed = lzo_noheader_decompress(parsed['compressed_data'], parsed['decompressed_size'])
|
|
279
|
+
|
|
280
|
+
cncs = [f"https://{chunk.decode()}" for chunk in pattern.split(decompressed) if chunk]
|
|
281
|
+
if cncs:
|
|
282
|
+
config_dict = {"CNCs": cncs}
|
|
283
|
+
return config_dict
|
|
284
|
+
|
|
285
|
+
except Exception:
|
|
286
|
+
continue
|
|
287
|
+
|
|
288
|
+
return config_dict
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
if __name__ == "__main__":
|
|
292
|
+
import sys
|
|
293
|
+
|
|
294
|
+
with open(sys.argv[1], "rb") as f:
|
|
295
|
+
config_json = json.dumps(extract_config(f.read()), indent=4)
|
|
296
|
+
print(config_json)
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import struct
|
|
2
|
-
import base64
|
|
3
|
-
import re
|
|
4
|
-
import json
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
DESCRIPTION = "Rhadamanthys parser"
|
|
8
|
-
AUTHOR = "kevoreilly, YungBinary"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def mask32(x):
|
|
12
|
-
return x & 0xFFFFFFFF
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def add32(x, y):
|
|
16
|
-
return mask32(x + y)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def left_rotate(x, n):
|
|
20
|
-
return mask32(x << n) | (x >> (32 - n))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def quarter_round(block, a, b, c, d):
|
|
24
|
-
block[a] = add32(block[a], block[b])
|
|
25
|
-
block[d] ^= block[a]
|
|
26
|
-
block[d] = left_rotate(block[d], 16)
|
|
27
|
-
block[c] = add32(block[c], block[d])
|
|
28
|
-
block[b] ^= block[c]
|
|
29
|
-
block[b] = left_rotate(block[b], 12)
|
|
30
|
-
block[a] = add32(block[a], block[b])
|
|
31
|
-
block[d] ^= block[a]
|
|
32
|
-
block[d] = left_rotate(block[d], 8)
|
|
33
|
-
block[c] = add32(block[c], block[d])
|
|
34
|
-
block[b] ^= block[c]
|
|
35
|
-
block[b] = left_rotate(block[b], 7)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def chacha20_permute(block):
|
|
39
|
-
for doubleround in range(10):
|
|
40
|
-
quarter_round(block, 0, 4, 8, 12)
|
|
41
|
-
quarter_round(block, 1, 5, 9, 13)
|
|
42
|
-
quarter_round(block, 2, 6, 10, 14)
|
|
43
|
-
quarter_round(block, 3, 7, 11, 15)
|
|
44
|
-
quarter_round(block, 0, 5, 10, 15)
|
|
45
|
-
quarter_round(block, 1, 6, 11, 12)
|
|
46
|
-
quarter_round(block, 2, 7, 8, 13)
|
|
47
|
-
quarter_round(block, 3, 4, 9, 14)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def words_from_bytes(b):
|
|
51
|
-
assert len(b) % 4 == 0
|
|
52
|
-
return [int.from_bytes(b[4 * i : 4 * i + 4], "little") for i in range(len(b) // 4)]
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def bytes_from_words(w):
|
|
56
|
-
return b"".join(word.to_bytes(4, "little") for word in w)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def chacha20_block(key, nonce, blocknum):
|
|
60
|
-
# This implementation doesn't support 16-byte keys.
|
|
61
|
-
assert len(key) == 32
|
|
62
|
-
assert len(nonce) == 12
|
|
63
|
-
assert blocknum < 2**32
|
|
64
|
-
constant_words = words_from_bytes(b"expand 32-byte k")
|
|
65
|
-
key_words = words_from_bytes(key)
|
|
66
|
-
nonce_words = words_from_bytes(nonce)
|
|
67
|
-
# fmt: off
|
|
68
|
-
original_block = [
|
|
69
|
-
constant_words[0], constant_words[1], constant_words[2], constant_words[3],
|
|
70
|
-
key_words[0], key_words[1], key_words[2], key_words[3],
|
|
71
|
-
key_words[4], key_words[5], key_words[6], key_words[7],
|
|
72
|
-
mask32(blocknum), nonce_words[0], nonce_words[1], nonce_words[2],
|
|
73
|
-
]
|
|
74
|
-
# fmt: on
|
|
75
|
-
permuted_block = list(original_block)
|
|
76
|
-
chacha20_permute(permuted_block)
|
|
77
|
-
for i in range(len(permuted_block)):
|
|
78
|
-
permuted_block[i] = add32(permuted_block[i], original_block[i])
|
|
79
|
-
return bytes_from_words(permuted_block)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def chacha20_stream(key, nonce, length, blocknum):
|
|
83
|
-
output = bytearray()
|
|
84
|
-
while length > 0:
|
|
85
|
-
block = chacha20_block(key, nonce, blocknum)
|
|
86
|
-
take = min(length, len(block))
|
|
87
|
-
output.extend(block[:take])
|
|
88
|
-
length -= take
|
|
89
|
-
blocknum += 1
|
|
90
|
-
return output
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def decrypt_config(data):
|
|
94
|
-
decrypted_config = b"\x21\x52\x48\x59"
|
|
95
|
-
data_len = len(data)
|
|
96
|
-
v3 = 0
|
|
97
|
-
while True:
|
|
98
|
-
v8 = 4
|
|
99
|
-
while v8:
|
|
100
|
-
if data_len <= (v3 + 4):
|
|
101
|
-
return decrypted_config
|
|
102
|
-
a = data[v3]
|
|
103
|
-
b = data[v3 + 4]
|
|
104
|
-
c = a ^ b
|
|
105
|
-
decrypted_config += bytes([c])
|
|
106
|
-
v8 -= 1
|
|
107
|
-
v3 += 1
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def chacha20_xor(custom_b64_decoded, key, nonce):
|
|
111
|
-
message_len = len(custom_b64_decoded)
|
|
112
|
-
key_stream = chacha20_stream(key, nonce, message_len, 0x80)
|
|
113
|
-
|
|
114
|
-
xor_key = bytearray()
|
|
115
|
-
for i in range(message_len):
|
|
116
|
-
xor_key.append(custom_b64_decoded[i] ^ key_stream[i])
|
|
117
|
-
|
|
118
|
-
return xor_key
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
def extract_strings(data, minchars, maxchars):
|
|
122
|
-
apat = b"([\x20-\x7e]{" + str(minchars).encode() + b"," + str(maxchars).encode() + b"})\x00"
|
|
123
|
-
strings = [string.decode() for string in re.findall(apat, data)]
|
|
124
|
-
match = re.search(apat, data)
|
|
125
|
-
if not match:
|
|
126
|
-
return None
|
|
127
|
-
upat = b"((?:[\x20-\x7e][\x00]){" + str(minchars).encode() + b"," + str(maxchars).encode() + b"})\x00\x00"
|
|
128
|
-
strings.extend(str(ws.decode("utf-16le")) for ws in re.findall(upat, data))
|
|
129
|
-
return strings
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def extract_c2_url(data):
|
|
133
|
-
pattern = b"(http[\x20-\x7e]+)\x00"
|
|
134
|
-
match = re.search(pattern, data)
|
|
135
|
-
return match.group(1).decode()
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def is_potential_custom_base64(string):
|
|
139
|
-
custom_alphabet = "ABC1fghijklmnop234NOPQRSTUVWXY567DEFGHIJKLMZ089abcdeqrstuvwxyz-|"
|
|
140
|
-
for c in string:
|
|
141
|
-
if c not in custom_alphabet:
|
|
142
|
-
return False
|
|
143
|
-
return True
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def custom_b64decode(data):
|
|
147
|
-
"""Decodes base64 data using a custom alphabet."""
|
|
148
|
-
standard_alphabet = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
|
149
|
-
custom_alphabet = b"ABC1fghijklmnop234NOPQRSTUVWXY567DEFGHIJKLMZ089abcdeqrstuvwxyz-|"
|
|
150
|
-
# Translate the data back to the standard alphabet before decoding
|
|
151
|
-
table = bytes.maketrans(custom_alphabet, standard_alphabet)
|
|
152
|
-
return base64.b64decode(data.translate(table), validate=True)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def extract_config(data):
|
|
156
|
-
config_dict = {}
|
|
157
|
-
magic = struct.unpack("I", data[:4])[0]
|
|
158
|
-
if magic == 0x59485221:
|
|
159
|
-
config_dict["CNCs"] = [data[24:].split(b"\0", 1)[0].decode()]
|
|
160
|
-
return config_dict
|
|
161
|
-
else:
|
|
162
|
-
key = b"\x52\xAB\xDF\x06\xB6\xB1\x3A\xC0\xDA\x2D\x22\xDC\x6C\xD2\xBE\x6C\x20\x17\x69\xE0\x12\xB5\xE6\xEC\x0E\xAB\x4C\x14\x73\x4A\xED\x51"
|
|
163
|
-
nonce = b"\x5F\x14\xD7\x9C\xFC\xFC\x43\x9E\xC3\x40\x6B\xBA"
|
|
164
|
-
|
|
165
|
-
extracted_strings = extract_strings(data, 0x100, 0x100)
|
|
166
|
-
for string in extracted_strings:
|
|
167
|
-
try:
|
|
168
|
-
if not is_potential_custom_base64(string):
|
|
169
|
-
continue
|
|
170
|
-
|
|
171
|
-
custom_b64_decoded = custom_b64decode(string)
|
|
172
|
-
xor_key = chacha20_xor(custom_b64_decoded, key, nonce)
|
|
173
|
-
decrypted_config = decrypt_config(xor_key)
|
|
174
|
-
reexecution_delay = int.from_bytes(decrypted_config[5:7], byteorder="little")
|
|
175
|
-
|
|
176
|
-
c2_url = extract_c2_url(decrypted_config)
|
|
177
|
-
if not c2_url:
|
|
178
|
-
continue
|
|
179
|
-
config_dict = {"raw": {"Reexecution_delay": reexecution_delay}, "CNCs": [c2_url]}
|
|
180
|
-
return config_dict
|
|
181
|
-
except Exception:
|
|
182
|
-
continue
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if __name__ == "__main__":
|
|
186
|
-
import sys
|
|
187
|
-
|
|
188
|
-
with open(sys.argv[1], "rb") as f:
|
|
189
|
-
config_json = json.dumps(extract_config(f.read()), indent=4)
|
|
190
|
-
print(config_json)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/CobaltStrikeBeacon.py
RENAMED
|
File without changes
|
{cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/CobaltStrikeStager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cape_parsers-0.1.51 → cape_parsers-0.1.53}/cape_parsers/CAPE/community/PhemedroneStealer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|