-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
80 lines (78 loc) · 3.19 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="python pyc disassembler decompiler opcode bytecode marshal pyinstaller reverse engineering"/>
<meta name="description" content="A Python Disassembler that disassembles compiled Python files into sequences of opcodes locally. Currently supporting Python 2 and 3. Supports .pyc files and PyInstaller executable files. Decompiler is being developed.">
<meta property="og:title" content=".pyc Disassembler">
<meta property="og:description" content="A Python Disassembler that disassembles compiled Python files into sequences of opcodes locally. Currently supporting Python 2 and 3. Supports .pyc files and PyInstaller executable files. Decompiler is being developed.">
<meta property="og:url" content="https://twy.name/Tools/pyc">
<meta property="og:type" content="article">
<title>.pyc Disassembler</title>
<link rel="canonical" href="https://twy.name/Tools/pyc">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": ".pyc Disassembler",
"description": "A Python Disassembler that disassembles compiled Python files into sequences of opcodes locally. Currently supporting Python 2 and 3. Supports .pyc files and PyInstaller executable files. Decompiler is being developed.",
"url": "https://twy.name/Tools/pyc",
"author": [
{
"@type": "Person",
"name": "TWY"
}
]
}
</script>
<title>.pyc Disassembler</title>
<link rel="stylesheet" type="text/css" href="../file_handler.css">
</head>
<body>
<script src="../byte_reader.js"></script>
<script src="python_versions.js"></script>
<script src="dis.js"></script>
<script src="marshal.js"></script>
<script src="pyc.js"></script>
<script src="pyinstaller.js"></script>
<script>
function displayEntry(entry) {
if (entry.type === "code") {
entry.loaded = entry.disassembly !== undefined;
return () => {
if (entry.disassembly.lines !== undefined && entry.disassembly.lines.length > 0) {
output.textContent = entry.disassembly.lines.join("\n");
} else {
output.textContent = "Cannot disassemble this file";
}
};
}
return null;
}
async function handleFile(entry) {
var bytes = entry.value;
let magic = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24);
if ((magic & 0xffff0000) == 0x0a0d0000) { // xx xx \r \n
entry.li.addchildren(handleBytes_pyc(bytes, entry.content));
} else if (magic == 0x005a5950) { // 50 59 5A 00 (PYZ\0)
entry.li.addchildren(await handleBytes_pyinstaller_pyz(bytes, entry.content, entry.encryption_key ?? null));
} else {
try {
entry.li.addchildren(await handleBytes_pyinstaller(bytes, entry.content));
} catch (e) {
console.error(e);
entry.content.push("Not a valid pyc file.");
entry.show_hex = true;
entry.li.classList.add("no_children");
}
}
}
async function handleEntry(entry) {
if (entry.type === "code") {
entry.disassembly = dis(entry.dict);
}
}
</script>
<script src="../file_handler.js"></script>
</body>
</html>