qilingframework / qiling

A True Instrumentable Binary Emulation Framework

Home Page:https://qiling.io

Repository from Github https://github.comqilingframework/qilingRepository from Github https://github.comqilingframework/qiling

Python 3.12 distutils deprecated package

ScraperMan2002 opened this issue · comments

*Description
When importing and using qiling in a python file compiled using Python 3.12, a bug appears that says something along the lines as distutils cannot be found. This is because in Python 3.12 distutils is deprecated.

Sample Code

from qiling import Qiling
from qiling.const import QL_VERBOSE

if __name__ == "__main__":
    # set up command line argv, emulated os root path, os default profile, and verboseness level.
    argv = r"hello".split()
    rootfs = r"rootfs/arm64_linux"
    profile = "linux.ql"
    verboseness = QL_VERBOSE.DEBUG

    # instantiate a Qiling object using above arguments;
    # additional settings are read from profile file
    ql = Qiling(argv, rootfs, verbose=verboseness, profile=profile)

    # https://docs.qiling.io/en/latest/debugger/
    # ql.debugger = True

    # https://docs.qiling.io/en/latest/register/
    # https://docs.qiling.io/en/latest/memory/

    ql.run()

Expected output

[+] 	Profile: linux.ql
[+] 	Mapped 0x400000-0x401000
[+] 	Mapped 0x410000-0x411000
[+] 	mem_start : 0x400000
[+] 	mem_end  : 0x411000
[+] 	mmap_address is : 0x7fffb7dd6000
[+] 	Received interrupt: 0x2
[+] 	write() CONTENT: b'Hey folks\n'
Hey folks
[+] 	0x0000000000400014: write(fd = 0x1, buf = 0x410030, count = 0xa) = 0xa
[+] 	Received interrupt: 0x2
[+] 	0x0000000000400020: exit(code = 0x0) = ?
[+] 	
[+] 	syscalls called
[+] 	------------------------
[+] 	ql_syscall_write:
[+] 	 {"params": {"fd": 1, "buf": 4259888, "count": 10}, "retval": 10, "address": 4194324, "retaddr": null, "position": 0}
[+] 	ql_syscall_exit:
[+] 	 {"params": {"code": 0}, "retval": null, "address": 4194336, "retaddr": null, "position": 1}
[+] 	
[+] 	strings ocurrences
[+] 	------------------------
commented

Hi there,
Can you please be more specific about the error you are seeing?
I can't find any package required by Qiling that depends on it.

commented

Try pip install setuptools to install that package for python 3.12. I believe the capstone requirement needs that package.