Advertisement
Guest User

ask_script

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