Guest User

Casanova Filter

a guest
Mar 29th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import time
  4. import sys
  5. import os
  6. import requests
  7. import re
  8. import random
  9. import getpass
  10.  
  11. ##
  12. ## CONFIG VARIABLES : YOU CAN EDIT THESE VARIABLES TO CHANGE TIMER VALUES ##
  13. ##
  14. MIN_DELAY_BETWEEN_PROFILE_VIEWS = 1
  15. MAX_DELAY_BETWEEN_PROFILE_VIEWS = 5
  16. DELAY_BETWEEN_RUNS = 30
  17. sex = 'female' # Possible values: 'male', 'female', or empty '' for both
  18. cont = '' # Possible values: 'AF' (Africa) 'AS' (Asia), 'EU' (Europe)
  19. #'NA' (North America), 'OC' (Oceania), 'SA' (South America)
  20. age1 = 18 # minimum age
  21. age2 = 23 # maximum age
  22.  
  23. # We keep already visited profile in a file to avoid visiting
  24. # a profile multiple times on consecutive execution of this script
  25. # YOU CAN DELETE THIS FILE IF YOU WANT TO VISIT EVERYBODY ONCE AGAIN
  26. visitedUsersFilename = "users_visited.txt"
  27.  
  28. # Set this variable to True to output debug log,
  29. # or False for more concise output
  30. DEBUG = False
  31. ##
  32. ## END OF CONFIG VARIABLES
  33. ##
  34.  
  35.  
  36. sessioncount = 0
  37. run_number = 1
  38. f = open(visitedUsersFilename, 'a+')
  39. processedUsers = [line.strip() for line in f]
  40. print "Already processed " + str(len(processedUsers)) + " users."
  41. s = requests.Session()
  42. login = raw_input('Username (mail): ')
  43. password = getpass.getpass('Password: ')
  44. payload = {'action': 'login',
  45. 'login': login,
  46. 'auto_login' : '1',
  47. 'password': password}
  48.  
  49. print "Logging in..."
  50. s.get("https://www.interpals.net/")
  51. r = s.post("https://www.interpals.net/login.php", data=payload)
  52. print "Logged in: Starting the dance \o/"
  53. time.sleep(2)
  54. #print r.headers
  55. #print r.text
  56. while True:
  57. runcount = 0
  58. if DEBUG:
  59. print "Fetching online users page..."
  60. r = s.get("https://www.interpals.net/online.php?sex=%s&cont=%s&age1=%d&age2=%d" % (sex, cont, age1, age2))
  61. data = r.text
  62. usernames = re.findall(r'<div class=\'online_prof\'><a href=\'([a-zA-Z0-9\-_]+)\'', data, re.M)
  63. for username in usernames:
  64. if username not in processedUsers:
  65. if DEBUG:
  66. print "Visiting profile of " + username + " (" + str(sessioncount) + ")"
  67. runcount += 1
  68. sessioncount += 1
  69. r = s.get("https://www.interpals.net/" + username)
  70. waitTime = random.randrange(MIN_DELAY_BETWEEN_PROFILE_VIEWS*10, MAX_DELAY_BETWEEN_PROFILE_VIEWS*10) / float(10)
  71. if DEBUG:
  72. print "Waiting " + str(waitTime) + "s"
  73. else:
  74. os.system('cls' if os.name=='nt' else 'clear')
  75. print ('\rRun %d - Fetched %d users (%d total)' % (run_number, runcount, sessioncount))
  76. time.sleep(waitTime)
  77. processedUsers.append(username)
  78. f.write(username + "\n")
  79. elif DEBUG:
  80. print "Already visited " + username
  81. run_number += 1
  82. if (runcount < 20):
  83. print ('[-] Waiting (%d)s before next run (fetched %d users this run, %d total)\n' % (DELAY_BETWEEN_RUNS * 4, runcount, sessioncount))
  84. time.sleep(DELAY_BETWEEN_RUNS * 4)
  85. else:
  86. print ('[+] Waiting (%d)s before next run (fetched %d users this run, %d total)\n' % (DELAY_BETWEEN_RUNS, runcount, sessioncount))
  87. time.sleep(DELAY_BETWEEN_RUNS)
  88.  
  89. # This script is ugly. It was made rapidly, for fun. At least, it does its job.
Add Comment
Please, Sign In to add comment