This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifconfig -a | grep -i "link[ ]*encap[ ]*:[ ]*ethernet" | awk 'BEGIN{ iface="z" } | |
{ if( $1 ~ /^eth/ && iface > $1 ) iface=$1 } | |
END{ print iface }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# it starts multiple screen session whose usual task is remote ssh over | |
# a line separated list of IP's | |
# session_name : the prefix of the name of the screen sessions | |
# script_name : implements the remote ssh code e.g. with python's paramiko | |
# input_file_prefix : the prefix of the files for the script to process | |
# iterations : the number of input files which is equivalent to the screen sessions to be spawned (indexing is zero-based) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SSHD_CONFIG=/etc/ssh/sshd_config | |
SSH_SVC=/etc/init.d/sshd | |
v=`grep -m 1 -e "X11Forwarding" ${SSHD_CONFIG} | awk '{ if( $0 ~ /^#/ ) print "no"; else print $2; }'` | |
enabled=0; | |
if [ ${v} == 'yes' ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the capture file should be filtered in order to contain | |
# 1] the source address of the host for which we are checking the re-transmission mechanism for | |
# 2] and the destination should be any number of target hosts we are interested in | |
# 3] we only need the retransmitted packets (apply appropriate filter) | |
# 4] the capture file to be processed should be exported in text format with as much verbose info as possible | |
# script 1 | |
# splits the capture in separate files (using a specific prefix) each containing a separate re-transmission stream - identified by the same destination IP and the same TCP sequence port | |
#!/bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1] convert all to lowercase letters | |
convmv --lower --notest * | |
# 2] remove naming defects such as : | |
# a] consecutive spaces | |
# b] weird characters like commas, parentheses, underscores, etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# network route that goes nowhere - blackhole filtering | |
# 1] available to almost every host implementing the ip module | |
# 2] almost 0 performance impact | |
# 3] can sustain higher throughput than conventional firewalls | |
route add -host 192.168.1.1 reject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://hacktux.com/bash/control/c | |
cleanup() | |
# example cleanup function | |
{ | |
rm -f /tmp/tempfile | |
return $? | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# it can add/delete multiple times the same crontab entry | |
# without having to worry for duplicate entries (in case of adding) | |
# or any leftovers (in case of deleting) | |
# THIS KEY HAS TO BE UNIQUE IN THE ENTRY TO BE ADDED/DELETED | |
CMD_KEY="moo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
import traceback | |
from optparse import Option, OptionParser, OptionGroup | |
version_string = "\n\ | |
%prog\n" |