netgenie-srv: Added base64 encode/decode functions to match the c versions.
This commit is contained in:
1 parent
bb0ba68bbc
commit
3c595ff619
2 files changed
+15
-1
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user