summaryrefslogtreecommitdiff
path: root/python_client.py
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2014-02-15 10:01:21 +0100
committerTreeki <treeki@gmail.com>2014-02-15 10:01:21 +0100
commit878a0c157b772a7ed04d4cc395059087f964b823 (patch)
tree623ad18853c846b6498ebbc56eb436a792f32ad3 /python_client.py
parent04cf34e30aa6541568660dfe9e77b2b2c0a9db88 (diff)
downloadbounce4-878a0c157b772a7ed04d4cc395059087f964b823.tar.gz
bounce4-878a0c157b772a7ed04d4cc395059087f964b823.zip
implement rudimentary password authentication
Diffstat (limited to '')
-rw-r--r--python_client.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/python_client.py b/python_client.py
index fc0ff9b..d30993c 100644
--- a/python_client.py
+++ b/python_client.py
@@ -40,6 +40,7 @@ nextID = 1
lastReceivedPacketID = 0
packetCache = []
packetLock = threading.Lock()
+password = ''
u32 = struct.Struct('<I')
@@ -552,7 +553,10 @@ class MainWindow(QtWidgets.QMainWindow):
authed = False
def handleLogin(self):
- writePacket(0x8001, struct.pack('<II 16s', protocolVer, lastReceivedPacketID, sessionKey), True)
+ encPW = password.encode('utf-8')
+ piece1 = struct.pack('<III', protocolVer, lastReceivedPacketID, len(encPW))
+ piece2 = struct.pack('16s', sessionKey)
+ writePacket(0x8001, piece1 + encPW + piece2, True)
def handleDebug(self, text):
with packetLock:
@@ -569,6 +573,12 @@ class MainWindow(QtWidgets.QMainWindow):
writePacket(0x102, struct.pack('<II', wid, len(data)) + data)
+
+if len(sys.argv) > 1:
+ password = sys.argv[1]
+else:
+ print('No password entered on command line!')
+
app = QtWidgets.QApplication(sys.argv)
mainwin = MainWindow()