Esempio n. 1
0
    def generate_medium_detour_binary(self, test_bin=True):
        try:
            nr = NetworkRules()
            backend = DetourBackend(self.infile)
            patches = []

            patches.extend(IndirectCFI(self.infile, backend).get_patches())
            patches.extend(
                TransmitProtection(self.infile, backend).get_patches())
            patches.extend(ShiftStack(self.infile, backend).get_patches())
            patches.extend(Adversarial(self.infile, backend).get_patches())
            patches.extend(Backdoor(self.infile, backend).get_patches())
            # patches.extend(NxStack(self.infile,backend).get_patches())
            patches.extend(
                MallocExtPatcher(self.infile, backend).get_patches())
            patches.extend(
                StackRetEncryption(self.infile, backend).get_patches())
            patches.extend(
                UninitializedPatcher(self.infile, backend).get_patches())
            patches.extend(
                NoFlagPrintfPatcher(self.infile, backend).get_patches())

            backend.apply_patches(patches)
            final_content = backend.get_final_content()
            if test_bin:
                test_bin_with_qemu(self.infile, final_content)
            res = (final_content, "")
        except PatcherexError, e:
            traceback.print_exc(e)
            res = (None, None)
Esempio n. 2
0
 def generate_fidget_bitflip_binary(self):
     nr = NetworkRules()
     midfile = self.infile + '.fidget' + str(random.randrange(0, 1000))
     fidget_it(self.infile, midfile)
     backend = DetourBackend(midfile)
     cp = Bitflip(midfile, backend)
     patches1 = cp.get_patches()
     backend.apply_patches(patches1)
     return (backend.get_final_content(), nr.get_bitflip_rule())
Esempio n. 3
0
    def generate_medium_lief_detour_binary(self, test_bin=True):
        try:
            backend = DetourBackend(self.infile)
            patches = []

            patches.extend(
                StackRetEncryption(self.infile, backend).get_patches())

            backend.apply_patches(patches)
            final_content = backend.get_final_content()
            if test_bin:
                test_bin_with_qemu(self.infile, final_content)
            res = (final_content, "")
        except PatcherexError, e:
            traceback.print_exc(e)
            res = (None, None)