Systemsicherheit/Assignment 4 - Protokollsicherheit (Praxis)/proxy/proxymodules/syssec.py
2024-05-25 10:25:40 +02:00

28 lines
950 B
Python

import os.path as path
import json
import socket
class Module:
def __init__(self, incoming=False, verbose=False, options=None):
# extract the file name from __file__. __file__ is proxymodules/name.py
self.name = path.splitext(path.basename(__file__))[0]
self.description = 'Simply print the received data as text'
self.incoming = incoming # incoming means module is on -im chain
self.find = None # if find is not None, this text will be highlighted
def execute(self, data):
print(f"Incoming data: {data}")
### Work with data here ###
# data_json = json.loads(data)
# data_json["content"] = "Blablabla"
# data = json.dumps(data_json)
# print(f"Outgoing data: {data}")
# return data + "\n"
print(f"Outgoing data: {data}")
return data
if __name__ == '__main__':
print('This module is not supposed to be executed alone!')