Example #1
0
File: covert.py Project: hanw/sonic
def generate_sequence(args):
    total_bits = args.pkt_cnt * args.multibit
    if args.input is not None:
        bits=read_binary_file(args.input, total_bits)
        return bits

    if args.message is not None:
        bs=sonic.msg_to_bits(args.message)

        bits=[]
        i=0
        while True:
            for b in bs:
                bits.append(b)
                i+= 1

                if i == total_bits:
                    return bits 

    bits=[]
    for s in range (0, total_bits):
        bits.append(random.randint(0,1))

    return bits