Reset to working instance...
This commit is contained in:
parent
5bbaa6c5ae
commit
28e1ea598d
28
README.md
28
README.md
|
@ -37,6 +37,34 @@ Linux/Mac
|
||||||
Windows
|
Windows
|
||||||
``` ./windows-start.sh ```
|
``` ./windows-start.sh ```
|
||||||
|
|
||||||
|
Nginx Setup Example
|
||||||
|
|
||||||
|
```
|
||||||
|
server {
|
||||||
|
listen 80 ;
|
||||||
|
# Use your hosts file or router DNSmasq to redirect www.remoteconn.com to your local server.
|
||||||
|
server_name www.remoteconn.com remoteconn.com;
|
||||||
|
error_log /tmp/remoteconn-nginx-error.log error;
|
||||||
|
|
||||||
|
|
||||||
|
location /socket.io {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
|
proxy_redirect off;
|
||||||
|
#proxy_buffering off;
|
||||||
|
|
||||||
|
proxy_pass http://127.0.0.1:8088/socket.io;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:8088/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
![1 Interface.... ](images/pic1.png)
|
![1 Interface.... ](images/pic1.png)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
eventlet==0.29.1
|
bcrypt==3.1.7
|
||||||
Flask==1.1.2
|
cffi==1.14.0
|
||||||
|
Click==7.0
|
||||||
|
dnspython==1.16.0
|
||||||
|
eventlet==0.25.2
|
||||||
|
Flask==1.1.1
|
||||||
Flask-Bcrypt==0.7.1
|
Flask-Bcrypt==0.7.1
|
||||||
Flask-Login==0.5.0
|
Flask-Login==0.5.0
|
||||||
flask-oidc==1.4.0
|
Flask-SocketIO==4.3.0
|
||||||
Flask-SocketIO==4.3.1
|
greenlet==0.4.16
|
||||||
greenlet==0.4.17
|
gunicorn==19.9.0
|
||||||
gunicorn==20.0.4
|
itsdangerous==1.1.0
|
||||||
PyAutoGUI==0.9.52
|
Jinja2==2.10.3
|
||||||
Werkzeug==1.0.1
|
MarkupSafe==1.1.1
|
||||||
|
monotonic==1.5
|
||||||
|
MouseInfo==0.1.3
|
||||||
|
Pillow==7.1.2
|
||||||
|
PyAutoGUI==0.9.50
|
||||||
|
pycparser==2.20
|
||||||
|
PyGetWindow==0.0.8
|
||||||
|
PyMsgBox==1.0.8
|
||||||
|
pyperclip==1.8.0
|
||||||
|
PyRect==0.1.4
|
||||||
|
PyScreeze==0.1.26
|
||||||
|
python-engineio==3.13.0
|
||||||
|
python-socketio==4.6.0
|
||||||
|
python3-xlib==0.15
|
||||||
|
PyTweening==1.0.3
|
||||||
|
six==1.14.0
|
||||||
|
Werkzeug==0.16.0
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
# Python imports
|
# Python imports
|
||||||
import os, secrets
|
import secrets
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
|
|
||||||
# Lib imports
|
# Lib imports
|
||||||
import pyautogui
|
|
||||||
import eventlet
|
import eventlet
|
||||||
# import eventlet.debug
|
|
||||||
from engineio.payload import Payload
|
|
||||||
|
|
||||||
# Some fixrs for Websockets
|
from engineio.payload import Payload
|
||||||
eventlet.monkey_patch()
|
|
||||||
# eventlet.debug.hub_prevent_multiple_readers(False)
|
|
||||||
Payload.max_decode_packets = 120 # Fix too many small packets causing error
|
|
||||||
|
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
@ -25,33 +18,13 @@ from flask_socketio import SocketIO
|
||||||
|
|
||||||
|
|
||||||
# Configs and 'init'
|
# Configs and 'init'
|
||||||
APP_NAME = 'RemoteMouse'
|
|
||||||
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.update({
|
app.config['TITLE'] = 'RemoteMouse'
|
||||||
"TITLE": APP_NAME,
|
app.config['SECRET_KEY'] = secrets.token_hex(32) # For csrf and some other stuff...
|
||||||
'DEBUG': False,
|
|
||||||
'SECRET_KEY': secrets.token_hex(32),
|
|
||||||
'PERMANENT_SESSION_LIFETIME': timedelta(days = 7).total_seconds()
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
# For Websockets
|
# For Websockets
|
||||||
socketio = SocketIO(app, async_mode = 'eventlet',
|
# eventlet.monkey_patch()
|
||||||
cors_allowed_origins = ["*"],
|
Payload.max_decode_packets = 120 # Fix too many small packets causing error
|
||||||
path = "socket.io",
|
socketio = SocketIO(app, async_mode='eventlet')
|
||||||
allow_upgrades = True,
|
|
||||||
manage_session = True,
|
|
||||||
cookie = None,
|
|
||||||
engineio_logger = True,
|
|
||||||
logger = True)
|
|
||||||
|
|
||||||
|
|
||||||
app.jinja_env.globals['TITLE'] = APP_NAME
|
|
||||||
pyautogui.FAILSAFE = False # If we hit corner, that's ok
|
|
||||||
# Let piautogui make updates as quick as it can...
|
|
||||||
pyautogui.MINIMUM_DURATION = 0
|
|
||||||
pyautogui.PAUSE = 0
|
|
||||||
|
|
||||||
from core import routes
|
from core import routes
|
||||||
|
|
|
@ -7,29 +7,74 @@ from flask import request, render_template
|
||||||
|
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from core import app, pyautogui, socketio # Get from __init__
|
from core import app, socketio # Get from __init__
|
||||||
from core.MessageHandler import MessageHandler # Get simple message processor
|
from core.MessageHandler import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
|
|
||||||
msgHandler = MessageHandler()
|
msgHandler = MessageHandler()
|
||||||
|
TITLE = app.config['TITLE']
|
||||||
|
|
||||||
|
pyautogui.FAILSAFE = False # If we hit corner, that's ok
|
||||||
|
# Let piautogui make updates as quick as it can...
|
||||||
|
pyautogui.MINIMUM_DURATION = 0
|
||||||
|
pyautogui.PAUSE = 0
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
return render_template('index.html')
|
return render_template('index.html',
|
||||||
|
title=TITLE)
|
||||||
|
|
||||||
return render_template('error.html',
|
return render_template('error.html',
|
||||||
title='Error!',
|
title='Error!',
|
||||||
message='Must use GET request type...')
|
message='Must use GET request type...')
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/sound-manager')
|
||||||
|
def soundManager():
|
||||||
|
if request.method == 'GET':
|
||||||
|
# command = 'runuser -l abaddon bash -c "pacmd list-sink-inputs"'
|
||||||
|
command = 'sudo -u abaddon bash -c "pacmd list-sink-inputs"'
|
||||||
|
# command = 'sudo -u abaddon bash <<EOF pacmd list-sink-inputs EOF'
|
||||||
|
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
||||||
|
result = process.wait()
|
||||||
|
print(process.stdout.read())
|
||||||
|
_apps = []
|
||||||
|
return render_template('sound-manager.html',
|
||||||
|
title=TITLE,
|
||||||
|
apps=_apps)
|
||||||
|
|
||||||
|
return render_template('error.html',
|
||||||
|
title='Error!',
|
||||||
|
message='Must use GET request type...')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/update-coords/xy/<x>/<y>')
|
||||||
|
def updateCoords2(x, y):
|
||||||
|
try:
|
||||||
|
# print(x + "," + y)
|
||||||
|
pyautogui.moveRel(float(x), float(y));
|
||||||
|
return "{}"
|
||||||
|
except Exception as e:
|
||||||
|
print( repr(e) )
|
||||||
|
return render_template('error.html',
|
||||||
|
title='Error!',
|
||||||
|
message='Key is not a valid input...')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/send-keys', methods=['GET', 'POST'])
|
@app.route('/send-keys', methods=['GET', 'POST'])
|
||||||
def sendKeys():
|
def sendKeys():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
try:
|
try:
|
||||||
text = str(request.values['text']).strip()
|
text = str(request.values['text']).strip()
|
||||||
pyautogui.typewrite(text);
|
pyautogui.typewrite(text);
|
||||||
|
# print("\nX: {} Y: {}".format(str(x), str(y)))
|
||||||
|
# pyautogui.typewrite('Hello world!\n', interval=secs_between_keys) # useful for entering text, newline is Enter
|
||||||
|
# pyautogui.press(['left', 'left', 'left', 'left']) # Press the left arrow key 4 times.
|
||||||
|
# pyautogui.keyDown('shift') # Press the Shift key down and hold it.
|
||||||
|
# pyautogui.keyUp('shift') # Let go of the Shift key.
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print( repr(e) )
|
print( repr(e) )
|
||||||
return render_template('error.html',
|
return render_template('error.html',
|
||||||
|
|
|
@ -6,7 +6,7 @@ from flask import request, render_template
|
||||||
|
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from core import app, pyautogui, socketio # Get from __init__
|
from core import app, socketio # Get from __init__
|
||||||
from core.MessageHandler import MessageHandler # Get simple message processor
|
from core.MessageHandler import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,76 +14,69 @@ from core.MessageHandler import MessageHandler # Get simple message processor
|
||||||
|
|
||||||
msgHandler = MessageHandler()
|
msgHandler = MessageHandler()
|
||||||
|
|
||||||
|
pyautogui.FAILSAFE = False # If we hit corner, that's ok
|
||||||
|
# Let piautogui make updates as quick as it can...
|
||||||
|
pyautogui.MINIMUM_DURATION = 0
|
||||||
|
pyautogui.PAUSE = 0
|
||||||
|
|
||||||
|
|
||||||
@app.route('/mouse-down')
|
@app.route('/mouse-down')
|
||||||
@socketio.on('mouse_down', namespace='/socket.io')
|
@socketio.on('mouse_down')
|
||||||
def mouseDown(eve = None):
|
def mouseDown(eve = None):
|
||||||
pyautogui.mouseDown()
|
pyautogui.mouseDown()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/mouse-up')
|
@app.route('/mouse-up')
|
||||||
@socketio.on('mouse_up', namespace='/socket.io')
|
@socketio.on('mouse_up')
|
||||||
def mouseUp(eve = None):
|
def mouseUp(eve = None):
|
||||||
pyautogui.mouseUp()
|
pyautogui.mouseUp()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route('/left-click')
|
@app.route('/left-click')
|
||||||
@socketio.on('left_click', namespace='/socket.io')
|
@socketio.on('left_click')
|
||||||
def leftClick(eve = None):
|
def leftClick(eve = None):
|
||||||
pyautogui.click()
|
pyautogui.click()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/right-click')
|
@app.route('/right-click')
|
||||||
@socketio.on('right_click', namespace='/socket.io')
|
@socketio.on('right_click')
|
||||||
def rightClick(eve = None):
|
def rightClick(eve = None):
|
||||||
pyautogui.click(button='right')
|
pyautogui.click(button='right')
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/scroll-up')
|
@app.route('/scroll-up')
|
||||||
@socketio.on('scroll_up', namespace='/socket.io')
|
@socketio.on('scroll_up')
|
||||||
def scrollUp(eve = None):
|
def scrollUp(eve = None):
|
||||||
pyautogui.scroll(1)
|
pyautogui.scroll(1)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/scroll-down')
|
@app.route('/scroll-down')
|
||||||
@socketio.on('scroll_down', namespace='/socket.io')
|
@socketio.on('scroll_down')
|
||||||
def scrollDown(eve = None):
|
def scrollDown(eve = None):
|
||||||
pyautogui.scroll(-1)
|
pyautogui.scroll(-1)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/press-enter')
|
@app.route('/press-enter')
|
||||||
@socketio.on('press_enter', namespace='/socket.io')
|
@socketio.on('press_enter')
|
||||||
def pressEnter(eve = None):
|
def pressEnter(eve = None):
|
||||||
pyautogui.press("enter")
|
pyautogui.press("enter")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/press-back')
|
@app.route('/press-back')
|
||||||
@socketio.on('press_back', namespace='/socket.io')
|
@socketio.on('press_back')
|
||||||
def pressBack(eve = None):
|
def pressBack(eve = None):
|
||||||
pyautogui.press("backspace")
|
pyautogui.press("backspace")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route('/update-coords/xy/<m1>/<m2>')
|
@socketio.on('update_coords')
|
||||||
@socketio.on('update_coords', namespace='/socket.io')
|
def updateCoords(message):
|
||||||
def updateCoords(m1 = None, m2 = None):
|
try:
|
||||||
if not m2:
|
parts = message.split(",")
|
||||||
try:
|
x = float( parts[0] )
|
||||||
parts = m1.split(",")
|
y = float( parts[1] )
|
||||||
x = float( parts[0] )
|
# print(str(x) + "," + str(y))
|
||||||
y = float( parts[1] )
|
pyautogui.moveRel(x, y);
|
||||||
# print(str(x) + "," + str(y))
|
except Exception as e:
|
||||||
pyautogui.moveRel(x, y);
|
print( repr(e) )
|
||||||
except Exception as e:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
x = float( m1 )
|
|
||||||
y = float( m2 )
|
|
||||||
# print(str(x) + "," + str(y))
|
|
||||||
pyautogui.moveRel(x, y);
|
|
||||||
except Exception as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return ""
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
{% if title %}
|
{% if title %}
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
{% else %}
|
{% else %}
|
||||||
<title>{{TITLE}}</title>
|
<title>App</title>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% block header_css %}
|
{% block header_css %}
|
||||||
|
|
|
@ -11,17 +11,16 @@ function main() {
|
||||||
echo "Working Dir: " $(pwd)
|
echo "Working Dir: " $(pwd)
|
||||||
source "../venv/bin/activate"
|
source "../venv/bin/activate"
|
||||||
|
|
||||||
LOG_LEVEL=debug
|
LOG_LEVEL=error
|
||||||
WORKER_COUNT=1
|
WORKER_COUNT=1
|
||||||
ADDR=127.0.0.1
|
ADDR=127.0.0.1
|
||||||
PORT=8088
|
PORT=8088
|
||||||
TIMEOUT=120
|
TIMEOUT=60
|
||||||
|
|
||||||
# Note can replace 127.0.0.1 with 0.0.0.0 to make it 'network/internet' accessable...
|
# Note can replace 127.0.0.1 with 0.0.0.0 to make it 'network/internet' accessable...
|
||||||
# Note: NEED -k eventlet for this to work! I spent too many hours on this...
|
# Note: NEED -k eventlet for this to work! I spent too many hours on this...
|
||||||
# <module>:<app> IE <file>:<flask app variable>
|
# <module>:<app> IE <file>:<flask app variable>
|
||||||
gunicorn wsgi:app \
|
gunicorn wsgi:app -b $ADDR:$PORT \
|
||||||
-b $ADDR:$PORT \
|
|
||||||
-k eventlet \
|
-k eventlet \
|
||||||
-w $WORKER_COUNT \
|
-w $WORKER_COUNT \
|
||||||
--timeout $TIMEOUT \
|
--timeout $TIMEOUT \
|
||||||
|
|
|
@ -10,6 +10,13 @@ function main() {
|
||||||
cd "${SCRIPTPATH}"
|
cd "${SCRIPTPATH}"
|
||||||
echo "Working Dir: " $(pwd)
|
echo "Working Dir: " $(pwd)
|
||||||
mkdir /tmp/apps
|
mkdir /tmp/apps
|
||||||
../venv/bin/gunicorn --bind unix:/tmp/apps/remoteconn.sock wsgi:app
|
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
WORKER_COUNT=1
|
||||||
|
|
||||||
|
gunicorn wsgi:app --bind unix:/tmp/apps/remoteconn.sock \
|
||||||
|
-k eventlet \
|
||||||
|
-w $WORKER_COUNT \
|
||||||
|
--log-level $LOG_LEVEL
|
||||||
}
|
}
|
||||||
main $@;
|
main $@;
|
||||||
|
|
|
@ -1,10 +1,30 @@
|
||||||
eventlet==0.29.1
|
bcrypt==3.1.7
|
||||||
Flask==1.1.2
|
cffi==1.14.0
|
||||||
|
Click==7.0
|
||||||
|
dnspython==1.16.0
|
||||||
|
eventlet==0.25.2
|
||||||
|
Flask==1.1.1
|
||||||
Flask-Bcrypt==0.7.1
|
Flask-Bcrypt==0.7.1
|
||||||
Flask-Login==0.5.0
|
Flask-Login==0.5.0
|
||||||
flask-oidc==1.4.0
|
Flask-SocketIO==4.3.0
|
||||||
Flask-SocketIO==4.3.1
|
greenlet==0.4.16
|
||||||
greenlet==0.4.17
|
|
||||||
waitress==1.4.3
|
waitress==1.4.3
|
||||||
PyAutoGUI==0.9.52
|
itsdangerous==1.1.0
|
||||||
Werkzeug==1.0.1
|
Jinja2==2.10.3
|
||||||
|
MarkupSafe==1.1.1
|
||||||
|
monotonic==1.5
|
||||||
|
MouseInfo==0.1.3
|
||||||
|
Pillow==7.1.2
|
||||||
|
pkg-resources==0.0.0
|
||||||
|
PyAutoGUI==0.9.50
|
||||||
|
pycparser==2.20
|
||||||
|
PyGetWindow==0.0.8
|
||||||
|
PyMsgBox==1.0.8
|
||||||
|
pyperclip==1.8.0
|
||||||
|
PyRect==0.1.4
|
||||||
|
PyScreeze==0.1.26
|
||||||
|
python-engineio==3.13.0
|
||||||
|
python-socketio==4.6.0
|
||||||
|
PyTweening==1.0.3
|
||||||
|
six==1.14.0
|
||||||
|
Werkzeug==0.16.0
|
||||||
|
|
Loading…
Reference in New Issue