back to a focus on usability, static just isnt there yet

This commit is contained in:
George Hotz 2014-11-07 13:53:13 -05:00
parent 53825f4107
commit f3fd86593f
6 changed files with 21 additions and 35 deletions

View File

@ -28,9 +28,7 @@ if __name__ == '__main__':
parser.add_argument("--host", metavar="HOST", help="listen address for web interface and socat. 127.0.0.1 by default", default=qira_config.HOST)
parser.add_argument("--web-port", metavar="PORT", help="listen port for web interface. 3002 by default", type=int, default=qira_config.WEB_PORT)
parser.add_argument("--socat-port", metavar="PORT", help="listen port for socat. 4000 by default", type=int, default=qira_config.SOCAT_PORT)
parser.add_argument("--ida", help="use ida to generate static data", action="store_true")
parser.add_argument("--radare", help="use radare to generate static data", action="store_true")
#parser.add_argument("--with-capstone", metavar="WITH_CAPSTONE", help="enable capstone for smarter disassembly", action="store_true")
parser.add_argument("--static", help="enable static features using static2", action="store_true")
#capstone flag in qira_config for now
# parse arguments, first try
@ -84,12 +82,7 @@ if __name__ == '__main__':
if args.cda:
qira_config.WITH_CDA = True
qira_config.WITH_DWARF = True
if args.ida:
qira_config.WITH_IDA = True
qira_config.WITH_STATIC = True
qira_config.WITH_CAPSTONE = True
if args.radare:
qira_config.WITH_RADARE = True
if args.static:
qira_config.WITH_STATIC = True
if args.flush_cache:
print "*** flushing caches"

View File

@ -20,25 +20,11 @@ CODESEARCHDIR = BASEDIR+"/cda/codesearch-latest/"
CALLED_AS_CDA = False
# capstone is now a requirement
WITH_CAPSTONE = True
# turn this off for now on releases
# this should all be removed
WITH_STATIC = False
WITH_CAPSTONE = False
WITH_RADARE = False
WITH_STATIC2 = False
WITH_IDA = False
WEBSOCKET_DEBUG = False
# enable radare if it's installed
"""
try:
from r2.r_core import RCore
WITH_RADARE = True
WITH_STATIC = True
except:
WITH_RADARE = False
"""

View File

@ -116,9 +116,12 @@ class Program:
self.proghash = sha1(open(self.program, "rb").read()).hexdigest()
print "*** program is",self.program,"with hash",self.proghash
# init static
# this is always initted, as it's the tag repo
self.static = static2.Static(self.program)
self.static.process()
# init static
if qira_config.WITH_STATIC:
self.static.process()
# no traces yet
self.traces = {}

View File

@ -359,8 +359,6 @@ def do_search(b64search):
ret.append(s)
return '<br/>'.join(ret)
# web static moved to external file
import qira_webstatic
# ***** generic webserver stuff *****
@ -396,11 +394,11 @@ def run_server(largs, lprogram):
global static
args = largs
program = lprogram
qira_webstatic.init(lprogram)
if qira_config.WITH_STATIC:
import qira_static
qira_static.init_static(program)
# web static moved to external file
import qira_webstatic
qira_webstatic.init(lprogram)
if qira_config.WITH_CDA:
import cacheserver
app.register_blueprint(cacheserver.app)

View File

@ -1,3 +1,4 @@
import qira_config
# returns list of addresses with respect to the qira memory model
# use no dependencies other than bap toil
@ -62,7 +63,7 @@ def load(sig_file):
# main function start identification function
def fsi(static):
trie = load("bw_x86")
trie = load(qira_config.BASEDIR+"/static2/bw_x86")
functions = set()
(addr, lenn) = static['sections'][-3]
for (addr, lenn) in static['sections']:

View File

@ -204,9 +204,14 @@ class Static:
def process(self):
recursive.make_function_at(self, self['entry'])
"""
main = self.get_address_by_name("main")
if main != None:
recursive.make_function_at(self, main)
"""
bw_functions = byteweight.fsi(self)
for f in bw_functions:
recursive.make_function_at(self, f)
print "*** found %d functions" % len(self['functions'])