Пример #1
0
def activeEventsTable(action):
    findActiveEvents = event._event().getAsClass(
        sessionData=api.g.sessionData,
        query={"expiryTime": {
            "$gt": time.time()
        }})
    total = len(findActiveEvents)
    columns = ["id", "Title", "Score"]
    table = ui.table(columns, total, total)
    if action == "build":
        return table.getColumns(), 200
    elif action == "poll":
        # Custom table data so it can be vertical
        data = []
        for activeEvent in findActiveEvents:
            data.append([
                ui.safe(activeEvent._id),
                ui.dictTable(activeEvent.eventTitle),
                ui.dictTable(activeEvent.score)
            ])
        table.data = data
        return {
            "draw": int(jimi.api.request.args.get('draw')),
            "recordsTable": 0,
            "recordsFiltered": 0,
            "recordsTotal": 0,
            "data": data
        }, 200
Пример #2
0
def tableScansDomains(action):
    scans = inga._inga().getAsClass(sessionData=api.g.sessionData,query={})
    columns = [ "Domain Name", "IP", "Scan Name" ]
    table = ui.table(columns,0,0)
    if action == "build":
        return table.getColumns() ,200
    elif action == "poll":
        data = []
        for scan in scans:
            for domain in scan.domains:
                data.append([ui.safe(domain["domain"]),ui.safe(domain["ip"]),ui.safe(scan.scanName)])
        total = len(data)
        start = int(jimi.api.request.args.get('start'))
        if start + 200 > len(data):
            data = data[start:]
        else:
            data = data[start:start+200]
        return { "draw" : int(jimi.api.request.args.get('draw')), "recordsTable" : len(data), "recordsFiltered" : total, "recordsTotal" : total, "data" : data } ,200
Пример #3
0
def singleAssetTableFields(assetID, action):
    assetObject = asset._asset().getAsClass(sessionData=api.g.sessionData,
                                            id=assetID)[0]
    total = len(assetObject.fields)
    columns = ["Field", "Value"]
    table = ui.table(columns, total, total)
    if action == "build":
        return table.getColumns(), 200
    elif action == "poll":
        # Custom table data so it can be vertical
        data = []
        for k, v in assetObject.fields.items():
            data.append([ui.safe(k), ui.safe(v)])
        table.data = data
        return {
            "draw": int(jimi.api.request.args.get('draw')),
            "recordsTable": 0,
            "recordsFiltered": 0,
            "recordsTotal": 0,
            "data": data
        }, 200
Пример #4
0
def tableScans(action):
    scans = inga._inga().groupby(sessionData=api.g.sessionData,field="scanName")
    total = len(scans)
    columns = [ "Scan Name", "Total Hosts" ]
    table = ui.table(columns,total,total)
    if action == "build":
        return table.getColumns() ,200
    elif action == "poll":
        # Custom table data so it can be vertical
        data = []
        for source in scans:
            data.append(["<a href=\"{0}{1}/\">{2}</a>".format("scan/",source["_id"],ui.safe(source["_id"])),ui.safe(source["_count"])])
        table.data = data
        return { "draw" : int(jimi.api.request.args.get('draw')), "recordsTable" : total, "recordsFiltered" : total, "recordsTotal" : total, "data" : data } ,200
Пример #5
0
def uiSafe(value):
    return ui.safe(value)