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
seq 3189 3193 > x.txt ; seq 5003 5008 > y.txt; while read -r x && read -r y <&3; do echo number wat${x}.hostgator.com wat${y}.hostgator.com ;done <x.txt 3<y.txt |
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/sbin/conntrack -L |grep $1 | grep ESTAB |grep 'dport=$2' | awk '{ system("/usr/sbin/conntrack -D --orig-src '$1' --orig-dst " substr($6,5) " -p tcp --orig-port-src " substr($7,7) " --orig-port-dst $2");}'; |
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
iptables -t mangle -N badz | |
iptables -t mangle -N blockz | |
iptables -t mangle -A PREROUTING -p tcp -m tcp --dport 80 -j blockz | |
iptables -t mangle -A badz -m recent --set --name terrible --rsource | |
iptables -t mangle -A blockz -p tcp -m tcp --dport 80 --tcp-flags FIN,SYN,RST,ACK SYN -m recent --update --seconds 3600 --name terrible --rsource -j DROP | |
iptables -t mangle -A blockz -p tcp -m tcp --dport 80 -m string --string "malicious_string" --algo bm --to 65535 -m recent --set --name bad --rsource | |
iptables -t mangle -A blockz -p tcp -m tcp --dport 80 -m string --string "malicious_string" --algo bm --to 65535 -m recent --update --seconds 10 --hitcount 3 --name bad --rsource -j badz |
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 | |
# Set the variable for bash behavior | |
shopt -s nullglob | |
shopt -s dotglob | |
# Die if dir name provided on command line | |
[[ $# -eq 0 ]] && { echo "Usage: $0 dir-name"; exit 1; } | |
# Check for empty files using arrays | |
chk_files=(${1}/*) |
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
# cpapi2 --user=tqqlzfna AddonDomain addaddondomain dir=/home/tqqlzfna/public_html/whatever.com newdomain=watever.com subdomain=wat | |
# /scripts/addpop test@watever.com apassword... | |
# mail -s "Test Subject" test@watever.com < /dev/null |
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/perl | |
use strict; | |
use warnings; | |
unless (scalar @ARGV == 1) { | |
die "Parameter needed, please pass ctid as parameter"; | |
} | |
my $ctid = $ARGV[0]; |
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/python3 | |
import os.path, re | |
from collections import namedtuple | |
MountInfo = namedtuple('MountInfo', ['mountid', 'parentid', 'devid', 'root', 'mountpoint', 'mountoptions', 'extra', 'fstype', 'source', 'fsoptions']) | |
mounts = {} | |
def unescape(string): |
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
This is what I tell people to do, who ask me "how do I learn to be a Linux sysadmin?". | |
1) Set up a KVM hypervisor. | |
2) Inside of that KVM hypervisor, install a Spacewalk server. | |
- Use CentOS 6 as the distro for all work below. | |
- For bonus points set up errata importation on the CentOS channels, so you can properly see security update advisory information. | |
3) Create a VM to provide named and dhcpd service to your entire environment. | |
- Set up the dhcp daemon to use the Spacewalk server as the pxeboot machine (thus allowing you to use Cobbler to do unattended OS installs). | |
- Make sure that every forward zone you create has a reverse zone associated with it. | |
- Use something like "internal.virtnet" (but not ".local") as your internal DNS zone. |
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
coproc cat # Start cat in background | |
echo Hello >&${COPROC[1]} # Say "Hello" to cat | |
read LINE <&${COPROC[0]} # Read response | |
echo $LINE # cat replied "Hello"! |
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 perl | |
use strict; | |
use warnings; | |
use Zabbix::Tiny; | |
$|++; | |
my %hostgroups = ( | |
'Test' => "42", | |
); | |
my $zabbix = Zabbix::Tiny->new( | |
server => 'https://myzabbix.something.com/api_jsonrpc.php', |
NewerOlder