Burp Suite User Forum

Login to post

Turbo Intruder ( Import error of a python library - requests module )

Mritunjya | Last updated: Sep 16, 2023 07:15PM UTC

I am trying to import requests library of Python in Turbo Intruder attack scripts But I am encoutering this error ``` There was an error executing your Python script. This is probably due to a flaw in your script, rather than a bug in Turbo Intruder :) ``` And here is the full stack trace: ``` Traceback (most recent call last): File "<string>", line 4, in <module> ImportError: No module named requests at org.python.core.Py.ImportError(Py.java:328) at org.python.core.imp.import_first(imp.java:877) at org.python.core.imp.import_module_level(imp.java:972) at org.python.core.imp.importName(imp.java:1062) at org.python.core.ImportFunction.__call__(__builtin__.java:1280) at org.python.core.PyObject.__call__(PyObject.java:431) at org.python.core.__builtin__.__import__(__builtin__.java:1232) at org.python.core.imp.importOne(imp.java:1081) at org.python.pycode._pyx1.f$0(<string>:25) at org.python.pycode._pyx1.call_function(<string>) at org.python.core.PyTableCode.call(PyTableCode.java:167) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1386) at org.python.core.Py.exec(Py.java:1430) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:267) at burp.Fast_httpKt.evalJython(fast-http.kt:55) at burp.TurboIntruderFrame$actionPerformed$1$ToggleAttack$actionPerformed$1.invoke(fast-http.kt:340) at burp.TurboIntruderFrame$actionPerformed$1$ToggleAttack$actionPerformed$1.invoke(fast-http.kt:289) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)``` I have even set the path for loading python modules in Extensions -> Extension Settings, it's set to ``` /usr/local/lib/python3.8/dist-packages``` James told in this post here: https://github.com/PortSwigger/turbo-intruder/issues/121 third party libraries are supported, if they are written in Python themselves and not C I checked and requests library is written completely in Python only by installing jython locally and importing requests there, it's getting imported there perfectly fine But having trouble while importing requests module in Turbo Intruder ...

paulwings | Last updated: Sep 18, 2023 05:04AM UTC

The "ImportError: No module named requests" error occurs when you try to import the "requests" module in Python, but it's not installed in your environment. To fix this, you should install the "requests" library using pip, a package manager for Python. Open your command prompt or terminal and run the command "pip install requests." This will download and install the "requests" module, allowing you to use it in your Python scripts. Ensure that pip is properly installed and configured in your Python environment before running the installation command. https://net-informations.com/python/err/imp.htm

Mritunjya | Last updated: Sep 18, 2023 01:33PM UTC

Hey Paul, I have both python3 and python installed Requests module is installed in python3 but not in python ``` ❯ which python /usr/bin/python ❯ python --version Python 2.7.18 ❯ which python3 /usr/bin/python3 ❯ python3 --version Python 3.8.10``` So to check which version of Python, Turbo Intruder is running so I used this script inside Turbo Intruder script ``` import sys print(sys.path) print(sys.version)``` Output: ``` ['/tmp/burp15654143336216621298.tmp/Lib', '/tmp/burp15654143336216621298.tmp/1/Lib', '__classpath__', '__pyclasspath__/'] 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)``` Seems to me that Turbo Intruder is running python by default in a specific environment, jython I guess How do I configure it to use python3 as my standard running environment in Turbo Intruder ??

Mritunjya | Last updated: Sep 21, 2023 04:01AM UTC

@paulwings any updates ...

You need to Log in to post a reply. Or register here, for free.