Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #-*- coding: utf-8 -*-
- try:
- from splinter import Browser
- except:
- print "Please install Splinter: http://splinter.readthedocs.org/en/latest/install.html"
- sys.exit()
- try:
- from stem.control import Controller
- except:
- print "Please install Stem: https://stem.torproject.org"
- sys.exit()
- import sys, getopt, re, os
- from stem.control import Controller
- from datetime import datetime
- from splinter.request_handler.status_code import HttpResponseError
- import getpass
- def main(argv):
- d = datetime.now()
- date = str(d.year) + '' + str(d.month) + '' + str(d.day) + '' + str(d.hour) + '' + str(d.minute) + '' + str(d.second)
- username = None
- txt = None
- try:
- opts, args = getopt.getopt(argv, "hi:u:", ["file=", "user=", "help"])
- except getopt.GetoptError:
- print 'Use --help for help'
- sys.exit(2)
- for opt, arg in opts:
- if opt in ("-h", "--help"):
- print 'Usage: %s <options> \n' % (os.path.basename(__file__))
- print ' -h, --help This help'
- print ' -u, --user USERNAME Your Twitter username'
- print ' -f, --file FILE File with twitter URLs list'
- sys.exit()
- elif opt in ("-i", "--file"):
- txt = arg
- elif opt in ("-u", "--user"):
- username = arg
- if not username and not txt:
- print 'Use --help for help\n'
- print 'Usage: python twitterReport.py -u <Twitter username> -i <account_list.txt>'
- print 'The accounts list must have only 1 account per line'
- sys.exit()
- password = getpass.getpass()
- # uncomment this section if you want to use privoxy + tor:
- #
- if __name__ == "__main__":
- port = 5000
- host = "127.0.0.1"
- hidden_svc_dir = "c:/temp/"
- @app.route('/')
- def index():
- return "<h1>Tor works!</h1>"
- print " * Getting controller"
- controller = Controller.from_port(address="127.0.0.1", port=9151)
- try:
- controller.authenticate(password="")
- controller.set_options([
- ("HiddenServiceDir", hidden_svc_dir),
- ("HiddenServicePort", "80 %s:%s" % (host, str(port)))
- ])
- svc_name = open(hidden_svc_dir + "/hostname", "r").read().strip()
- print " * Created host: %s" % svc_name
- except Exception:
- print e
- app.run()
- if "https://twitter.com/login/error" in browser.url:
- print "The email and password you entered did not match our records."
- sys.exit()
- for line in file:
- try:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement