Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

Commit 60d2f1d

Browse files
committed
Ready for release
There was still some bugs that make the application crashed when used with the password protection. I also added a banner at start with the version, as I tend to forget to increment the version I simply used the commit hash. Obviously the commit hash will always be one version behind but this should do the trick for now.
1 parent 97f9aff commit 60d2f1d

10 files changed

+47
-50
lines changed

README.md

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,32 @@ The easiest way to use this software is to download the compiled version.
4242
You can find it here:
4343
https://github.com/madnerdorg/libreconnect/releases
4444

45+
# Use password
46+
You can use a password, just send it using the websocket.
47+
For example:
48+
```
49+
usb_scanner --password HorseBatteryStaple
50+
```
51+
As for now you can only use the same password for each connector.
52+
53+
# IP Ban
54+
I also implement ip ban to disallow force brute.
55+
```
56+
usb_scanner --bantime seconds
57+
```
58+
59+
# Power management
60+
If you want to be able to turn on/off your system (this is useful if you don't have access to a terminal for ex.)
61+
You can use special commands.
62+
```
63+
usb_scanner --power
64+
```
65+
Then send using the websocket:
66+
```
67+
Turn off server: @poweroff
68+
Reboot server: @reboot
69+
```
70+
4571
# Use python version
4672
I recommended using miniconda if you are on windows (https://conda.io/miniconda.html)
4773
This will work on python 2/3.
@@ -71,30 +97,11 @@ openssl x509 -req -days 3650 -in keys/server.csr -signkey keys/server.key -out k
7197
openssl x509 -in keys/server.crt -out keys/server.pem
7298
```
7399

74-
# Use password
75-
You can use a password, just send it using the websocket.
76-
For example:
77-
```
78-
usb_scanner --password HorseBatteryStaple
79-
```
80-
As for now you can only use the same password for each connector.
81-
82-
# IP Ban
83-
I also implement ip ban to disallow force brute.
84-
```
85-
usb_scanner --bantime seconds
86-
```
87-
88-
# Power management
89-
If you want to be able to turn on/off your system (this is useful if you don't have access to a terminal for ex.)
90-
You can use special commands.
100+
# Compile
101+
I used pyinstaller to compile, it seems it doesn't works with python 3.6
91102
```
92-
usb_scanner --power
93-
```
94-
Then send using the websocket:
95-
```
96-
Turn off server: @poweroff
97-
Reboot server: @reboot
103+
pip install pyinstaller
104+
pip install pypiwin32
98105
```
99106

100107
# Source

connector.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ def onMessage(self, payload, isBinary):
203203
self.sendMessage(str("@banned").encode())
204204
else:
205205
suspected_clients[suspect]["retry"] = user["retry"] + 1
206-
self.sendMessage("@wrongpassword:" +
207-
str(suspected_clients[suspect]["retry"]) +
208-
"/" +
209-
str(maxretry)).encode()
206+
error_message = "@wrongpassword:" + str(suspected_clients[suspect]["retry"]) + "/" + str(maxretry)
207+
self.sendMessage(error_message.encode())
210208
print("Recorded suspect: " +
211209
str(suspected_clients[suspect]["retry"]))
212210
else:

scripts/compile.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
@echo off
22
cd ..
33
pip install pyinstaller
4+
pip install pypiwin32
45
pyinstaller --onefile connector.py
6+
pyinstaller --onefile usb_scanner.py

scripts/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
pip install pyinstaller
3-
cd ..;pyinstaller --onefile connector.py
3+
cd ..;pyinstaller --onefile connector.py;pyinstaller --onefile usb_scanner.py

scripts/compile_service.bat

Lines changed: 0 additions & 4 deletions
This file was deleted.

scripts/install.bat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@echo off
22
cd ..
3-
pip install websocket
43
pip install pyserial
5-
pip install websocket_server
4+
pip install twisted
5+
pip install autobahn
6+
pip install service_identity
67
pause

scripts/install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2-
pip install websocket
32
pip install pyserial
4-
pip install websocket_server
3+
pip install twisted
4+
pip install autobahn
5+
pip install service_identity

scripts/start.bat

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/start.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

usb_scanner.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import subprocess
1515
import os
1616

17+
18+
version = "97f9aff"
1719
# We use 115200 as default baudrate
1820
baudrate = 115200
1921
# Check serial ports every x seconds
@@ -25,6 +27,10 @@
2527
devices_name = []
2628
devices_websocket = []
2729

30+
print("LibreConnect - version " + version)
31+
print("By madnerd.org (https://github.com/madnerdorg/libreconnect)")
32+
print("----------------------------------------------------------")
33+
2834
# Check if python file existed, if not default to compiled version
2935
if os.path.exists("connector.py"):
3036
connector_software = "python connector.py"

0 commit comments

Comments
 (0)