diff --git a/examples/adcache_x86_windows_debug.py b/examples/adcache_x86_windows_debug.py index 2e4fdb7f..8728bcf9 100644 --- a/examples/adcache_x86_windows_debug.py +++ b/examples/adcache_x86_windows_debug.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys from zipfile import ZipFile diff --git a/examples/cachedlls_x8664_windows.py b/examples/cachedlls_x8664_windows.py index 39f07e99..92e9e11f 100644 --- a/examples/cachedlls_x8664_windows.py +++ b/examples/cachedlls_x8664_windows.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/crackme_x86_linux.py b/examples/crackme_x86_linux.py index abfa6078..ea6ebea0 100644 --- a/examples/crackme_x86_linux.py +++ b/examples/crackme_x86_linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os from unicorn import * diff --git a/examples/crackme_x86_windows.py b/examples/crackme_x86_windows.py index b71c4773..c5faa90e 100644 --- a/examples/crackme_x86_windows.py +++ b/examples/crackme_x86_windows.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn import * from unicorn.x86_const import * diff --git a/examples/crackme_x86_windows_auto.py b/examples/crackme_x86_windows_auto.py index e87ec0bb..2f7033b1 100644 --- a/examples/crackme_x86_windows_auto.py +++ b/examples/crackme_x86_windows_auto.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.x86_const import * diff --git a/examples/crackme_x86_windows_setcallback.py b/examples/crackme_x86_windows_setcallback.py index 028355a5..88d35ac0 100644 --- a/examples/crackme_x86_windows_setcallback.py +++ b/examples/crackme_x86_windows_setcallback.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/crackme_x86_windows_unpatch.py b/examples/crackme_x86_windows_unpatch.py index d9323410..743c18e8 100644 --- a/examples/crackme_x86_windows_unpatch.py +++ b/examples/crackme_x86_windows_unpatch.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.x86_const import * import sys diff --git a/examples/doogie_8086_crack.py b/examples/doogie_8086_crack.py index 959ba247..cffb92d3 100644 --- a/examples/doogie_8086_crack.py +++ b/examples/doogie_8086_crack.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, curses, math, struct, string, time, logging sys.path.append("..") diff --git a/examples/extensions/report/hello_x86_windows_json.py b/examples/extensions/report/hello_x86_windows_json.py index 73506bbf..b2b371d2 100644 --- a/examples/extensions/report/hello_x86_windows_json.py +++ b/examples/extensions/report/hello_x86_windows_json.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys diff --git a/examples/fuzzing/dlink_dir815/dir815_mips32el_linux.py b/examples/fuzzing/dlink_dir815/dir815_mips32el_linux.py index 6e2a041b..7c2fa84a 100644 --- a/examples/fuzzing/dlink_dir815/dir815_mips32el_linux.py +++ b/examples/fuzzing/dlink_dir815/dir815_mips32el_linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # Everything about the bug and firmware https://www.exploit-db.com/exploits/33863 diff --git a/examples/fuzzing/tenda_ac15/fuzz_tendaac15_httpd.py b/examples/fuzzing/tenda_ac15/fuzz_tendaac15_httpd.py index 263e2b0a..2e6e3204 100644 --- a/examples/fuzzing/tenda_ac15/fuzz_tendaac15_httpd.py +++ b/examples/fuzzing/tenda_ac15/fuzz_tendaac15_httpd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # 1. Download AC15 Firmware from https://down.tenda.com.cn/uploadfile/AC15/US_AC15V1.0BR_V15.03.05.19_multi_TD01.zip diff --git a/examples/fuzzing/tenda_ac15/saver_tendaac15_httpd.py b/examples/fuzzing/tenda_ac15/saver_tendaac15_httpd.py index febf80ab..518bda97 100644 --- a/examples/fuzzing/tenda_ac15/saver_tendaac15_httpd.py +++ b/examples/fuzzing/tenda_ac15/saver_tendaac15_httpd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # 1. Download AC15 Firmware from https://down.tenda.com.cn/uploadfile/AC15/US_AC15V1.0BR_V15.03.05.19_multi_TD01.zip diff --git a/examples/hello_8086_dos.py b/examples/hello_8086_dos.py index 377dbd02..4ef4151d 100644 --- a/examples/hello_8086_dos.py +++ b/examples/hello_8086_dos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/hello_arm_linux_custom_syscall.py b/examples/hello_arm_linux_custom_syscall.py index 0ab8de5d..889860de 100644 --- a/examples/hello_arm_linux_custom_syscall.py +++ b/examples/hello_arm_linux_custom_syscall.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/hello_arm_linux_debug.py b/examples/hello_arm_linux_debug.py index 88e11468..0e5cea22 100644 --- a/examples/hello_arm_linux_debug.py +++ b/examples/hello_arm_linux_debug.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/hello_arm_set_filter.py b/examples/hello_arm_set_filter.py index 0e1d2f7f..f17f350a 100644 --- a/examples/hello_arm_set_filter.py +++ b/examples/hello_arm_set_filter.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/hello_linuxx8664_intercept.py b/examples/hello_linuxx8664_intercept.py index 13045070..7a1ef0fa 100644 --- a/examples/hello_linuxx8664_intercept.py +++ b/examples/hello_linuxx8664_intercept.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/hello_mips32el_linux_debug.py b/examples/hello_mips32el_linux_debug.py index 3376ace9..46879fdf 100644 --- a/examples/hello_mips32el_linux_debug.py +++ b/examples/hello_mips32el_linux_debug.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys diff --git a/examples/hello_mips32el_linux_function_hook.py b/examples/hello_mips32el_linux_function_hook.py index 69dfec94..ec6c2d30 100644 --- a/examples/hello_mips32el_linux_function_hook.py +++ b/examples/hello_mips32el_linux_function_hook.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys diff --git a/examples/hello_x8664_gdb_macos.py b/examples/hello_x8664_gdb_macos.py index 79f6ea9a..53a0cb55 100644 --- a/examples/hello_x8664_gdb_macos.py +++ b/examples/hello_x8664_gdb_macos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/hello_x8664_linux_customapi.py b/examples/hello_x8664_linux_customapi.py index 43b4fdd4..3d2b3d43 100644 --- a/examples/hello_x8664_linux_customapi.py +++ b/examples/hello_x8664_linux_customapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/hello_x8664_linux_disasm.py b/examples/hello_x8664_linux_disasm.py index 3077a5b2..da481ada 100644 --- a/examples/hello_x8664_linux_disasm.py +++ b/examples/hello_x8664_linux_disasm.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn import * from capstone import * diff --git a/examples/hello_x8664_linux_part_exec.py b/examples/hello_x8664_linux_part_exec.py index b9a7ae03..553ec567 100644 --- a/examples/hello_x8664_linux_part_exec.py +++ b/examples/hello_x8664_linux_part_exec.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/hello_x8664_macos.py b/examples/hello_x8664_macos.py index 223ec2c2..13ec6e94 100644 --- a/examples/hello_x8664_macos.py +++ b/examples/hello_x8664_macos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/hello_x8664_windows_customapi.py b/examples/hello_x8664_windows_customapi.py index bb32ecc5..3bd1d3f2 100644 --- a/examples/hello_x8664_windows_customapi.py +++ b/examples/hello_x8664_windows_customapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, logging sys.path.append("..") diff --git a/examples/hello_x86_linux_fake_urandom.py b/examples/hello_x86_linux_fake_urandom.py index 68f83093..e3feef6e 100644 --- a/examples/hello_x86_linux_fake_urandom.py +++ b/examples/hello_x86_linux_fake_urandom.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling import * from qiling.os.mapper import QlFsMappedObject diff --git a/examples/mem_invalid_access.py b/examples/mem_invalid_access.py index ebb56524..c0606c6d 100644 --- a/examples/mem_invalid_access.py +++ b/examples/mem_invalid_access.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/multithreading_arm64_linux.py b/examples/multithreading_arm64_linux.py index 6d300c10..f1911700 100644 --- a/examples/multithreading_arm64_linux.py +++ b/examples/multithreading_arm64_linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/multithreading_mips32el_linux.py b/examples/multithreading_mips32el_linux.py index 05bf351a..e2f91d3c 100644 --- a/examples/multithreading_mips32el_linux.py +++ b/examples/multithreading_mips32el_linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/multithreading_x86_windows.py b/examples/multithreading_x86_windows.py index c0fa96a2..07fea0ae 100644 --- a/examples/multithreading_x86_windows.py +++ b/examples/multithreading_x86_windows.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/netgear_6220_mips32el_linux.py b/examples/netgear_6220_mips32el_linux.py index 85f5f490..5133575f 100644 --- a/examples/netgear_6220_mips32el_linux.py +++ b/examples/netgear_6220_mips32el_linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # After mapping /proc there will be a /dev/mtdblock11 missing and crash # To fix this, diff --git a/examples/ntQuerySystemInfo_x86.py b/examples/ntQuerySystemInfo_x86.py index 5016ba7f..ff16b74b 100644 --- a/examples/ntQuerySystemInfo_x86.py +++ b/examples/ntQuerySystemInfo_x86.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/petya_8086_crack.py b/examples/petya_8086_crack.py index cb2676e5..b9e0a9ec 100644 --- a/examples/petya_8086_crack.py +++ b/examples/petya_8086_crack.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") diff --git a/examples/regdemo_x86_windows.py b/examples/regdemo_x86_windows.py index a6ecae23..80260385 100644 --- a/examples/regdemo_x86_windows.py +++ b/examples/regdemo_x86_windows.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/sality.py b/examples/sality.py index 1298b916..4425cb99 100644 --- a/examples/sality.py +++ b/examples/sality.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, sys, logging diff --git a/examples/setexit_arm64_linux.py b/examples/setexit_arm64_linux.py index b9aafbe4..d637aac3 100644 --- a/examples/setexit_arm64_linux.py +++ b/examples/setexit_arm64_linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/shellcode_run.py b/examples/shellcode_run.py index 6b0d70d5..87070f99 100644 --- a/examples/shellcode_run.py +++ b/examples/shellcode_run.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from binascii import unhexlify import sys diff --git a/examples/simple_efi_x8664.py b/examples/simple_efi_x8664.py index f18351c9..3dda7294 100644 --- a/examples/simple_efi_x8664.py +++ b/examples/simple_efi_x8664.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys import pickle diff --git a/examples/tendaac1518_httpd.py b/examples/tendaac1518_httpd.py index 750cc91b..afa69c09 100644 --- a/examples/tendaac1518_httpd.py +++ b/examples/tendaac1518_httpd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # 1. Download AC15 Firmware from https://down.tenda.com.cn/uploadfile/AC15/US_AC15V1.0BR_V15.03.05.19_multi_TD01.zip diff --git a/examples/uefi_sanitized_heap.py b/examples/uefi_sanitized_heap.py index 4eb29fa8..0f51188d 100644 --- a/examples/uefi_sanitized_heap.py +++ b/examples/uefi_sanitized_heap.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, sys import sys diff --git a/examples/uselessdisk_x86_windows.py b/examples/uselessdisk_x86_windows.py index 2d5dffe5..6446f267 100644 --- a/examples/uselessdisk_x86_windows.py +++ b/examples/uselessdisk_x86_windows.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys diff --git a/examples/wannacry_x86_windows_hookaddress.py b/examples/wannacry_x86_windows_hookaddress.py index 3d35157b..10a580c2 100644 --- a/examples/wannacry_x86_windows_hookaddress.py +++ b/examples/wannacry_x86_windows_hookaddress.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys sys.path.append("..") from qiling import * diff --git a/examples/windows_trace.py b/examples/windows_trace.py index bba408ce..e5e1ac92 100644 --- a/examples/windows_trace.py +++ b/examples/windows_trace.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import argparse import sys diff --git a/qiling/arch/a8086.py b/qiling/arch/a8086.py index 64564d70..6bb78f71 100644 --- a/qiling/arch/a8086.py +++ b/qiling/arch/a8086.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + from unicorn import * from unicorn.x86_const import * diff --git a/qiling/arch/arch.py b/qiling/arch/arch.py index 3dcf66b9..b81ca3d9 100644 --- a/qiling/arch/arch.py +++ b/qiling/arch/arch.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from abc import ABC, abstractmethod import struct diff --git a/qiling/arch/arm.py b/qiling/arch/arm.py index d2d87faf..292c5ff1 100644 --- a/qiling/arch/arm.py +++ b/qiling/arch/arm.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging diff --git a/qiling/arch/arm64.py b/qiling/arch/arm64.py index b303c963..80f0e43f 100644 --- a/qiling/arch/arm64.py +++ b/qiling/arch/arm64.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn import * from unicorn.arm64_const import * diff --git a/qiling/arch/arm64_const.py b/qiling/arch/arm64_const.py index 13b75686..c706d10c 100644 --- a/qiling/arch/arm64_const.py +++ b/qiling/arch/arm64_const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.arm64_const import * diff --git a/qiling/arch/arm_const.py b/qiling/arch/arm_const.py index 45d7ebf2..db5e8882 100644 --- a/qiling/arch/arm_const.py +++ b/qiling/arch/arm_const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.arm_const import * diff --git a/qiling/arch/mips.py b/qiling/arch/mips.py index 9cdf848d..bb1ec046 100644 --- a/qiling/arch/mips.py +++ b/qiling/arch/mips.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn import * from unicorn.mips_const import * diff --git a/qiling/arch/mips_const.py b/qiling/arch/mips_const.py index 9bb4445e..8dd8d48a 100644 --- a/qiling/arch/mips_const.py +++ b/qiling/arch/mips_const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.mips_const import * diff --git a/qiling/arch/register.py b/qiling/arch/register.py index 103f086a..2ecaa5fe 100644 --- a/qiling/arch/register.py +++ b/qiling/arch/register.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# class QlRegisterManager(): """ diff --git a/qiling/arch/utils.py b/qiling/arch/utils.py index c0d457f3..a8010c94 100644 --- a/qiling/arch/utils.py +++ b/qiling/arch/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# """ This module is intended for general purpose functions that are only used in qiling.arch diff --git a/qiling/arch/x86.py b/qiling/arch/x86.py index f3b4ef11..54bac069 100644 --- a/qiling/arch/x86.py +++ b/qiling/arch/x86.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + from unicorn import * from unicorn.x86_const import * diff --git a/qiling/arch/x86_const.py b/qiling/arch/x86_const.py index 6786fc29..b93c437b 100644 --- a/qiling/arch/x86_const.py +++ b/qiling/arch/x86_const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.x86_const import * diff --git a/qiling/const.py b/qiling/const.py index ec2c6137..b54fc68b 100644 --- a/qiling/const.py +++ b/qiling/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from enum import IntEnum diff --git a/qiling/core.py b/qiling/core.py index 888395c9..9ffdb4b0 100644 --- a/qiling/core.py +++ b/qiling/core.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from configparser import ConfigParser import ctypes, logging, ntpath, os, pickle, platform diff --git a/qiling/core_hooks.py b/qiling/core_hooks.py index a0ac023b..1b6c5fd6 100644 --- a/qiling/core_hooks.py +++ b/qiling/core_hooks.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# ############################################## # These are part of the core.py Qiling class # diff --git a/qiling/core_struct.py b/qiling/core_struct.py index bb13de84..63041e8c 100644 --- a/qiling/core_struct.py +++ b/qiling/core_struct.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# ############################################## # These are part of the core.py Qiling class # @@ -10,6 +10,7 @@ ############################################## import struct + from .const import QL_ENDIAN from .exception import QlErrorStructConversion diff --git a/qiling/debugger/debugger.py b/qiling/debugger/debugger.py index 5f2c4673..233f655e 100644 --- a/qiling/debugger/debugger.py +++ b/qiling/debugger/debugger.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -from qiling import * +# + +from qiling import Qiling class QlDebugger(): diff --git a/qiling/debugger/disassember.py b/qiling/debugger/disassember.py index 037eeecd..d0467189 100644 --- a/qiling/debugger/disassember.py +++ b/qiling/debugger/disassember.py @@ -1,9 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + from elftools.elf.elffile import ELFFile -from qiling import * + +from qiling import Qiling from qiling.const import * from capstone import * diff --git a/qiling/debugger/gdb/gdb.py b/qiling/debugger/gdb/gdb.py index a1d9837d..89406fab 100644 --- a/qiling/debugger/gdb/gdb.py +++ b/qiling/debugger/gdb/gdb.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # gdbserver --remote-debug 0.0.0.0:9999 /path/to binary # documentation: according to https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Protocol.html#Remote-Protocol diff --git a/qiling/debugger/gdb/utils.py b/qiling/debugger/gdb/utils.py index 9a8fdc61..da23d2f5 100644 --- a/qiling/debugger/gdb/utils.py +++ b/qiling/debugger/gdb/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from unicorn import * diff --git a/qiling/debugger/qdb/frontend.py b/qiling/debugger/qdb/frontend.py index 34a01597..fa3a3841 100644 --- a/qiling/debugger/qdb/frontend.py +++ b/qiling/debugger/qdb/frontend.py @@ -1,14 +1,14 @@ #!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# import math, copy, os from contextlib import contextmanager from qiling.const import QL_ARCH - from .utils import dump_regs, get_arm_flags - - # class for colorful prints class color: CYAN = '\033[96m' diff --git a/qiling/debugger/qdb/qdb.py b/qiling/debugger/qdb/qdb.py index 0f821c6e..d72edda0 100644 --- a/qiling/debugger/qdb/qdb.py +++ b/qiling/debugger/qdb/qdb.py @@ -1,4 +1,7 @@ #!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# import cmd from functools import partial diff --git a/qiling/debugger/qdb/utils.py b/qiling/debugger/qdb/utils.py index ae168444..a4c628dd 100644 --- a/qiling/debugger/qdb/utils.py +++ b/qiling/debugger/qdb/utils.py @@ -1,4 +1,7 @@ #!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# from functools import partial @@ -7,7 +10,6 @@ from qiling.const import * CODE_END = True - def dump_regs(ql): if ql.archtype == QL_ARCH.MIPS: diff --git a/qiling/debugger/utils.py b/qiling/debugger/utils.py index c6b48023..5fa75e33 100644 --- a/qiling/debugger/utils.py +++ b/qiling/debugger/utils.py @@ -1,8 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -from qiling import * +# from elftools.common.exceptions import ELFError from elftools.common.py3compat import ( @@ -30,6 +29,8 @@ from elftools.elf.descriptions import ( from elftools.elf.constants import E_FLAGS from elftools.elf.constants import E_FLAGS_MASKS +from qiling import Qiling + class QlReadELF(object): def __init__(self, ql:Qiling, elf_stream): diff --git a/qiling/exception.py b/qiling/exception.py index c5d88df0..e6d46060 100644 --- a/qiling/exception.py +++ b/qiling/exception.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, traceback diff --git a/qiling/extensions/coverage/formats/base.py b/qiling/extensions/coverage/formats/base.py index 80e5c7a5..6cd4e865 100644 --- a/qiling/extensions/coverage/formats/base.py +++ b/qiling/extensions/coverage/formats/base.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from abc import ABC, abstractmethod + class QlBaseCoverage(ABC): """ An abstract base class for concrete code coverage collectors. diff --git a/qiling/extensions/coverage/formats/drcov.py b/qiling/extensions/coverage/formats/drcov.py index 7501ec4f..07d13043 100644 --- a/qiling/extensions/coverage/formats/drcov.py +++ b/qiling/extensions/coverage/formats/drcov.py @@ -1,12 +1,14 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from ctypes import Structure from ctypes import c_uint32, c_uint16 + from .base import QlBaseCoverage + # Adapted from https://www.ayrx.me/drcov-file-format class bb_entry(Structure): _fields_ = [ diff --git a/qiling/extensions/coverage/formats/drcov_exact.py b/qiling/extensions/coverage/formats/drcov_exact.py index 0bd809e3..685c6c04 100644 --- a/qiling/extensions/coverage/formats/drcov_exact.py +++ b/qiling/extensions/coverage/formats/drcov_exact.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .drcov import QlDrCoverage + class QlDrCoverageExact(QlDrCoverage): """ Collects emulated code coverage and formats it in accordance with the DynamoRIO based diff --git a/qiling/extensions/coverage/utils.py b/qiling/extensions/coverage/utils.py index d5b6f33d..fb9fd1aa 100644 --- a/qiling/extensions/coverage/utils.py +++ b/qiling/extensions/coverage/utils.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +from contextlib import contextmanager from .formats import * -from contextlib import contextmanager + # Returns subclasses recursively. def get_all_subclasses(cls): diff --git a/qiling/extensions/idaplugin/qilingida.py b/qiling/extensions/idaplugin/qilingida.py index 01f0ac5d..b6baa566 100644 --- a/qiling/extensions/idaplugin/qilingida.py +++ b/qiling/extensions/idaplugin/qilingida.py @@ -1,5 +1,4 @@ # Cross Platform and Multi Architecture Advanced Binary Emulation Framework Plugin For IDA -# Built on top of Unicorn emulator (www.unicorn-engine.org) # Learn how to use? Please visit https://docs.qiling.io/en/latest/ida/ UseAsScript = True @@ -14,21 +13,6 @@ from enum import Enum from elftools.elf.elffile import ELFFile from json import load -# Qiling -from qiling import * -from qiling.const import * -from qiling.arch.x86_const import reg_map_32 as x86_reg_map_32 -from qiling.arch.x86_const import reg_map_64 as x86_reg_map_64 -from qiling.arch.x86_const import reg_map_misc as x86_reg_map_misc -from qiling.arch.x86_const import reg_map_st as x86_reg_map_st -from qiling.arch.arm_const import reg_map as arm_reg_map -from qiling.arch.arm64_const import reg_map as arm64_reg_map -from qiling.arch.mips_const import reg_map as mips_reg_map -from qiling.utils import ql_get_arch_bits -from qiling import __version__ as QLVERSION -from qiling.os.filestruct import ql_file -from keystone import * - # IDA Python SDK from idaapi import * from idc import * @@ -56,6 +40,22 @@ import ida_range from PyQt5 import QtCore, QtWidgets from PyQt5.QtWidgets import (QPushButton, QHBoxLayout) +# Qiling +from qiling import * +from qiling.const import * +from qiling.arch.x86_const import reg_map_32 as x86_reg_map_32 +from qiling.arch.x86_const import reg_map_64 as x86_reg_map_64 +from qiling.arch.x86_const import reg_map_misc as x86_reg_map_misc +from qiling.arch.x86_const import reg_map_st as x86_reg_map_st +from qiling.arch.arm_const import reg_map as arm_reg_map +from qiling.arch.arm64_const import reg_map as arm64_reg_map +from qiling.arch.mips_const import reg_map as mips_reg_map +from qiling.utils import ql_get_arch_bits +from qiling import __version__ as QLVERSION +from qiling.os.filestruct import ql_file +from keystone import * + + QilingHomePage = 'https://www.qiling.io' QilingStableVersionURL = 'https://raw.githubusercontent.com/qilingframework/qiling/master/qiling/__version__.py' logging.basicConfig(level=logging.INFO, format='[%(levelname)s][%(module)s:%(lineno)d] %(message)s') diff --git a/qiling/extensions/report/report.py b/qiling/extensions/report/report.py index d78b4cf7..f564528f 100644 --- a/qiling/extensions/report/report.py +++ b/qiling/extensions/report/report.py @@ -1,6 +1,12 @@ -from qiling.const import * +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + import json +from qiling.const import * + class Report: def __init__(self, ql): diff --git a/qiling/extensions/sanitizers/heap.py b/qiling/extensions/sanitizers/heap.py index dd7638c2..8fc476f7 100644 --- a/qiling/extensions/sanitizers/heap.py +++ b/qiling/extensions/sanitizers/heap.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import random from enum import Enum diff --git a/qiling/extensions/windows_sdk/winsdk_dump.py b/qiling/extensions/windows_sdk/winsdk_dump.py index 2b795fdb..2b8f8404 100644 --- a/qiling/extensions/windows_sdk/winsdk_dump.py +++ b/qiling/extensions/windows_sdk/winsdk_dump.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # windows sdk data file can download here: 'https://github.com/ohjeongwook/windows_sdk_data.git' diff --git a/qiling/loader/dos.py b/qiling/loader/dos.py index ff007ea5..37ca73ad 100644 --- a/qiling/loader/dos.py +++ b/qiling/loader/dos.py @@ -1,14 +1,13 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import logging, math, sys, traceback from .loader import QlLoader from qiling.os.disk import QlDisk -import sys -import traceback -import math -import logging + class QlLoaderDOS(QlLoader): def __init__(self, ql): diff --git a/qiling/loader/elf.py b/qiling/loader/elf.py index 97d5f221..235f2abc 100644 --- a/qiling/loader/elf.py +++ b/qiling/loader/elf.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -import sys -import os -import string, logging +# + +import logging, os, string, sys + from heapq import heappush, heappop from elftools.elf.elffile import ELFFile diff --git a/qiling/loader/loader.py b/qiling/loader/loader.py index 3485c49f..ca67cb1e 100644 --- a/qiling/loader/loader.py +++ b/qiling/loader/loader.py @@ -1,11 +1,15 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + import pefile + +from collections import namedtuple + from qiling.const import QL_OS, QL_OS_ALL, QL_ARCH, QL_ENDIAN, QL_OUTPUT from qiling.exception import QlErrorArch, QlErrorOsType, QlErrorOutput -from collections import namedtuple + class QlLoader(): def __init__(self, ql): diff --git a/qiling/loader/macho.py b/qiling/loader/macho.py index 0cc8fa76..a8837e9e 100644 --- a/qiling/loader/macho.py +++ b/qiling/loader/macho.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, plistlib, struct, logging diff --git a/qiling/loader/macho_parser/const.py b/qiling/loader/macho_parser/const.py index c2be88ad..5dae008b 100644 --- a/qiling/loader/macho_parser/const.py +++ b/qiling/loader/macho_parser/const.py @@ -2,7 +2,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # https://opensource.apple.com/source/cctools/cctools-795/include/mach-o/loader.h diff --git a/qiling/loader/macho_parser/data.py b/qiling/loader/macho_parser/data.py index 302b5590..7acda503 100644 --- a/qiling/loader/macho_parser/data.py +++ b/qiling/loader/macho_parser/data.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + from struct import unpack class Segment: diff --git a/qiling/loader/macho_parser/header.py b/qiling/loader/macho_parser/header.py index 02e11d39..00e8f29e 100644 --- a/qiling/loader/macho_parser/header.py +++ b/qiling/loader/macho_parser/header.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +from struct import unpack from .utils import * from .const import * -from struct import unpack class Header: diff --git a/qiling/loader/macho_parser/loadcommand.py b/qiling/loader/macho_parser/loadcommand.py index 9b6331d5..75bac021 100644 --- a/qiling/loader/macho_parser/loadcommand.py +++ b/qiling/loader/macho_parser/loadcommand.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +from struct import unpack from .const import * from .utils import * -from struct import unpack # TODO: We need support more LC command to load more kinds of binary diff --git a/qiling/loader/macho_parser/parser.py b/qiling/loader/macho_parser/parser.py index 81dea4a2..62b3a099 100644 --- a/qiling/loader/macho_parser/parser.py +++ b/qiling/loader/macho_parser/parser.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import logging from .header import * from .loadcommand import * @@ -10,7 +12,6 @@ from .const import * from .utils import * from struct import unpack from qiling.const import * -import logging class MachoParser: diff --git a/qiling/loader/macho_parser/utils.py b/qiling/loader/macho_parser/utils.py index dfffbfce..d640b4b4 100644 --- a/qiling/loader/macho_parser/utils.py +++ b/qiling/loader/macho_parser/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# class FileReader: def __init__(self, binary): diff --git a/qiling/loader/pe.py b/qiling/loader/pe.py index dc9bad06..0322e733 100644 --- a/qiling/loader/pe.py +++ b/qiling/loader/pe.py @@ -1,18 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import sys -import os -import string -import pefile -import pickle -import traceback -import secrets -import logging +import logging, os, pefile, pickle, secrets, string, sys, traceback from unicorn.x86_const import * + from qiling.os.windows.utils import * from qiling.os.windows.structs import * from qiling.exception import * diff --git a/qiling/loader/pe_uefi.py b/qiling/loader/pe_uefi.py index 2505a5a6..5fafdc83 100644 --- a/qiling/loader/pe_uefi.py +++ b/qiling/loader/pe_uefi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from typing import Sequence diff --git a/qiling/os/const.py b/qiling/os/const.py index 0158bdc4..f4be521c 100644 --- a/qiling/os/const.py +++ b/qiling/os/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# STDCALL = 1 CDECL = 2 diff --git a/qiling/os/disk.py b/qiling/os/disk.py index 617783d8..765712ac 100644 --- a/qiling/os/disk.py +++ b/qiling/os/disk.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .mapper import QlFsMappedObject diff --git a/qiling/os/dos/dos.py b/qiling/os/dos/dos.py index 5445406b..8bdeff82 100644 --- a/qiling/os/dos/dos.py +++ b/qiling/os/dos/dos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import types, os, struct, time, logging diff --git a/qiling/os/dos/utils.py b/qiling/os/dos/utils.py index ae467529..3541acdd 100644 --- a/qiling/os/dos/utils.py +++ b/qiling/os/dos/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# def BIN2BCD(val: int): return val % 10 + (((val//10) % 10) << 4) + (((val//100) % 10) << 8) + (((val//1000) % 10) << 12) diff --git a/qiling/os/filestruct.py b/qiling/os/filestruct.py index 4608bbe3..d45a3d8b 100644 --- a/qiling/os/filestruct.py +++ b/qiling/os/filestruct.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + import os from qiling.exception import * diff --git a/qiling/os/fncc.py b/qiling/os/fncc.py index e0c6ed71..d4957c93 100644 --- a/qiling/os/fncc.py +++ b/qiling/os/fncc.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# diff --git a/qiling/os/freebsd/const.py b/qiling/os/freebsd/const.py index 791a35dc..e1cd26a7 100644 --- a/qiling/os/freebsd/const.py +++ b/qiling/os/freebsd/const.py @@ -1,4 +1,4 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) \ No newline at end of file +# \ No newline at end of file diff --git a/qiling/os/freebsd/freebsd.py b/qiling/os/freebsd/freebsd.py index 5fc5edd9..6e34afcd 100644 --- a/qiling/os/freebsd/freebsd.py +++ b/qiling/os/freebsd/freebsd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.arch.x86 import * from qiling.const import * diff --git a/qiling/os/freebsd/map_syscall.py b/qiling/os/freebsd/map_syscall.py index bbb74a65..a8fdce94 100644 --- a/qiling/os/freebsd/map_syscall.py +++ b/qiling/os/freebsd/map_syscall.py @@ -1,9 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) - -# cols = ("x8664") +# from qiling.const import * diff --git a/qiling/os/freebsd/syscall.py b/qiling/os/freebsd/syscall.py index a5a4939a..37ce4265 100644 --- a/qiling/os/freebsd/syscall.py +++ b/qiling/os/freebsd/syscall.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + import logging + from qiling.arch.x86_const import * def ql_syscall_clock_gettime(ql, clock_gettime_clock_id, clock_gettime_timespec, *args, **kw): diff --git a/qiling/os/linux/const.py b/qiling/os/linux/const.py index 3356e243..45f469de 100644 --- a/qiling/os/linux/const.py +++ b/qiling/os/linux/const.py @@ -1,4 +1,4 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# diff --git a/qiling/os/linux/fncc.py b/qiling/os/linux/fncc.py index 99453fdf..fd8fbcf4 100644 --- a/qiling/os/linux/fncc.py +++ b/qiling/os/linux/fncc.py @@ -1,12 +1,14 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + import struct, logging + from unicorn.x86_const import * from unicorn.mips_const import * -from qiling.os.utils import * +from qiling.os.utils import * DWORD = 1 UINT = 1 diff --git a/qiling/os/linux/function_hook.py b/qiling/os/linux/function_hook.py index 05edeab0..0d667e49 100644 --- a/qiling/os/linux/function_hook.py +++ b/qiling/os/linux/function_hook.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, logging + from qiling.const import * -PT_DYNAMIC = 2 - +PT_DYNAMIC = 2 DT_NULL = 0 DT_NEEDED = 1 DT_PLTRELSZ = 2 diff --git a/qiling/os/linux/futex.py b/qiling/os/linux/futex.py index 4e19f14f..9bd7b1c0 100644 --- a/qiling/os/linux/futex.py +++ b/qiling/os/linux/futex.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import gevent, logging from logging import getLevelName from gevent.event import Event from queue import Queue -import gevent -import logging class QlLinuxFutexManagement: diff --git a/qiling/os/linux/kernel_api/__init__.py b/qiling/os/linux/kernel_api/__init__.py index 72cfb9c2..b6110420 100644 --- a/qiling/os/linux/kernel_api/__init__.py +++ b/qiling/os/linux/kernel_api/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .kernel_api import * diff --git a/qiling/os/linux/kernel_api/hook.py b/qiling/os/linux/kernel_api/hook.py index bbc13c23..63bc0c4f 100644 --- a/qiling/os/linux/kernel_api/hook.py +++ b/qiling/os/linux/kernel_api/hook.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.linux.kernel_api import * import logging diff --git a/qiling/os/linux/kernel_api/kernel_api.py b/qiling/os/linux/kernel_api/kernel_api.py index d8e158db..e480d34c 100644 --- a/qiling/os/linux/kernel_api/kernel_api.py +++ b/qiling/os/linux/kernel_api/kernel_api.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.linux.fncc import * diff --git a/qiling/os/linux/linux.py b/qiling/os/linux/linux.py index 491c77b5..cde96a6d 100644 --- a/qiling/os/linux/linux.py +++ b/qiling/os/linux/linux.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging diff --git a/qiling/os/linux/map_syscall.py b/qiling/os/linux/map_syscall.py index 7e6e7ef6..90a9206c 100644 --- a/qiling/os/linux/map_syscall.py +++ b/qiling/os/linux/map_syscall.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # Table from: https://github.com/zeropointdynamics/zelos/blob/master/src/zelos/ext/platforms/linux/syscalls/syscalls_table.py # cols = ("arm64", "arm", "x8664", "x32", "x86", "mips", "powerpc", "ia64") diff --git a/qiling/os/linux/syscall.py b/qiling/os/linux/syscall.py index 9bd21a65..5337dba1 100644 --- a/qiling/os/linux/syscall.py +++ b/qiling/os/linux/syscall.py @@ -1,24 +1,16 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -# -# import struct -# import sys -# import os -# import string -# import resource -# import socket -# import time -# import io -# import select +# + +import logging from unicorn.arm_const import * from unicorn.x86_const import * from unicorn.mips_const import * + from qiling.arch.x86_const import * from qiling.const import * -import logging def ql_syscall_set_thread_area(ql, u_info_addr, *args, **kw): if ql.archtype == QL_ARCH.X86: diff --git a/qiling/os/linux/syscall_nums.py b/qiling/os/linux/syscall_nums.py index 2a2196dc..52abeb95 100644 --- a/qiling/os/linux/syscall_nums.py +++ b/qiling/os/linux/syscall_nums.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # Linux syscall numbers diff --git a/qiling/os/linux/thread.py b/qiling/os/linux/thread.py index beb4a714..3f279e92 100644 --- a/qiling/os/linux/thread.py +++ b/qiling/os/linux/thread.py @@ -1,15 +1,14 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import os, time, logging +import gevent, os, time, logging + +from abc import ABC, abstractmethod from pathlib import Path - -from unicorn.unicorn import UcError -import gevent from gevent import Greenlet - +from unicorn.unicorn import UcError from unicorn.mips_const import * from unicorn.arm_const import * @@ -19,12 +18,9 @@ from qiling.arch.x86_const import * from qiling.const import * from qiling.os.const import * - -from abc import ABC, abstractmethod - - LINUX_THREAD_ID = 2000 + def new_thread_id(): global LINUX_THREAD_ID old = LINUX_THREAD_ID diff --git a/qiling/os/linux/utils.py b/qiling/os/linux/utils.py index f7f2f14a..a4dba38f 100644 --- a/qiling/os/linux/utils.py +++ b/qiling/os/linux/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from .const import * diff --git a/qiling/os/macos/__init__.py b/qiling/os/macos/__init__.py index 26c74654..16756da5 100644 --- a/qiling/os/macos/__init__.py +++ b/qiling/os/macos/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # virtual addr : 0x00000000000 - 0x7FFFFFFFFFF # 64 bit case no aslr: diff --git a/qiling/os/macos/const.py b/qiling/os/macos/const.py index 15c51612..46c5b9a4 100644 --- a/qiling/os/macos/const.py +++ b/qiling/os/macos/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # basic values PAGE_SIZE = 0x1000 diff --git a/qiling/os/macos/events/macos.py b/qiling/os/macos/events/macos.py index dfec2979..fa8a4526 100644 --- a/qiling/os/macos/events/macos.py +++ b/qiling/os/macos/events/macos.py @@ -1,15 +1,19 @@ -import ctypes -import socket -import struct -import logging + +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + +import ctypes, logging, socket, struct + from functools import wraps +from unicorn.x86_const import * +from unicorn import UcError, UC_ERR_READ_UNMAPPED, UC_ERR_FETCH_UNMAPPED from qiling.os.macos.structs import * from qiling.os.macos.utils import gen_stub_code from .macos_structs import * -from unicorn.x86_const import * -from unicorn import UcError, UC_ERR_READ_UNMAPPED, UC_ERR_FETCH_UNMAPPED class QlMacOSEv: def __init__(self, ql, ev_type, ev_name, ev_obj, ev_obj_idx=-1, protocol=None): diff --git a/qiling/os/macos/events/macos_policy.py b/qiling/os/macos/events/macos_policy.py index 5cba4560..aaa92152 100644 --- a/qiling/os/macos/events/macos_policy.py +++ b/qiling/os/macos/events/macos_policy.py @@ -1,10 +1,15 @@ -import enum -import ctypes -import logging -from .macos_structs import label_t, ucred_t, POINTER64, fileglob_t, vnode_t -#from .macos import * +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + +import ctypes, enum, logging + from functools import wraps +from .macos_structs import label_t, ucred_t, POINTER64, fileglob_t, vnode_t + + def init_ctx(f): @wraps(f) def wrapper(self, *args, **kw): diff --git a/qiling/os/macos/events/macos_structs.py b/qiling/os/macos/events/macos_structs.py index 91615b07..edbd07e9 100644 --- a/qiling/os/macos/events/macos_structs.py +++ b/qiling/os/macos/events/macos_structs.py @@ -1,6 +1,10 @@ -import enum -import ctypes -import logging +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + +import ctypes, enum, logging + from qiling.os.macos.structs import POINTER64 base_event_normal = 0 diff --git a/qiling/os/macos/fncc.py b/qiling/os/macos/fncc.py index 0001c6bc..368a8a87 100644 --- a/qiling/os/macos/fncc.py +++ b/qiling/os/macos/fncc.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + import struct + from unicorn.x86_const import * + from qiling.os.utils import * from qiling.os.macos.utils import * diff --git a/qiling/os/macos/kernel_api/__init__.py b/qiling/os/macos/kernel_api/__init__.py index 72cfb9c2..b6110420 100644 --- a/qiling/os/macos/kernel_api/__init__.py +++ b/qiling/os/macos/kernel_api/__init__.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .kernel_api import * diff --git a/qiling/os/macos/kernel_api/hook.py b/qiling/os/macos/kernel_api/hook.py index e0df738a..d9b904f7 100644 --- a/qiling/os/macos/kernel_api/hook.py +++ b/qiling/os/macos/kernel_api/hook.py @@ -1,12 +1,15 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging -from qiling.os.macos.kernel_api import * + from unicorn import * +from qiling.os.macos.kernel_api import * + + # hook MacOS kernel API def hook_kernel_api(ql, address, size): # call kernel api diff --git a/qiling/os/macos/kernel_api/kernel_api.py b/qiling/os/macos/kernel_api/kernel_api.py index 543d00aa..82ba3096 100644 --- a/qiling/os/macos/kernel_api/kernel_api.py +++ b/qiling/os/macos/kernel_api/kernel_api.py @@ -1,12 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import ctypes, logging, os, struct -import ctypes -import os -import struct -import logging from time import time from qiling.os.macos.fncc import * diff --git a/qiling/os/macos/kernel_func.py b/qiling/os/macos/kernel_func.py index 58ecd4ee..25d32413 100644 --- a/qiling/os/macos/kernel_func.py +++ b/qiling/os/macos/kernel_func.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# +import os, logging from struct import * -import os, logging from qiling.const import * from .const import * diff --git a/qiling/os/macos/mach_port.py b/qiling/os/macos/mach_port.py index 3a5db102..2ac4cf02 100644 --- a/qiling/os/macos/mach_port.py +++ b/qiling/os/macos/mach_port.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -# reference to 《Mac OS X and IOS Internals: To the Apple's Core》 +# reference to import logging + from struct import pack, unpack + from qiling.const import * # define in kernel osfmk/mach/message.h diff --git a/qiling/os/macos/macos.py b/qiling/os/macos/macos.py index a353a192..d84b9018 100644 --- a/qiling/os/macos/macos.py +++ b/qiling/os/macos/macos.py @@ -1,22 +1,19 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import traceback, logging +import logging, traceback from unicorn import * from unicorn.x86_const import * from unicorn.arm64_const import * from qiling.arch.x86 import * - from qiling.const import * from qiling.os.const import * from qiling.os.posix.posix import QlOsPosix - from .const import * - from qiling.os.macos import macos from qiling.os.macos.structs import * from qiling.os.macos.events.macos_structs import * diff --git a/qiling/os/macos/map_syscall.py b/qiling/os/macos/map_syscall.py index 66890653..828bdd1d 100644 --- a/qiling/os/macos/map_syscall.py +++ b/qiling/os/macos/map_syscall.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # cols = ("arm64", "x8664") diff --git a/qiling/os/macos/structs.py b/qiling/os/macos/structs.py index caa5595c..402ec8dd 100644 --- a/qiling/os/macos/structs.py +++ b/qiling/os/macos/structs.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import ctypes, struct from enum import IntEnum -import ctypes -import struct + class POINTER64(ctypes.Structure): _fields_ = [("value", ctypes.c_uint64)] diff --git a/qiling/os/macos/subsystems.py b/qiling/os/macos/subsystems.py index 6385bbda..95cf0458 100644 --- a/qiling/os/macos/subsystems.py +++ b/qiling/os/macos/subsystems.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # Subsystems which program may communicate to # generated by MIG @@ -11,9 +11,10 @@ # find Release source code in https://github.com/doadam/xnu-4570.1.46/master/BUILD/obj/RELEASE_X86_64/osfmk/RELEASE/mach/mach_host_server.c import logging -from struct import pack, unpack -from qiling.const import * +from struct import pack, unpack + +from qiling.const import * from .mach_port import * from .const import * diff --git a/qiling/os/macos/syscall.py b/qiling/os/macos/syscall.py index a9ddf8ad..5ddf90fd 100644 --- a/qiling/os/macos/syscall.py +++ b/qiling/os/macos/syscall.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, logging diff --git a/qiling/os/macos/task.py b/qiling/os/macos/task.py index 3269b132..cca4b339 100644 --- a/qiling/os/macos/task.py +++ b/qiling/os/macos/task.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # task class not finished # TODO: finished diff --git a/qiling/os/macos/thread.py b/qiling/os/macos/thread.py index 3bbc2aa9..f86ec184 100644 --- a/qiling/os/macos/thread.py +++ b/qiling/os/macos/thread.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os + from qiling.os.thread import * from qiling.os.macos.mach_port import * diff --git a/qiling/os/macos/utils.py b/qiling/os/macos/utils.py index dc3831ce..052d013b 100644 --- a/qiling/os/macos/utils.py +++ b/qiling/os/macos/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import ctypes, os, struct, logging diff --git a/qiling/os/mapper.py b/qiling/os/mapper.py index 18da471a..f930fabe 100644 --- a/qiling/os/mapper.py +++ b/qiling/os/mapper.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import inspect, logging from .filestruct import ql_file from .utils import QlOsUtils -import inspect, logging + # All mapped objects should inherit this class. # Note this object is compatible with ql_file. diff --git a/qiling/os/memory.py b/qiling/os/memory.py index c0941a94..171c1a50 100644 --- a/qiling/os/memory.py +++ b/qiling/os/memory.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import os, re, logging +import logging, os, re from qiling.const import * from qiling.exception import * diff --git a/qiling/os/os.py b/qiling/os/os.py index e4db051e..de8a07c1 100644 --- a/qiling/os/os.py +++ b/qiling/os/os.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import os, sys, types, logging +import logging, os, sys, types from .utils import QlOsUtils from .const import * diff --git a/qiling/os/posix/const.py b/qiling/os/posix/const.py index af03b41e..f0c792a3 100644 --- a/qiling/os/posix/const.py +++ b/qiling/os/posix/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.const import * diff --git a/qiling/os/posix/const_mapping.py b/qiling/os/posix/const_mapping.py index a23de163..aad93ab0 100644 --- a/qiling/os/posix/const_mapping.py +++ b/qiling/os/posix/const_mapping.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .const import * from qiling.const import * diff --git a/qiling/os/posix/filestruct.py b/qiling/os/posix/filestruct.py index a30bc3f4..76d5cac2 100644 --- a/qiling/os/posix/filestruct.py +++ b/qiling/os/posix/filestruct.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os from qiling.exception import * diff --git a/qiling/os/posix/posix.py b/qiling/os/posix/posix.py index 6ded974c..e51f7af5 100644 --- a/qiling/os/posix/posix.py +++ b/qiling/os/posix/posix.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # For syscall_num import logging diff --git a/qiling/os/posix/syscall/__init__.py b/qiling/os/posix/syscall/__init__.py index 6ec9a17d..d543080c 100644 --- a/qiling/os/posix/syscall/__init__.py +++ b/qiling/os/posix/syscall/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .fcntl import * from .futex import * from .ioctl import * diff --git a/qiling/os/posix/syscall/fcntl.py b/qiling/os/posix/syscall/fcntl.py index 58515d76..f819e231 100644 --- a/qiling/os/posix/syscall/fcntl.py +++ b/qiling/os/posix/syscall/fcntl.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/futex.py b/qiling/os/posix/syscall/futex.py index cc96382f..cd7da3f7 100644 --- a/qiling/os/posix/syscall/futex.py +++ b/qiling/os/posix/syscall/futex.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/ioctl.py b/qiling/os/posix/syscall/ioctl.py index b320fd51..29ba2554 100644 --- a/qiling/os/posix/syscall/ioctl.py +++ b/qiling/os/posix/syscall/ioctl.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/mman.py b/qiling/os/posix/syscall/mman.py index 1c9ad9e5..18536e77 100644 --- a/qiling/os/posix/syscall/mman.py +++ b/qiling/os/posix/syscall/mman.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from unicorn import ( diff --git a/qiling/os/posix/syscall/net.py b/qiling/os/posix/syscall/net.py index c4c3de79..a6c46635 100644 --- a/qiling/os/posix/syscall/net.py +++ b/qiling/os/posix/syscall/net.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/prctl.py b/qiling/os/posix/syscall/prctl.py index cdaba2b5..9e31794f 100644 --- a/qiling/os/posix/syscall/prctl.py +++ b/qiling/os/posix/syscall/prctl.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/ptrace.py b/qiling/os/posix/syscall/ptrace.py index 503ae48a..5da6da65 100644 --- a/qiling/os/posix/syscall/ptrace.py +++ b/qiling/os/posix/syscall/ptrace.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/random.py b/qiling/os/posix/syscall/random.py index 06288a5b..2622ddda 100644 --- a/qiling/os/posix/syscall/random.py +++ b/qiling/os/posix/syscall/random.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, logging diff --git a/qiling/os/posix/syscall/resource.py b/qiling/os/posix/syscall/resource.py index 4159e47a..0bb3d0f2 100644 --- a/qiling/os/posix/syscall/resource.py +++ b/qiling/os/posix/syscall/resource.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# try: import resource diff --git a/qiling/os/posix/syscall/sched.py b/qiling/os/posix/syscall/sched.py index 13825611..6bfe0443 100644 --- a/qiling/os/posix/syscall/sched.py +++ b/qiling/os/posix/syscall/sched.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import types, logging from multiprocessing import Process diff --git a/qiling/os/posix/syscall/select.py b/qiling/os/posix/syscall/select.py index 36433514..ada1ee78 100644 --- a/qiling/os/posix/syscall/select.py +++ b/qiling/os/posix/syscall/select.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import select, logging from qiling.const import * diff --git a/qiling/os/posix/syscall/sendfile.py b/qiling/os/posix/syscall/sendfile.py index e0ca8931..23d368f5 100644 --- a/qiling/os/posix/syscall/sendfile.py +++ b/qiling/os/posix/syscall/sendfile.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/signal.py b/qiling/os/posix/syscall/signal.py index 1b1297af..c00c63c1 100644 --- a/qiling/os/posix/syscall/signal.py +++ b/qiling/os/posix/syscall/signal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/socket.py b/qiling/os/posix/syscall/socket.py index 829c296c..13df73fa 100644 --- a/qiling/os/posix/syscall/socket.py +++ b/qiling/os/posix/syscall/socket.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, ipaddress, logging diff --git a/qiling/os/posix/syscall/stat.py b/qiling/os/posix/syscall/stat.py index 153fa5f6..bf7e1e66 100644 --- a/qiling/os/posix/syscall/stat.py +++ b/qiling/os/posix/syscall/stat.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/sysctl.py b/qiling/os/posix/syscall/sysctl.py index 8dc16523..64c0d645 100644 --- a/qiling/os/posix/syscall/sysctl.py +++ b/qiling/os/posix/syscall/sysctl.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/sysinfo.py b/qiling/os/posix/syscall/sysinfo.py index f796c2b0..4ec23b03 100644 --- a/qiling/os/posix/syscall/sysinfo.py +++ b/qiling/os/posix/syscall/sysinfo.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, logging diff --git a/qiling/os/posix/syscall/time.py b/qiling/os/posix/syscall/time.py index 964f2bb7..ca708655 100644 --- a/qiling/os/posix/syscall/time.py +++ b/qiling/os/posix/syscall/time.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/types.py b/qiling/os/posix/syscall/types.py index 84bd10df..3b7e3ade 100644 --- a/qiling/os/posix/syscall/types.py +++ b/qiling/os/posix/syscall/types.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/uio.py b/qiling/os/posix/syscall/uio.py index 11133729..696f33fb 100644 --- a/qiling/os/posix/syscall/uio.py +++ b/qiling/os/posix/syscall/uio.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/unistd.py b/qiling/os/posix/syscall/unistd.py index 517eaddd..53b1190b 100644 --- a/qiling/os/posix/syscall/unistd.py +++ b/qiling/os/posix/syscall/unistd.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import stat, logging, itertools, pathlib diff --git a/qiling/os/posix/syscall/utsname.py b/qiling/os/posix/syscall/utsname.py index f9a89b2b..8b6c2ff4 100644 --- a/qiling/os/posix/syscall/utsname.py +++ b/qiling/os/posix/syscall/utsname.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/posix/syscall/wait.py b/qiling/os/posix/syscall/wait.py index 8601b881..9ce47bdb 100644 --- a/qiling/os/posix/syscall/wait.py +++ b/qiling/os/posix/syscall/wait.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/stat.py b/qiling/os/stat.py index f162c14b..b6c227a9 100644 --- a/qiling/os/stat.py +++ b/qiling/os/stat.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -import os +# +import os class Stat(object): def __init__(self, path): diff --git a/qiling/os/thread.py b/qiling/os/thread.py index 636174c3..28adec68 100644 --- a/qiling/os/thread.py +++ b/qiling/os/thread.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from abc import ABCMeta, abstractmethod from gevent import Greenlet diff --git a/qiling/os/uefi/PiMultiPhase.py b/qiling/os/uefi/PiMultiPhase.py index b4a58697..798705a7 100644 --- a/qiling/os/uefi/PiMultiPhase.py +++ b/qiling/os/uefi/PiMultiPhase.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + from .UefiBaseType import * from .ProcessorBind import * diff --git a/qiling/os/uefi/ProcessorBind.py b/qiling/os/uefi/ProcessorBind.py index fde43515..35463dcd 100644 --- a/qiling/os/uefi/ProcessorBind.py +++ b/qiling/os/uefi/ProcessorBind.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + import ctypes bits = 64 diff --git a/qiling/os/uefi/UefiBaseType.py b/qiling/os/uefi/UefiBaseType.py index 34f2fb1e..d64bcd61 100644 --- a/qiling/os/uefi/UefiBaseType.py +++ b/qiling/os/uefi/UefiBaseType.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .ProcessorBind import * diff --git a/qiling/os/uefi/UefiMultiPhase.py b/qiling/os/uefi/UefiMultiPhase.py index 9c36ead0..01bd0e8a 100644 --- a/qiling/os/uefi/UefiMultiPhase.py +++ b/qiling/os/uefi/UefiMultiPhase.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .ProcessorBind import * diff --git a/qiling/os/uefi/UefiSpec.py b/qiling/os/uefi/UefiSpec.py index 71d97f55..14816b88 100644 --- a/qiling/os/uefi/UefiSpec.py +++ b/qiling/os/uefi/UefiSpec.py @@ -2,7 +2,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # @see: MdePkg\Include\Uefi\UefiSpec.h diff --git a/qiling/os/uefi/bs.py b/qiling/os/uefi/bs.py index b5e7816e..07f9b129 100644 --- a/qiling/os/uefi/bs.py +++ b/qiling/os/uefi/bs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from binascii import crc32 diff --git a/qiling/os/uefi/const.py b/qiling/os/uefi/const.py index 6017d02e..b440bcff 100644 --- a/qiling/os/uefi/const.py +++ b/qiling/os/uefi/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# EFI_MAX_BIT = (1 << 63) EFI_SUCCESS = 0 diff --git a/qiling/os/uefi/ds.py b/qiling/os/uefi/ds.py index d2be705a..d6004e1a 100644 --- a/qiling/os/uefi/ds.py +++ b/qiling/os/uefi/ds.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.const import * from qiling.os.const import * diff --git a/qiling/os/uefi/fncc.py b/qiling/os/uefi/fncc.py index 1a5c56fb..47e2e0e9 100644 --- a/qiling/os/uefi/fncc.py +++ b/qiling/os/uefi/fncc.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# def dxeapi(param_num=None, params=None): def decorator(func): diff --git a/qiling/os/uefi/protocols/EfiLoadedImageProtocol.py b/qiling/os/uefi/protocols/EfiLoadedImageProtocol.py index 69e5694d..d7114dde 100644 --- a/qiling/os/uefi/protocols/EfiLoadedImageProtocol.py +++ b/qiling/os/uefi/protocols/EfiLoadedImageProtocol.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from ..ProcessorBind import * from ..UefiBaseType import * diff --git a/qiling/os/uefi/protocols/EfiSmmAccess2Protocol.py b/qiling/os/uefi/protocols/EfiSmmAccess2Protocol.py index 929adc18..15e4834a 100644 --- a/qiling/os/uefi/protocols/EfiSmmAccess2Protocol.py +++ b/qiling/os/uefi/protocols/EfiSmmAccess2Protocol.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.const import * from qiling.os.uefi.const import * diff --git a/qiling/os/uefi/protocols/EfiSmmBase2Protocol.py b/qiling/os/uefi/protocols/EfiSmmBase2Protocol.py index 280f919a..1f42b042 100644 --- a/qiling/os/uefi/protocols/EfiSmmBase2Protocol.py +++ b/qiling/os/uefi/protocols/EfiSmmBase2Protocol.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.const import * diff --git a/qiling/os/uefi/protocols/EfiSmmCpuProtocol.py b/qiling/os/uefi/protocols/EfiSmmCpuProtocol.py index 8e8d37d1..8f6fdd65 100644 --- a/qiling/os/uefi/protocols/EfiSmmCpuProtocol.py +++ b/qiling/os/uefi/protocols/EfiSmmCpuProtocol.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.const import * from ..fncc import * diff --git a/qiling/os/uefi/protocols/EfiSmmSwDispatch2Protocol.py b/qiling/os/uefi/protocols/EfiSmmSwDispatch2Protocol.py index 7b1c265c..6884f001 100644 --- a/qiling/os/uefi/protocols/EfiSmmSwDispatch2Protocol.py +++ b/qiling/os/uefi/protocols/EfiSmmSwDispatch2Protocol.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.const import * from ..const import * diff --git a/qiling/os/uefi/protocols/PcdProtocol.py b/qiling/os/uefi/protocols/PcdProtocol.py index 90f9b557..f4237b11 100644 --- a/qiling/os/uefi/protocols/PcdProtocol.py +++ b/qiling/os/uefi/protocols/PcdProtocol.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.const import * from ..fncc import * diff --git a/qiling/os/uefi/rt.py b/qiling/os/uefi/rt.py index bcb06f37..64c81968 100644 --- a/qiling/os/uefi/rt.py +++ b/qiling/os/uefi/rt.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.const import * from .const import * diff --git a/qiling/os/uefi/shutdown.py b/qiling/os/uefi/shutdown.py index c5028e67..f36d553c 100644 --- a/qiling/os/uefi/shutdown.py +++ b/qiling/os/uefi/shutdown.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging + from .utils import check_and_notify_protocols def hook_EndOfExecution(ql): diff --git a/qiling/os/uefi/smst.py b/qiling/os/uefi/smst.py index 10f7f57a..5e960760 100644 --- a/qiling/os/uefi/smst.py +++ b/qiling/os/uefi/smst.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.const import * from qiling.os.const import * diff --git a/qiling/os/uefi/st.py b/qiling/os/uefi/st.py index 60d3fd41..935ca658 100644 --- a/qiling/os/uefi/st.py +++ b/qiling/os/uefi/st.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging import binascii diff --git a/qiling/os/uefi/type32.py b/qiling/os/uefi/type32.py index 2ec7db72..68550c0e 100644 --- a/qiling/os/uefi/type32.py +++ b/qiling/os/uefi/type32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # -*- coding: utf-8 -*- # diff --git a/qiling/os/uefi/type64.py b/qiling/os/uefi/type64.py index 41ad11cc..303a553d 100644 --- a/qiling/os/uefi/type64.py +++ b/qiling/os/uefi/type64.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # -*- coding: utf-8 -*- # diff --git a/qiling/os/uefi/uefi.py b/qiling/os/uefi/uefi.py index 222b93f3..74194d30 100644 --- a/qiling/os/uefi/uefi.py +++ b/qiling/os/uefi/uefi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging diff --git a/qiling/os/uefi/utils.py b/qiling/os/uefi/utils.py index 45fcd701..147ebd43 100644 --- a/qiling/os/uefi/utils.py +++ b/qiling/os/uefi/utils.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import logging, struct -import struct -import logging from uuid import UUID from qiling.os.uefi.const import * diff --git a/qiling/os/utils.py b/qiling/os/utils.py index 3850b85c..f6c40811 100644 --- a/qiling/os/utils.py +++ b/qiling/os/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# """ This module is intended for general purpose functions that are only used in qiling.os @@ -16,7 +16,6 @@ from unicorn.arm_const import * from unicorn.x86_const import * from unicorn.arm64_const import * from unicorn.mips_const import * - from capstone import * from capstone.arm_const import * from capstone.x86_const import * @@ -27,7 +26,6 @@ from keystone import * from qiling.const import * from qiling.exception import * from .const import * - from qiling.os.windows.wdk_const import * from qiling.os.windows.structs import * from qiling.utils import verify_ret diff --git a/qiling/os/windows/api.py b/qiling/os/windows/api.py index 52e97545..dbea95d6 100644 --- a/qiling/os/windows/api.py +++ b/qiling/os/windows/api.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.const import * from .fncc import * diff --git a/qiling/os/windows/clipboard.py b/qiling/os/windows/clipboard.py index 5ee35231..02c1dc00 100644 --- a/qiling/os/windows/clipboard.py +++ b/qiling/os/windows/clipboard.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # A Simple Windows Clipboard Simulation NOT_LOCKED = -1 diff --git a/qiling/os/windows/const.py b/qiling/os/windows/const.py index 49046098..58f69f97 100644 --- a/qiling/os/windows/const.py +++ b/qiling/os/windows/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from Registry import Registry # ERRORS CODE diff --git a/qiling/os/windows/dlls/__init__.py b/qiling/os/windows/dlls/__init__.py index e7713665..5653325c 100644 --- a/qiling/os/windows/dlls/__init__.py +++ b/qiling/os/windows/dlls/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from .advapi32 import * from .msvcrt import * from .user32 import * diff --git a/qiling/os/windows/dlls/advapi32.py b/qiling/os/windows/dlls/advapi32.py index 3a94cd27..a8884695 100644 --- a/qiling/os/windows/dlls/advapi32.py +++ b/qiling/os/windows/dlls/advapi32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, logging from qiling.os.windows.fncc import * from qiling.os.const import * diff --git a/qiling/os/windows/dlls/cng.py b/qiling/os/windows/dlls/cng.py index 7f9b0617..aa514ea0 100644 --- a/qiling/os/windows/dlls/cng.py +++ b/qiling/os/windows/dlls/cng.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.os.windows.const import * diff --git a/qiling/os/windows/dlls/const.py b/qiling/os/windows/dlls/const.py index e2ce8c41..986cf7e0 100644 --- a/qiling/os/windows/dlls/const.py +++ b/qiling/os/windows/dlls/const.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# IDCANCEL = 2 diff --git a/qiling/os/windows/dlls/crypt32.py b/qiling/os/windows/dlls/crypt32.py index 0ab01b0e..7a208876 100644 --- a/qiling/os/windows/dlls/crypt32.py +++ b/qiling/os/windows/dlls/crypt32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import base64 import logging diff --git a/qiling/os/windows/dlls/kernel32/consoleapi2.py b/qiling/os/windows/dlls/kernel32/consoleapi2.py index 32f361d9..057cc85e 100644 --- a/qiling/os/windows/dlls/kernel32/consoleapi2.py +++ b/qiling/os/windows/dlls/kernel32/consoleapi2.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/consoleapi3.py b/qiling/os/windows/dlls/kernel32/consoleapi3.py index 4f3018ad..7a5b4e44 100644 --- a/qiling/os/windows/dlls/kernel32/consoleapi3.py +++ b/qiling/os/windows/dlls/kernel32/consoleapi3.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/debugapi.py b/qiling/os/windows/dlls/kernel32/debugapi.py index 4a04b897..1cd642f6 100644 --- a/qiling/os/windows/dlls/kernel32/debugapi.py +++ b/qiling/os/windows/dlls/kernel32/debugapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/errhandlingapi.py b/qiling/os/windows/dlls/kernel32/errhandlingapi.py index 312eca3d..d366f666 100644 --- a/qiling/os/windows/dlls/kernel32/errhandlingapi.py +++ b/qiling/os/windows/dlls/kernel32/errhandlingapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/fibersapi.py b/qiling/os/windows/dlls/kernel32/fibersapi.py index 3204fa8f..a2adb75c 100644 --- a/qiling/os/windows/dlls/kernel32/fibersapi.py +++ b/qiling/os/windows/dlls/kernel32/fibersapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/fileapi.py b/qiling/os/windows/dlls/kernel32/fileapi.py index d53e0c55..cc69b837 100644 --- a/qiling/os/windows/dlls/kernel32/fileapi.py +++ b/qiling/os/windows/dlls/kernel32/fileapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, time, os, logging from shutil import copyfile diff --git a/qiling/os/windows/dlls/kernel32/handleapi.py b/qiling/os/windows/dlls/kernel32/handleapi.py index f07602bd..774f5f3f 100644 --- a/qiling/os/windows/dlls/kernel32/handleapi.py +++ b/qiling/os/windows/dlls/kernel32/handleapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/heapapi.py b/qiling/os/windows/dlls/kernel32/heapapi.py index 2015541a..9c87099f 100644 --- a/qiling/os/windows/dlls/kernel32/heapapi.py +++ b/qiling/os/windows/dlls/kernel32/heapapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/interlockedapi.py b/qiling/os/windows/dlls/kernel32/interlockedapi.py index 2771176d..8a2dca6c 100644 --- a/qiling/os/windows/dlls/kernel32/interlockedapi.py +++ b/qiling/os/windows/dlls/kernel32/interlockedapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/ioapiset.py b/qiling/os/windows/dlls/kernel32/ioapiset.py index 791d118f..17c62a29 100644 --- a/qiling/os/windows/dlls/kernel32/ioapiset.py +++ b/qiling/os/windows/dlls/kernel32/ioapiset.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/libloaderapi.py b/qiling/os/windows/dlls/kernel32/libloaderapi.py index bc2d6221..ddd10153 100644 --- a/qiling/os/windows/dlls/kernel32/libloaderapi.py +++ b/qiling/os/windows/dlls/kernel32/libloaderapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os import logging diff --git a/qiling/os/windows/dlls/kernel32/memoryapi.py b/qiling/os/windows/dlls/kernel32/memoryapi.py index 9013086d..ae33277c 100644 --- a/qiling/os/windows/dlls/kernel32/memoryapi.py +++ b/qiling/os/windows/dlls/kernel32/memoryapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/processenv.py b/qiling/os/windows/dlls/kernel32/processenv.py index 6f77e559..75d97c90 100644 --- a/qiling/os/windows/dlls/kernel32/processenv.py +++ b/qiling/os/windows/dlls/kernel32/processenv.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.os.windows.fncc import * diff --git a/qiling/os/windows/dlls/kernel32/processthreadsapi.py b/qiling/os/windows/dlls/kernel32/processthreadsapi.py index 80319d7b..41516eb1 100644 --- a/qiling/os/windows/dlls/kernel32/processthreadsapi.py +++ b/qiling/os/windows/dlls/kernel32/processthreadsapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/profileapi.py b/qiling/os/windows/dlls/kernel32/profileapi.py index 782a484f..a31bbf83 100644 --- a/qiling/os/windows/dlls/kernel32/profileapi.py +++ b/qiling/os/windows/dlls/kernel32/profileapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/psapi.py b/qiling/os/windows/dlls/kernel32/psapi.py index 133ff5c9..b9acbe42 100644 --- a/qiling/os/windows/dlls/kernel32/psapi.py +++ b/qiling/os/windows/dlls/kernel32/psapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/stringapiset.py b/qiling/os/windows/dlls/kernel32/stringapiset.py index 1e98d5ce..430cbfa9 100644 --- a/qiling/os/windows/dlls/kernel32/stringapiset.py +++ b/qiling/os/windows/dlls/kernel32/stringapiset.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/synchapi.py b/qiling/os/windows/dlls/kernel32/synchapi.py index 9c2de769..b8c2b2b1 100644 --- a/qiling/os/windows/dlls/kernel32/synchapi.py +++ b/qiling/os/windows/dlls/kernel32/synchapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/sysinfoapi.py b/qiling/os/windows/dlls/kernel32/sysinfoapi.py index 574e20a1..73846279 100644 --- a/qiling/os/windows/dlls/kernel32/sysinfoapi.py +++ b/qiling/os/windows/dlls/kernel32/sysinfoapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/tlhelp32.py b/qiling/os/windows/dlls/kernel32/tlhelp32.py index 4cabffb2..4dbc426b 100644 --- a/qiling/os/windows/dlls/kernel32/tlhelp32.py +++ b/qiling/os/windows/dlls/kernel32/tlhelp32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/winbase.py b/qiling/os/windows/dlls/kernel32/winbase.py index 2aee358a..cf7dc537 100644 --- a/qiling/os/windows/dlls/kernel32/winbase.py +++ b/qiling/os/windows/dlls/kernel32/winbase.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.windows.const import * from qiling.os.windows.fncc import * diff --git a/qiling/os/windows/dlls/kernel32/winnls.py b/qiling/os/windows/dlls/kernel32/winnls.py index 934da7e6..6f47b866 100644 --- a/qiling/os/windows/dlls/kernel32/winnls.py +++ b/qiling/os/windows/dlls/kernel32/winnls.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/kernel32/winnt.py b/qiling/os/windows/dlls/kernel32/winnt.py index c1277285..9b188aaa 100644 --- a/qiling/os/windows/dlls/kernel32/winnt.py +++ b/qiling/os/windows/dlls/kernel32/winnt.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from qiling.os.windows.const import * from qiling.os.windows.fncc import * diff --git a/qiling/os/windows/dlls/kernel32/wow64apiset.py b/qiling/os/windows/dlls/kernel32/wow64apiset.py index 789971a5..58c6a415 100644 --- a/qiling/os/windows/dlls/kernel32/wow64apiset.py +++ b/qiling/os/windows/dlls/kernel32/wow64apiset.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/mscoree.py b/qiling/os/windows/dlls/mscoree.py index 5af2f1e1..508bf449 100644 --- a/qiling/os/windows/dlls/mscoree.py +++ b/qiling/os/windows/dlls/mscoree.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import base64 from qiling.os.windows.fncc import * diff --git a/qiling/os/windows/dlls/msi.py b/qiling/os/windows/dlls/msi.py index 20b90c04..0a687ca8 100644 --- a/qiling/os/windows/dlls/msi.py +++ b/qiling/os/windows/dlls/msi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct from qiling.os.windows.const import * diff --git a/qiling/os/windows/dlls/msvbvm60.py b/qiling/os/windows/dlls/msvbvm60.py index 420bfa6f..fd0dba3f 100644 --- a/qiling/os/windows/dlls/msvbvm60.py +++ b/qiling/os/windows/dlls/msvbvm60.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct from qiling.os.windows.const import * diff --git a/qiling/os/windows/dlls/msvcrt.py b/qiling/os/windows/dlls/msvcrt.py index 2f074f4c..8237df22 100644 --- a/qiling/os/windows/dlls/msvcrt.py +++ b/qiling/os/windows/dlls/msvcrt.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os import time diff --git a/qiling/os/windows/dlls/ntdll.py b/qiling/os/windows/dlls/ntdll.py index 4a64f16e..f1e9f47e 100644 --- a/qiling/os/windows/dlls/ntdll.py +++ b/qiling/os/windows/dlls/ntdll.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, logging from qiling.os.windows.const import * diff --git a/qiling/os/windows/dlls/ntoskrnl.py b/qiling/os/windows/dlls/ntoskrnl.py index 38c666ca..c631a63c 100644 --- a/qiling/os/windows/dlls/ntoskrnl.py +++ b/qiling/os/windows/dlls/ntoskrnl.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import logging from qiling.os.windows.const import * diff --git a/qiling/os/windows/dlls/ole32.py b/qiling/os/windows/dlls/ole32.py index b2dc822e..047f1cb8 100644 --- a/qiling/os/windows/dlls/ole32.py +++ b/qiling/os/windows/dlls/ole32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/oleaut32.py b/qiling/os/windows/dlls/oleaut32.py index ad19df64..4213e4e7 100644 --- a/qiling/os/windows/dlls/oleaut32.py +++ b/qiling/os/windows/dlls/oleaut32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import time diff --git a/qiling/os/windows/dlls/shell32.py b/qiling/os/windows/dlls/shell32.py index 5981f3aa..01ca5605 100644 --- a/qiling/os/windows/dlls/shell32.py +++ b/qiling/os/windows/dlls/shell32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct, time, os, logging diff --git a/qiling/os/windows/dlls/shlwapi.py b/qiling/os/windows/dlls/shlwapi.py index c0f508f4..7f50588e 100644 --- a/qiling/os/windows/dlls/shlwapi.py +++ b/qiling/os/windows/dlls/shlwapi.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct from qiling.os.windows.fncc import * diff --git a/qiling/os/windows/dlls/ucrtbased.py b/qiling/os/windows/dlls/ucrtbased.py index 5d42782c..facd3fc4 100644 --- a/qiling/os/windows/dlls/ucrtbased.py +++ b/qiling/os/windows/dlls/ucrtbased.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct from qiling.os.windows.const import * diff --git a/qiling/os/windows/dlls/user32.py b/qiling/os/windows/dlls/user32.py index ec607d35..9d4566fe 100644 --- a/qiling/os/windows/dlls/user32.py +++ b/qiling/os/windows/dlls/user32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import logging diff --git a/qiling/os/windows/dlls/wininet.py b/qiling/os/windows/dlls/wininet.py index a83f4e06..26606cad 100644 --- a/qiling/os/windows/dlls/wininet.py +++ b/qiling/os/windows/dlls/wininet.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct from qiling.os.windows.fncc import * diff --git a/qiling/os/windows/dlls/wsock32.py b/qiling/os/windows/dlls/wsock32.py index 4e955f4b..cc0dbc46 100644 --- a/qiling/os/windows/dlls/wsock32.py +++ b/qiling/os/windows/dlls/wsock32.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct import logging diff --git a/qiling/os/windows/dlls/wudplatform.py b/qiling/os/windows/dlls/wudplatform.py index 41be8f07..bbad1efd 100644 --- a/qiling/os/windows/dlls/wudplatform.py +++ b/qiling/os/windows/dlls/wudplatform.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import struct from qiling.os.windows.const import * diff --git a/qiling/os/windows/fiber.py b/qiling/os/windows/fiber.py index efbac592..7febc9f2 100644 --- a/qiling/os/windows/fiber.py +++ b/qiling/os/windows/fiber.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # A Simple Windows Clipboard Simulation import logging + from unicorn import * from unicorn.x86_const import * diff --git a/qiling/os/windows/fncc.py b/qiling/os/windows/fncc.py index 50b45f41..28d1b6d3 100644 --- a/qiling/os/windows/fncc.py +++ b/qiling/os/windows/fncc.py @@ -1,12 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import json, logging, os, struct -import os -import json -import struct -import logging from functools import wraps from qiling.os.const import * diff --git a/qiling/os/windows/handle.py b/qiling/os/windows/handle.py index b63380aa..2a018ba1 100644 --- a/qiling/os/windows/handle.py +++ b/qiling/os/windows/handle.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# # A Simple Windows Handle Simulation diff --git a/qiling/os/windows/registry.py b/qiling/os/windows/registry.py index 8d51f7f2..65dba361 100644 --- a/qiling/os/windows/registry.py +++ b/qiling/os/windows/registry.py @@ -1,14 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# +import json, logging, os, sys -import os -import json -import sys -import logging from Registry import Registry + from qiling.os.windows.const import * from qiling.exception import * from qiling.const import * diff --git a/qiling/os/windows/structs.py b/qiling/os/windows/structs.py index 52e1c544..fa78f297 100644 --- a/qiling/os/windows/structs.py +++ b/qiling/os/windows/structs.py @@ -1,16 +1,16 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -import struct, logging +# + +import ctypes, logging, struct + +from enum import IntEnum + from unicorn.x86_const import * from qiling.const import * -from enum import IntEnum from qiling.os.windows.handle import * from qiling.exception import * - - -import ctypes from .wdk_const import * diff --git a/qiling/os/windows/thread.py b/qiling/os/windows/thread.py index 5d3b609b..58bd1dd4 100644 --- a/qiling/os/windows/thread.py +++ b/qiling/os/windows/thread.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# from unicorn.x86_const import * + from qiling.exception import * from qiling.os.thread import * from .utils import * diff --git a/qiling/os/windows/utils.py b/qiling/os/windows/utils.py index 5f8fbe92..959cb9c9 100644 --- a/qiling/os/windows/utils.py +++ b/qiling/os/windows/utils.py @@ -1,17 +1,14 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import logging, ntpath, os, uuid -import os -import uuid -import ntpath -import logging from sys import getsizeof from qiling.const import * from qiling.os.const import * - from .registry import RegistryManager from .clipboard import Clipboard from .fiber import FiberManager diff --git a/qiling/os/windows/wdk_const.py b/qiling/os/windows/wdk_const.py index b9c8e510..1da316ec 100644 --- a/qiling/os/windows/wdk_const.py +++ b/qiling/os/windows/wdk_const.py @@ -1,3 +1,8 @@ +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + PROCESSOR_FEATURE_MAX = 64 MAX_WOW64_SHARED_ENTRIES = 16 diff --git a/qiling/os/windows/windows.py b/qiling/os/windows/windows.py index c2867be2..3f324597 100644 --- a/qiling/os/windows/windows.py +++ b/qiling/os/windows/windows.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import types, logging @@ -11,7 +11,6 @@ from qiling.arch.x86_const import * from qiling.arch.x86 import * from qiling.const import * from qiling.os.os import QlOs - from .dlls import * from .const import * from .utils import * diff --git a/qiling/utils.py b/qiling/utils.py index f76da59f..99168864 100644 --- a/qiling/utils.py +++ b/qiling/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# """ This module is intended for general purpose functions that can be used diff --git a/qltool b/qltool index 1ae4580e..1c0c82a4 100755 --- a/qltool +++ b/qltool @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import argparse, os, string, sys, ast, unicorn diff --git a/tests/test_android.py b/tests/test_android.py index 95bd9fb3..d130e973 100644 --- a/tests/test_android.py +++ b/tests/test_android.py @@ -1,12 +1,9 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import unittest -import os -import sys -import logging +import logging, os, sys, unittest sys.path.append("..") from qiling import * diff --git a/tests/test_basic.py b/tests/test_basic.py deleted file mode 100644 index a459db90..00000000 --- a/tests/test_basic.py +++ /dev/null @@ -1,16 +0,0 @@ -import unittest -import sys -sys.path.append("..") -from qiling import * -from qiling.utils import * - -class TestBasic(unittest.TestCase): - def test_invalid_module(self): - self.assertRaises(QlErrorModuleNotFound, ql_get_module_function, "InvalidModule", "InvalidFunction") - - def test_invalid_module_function(self): - self.assertRaises(QlErrorModuleFunctionNotFound, ql_get_module_function, "qiling.arch.x86", "InvalidFunction") - - -if __name__ == "__main__": - unittest.main() \ No newline at end of file diff --git a/tests/test_debugger.py b/tests/test_debugger.py index c9f41073..015a666b 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, subprocess, threading, unittest, socket, time from binascii import unhexlify + sys.path.append("..") from qiling import * from qiling.exception import * diff --git a/tests/test_dos.py b/tests/test_dos.py index c44ea294..a0600e69 100644 --- a/tests/test_dos.py +++ b/tests/test_dos.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, random, sys, unittest + import string as st from binascii import unhexlify diff --git a/tests/test_dos_exe.py b/tests/test_dos_exe.py index aedee7d1..f0c6f283 100644 --- a/tests/test_dos_exe.py +++ b/tests/test_dos_exe.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, random, sys, unittest import string as st diff --git a/tests/test_edl.py b/tests/test_edl.py index cfe98580..31fc8a25 100644 --- a/tests/test_edl.py +++ b/tests/test_edl.py @@ -1,15 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import unittest -import os -import sys -import time -sys.path.append("..") +import os, sys, time, unittest from struct import pack -import sys + sys.path.append("..") from qiling import * from unicorn import * diff --git a/tests/test_elf.py b/tests/test_elf.py index 6b72b9e5..18b292b5 100644 --- a/tests/test_elf.py +++ b/tests/test_elf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, unittest, subprocess, string, random, os, logging diff --git a/tests/test_elf.sh b/tests/test_elf.sh index 2a988833..a76100a0 100755 --- a/tests/test_elf.sh +++ b/tests/test_elf.sh @@ -2,6 +2,6 @@ # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# python3 ./test_posix.py && python3 test_android.py && python3 ./test_debugger.py && python3 ./test_uefi.py && python3 ./test_shellcode.py && python3 ./test_edl.py diff --git a/tests/test_elf_multithread.py b/tests/test_elf_multithread.py index 4315e850..64d351be 100644 --- a/tests/test_elf_multithread.py +++ b/tests/test_elf_multithread.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, unittest, subprocess, string, random, os, logging diff --git a/tests/test_macho.py b/tests/test_macho.py index 74b9c0e0..74511f2b 100644 --- a/tests/test_macho.py +++ b/tests/test_macho.py @@ -1,14 +1,15 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) - +# import sys, unittest sys.path.append("..") + from qiling import * from qiling.exception import * + class MACHOTest(unittest.TestCase): def test_macho_macos_x8664(self): ql = Qiling(["../examples/rootfs/x8664_macos/bin/x8664_hello_usercorn"], "../examples/rootfs/x8664_macos") diff --git a/tests/test_macho.sh b/tests/test_macho.sh index 3db684ee..2db6ee74 100755 --- a/tests/test_macho.sh +++ b/tests/test_macho.sh @@ -2,6 +2,6 @@ # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# python3 ./test_macho_macos.py && python3 ./test_macho.py diff --git a/tests/test_macho_macos.py b/tests/test_macho_macos.py index 5fdc025b..fb64135b 100644 --- a/tests/test_macho_macos.py +++ b/tests/test_macho_macos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, sys, unittest diff --git a/tests/test_pathutils.py b/tests/test_pathutils.py index 3a95e709..b2a06499 100644 --- a/tests/test_pathutils.py +++ b/tests/test_pathutils.py @@ -1,13 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import pathlib, sys, unittest -import unittest -import pathlib -import sys sys.path.append("..") - from qiling import * from qiling.const import * from qiling.os.utils import PathUtils diff --git a/tests/test_pe.py b/tests/test_pe.py index 11f3c5d3..a16c2393 100644 --- a/tests/test_pe.py +++ b/tests/test_pe.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, random, sys, unittest, logging import string as st @@ -9,7 +9,7 @@ from binascii import unhexlify from unicorn.x86_const import * -sys.path.insert(0, "..") +sys.path.append("..") from qiling import * from qiling.const import * from qiling.exception import * diff --git a/tests/test_pe_sality.py b/tests/test_pe_sality.py index 02740420..335c4bdc 100644 --- a/tests/test_pe_sality.py +++ b/tests/test_pe_sality.py @@ -1,15 +1,15 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, random, sys, unittest, logging + import string as st from binascii import unhexlify - from unicorn.x86_const import * -sys.path.insert(0, "..") +sys.path.append("..") from qiling import * from qiling.const import * from qiling.exception import * diff --git a/tests/test_perf.py b/tests/test_perf.py index c76374a8..c25ac061 100644 --- a/tests/test_perf.py +++ b/tests/test_perf.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import cProfile import pstats diff --git a/tests/test_peshellcode.py b/tests/test_peshellcode.py index bc810cec..4a1930e6 100644 --- a/tests/test_peshellcode.py +++ b/tests/test_peshellcode.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# + +import sys, unittest from binascii import unhexlify -import sys, unittest -sys.path.insert(0, "..") - +sys.path.append("..") from qiling import * from qiling.exception import * diff --git a/tests/test_posix.py b/tests/test_posix.py index eb413471..6eb39064 100644 --- a/tests/test_posix.py +++ b/tests/test_posix.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys,unittest + sys.path.append("..") from qiling import * from qiling.exception import * diff --git a/tests/test_qltool.py b/tests/test_qltool.py index 6ccaf4f4..c6d060df 100644 --- a/tests/test_qltool.py +++ b/tests/test_qltool.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, subprocess, unittest + sys.path.append("..") from qiling import * from qiling.exception import * diff --git a/tests/test_shellcode.py b/tests/test_shellcode.py index 30407d19..9b99fc42 100644 --- a/tests/test_shellcode.py +++ b/tests/test_shellcode.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# -import sys,unittest +import sys, unittest from binascii import unhexlify + sys.path.append("..") from qiling import * from qiling.exception import * diff --git a/tests/test_uefi.py b/tests/test_uefi.py index f179c5bb..ecfaa471 100644 --- a/tests/test_uefi.py +++ b/tests/test_uefi.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import os, pickle, sys,unittest + sys.path.append("..") from qiling import Qiling from qiling.extensions.sanitizers.heap import QlSanitizedMemoryHeap diff --git a/tests/test_windows_debugger.py b/tests/test_windows_debugger.py index a1a65a42..7c9e0dd8 100644 --- a/tests/test_windows_debugger.py +++ b/tests/test_windows_debugger.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) +# import sys, subprocess, threading, unittest, socket, time + from binascii import unhexlify + sys.path.append("..") from qiling import * from qiling.exception import * diff --git a/tests/test_windows_stdio.py b/tests/test_windows_stdio.py index 57bcfbb2..d60a698a 100644 --- a/tests/test_windows_stdio.py +++ b/tests/test_windows_stdio.py @@ -1,15 +1,17 @@ #!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework -# Built on top of Unicorn emulator (www.unicorn-engine.org) -from unicorn import * - -from unicorn.x86_const import * +# import sys + +from unicorn import * +from unicorn.x86_const import * + sys.path.append("..") from qiling import * + class StringBuffer: def __init__(self): self.buffer = b'' diff --git a/tests/view_perf_results.py b/tests/view_perf_results.py index 7a78cf89..57e81be1 100644 --- a/tests/view_perf_results.py +++ b/tests/view_perf_results.py @@ -1,7 +1,12 @@ -import sys -import os -import io +#!/usr/bin/env python3 +# +# Cross Platform and Multi Architecture Advanced Binary Emulation Framework +# + +import io, os, sys + import pstats + from tkinter import * from tkinter import filedialog from tkinter import messagebox as msgbox