Skip to content

Instantly share code, notes, and snippets.

View SystemZ's full-sized avatar

Michał Frąckiewicz SystemZ

View GitHub Profile
@SystemZ
SystemZ / dump_dns.sh
Created October 28, 2015 21:31
Get current DNS queries with tcpdump
sudo tcpdump -vvv -s 0 -l -n port 53 -i eth0 | tee -a dnsdump.log
@SystemZ
SystemZ / check_net_by_dns.sh
Created October 28, 2015 21:33
Check Internet status by Google DNS query
#!/bin/bash
ping -c 1 -s 1 -W 1 8.8.8.8 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "ok"
elif [ $? -ne 0 ]; then
echo "bad"
fi
@SystemZ
SystemZ / iptables_reset.sh
Created October 28, 2015 21:55
Iptables reset
#!/bin/bash
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
@SystemZ
SystemZ / make_spam.sh
Created October 28, 2015 21:59
Simple spam with date to textfile, useful for testing websocket log file read
#!/bin/bash
while :
do
echo "spam"
echo "$(date +%Y%m%d%H%M%S) blah" >> spam.txt
sleep 1
done
@SystemZ
SystemZ / get_http.go
Created October 28, 2015 22:33
Golang get http
package main
import (
"fmt"
"net/http"
"time"
)
func main() {
for {
@SystemZ
SystemZ / lpr_duplex.sh
Created October 28, 2015 22:35
Print file with duplex
#!/bin/bash
lpr -o Duplex=DuplexNoTumble -P "printername" $1
@SystemZ
SystemZ / remove_old_files.sh
Created November 22, 2015 23:11
Remove old files in path
#http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/
#remove files older than 30 days
find /path/to/files* -mtime +30 -exec rm {} \;
@SystemZ
SystemZ / vz_list_main_ip.sh
Created December 16, 2015 05:55
List all OpenVZ containers main IPs.
vzlist -a | tail -n +2 | awk '{print $4}'
dig -t SRV _minecraft._tcp.domain.com
@SystemZ
SystemZ / ts_srv.sh
Last active January 12, 2016 05:56
dig -t SRV _ts3._udp.domain.com