def cli():
    """ Command line interface """
    ch = logging.StreamHandler()
    ch.setFormatter(logging.Formatter(
        '%(asctime)s.%(msecs)03d %(levelname)s: %(message)s',
        datefmt="%Y-%m-%d %H:%M:%S"
    ))
    logger.addHandler(ch)

    import argparse
    parser = argparse.ArgumentParser(description="Search 'network' for hosts with a \
    response to 'path' that matches 'filter'")
    parser.add_argument('network', help='IP address with optional mask, e.g. 192.168.0.0/24')
    parser.add_argument('-p', '--path', help='URL path at host, e.g. index.html',
        default='')
    parser.add_argument('-f', '--filter', help='Regular expression pattern for filter',
        dest='pattern', default='')
    parser.add_argument('-l', '--log', help='Enable logging', action='store_true')
    args = parser.parse_args()
    print('Scanning, please wait ...')
    result = survey(**vars(args))
    print('Found {} match{}{}{} on {}'.format(len(result), 'es' if len(result)!=1 else '',
        ' for ' if args.pattern else '', args.pattern, args.network))
    for x in result:
        print(x.hostname)
Command line interface