Skip to content

Commit

Permalink
Added bin scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrp committed Feb 18, 2015
1 parent e9bd5be commit d95f099
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
37 changes: 37 additions & 0 deletions bin/maraithal
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function
from maraithal.lsbstegano import LSBStegano
import argparse
from getpass import getpass
try:
raw_input
except NameError:
raw_input = input

def main():
"""
Main function for app
"""
parser = argparse.ArgumentParser()
parser.add_argument('mode', help='enc or dec to encode or decode text respectively')
parser.add_argument('image', help='Path to PNG image to be used')
parser.add_argument('--message-file', help='File to read text from')
parser.add_argument('--passphrase', help='Passphrase to use while encoding or decoding')
args = parser.parse_args()

if args.mode == 'enc':
lsb = LSBStegano(args.image)
key = args.passphrase if args.passphrase else getpass()
print('Message:', end='')
text = raw_input()
lsb.text_encode(text, key)
elif args.mode == 'dec':
lsb = LSBStegano(args.image)
key = args.passphrase if args.passphrase else getpass()
print(lsb.text_decode(key))

if __name__ == '__main__':
main()

27 changes: 1 addition & 26 deletions maraithal/lsbstegano.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
from __future__ import print_function
from PIL import Image
import random
import argparse

try:
from itertools import izip
except ImportError:
izip = zip
raw_input = input
from getpass import getpass

class LSBStegano(object):
"""
Expand Down Expand Up @@ -112,27 +111,3 @@ def text_decode(self, key, mode=C_RED):
return res
i += 1

def main():
"""
Main function for app
"""
parser = argparse.ArgumentParser()
parser.add_argument('mode', help='enc or dec to encode or decode text respectively')
parser.add_argument('image', help='Path to PNG image to be used')
parser.add_argument('--message-file', help='File to read text from')
parser.add_argument('--passphrase', help='Passphrase to use while encoding or decoding')
args = parser.parse_args()

if args.mode == 'enc':
lsb = LSBStegano(args.image)
key = args.passphrase if args.passphrase else getpass()
print('Message:', end='')
text = raw_input()
lsb.text_encode(text, key)
elif args.mode == 'dec':
lsb = LSBStegano(args.image)
key = args.passphrase if args.passphrase else getpass()
print(lsb.text_decode(key))

if __name__ == '__main__':
main()
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
'url': 'https://github.com/rkrp/maraithal',
'download_url': 'https://github.com/rkrp/maraithal',
'author_email': '[email protected]',
'version': '0.4',
'version': '0.5',
'install_requires': ['pillow'],
'packages': ['maraithal'],
'scripts': [],
'scripts': ['bin/maraithal'],
'name': 'maraithal',
'license' : 'GPLv3',
# 'classifiers' : {
Expand Down
Binary file modified tests/test.enc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d95f099

Please sign in to comment.