mirror of https://github.com/dirtbags/moth.git
34 lines
657 B
Plaintext
34 lines
657 B
Plaintext
|
#! /usr/bin/python
|
||
|
|
||
|
import sys
|
||
|
import os
|
||
|
import gzip
|
||
|
import md5
|
||
|
|
||
|
partlen = 8
|
||
|
|
||
|
key = sys.stdin.read().strip()
|
||
|
hexofkey = key.encode('hex')
|
||
|
|
||
|
garbage = os.fdopen(3).read()
|
||
|
|
||
|
keyparts = []
|
||
|
for i in range(0, len(hexofkey), partlen):
|
||
|
part = hexofkey[i:i+partlen]
|
||
|
keyparts.append(part)
|
||
|
|
||
|
textpartlen = len(garbage) / len(keyparts)
|
||
|
for i in range(len(keyparts)):
|
||
|
offset = i*textpartlen
|
||
|
if i == len(keyparts) - 1:
|
||
|
textpart = garbage[offset:]
|
||
|
else:
|
||
|
textpart = garbage[offset:offset+textpartlen]
|
||
|
|
||
|
fn = keyparts[i] + '.txt'
|
||
|
gf = gzip.GzipFile(filename=fn, mode='ab', fileobj=sys.stdout)
|
||
|
gf.write(textpart)
|
||
|
gf.close()
|
||
|
|
||
|
|