Skip to content

Instantly share code, notes, and snippets.

@axju
Last active April 5, 2018 11:07
Show Gist options
  • Save axju/c18588cc3cb9a5ee4069d8dde055896b to your computer and use it in GitHub Desktop.
Save axju/c18588cc3cb9a5ee4069d8dde055896b to your computer and use it in GitHub Desktop.
from time import sleep
from requests import post
import webbrowser
id = '...'
pw = '...'
def run(timeout=60):
print('[*] Start Bot', id)
while True:
for task in get_task():
print('[*] run task', task['id'])
try:
result = globals()[task['cmd']]()
send_result(task['id'], result)
print(' OKAY')
except Exception as e:
print(' ERROR')
send_result(task['id'], 'ERROR: '+str(e))
print('[*] sleep...')
for i in range(timeout):
sleep(1)
def get_task():
payload = {'id': id, 'pw': pw}
r = post('http://easybot.short-report.de/api/get.php', data=payload)
return r.json()
def send_result(task_id, result):
payload = {'id': id, 'task': task_id, 'result': result}
r = post('http://easybot.short-report.de/api/send.php', data=payload)
def hello():
return 'Hello I''m'+id
def opensr():
url = 'http://blog.short-report.de'
webbrowser.open(url)
return 'open '+url
if __name__ == '__main__':
run(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment