2025-10-15 20:59:22 +00:00
|
|
|
import argparse
|
|
|
|
|
import re
|
|
|
|
|
|
2025-10-15 21:15:47 +00:00
|
|
|
def main() -> None:
|
2025-10-15 20:59:22 +00:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
parser.add_argument("path", type=str, help="Input file path")
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
regex = r"(\:\n)(.*?)(^[^\n]+\n[^\n]+result_.*?\n\n)"
|
2025-10-15 21:15:47 +00:00
|
|
|
subst = "\\g<1><b>\\g<2></b><span style=\"color:grey\">\\g<3></span>"
|
2025-10-15 20:59:22 +00:00
|
|
|
|
|
|
|
|
with open(args.path, 'rt') as f:
|
|
|
|
|
text = f.read()
|
|
|
|
|
|
|
|
|
|
outp_flag = "Disassembly of section .text" not in text
|
|
|
|
|
|
2025-10-15 21:15:47 +00:00
|
|
|
text = text.replace('\t', ' ' * 4)
|
2025-10-15 20:59:22 +00:00
|
|
|
text = text.replace('>', '>')
|
|
|
|
|
text = text.replace('<', '<')
|
|
|
|
|
|
|
|
|
|
text = re.sub(regex, subst, text, 0, re.MULTILINE | re.DOTALL)
|
|
|
|
|
|
2025-10-15 21:15:47 +00:00
|
|
|
text = re.sub(r" +", " ", text, 0, re.MULTILINE | re.DOTALL)
|
|
|
|
|
|
2025-10-15 20:59:22 +00:00
|
|
|
print('<code>')
|
|
|
|
|
for line in text.splitlines():
|
|
|
|
|
if outp_flag:
|
2025-10-15 21:15:47 +00:00
|
|
|
print(line + '<br>')
|
2025-10-15 20:59:22 +00:00
|
|
|
|
|
|
|
|
if "Disassembly of section .text:" in line:
|
|
|
|
|
outp_flag = True
|
|
|
|
|
|
|
|
|
|
print('</code>')
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2025-10-15 21:15:47 +00:00
|
|
|
main()
|