Instantly share code, notes, and snippets.

anonymous /push.py
Created Dec 31, 2017

Embed
What would you like to do?
automated push
#!/usr/bin/env python3
import sys
import requests
if __name__ == '__main__':
s = requests.session()
for line in sys.stdin.readlines():
name,uuid,comment = line.strip().split('\t')
url = 'https://uuid.pirate-server.com/{}'.format(uuid)
r = s.get(url)
csrfmiddlewaretoken = r.text.split("csrfmiddlewaretoken' value='")[1].split("'")[0]
r = s.post('https://uuid.pirate-server.com/comment',headers={'Referer':url},data={
'csrfmiddlewaretoken':csrfmiddlewaretoken,
'title':name,
'details':comment,
'author':'automated push',
})
print('{} {}'.format(uuid,name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment