This file contains hidden or 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 | |
| TOPIP=15 | |
| TOPUP=30 | |
| TOPU=30 | |
| TOPP=30 | |
| TOPLU=15 | |
| TOPLP=15 | |
| GEOLITEDB="/home/<username>/maxmind/GeoIPCountryWhois.db" # Use the sqlite3 db created with http://pastebin.com/9WxCy5ks |
This file contains hidden or 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 | |
| . /usr/local/knock/library | |
| #Lista de portas na ordem da sequencia | |
| ports=(34 1032 43231 456) | |
| #Porta a Ser desbloqueada | |
| safePort=29 | |
| #Comando tshark (wireshark para console) | |
| #customizado para exibir apenas | |
| #ip de origem e porta de destino | |
| tshark -n -l -f "tcp and dst 177.70.2.30 and tcp[tcpflags] & (tcp-syn) != 0 and tcp[tcpflags] & (tcp-ack) = 0" -E separator=":" -Tfields -e ip.src -e tcp.dstport | |
This file contains hidden or 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 | |
| # cf. https://www.skyarch.net/blog/?p=7423 | |
| ip2dec() { | |
| local IFS=. | |
| local C=($1) | |
| printf "%s\n" $(( (${C[0]} << 24) | (${C[1]} << 16) | (${C[2]} << 8) | ${C[3]} )) | |
| } | |
| mask2dec() { |
This file contains hidden or 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/sh | |
| set -eu | |
| ip2dec () { | |
| local ip="$1" | |
| if test -z "$ip"; then | |
| printf "Argument required" 1>&2 | |
| return 1 | |
| fi |
This file contains hidden or 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 | |
| ip2dec () { | |
| local a b c d ip=$@ | |
| IFS=. read -r a b c d <<< "$ip" | |
| printf '%d\n' "$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d))" | |
| } | |
| die () { | |
| echo $1 |
This file contains hidden or 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 | |
| _err() { | |
| printf "$(date +'%Y-%m-%dT%H:%M:%S%z') [ERROR] $@" >&2 | |
| } | |
| _usage() { | |
| _err "Usage: $(basename $0) {$(sed "s/ () /|/g; s/ ()$//g;" <<< $(declare -f | egrep "^[[:alpha:]][[:graph:]]+[[:space:]]\(\)"))} \$IPADDR/\$PREFIX\n" | |
| } |
This file contains hidden or 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 | |
| # src: https://stackoverflow.com/questions/20762575/explanation-of-convertor-of-cidr-to-netmask-in-linux-shell-netmask2cdir-and-cdir | |
| mask2cidr () | |
| { | |
| # Assumes there's no "255." after a non-255 byte in the mask | |
| local x=${1##*255.} | |
| set -- 0^^^128^192^224^240^248^252^254^ $(( (${#1} - ${#x})*2 )) ${x%%.*} | |
| x=${1%%$3*} |
This file contains hidden or 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 | |
| # By Frank Danielson @ Bold Apps | |
| IPS=(`ifconfig | grep "inet addr:" | awk -F: '{ print $2 }' | awk '{ print $1 }'`) | |
| MASKS=(`ifconfig | grep "Mask:" | awk -F: '{ print $4 }'`) | |
| BITS=() | |
| i=0 | |
| mask2cidr() { |
This file contains hidden or 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
| $ ip2decimal 192.168.0.1 | |
| 3232235521 | |
| $ decimal2ip 3232235521 | |
| 192.168.0.1 | |
| $ | |
| $ ip2decimal 255.255.255.0 | |
| 4294967040 | |
| $ cidr2decimal 24 | |
| 4294967040 |
NewerOlder