README.md
1# stegify
2[![Build Status](https://travis-ci.org/DimitarPetrov/stegify.svg?branch=master)](https://travis-ci.org/DimitarPetrov/stegify)
3[![Coverage Status](https://coveralls.io/repos/github/DimitarPetrov/stegify/badge.svg?branch=master)](https://coveralls.io/github/DimitarPetrov/stegify?branch=master)
4[![GoDoc](https://godoc.org/github.com/DimitarPetrov/stegify?status.svg)](https://godoc.org/github.com/DimitarPetrov/stegify)
5[![Go Report Card](https://goreportcard.com/badge/github.com/DimitarPetrov/stegify)](https://goreportcard.com/report/github.com/DimitarPetrov/stegify)
6[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
7
8
9## Overview
10`stegify` is a simple command line tool capable of fully transparent hiding any file within an image or set of images.
11This technique is known as LSB (Least Significant Bit) [steganography](https://en.wikipedia.org/wiki/steganography)
12
13## Demonstration
14
15| Carrier | Data | Result |
16| ---------------------------------------| ------------------------------------|------------------------------------------------------|
17| ![Original File](examples/street.jpeg) | ![Data file](examples/lake.jpeg) | ![Encoded File](examples/test_decode.jpeg) |
18
19The `Result` file contains the `Data` file hidden in it. And as you can see it is fully transparent.
20
21If multiple `Carrier` files are provided, the `Data` file will be split in pieces and every piece is encoded in the respective carrier.
22
23| Carrier1 | Carrier2 | Data | Result1 | Result2 |
24| ---------------------------------------------|--------------------------------------------|--------------------------------------------|------------------------------------------------------------------|------------------------------------------------------------------|
25| <img src="examples/street.jpeg" width="500"> | <img src="examples/lake.jpeg" width="500"> | <img src="examples/video.gif" width="500"> | <img src="examples/test_multi_carrier_decode1.jpeg" width="500"> | <img src="examples/test_multi_carrier_decode2.jpeg" width="500"> |
26
27The `Result1` file contains one half of the `Data` file hidden in it and `Result2` the other. As always fully transparent.
28
29## Installation
30
31#### Installing from Source
32```
33go get -u github.com/DimitarPetrov/stegify
34```
35
36#### Installing via Homebrew (macOS)
37```
38brew tap DimitarPetrov/stegify
39brew install stegify
40```
41
42Or you can download a binary for your system [here](https://github.com/DimitarPetrov/stegify/releases).
43
44## Usage
45
46### As a command line tool
47
48#### Single carrier encoding/decoding
49```
50stegify encode --carrier <file-name> --data <file-name> --result <file-name>
51
52stegify decode --carrier <file-name> --result <file-name>
53```
54When encoding, the file with name given to flag `--data` is hidden inside the file with name given to flag
55`--carrier` and the resulting file is saved in new file in the current working directory under the
56name given to flag `--result`.
57
58> **_NOTE:_** The result file won't have any file extension and therefore it should be specified explicitly in `--result` flag.
59
60When decoding, given a file name of a carrier file with previously encoded data in it, the data is extracted
61and saved in new file in the current working directory under the name given to flag `--result`.
62
63> **_NOTE:_** The result file won't have any file extension and therefore it should be specified explicitly in `--result` flag.
64
65In both cases the flag `--result` could be omitted and default values will be used.
66
67#### Multiple carriers encoding/decoding
68
69```
70stegify encode --carriers "<file-names...>" --data <file-name> --results "<file-names...>"
71OR
72stegify encode --carrier <file-name> --carrier <file-name> ... --data <file-name> --result <file-name> --result <file-name> ...
73
74stegify decode --carriers "<file-names...>" --result <file-name>
75OR
76stegify decode --carrier <file-name> --carrier <file-name> ... --result <file-name>
77```
78When encoding a data file in more than one carriers, the data file is split in *N* chunks, where *N* is number of provided carriers.
79Each of the chunks is then encoded in the respective carrier.
80
81> **_NOTE:_** When decoding, carriers should be provided in the **exact** same order for result to be properly extracted.
82
83This kind of encoding provides one more layer of security and more flexibility regarding size limitations.
84
85In both cases the flag `--result/--results` could be omitted and default values will be used.
86
87> **_NOTE:_** When encoding the number of the result files (if provided) should be equal to the number of carrier files. When decoding, exactly one result is expected.
88
89When multiple carriers are provided with mixed kinds of flags, the names provided through `carrier` flag are taken first and with `carriers/c` flags second.
90Same goes for the `result/results` flag.
91
92
93### Programmatically in your code
94
95`stegify` can be used programmatically too and it provides easy to use functions working with file names
96or raw Readers and Writers. You can visit [godoc](https://godoc.org/github.com/DimitarPetrov/stegify) under
97`steg` package for details.
98
99## Disclaimer
100
101If carrier file is in jpeg or jpg format, after encoding the result file image will be png encoded (therefore it may be bigger in size)
102despite of file extension specified in the result flag.
103
104## Showcases
105
106### Codefest’19
107
108`stegify` was used for one of the *Capture The Flag* challenges in [**Codefest’19**](https://www.hackerrank.com/codefest19-ctf).
109
110Participants were given a photo of a bunch of "innocent" cats. Nothing suspicious right? Think again!
111
112You can read more [here](https://medium.com/bugbountywriteup/codefest19-ctf-writeups-a8f4e9b45d1) and [here](https://medium.com/@markonsecurity/image-challenges-1-cats-are-innocent-right-69cd4220bc99).
113