internetwache / GitTools

A repository with 3 tools for pwn'ing websites with .git repositories available
MIT License
3.78k stars 612 forks source link

Import Error #3

Closed ITuser07 closed 7 years ago

ITuser07 commented 7 years ago

Any idea why when trying to run python gitfinder.py it would be throwing the following error?

File "gitfinder.py", line 3, in <module>
   from urllib.request import urlopen
ImportError: No module named request
gehaxelt commented 7 years ago

Hi, which python version are you using? Did you try python2 ?

ITuser07 commented 7 years ago

It's Python 2.7.12 will this one not work?

gehaxelt commented 7 years ago

Hi, I'm sorry for the delay and I was wrong initially. The script is written for python3.

Could you try to run with with python3 gitfinder.py ?

ITuser07 commented 7 years ago

Thanks, that did seem to work. It's scanning and finishing now, I must be doing something wrong though as it's not outputting.

command = python3 gitfinder.py -i input.txt -o output.txt Note: the input.txt file has one line in it that has http://www.mysite.com

gehaxelt commented 7 years ago

Does your domain expose a ".git" repository?

Can you manually downlad http://www.mysite.com/.git/HEAD ?

ITuser07 commented 7 years ago

Yep it does and yep I can. Does the output.txt file need to exist already then it just writes to it or does it actually create the file? I've tried it both ways and neither worked.

gehaxelt commented 7 years ago

Hmm, that's strange. I think it should create the file automatically.

Can you send me an email with your domain?

ITuser07 commented 7 years ago

I don't think it's the domain as I have tried 2 different ones. I would prefer not to give the address out sense the git is exposed.

Heres a snipit of my command:

~/GitTools/Finder$ python3 gitfinder.py -i domains.txt -o output.txt Scanning... Finished

inside the domains.txt file are 2 lines. http://www.mysite.com http://mysite2.com

both of them have exposed git directory's and directory listing is enabled.

gehaxelt commented 7 years ago

Hi, the python script appends http:// to all domains:

        req = urlopen('http://' + domain + "/.git/HEAD")

The input file should only contain domains, not full urls. Removing http:// should help.

ITuser07 commented 7 years ago

You hit the nail on the head. That was it. Thank you! :)

gehaxelt commented 7 years ago

You're welcome!