{"id":21360608,"url":"https://github.com/merces/bashacks","last_synced_at":"2025-04-12T20:42:25.070Z","repository":{"id":2554180,"uuid":"3532748","full_name":"merces/bashacks","owner":"merces","description":"A set of functions to increase productivity while hacking with Bash","archived":false,"fork":false,"pushed_at":"2024-11-28T01:55:16.000Z","size":353,"stargazers_count":198,"open_issues_count":4,"forks_count":43,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-04T00:09:17.855Z","etag":null,"topics":["bash-hacks","command-line","malware-analysis","oneliners"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merces.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-02-24T04:29:59.000Z","updated_at":"2025-03-25T12:39:25.000Z","dependencies_parsed_at":"2025-01-15T04:28:35.430Z","dependency_job_id":"7b44800b-256f-4e15-b95a-dfc6f05277ae","html_url":"https://github.com/merces/bashacks","commit_stats":{"total_commits":269,"total_committers":16,"mean_commits":16.8125,"dds":0.5018587360594795,"last_synced_commit":"b3ac4e9b3c0d077b8bcbfb6fb82055f6ea6fb457"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merces%2Fbashacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merces%2Fbashacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merces%2Fbashacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merces%2Fbashacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merces","download_url":"https://codeload.github.com/merces/bashacks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631669,"owners_count":21136554,"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":["bash-hacks","command-line","malware-analysis","oneliners"],"created_at":"2024-11-22T05:35:30.940Z","updated_at":"2025-04-12T20:42:25.041Z","avatar_url":"https://github.com/merces.png","language":"Shell","readme":"# bashacks\n\n## What?\n\nbashacks is as a collection of bash functions most likely useful for programmers, security analysts, and general users that need some low level type of operations.\n\nIn fact, there is nothing really new in bashacks as all functions are written using existing software in UNIX-like systems. However, it allows you to use shorter commands to achieve tasks that'd commonly require multiple commands.\n\n## Requirements\n\n* bash \u003e= 4\n* bc\n* binutils\n* coreutils\n* curl\n* file\n* grep\n* hexdump\n* html2text\n* perl\n* sed\n* wget\n* xxd\n* zip\n\n## Installation\n\nUse the *make* command to generate a single file containing all functions and add it to your ```/etc/bash.bashrc``` file:\n\n    make\n    make install\n\n That's all. You can now check the available functions from command line by typing *bh_* and pressing TAB.\n\n## Documentation\n\nThere's some [here](https://bashacks.readthedocs.io/), but it is outdated. PRs are welcome!\n\n## Usage\n\nWhat time is now in Epoch?\n\n    $ bh_epoch\n    1522324129\n\nAlphabetically add 4 to 'f'\n\n    $ bh_charcalc f + 4\n    j\n\nCheck my external IP address\n\n    $ bh_myip\n    177.212.113.13\n\nCreate a basic C program skeleton\n\n    $ bh_skel_c \u003e hello.c\n    $ cat hello.c\n    #include \u003cstdio.h\u003e\n\n    int main(int argc, char *argv[]) {\n\n\n        return 0;\n    }\n\nCalculate common checksums for files\n\n    $ bh_hashes /bin/ip*\n    387478f58a0669173fb6557d392a58e9 /bin/ip\n    1dd0f3b100bd6efc4664da0cdefff801d7d2efd8 /bin/ip\n    1d418ae3a767280c7fc6026a25e5bb9774c0e8afc7b3387b547765b62cbe578f /bin/ip\n    78868acd29e4a33194fb786f6589d3d1 /bin/ipcmk\n    8c22a129ff4b5748cc62222a93ba8471d7fdce19 /bin/ipcmk\n    34a068d7f85e85746b3fc98502fa96a734cc51f3a9d49cad92911e8f239bd9c9 /bin/ipcmk\n    69c2bedc20e77c039912c9d5e7af33db /bin/ipcrm\n    7992a936b28359d7f087a448d2b8a2418ef4f112 /bin/ipcrm\n    cded383eb3b74467409c1731c2804350fe3d1123bdac7304c1c6f3af9e7976f7 /bin/ipcrm\n    499f17765c0aa55ac99739c9bcac1d0c /bin/ipcs\n    c476949e77ef8710398fd8ec4f78c8cf1d76a420 /bin/ipcs\n    33c77a5b625f4de919f55dc24207645d219a2fde2e0b92be27c5cda8c662cd72 /bin/ipcs\n    6a738c5c2506f7e87c9458e0c3df378f /bin/iptables-xml\n    ba97af2e429aca6beb5a2b8861e370bbf874dee9 /bin/iptables-xml\n    cb8c10461da5247e8d6d63a123ba563df95ae1e78f29e1717eb8bb02c2ca045b /bin/iptables-xml\n\nFind files by MIME type (ignores file extension):\n\n    $ bh_findmime -elf /bin | head\n    /bin/[\n    /bin/addpart\n    /bin/appres\n    /bin/apt\n    /bin/apt-cache\n    /bin/apt-cdrom\n    /bin/apt-config\n    /bin/apt-extracttemplates\n    /bin/apt-ftparchive\n    /bin/apt-get\n\nYou could pipe the results to xargs in order to calculate checksums quickly:\n\n    $ bh_findmime -pe ~/Downloads/ | xargs shasum\n    d9e49c4209087170e36cbef689d96240d736cf3b  /Users/menteb/Downloads/CSCWCNG.dll\n    50dfeea02e89f41caf52df152c7cb923c667bffc  /Users/menteb/Downloads/Receitanet-1.10.exe\n    86a5f89d43ab11456fb817aeceb14b83cc6c2608  /Users/menteb/Downloads/Xojo2017r3Setup.exe.opdownload\n\nConvert string to hex in different output formats\n\n    $ bh_str2hex mentebinaria\n    6d 65 6e 74 65 62 69 6e 61 72 69 61\n\n    $ bh_str2hex -x mentebinaria\n    \\x6d\\x65\\x6e\\x74\\x65\\x62\\x69\\x6e\\x61\\x72\\x69\\x61\n\n    $ bh_str2hex -c mentebinaria\n    { 0x6d, 0x65, 0x6e, 0x74, 0x65, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x61 }\n\nThere is very basic error handling in bashacks. If a function does not receive the arguments it needs, it justs returns `1`.\n\nThere's much more. Install it and see for yourself. :)\n\n## Changelog\n\n### bashacks 1.5 - 2024 - soon\n\n* New name: bashacks\n* Bugs fixed.\n* New cache engine at $HOME/.bashacks/cache used by internet dependent functions like `bh_asminfo` and `bh_hashcrack`.\n* New functions:\n    * `bh_asminfo` - details an Assembly x86 instruction.\n    * `bh_epoch` - converts an Epoch date to its human-readable equivalent.\n    * `bh_findmime` - finds files by their MIME-type.\n    * `bh_hostcalc` - returns the total hosts number for an IPv4 subnet.\n    * `bh_md5rename` - renames files to their MD5 hash.\n    * `bh_sharefile` - upload a file to file.io and returns a download link that only works once.\n    * `bh_skel_c` - outputs a blank C source file skeleton.\n    * `bh_skel_python` - outputs a blank Python script skeleton.\n    * `bh_skel_yara` - outputs a simple Yara rule skeleton.\n    * `bh_str2hexr` - converts a string to its reversed hexadecimal equivalent.\n    * `bh_unshort` - gives the real URL behind shortened links.\n    * `bh_urlencode` - decodes an URL-encoded string.\n    * `bh_wgetr` -  site mirroring with random interval between resquests and custom User-Agent.\n    * `bh_zerostring` - fill a string with nullbytes in a binary file.\n    * `bh_zipmal` - zip files with 'infected' password.\n    * `bh_ipblocked` - checks if an IP address is blocked by a few security vendors.\n    * `bh_skel_latex` - outputs a LaTeX template.\n* Removed functions:\n    * `bh_intel` is not needed anymore.\n    * `bh_asc2dec` you can get the same results with `bh_str2dec`.\n    * `bh_asc2hex` result is easily achieved with `echo a | hd`.\n    * `bh_hashcrack` the service previously used went down again, and this is hard to maintain.\n\n### hack-functions 1.4 - February, 27 2012\n\n* new function: `bh_charcalc` - performs math with characters.\n* new function: `bh_intel` - set Intel syntax for disassembling.\n* new function: `bh_rotall` - simultaneous ROT for strings (thanks to @laerciomasalla for suggesting it).\n* created reference guide in Portuguese.\n* `bh_hexcalc` now supports the four basic math operations and the result is prefixed with `0x`.\n* `bh_str2hex` and `hex2str` now support the prefixes `0x`, `\\x`, with or without spaces, and C-style arrays.\n\n### hack-functions 1.2 - February, 24 2012\n\n* new functions: `bh_bin2dec` and `bh_asc2hex`.\n* added Intel syntax by default for gdb and objdump.\n* curl gets replaced by wget in `bh_unmd5`.\n* code optimization in many functions.\n\n### hack-functions 1.0 - February, 24 2012\n\n* first public release containing 20 functions.\n\n## Known Bugs\n\n### String escape\n\nIn some string functions you have to escape special characters because bash will try to\ninterpret them. See the following example using bh_strxor function:\n\n    $ bh_strxor 0x41 fernando\n    '$3/ /%.\n\n    $ bh_strxor 0x41 \"'\\$3/ /%.\" # string between double quotes and dollar sign escaped\n    fernando\n    \n### Zsh support\n\nMany bashacks functions use the word splitting feature from bash, so they don't work by default in Zsh. However, you can configure Zsh to perform word splitting with the following command:\n\n    $ setopt sh_word_split\n\nThen things should work.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerces%2Fbashacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerces%2Fbashacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerces%2Fbashacks/lists"}