pyflashkit 1.0.0__py3-none-any.whl
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.
- flashkit/__init__.py +54 -0
- flashkit/abc/__init__.py +79 -0
- flashkit/abc/builder.py +847 -0
- flashkit/abc/constants.py +198 -0
- flashkit/abc/disasm.py +364 -0
- flashkit/abc/parser.py +434 -0
- flashkit/abc/types.py +275 -0
- flashkit/abc/writer.py +230 -0
- flashkit/analysis/__init__.py +28 -0
- flashkit/analysis/call_graph.py +317 -0
- flashkit/analysis/inheritance.py +267 -0
- flashkit/analysis/references.py +371 -0
- flashkit/analysis/strings.py +299 -0
- flashkit/cli/__init__.py +75 -0
- flashkit/cli/_util.py +52 -0
- flashkit/cli/build.py +36 -0
- flashkit/cli/callees.py +30 -0
- flashkit/cli/callers.py +30 -0
- flashkit/cli/class_cmd.py +83 -0
- flashkit/cli/classes.py +71 -0
- flashkit/cli/disasm.py +77 -0
- flashkit/cli/extract.py +36 -0
- flashkit/cli/info.py +41 -0
- flashkit/cli/packages.py +30 -0
- flashkit/cli/refs.py +31 -0
- flashkit/cli/strings.py +58 -0
- flashkit/cli/tags.py +32 -0
- flashkit/cli/tree.py +52 -0
- flashkit/errors.py +33 -0
- flashkit/info/__init__.py +31 -0
- flashkit/info/class_info.py +176 -0
- flashkit/info/member_info.py +275 -0
- flashkit/info/package_info.py +60 -0
- flashkit/search/__init__.py +16 -0
- flashkit/search/search.py +456 -0
- flashkit/swf/__init__.py +66 -0
- flashkit/swf/builder.py +283 -0
- flashkit/swf/parser.py +164 -0
- flashkit/swf/tags.py +120 -0
- flashkit/workspace/__init__.py +20 -0
- flashkit/workspace/resource.py +189 -0
- flashkit/workspace/workspace.py +232 -0
- pyflashkit-1.0.0.dist-info/METADATA +281 -0
- pyflashkit-1.0.0.dist-info/RECORD +48 -0
- pyflashkit-1.0.0.dist-info/WHEEL +5 -0
- pyflashkit-1.0.0.dist-info/entry_points.txt +2 -0
- pyflashkit-1.0.0.dist-info/licenses/LICENSE +21 -0
- pyflashkit-1.0.0.dist-info/top_level.txt +1 -0
flashkit/__init__.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
flashkit — SWF/ABC toolkit for parsing, analyzing, and manipulating Flash files.
|
|
3
|
+
|
|
4
|
+
A Python library for working with Adobe Flash SWF containers and AVM2
|
|
5
|
+
bytecode. Provides low-level binary parsing with round-trip fidelity,
|
|
6
|
+
a rich resolved class model, and analysis tools for inheritance graphs,
|
|
7
|
+
call graphs, cross-references, and string search.
|
|
8
|
+
|
|
9
|
+
Packages:
|
|
10
|
+
swf: SWF container format (parse, build, tag types).
|
|
11
|
+
abc: AVM2 bytecode (parse, write, constants, data types).
|
|
12
|
+
info: Rich resolved model (ClassInfo, FieldInfo, MethodInfo).
|
|
13
|
+
workspace: Loaded binary workspace (SWF/SWZ resources).
|
|
14
|
+
analysis: Inheritance graph, call graph, references, strings.
|
|
15
|
+
search: Query engine for workspace content.
|
|
16
|
+
|
|
17
|
+
Quick start::
|
|
18
|
+
|
|
19
|
+
from flashkit import parse_swf, parse_abc, serialize_abc
|
|
20
|
+
|
|
21
|
+
header, tags, version, length = parse_swf(swf_bytes)
|
|
22
|
+
abc = parse_abc(abc_bytes)
|
|
23
|
+
output = serialize_abc(abc)
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
__version__ = "1.0.0"
|
|
27
|
+
|
|
28
|
+
from .errors import (
|
|
29
|
+
FlashkitError, ParseError, SWFParseError,
|
|
30
|
+
ABCParseError, SerializeError, ResourceError,
|
|
31
|
+
)
|
|
32
|
+
from .swf.parser import parse_swf
|
|
33
|
+
from .swf.builder import rebuild_swf, make_doabc2_tag
|
|
34
|
+
from .abc.parser import parse_abc
|
|
35
|
+
from .abc.writer import serialize_abc
|
|
36
|
+
from .abc.types import AbcFile
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"__version__",
|
|
40
|
+
# Errors
|
|
41
|
+
"FlashkitError",
|
|
42
|
+
"ParseError",
|
|
43
|
+
"SWFParseError",
|
|
44
|
+
"ABCParseError",
|
|
45
|
+
"SerializeError",
|
|
46
|
+
"ResourceError",
|
|
47
|
+
# Core API
|
|
48
|
+
"parse_swf",
|
|
49
|
+
"rebuild_swf",
|
|
50
|
+
"make_doabc2_tag",
|
|
51
|
+
"parse_abc",
|
|
52
|
+
"serialize_abc",
|
|
53
|
+
"AbcFile",
|
|
54
|
+
]
|
flashkit/abc/__init__.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AVM2 bytecode parsing and serialization.
|
|
3
|
+
|
|
4
|
+
This package handles the ABC (ActionScript Byte Code) format — the bytecode
|
|
5
|
+
that runs on Adobe's AVM2 virtual machine inside Flash Player and Adobe AIR.
|
|
6
|
+
|
|
7
|
+
Quick start::
|
|
8
|
+
|
|
9
|
+
from flashkit.abc import parse_abc, serialize_abc, AbcFile
|
|
10
|
+
|
|
11
|
+
abc = parse_abc(raw_bytes)
|
|
12
|
+
print(f"Classes: {len(abc.instances)}")
|
|
13
|
+
output = serialize_abc(abc)
|
|
14
|
+
assert output == raw_bytes # round-trip fidelity
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .types import (
|
|
18
|
+
AbcFile,
|
|
19
|
+
NamespaceInfo,
|
|
20
|
+
NsSetInfo,
|
|
21
|
+
MultinameInfo,
|
|
22
|
+
MethodInfo,
|
|
23
|
+
MetadataInfo,
|
|
24
|
+
TraitInfo,
|
|
25
|
+
InstanceInfo,
|
|
26
|
+
ClassInfo,
|
|
27
|
+
ScriptInfo,
|
|
28
|
+
ExceptionInfo,
|
|
29
|
+
MethodBodyInfo,
|
|
30
|
+
)
|
|
31
|
+
from .parser import (
|
|
32
|
+
parse_abc,
|
|
33
|
+
read_u30,
|
|
34
|
+
read_s32,
|
|
35
|
+
write_u30,
|
|
36
|
+
write_s32,
|
|
37
|
+
s24,
|
|
38
|
+
read_u8,
|
|
39
|
+
read_u16,
|
|
40
|
+
read_u32,
|
|
41
|
+
read_d64,
|
|
42
|
+
)
|
|
43
|
+
from .writer import serialize_abc
|
|
44
|
+
from .disasm import Instruction, decode_instructions
|
|
45
|
+
from .builder import AbcBuilder
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
# Types
|
|
49
|
+
"AbcFile",
|
|
50
|
+
"NamespaceInfo",
|
|
51
|
+
"NsSetInfo",
|
|
52
|
+
"MultinameInfo",
|
|
53
|
+
"MethodInfo",
|
|
54
|
+
"MetadataInfo",
|
|
55
|
+
"TraitInfo",
|
|
56
|
+
"InstanceInfo",
|
|
57
|
+
"ClassInfo",
|
|
58
|
+
"ScriptInfo",
|
|
59
|
+
"ExceptionInfo",
|
|
60
|
+
"MethodBodyInfo",
|
|
61
|
+
# Parser
|
|
62
|
+
"parse_abc",
|
|
63
|
+
"read_u30",
|
|
64
|
+
"read_s32",
|
|
65
|
+
"write_u30",
|
|
66
|
+
"write_s32",
|
|
67
|
+
"s24",
|
|
68
|
+
"read_u8",
|
|
69
|
+
"read_u16",
|
|
70
|
+
"read_u32",
|
|
71
|
+
"read_d64",
|
|
72
|
+
# Writer
|
|
73
|
+
"serialize_abc",
|
|
74
|
+
# Disassembler
|
|
75
|
+
"Instruction",
|
|
76
|
+
"decode_instructions",
|
|
77
|
+
# Builder
|
|
78
|
+
"AbcBuilder",
|
|
79
|
+
]
|