SHARE
TWEET

Untitled

a guest May 21st, 2017 49 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.        
  31.     correct_letter_count = 0
  32.  
  33.        
  34.     passwordarray = []
  35.     for j in range(0, len(actual_password)):
  36.                 passwordarray.append(0)
  37.                
  38.     for i in range(0, len(password_guess)):
  39.         for j in range(0, len(actual_password)):
  40.                         if (passwordarray[j] == 0)
  41.                                 if (password_guess[i] == actual_password[j]):
  42.                                                 correct_letter_count += 1
  43.                                                 passwordarray[j] = 1
  44.  
  45.     print correct_letter_count
  46.  
  47.     #Check for correct letters in the correct spot
  48.  
  49.     correct_spot_count = 0
  50.     if (len (password_guess) > len (actual_password)):
  51.         for i in range (0, len (actual_password)):
  52.             if (password_guess[i] == actual_password[i]):
  53.                 correct_spot_count = correct_spot_count+1
  54.     else:
  55.         for i in range (0, len (password_guess)):
  56.             if (password_guess[i] == actual_password[i]):
  57.                 correct_spot_count = correct_spot_count+1
  58.                
  59.     print correct_spot_count
  60.     result = password_guess + " # of correct characters: %.0f # of characters in the correct spot: %.0f" % (correct_letter_count, correct_spot_count)
  61.     return result
  62.  
  63.  
  64. while True :
  65.         if ((time.time() - lastcheck) > 180)
  66.                 if (count < 100):
  67.                         list = client.GetReplies(since_id = lastid)
  68.                         count + 1
  69.                         lastcheck = time.time()
  70.                         print "Getting statuses since:", lastid
  71.                         for status in list:
  72.                                 screen_name = status.user.screen_name
  73.                                 status_text = status.text
  74.                                 status_id = status.id
  75.                                 replymessage = "@" + screen_name + " " + compair(status_text, password)
  76.                                 client.PostUpdate(replymessage, in_reply_to_status_id = status_id)
  77.                                
  78.                                 sentmessage = screen_name + " " + status_text + " " + str(status_id)
  79.                                 idfile = open('log.txt', 'a')
  80.                                 idfile.write(sentmessage + '\n')
  81.                                 idfile.write(replymessage + '\n')
  82.                                 idfile.close()
  83.                                 if status.id > lastid:
  84.                                         lastid = status.id
  85.                                         idfile = open('lastid', 'w')
  86.                                         pickle.dump(lastid, idfile)
  87.                                         idfile.close()
  88.                         if ((time.time()-starttime) > 3600)
  89.                                 starttime = time.time()
  90.                                 count = 0
  91.                        
  92.                 else :
  93.                         lastcheck = time.time() - 3420
  94.                         starttime = time.time()
  95.                         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