Advertisement
peanutstick

Untitled

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