Skip to content

Instantly share code, notes, and snippets.

@x2c3z4
x2c3z4 / Find Google-IP
Created December 23, 2016 02:01 — forked from on195594/Find Google-IP
如何查找Google的IP地址段
一般查找域名对应的IP,可以用这个命令 nslookup <域名>,但这样找,返回的ip比较少,今天看到一条命令,可以批量查找Google当前的IP范围。
命令及返回的结果如下:
# nslookup -q=TXT _netblocks.google.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
_netblocks.google.com text = "v=spf1 ip4:64.18.0.0/20 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:207.126.144.0/20 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"
@x2c3z4
x2c3z4 / stacktrace.cxx
Created December 16, 2016 10:06 — forked from fmela/stacktrace.cxx
A C++ function that produces a stack backtrace with demangled function & method names.
#include <execinfo.h> // for backtrace
#include <dlfcn.h> // for dladdr
#include <cxxabi.h> // for __cxa_demangle
#include <cstdio>
#include <cstdlib>
#include <string>
#include <sstream>
// This function produces a stack backtrace with demangled function & method names.
@x2c3z4
x2c3z4 / requestor.awk
Created November 14, 2016 02:56 — forked from sinegar/requestor.awk
Combine tcpdump packets into requests and response times.
#!/usr/bin/awk -f
# #
#
# Inspired by http://www.percona.com/doc/percona-toolkit/2.1/pt-tcp-model.html
#
# Example usage:
# $ tcpdump -i any -s 0 -nnq -tt 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
# 1349692787.492311 IP X.X.X.X.XXXX > X.X.X.X.XXXX: tcp 1448
# $ ./requestor.awk dump.file
@x2c3z4
x2c3z4 / ddos-deflate-install.sh
Created September 8, 2016 03:08
ddos-deflate
cd /opt
wget https://github.com/jgmdev/ddos-deflate/archive/master.zip
unzip master.zip
rm master.zip
cd ddos-deflate-master
./install.sh
echo '# Paths of the script and other files
PROGDIR="/usr/local/ddos"
@x2c3z4
x2c3z4 / domainavailable
Created August 9, 2016 04:21 — forked from peterc/domainavailable
Check if a domain is available to register (uses DNS before WHOIS to be fast) - supports .com,.net,.org,.co.uk - inspired by foca/giles http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
#!/bin/bash
# domainavailable
# Fast, domain name checker to use from the shell
# Use globs for real fun:
# domainavailable blah{1..3}.{com,net,org,co.uk}
# Inspired by foca / giles:
# http://gilesbowkett.blogspot.com/2009/02/simple-bash-domain-availability.html
trap 'exit 1' INT TERM EXIT
@x2c3z4
x2c3z4 / host-network-setup.sh
Created August 1, 2016 04:10 — forked from yousong/qemustart.sh
Run OpenWrt on QEMU virtual machines with LAN and WAN network.
#
# The following script will
# - Create Linux bridge $BR_WAN, $BR_LAN
# - Install IP addresses and basic routes
# - Enable proxy_arp on $BR_WAN
# - Enable ip_forward
# - Enable MASQUERADE on $IF_INET
# - $BR_LAN, $BR_WAN has to be allowed in ~/.usr/etc/qemu/bridge.conf
#
@x2c3z4
x2c3z4 / strapwrap.sh
Created July 6, 2016 15:49 — forked from DazWorrall/strapwrap.sh
Little script to create a minimal ubuntu using debootstrap and bring it up to date
#!/bin/bash
set -e
DEFAULT_PACKAGES=ssh,language-pack-en-base
DEFAULT_COMPONENTS=main,universe
DEBOOTSTRAP=/usr/sbin/debootstrap
DEFAULT_MIRROR=http://archive.ubuntu.com/ubuntu
DEFAULT_VARIANT=minbase
MIRROR=${STRAP_MIRROR:-$DEFAULT_MIRROR}
ROOTFS=$1
@x2c3z4
x2c3z4 / install_lio.sh
Created July 5, 2016 17:17 — forked from avirambh/install_lio.sh
Install LIO on ubuntu 14.04
pip uninstall -y rtslib-fb==2.1.49
sudo apt-get remove -y lio-utils
sudo apt-get install -y python-prettytable python-ipaddr python-netifaces python-configobj python-pyparsing python-epydoc texlive-latex-base texlive-latex-extra texlive-latex-recommended lmodern texlive-fonts-recommended python-urwid
rm -rf rtslib
git clone https://github.com/Datera/rtslib
cd rtslib; make deb; sudo apt-get -y remove rtslib ; dpkg -i dist/*.deb; cd ..
rm -rf configshell
git clone https://github.com/Datera/configshell
@x2c3z4
x2c3z4 / aliases
Created June 3, 2016 03:59 — forked from kaleb/aliases
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <[email protected]>
alias tim Timothy Pitt <[email protected]>
alias steven Steven Jackson <[email protected]>
alias kaleb Kaleb Hornsby <[email protected]>
alias alug-admin nick, tim, steven
@x2c3z4
x2c3z4 / worker nginx conf
Created May 10, 2016 06:56 — forked from fqrouter/worker nginx conf
Youtube Reverse Proxy
resolver 8.8.8.8;
location /video/ {
if ($request_uri ~ "^/video/(.+?)/.+") {
set $upstream_host $1.googlevideo.com;
add_header Content-Disposition "attachment; filename=video.mp4;";
}
rewrite /video/.+?/(.+)$ /$1 break;
proxy_buffering off;
proxy_pass https://$upstream_host;
proxy_set_header Host $upstream_host;