bong/bong.py
2018-06-26 11:29:40 +02:00

38 lines
687 B
Python

import sys
from netaddr import IPNetwork
import requests
import xml.etree.ElementTree as ET
url = 'https://www.bing.com/search'
cidr = '192.168.1.1/24'
def main():
first = 1
for ip in IPNetwork(cidr):
print('Looking for ' + str(ip))
while (parse(search(str(ip), first))):
if first > 200:
break
first += 10
def help():
print('Usage: ./dork 192.168.1.1/24')
def search(ip, first):
r = requests.get(url, params={'q': 'ip:' + ip, 'format': 'rss', 'first': first});
tree = ET.fromstring(r.content)
return tree
def parse(tree):
count = 0
for i in tree[0]:
if i.tag == 'item':
count += 1
print(i[1].text)
if count == 10:
return 1
else:
return 0
main()