Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- encoding : utf-8 -*-
- import requests
- from bs4 import BeautifulSoup
- following = 'Emanis_tNader'
- prox = False
- z = 0
- ipt = ['']
- portt = ['']
- def getProxies():
- #getting proxies
- req = BeautifulSoup(requests.get("https://www.sslproxies.org", verify=True).content, 'html.parser')
- ips = req.find('table').findAll('tr')
- for ip in ips:
- if str(ip.find('td', {'class': 'hx'})) == '<td class="hx">yes</td>':
- ipt.append(ip.findAll('td')[0].text)
- portt.append(ip.findAll('td')[1].text)
- getProxies()
- with open('Shrinked.txt') as file:
- q = file.readlines()
- for acc in q:
- try:
- username = acc.replace(":mahmoud123\n", "")
- password = 'mahmoud123'
- #GETTING DATA FROM ASK.FM
- s = requests.session()
- ask = s.get('https://ask.fm/login')
- soup = BeautifulSoup(ask.content, 'html.parser')
- Token = soup.find('input', {'name': 'authenticity_token'}).get('value')
- cookies = ask.cookies
- cookies = { 'locale': 'en', 'uuid': cookies['uuid'], 'country': 'US', '__qca': 'P0-509822842-1519408370109', '_m_ask_fm_session': cookies['_m_ask_fm_session'], }
- 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' }
- data = [ ('utf8', '\u2713'), ('authenticity_token', Token), ('login', username), ('password', password), ('remember_me', '0'), ]
- if prox == True:
- print proxies
- print username
- res = s.post('https://ask.fm/login', headers=headers, cookies=cookies, data=data, proxies=proxies, timeout=5)
- else:
- res = s.post('https://ask.fm/login', headers=headers, cookies=cookies, data=data)
- if 'login' in res.content:
- print '[+] Logging in done.'
- if 'verify' in res.text:
- print res.text
- raise Exception('Verify human err')
- #get needed data
- ask = s.get('https://ask.fm/'+following)
- soup = BeautifulSoup(ask.content, 'html.parser')
- Token = soup.find('meta', {'name': 'csrf-token'}).get('content')
- headers['X-CSRF-Token'] = Token
- cookies['_m_ask_fm_session'] = ask.cookies['_m_ask_fm_session']
- #follow
- if prox == True:
- ask = s.post('https://ask.fm/'+following+'/follow', headers=headers, cookies=cookies, proxies=proxies, timeout=5)
- else:
- ask = s.post('https://ask.fm/'+following+'/follow', headers=headers, cookies=cookies)
- if 'Unfollow' in ask.content:
- print '[+] Following done.'
- print '~~~~~~~~~~~~~~~~~~~'
- s.cookies.clear()
- except Exception as e:
- if len(ipt) < 2:
- getProxies()
- pass
- print e
- del ipt[0]
- del portt[0]
- proxies = {'https': 'https://'+ipt[0]+':'+portt[0]}
- prox = True
- print '~~~~~~~~~~~~~~~~~~'
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement