Advertisement
Guest User

ssssss

a guest
Apr 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. # -*- encoding : utf-8 -*-
  2. import requests
  3. from bs4 import BeautifulSoup
  4. following = 'Emanis_tNader'
  5.  
  6. prox = False
  7. z = 0
  8. ipt = ['']
  9. portt = ['']
  10. def getProxies():
  11. #getting proxies
  12. req = BeautifulSoup(requests.get("https://www.sslproxies.org", verify=True).content, 'html.parser')
  13. ips = req.find('table').findAll('tr')
  14. for ip in ips:
  15. if str(ip.find('td', {'class': 'hx'})) == '<td class="hx">yes</td>':
  16. ipt.append(ip.findAll('td')[0].text)
  17. portt.append(ip.findAll('td')[1].text)
  18. getProxies()
  19.  
  20. with open('Shrinked.txt') as file:
  21. q = file.readlines()
  22. for acc in q:
  23. z = z + 1
  24. if z == 990:
  25. exit(0)
  26. try:
  27. username = acc.replace(":mahmoud123\n", "")
  28. password = 'mahmoud123'
  29. #GETTING DATA FROM ASK.FM
  30. s = requests.session()
  31.  
  32. ask = s.get('https://ask.fm/login')
  33. soup = BeautifulSoup(ask.content, 'html.parser')
  34.  
  35. Token = soup.find('input', {'name': 'authenticity_token'}).get('value')
  36. cookies = ask.cookies
  37.  
  38. cookies = { 'locale': 'en', 'uuid': cookies['uuid'], 'country': 'US', '__qca': 'P0-509822842-1519408370109', '_m_ask_fm_session': cookies['_m_ask_fm_session'], }
  39. headers = { 'Host': 'ask.fm', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'https://ask.fm/login', 'Content-Length': '191' }
  40. data = [ ('utf8', '\u2713'), ('authenticity_token', Token), ('login', username), ('password', password), ('remember_me', '0'), ]
  41. if prox == True:
  42. res = s.post('https://ask.fm/login', headers=headers, cookies=cookies, data=data, proxies=proxies, timeout=10)
  43. else:
  44. res = s.post('https://ask.fm/login', headers=headers, cookies=cookies, data=data)
  45. if 'login' in res.content:
  46. print '[+] Logging in done.'
  47. if 'verify' in res.text:
  48. print '[-] Error. Please verify you\'re human.'
  49. raise Exception('use proxy')
  50.  
  51. #get needed data
  52. ask = s.get('https://ask.fm/'+following)
  53. soup = BeautifulSoup(ask.content, 'html.parser')
  54. Token = soup.find('meta', {'name': 'csrf-token'}).get('content')
  55. headers['X-CSRF-Token'] = Token
  56. cookies['_m_ask_fm_session'] = ask.cookies['_m_ask_fm_session']
  57.  
  58. #follow
  59. if prox == True:
  60. ask = s.post('https://ask.fm/'+following+'/follow', headers=headers, cookies=cookies, proxies=proxies, timeout=10)
  61. else:
  62. ask = s.post('https://ask.fm/'+following+'/follow', headers=headers, cookies=cookies)
  63. if 'Unfollow' in ask.content:
  64. print '[+] Following done.'
  65. print '~~~~~~~~~~~~~~~~~~~'
  66. except Exception as e:
  67. print e
  68. del ipt[0]
  69. del portt[0]
  70. proxies = {'https': 'https://'+ipt[0]+':'+portt[0]}
  71. prox = True
  72. print 'Captcha'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement