Skip to content

Instantly share code, notes, and snippets.

@moloch--
Last active January 1, 2022 01:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save moloch--/c39234e6c2e9850ea1f9 to your computer and use it in GitHub Desktop.
Save moloch--/c39234e6c2e9850ea1f9 to your computer and use it in GitHub Desktop.
Password cracking twitter bot
#!/usr/bin/env python
#
# Password cracking twitter bot
#
import os
import time
import twitter
import json
import random
from datetime import datetime
from hashlookup.LookupTable import LookupTable
CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_TOKEN_KEY = ""
ACCESS_TOKEN_SECRET = ""
POLL = 60
WORDLIST = './crackstation-dist/crackstation.txt'
W = "\033[0m" # default/white
R = "\033[31m" # red
P = "\033[35m" # purple
C = "\033[36m" # cyan
bold = "\033[1m"
INFO = bold + C + "[*] " + W
WARN = bold + R + "[!] " + W
MONEY = bold + P + "[$] " + W
TIME = lambda: str(datetime.now()).split(' ')[1].split('.')[0]
print INFO+"%s: Logging into Twitter API ..." % TIME()
api = twitter.Api(consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET, access_token_key=ACCESS_TOKEN_KEY, access_token_secret=ACCESS_TOKEN_SECRET)
indexes = {
'md5': './crackstation-dist/crackstation-md5.idx',
}
if os.path.exists('processed.pkl'):
with open('processed.pkl', 'r') as fp:
processed = json.loads(fp.read())
print INFO+"%s: Loaded %d processed IDs" % (TIME(), len(processed))
else:
processed = []
def crack_hashes(algorithm, hashes):
results = []
if 0 < len(hashes):
lookup_table = LookupTable(
algorithm=algorithm,
index_file=indexes[algorithm],
wordlist_file=WORDLIST,
)
results = lookup_table[hashes]
return results
def process_request(mention):
hashes = filter(lambda word: len(word) == 32, mention.text.split(' '))
if len(hashes):
print INFO+"%s: Canidate hashes: %s" % (TIME(), hashes)
results = crack_hashes('md5', hashes[0]) # Limit one hash atm
if results[hashes[0]] is not None:
message = "@%s I cracked your hash, the password is '%s'" % (
mention.user.screen_name, results[hashes[0]]
)
else:
message = "Sorry @%s but I couldn't crack that hash :(" % mention.user.screen_name
else:
print WARN+"%s: No hashes found in request." % TIME()
message = None
if message:
print INFO + "%s: Posting update \"%s\"" % (TIME(), message)
message += " (%d)" % random.randint(0, 9999)
api.PostUpdate(message)
def poll_twitter():
mentions = filter(lambda m: m.id not in processed, api.GetMentions())
print INFO + "%s: %d new mention(s) to process" % (TIME(), len(mentions))
for mention in mentions:
process_request(mention)
processed.append(int(mention.id))
def run_forever():
while True:
time.sleep(POLL)
print INFO + "%s: Polling twitter API ..." % TIME()
try:
poll_twitter()
except twitter.TwitterError as error:
print WARN+"%s: Error from API %s, sleeping for 5mins" % (TIME(), str(error))
if __name__ == '__main__':
try:
run_forever()
except KeyboardInterrupt:
with open('processed.pkl', 'wb') as fp:
fp.write("%s" % json.dumps(processed))
print INFO+"%s: Saved processed to processed.pkl" % TIME()
@zackman218
Copy link

what do i put in for these, how do i get them?

CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_TOKEN_KEY = ""
ACCESS_TOKEN_SECRET = ""

@zackman218
Copy link

like seriously i have no idea how to use this i have syntax errors on import twitter and a few other things i'm a very basic coder just started learning a few months ago

@Dev913
Copy link

Dev913 commented Jul 16, 2018

Well you have to create a twitter application utilizing this link...(https://apps.twitter.com/)...Then you will need to just create one and you will get the keys that twitter provides...

@Dev913
Copy link

Dev913 commented Jul 16, 2018

@Zxr4n
Copy link

Zxr4n commented Sep 25, 2020

do you have discord?

@trevor4ever
Copy link

can some1 help me in cracking my hacked twitter password?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment