Scroll to navigation

BASHACKS(1) User Commands BASHACKS(1)

NAME

bashacks - collection of useful bash functions for programmers

DESCRIPTION

Bashacks

Is a collection of Bash functions for UNIX systems, designed to simplify low-level
operations. Ideal for programmers, security analysts, and users seeking concise
commands, enhancing script readability and productivity.

SYNOPSIS

bashacks [OPTIONS] ARGUMENTS

OPTIONS

Display help message and exit.

Display version information and exit.

USAGE

The following Bashacks functions are available. Type the function name and press TAB
to auto-complete:
Examples of Options : bh_"TAB"
bh_asciitable     bh_cmd_sha256     bh_hex2dec        bh_rot13          bh_str2hexr
bh_asmgrep        bh_cmd_sha512     bh_hex2str        bh_rotall         bh_strxor
bh_asminfo        bh_cmd_wget       bh_hexcalc        bh_secretfile     bh_unshort
bh_bin2dec        bh_dec2asc        bh_hostcalc       bh_sharefile      bh_urldecode
bh_bin2ip         bh_dec2bin        bh_ip2bin         bh_skel_c         bh_urlencode
bh_bkp            bh_dec2hex        bh_ipinfo         bh_skel_go        bh_utf8table
bh_charcalc       bh_epoch          bh_ipisblocked    bh_skel_latex     bh_wgetr
bh_cmd_disasm     bh_findmime       bh_md5rename      bh_skel_python    bh_zerostring
bh_cmd_md5        bh_hashes         bh_myip           bh_skel_yara      bh_zipmal
bh_cmd_sed_ext    bh_hex2bin        bh_replacestring  bh_str2dec
bh_cmd_sha1       bh_rot            bh_str2hex

CONTENTS

The Bashacks pack is organized into several subcategories for
easy location of specific functions. Each subcategory addresses
a set specific functionalities. Below the main subcategories are
available.
These subcategories help organize the package's functionalities,
making it easier for users to find and use tools wanted.

Crypto

Functions related to cryptography and hash manipulation.

bh_rot - Encrypts/Decrypts a string with the Caesar Cipher using n shifts to the right.

bh_strxor - Calculates the exclusive OR of each character in a string with a key.

For more details, see: file:///usr/share/doc/bashacks-doc/html/crypto.html

Filesystem

This section generally contains functions for file manipulation.

bh_bkp - Performs a quick backup of the file using the current date.

bh_findmime - Finds files by MIME type.

bh_hashes - Generates the md5, sha1, and sha256 message digest of the file or list of files.

bh_md5rename - Converts the filename to the equivalent md5 hash.

bh_secretfile - Use it to compress and send files, automatically generating a password.

bh_sharefile - Loads a file and provides a unique URL to access it without a password.

bh_zipmal - Compresses the file in zip format with password protection. The password is "infected".

For more details, see: file:///usr/share/doc/bashacks-doc/html/filesystem.html

Math

Mathematical operations functions.

bh_bin2dec - Converts binary to decimal.

bh_charcalc - Performs operations with characters (char).

bh_dec2bin - Converts decimal to binary.

bh_dec2hex - Converts decimal to hexadecimal.

bh_hex2bin - Converts hexadecimal to binary.

bh_hex2dec - Converts hexadecimal to decimal.

bh_hexcalc - In the same way as bh_charcalc, however, works here with hexdigits.

For more details, see: file:///usr/share/doc/bashacks-doc/html/math.html

Net

Network operations and related tools.

bh_bin2ip - Convert a binary string into a network IP address.

bh_hostcalc - Enter a network CIDR mask and determine the number of hosts.

bh_ip2bin - Convert a network IP address into a binary string.

bh_ipisblocked - Checks if an IP address is blocked by several security vendors, returning [T] if positive and [F] if opposite.

bh_ipinfo - Queries ipinfo.io and returns basic information about an address.

bh_myip - Returns the external IP address of your network connection.

bh_unshort - Reveals the real URL behind shortened links.

bh_wgetr - Operates recursively, building on a previous instance of wget.

For more details, see: file:///usr/share/doc/bashacks-doc/html/net.html

Programming

Session for the creation of facilitators for development in cli

bh_skel_c - Generates on the standard output a "C" skeleton.

bh_skel_go - Generates on the standard output a "go" skeleton.

bh_skel_latex - Generates on the standard output a "LaTeX" skeleton.

bh_skel_python - Generates on the standard output a "python" skeleton.

bh_skel_yara - Generates on the standard output a "yara" skeleton.

For more details, see: file:///usr/share/doc/bashacks-doc/html/programming.html

Reversing

Reverse engineering utilities

bh_asmgrep - With the binary, attempts to find assembly instructions and prints 4 lines around.

bh_asminfo - Displays information about assembly instructions. Internet connection is required for help.

bh_replacestring - Finds and replaces occurrences of a string in the file.

bh_zerostring - Replaces occurrences with zero bytes in a block or a common file.

For more details, see: file:///usr/share/doc/bashacks-doc/html/reversing.html

String

Functions for string manipulation.

bh_asciitable - Displays the ASCII table in the terminal.

bh_dec2asc - Equivalent in ASCII for decimal numbers.

bh_epoch - Converts a Unix epoch timestamp to a human-readable date and time.

bh_hex2str - Converts one or more bytes into a hex string.

bh_str2dec - Converts one or more bytes to their decimal equivalent.

bh_str2hex - Converts a string to its hex byte equivalent for each character (hex string).

bh_str2hexr - Converts a string to its reversed hexadecimal equivalent.

bh_urldecode - Decodes strings to web standard human-readable format.

bh_urlencode - Encodes strings to web standard format.

bh_utf8table - Displays the UTF-8 table.

For more details, see: file:///usr/share/doc/bashacks-doc/html/string.html

EXAMPLES

bh_rot [int] [string]
usage:
$ bh_rot 3 terra
whuud
bh_strxor [key] [string]
usage:
$ bh_strxor 15 'hack'
gnld
bh_bkp [filename]
usage:
$ bh_bkp bashacks.sh
$ ls -1
bashacks.sh
bashacks.sh.20160122
bh_findmime -[type] [directory]
usage:
$ bh_findmime -elf /usr/bin
/usr/bin/[
/usr/bin/411toppm
bh_hashes [filename or list of files]
usage:
$ bh_hashes bashacks.sh
5dab37cac730088fd959f8292636fc9b bashacks.sh
38be74a4e710a3eeb24b4fa2015cea990d4eda67 bashacks.sh
587b713bb31e3bf32de0b734805c3dd247f49a14cd9e9a5f35008e4f620d3f82 bashacks.sh
bh_md5rename [filename or list of files]
usage:
$ touch ment.bin
$ bh_md5rename ment.bin
$ ls
d41d8cd98f00b204e9800998ecf8427e
bh_zipmal [filename]
usage:
$ bh_zipmal file.txt

adding: file.txt (deflated 69%) -rw-rw-r-- 1 user user 577 mar 29 10:43 file.zip password: infected bh_bin2dec [binary] usage: $ bh_bin2dec 1111111 bh_charcalc [char/string] [operator] [number] usage: $ bh_charcalc A + 2 C $ bh_charcalc A \* 255 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA bh_dec2bin [decimal] usage: $ bh_dec2bin 255 11111111 bh_dec2hex [decimal] $ bh_dec2hex 10 a bh_hex2dec [one or more hex digit] usage: $ bh_hex2dec A 10 bh_hexcalc [hex digit] [operator] [hex digit] usage: $ bh_hexcalc A \* 2 0xa0 bh_bin2ip [binary string] usage: $ bh_bin2ip 00001010.00001010.00000000.00000001 10.10.0.1 bh_hostcalc [network/prefix] usage: $ bh_hostcalc 192.168.1.0/24 254 bh_ipisblocked [ipaddress] usage: $ bh_ipisblocked 77.xxx.xx.xx == 77.xxx.xx.xx == [F] TALOS [F] Malc0de [F] Projecthoneypot.org [F] blocklist.de [T] Alienvault [F] SANS-TOPSOURCE bh_unshort [url] usage: $ bh_unshort https://bit.ly/3example http://websitedoctors.blogspot.com/2010/11/best-search-engine-optimization-seo.html bh_wgetr [url] usage: $ bh_wgetr http://www.mentebinaria.com.br/artigos/0x1e/0x1e-maqengrevwin.html www.mentebinaria.com.br/art 100%[==========================================>] 8.73K --.-KB/s in 0s www.mentebinaria.com.br/rob 100%[==========================================>] 361 --.-KB/s in 0s www.mentebinaria.com.br/art 100%[==========================================>] 66.18K 132KB/s in 0.5s $ ls -1 www.mentebinaria.com.br $ ls -1 www.mentebinaria.com.br/artigos/0x1e/ 0x1e-maqengrevwin.html desktop.png bh_ipinfo [ipaddress] usage: $ bh_ipinfo 8.8.8.8 {
"ip": "8.8.8.8",
"hostname": "dns.google",
"anycast": true,
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4056,-122.0775",
"org": "AS15169 Google LLC",
"postal": "94043",
"timezone": "America/Los_Angeles",
"readme": "https://ipinfo.io/missingauth" } bh_skel_c usage: $ bh_skel_c #include <stdio.h> int main(int argc, char *argv[]) {
return 0; } bh_skel_go usage: $ bh_skel_go package main import "fmt" func main() {
fmt.Println("Hello, World!") } bh_skel_latex usage: $ bh_skel_latex \documentclass{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage[margin=1in]{geometry} \author{} \title{} bh_skel_python usage: $ bh_skel_python #!/usr/bin/env python # *-* coding: utf-8 *-* if __name__ == '__main__': bh_skel_yara usage: $ bh_skel_yara rule test {
meta:
author = "username"
description = ""
date = "2026-03-29"
ref = ""
hash = ""
strings:
$a = "test" ascii wide
condition:
all of them } bh_asmgrep [asm instruction] [binary path] usage: $ bh_asmgrep mov /bin/ls 409f2e:66 90 : xchg %ax,%ax 409f30:80 7c 13 ff 2f : cmpb $0x2f,-0x1(%rbx,%rdx,1) 409f35:48 8d 42 ff : lea -0x1(%rdx),%rax 409f39:75 08 : jne 409f43 <__sprintf_chk@plt+0x7783> 409f3b:48 89 c2 : mov %rax,%rdx 409f3e:48 39 d5 : cmp %rdx,%rbp 409f41:75 ed : jne 409f30 <__sprintf_chk@plt+0x7770> 409f43:48 83 c4 08 : add $0x8,%rsp -- bh_asminfo [asm instruction] usage: $ bh_asminfo push push |Code |Mnemonic |Description | |FF /6 |PUSH r/m16 |Push r/m16 | |FF /6 |PUSH r/m32 |Push r/m32 | |50+rw |PUSH r16 |Push r16 | |50+rd |PUSH r32 |Push r32 | |6A |PUSH imm8 |Push imm8 | bh_replacestring [file] [string to search] [string to replace] usage: $ hexdump -C MB_DEV 00000690 2e 00 54 00 58 00 54 00 2e 00 00 00 73 00 77 00 |..T.X.T.....s.w.| 000006a0 e5 45 53 54 45 54 7e 31 53 57 58 20 00 65 a1 9b |.ESTET~1SWX .e..| 000006b0 8b 54 8b 54 00 00 a1 9b 8b 54 00 00 00 00 00 00 |.T.T.....T......| 000006c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00005e00 4d 65 6e 74 65 42 69 6e 61 72 69 61 0a 00 00 00 |MenteBinaria....| 00005e10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| bh_zerostring [file] [string to replace] usage: $ cp /usr/bin/true /tmp/true_test $ bh_zerostring /tmp/true_test "error" 5+0 records in 5+0 records out 5 bytes copied bh_epoch [timestamp] usage: $ bh_epoch 1743249600 sáb 29 mar 2026 09:00:00 -03 bh_dec2asc [decimal] usage: $ bh_dec2asc 65 A bh_hex2str [hex string] usage: $ bh_hex2str '72 6f 63 6b' rock bh_str2hex [-x] [-0x] [-c] [string] usage: $ bh_str2hex 'Fernando' 46 65 72 6e 61 6e 64 6f $ bh_str2hex -0x 'Fernando' 0x46 0x65 0x72 0x6e 0x61 0x6e 0x64 0x6f bh_str2hexr [string] usage: $ bh_str2hexr "hello" 6f 6c 6c 65 68 bh_urldecode [encoded string] usage: $ bh_urldecode '%2fzzz%21%40%2e%23' /zzz!@.# bh_urlencode [string] usage: $ bh_urlencode '/zzz!@.#' %2fzzz%21%40%2e%23

SEE ALSO

For more information about bashacks visit: https://github.com/merces/bashacks/tree/master/doc/source

AUTHOR

Developed by Fernando Merces <contato@mentebinaria.com.br>
This manual page was written by Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com>
for the Debian project (but may be used by others).
November 2026 bashacks 1.5