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.js - converts IP address to decimal format | |
| * @author - Livingston Samuel | |
| */ | |
| var IP2Decimal = function (ip) { | |
| var ipSyntax = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, ipArr, i = 4, decVal = 0; | |
| if (ipSyntax.test(ip)) { | |
| ipArr = ip.split("."); |
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 | |
| function ::netmask2cidr() | |
| { | |
| case $1 in | |
| 0x*) | |
| local hex=${1#0x*} quad= | |
| while [ -n "${hex}" ]; do | |
| local lastbut2=${hex#??*} | |
| quad=${quad}${quad:+.}0x${hex%${lastbut2}*} |
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
| _cidr2mask() | |
| { | |
| local i mask="" | |
| local full_octets=$(($1 / 8)) | |
| local partial_octet=$(($1 % 8)) | |
| for((i = 0; i < 4; i += 1)) | |
| do | |
| if [ $i -lt $full_octets ] | |
| then |
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
| cidr2mask() { | |
| local mask="" | |
| local netaddr="" | |
| local bcast="" | |
| local gateway="" | |
| local full_octets=$(($2/8)) | |
| local partial_octet=$(($2%8)) | |
| ipparts=($(echo $1 | tr "." "\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 | |
| # Customize this | |
| domain="indigobio.com" | |
| ns1="8.8.8.8" | |
| ns2="4.2.2.2" | |
| ndots="2" | |
| usage() { | |
| echo |
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
| # | |
| # Make gcc-4.8 the default compiler | |
| # brew installs gcc-4.8, but does not create symlinks for it to be used | |
| # without the version number. | |
| # This script: | |
| # 1. Generate symlinks for all gcc tools installed by brew | |
| # 2. Make brew-installed software the first in path | |
| # | |
| BREW_CMD="brew" |
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 |
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 | |
| # 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
| #!/bin/bash | |
| # Author: Felipe Molina (@felmoltor) | |
| # Date: 05/03/2015 | |
| # Summary: | |
| # This script analyzes the Apache logs previously downloaded with "download.ovh.logs.sh" | |
| # It compares the requests done yesterday with the whitelist of files of the website contained in "whitelist.files.list" | |
| # If one of the requests is not pressent in this whitelist, the script stores it as suspicious along with the server response | |
| # of the request and finally a summary is sent to your email. |
OlderNewer