SHARE
TWEET

Untitled

a guest May 21st, 2017 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import twitter, subprocess,  time, pickle, string
  2. username = "solvemypassword"
  3. password = "solvemypassword"
  4. client = twitter.Api(username, password)
  5. lastid = 0
  6. count = 0
  7. idfile = open('lastid', 'r')
  8. lastid = pickle.load(idfile)
  9. idfile.close()
  10.  
  11. def compair( incoming, actual_password ):
  12.  
  13.     #parse the input (hahaha)
  14.  
  15.     incomingsplit = incoming.split()
  16.     if  (len ( incomingsplit ) >= 3):
  17.         return "ERROR: password guesses must not contain spaces!"
  18.     if (incomingsplit[0] == "@SolveMyPassword" or incomingsplit[0] == "@solvemypassword" or incomingsplit[0] == "@Solvemypassword"):
  19.         password_guess = incomingsplit[1]
  20.     else:
  21.         password_guess = incomingsplit[0]
  22.  
  23.     if (password_guess == incoming):
  24.         return "That's correct! YOU'VE WON!"
  25.     #Check for number of correct letters
  26.  
  27.     correct_letter_count = 0
  28.     letters = ""
  29.     for i in range(0, len(password_guess)):
  30.         for j in range(0, len(actual_password)):
  31.             if (password_guess[i] == actual_password[j]):
  32.                 if (letters.find(password_guess[i]) == -1):
  33.                     letters = letters + password_guess[i]
  34.  
  35.     correct_letter_count = len (letters)
  36.     print correct_letter_count
  37.  
  38.     #Check for correct letters in the correct spot
  39.  
  40.     correct_spot_count = 0
  41.     if (len (password_guess) > len (actual_password)):
  42.         for i in range (0, len (actual_password)):
  43.             if (password_guess[i] == actual_password[i]):
  44.                 correct_spot_count = correct_spot_count+1
  45.     else:
  46.         for i in range (0, len (password_guess)):
  47.             if (password_guess[i] == actual_password[i]):
  48.                 correct_spot_count = correct_spot_count+1
  49.                
  50.     print correct_spot_count
  51.     result = password_guess + " # of correct characters: %.0f # of characters in the correct spot: %.0f" % (correct_letter_count, correct_spot_count)
  52.     return result
  53.  
  54. starttime = time.time()
  55. while True :
  56.        
  57.         if (count < 100):
  58.                 list = client.GetReplies(since_id = lastid)
  59.                 count + 1
  60.                 print "Getting statuses since:", lastid
  61.                 for status in list:
  62.                         screen_name = status.user.screen_name
  63.                         status_text = status.text
  64.                         status_id = status.id
  65.                         replymessage = "@" + screen_name + " " + compair(status_text, password)
  66.                         client.PostUpdate(replymessage, in_reply_to_status_id = status_id)
  67.                        
  68.                         sentmessage = screen_name + " " + status_text + " " + str(status_id)
  69.                         idfile = open('log.txt', 'a')
  70.                         idfile.write(sentmessage + '\n')
  71.                         idfile.write(replymessage + '\n')
  72.                         idfile.close()
  73.                         if status.id > lastid:
  74.                                 lastid = status.id
  75.                                 idfile = open('lastid', 'w')
  76.                                 pickle.dump(lastid, idfile)
  77.                                 idfile.close()
  78.                 if ((time.time()-starttime) > 3600)
  79.                         starttime = time.time()
  80.                         count = 0
  81.                
  82.         else :
  83.                 time.sleep(3600)
  84.                 starttime = time.time()
  85.                 count = 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top