Advertisement
Guest User

newst

a guest
Apr 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 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. with open('Shrinked.txt') as file:
  20. q = file.readlines()
  21. for acc in q:
  22. try:
  23. username = acc.replace(":mahmoud123\n", "")
  24. password = 'mahmoud123'
  25. #GETTING DATA FROM ASK.FM
  26. s = requests.session()
  27.  
  28. ask = s.get('https://ask.fm/login')
  29. soup = BeautifulSoup(ask.content, 'html.parser')
  30.  
  31. Token = soup.find('input', {'name': 'authenticity_token'}).get('value')
  32. cookies = ask.cookies
  33.  
  34. cookies = { 'locale': 'en', 'uuid': cookies['uuid'], 'country': 'US', '__qca': 'P0-509822842-1519408370109', '_m_ask_fm_session': cookies['_m_ask_fm_session'], }
  35. 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' }
  36. data = [ ('utf8', '\u2713'), ('authenticity_token', Token), ('login', username), ('password', password), ('remember_me', '0'), ]
  37. if prox == True:
  38. print proxies
  39. print username
  40. res = s.post('https://ask.fm/login', headers=headers, cookies=cookies, data=data, proxies=proxies, timeout=5)
  41. else:
  42. res = s.post('https://ask.fm/login', headers=headers, cookies=cookies, data=data)
  43. if 'login' in res.content:
  44. print '[+] Logging in done.'
  45. if 'verify' in res.text:
  46. print res.text
  47. raise Exception('Verify human err')
  48.  
  49. #get needed data
  50. ask = s.get('https://ask.fm/'+following)
  51. soup = BeautifulSoup(ask.content, 'html.parser')
  52. Token = soup.find('meta', {'name': 'csrf-token'}).get('content')
  53. headers['X-CSRF-Token'] = Token
  54. cookies['_m_ask_fm_session'] = ask.cookies['_m_ask_fm_session']
  55.  
  56. #follow
  57. if prox == True:
  58. ask = s.post('https://ask.fm/'+following+'/follow', headers=headers, cookies=cookies, proxies=proxies, timeout=5)
  59. else:
  60. ask = s.post('https://ask.fm/'+following+'/follow', headers=headers, cookies=cookies)
  61. if 'Unfollow' in ask.content:
  62. print '[+] Following done.'
  63. print '~~~~~~~~~~~~~~~~~~~'
  64. s.cookies.clear()
  65. except Exception as e:
  66. if len(ipt) < 2:
  67. getProxies()
  68. pass
  69. print e
  70. del ipt[0]
  71. del portt[0]
  72. proxies = {'https': 'https://'+ipt[0]+':'+portt[0]}
  73. prox = True
  74. print '~~~~~~~~~~~~~~~~~~'
  75. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement