SHARE
TWEET

Untitled

a guest May 21st, 2017 73 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. starttime = time.time()
  11. lastcheck = time.time()-180
  12.  
  13.  
  14. def compair( incoming, actual_password ):
  15.  
  16.     #parse the input (hahaha)
  17.  
  18.     incomingsplit = incoming.split()
  19.     if  (len ( incomingsplit ) >= 3):
  20.         return "ERROR: password guesses must not contain spaces!"
  21.     if (incomingsplit[0] == "@SolveMyPassword" or incomingsplit[0] == "@solvemypassword" or incomingsplit[0] == "@Solvemypassword"):
  22.         password_guess = incomingsplit[1]
  23.     else:
  24.         password_guess = incomingsplit[0]
  25.  
  26.     if (password_guess == incoming):
  27.         return "That's correct! YOU'VE WON!"
  28.     #Check for number of correct letters
  29.  
  30.     correct_letter_count = 0
  31.     letters = ""
  32.     for i in range(0, len(password_guess)):
  33.         for j in range(0, len(actual_password)):
  34.             if (password_guess[i] == actual_password[j]):
  35.                 if (letters.find(password_guess[i]) == -1):
  36.                     letters = letters + password_guess[i]
  37.  
  38.     correct_letter_count = len (letters)
  39.     print correct_letter_count
  40.  
  41.     #Check for correct letters in the correct spot
  42.  
  43.     correct_spot_count = 0
  44.     if (len (password_guess) > len (actual_password)):
  45.         for i in range (0, len (actual_password)):
  46.             if (password_guess[i] == actual_password[i]):
  47.                 correct_spot_count = correct_spot_count+1
  48.     else:
  49.         for i in range (0, len (password_guess)):
  50.             if (password_guess[i] == actual_password[i]):
  51.                 correct_spot_count = correct_spot_count+1
  52.                
  53.     print correct_spot_count
  54.     result = password_guess + " # of correct characters: %.0f # of characters in the correct spot: %.0f" % (correct_letter_count, correct_spot_count)
  55.     return result
  56.  
  57.  
  58. while True :
  59.         if ((time.time() - lastcheck) > 180)
  60.                 if (count < 100):
  61.                         list = client.GetReplies(since_id = lastid)
  62.                         count + 1
  63.                         lastcheck = time.time()
  64.                         print "Getting statuses since:", lastid
  65.                         for status in list:
  66.                                 screen_name = status.user.screen_name
  67.                                 status_text = status.text
  68.                                 status_id = status.id
  69.                                 replymessage = "@" + screen_name + " " + compair(status_text, password)
  70.                                 client.PostUpdate(replymessage, in_reply_to_status_id = status_id)
  71.                                
  72.                                 sentmessage = screen_name + " " + status_text + " " + str(status_id)
  73.                                 idfile = open('log.txt', 'a')
  74.                                 idfile.write(sentmessage + '\n')
  75.                                 idfile.write(replymessage + '\n')
  76.                                 idfile.close()
  77.                                 if status.id > lastid:
  78.                                         lastid = status.id
  79.                                         idfile = open('lastid', 'w')
  80.                                         pickle.dump(lastid, idfile)
  81.                                         idfile.close()
  82.                         if ((time.time()-starttime) > 3600)
  83.                                 starttime = time.time()
  84.                                 count = 0
  85.                        
  86.                 else :
  87.                         lastcheck = time.time() - 3420
  88.                         starttime = time.time()
  89.                         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
 
Top