Ejemplo n.º 1
0
def main() -> None:
    """Update the flow database from Airodump CSV files"""
    parser = ArgumentParser(description=__doc__,
                            parents=[db.passive.argparser_insert])
    parser.add_argument("files",
                        nargs="*",
                        metavar="FILE",
                        help="Airodump CSV files")
    args = parser.parse_args()
    ignore_rules = _get_ignore_rules(args.ignore_spec)
    if args.test:
        function = DBPassive().insert_or_update_local_bulk
    elif (not (args.no_bulk or args.local_bulk)) or args.bulk:
        function = db.passive.insert_or_update_bulk
    elif args.local_bulk:
        function = db.passive.insert_or_update_local_bulk
    else:
        function = partial(
            DBPassive.insert_or_update_bulk,
            db.passive,
        )
    function(
        rec_iter(args.files, args.sensor, ignore_rules),
        getinfos=getinfos,
        separated_timestamps=False,
    )
Ejemplo n.º 2
0
def main() -> None:
    parser = ArgumentParser(description=__doc__,
                            parents=[db.passive.argparser_insert])
    parser.add_argument("files",
                        nargs="*",
                        metavar="FILE",
                        help="passive_recon log files")
    args = parser.parse_args()
    ignore_rules = _get_ignore_rules(args.ignore_spec)
    if args.test:
        function = DBPassive().insert_or_update_local_bulk
    elif (not (args.no_bulk or args.local_bulk)) or args.bulk:
        function = db.passive.insert_or_update_bulk
    elif args.local_bulk:
        function = db.passive.insert_or_update_local_bulk
    else:
        function = functools.partial(
            DBPassive.insert_or_update_bulk,
            db.passive,
        )
    for fdesc in args.files or [sys.stdin.buffer]:
        function(rec_iter(ZeekFile(fdesc), args.sensor, ignore_rules),
                 getinfos=getinfos)