├── .gitignore ├── requirements.txt ├── examples ├── example_results.txt └── example_dictionary.txt ├── README.md └── thf.py /.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.9.1 2 | wheel==0.24.0 3 | -------------------------------------------------------------------------------- /examples/example_results.txt: -------------------------------------------------------------------------------- 1 | 5i4uotegiwf 2 | rewosdfhno 3 | groeisfdans 4 | -------------------------------------------------------------------------------- /examples/example_dictionary.txt: -------------------------------------------------------------------------------- 1 | charleslai 2 | 5i4uotegiwf 3 | rewosdfhno 4 | groeisfdans 5 | cat 6 | ant 7 | bear 8 | arrow 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # twitter-handle-finder 2 | Find available Twitter handles via dictionary brute force. The main `thf.py` script will iterate through a line-separated file and check each word for availability as a Twitter handle. Results are saved in a `results.txt` file. 3 | 4 | ## Installation 5 | `virtualenv venv && source venv/bin/activate && pip install -r requirements.txt` 6 | 7 | ## Usage 8 | `python thf.py dictionary.txt` 9 | 10 | -------------------------------------------------------------------------------- /thf.py: -------------------------------------------------------------------------------- 1 | # Twitter handle finder: Brute force Twitter for handles 2 | 3 | import sys, os 4 | import requests 5 | 6 | def main(argv): 7 | # Check if arguments formed correctly 8 | if len(argv) < 1: 9 | sys.stderr.write("Usage: %s \n" % (argv[0],)) 10 | return 1 11 | 12 | if not os.path.exists(argv[1]): 13 | sys.stderr.write("ERROR: Dictionary %r was not found!\n" % (argv[1],)) 14 | return 1 15 | 16 | base_url = "https://twitter.com/" 17 | 18 | # Iterate through the dictionary and save valid handles 19 | print "Checking available Twitter handles..." 20 | with open(argv[1],'r') as dictionary: 21 | with open("results.txt", 'a') as out: 22 | for w in dictionary: 23 | if requests.get(base_url + w.rstrip()).status_code == 404: 24 | out.write(w) 25 | print "Done." 26 | 27 | if __name__ == "__main__": 28 | sys.exit(main(sys.argv)) 29 | --------------------------------------------------------------------------------