# Path: pyexfil/includes/encryption_wrappers.py
# def AESDecryptOFB(key, text, unpad=True):
# 	if type(key) == str:
# 		key = bytes(key, 'ascii')
# 	padded_key = key + b'\x00' * (32 - len(key))
# 	decryptor = AES.new(padded_key, mode, iv.encode("utf8"))
# 	plain = decryptor.decrypt(text)
# 	if unpad:
# 		plain = plain.replace(b'\x00', b'')
# 	return plain
# 
# def AESEncryptOFB(key, text):
# 	if type(key) == str:
# 		key = bytes(key, 'ascii')
# 	pad_len = (-len(text)) % 16
# 	padded_text = text + b'\x00' * pad_len
# 	padded_key = key +  b'\x00' * (32 - len(key))
# 	encs = AES.new(padded_key, mode, iv.encode("utf8"))
# 	plain = encs.encrypt(padded_text)
# 	return plain


import os
import sys
import csv
import json
import socket
import base64
import hashlib
import threading
from scapy.all import *
from Crypto import Random
from Crypto.Cipher import AES
from StringIO import StringIO
from pyexfil.includes.encryption_wrappers import AESDecryptOFB, AESEncryptOFB
#!/usr/bin/python



# Python3 Compatiblity
try:
	input_prompt = raw_input
except:
	input_prompt = input



PROMPT = "DB_LSP > "
counter = 0             # Create a Packet Counter


class AESCipher(object):

	def __init__(self, key):
		self.bs = 32
		self.key = hashlib.sha256(key.encode()).digest()

	def encrypt(self, raw):
		raw = self._pad(raw)
		iv = Random.new().read(AES.block_size)
		cipher = AES.new(self.key, AES.MODE_CBC, iv)
		return base64.b64encode(iv + cipher.encrypt(raw))

	def decrypt(self, enc):

# Path: pyexfil/includes/encryption_wrappers.py
# def AESDecryptOFB(key, text, unpad=True):
# 	if type(key) == str:
# 		key = bytes(key, 'ascii')
# 	padded_key = key + b'\x00' * (32 - len(key))
# 	decryptor = AES.new(padded_key, mode, iv.encode("utf8"))
# 	plain = decryptor.decrypt(text)
# 	if unpad:
# 		plain = plain.replace(b'\x00', b'')
# 	return plain
# 
# def AESEncryptOFB(key, text):
# 	if type(key) == str:
# 		key = bytes(key, 'ascii')
# 	pad_len = (-len(text)) % 16
# 	padded_text = text + b'\x00' * pad_len
# 	padded_key = key +  b'\x00' * (32 - len(key))
# 	encs = AES.new(padded_key, mode, iv.encode("utf8"))
# 	plain = encs.encrypt(padded_text)
# 	return plain


# Path: pyexfil/Comm/DB_LSP/dblsp.py
import os
import sys
import csv
import json
import socket
import base64
import hashlib
import threading
from scapy.all import *
from Crypto import Random
from Crypto.Cipher import AES
from StringIO import StringIO
from pyexfil.includes.encryption_wrappers import AESDecryptOFB, AESEncryptOFB

#!/usr/bin/python



# Python3 Compatiblity
try:
	input_prompt = raw_input
except:
	input_prompt = input



PROMPT = "DB_LSP > "
counter = 0             # Create a Packet Counter


class AESCipher(object):

	def __init__(self, key):
		self.bs = 32
		self.key = hashlib.sha256(key.encode()).digest()

	def encrypt(self, raw):
		raw = self._pad(raw)
		iv = Random.new().read(AES.block_size)
		cipher = AES.new(self.key, AES.MODE_CBC, iv)
		return base64.b64encode(iv + cipher.encrypt(raw))

	def decrypt(self, enc):

		enc = base64.b64decode(enc)