Reset to working instance...

This commit is contained in:
itdominator 2021-07-18 21:59:33 -05:00
parent 5bbaa6c5ae
commit 28e1ea598d
9 changed files with 173 additions and 88 deletions

View File

@ -37,6 +37,34 @@ Linux/Mac
Windows
``` ./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
![1 Interface.... ](images/pic1.png)

View File

@ -1,10 +1,30 @@
eventlet==0.29.1
Flask==1.1.2
bcrypt==3.1.7
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-Login==0.5.0
flask-oidc==1.4.0
Flask-SocketIO==4.3.1
greenlet==0.4.17
gunicorn==20.0.4
PyAutoGUI==0.9.52
Werkzeug==1.0.1
Flask-SocketIO==4.3.0
greenlet==0.4.16
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2==2.10.3
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

View File

@ -1,18 +1,11 @@
# Python imports
import os, secrets
from datetime import timedelta
import secrets
# Lib imports
import pyautogui
import eventlet
# import eventlet.debug
from engineio.payload import Payload
# Some fixrs for Websockets
eventlet.monkey_patch()
# eventlet.debug.hub_prevent_multiple_readers(False)
Payload.max_decode_packets = 120 # Fix too many small packets causing error
from engineio.payload import Payload
from flask import Flask
@ -25,33 +18,13 @@ from flask_socketio import SocketIO
# Configs and 'init'
APP_NAME = 'RemoteMouse'
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__)
app.config.update({
"TITLE": APP_NAME,
'DEBUG': False,
'SECRET_KEY': secrets.token_hex(32),
'PERMANENT_SESSION_LIFETIME': timedelta(days = 7).total_seconds()
})
app.config['TITLE'] = 'RemoteMouse'
app.config['SECRET_KEY'] = secrets.token_hex(32) # For csrf and some other stuff...
# For Websockets
socketio = SocketIO(app, async_mode = 'eventlet',
cors_allowed_origins = ["*"],
path = "socket.io",
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
# eventlet.monkey_patch()
Payload.max_decode_packets = 120 # Fix too many small packets causing error
socketio = SocketIO(app, async_mode='eventlet')
from core import routes

View File

@ -7,29 +7,74 @@ from flask import request, render_template
# 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
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('/')
def home():
if request.method == 'GET':
return render_template('index.html')
return render_template('index.html',
title=TITLE)
return render_template('error.html',
title='Error!',
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'])
def sendKeys():
if request.method == 'POST':
try:
text = str(request.values['text']).strip()
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:
print( repr(e) )
return render_template('error.html',

View File

@ -6,7 +6,7 @@ from flask import request, render_template
# 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
@ -14,76 +14,69 @@ from core.MessageHandler import MessageHandler # Get simple message processor
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')
@socketio.on('mouse_down', namespace='/socket.io')
@socketio.on('mouse_down')
def mouseDown(eve = None):
pyautogui.mouseDown()
return ""
@app.route('/mouse-up')
@socketio.on('mouse_up', namespace='/socket.io')
@socketio.on('mouse_up')
def mouseUp(eve = None):
pyautogui.mouseUp()
return ""
@app.route('/left-click')
@socketio.on('left_click', namespace='/socket.io')
@socketio.on('left_click')
def leftClick(eve = None):
pyautogui.click()
return ""
@app.route('/right-click')
@socketio.on('right_click', namespace='/socket.io')
@socketio.on('right_click')
def rightClick(eve = None):
pyautogui.click(button='right')
return ""
@app.route('/scroll-up')
@socketio.on('scroll_up', namespace='/socket.io')
@socketio.on('scroll_up')
def scrollUp(eve = None):
pyautogui.scroll(1)
return ""
@app.route('/scroll-down')
@socketio.on('scroll_down', namespace='/socket.io')
@socketio.on('scroll_down')
def scrollDown(eve = None):
pyautogui.scroll(-1)
return ""
@app.route('/press-enter')
@socketio.on('press_enter', namespace='/socket.io')
@socketio.on('press_enter')
def pressEnter(eve = None):
pyautogui.press("enter")
return ""
@app.route('/press-back')
@socketio.on('press_back', namespace='/socket.io')
@socketio.on('press_back')
def pressBack(eve = None):
pyautogui.press("backspace")
return ""
@app.route('/update-coords/xy/<m1>/<m2>')
@socketio.on('update_coords', namespace='/socket.io')
def updateCoords(m1 = None, m2 = None):
if not m2:
try:
parts = m1.split(",")
x = float( parts[0] )
y = float( parts[1] )
# print(str(x) + "," + str(y))
pyautogui.moveRel(x, y);
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 ""
@socketio.on('update_coords')
def updateCoords(message):
try:
parts = message.split(",")
x = float( parts[0] )
y = float( parts[1] )
# print(str(x) + "," + str(y))
pyautogui.moveRel(x, y);
except Exception as e:
print( repr(e) )

View File

@ -6,7 +6,7 @@
{% if title %}
<title>{{title}}</title>
{% else %}
<title>{{TITLE}}</title>
<title>App</title>
{% endif %}
{% block header_css %}

View File

@ -11,17 +11,16 @@ function main() {
echo "Working Dir: " $(pwd)
source "../venv/bin/activate"
LOG_LEVEL=debug
LOG_LEVEL=error
WORKER_COUNT=1
ADDR=127.0.0.1
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: NEED -k eventlet for this to work! I spent too many hours on this...
# <module>:<app> IE <file>:<flask app variable>
gunicorn wsgi:app \
-b $ADDR:$PORT \
gunicorn wsgi:app -b $ADDR:$PORT \
-k eventlet \
-w $WORKER_COUNT \
--timeout $TIMEOUT \

View File

@ -10,6 +10,13 @@ function main() {
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd)
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 $@;

View File

@ -1,10 +1,30 @@
eventlet==0.29.1
Flask==1.1.2
bcrypt==3.1.7
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-Login==0.5.0
flask-oidc==1.4.0
Flask-SocketIO==4.3.1
greenlet==0.4.17
Flask-SocketIO==4.3.0
greenlet==0.4.16
waitress==1.4.3
PyAutoGUI==0.9.52
Werkzeug==1.0.1
itsdangerous==1.1.0
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