/usr/bin/stepic is in stepic 0.4.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/python3
# stepic - Python image steganography
# Copyright (C) 2007 Lenny Domnitser
# Copyright (C) 2018 Scott Kitterman
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import optparse
import sys
import traceback
from PIL import Image
import stepic
def encode_files(image_in, data_in, image_out, format):
image = Image.open(image_in)
if not hasattr(data_in, 'read'):
data_in = open(data_in, 'rb')
data = data_in.read()
if format is None and hasattr(image_out, 'write'):
format = image.format
stepic.encode_inplace(image, data)
image.save(image_out, format)
def decode_files(image_in, data_out):
image = Image.open(image_in)
if not hasattr(data_out, 'write'):
data_out = open(data_out, 'wb')
data_out.write(stepic.decode(image))
def main():
parser = optparse.OptionParser(version=stepic.__version__,
description='Hide data in an image, or read hidden data from an image')
parser.add_option('--debug', action='store_true', default=False)
parser.add_option('-d', '--decode', action='store_true', default=False,
help='given an image, write out the hidden data file')
parser.add_option('-e', '--encode', action='store_true', default=False,
help='given an image and data file, write out a new image file with the data hidden in it')
parser.add_option('-f', '--format', metavar='FORMAT',
help='output image format (optional)')
parser.add_option('-i', '--image-in=', dest='image_in', metavar='FILE', default=sys.stdin,
help='read in image FILE for decoding or encoding')
parser.add_option('-t', '--data-in=', dest='data_in', metavar='FILE', default=sys.stdin,
help='read in data FILE for encoding')
parser.add_option('-o', '--out=', dest='out', metavar='FILE', default=sys.stdout,
help='write out to FILE, data when decoding, image when encoding')
options, args = parser.parse_args()
if args:
parser.print_usage()
sys.exit(2)
if options.decode == options.encode:
parser.print_usage()
sys.stderr.write('choose either encode or decode\n')
try:
if options.decode:
decode_files(options.image_in, options.out)
elif options.encode:
encode_files(options.image_in, options.data_in, options.out, options.format)
except (TypeError, ValueError) as e:
message = 'error: ' + str(e) + '\n'
sys.stderr.write(message)
sys.exit(1)
except KeyboardInterrupt:
pass
except Exception as e:
message = e.__class__.__name__ + ': ' + str(e) + '\n'
sys.stderr.write(message)
if options.debug:
traceback.print_tb(sys.exc_traceback)
sys.exit(3)
if __name__ == '__main__':
main()
|