예제 #1
0
def main(doAllFuncs=True):
    #doAllFuncs=False
    #jayutils.configLogger('', logging.DEBUG)
    jayutils.configLogger('', logging.INFO)
    logger = jayutils.getLogger('stackstrings')
    logger.debug('Starting up now')
    filePath = jayutils.getInputFilepath()
    if filePath is None:
        self.logger.info('No input file provided. Stopping')
        return
    vw = jayutils.loadWorkspace(filePath)
    ea = idc.ScreenEA()
    res = idc.AskYN(0, 'Use basic-block local aggregator')
    if res == -1:
        print 'User canceled'
        return
    uselocalagg = (res == 1)
    ranges = getFuncRanges(ea, doAllFuncs)
    for funcStart, funcEnd in ranges:
        try:
            logger.debug('Starting on function: 0x%x', funcStart)
            stringList = runStrings(vw, funcStart, uselocalagg)
            for node, string in stringList:
                if isLikelyFalsePositiveString(string):
                    #if it's very likely a FP, skip annotating
                    continue
                print '0x%08x: %s' % (node[0], string)
                #print '0x%08x: 0x%08x: %s %s' % (node[0], node[1], binascii.hexlify(string), string)
                idc.MakeComm(node[0], string.strip())

        except Exception, err:
            logger.exception('Error during parse: %s', str(err))
예제 #2
0
def main():
    #jayutils.configLogger(__name__, logging.DEBUG)
    jayutils.configLogger(__name__, logging.INFO)
    logger = jayutils.getLogger('')
    logger.debug('Starting up in main')
    #name = idc.AskStr('CreateThread', 'Enter function to find args for')
    #argNum = idc.AskLong(6)

    filePath = jayutils.getInputFilepath()
    if filePath is None:
        self.logger.info('No input file provided. Stopping')
        return
    vw = jayutils.loadWorkspace(filePath)
    logger.debug('Loaded workspace')
    tracker = ArgTracker(vw)

    import idautils
    funcEa = idc.get_name_ea_simple('CreateThread')
    if funcEa == idc.BADADDR:
        logger.info('CreateThread not found. Returning now')
        return
    for xref in idautils.XrefsTo(funcEa):
        argsList = tracker.getPushArgs(xref.frm, 6)
        for argDict in argsList:
            print '-' * 60
            pc, value = argDict[3]
            print '0x%08x: 0x%08x: 0x%08x' % (xref.frm, pc, value)
예제 #3
0
def main():
    #jayutils.configLogger(__name__, logging.DEBUG)
    jayutils.configLogger(__name__, logging.INFO)
    logger = jayutils.getLogger('')
    logger.debug('Starting up in main')
    #name = idc.AskStr('CreateThread', 'Enter function to find args for')
    #argNum = idc.AskLong(6)

    filePath = jayutils.getInputFilepath()
    if filePath is None:
        self.logger.info('No input file provided. Stopping')
        return
    vw = jayutils.loadWorkspace(filePath)
    logger.debug('Loaded workspace')
    tracker = ArgTracker(vw)

    import idautils
    funcEa = idc.LocByName('CreateThread')
    if funcEa == idc.BADADDR:
        logger.info('CreateThread not found. Returning now')
        return
    for xref in idautils.XrefsTo(funcEa):
        argsList = tracker.getPushArgs(xref.frm, 6)
        for argDict in argsList:
            print '-'*60
            pc, value = argDict[3]
            print '0x%08x: 0x%08x: 0x%08x' % (xref.frm, pc, value)
예제 #4
0
def main(doAllFuncs=True):
    #doAllFuncs=False
    #jayutils.configLogger('', logging.DEBUG)
    jayutils.configLogger('', logging.INFO)
    logger = jayutils.getLogger('stackstrings')
    logger.debug('Starting up now')
    filePath = jayutils.getInputFilepath()
    if filePath is None:
        self.logger.info('No input file provided. Stopping')
        return
    vw = jayutils.loadWorkspace(filePath)
    ea = idc.ScreenEA()
    res = idc.AskYN(0, 'Use basic-block local aggregator')
    if res == -1:
        print 'User canceled'
        return
    uselocalagg = (res == 1)
    ranges = getFuncRanges(ea, doAllFuncs)
    for funcStart, funcEnd in ranges:
        try:
            logger.debug('Starting on function: 0x%x', funcStart)
            stringList = runStrings(vw, funcStart, uselocalagg)    
            for node, string in stringList:
                if isLikelyFalsePositiveString(string):
                    #if it's very likely a FP, skip annotating
                    continue
                print '0x%08x: %s' % (node[0], string)
                #print '0x%08x: 0x%08x: %s %s' % (node[0], node[1], binascii.hexlify(string), string)
                idc.MakeComm(node[0], string.strip())
     
        except Exception, err:
            logger.exception('Error during parse: %s', str(err))
예제 #5
0
def main():
    try:
        global logger
        #logger = jayutils.configLogger(__name__, logging.DEBUG)
        logger = jayutils.configLogger(__name__, logging.INFO)
        launcher = ApplyCalleeTypeRunner()
        launcher.run()
    except Exception, err:
        import traceback
        print('Error in act: %s: %s' % (str(err), traceback.format_exc()))
예제 #6
0
def main():
    try:
        global logger
        #logger = jayutils.configLogger(__name__, logging.DEBUG)
        logger = jayutils.configLogger(__name__, logging.INFO)
        launcher = ApplyCalleeTypeRunner()
        launcher.run()
    except Exception, err:
        import traceback
        print('Error in act: %s: %s' % (str(err), traceback.format_exc()))
예제 #7
0
def main():
    #logger = jayutils.configLogger('', logging.DEBUG)
    logger = jayutils.configLogger('', logging.INFO)
    launcher = StructTypeRunner()
    launcher.run()
예제 #8
0
def main():
    #logger = jayutils.configLogger('', logging.DEBUG)
    logger = jayutils.configLogger('', logging.INFO)
    launcher = SearchLauncher()
    launcher.run()
예제 #9
0
QT_AVAILABLE = True
try:
    from PyQt5 import QtWidgets, QtCore
    from shellcode_widget import ShellcodeWidget
except ImportError:
    print 'Falling back to simple dialog-based GUI. \nPlease consider installing the HexRays PyQt5 build available at \n"http://hex-rays.com/products/ida/support/download.shtml"'
    QT_AVAILABLE = False


# get the IDA version number
ida_major, ida_minor = map(int, idaapi.get_kernel_version().split("."))
using_ida7api = (ida_major > 6)

#logger = jayutils.configLogger('shellcode_hash', logging.DEBUG)
logger = jayutils.configLogger('shellcode_hash', logging.INFO)

class RejectionException(Exception):
    pass

############################################################
# SQL queries
############################################################

sql_lookup_hash_value='''
select
    h.hash_val, 
    h.symbol_name, 
    l.lib_name, 
    t.hash_name, 
    t.hash_size
예제 #10
0
def main():
    logger = jayutils.configLogger('', logging.DEBUG)
    #logger = jayutils.configLogger('', logging.INFO)
    launcher = ApplyCalleeTypeRunner()
    launcher.run()
예제 #11
0
def main():
    global logger
    #logger = jayutils.configLogger(__name__, logging.DEBUG)
    logger = jayutils.configLogger(__name__, logging.INFO)
    launcher = StructTypeRunner()
    launcher.run()
예제 #12
0
def main():
    logger = jayutils.configLogger('', logging.DEBUG)
    #logger = jayutils.configLogger('', logging.INFO)
    launcher = ApplyCalleeTypeRunner()
    launcher.run()
예제 #13
0
def main():
    #logger = jayutils.configLogger('', logging.DEBUG)
    logger = jayutils.configLogger('', logging.INFO)
    launcher = StructTypeRunner()
    launcher.run()
예제 #14
0
def main():
    #logger = jayutils.configLogger('', logging.DEBUG)
    logger = jayutils.configLogger('', logging.INFO)
    launcher = SearchLauncher()
    launcher.run()
예제 #15
0
def main():
    global logger
    #logger = jayutils.configLogger(__name__, logging.DEBUG)
    logger = jayutils.configLogger(__name__, logging.INFO)
    launcher = StructTypeRunner()
    launcher.run()