from lib import pcap

if __name__ == '__main__':
    '''
    This acted as testing file
    '''
    print("---------------------")
    pcap.dump("./feeds/isp001/isp001_cli002.pcap")
    print("---------------------")
    pcap.dump("./feeds/cli002/cli002_ser001.pcap")
Exemple #2
0
            digestmod = 'sha256'
        elif key['type'] in ['hmac_sha256', 'hmac_sha1', 'hmac_md5']:
            fid = bytes.fromhex(key['feed_id'])
            digestmod = key['type'][5:]
            signer = crypto.HMAC(digestmod, bytes.fromhex(key['private']))
        return fid, signer, digestmod

    parser = argparse.ArgumentParser(description='BACnet feed tool')
    parser.add_argument('--keyfile')
    parser.add_argument('pcapfile', metavar='PCAPFILE')
    parser.add_argument('CMD', choices=['create', 'dump', 'append', 'check'])

    args = parser.parse_args()

    if args.CMD == 'dump':
        pcap.dump(args.pcapfile)

    elif args.CMD in ['create', 'append']:
        if args.keyfile == None:
            print("missing keyfile parameter")
            sys.exit()
        fid, signer, digestmod = load_keyfile(args.keyfile)

        if args.CMD == 'create':
            try:
                os.remove(args.pcapfile)
            except:
                pass
            feed = FEED(args.pcapfile, fid, signer, True, digestmod=digestmod)
        else:
            feed = FEED(args.pcapfile, fid, signer, digestmod=digestmod)
Exemple #3
0
            send_request(request)
        else:
            print('')
        time.sleep(delay)

        input = 'refresh'
        logging.info(f'Input:{input}, delay:{delay}')
        request = handle_input(input)
        if request != None:
            read_request()
            send_request(request)
        else:
            print('')
        time.sleep(delay)

    #starts watchdog with the to be called method
    start_watchdog(r)

    logging.info('dumping feed...')
    pcap.dump(client_log)
    print('------------------------------')
    pcap.dump(isp_log)
    print('------------------------------')

    for s in c_server_dict.values():
        pcap.dump(s.c_s_feed)
        print('------------------------------')

        pcap.dump(s.s_c_feed)
        print('------------------------------')
Exemple #4
0
import impexp
import lib.pcap as pcap
try:
    print("eigene DB")
    pcap.dump("test.pcap")
except Exception as e:
    print(e)
try:
    print("eigener Payload")
    pcap.dump("payload.pcap")
except Exception as e:
    print(e)
try:
    print("peer Payload")
    pcap.dump("peerPayload.pcap")
except Exception as e:
    print(e)