Handy bash command collection – Part 28534

Converting a string into a series of hex with printf

This is a handy command-line when pen-testing SQL Injection:

$ a='or 3=3; --'; for ((i=0;i<${#a};i++));do printf '%%%02X' \'${a:$i:1};done; printf '\n'


Build-in ASCII/DEC/OCT/HEX table: man ascii

Handy command-line when pen-testing SQL Injection and you are to lazy to type the command above :)

$ man ascii
Oct Dec Hex Char Oct Dec Hex Char
000 0 00 NUL '\0' 100 64 40 @
001 1 01 SOH (start of heading) 101 65 41 A
002 2 02 STX (start of text) 102 66 42 B
003 3 03 ETX (end of text) 103 67 43 C

Calculate SHA hash values of text

$ echo -n thisisaninputstring | shasum -a 256

Note: Consider avoiding to have this command stored in bash history.

Prevent commands from being logged in history

After a:

  export HISTCONTROL=ignorespace 

Any command that is preceded by a space is not stored in shell command history:

 ls test/     # ⇒ NOT stored in shell history
ls test/      # ⇒ stored in shell history

(Note: this is a short note. There is more behind command histories in Linux.)

List of available packages (Fedora)

yum list available

List of commands, aliases, keywords (Debian)

# All commands available to you
compgen -c 

# All aliases available to you
compgen -a 

# All build-ins available to you
compgen -b 

# All keywords available to you
compgen -k 

# All functions available to you
compgen -A function 

# Everything you can run
compgen -A function -abck 

Retrieving the GIT client proxy settings

When a PC is located behind a authenticating proxy, the pass-thru username and password can be retrieved from the git client:

$ git config --global --get https.proxy

$ git config --global --get http.proxy

# To set the proxy info:
$ git config --global https://proxyusername:proxypassword@proxyip:proxyport

Retrieving ….

$ git config --system --get http.sslcainfo

Note: Make sure you look your PC when AFK :)

Obtaining list of MTAs registered to domain

root@dune:~# nslookup -q=mx
Non-authoritative answer:     mail exchanger = 5     mail exchanger = 5     mail exchanger = 5     mail exchanger = 5
Authoritative answers can be found from:     nameserver =     nameserver =     nameserver =     nameserver = internet address = internet address = internet address =

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.