{"id":19289782,"url":"https://github.com/ragibson/steganography","last_synced_at":"2025-05-15T20:07:35.485Z","repository":{"id":2120878,"uuid":"43174818","full_name":"ragibson/Steganography","owner":"ragibson","description":"Least Significant Bit Steganography for bitmap images (.bmp and .png), WAV sound files, and byte sequences. Simple LSB Steganalysis (LSB extraction) for bitmap images.","archived":false,"fork":false,"pushed_at":"2024-10-09T01:36:42.000Z","size":214,"stargazers_count":616,"open_issues_count":0,"forks_count":96,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-15T20:07:08.299Z","etag":null,"topics":["bitmap","cryptography","ctf","steganalysis","steganography","wav"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ragibson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-25T20:48:45.000Z","updated_at":"2025-05-15T06:28:14.000Z","dependencies_parsed_at":"2024-06-11T00:31:07.600Z","dependency_job_id":"650e5335-3c32-48a7-abbb-05a340145b23","html_url":"https://github.com/ragibson/Steganography","commit_stats":{"total_commits":97,"total_committers":6,"mean_commits":"16.166666666666668","dds":0.5979381443298969,"last_synced_commit":"aeded05aaf8de7cbea98690e491f4bec6b23e24e"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FSteganography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FSteganography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FSteganography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ragibson%2FSteganography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ragibson","download_url":"https://codeload.github.com/ragibson/Steganography/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414501,"owners_count":22067272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitmap","cryptography","ctf","steganalysis","steganography","wav"],"created_at":"2024-11-09T22:17:03.910Z","updated_at":"2025-05-15T20:07:30.419Z","avatar_url":"https://github.com/ragibson.png","language":"Python","readme":"# Steganography\n\n![Steganography illustration](readme_illustration.png)\n\n# Table of Contents\n\n* [Installation](#installation)\n* [Byte Sequence Manipulation](#byte-sequence-manipulation)\n* [WavSteg](#wavsteg)\n* [LSBSteg](#lsbsteg)\n* [StegDetect](#stegdetect)\n\nIf you are unfamiliar with steganography techniques, I have also written a\nbasic overview of the field in\n[Steganography: Hiding Data Inside Data](https://ryanagibson.com/posts/steganography-intro/).\n\n## Installation\n\nThis project is on [PyPI](https://pypi.org/project/stego-lsb/) and can be\ninstalled with\n\n    pip install stego-lsb\n\nAlternatively, you can install it from this repository directly:\n\n    git clone https://github.com/ragibson/Steganography\n    cd Steganography\n    python3 setup.py install\n\nAfter installation, use the `stegolsb` command in the terminal or import\nfunctions from `stego_lsb` in your code.\n\n## Byte Sequence Manipulation\n\nbit_manipulation provides the ability to (quickly) interleave the bytes of a\npayload directly in the least significant bits of a carrier byte sequence.\n\nSpecifically, it contains four primary functions:\n\n    # Interleave the bytes of payload into the num_lsb LSBs of carrier.\n    lsb_interleave_bytes(carrier, payload, num_lsb, truncate=False)\n\n    # Deinterleave num_bits bits from the num_lsb LSBs of carrier.\n    lsb_deinterleave_bytes(carrier, num_bits, num_lsb)\n\n    # Runs lsb_interleave_bytes with a List[uint8] carrier.\n    lsb_interleave_list(carrier, payload, num_lsb)\n\n    # Runs lsb_deinterleave_bytes with a List[uint8] carrier.\n    lsb_deinterleave_list(carrier, num_bits, num_lsb)\n\nRunning `bit_manipulation.py`, calling its `test()` function directly, or\nrunning `stegolsb test` should produce output similar to\n\n    Testing 1.0 MB payload -\u003e 10.0 MB carrier...\n    Progress: [################################]\n    ----------------------------------------\n    | # LSBs | Encode Rate  | Decode rate  |\n    | 1      | 60.6   MB/s  | 95.9   MB/s  |\n    | 2      | 56.6   MB/s  | 52.7   MB/s  |\n    | 3      | 82.5   MB/s  | 77.4   MB/s  |\n    | 4      | 112.4  MB/s  | 105.9  MB/s  |\n    | 5      | 135.9  MB/s  | 129.8  MB/s  |\n    | 6      | 159.9  MB/s  | 152.4  MB/s  |\n    | 7      | 181.7  MB/s  | 174.6  MB/s  |\n    | 8      | 372.8  MB/s  | 1121.8 MB/s  |\n    ----------------------------------------\n\n## WavSteg\n\nWavSteg uses least significant bit steganography to hide a file in the samples\nof a .wav file.\n\nFor each sample in the audio file, we overwrite the least significant bits with\nthe data from our file.\n\n### How to use\n\nWavSteg requires Python 3\n\nRun WavSteg with the following command line arguments:\n\n    Command Line Arguments:\n     -h, --hide               To hide data in a sound file\n     -r, --recover            To recover data from a sound file\n     -i, --input TEXT         Path to a .wav file\n     -s, --secret TEXT        Path to a file to hide in the sound file\n     -o, --output TEXT        Path to an output file\n     -n, --lsb-count INTEGER  How many LSBs to use  [default: 2]\n     -b, --bytes INTEGER      How many bytes to recover from the sound file\n     --help                   Show this message and exit.\n\nExample:\n\n    $ stegolsb wavsteg -h -i sound.wav -s file.txt -o sound_steg.wav -n 1\n    # OR\n    $ stegolsb wavsteg -r -i sound_steg.wav -o output.txt -n 1 -b 1000\n\n### Hiding Data\n\nHiding data uses the arguments -h, -i, -s, -o, and -n.\n\nThe following command would hide the contents of file.txt into sound.wav and\nsave the result as sound_steg.wav. The command also outputs how many bytes have\nbeen used out of a theoretical maximum.\n\nExample:\n\n    $ stegolsb wavsteg -h -i sound.wav -s file.txt -o sound_steg.wav -n 2\n    Using 2 LSBs, we can hide 6551441 bytes\n    Files read                     in 0.01s\n    5589889 bytes hidden           in 0.24s\n    Output wav written             in 0.03s\n\nIf you attempt to hide too much data, WavSteg will print the minimum number of\nLSBs required to hide your data.\n\n### Recovering Data\n\nRecovering data uses the arguments -r, -i, -o, -n, and -b\n\nThe following command would recover the hidden data from sound_steg.wav and\nsave it as output.txt. This requires the size in bytes of the hidden data to\nbe accurate or the result may be too short or contain extraneous data.\n\nExample:\n\n    $ stegolsb wavsteg -r -i sound_steg.wav -o output.txt -n 2 -b 5589889\n    Files read                     in 0.02s\n    Recovered 5589889 bytes        in 0.18s\n    Written output file            in 0.00s\n\n## LSBSteg\n\nLSBSteg uses least significant bit steganography to hide a file in the color\ninformation of an RGB image (.bmp or .png).\n\nFor each color channel (e.g., R, G, and B) in each pixel of the image, we\noverwrite the least significant bits of the color value with the data from our\nfile. In order to make recovering this data easier, we also hide the file size\nof our input file in the first few color channels of the image.\n\n### How to use\n\nYou need Python 3 and Pillow, a fork of the Python Imaging Library (PIL).\n\nRun LSBSteg with the following command line arguments:\n\n    Command Line Arguments:\n     -h, --hide                      To hide data in an image file\n     -r, --recover                   To recover data from an image file\n     -a, --analyze                   Print how much data can be hidden within an image   [default: False]\n     -i, --input TEXT                Path to an bitmap (.bmp or .png) image\n     -s, --secret TEXT               Path to a file to hide in the image\n     -o, --output TEXT               Path to an output file\n     -n, --lsb-count INTEGER         How many LSBs to use  [default: 2]\n     -c, --compression INTEGER RANGE\n                                     1 (best speed) to 9 (smallest file size)  [default: 1]\n     --help                          Show this message and exit.\n\nExample:\n\n    $ stegolsb steglsb -a -i input_image.png -s input_file.zip -n 2\n    # OR\n    $ stegolsb steglsb -h -i input_image.png -s input_file.zip -o steg.png -n 2 -c 1\n    # OR\n    $ stegolsb steglsb -r -i steg.png -o output_file.zip -n 2\n\n### Analyzing\n\nBefore hiding data in an image, it can be useful to see how much data can be\nhidden. The following command will achieve this, producing output similar to\n\n    $ stegolsb steglsb -a -i input_image.png -s input_file.zip -n 2\n    Image resolution: (2000, 1100, 3)\n    Using 2 LSBs, we can hide:     1650000 B\n    Size of input file:            1566763 B\n    File size tag:                 3 B\n\n### Hiding Data\n\nThe following command will hide data in the input image and write the result to\nthe steganographed image, producing output similar to\n\n    $ stegolsb steglsb -h -i input_image.png -s input_file.zip -o steg.png -n 2 -c 1\n    Files read                     in 0.26s\n    1566763 bytes hidden           in 0.31s\n    Image overwritten              in 0.27s\n\n### Recovering Data\n\nThe following command will recover data from the steganographed image and write\nthe result to the output file, producing output similar to\n\n    $ stegolsb steglsb -r -i steg.png -o output_file.zip -n 2\n    Files read                     in 0.30s\n    1566763 bytes recovered        in 0.28s\n    Output file written            in 0.00s\n\n## StegDetect\n\nStegDetect provides one method for detecting simple steganography in images.\n\n### How to Use\n\nYou need Python 3 and Pillow, a fork of the Python Imaging Library (PIL).\n\nRun StegDetect with the following command line arguments:\n\n    Command Line Arguments:\n     -i, --input TEXT         Path to an image\n     -n, --lsb-count INTEGER  How many LSBs to display  [default: 2]\n     --help                   Show this message and exit.\n\n### Showing the Least Significant Bits of an Image\n\nWe sum the least significant n bits of the RGB color channels for each pixel\nand normalize the result to the range 0-255. This value is then applied to each\ncolor channel for the pixel. Where n is the number of least significant bits to\nshow, the following command will save the resulting image, appending \"_nLSBs\"\nto the file name, and will produce output similar to the following:\n\n    $ stegolsb stegdetect -i input_image.png -n 2\n    Runtime: 0.63s\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragibson%2Fsteganography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragibson%2Fsteganography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragibson%2Fsteganography/lists"}