mirror of
https://github.com/qilingframework/qiling.git
synced 2026-10-12 02:21:40 +00:00
27 lines
642 B
Python
27 lines
642 B
Python
#!/usr/bin/env python3
|
|
#
|
|
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
|
|
#
|
|
|
|
from sys import path
|
|
path.append('..')
|
|
|
|
from qiling import Qiling
|
|
from qiling.os.mapper import QlFsMappedObject
|
|
|
|
class Fake_urandom(QlFsMappedObject):
|
|
|
|
def read(self, size):
|
|
return b"\x01" # fixed value for reading /dev/urandom
|
|
|
|
def fstat(self): # syscall fstat will ignore it if return -1
|
|
return -1
|
|
|
|
def close(self):
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
ql = Qiling(["rootfs/x86_linux/bin/x86_fetch_urandom"], "rootfs/x86_linux")
|
|
ql.add_fs_mapper("/dev/urandom", Fake_urandom())
|
|
ql.run()
|