tbodt / v8py

Write Python APIs, then call them from JavaScript using the V8 engine.
GNU Lesser General Public License v3.0
440 stars 28 forks source link

Infinite recursion in Debugger. #22

Closed armudgal closed 6 years ago

armudgal commented 6 years ago

Hi, Using the v8py.debug.Debugger as this:

class Debugger(v8py.debug.Debugger):
    def __init__(self, ctxt):
        super(Debugger, self).__init__(ctxt)

An exception occurs. (Please note that I have removed redundant lines to make the traceback readable)

Traceback (most recent call last):
  File "/usr/local/bin/thug", line 11, in <module>
    load_entry_point('thug==0.9.22', 'console_scripts', 'thug')()
  File "/home/arushit/Desktop/thug/thug/thug.py", line 342, in main
    Thug(sys.argv[1:])()
  File "/home/arushit/Desktop/thug/thug/ThugAPI/ThugAPI.py", line 107, in __call__
    self.analyze()
  File "/home/arushit/Desktop/thug/thug/thug.py", line 333, in analyze
    p(args[0])
  File "/home/arushit/Desktop/thug/thug/ThugAPI/ThugAPI.py", line 414, in run_local
    self.__run(window)
  File "/home/arushit/Desktop/thug/thug/ThugAPI/ThugAPI.py", line 372, in __run
    dft.run()
  File "/home/arushit/Desktop/thug/thug/DOM/DFT.py", line 1427, in run
    self._run()
  File "/home/arushit/Desktop/thug/thug/DOM/DFT.py", line 1372, in _run
    if not self.do_handle(child, soup):
  File "/home/arushit/Desktop/thug/thug/DOM/DFT.py", line 1339, in do_handle
    handler(child)
  File "/home/arushit/Desktop/thug/thug/DOM/DFT.py", line 764, in handle_script
    handler(script)
  File "/home/arushit/Desktop/thug/thug/DOM/DFT.py", line 855, in handle_javascript
    self.window.evalScript(js, tag = script)
  File "/home/arushit/Desktop/thug/thug/DOM/Window.py", line 976, in evalScript
    result    = shellcode.run()
  File "/home/arushit/Desktop/thug/thug/Debugger/Shellcode.py", line 90, in run
    with Debugger(self.ctxt) as dbg:
  File "/home/arushit/Desktop/thug/thug/Debugger/Debugger.py", line 34, in __init__
    super(Debugger, self).__init__(ctxt)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
    .
    .
    . 
    .
    .
    .
    .
    .
    .
    .
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)
  File "/home/arushit/Desktop/v8py/v8py/debug.py", line 7, in __init__
    super(self.__class__, self).__init__(context)

RuntimeError: maximum recursion depth exceeded while calling a Python object
Received signal 11 SEGV_MAPERR 000000000028

==== C stack trace ===============================

 [0x7f1ec5a0a301]
 [0x7f1ed13cdf20]
 [0x7f1ec509e172]
 [0x5604ba8f34e5]
 [0x5604ba8cd558]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba8cd59e]
 [0x5604ba93718e]
 [0x5604ba893ab2]
 [0x5604ba89737c]
 [0x5604ba8f7caa]
 [0x5604ba8f4e28]
 [0x5604ba891454]
 [0x7f1ed13b0b97]
 [0x5604ba890e0a]
[end of stack trace]
Segmentation fault (core dumped)
tbodt commented 6 years ago

Is this Python 2? I don't think I've ever tried to use the debugger on Python 2. Seems like you'll have to fix some stuff.

armudgal commented 6 years ago

Yeah this is Python2. Can you give me some pointers/opinion on how should I tackle the problem?

desertkun commented 6 years ago

I have fixed that in my branch.

tbodt commented 6 years ago

20 includes this fix from @desertkun's branch.