Skip to content

Commit

Permalink
Merge pull request #42 from commial/fix/minifix
Browse files Browse the repository at this point in the history
Few fixes
  • Loading branch information
commial authored Mar 24, 2017
2 parents 97522f1 + 8913942 commit 154cc33
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 17 deletions.
4 changes: 3 additions & 1 deletion ext/ida/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def launch_on_funcs(architecture, abi, funcs, test_set, map_addr=None,

# Launch identification
print "Launch identification on %d function(s)" % nb_func
options = ["-t"] + test_set + ["-a", architecture, "-b", abi, "-o", "JSON"]
options = ["-a", architecture, "-b", abi, "-o", "JSON"]
for test_name in test_set:
options = ["-t", test_name]
if jitter is not None:
options += ["-j", jitter]
options += add_map
Expand Down
27 changes: 16 additions & 11 deletions sibyl/actions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,26 @@ class ActionConfig(Action):

_name_ = "config"
_desc_ = "Configuration management"
_args_ = [(("-V", "--value"), {"help": "Return the value of a specific option"}),
_args_ = [
(("-V", "--value"), {"help": "Return the value of a specific option"}),
(("-d", "--dump"), {"help": "Dump the current configuration",
"action": "store_true"}),
]

def run(self):
if not self.args.value:
self.show()

if self.args.value.endswith("_keys") and hasattr(config,
self.args.value[:-5]):
val = getattr(config, self.args.value[:-5]).keys()
elif hasattr(config, self.args.value):
val = getattr(config, self.args.value)
if self.args.dump:
print "\n".join(config.dump())
elif self.args.value:
if self.args.value.endswith("_keys") and hasattr(config,
self.args.value[:-5]):
val = getattr(config, self.args.value[:-5]).keys()
elif hasattr(config, self.args.value):
val = getattr(config, self.args.value)
else:
val = "ERROR"
print val
else:
val = "ERROR"
print val
self.show()

def show(self):
# Configuration files
Expand Down
10 changes: 5 additions & 5 deletions sibyl/actions/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ class ActionFind(Action):
"choices": Machine.available_machine()}),
(["-b", "--abi"], {"help": "ABI to use",
"choices": [x.__name__ for x in ABIS]}),
(["-t", "--tests"], {"help": "Tests to run",
"nargs": "*",
"choices": ["all"] + config.available_tests.keys(),
"default": ["all"]}),
(["-t", "--tests"], {"help": "Tests to run (default is all)",
"choices": config.available_tests.keys(),
"default": [],
"action": "append"}),
(["-v", "--verbose"], {"help": "Verbose mode (use multiple time to " \
"increase verbosity level)",
"action": "count",
Expand Down Expand Up @@ -175,7 +175,7 @@ def run(self):
# Select Test set
self.tests = []
for tname, tcases in config.available_tests.iteritems():
if "all" in self.args.tests or tname in self.args.tests:
if not self.args.tests or tname in self.args.tests:
self.tests += tcases
if self.args.verbose > 0:
print "Found %d test cases" % len(self.tests)
Expand Down
16 changes: 16 additions & 0 deletions sibyl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ def parse_files(self, files):
for name in cparser.options("tests"):
self.config["tests"][name] = cparser.get("tests", name)

def dump(self):
"""Dump the current configuration as a config file"""
out = []

# Find
out.append("[find]")
out.append("jit_engine = %s" % ",".join(self.config["jit_engine"]))

# Tests
out.append("")
out.append("[tests]")
for name, path in self.config["tests"].iteritems():
out.append("%s = %s" % (name, path))

return out

@property
def jit_engine(self):
"""Name of engine to use for jit"""
Expand Down

0 comments on commit 154cc33

Please sign in to comment.