Git Product home page Git Product logo

kurolabs / stegcloak Goto Github PK

View Code? Open in Web Editor NEW
3.2K 41.0 196.0 5.65 MB

Hide secrets with invisible characters in plain text securely using passwords 🧙🏻‍♂️⭐

Home Page: https://stegcloak.surge.sh

License: Other

JavaScript 100.00%
cryptography steganography compression functional-programming ramdajs hacking-tool security hacking javascript privacy security-tools stego cipher infosec hacking-tools data-exfiltration

stegcloak's Introduction


StegCloak

StegCloak

The Cloak of Invisibility for your texts

StegCloak is a pure JavaScript steganography module designed in functional programming style, to hide secrets inside text by compressing and encrypting the secret before cloaking it with special unicode invisible characters. It can be used to safely watermark strings, invisible scripts on webpages, texts on social media or for any other covert communication. Completely invisible! See how it works in-depth in this Medium article or watch our demo to know what it does.

JavaScript Standard Style

Features

  • Protect your invisible secret using passwords and HMAC integrity
  • Cryptographically secure by encrypting the invisible secret using AES-256-CTR.
  • Uses 6 Invisible characters in unicode characters that works everywhere in the web - Tweets, Gmail, WhatsApp, Telegram, Instagram, Facebook, and many more!
  • Maximum Compression to reduce the payload (LZ, Huffman).
  • Completely invisible, uses Zero Width Characters instead of white spaces or tabs.
  • Super fast! Hides the Wikipedia page-source for steganography (800 lines and 205362 characters) within a covertext of 3 words in under one second.
  • Hiding files in strings can be achieved by uploading the file to cloud and stegcloaking the link in the string
  • Written in pure functional style.
  • Usage - Available as an API module, a CLI and also a Web Interface (optimized with web workers).

StegCloak Demo

Installing

Using npm,

$ npm install -g stegcloak

Using npm (to use it locally in your program),

$ npm install stegcloak

How it works

CLI Usage

Hide

$ stegcloak hide

Options:

  hide [options] [secret] [cover]

  -fc, --fcover <file>      Extract cover text from file
  -fs, --fsecret <file>     Extract secret text from file
  -n, --nocrypt             If you don't need encryption (default: false)
  -i, --integrity           If additional security of preventing tampering is needed (default: false)
  -o, --output <output>     Stream the results to an output file
  -c, --config <file>       Config file
  -h, --help                display help for command

Reveal

$ stegcloak reveal       

Options:

  reveal [message]

  -f, --file <file>       Extract message from file
  -cp, --clip             Copy message directly from clipboard
  -o, --output <output>   Stream the secret to an output file
  -c, --config <file>     Config file
  -h, --help              display help for command

Additional support

  • STEGCLOAK_PASSWORD environment variable, if set, will be used by default as password.

  • Configuration file support to configure StegCloak CLI and to avoid prompts. Read the config docs here.

API Usage

const StegCloak = require('stegcloak');

const stegcloak = new StegCloak(true, false);  // Initializes with encryption true and hmac false for hiding

// These arguments are used only during hide

// Can be changed later by switching boolean flags for stegcloak.encrypt and stegcloak.integrity
What's HMAC and do I need it?

HMAC is an additional fingerprint security step taken towards tampering of texts and to verify if the message received was actually sent by the intended sender. If the data is sent through WhatsApp, Messenger or any social media platform, this is already taken care of! However, if you are using StegCloak in your program to safely transmit and retrieve, this option can be enabled and StegCloak takes care of it.

Hide

stegcloak.hide(secret, password, cover) -> string
const magic = stegcloak.hide("Voldemort is back", "mischief managed", "The WiFi's not working here!");

// Uses stegcloak.encrypt and stegcloak.integrity booleans for obfuscation

console.log(magic);  // The WiFi's not working here!

Reveal

stegcloak.reveal(data, password) -> string
const secret = stegcloak.reveal(magic, "mischief managed");

// Automatically detects if encryption or integrity checks were done during hide and acts accordingly

console.log(secret); // Voldemort is back

This amazing blog by Francesco Soncina shows how you could use the StegCloak API to watermark any text on your website.

Important

StegCloak doesn't solve the Alice-Bob-Warden problem, it's powerful only when people are not looking for it and it helps you achieve that really well, given its invisible properties around the web! It could be safely used for watermarking in forums, invisible tweets, social media etc. Please don't use it when you know there's someone who is actively sniffing your data - looking at the unicode characters through a data analysis tool. In that case, even though the secret encoded cannot be deciphered, the fact lies that the Warden (middle-man) knows some secret communication took place, because he would have noticed an unusual amount of special invisible characters.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT - Copyright (c) 2020 Jyothishmathi CV, Kandavel A, Mohanasundar M

Acknowledgements

The StegCloak logo was designed by Smashicons.

stegcloak's People

Contributors

0xflotus avatar ak5123 avatar dependabot[bot] avatar gsimone avatar jyothishmathicv avatar lcotonea avatar nandahkrishna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stegcloak's Issues

Problem with Hide stegcloak

When I try to get the content from the out.txt file, then python does not want to perceive the content normally. For generate random text i use lorem_text.
In file:
Veniam adipisci tempora explicabo natus atque eius architecto dignissimos, praesentium ad odio eligendi eum voluptate vero alias id?
In console:
Veniam ⁡‍‌‍⁤⁡⁡⁡‌⁡⁢⁡‌‍⁣⁣⁣⁢⁡‍⁣‍⁡⁢‍‍⁡⁤‌‍‍⁢⁡‌⁡‌⁤⁡⁡adipisci tempora explicabo natus atque eius architecto dignissimos, praesentium ad odio eligendi eum voluptate vero alias id?
How I can get the text in normal form?

Broken decipher

Given the secret "Hello" and a password 123 and a text tO cloak into as 'Ggygvh ⁢‍⁢‌⁡⁢⁡‌⁣⁣‍⁤⁢⁢⁢‌‍⁢⁡‌⁢‍⁢⁡‍⁡⁣⁡⁢‌‍‌⁢⁢‌⁢⁤⁢⁤⁢‌⁢‌‌‌⁢⁡‌hhhggcgh higfgh', the decipher of it yields broken result of the secret being 'HelbW'
Screenshot_20201101-124442

doesn't work on Android

I tried 3 different browsers on android
Chrome - version 55.0.2883.91
Link Bubble - version 1.9.58
Tet Aide - version 9.0 beta 3a
on all 3 the "your secret" box never changes. It just remains /secret/.
What is the problem? If it's just javascript it shouldn't be that different from one device (or version) to another, should it?

Flow diagram

Hello! 👋
I guess this diagram you use is from Telegram security diagram flow
FlowDiagram

And i ask if its the same here and thank you!

Add a `—config` option to the CLI tool

As discussed in #8, we should add a --config option in case people want to use StegCloak in languages other than Node - the current interactive nature of the CLI tool is a problem in those cases.

Hiding files in strings

Hiding files in strings can be achieved by uploading the file to cloud and stegcloaking the link in the string

From your readme, would it be possible to base64 the binary into a string? Perhaps this is something that could be supported?

How to check reveal failed

I use the API, even wrong password returns value but not a false or null, so I can not find a way to check failed.

RangeError: Input buffers must have the same byte length

I am getting this error:

RangeError: Input buffers must have the same byte length
    at decrypt (/home/runner/encryptstuff/node_modules/stegcloak/components/encrypt.js:41:10)
    at StegCloak.reveal (/home/runner/encryptstuff/node_modules/stegcloak/stegcloak.js:94:7)
    at /home/runner/encryptstuff/index.js:24:22
    at Layer.handle [as handle_request] (/home/runner/encryptstuff/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:137:13)
    at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
    at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
    at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
    at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)
    at next (/home/runner/encryptstuff/node_modules/express/lib/router/route.js:131:14)

Using this code to decrypt:

// Use an express route, suitable for either GET or POST 
app.all("/decrypt", (req, res) => {
	// Conbining req.query and req.body
	var body = {...req.query, ...req.body}
	// Enc is a 'new Stegcloak(true, false)'
	let decrypted = enc.reveal(body.data || body.text, body.password || body.pass);
	// Log
	console.log(decrypted)
	// Send to client
	res.json(decrypted);
})

With this form body:

// POST /decrypt
{
  "text": "Here's ⁢‍⁢⁣⁢⁢‌‍⁢‌‌‌⁢‌⁡‍‌⁡‍⁢⁢‍⁡⁢⁡‌‍⁡‌⁡⁢‌‍⁢‌‌⁡‌‍⁢‌‌‍⁢⁤‍⁢⁣‍⁢‍⁢⁢‌‌⁢‍⁡⁢⁢⁢⁡‍⁢⁢⁤‍‌‍‌⁢⁢‌‍‌⁢‍⁢⁢⁡⁣‍⁢⁣‌‍⁡⁢⁣⁢‍⁡‌⁢⁣‌‍⁤‌⁢‌‍⁤‌⁢‌⁣⁡⁢⁡⁣⁢⁢⁡⁢⁡‌⁤‍⁢‌‌⁣⁢‌ ‍⁡‍⁢⁢⁢⁡‌‍⁡‌⁢⁢⁢‌⁡‌‌⁤‌⁢⁡‍⁤‌‌‍⁢⁢⁡‍⁢⁡‍‌⁤‌‌⁢⁡⁢‌⁢⁡⁢‍⁢⁢⁡‌‍‌‍⁢⁡‍⁢⁢⁢⁡⁢‌‍⁢⁡‍⁡‌‍⁢‌‌⁡‍‌‌⁢⁡‌‌‌⁤‍⁡‌‌‍⁡‍⁢⁡‍⁡⁢‌⁢‍⁤⁤⁢⁡⁢‍‌⁢⁣⁡⁢⁡⁢⁡⁢‍⁢⁡‌‍⁡‌⁡‌‌‌⁡⁣‌⁡‌‌‌⁡⁢ ‌‍⁡⁢‌⁢⁢‍⁤‍‌⁡‌⁢⁢‍⁢‌⁢⁢‌⁢‍‌‍⁡⁢‌‌⁤⁢⁤‍⁡‌⁢‌‍⁢⁢‍‌⁡‍⁡⁢‌‌⁣‍⁤⁢‍‌‌‌‌‌⁡⁢‌‍⁢‍‌⁤⁡‌‍⁡⁣⁣⁤⁢⁡‌‍⁤⁢⁣⁢‍⁤‌‍⁢‌⁢‍⁡⁢⁢⁢⁢⁡‌⁡⁢⁣⁢⁣‌⁡‌⁢‌‌⁢‍⁡‌⁤⁡‌‌‌⁢⁤⁡‍‌⁡‌⁡⁢⁣⁣⁡‌‍‌‍ ⁡⁢‌⁢‌⁢‌⁤⁢‌⁢‍⁡⁢⁢⁢‍⁢‌⁡‌‌⁤⁣‍‌⁢⁡‌‍⁡‌⁢‍⁢⁢⁣‌‍‌‌⁡‌⁤⁢‌⁢⁢⁣⁤‌⁡‍⁡‍⁡⁣⁢⁡‌⁢⁢‍‌‌⁢‌⁣⁡‌⁡‌⁤‌⁡⁢‌⁡⁢⁡‌⁢⁣⁢⁢‌⁡⁣⁤‌⁡‍⁡⁢⁡⁢‌⁢‍⁢‌‍⁢‌‌⁤⁢⁡⁢‌⁢⁣‍⁢‌⁣⁢⁡⁢⁡‌‌‌⁡‌⁡‌‌‍‌‍⁡ ⁢‌⁢⁢⁡‌⁡⁢⁡⁢‌‌‌⁢⁡‍‌⁡⁣‍‌‌⁡‌⁢⁢‍⁡⁢‌‌‌⁡‍⁢⁡⁣⁡⁢⁢‌⁢‌⁢‍⁡⁣‍⁢‍⁡⁣‌⁤‍‌‍⁡⁢‌⁢⁢⁡‌⁢⁡⁢⁢⁡‌⁡‌⁡‍⁤⁣‌‌⁢‍⁤⁢‌⁡⁣‍⁢⁡‌‍⁡⁢⁢⁣⁢⁡‍⁢⁢⁢‌‌⁢⁢‌‍‌‌⁢⁢‍⁢‍⁡‌⁡‌⁡‌⁢⁢⁢⁢‌⁡⁢⁢‌‌‌⁣⁢ ⁢⁢⁤‌⁡⁢⁡⁢⁡‍‌⁣‌⁢‌‌⁡‍‌⁢‌⁣⁡‍⁢‍⁡⁢‌⁡‍‌⁤‍⁢‍⁤‍‌⁡⁢‌‍‌⁡‍‌⁢⁡‌‍‌⁡‌⁡‌‍⁤⁢⁤‍‌‍⁡‍‌⁢⁢⁢‌⁤⁡⁣‌⁢⁡⁢⁡‌⁣‌‍⁢‍⁢⁢⁢‌⁢‌⁢‌⁤‌⁡‌⁢‌⁣⁢‌‌‍⁢‌⁡⁣⁡‍⁢⁢‌⁤‍⁢⁡‌⁢‌⁢⁤⁡‌‌⁤⁤‌⁡⁢⁢⁢⁢ ‌‌‌⁡⁢‌‌⁢⁢⁡⁣⁣⁢‌⁡⁢⁢‌⁣‌‍⁡‍‌⁢⁤‌⁢⁣‌‍‌‌‍⁤⁤‌⁡‌‌⁢‍‌‌‌‌‌⁢⁢⁣‍⁢‌‌⁢⁡‌‍⁤‍‌‌⁤‍⁢⁣⁢‍⁤⁢⁣⁢⁡⁢‌‍‌⁡⁢‌the code!",
  "pass": "42"
}

Encrypted this:

// POST /encrypt
{
  "hide": "chrome.contextMenus.create({    id: `encrypt`,     title: `Encrypt "%s"`,    contexts: [\'selection\'],    onclick: (info) => {       const { menuItemId: id , selectionText: selected } = info;       console.log(info);       encrypt(selected).then((res) => {          prompt(_gui.encrypt, res)       });    } }, log("Created context menu"))",
  "show": "Here's the code!",
  "pass": "42"
}

Express code to encrypt:

app.all("/encrypt", (req, res) => {
	var body = {...req.query, ...req.body}
	let encrypted = enc.hide(body.secret || body.hide, body.password || body.pass, body.cover || body.show || body.text)
	res.json(encrypted);
})

Improve docs on cli usage

Logically you can figure out some of the items are different parameter sets, but the docs don't make that clear.

What does cover mean here, the key/password? I think it may be clearer to change the name. Does it work to pass a file and a secret? Probably not. Are outputs on stdout or is it mandatory to specify output?

hide [options] [secret] [cover]

-f, --file <file>       Extract input from file
-n, --nocrypt           If you don't need encryption (default: false)
-i, --integrity         If additional security of preventing tampering is needed (default: false)
-o, --output <output>   Stream the results to an output file
-h, --help              display help for command

Similar questions here, where do you pass [cover] here to decrypt the string? Options aren't stated in the same format as the previous example.

reveal [data]

-f, --file <file>       Extract input from file
-cp, --clip             Copy Data directly from clipboard
-o, --output <output>   Stream the secret to an output file
-h, --help              display help for command

Standard usage, without React

Please make normal, regular demo for people like me who are not familiar with coding, api usage, or React.
Just a standard click-to-open index.html where your excellent script works without a need for react.

extra characters in encrypted msg

I use Windows 10. and I have additional characters after the encrypting, after which it is impossible to decode.

stegcloak hide --config to_send.json

Screenshot_2
Screenshot_3

Changing the ZWC amount.

Trying to change the ZWCs and the amount of them used to three on this line here in stegcloak.js.

const zwc = ["‌", "‍", "​"]; (200c, 200d, 200b)

It looks like the shrink and expand function expect 5 and 6 characters so is there an easy way to limit it to user three or two? Thank you.

Visible Character in iOS Safari

This particular UTF Character (HEX \xe2\x81\xa4 or E281A4, HTML Entity &#x2064;) renders as a ? or a square character (depending on the font) in iOS Safari HTML page.

Tested in iPadOS 13.5.1 with Safari.

I tried to do a minimum reproducibility test and the best I could do was this https://codepen.io/daniele-pelagatti/pen/ExPbEYO in the HTML Tab, if you open it in iOS it should show the caracter. It doesn't show in the result windows through for some reason.

Clarification: are there 6 or 7 characters?

Hi guys, very cool project. I found it via your article.

In that article, you detail how you use the 6 special characters during the encoding/compression phases. But in your readme here and in your source code, you use 7 characters. The one that's left out of the article is U+2061 (Function Application). So just for clarification, is that one truly a web-safe, cross-platform invisible character? And do you use it in that second compression step to replace 2 Cs or 2 Ds?

Problems with transparent strings visible on the Windows operating system

Hello. First of all, thank you for making a nice library.
And i found one interesting thing about using this library.

I own Android, Mac and iOS and have tested the equipment.
The tests on my equipment were successful,
but some of the transparent letters were visible to window users.

스크린샷 2020-06-17 오후 5 22 20

I sent the message below to my friends who can see the transparent string,
and I received the answer below.

KakaoTalk_Photo_2020-06-17-17-22-32

so... it's looks like a U+2060 has can be seeing when the
user are have some windows machines.

I recommend deleting U+2060 to improve the completeness of this library.

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.