Advertisement
Guest User

d_f_bruter v0.1

a guest
Jun 28th, 2010
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.01 KB | None | 0 0
  1. #!/usr/bin/python
  2. # script coded by datahack from pentest101.blogspot.com
  3. # d_f_bruter very smart script to brute force dirs and files
  4. # we are not responsible for any bad usage
  5. # have fun
  6.  
  7. import re
  8. import sys
  9. import httplib
  10.  
  11. def usage():
  12.     print "#### script coded by Pentest101 Team ####"
  13.     print "#### brute force dirs and files      ####"
  14.     print "[+] usage : ./d_f_bruter.py -[options] [file] [site]"
  15.     print "[+] usage : ./d_f_bruter.py -D file_dris.txt  [site]"
  16.     print "[+] usage : ./d_f_bruter.py -F file_files.txt [site]"
  17.     print "[+] usage : ./d_f_bruter.py -A file_dirs.txt file_files.txt [site]"  
  18.     print "[+] options:"
  19.     print "     -D : brute dirs"
  20.     print "     -F : brute files"
  21.     print "     -A : brute dirs first files second"
  22.     sys.exit()
  23.  
  24. def brute_dirs(filename,site):
  25.  
  26.     print ">>> brute forcing dirs : ",site
  27.     print ""
  28.     f = open(filename)
  29.     files = f.readlines();
  30.     for ff in files:
  31.             ff = re.sub('\n$','',ff)
  32.             conn = httplib.HTTPConnection(site)
  33.             conn.request("GET","/" + ff)
  34.             r1 = conn.getresponse()
  35.             print ff,' ',r1.status , r1.reason
  36.             conn.close()
  37.  
  38. def brute_files(filename,site):
  39.         print ">>> brute forcing files : ",site
  40.     print ""
  41.     f = open(filename)
  42.         files = f.readlines();
  43.         for ff in files:
  44.                 ff = re.sub('\n$','',ff)
  45.                 conn = httplib.HTTPConnection(site)
  46.                 conn.request("GET","/" + ff)
  47.                 r1 = conn.getresponse()
  48.                 print ff,' ',r1.status , r1.reason
  49.                 conn.close()
  50.  
  51. def main():
  52.     try:
  53.         if sys.argv[1] == "-D":
  54.             brute_dirs(sys.argv[2],sys.argv[3])
  55.             print "coded by Pentest101.blogspot.com"
  56.         elif sys.argv[1] == "-F":
  57.             brute_files(sys.argv[2],sys.argv[3])
  58.             print "coded by Pentest101.blogspot.com"
  59.         elif sys.argv[1] == "-A":
  60.             brute_dirs(sys.argv[2],sys.argv[4])
  61.             brute_files(sys.argv[3],sys.argv[4])
  62.             print "coded by Pentest101.blogspot.com"
  63.         else:
  64.             usage()
  65.     except IndexError:
  66.         usage()
  67. # good to go
  68. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement