troubleshoot a python script

sunhux
sunhux used Ask the Experts™
on
https://github.com/mazen160/struts-pwn/blob/master/README.md

I refer to the above url & I've got python 2.7 installed successfully on my Win XP.

When I ran the command below, got the error below:  need to help with the line 13 & importError :
 C:\rootc\strut>python struts-pwn.py --check --url 'http://www.google.com'
Traceback (most recent call last):
  File "struts-pwn.py", line 13, in <module>
    import requests
ImportError: No module named requests


Attached is the python script I downloaded ie struts-pwn.py
struts-pwn.py
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
When I ran the command below

if the command was issued in a cmd shell window you must not use single quote ' character for string argument but double quotes "

python struts-pwn.py --check --url "http://www.google.com"

Open in new window


if the string doesn't contain spaces you even could omit the double quotes.

i hope this comment helps as i don't know nothing of python.

Sara

Author

Commented:
I just tried without quotes & with double quotes & still getting the same message:

C:\rootc\strut>python struts-pwn.py --check --url http://www.google.com
Traceback (most recent call last):
  File "struts-pwn.py", line 13, in <module>
    import requests
ImportError: No module named requests

C:\rootc\strut>
C:\rootc\strut>python struts-pwn.py --check --url "http://www.google.com"
Traceback (most recent call last):
  File "struts-pwn.py", line 13, in <module>
    import requests
ImportError: No module named requests


Line 13 reads:
import requests

Author

Commented:
If I comment out line 13 by prefixing with #   and then rerun, it looks better:

C:\rootc\strut>python struts-pwn.py --check --url "http://www.google.com"

[*] URL: http://www.google.com
EXCEPTION::::--> global name 'requests' is not defined
[*] Status: Not Affected.
[%] Done.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Thing is without that line, I'm not sure if the script is working correctly.

So far it reported a few URLs as  "not affected" : if anyone has an affected URL for me to scan to verify, will be good

Author

Commented:
I know why:  though I have python Ver 2.7 installed, I'll still need
requests library installed : where can I download this?

A few links lead me to a site that requires me to have Sign-In id?
Anyone has it?
Try running:
python -m pip install requests

Open in new window

If you don't have pip, you might want to download/install that first.

Author

Commented:
I'm not on Linux but Windows
Ah. Sorry, I semi-automatically skipped over that because EE modified "Win XP" in your text to be one of those "ad" text things. Makes it harder to pay attention to those details. But that should work in Windows anyway.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial