Exploit-DB updates

Saturday, October 8, 2011

Making command alias's to shorten long commands.

I haven't posted in a while, but I wanted to make a quick post on how to make an alias for long commands to reduce your typing. 

For example, if I often had to perform MITM attacks during assessments/pentests than I may want to make an alias for the iptables rules. To do this I can create the following alias like so;

alias sslrule='iptables -t nat -A PREROUTING -p tcp --destination-port  80 -j REDIRECT --to-ports 10000'
alias rules='echo -e "\033[1;41;1mNAT Rules";iptables -t nat -L -nv;echo -e "\033[1;44;1mPlain Rules";iptables -L -nv;echo -e "\033[0m"'

Now instead of typing out that long rule you can just type sslrule, and to see the rules in a distinctive manner I can just type rules.

Now this isn't a permanent alias, if we want to make a permanent alias than we'll need to edit our .bashrc file and add the alias there. In my case it will be located in /root/.bashrc. From there you can just append the alias's of your choice below the existing ones and you'll now have a permanent alias to save you some typing (and carpal tunnel).

No comments:

Post a Comment