-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto.py
executable file
·80 lines (67 loc) · 2.25 KB
/
auto.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python3
import pyautogui
import ifaddr
import random_word
import flask
from flask import request
from flask import render_template, send_from_directory
# Disable flask production warning
import sys
cli = sys.modules['flask.cli']
cli.show_server_banner = lambda *x: None
app = flask.Flask(__name__, static_folder = 'static')
app.config["DEBUG"] = False
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
#pyautogui.PAUSE = 1
pyautogui.FAILSAFE = False
IP = ""
PORT = "8080"
adapters = ifaddr.get_adapters()
for adapter in adapters:
for ip in adapter.ips:
if isinstance(ip.ip, str):
if not ip.ip.startswith("127."):
IP = ip.ip
securewords = " ".join(random_word.RandomWords().get_random_words(hasDictionaryDef="true", minCorpusCount=10, minDictionaryCount=10, maxLength=10, limit=3))
securewords = securewords.lower()
print("\033[1mRequest Code: "+securewords+"\033[0m")
@app.route('/', methods=['GET', 'POST'])
def home():
if request.method == 'GET':
return app.send_static_file('index.html')
else:
x = int(float(request.form['x']))
y = -int(float(request.form['y']))
x *= 10
y *= 10
print(x, y)
reqcode = request.form['reqcode'].strip().lower()
if reqcode == securewords:
try:
pyautogui.moveRel(x, y, duration = 0.01)
except RuntimeException:
print("Runtime Exception!")
else:
print("Incorrect Request Code!")
return ''
@app.route('/click', methods=['POST'])
def click():
reqcode = request.form['reqcode'].strip().lower()
if reqcode == securewords:
try:
pyautogui.click(button=request.form['button'])
except RuntimeException:
print("Runtime Exception!")
return ''
@app.route('/scroll', methods=['POST'])
def scroll():
reqcode = request.form['reqcode'].strip().lower()
if reqcode == securewords:
if reqcode == securewords:
try:
pyautogui.scroll(int(request.form['clicks']))
except RuntimeException:
print("Runtime Exception!")
return ''
if __name__ == "__main__":
app.run(host=IP, port=PORT, ssl_context='adhoc')