bong.py 687 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import sys
  2. from netaddr import IPNetwork
  3. import requests
  4. import xml.etree.ElementTree as ET
  5. url = 'https://www.bing.com/search'
  6. cidr = '192.168.1.1/24'
  7. def main():
  8. first = 1
  9. for ip in IPNetwork(cidr):
  10. print('Looking for ' + str(ip))
  11. while (parse(search(str(ip), first))):
  12. if first > 200:
  13. break
  14. first += 10
  15. def help():
  16. print('Usage: ./dork 192.168.1.1/24')
  17. def search(ip, first):
  18. r = requests.get(url, params={'q': 'ip:' + ip, 'format': 'rss', 'first': first});
  19. tree = ET.fromstring(r.content)
  20. return tree
  21. def parse(tree):
  22. count = 0
  23. for i in tree[0]:
  24. if i.tag == 'item':
  25. count += 1
  26. print(i[1].text)
  27. if count == 10:
  28. return 1
  29. else:
  30. return 0
  31. main()