1
0
Fork 0
mirror of https://github.com/dirtbags/moth.git synced 2025-01-09 05:20:54 -07:00
moth/packages/sequence/1000/.create.py
2011-02-23 17:29:34 -07:00

24 lines
385 B
Python
Executable file

#! /usr/bin/python
import struct
import random
import sys
def packet(seq, txt):
return struct.pack('!HB', seq, len(txt)) + txt
key = open("key").read().strip()
i = 0
seq = 83
packets = []
while i < len(key):
l = random.randrange(5)+1
p = packet(seq, key[i:i+l])
packets.append(p)
i += l
seq += 1
random.shuffle(packets)
sys.stdout.write(''.join(packets))