From 11010df1a631d9b230de376b2cbd21695ec7a471 Mon Sep 17 00:00:00 2001 From: Giulio Date: Tue, 26 Jun 2018 11:29:40 +0200 Subject: [PATCH] Import --- bong.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 bong.py diff --git a/bong.py b/bong.py new file mode 100644 index 0000000..71f02b5 --- /dev/null +++ b/bong.py @@ -0,0 +1,38 @@ +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() \ No newline at end of file