Check These Out
Sometimes you need a simple server which listens on a port and prints out received data.
Example: Consider you want to know, which data is posted by a homepage to a remote script without analysing the html code! A simple way to do this is to save the page to your computer, substitude all action="address" with action="localhost:portnumber", run 'ncat -l portnumber' and open the edited page with your browser. If you then submit the form, ncat will print out the http-protocol with all the posted data.
Based on the execute with timeout command in this site.
A more complex script:
#!/bin/sh
# This script will check the avaliability of a list of NFS mount point,
# forcing a remount of those that do not respond in 5 seconds.
#
# It basically does this:
# NFSPATH=/mountpoint TIMEOUT=5; perl -e "alarm $TIMEOUT; exec @ARGV" "test -d $NFSPATH" || (umount -fl $NFSPATH; mount $NFSPATH)
#
TIMEOUT=5
SCRIPT_NAME=$(basename $0)
for i in
[email protected]; do
echo "Checking $i..."
if ! perl -e "alarm $TIMEOUT; exec @ARGV" "test -d $i" > /dev/null 2>&1; then
echo "$SCRIPT_NAME: $i is failing with retcode $?."1>&2
echo "$SCRIPT_NAME: Submmiting umount -fl $i" 1>&2
umount -fl $i;
echo "$SCRIPT_NAME: Submmiting mount $i" 1>&2
mount $i;
fi
done
Usefule to check whether SELinux is in force or disabled.
Though you need to be superuser while execute this command.
Merge all pdf files in the directory into one pdf file (the out.pdf file)
Unlike other alternatives, this command only relies on bash builtins and should also work on windows platforms with the bash executable.
Sparseness corresponds to the number 128 and can be adjusted. To print all possible digits instead of only 0 and 1 replace RANDOM%2 by RANDOM%10 or RANDOM%16 to add letters [A-F].
Removes an iptables rule created by fail2ban. This example shows how to remove a rule for an IP from the fail2ban-SSH chain. Can be used for any service monitored by fail2ban.
For more on fail2ban, see http://www.fail2ban.org/wiki/index.php/Main_Page
just a bit simpler
Edit the files, each in a separate tab. use gT and gt to move to the left- and right-tab, respectively. to add another tab while editing, type ':tabe filename'
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"