#!/usr/bin/env python
"""
$Id$
cloak.py - Simple file encryption/compression utility
Copyright (c) 2006-2010 sqlmap developers (http://sqlmap.sourceforge.net/)
See the file 'doc/COPYING' for copying permission
"""
import bz2
import os
import sys
from optparse import OptionError
from optparse import OptionParser
def hideAscii(data):
retVal = ""
for i in xrange(len(data)):
if ord(data[i]) < 128:
retVal += chr(ord(data[i]) ^ 127)
else:
retVal += data[i]
return retVal
def cloak(inputFile):
f = open(inputFile, 'rb')
data = bz2.compress(f.read())
f.close()
return hideAscii(data)
def decloak(inputFile):
f = open(inputFile, 'rb')
data = bz2.decompress(hideAscii(f.read()))
f.close()
return data
def main():
usage = '%s [-d] -i [-o