INNER CODE UNIT · Python

getuniqueresults

idnahacks/GoodHound · goodhound/ghresults.py:55

def getuniqueresults(results):
    """This stops many paths appearing in the result from the same group which can happen. This doesn't feel like the best way of approaching this and should be looked at for improvement."""
    uniquegroupresults = []
    #sort by startnode and then risk score in order to take the top risk score result for each group with a path
    sorted_p = sorted(results, key=lambda i: (i[0], -i[5]))
    for p in sorted_p:
        startnode = p[0]
        num_members = p[1]
        percentage = p[2]
        hops = p[3]
        cost = p[4]
        riskscore = p[5]
        fullpath = p[6]
        query = p[7]
        uid = p[8]
        # check if there is already a path added for the current group and if not add it.
        if (len(uniquegroupresults)==0) or (any(startnode == ugp[0] for ugp in uniquegroupresults) != True):
            unique = [startnode, num_members, percentage, hops, cost, riskscore, fullpath, query, uid]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…