Skip to content

Instantly share code, notes, and snippets.

@smartm13
Last active December 1, 2017 11:42
Show Gist options
  • Save smartm13/0efe2b978b38228dc09ad48a990083a8 to your computer and use it in GitHub Desktop.
Save smartm13/0efe2b978b38228dc09ad48a990083a8 to your computer and use it in GitHub Desktop.
##shebang python 2.7
#pvpro daily free coins claimer
from crontab import CronTab
from datetime import datetime
import time
#pvpro credentials of all users
credentails=[
#(username,password),
('carbonhorse','#masked#'),('shyamkalariya','#masked#'),('dizyant','#masked#'),('jshah7991','#masked#'),('InViNcI','#masked#'),('karma1205','#masked#'),('learningm4a4','#masked#')
]
logf='/home/ubuntu/logpvpro.log'
#import datetime
#currentHour=10
#if datetime.datetime.now().hour!=currentHour:exit()
def printf(s):
global logf
try:
with open(logf,'a') as f:f.write(s)
except:pass
# print(s)
def claimcoins(username,password):
import requests
getheaders= {
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.8',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
'Accept': '*/*',
'Referer': 'https://www.pvpro.com/pvpro/csgo-eu/home',
'X-Requested-With': 'XMLHttpRequest',
'Connection': 'keep-alive',
}
postheaders = {
'Origin': 'https://www.pvpro.com',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.8',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Cache-Control': 'max-age=0',
'Referer': 'https://www.pvpro.com/pvpro/account/choose',
'Connection': 'keep-alive',
}
r0=requests.get('http://www.pvpro.com/pvpro/home')
cookies = r0.history[-1].cookies.get_dict()
fs='name="_csrf" content="'
st=str(r0.content).index(fs)+len(fs)
csrf=r0.content[st:str(r0.content).index('"',st)]
data = [
('username', username),
('password', password),
('_csrf', csrf or '0bb86a9c-2633-472a-bfee-ca0b7af943f8'),
]
rl=requests.post('https://www.pvpro.com/pvpro/doLogin', headers=postheaders, cookies=cookies, data=data,allow_redirects=False)
cookies=rl.cookies.get_dict() or cookies
rr=requests.get('https://www.pvpro.com/pvpro/secured/player/doClaimNameCredits', headers=getheaders, cookies=cookies)
op=str(rr.content)
return "success" in op.lower()
def main():
global credentails
printf('\n\nJobTimeStamp:[{}]'.format(datetime.now()))
for (u,p) in credentails:
printf("\nClaiming coins for "+u+" : ")
if(1==1):
r=claimcoins(u,p)
printf(str(r))
else:printf('failed. sorry,'+u)
time.sleep(62)
now = datetime.now()
#Get cronjobs of the user
mycron = CronTab(user='ubuntu')
#get the required job.Here pvpro waali script
job = mycron[1]
mins,hours = now.minute,now.hour
job.minute.on(mins)
job.hours.on(hours)
time.sleep(120)
# #what to do at 59 mins
# if job.minute.render() == str(job.minute.max):
# #at 23:59
# if job.hour.render() == str(job.hour.max):
# job.hour.parse(job.hour.min)
# job.minute.parse(job.hour.min)
# else:
# job.hour.parse(int(job.hour.render())+1)
# job.minute.parse(job.minute.min)
# #increment to minutes
# else:
# job.minute.parse(int(job.minute.render())+1)
mycron.write()
if __name__=="__main__":main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment