Giter VIP home page Giter VIP logo

stegage's Introduction

stegage

Go Reference Test Build Go Report Card GitHub Release GitHub Release

stegage is a command line tool and Go library to both encrypt (with age) and conceal (with steganography) a file.

Original image Encoded image with the encrypted file inside
Original File Encoded File

How it works

encode

stegage encrypts a file (f.ex. doc.txt) with a passphrase and embeds the encrypted file inside an image (f.ex. stegage.jpeg. The resulting image stegage_encoded.png is visually identical to the original image stegage.jpeg.

┌────────────┐              ┌────────────┐
│    doc.txt │    encrypt   │ doc.txt.enc│
│            ├─────────────►│            ├────┐
│            │              │            │    │          ┌─────────────────────────────────┐
│            │              │            │    │          │              stegage_encoded.png│
└────────────┘              └────────────┘    │  stegano │                                 │
                                              │  graphy  │                                 │
          ┌─────────────────────────────────┐ ├─────────►│   ┌────────────┐                │
          │                    stegage.jpeg │ │          │   │ doc.txt.enc│                │
          │                                 │ │          │   │            │                │
          │                                 │ │          │   │            │                │
          │                                 │ │          │   │            │                │
          │                                 │ │          │   └────────────┘                │
          │                                 ├─┘          │                                 │
          │                                 │            └─────────────────────────────────┘
          │                                 │
          │                                 │
          │                                 │
          └─────────────────────────────────┘

The supported image formats for embedding are jpeg and png. The resulting image format is always png.

decode

stegage extracts the encrypted file from the embedding image and decrypts it.

┌─────────────────────────────────┐
│              stegage_encoded.png│
│                                 │                 ┌────────────┐            ┌────────────┐
│                                 │                 │ doc.txt.enc│            │    doc.txt │
│   ┌────────────┐                │  steganography  │            │  decrypt   │            │
│   │ doc.txt.enc│                ├────────────────►│            ├───────────►│            │
│   │            │                │                 │            │            │            │
│   │            │                │                 └────────────┘            └────────────┘
│   │            │                │
│   └────────────┘                │
│                                 │
└─────────────────────────────────┘

Usage

encode

Encrypt the file doc.txt and embed the encrypted payload in a copy of stegage.png. Save the copy to the file stegage_encoded.png.

⤷ stegage encode --inside stegage.png doc.txt > stegage_encoded.png 
Enter passphrase:
Confirm passphrase:

decode

Extract the encrypted payload from the file stegage_encoded.png and decrypt it. Save the decrypted payload to the file doc.txt

⤷ stegage decode stegage_encoded.png >  doc.txt
Enter passphrase:

Installation

Official binary Releases

You can download the latest release versions of stegage from the stegage release page.

Build from source

If your system has Go 1.17+:

go install github.com/revelaction/stegage/[email protected]

Library Usage

encode

// error handling omitted for brevity. See ./cmd/stegage/main.go for a real example
image, _ := os.Open(image.png) 

passphrase:= strings.NewReader("aj4@7%8821vja")
data, _ := os.Open("doc.txt")

out, _ := os.Create("encoded.png") 

err := stegage.Encode(passphrase, data, image, out); err != nil {
	fmt.Printf("stegage: error encoding: %v", err)
}

decode

imageEncoded, _ := os.Open(image_encoded.png)
passphrase := strings.NewReader("aj4@7%8821vja")
out, _ := os.Create("doc.txt") 

err := stegage.Decode(passphrase, imageEncoded, out); err != nil {
	fmt.Printf("stegage: error decoding: %v", err)
}

Bash Completion

stegage has builtin bash autocompletion. You can enable it by putting the following bash snippet in your .bashrc file:

if hash stegage; then
	PROG=stegage source <(stegage bash)
fi

Command line options

⤷ stegage help
NAME:
   stegage - encrypt and conceal (steganography) a file

USAGE:
   stegage [global options] command [command options] [arguments...]

COMMANDS:
   encode, e  Encrypt a file with age and additionally conceal with steganography
   decode, d  Decrypt an age encrypted file inside of an image file
   bash       Dump bash complete script
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help (default: false)

stegage's People

Contributors

revelaction avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.