Advertisement
peanutstick

Untitled

Jan 30th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.50 KB | None | 0 0
  1. import webbrowser
  2. import urllib.request
  3. import re
  4. import sys
  5. import threading
  6. from threading import Thread
  7.  
  8. print("donne les 2 premier octets ")
  9. r = input(str(":"))
  10. i = 0
  11. x = 1
  12. """
  13. --------------------------------------------------------
  14. ------------------------Thread 1------------------------
  15. --------------------------------------------------------
  16. """
  17. def f1(x,i,r):
  18.     while i < 64:
  19.             i += 1
  20.             y = str(x)
  21.             u0 = str(i)
  22.             try:
  23.                 t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
  24.             except:
  25.                 t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
  26.                 print(t0)
  27.             if t0 == 200:
  28.                 print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
  29.                 #webbrowser.open('http://'+r+'.'+y+'.'+u)
  30.                 url = 'http://'+r+'.'+y+'.'+u0
  31.                 req = urllib.request.Request(url)
  32.                 resp = urllib.request.urlopen(req)
  33.                 respData = resp.read()
  34.                 Title = re.findall(r'e>(.*?)</title>',str(respData))
  35.                 Title = str(Title)
  36.                 print(Title)
  37.                 print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
  38.             if i == 64:
  39.                 i = 0
  40.                 x += 1
  41. """
  42. --------------------------------------------------------
  43. ------------------------Thread 2------------------------
  44. --------------------------------------------------------
  45. """
  46. def f2(x,i,r):
  47.     while i < 64:
  48.                 i += 1
  49.                 y = str(x)
  50.                 u0 = str(i+64)
  51.                 try:
  52.                     t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
  53.                 except:
  54.                     t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
  55.                     print(t0)
  56.                 if t0 == 200:
  57.                     print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
  58.                     #webbrowser.open('http://'+r+'.'+y+'.'+u)
  59.                     url = 'http://'+r+'.'+y+'.'+u0
  60.                     req = urllib.request.Request(url)
  61.                     resp = urllib.request.urlopen(req)
  62.                     respData = resp.read()
  63.                     Title = re.findall(r'e>(.*?)</title>',str(respData))
  64.                     Title = str(Title)
  65.                     print(Title)
  66.                     print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
  67.                 if i == 64:
  68.                     i = 0
  69.                     x += 1
  70. """
  71. --------------------------------------------------------
  72. ------------------------Thread 3------------------------
  73. --------------------------------------------------------
  74. """
  75. def f3(x,i,r):
  76.     while i < 64:
  77.                 i += 1
  78.                 y = str(x)
  79.                 u0 = str(i+128)
  80.                 try:
  81.                     t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
  82.                 except:
  83.                     t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
  84.                     print(t0)
  85.                 if t0 == 200:
  86.                     print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
  87.                     #webbrowser.open('http://'+r+'.'+y+'.'+u)
  88.                     url = 'http://'+r+'.'+y+'.'+u0
  89.                     req = urllib.request.Request(url)
  90.                     resp = urllib.request.urlopen(req)
  91.                     respData = resp.read()
  92.                     Title = re.findall(r'e>(.*?)</title>',str(respData))
  93.                     Title = str(Title)
  94.                     print(Title)
  95.                     print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
  96.                 if i == 64:
  97.                     i = 0
  98.                     x += 1
  99. """
  100. --------------------------------------------------------
  101. ------------------------Thread 4------------------------
  102. --------------------------------------------------------
  103. """
  104. def f4(x,i,r):
  105.     while i < 64:
  106.                 i += 1
  107.  
  108.                 y = str(x)
  109.                 u0 = str(i+192)
  110.                 try:
  111.                     t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
  112.                 except:
  113.                     t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
  114.                     print(t0)
  115.                 if t0 == 200:
  116.                     print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
  117.                     #webbrowser.open('http://'+r+'.'+y+'.'+u)
  118.                     url = 'http://'+r+'.'+y+'.'+u0
  119.                     req = urllib.request.Request(url)
  120.                     resp = urllib.request.urlopen(req)
  121.                     respData = resp.read()
  122.                     Title = re.findall(r'e>(.*?)</title>',str(respData))
  123.                     Title = str(Title)
  124.                     print(Title)
  125.                     print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
  126.                 if i == 64:
  127.                     i = 0
  128.                     x += 1
  129. """
  130. --------------------------------------------------------
  131. ------------------------lancement Des Threads-----------
  132. --------------------------------------------------------
  133. """
  134. if __name__ == "__main__":
  135.     tr1 = Thread(target = f1, args=[x,i,r])
  136.     tr2 = Thread(target = f2, args=[x,i,r])
  137.     tr3 = Thread(target = f3, args=[x,i,r])
  138.     tr4 = Thread(target = f4, args=[x,i,r])
  139.     tr1.setDaemon(True)
  140.     tr2.setDaemon(True)
  141.     tr3.setDaemon(True)
  142.     tr4.setDaemon(True)
  143.     tr1.start()
  144.     tr2.start()
  145.     tr3.start()
  146.     tr4.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement