netgenie-srv: Added base64 encode/decode functions to match the c versions.

This commit is contained in:
BB 2023-05-07 22:07:52 -06:00
parent bb0ba68bbc
commit 3c595ff619
2 changed files with 15 additions and 1 deletions

@ -1 +1 @@
Subproject commit dec7cce32ff6942c18c3454291204bca42e7cbca Subproject commit 7db7f0785dd8d70e8caea243fd1409c80346cf17

View File

@ -2,6 +2,7 @@ import asyncio
import threading import threading
from scapy.all import * from scapy.all import *
import argparse import argparse
import base64
DEBUG=False 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 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(): def parseArgs():
args = argparse.ArgumentParser() args = argparse.ArgumentParser()
# The bridge ip and port # The bridge ip and port