Advertisement
Peaser

stegger

Aug 7th, 2014
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. import sys, compressor, os
  2.  
  3. w = """Usage:
  4.    script.py <File> <level(integer)> <Command(below)>
  5.  
  6.    Commands:
  7.        Steg_In
  8.        Steg_Out"""
  9.  
  10. try:inf,level,com=sys.argv[1],sys.argv[2],sys.argv[3]
  11. except:print w;sys.exit(0)
  12.  
  13. def Steg_In(n):
  14.     context = open(inf, 'rb').read()
  15.     indexes = [ord(i) for i in context]
  16.     mixed = [i+n for i in indexes]
  17.     new = [chr(i) for i in mixed]
  18.     with open(inf, 'wb') as end:
  19.         end.write(''.join(new))
  20.         end.close()
  21.     compressor.compress(inf, inf)
  22.  
  23. def Steg_Out(n):
  24.     compressor.decompress(inf, inf)
  25.     context = open(inf, 'rb').read()
  26.     indexes = [ord(i) for i in context]
  27.     mixed = [i-n for i in indexes]
  28.     new = [chr(i) for i in mixed]
  29.     with open(inf, 'wb') as end:
  30.         end.write(''.join(new))
  31.         end.close()
  32.  
  33. def main():
  34.     __all__ = 'Steg_In', 'Steg_Out'
  35.     if com not in __all__:print w;sys.exit(0)
  36.     if com == __all__[0]:Steg_In(int(level))
  37.     else:Steg_Out(int(level))
  38.  
  39. if __name__=="__main__":main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement