def all_gadgets(self, binary): argv = ('--binary %s %s' % (binary, self.args_string())) argv = argv.split() args = Args(argv).get_args() core = Core(args) gadgets = core.analyze(True) return core.pass_clean(gadgets)
def args_string(self): args_string = "" args = Args(sys.argv[1:]).get_args() if args.depth != 5: args_string += " --depth %s" % args.depth if args.all: args_string += " --all" if args.nojop: args_string += " --nojop" if args.noretf: args_string += " --noretf" return args_string
def test_op(self, file, op): argv = ('--binary %s --op %s' % (file, op)).split() args = Args(argv).get_args() core = Core(args) if "--ropchain" not in argv: gadgets = core.search_operation(self.__gadgets, args.op, args.reg_src, args.reg_dst) else: gadgets = core.search_ropchains(self.__gadgets, args.op, args.reg_src, args.reg_dst) if len(gadgets) != 0: return True return False
def main(): import sys from easyrop.args import Args from easyrop.core import Core from easyrop.tester import Tester from easyrop.rop_generator import RopGenerator args = Args(sys.argv[1:]).get_args() if args.ropattack: RopGenerator(args.binary, args.ropattack).generate() elif args.test_os: Tester().test() elif args.test_binary: Tester().test_binary(args.test_binary) else: sys.exit(Core(args).analyze())
def get_gadgets(self, file): argv = ('--binary %s' % file).split() args = Args(argv).get_args() core = Core(args) return core.analyze(True)
def make_core(self, argv): argv_split = argv.split() args = Args(argv_split).get_args() core = Core(args) return args, core