PortSwigger / python-scripter

Sourced from gist: https://gist.github.com/mwielgoszewski/7026954
50 stars 11 forks source link

"ImportError: No module named..." issue #7

Open matth82 opened 2 years ago

matth82 commented 2 years ago

When I want to import various libraries it gives an error (when using a .py script on my kali the import of these libs works):

import base64
import hashlib
import time
import json
import jwt
from Crypto.PublicKey import RSA

Error log:

Traceback (most recent call last):
  File "/home/matt/.BurpSuite/bapps/eb563ada801346e6bdb7a7d7c5c52587/models.py", line 165, in processHttpMessage
    exec(self._code, globals_, locals_)
  File "<string>", line 3, in <module>
ImportError: No module named Crypto
...
ImportError: No module named jwt

Now I used /home/matt/.local/lib/python3.9/site-packages as maindir in the 'Folder for loading modules (optional)' section in the Extender->Options tab an it seems to work. However, creating a global function using def... gives me:

"NameError: global name 'base64' is not defined" -> apparently one can use 'import' within a global function to resolve it.