Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import webbrowser
- import urllib.request
- import re
- import sys
- import threading
- from threading import Thread
- print("donne les 2 premier octets ")
- r = input(str(":"))
- i = 0
- x = 1
- """
- --------------------------------------------------------
- ------------------------Thread 1------------------------
- --------------------------------------------------------
- """
- def f1(x,i,r):
- while i < 64:
- i += 1
- y = str(x)
- u0 = str(i)
- try:
- t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
- except:
- t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
- print(t0)
- if t0 == 200:
- print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
- #webbrowser.open('http://'+r+'.'+y+'.'+u)
- url = 'http://'+r+'.'+y+'.'+u0
- req = urllib.request.Request(url)
- resp = urllib.request.urlopen(req)
- respData = resp.read()
- Title = re.findall(r'e>(.*?)</title>',str(respData))
- Title = str(Title)
- print(Title)
- print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
- if i == 64:
- i = 0
- x += 1
- """
- --------------------------------------------------------
- ------------------------Thread 2------------------------
- --------------------------------------------------------
- """
- def f2(x,i,r):
- while i < 64:
- i += 1
- y = str(x)
- u0 = str(i+64)
- try:
- t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
- except:
- t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
- print(t0)
- if t0 == 200:
- print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
- #webbrowser.open('http://'+r+'.'+y+'.'+u)
- url = 'http://'+r+'.'+y+'.'+u0
- req = urllib.request.Request(url)
- resp = urllib.request.urlopen(req)
- respData = resp.read()
- Title = re.findall(r'e>(.*?)</title>',str(respData))
- Title = str(Title)
- print(Title)
- print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
- if i == 64:
- i = 0
- x += 1
- """
- --------------------------------------------------------
- ------------------------Thread 3------------------------
- --------------------------------------------------------
- """
- def f3(x,i,r):
- while i < 64:
- i += 1
- y = str(x)
- u0 = str(i+128)
- try:
- t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
- except:
- t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
- print(t0)
- if t0 == 200:
- print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
- #webbrowser.open('http://'+r+'.'+y+'.'+u)
- url = 'http://'+r+'.'+y+'.'+u0
- req = urllib.request.Request(url)
- resp = urllib.request.urlopen(req)
- respData = resp.read()
- Title = re.findall(r'e>(.*?)</title>',str(respData))
- Title = str(Title)
- print(Title)
- print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
- if i == 64:
- i = 0
- x += 1
- """
- --------------------------------------------------------
- ------------------------Thread 4------------------------
- --------------------------------------------------------
- """
- def f4(x,i,r):
- while i < 64:
- i += 1
- y = str(x)
- u0 = str(i+192)
- try:
- t0 = urllib.request.urlopen('http://'+r+'.'+y+'.'+u0, timeout=1).getcode()
- except:
- t0 = 'http://'+r+'.'+y+'.'+u0+' ---NOP---'
- print(t0)
- if t0 == 200:
- print('http://'+r+'.'+y+'.'+u0+' ---OUI---')
- #webbrowser.open('http://'+r+'.'+y+'.'+u)
- url = 'http://'+r+'.'+y+'.'+u0
- req = urllib.request.Request(url)
- resp = urllib.request.urlopen(req)
- respData = resp.read()
- Title = re.findall(r'e>(.*?)</title>',str(respData))
- Title = str(Title)
- print(Title)
- print('http://'+r+'.'+y+'.'+u0+' ---'+Title+'---', file=open("outpute.txt", "a"))
- if i == 64:
- i = 0
- x += 1
- """
- --------------------------------------------------------
- ------------------------lancement Des Threads-----------
- --------------------------------------------------------
- """
- if __name__ == "__main__":
- tr1 = Thread(target = f1, args=[x,i,r])
- tr2 = Thread(target = f2, args=[x,i,r])
- tr3 = Thread(target = f3, args=[x,i,r])
- tr4 = Thread(target = f4, args=[x,i,r])
- tr1.setDaemon(True)
- tr2.setDaemon(True)
- tr3.setDaemon(True)
- tr4.setDaemon(True)
- tr1.start()
- tr2.start()
- tr3.start()
- tr4.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement