FreshRSS

๐Ÿ”’
โŒ Secure Planet Training Courses Updated For 2019 - Click Here
There are new available articles, click to refresh the page.
Before yesterdayYour RSS feeds

Sttr - Cross-Platform, Cli App To Perform Various Operations On String

By: Zion3R


sttr is command line software that allows you to quickly run various transformation operations on the string.


// With input prompt
sttr

// Direct input
sttr md5 "Hello World"

// File input
sttr md5 file.text
sttr base64-encode image.jpg

// Reading from different processor like cat, curl, printf etc..
echo "Hello World" | sttr md5
cat file.txt | sttr md5

// Writing output to a file
sttr yaml-json file.yaml > file-output.json

:movie_camera: Demo

:battery: Installation

Quick install

You can run the below curl to install it somewhere in your PATH for easy use. Ideally it will be installed at ./bin folder

curl -sfL https://raw.githubusercontent.com/abhimanyu003/sttr/main/install.sh | sh

Webi

MacOS / Linux

curl -sS https://webi.sh/sttr | sh

Windows

curl.exe https://webi.ms/sttr | powershell

See here

Homebrew

If you are on macOS and using Homebrew, you can install sttr with the following:

brew tap abhimanyu003/sttr
brew install sttr

Snap

sudo snap install sttr

Arch Linux

yay -S sttr-bin

Scoop

scoop bucket add sttr https://github.com/abhimanyu003/scoop-bucket.git
scoop install sttr

Go

go install github.com/abhimanyu003/sttr@latest

Manually

Download the pre-compiled binaries from the Release! page and copy them to the desired location.

:books: Guide

  • After installation simply run sttr command.
// For interactive menu
sttr
// Provide your input
// Press two enter to open operation menu
// Press `/` to filter various operations.
// Can also press UP-Down arrows select various operations.
  • Working with help.
sttr -h

// Example
sttr zeropad -h
sttr md5 -h
  • Working with files input.
sttr {command-name} {filename}

sttr base64-encode image.jpg
sttr md5 file.txt
sttr md-html Readme.md
  • Writing output to file.
sttr yaml-json file.yaml > file-output.json
  • Taking input from other command.
curl https: //jsonplaceholder.typicode.com/users | sttr json-yaml
  • Chaining the different processor.
sttr md5 hello | sttr base64-encode

echo "Hello World" | sttr base64-encode | sttr md5

:boom: Supported Operations

Encode/Decode

  • [x] ascii85-encode - Encode your text to ascii85
  • [x] ascii85-decode - Decode your ascii85 text
  • [x] base32-decode - Decode your base32 text
  • [x] base32-encode - Encode your text to base32
  • [x] base64-decode - Decode your base64 text
  • [x] base64-encode - Encode your text to base64
  • [x] base85-encode - Encode your text to base85
  • [x] base85-decode - Decode your base85 text
  • [x] base64url-decode - Decode your base64 url
  • [x] base64url-encode - Encode your text to url
  • [x] html-decode - Unescape your HTML
  • [x] html-encode - Escape your HTML
  • [x] rot13-encode - Encode your text to ROT13
  • [x] url-decode - Decode URL entities
  • [x] url-encode - Encode URL entities

Hash

  • [x] bcrypt - Get the Bcrypt hash of your text
  • [x] md5 - Get the MD5 checksum of your text
  • [x] sha1 - Get the SHA1 checksum of your text
  • [x] sha256 - Get the SHA256 checksum of your text
  • [x] sha512 - Get the SHA512 checksum of your text

String

  • [x] camel - Transform your text to CamelCase
  • [x] kebab - Transform your text to kebab-case
  • [x] lower - Transform your text to lower case
  • [x] reverse - Reverse Text ( txeT esreveR )
  • [x] slug - Transform your text to slug-case
  • [x] snake - Transform your text to snake_case
  • [x] title - Transform your text to Title Case
  • [x] upper - Transform your text to UPPER CASE

Lines

  • [x] count-lines - Count the number of lines in your text
  • [x] reverse-lines - Reverse lines
  • [x] shuffle-lines - Shuffle lines randomly
  • [x] sort-lines - Sort lines alphabetically
  • [x] unique-lines - Get unique lines from list

Spaces

  • [x] remove-spaces - Remove all spaces + new lines
  • [x] remove-newlines - Remove all new lines

Count

  • [x] count-chars - Find the length of your text (including spaces)
  • [x] count-lines - Count the number of lines in your text
  • [x] count-words - Count the number of words in your text

RGB/Hex

  • [x] hex-rgb - Convert a #hex-color code to RGB
  • [x] hex-encode - Encode your text Hex
  • [x] hex-decode - Convert Hexadecimal to String

JSON

  • [x] json - Format your text as JSON
  • [x] json-escape - JSON Escape
  • [x] json-unescape - JSON Unescape
  • [x] json-yaml - Convert JSON to YAML text
  • [x] json-msgpack - Convert JSON to MSGPACK
  • [x] msgpack-json - Convert MSGPACK to JSON

YAML

  • [x] yaml-json - Convert YAML to JSON text

Markdown

  • [x] markdown-html - Convert Markdown to HTML

Extract

  • [x] extract-emails - Extract emails from given text
  • [x] extract-ip - Extract IPv4 and IPv6 from your text
  • [x] extract-urls - Extract URls your text ( we don't do ping check )

Other

  • [x] escape-quotes - escape single and double quotes from your text
  • [x] completion - generate the autocompletion script for the specified shell
  • [x] interactive - Use sttr in interactive mode
  • [x] version - Print the version of sttr
  • [x] zeropad - Pad a number with zeros
  • [x] and adding more....

Featured On

These are the few locations where sttr was highlighted, many thanks to all of you. Please feel free to add any blogs/videos you may have made that discuss sttr to the list.



Wa-Tunnel - Tunneling Internet Traffic Over Whatsapp


This is a Baileys based piece of code that lets you tunnel TCP data through two Whatsapp accounts.

This can be usable in different situations, for example network carriers that give unlimited whatsapp data or airplanes where you also get unlimited social network data.

It's using Baileys since it's a WS based multi-device whatsapp library and therefore could be used in android in the future, using Termux for example.

The idea is to use it with a proxy setup on the server like this: [Client (restricted access) -> Whatsapp -> Server -> Proxy -> Internet]

Apologizes in advance since Javascript it's not one of my primary coding languages :/

Use only for educational purpose.


How does it work?

It sends TCP network packages through WhatsApp text and file messages, depending on the amount of characters it splits them into different text messages or files.

To not get timed out by WhatsApp by default it's limited at 20k characters per message, at the moment it's hardcoded in wasocket.js. I have done multiple tests and anything below that may get you banned for sending too many messages and any above 80k may timeout.

If a network package is over the limit (20k chars by default) it will be sent as a file if enabled. Also if multiple network packages are cached it will use the same cryteria.

File messages are sent as binary files, TCP responses are concatenated with a delimiter and compressed using brotli to reduce data usage.

It caches TCP socket responses to group them and send the maximum amount of data in a message therefore reducing the amount of messages, improving the speed and reducing the probability of getting banned.

Performance improvements

Before: (without files and no response caching)

curl -x localhost:12345 https://www.youtube.com
- 50-80 messages
- 30-40 seconds

After: (with files and response caching)

curl -x localhost:12345 https://www.youtube.com
- 6-8 messages
- 7-15 seconds

In case you are not allowed to send files use the --disable-files flag when starting the server and client to disable this functionality.

Why?

I got the idea While travelling through South America network data on carriers is usually restricted to not many GBs but WhatsApp is usually unlimited, I tried to create this library since I didn't find any usable at the date.

Setup

You must have access to two Whatsapp accounts, one for the server and one for the client. You can forward a local port or use an external proxy.

Server side

Clone the repository on your server and install node dependencies.

  1. cd path/to/wa-tunnel
  2. npm install

Then you can start the server with the following command where port is the proxy port and host is the proxy host you want to forward. And number is the client WhatsApp number with the country code alltogether and without +.

npm run server host port number

You can use a local proxy server like follows:

npm run server localhost 3128 12345678901

Or you can use a normal proxy server like follows:

npm run server 192.168.0.1 3128 12345678901

Client Side

Clone the repository on your server and install node dependencies.

  1. cd path/to/wa-tunnel
  2. npm install

Then you can start the server with the following command where port is the local port where you will connect and number is the server WhatsApp number with the country code alltogether and without +.

npm run client port number

For example

npm run client 8080 1234567890

Usage

The first time you open the script Baileys will ask you to scan the QR code with the whatsapp app, after that the session is saved for later usage.

It may crash, that's normal after that just restart the script and you will have your client/server ready!

Once you have both client and server ready you can test using curl and see the magic happen.

curl -v -x proxyHost:proxyPort https://httpbin.org/ip

With the example commands would be:

curl -v -x localhost:8080 https://httpbin.org/ip

It has been tested also with a normal browser like Firefox, it's slow but can be used.

You can also forward other protocol ports like SSH by setting up the server like this:

npm run server localhost 22 12345678901

And then connect to the server by using in the client:

ssh root@localhost -p 8080

Usage on Android

To use on Android, you can use it with Termux using the following commands:

pkg update && pkg upgrade
pkg install git nodejs -y
git clone https://github.com/aleixrodriala/wa-tunnel.git
cd wa-tunnel
npm install

Disclaimer

Using this library may get your WhatsApp account banned, use with a temporary number or at your own risk.

TO-DO

  • Make an Android script to install node dependencies on termux
  • When Baileys supports calls, implement package sending through calls
  • Implement sending files for big data packages to reduce messages and maybe improve speed
  • Cache socket responses to reduce even further the amount of messages sent
  • Documentation

License

MIT



โŒ