Skip to content

AttributeError when setup in qilingida.py, because sys.stdin is None at idapython in windows. #1362

@0x79H

Description

@0x79H

error AttributeError: 'NoneType' object has no attribute 'fileno', when call sys.stdin.fileno() at setup in qilingida.py

ida 7.7😉
windows 11
python 3.10.5
qiling version: 1706049
target is arm elf file. ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV)

Traceback (most recent call last):
  File "C:/Users/root/AppData/Roaming/Hex-Rays/IDA Pro/plugins/qilingida.py", line 810, in activate
    self.action_handler.ql_handle_menu_action(self.action_type)
  File "C:/Users/root/AppData/Roaming/Hex-Rays/IDA Pro/plugins/qilingida.py", line 2098, in ql_handle_menu_action
    [x.handler() for x in self.menuitems if x.action == action]
  File "C:/Users/root/AppData/Roaming/Hex-Rays/IDA Pro/plugins/qilingida.py", line 2098, in <listcomp>
    [x.handler() for x in self.menuitems if x.action == action]
  File "C:/Users/root/AppData/Roaming/Hex-Rays/IDA Pro/plugins/qilingida.py", line 1037, in ql_start
    self.qlemu.start()
  File "C:/Users/root/AppData/Roaming/Hex-Rays/IDA Pro/plugins/qilingida.py", line 889, in start
    self.ql = Qiling(argv=self.path, rootfs=self.rootfs, verbose=QL_VERBOSE.DEBUG, env=self.env, log_plain=True, *args, **kwargs)
  File "C:\Python\Python3-10-5\lib\site-packages\qiling\core.py", line 189, in __init__
    self._os = select_os(ostype)(self)
  File "C:\Python\Python3-10-5\lib\site-packages\qiling\os\linux\linux.py", line 30, in __init__
    super(QlOsLinux, self).__init__(ql)
  File "C:\Python\Python3-10-5\lib\site-packages\qiling\os\posix\posix.py", line 142, in __init__
    super().__init__(ql)
  File "C:\Python\Python3-10-5\lib\site-packages\qiling\os\os.py", line 63, in __init__
    sys.stdin.fileno()
AttributeError: 'NoneType' object has no attribute 'fileno'

i check sys.stdin is None
and i know $IDAdir/python/3/init.py set stdout and stderr but not set stdin

try to fix this and find #475 (comment), same problem but not helpful.

no idea why sys.stdin is None in idapython, and no idea how to fix this.

any idea? thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions