RSSNSA.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/python3
  2. #
  3. # RSSNSA RSS nice shim anonymizer (actually it is just a proxy but i want that dope NSA in the name)
  4. # Anonymize your RSS readers by spreading fetches over multiple circuits!
  5. #
  6. # Dependencies:
  7. # * Tor
  8. # * torsocks
  9. # * wget
  10. # * python3
  11. import time
  12. import threading
  13. import random
  14. import subprocess
  15. import http.server
  16. import socketserver
  17. # Fakeuseragent fakes the user agent. Duh. Here are some ideas:
  18. #
  19. # QuiteRSS: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/602.1 (KHTML, like Gecko) QuiteRSS/0.18.12 Safari/602.1
  20. # Akregator: Akregator/5.9.3; syndication
  21. # Liferea: Liferea/1.12.6 (Linux; https://lzone.de/liferea/) AppleWebKit (KHTML, like Gecko)
  22. # newsboat: newsboat/2.13.0 (Linux x86_64)
  23. # FeedReader: FeedReader 2.7.1
  24. # DankShit: Hi, don't mind me. Im just a Tor user. You should host an onion btw!
  25. # Wget: Wget/1.20.1 (linux-gnu)
  26. torip='127.0.0.1'
  27. torport='9050'
  28. randomize=True
  29. fakeuseragent='Hi, don\'t mind me, im just a Tor user. You should host an onion btw!'
  30. serveport=8000
  31. # Format is: ('URL','name on disk/proxyserver',interval in seconds),
  32. # Interval has to be larger than 2 when enabling randomization or tits go up
  33. #
  34. # Seconds - Hours
  35. # 0.1 - 600
  36. # 0.5 - 1800
  37. # 1 - 3600
  38. # 2 - 7200
  39. # 6 - 21600
  40. # 24 - 86400
  41. feeds=[ ('https://blog.torproject.org/rss.xml','torblog.xml',20),
  42. ('http://tv54samlti22655ohq3oaswm64cwf7ulp6wzkjcvdla2hagqcu7uokid.onion/index.rss','matt.xml',20),
  43. ('https://www.nsa.gov/DesktopModules/ArticleCS/RSS.ashx?ContentType=1&Site=920&max=20','Fuckers.xml',86400)]
  44. class fetch (threading.Thread):
  45. def __init__(self, url, file,interval):
  46. threading.Thread.__init__(self)
  47. self.url = url
  48. self.file = file
  49. self.interval = interval
  50. def run(self):
  51. while (True):
  52. subprocess.run(['torsocks','--address',torip,'--port',torport,'-i','wget','--user-agent='+fakeuseragent,'-O'+self.file,self.url])
  53. if (randomize):
  54. time.sleep(random.randrange(self.interval/2,self.interval*2))
  55. else:
  56. time.sleep(self.interval)
  57. threads = list()
  58. for (url, file, interval) in feeds:
  59. threads.append(fetch(url,file,interval))
  60. for thread in threads:
  61. print('Starting thread')
  62. thread.start()
  63. socketserver.allow_reuse_address = True # Has no effect. lol. Anybody fix me pls.
  64. handler = http.server.SimpleHTTPRequestHandler
  65. with socketserver.TCPServer(("", serveport), handler) as httpd:
  66. print('Server started at localhost:' + str(serveport))
  67. socketserver.allow_reuse_address = True
  68. httpd.serve_forever()