Beispiel #1
0
 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)
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
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())
Beispiel #5
0
 def get_gadgets(self, file):
     argv = ('--binary %s' % file).split()
     args = Args(argv).get_args()
     core = Core(args)
     return core.analyze(True)
Beispiel #6
0
 def make_core(self, argv):
     argv_split = argv.split()
     args = Args(argv_split).get_args()
     core = Core(args)
     return args, core