Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # ---
- # try_dirs.py
- # this 'module' will check if there is a file/dir at remote host.
- # files/dirs can be edited (you will find it at dirsToCheck.txt file).
- # ---
- # More @ http://hauntit.blogspot.com
- # version : 2
- #
- import urllib
- import sys
- # defines:
- url = sys.argv[1]
- dirsToCheck = open('dirsToCheck.txt','r')
- try_dir = dirsToCheck.readlines()
- if len(sys.argv) < 2:
- sys.stderr.write('usage: '+sys.argv[0]+' http://localhost/')
- sys.exit(1)
- else:
- print '--------------------------------------------------------------'
- print 'Try enumerate files/dirs at this URL: ',url
- print '--------------------------------------------------------------'
- i=0
- for line in try_dir:
- full_url_to_check = url+line
- # print full_url_to_check
- try_page = urllib.urlopen(full_url_to_check)
- i=i+1
- if try_page.getcode() == 200:
- print 'Found location: ', line
- print 'Status: ', try_page.getcode()
- print '------------------------------------------'
- elif try_page.getcode() == 401:
- print 'Found location: ', line
- print 'Seems to be authorized only: ', try_page.getcode()
- print '------------------------------------------'
- elif try_page.getcode() >= 500:
- print 'Found server-side problem: ', line
- print 'Status: ', try_page.getcode()
- print '------------------------------------------'
- elif try_page.getcode() == 403:
- print 'Found but you have no permissions to access: ', line
- print 'Status: ', try_page.getcode()
- print '------------------------------------------'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement