From 3c595ff61946d6845a8d0f000832abf028f147ba Mon Sep 17 00:00:00 2001 From: BB Date: Sun, 7 May 2023 22:07:52 -0600 Subject: [PATCH] netgenie-srv: Added base64 encode/decode functions to match the c versions. --- NetGuard | 2 +- server/NetGenieSrv.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NetGuard b/NetGuard index dec7cce..7db7f07 160000 --- a/NetGuard +++ b/NetGuard @@ -1 +1 @@ -Subproject commit dec7cce32ff6942c18c3454291204bca42e7cbca +Subproject commit 7db7f0785dd8d70e8caea243fd1409c80346cf17 diff --git a/server/NetGenieSrv.py b/server/NetGenieSrv.py index 2898efd..244a714 100644 --- a/server/NetGenieSrv.py +++ b/server/NetGenieSrv.py @@ -2,6 +2,7 @@ import asyncio import threading from scapy.all import * import argparse +import base64 DEBUG=False @@ -139,6 +140,19 @@ def connectIO(inaddr='127.0.0.1', inport=8001, outaddr='127.0.0.1', outport=8002 return insock, outsock +def base64_decode_with_plus(data): + data = data.rstrip('+') + padding = 4 - len(data) % 4 + data += '=' * padding + return base64.b64decode(data) + +def base64_encode_with_plus(data): + encoded_data = base64.b64encode(data).rstrip(b'=') + padding = (4 - len(encoded_data) % 4) % 4 + encoded_data += b'+' * padding + return encoded_data.decode('ascii') + + def parseArgs(): args = argparse.ArgumentParser() # The bridge ip and port