Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. import re
  2. import threading
  3. import queue
  4.  
  5. ParsedQue = queue.Queue()
  6.  
  7. def openFile():
  8. file = open('links.txt', 'rb')
  9. for line in file:
  10. startParsing(line)
  11.  
  12.  
  13. def startParsing(targetLink):
  14. firstThread = threading.Thread(target=parseFirstPart(targetLink)).start()
  15. secondThread = threading.Thread(target=parseSecondPart(targetLink)).start()
  16. thirdThread = threading.Thread(target=parseThirdPart(targetLink)).start()
  17. forthThread = threading.Thread(target=parseForthPart(targetLink)).start()
  18. fifthThread = threading.Thread(target=parseFifthPart(targetLink)).start()
  19. sixThread = threading.Thread(target=parseSixPart(targetLink)).start()
  20. print('Done : ' + str(targetLink))
  21.  
  22. ## regexp methods
  23. def parseFirstPart(targetLink):
  24. res = re.findall(r'\.php\?[a-zA-z0-9]{1,30}=' , str(targetLink))
  25. if not res:
  26. pass
  27. else:
  28. ParsedQue.put(res[0])
  29.  
  30. def parseSecondPart(targetLink):
  31. res = re.findall(r'&[a-zA-Z0-9]{0,20}[_]{0,1}[a-zA-Z0-9]{0,20}=' , str(targetLink))
  32. if res:
  33. z = res[0].replace('&' , '.php?')
  34. ParsedQue.put(z)
  35. else:
  36. pass
  37.  
  38. def parseThirdPart(targetLink):
  39. res = re.findall(r'//[w]{3}\.{0,1}[a-zA-Z0-9]{0,30}' , str(targetLink))
  40. if res:
  41. z = res[0].replace('//www.' , '.php?')
  42. ParsedQue.put(z + '=')
  43. else:
  44. pass
  45.  
  46. def parseForthPart(targetLink):
  47. res = re.findall(r'//[^w]{3}[a-zA-Z0-9]{0,30}' , str(targetLink))
  48. if res:
  49. z = res[0].replace('//' , '.php?')
  50. ParsedQue.put(z + '=')
  51. else:
  52. pass
  53. ############################################ This part
  54. def parseFifthPart(targetLink):
  55. res = re.findall(r'=[a-zA-Z]{1,20}\_[a-zA-Z]{1,20}' , str(targetLink))
  56. if res:
  57. z = res[0].replace('=' , '.php?')
  58. ParsedQue.put(z + '=')
  59. else:
  60. pass
  61.  
  62. def parseSixPart(targetLink):
  63. res = re.findall(r'=[a-zA-Z]{1,20}' , str(targetLink))
  64. if res:
  65. z = res[0].replace('=' , '.php?')
  66. ParsedQue.put(z + '=')
  67. else:
  68. pass
  69. #############################################
  70.  
  71. ##creatin file with result
  72. def fileWritting():
  73. result = open('result.txt' , 'w')
  74. getArray = removeDublicates()
  75. privatArray = checkForExistingDorcs(getArray)
  76. for row in privatArray:
  77. result.write(str(row) + '\n')
  78. result.close()
  79.  
  80. ## delete copies
  81. def removeDublicates():
  82. result = []
  83. mass = []
  84. while not ParsedQue.empty():
  85. mass.append(ParsedQue.get())
  86.  
  87. for row in mass:
  88. if row not in result:
  89. result.append(row)
  90. return result
  91.  
  92. def checkForExistingDorcs(mass):
  93. res = []
  94. for row in mass:
  95. if row not in open('base.txt').read():
  96. res.append(row)
  97. file = open('base.txt' , 'a')
  98. file.write(row + '\n')
  99. file.close()
  100. print('========================================')
  101. print('Created ' + str(len(res)) + ' new dorks')
  102. print('========================================')
  103. return res
  104.  
  105.  
  106.  
  107.  
  108. openFile()
  109. fileWritting()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement