def getfingerprints(responses):
    import logging
    from regen import generateregex
    log = logging.getLogger('getfingerprints')
    totags = list()
    statichashes = list()
    for response in responses:
        response = getheader(response)
        dyn = getdynamic(response)
        staticbuff = getstatic(response, dyn)
        _tmp = hashstatic(staticbuff)
        if _tmp not in statichashes:
            statichashes.append(_tmp)
        else:
            log.debug('Already have this static hash')
        if dyn.has_key('to'):
            if dyn['to'].has_key('tag'):
                log.debug("got to tag:%s" % dyn['to']['tag'])
                totags.append(dyn['to']['tag'])
    if len(statichashes) < 1:
        log.warn("no static hash found")
        return
    if len(totags) < 1:
        log.warn("no dynamic tags were found")
        totagregex = None
    else:
        log.debug("Unique to tags: %s" % ','.join(set(totags)))
        totagregex = generateregex(totags)
    if len(statichashes) > 1:
        log.warn("Static hashes are not so static")
        log.info("static hashes: %s" % statichashes)
    return (totagregex, statichashes)
Exemplo n.º 2
0
def getfingerprints(responses):
    import logging
    from regen import generateregex
    log = logging.getLogger('getfingerprints')
    totags = list()
    statichashes = list()
    for response in responses:
        response = getheader(response)
        dyn = getdynamic(response)
        staticbuff = getstatic(response,dyn)
        _tmp = hashstatic(staticbuff)
        if _tmp not in statichashes:
            statichashes.append(_tmp)
        else:
            log.debug('Already have this static hash')
        if dyn.has_key('to'):
            if dyn['to'].has_key('tag'):
                log.debug("got to tag:%s" % dyn['to']['tag'])
                totags.append(dyn['to']['tag'])
    if len(statichashes) < 1:
        log.warn("no static hash found")
        return
    if len(totags) < 1:
        log.warn("no dynamic tags were found")
        totagregex = None
    else:
        log.debug("Unique to tags: %s" % ','.join(set(totags)))
        totagregex = generateregex(totags)    
    if len(statichashes) > 1:
        log.warn("Static hashes are not so static")
        log.info("static hashes: %s" % statichashes)
    return(totagregex,statichashes)
Exemplo n.º 3
0
def getbestmatch(stuff):
    from regen import generateregex
    return generateregex(cleanact(stuff),groups=False)
Exemplo n.º 4
0
as14ecdccd
as265d1496
as26c2f484
as201a90c8
as166fb461
as7b3bdcea
as1a39fc3a
as494a8065
as72ec8ee9
as033518df
as428039ab
as24d181bc
as3079f6da
as0444e4cc
as75e5e132
as66515468
as5a3df9fd
as4b49c60a
as0cfbcf3a
as781231da
as2a59181b
as26c345af
as0fe9f831
as537ffa69
as13ae012e
as0c3f869a
as14650226
as58ab1e9b
as75c397e3""".splitlines()
    print generateregex(stuff)
Exemplo n.º 5
0
def getbestmatch(stuff):
    from regen import generateregex
    return generateregex(cleanact(stuff), groups=False)
Exemplo n.º 6
0
as14ecdccd
as265d1496
as26c2f484
as201a90c8
as166fb461
as7b3bdcea
as1a39fc3a
as494a8065
as72ec8ee9
as033518df
as428039ab
as24d181bc
as3079f6da
as0444e4cc
as75e5e132
as66515468
as5a3df9fd
as4b49c60a
as0cfbcf3a
as781231da
as2a59181b
as26c345af
as0fe9f831
as537ffa69
as13ae012e
as0c3f869a
as14650226
as58ab1e9b
as75c397e3""".splitlines()
    print generateregex(stuff)