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
| function Main | |
| { | |
| # File containing a MAC device list | |
| $filename = "C:\Scripts\wakeonlan\mac_list.txt" | |
| # The variables above may vary according to your input | |
| $ip = Get-IPAddress | |
| $broadcast = Get-BroadcastAddress $ip | |
| Send-WOL-FromFile $filename $broadcast -Verbose |
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
| function ip2decimal(ip) { | |
| ip = ip.split("."); | |
| var e, w = 16777216, x = 65536, y = 256, a = eval(ip[0]), b = eval(ip[1]), c = eval(ip[2]), d = eval(ip[3]); | |
| e = a * w + b * x + c * y + d; | |
| return e; | |
| } | |
| function decimal2ip(ip) { | |
| var w = 16777216, x = 65536, y = 256, e = eval(ip), a = e / w, z = e - (a - e % w / w) * w, b = z / x, q = z - (b - z % x / x) * x, c = q / y, d = q - (c - q % y / y) * y; | |
| return parseInt(a) + "." + parseInt(b) + "." + parseInt(c) + "." + parseInt(d); |
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
| # | |
| # Library with various ip manipulation functions | |
| # | |
| # convert ip ranges to CIDR notation | |
| # str range2cidr(ip2dec("192.168.0.15"), ip2dec("192.168.5.115")) | |
| # | |
| # Credit to Chubler_XL for this brilliant function. (see his post below for non GNU awk) | |
| # | |
| function range2cidr(ipStart, ipEnd, bits, mask, newip) { |
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
| # | |
| # Library with various ip manipulation functions | |
| # | |
| # convert ip ranges to CIDR notation | |
| # str range2cidr(ip2dec("192.168.0.15"), ip2dec("192.168.5.115")) | |
| # | |
| # Credit to Chubler_XL for this brilliant function. (see his post below for non GNU awk) | |
| # | |
| function range2cidr(ipStart, ipEnd, bits, mask, newip) { |
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
| # | |
| # Library with various ip manipulation functions | |
| # | |
| # convert ip ranges to CIDR notation | |
| # str range2cidr(ip2dec("192.168.0.15"), ip2dec("192.168.5.115")) | |
| # | |
| # Credit to Chubler_XL for this brilliant function. (see his post below for non GNU awk) | |
| # | |
| function range2cidr(ipStart, ipEnd, bits, mask, newip) { |
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 | |
| # Inserts or removes iptables rules to prevent snat to the hosts local weave ip ranges | |
| # This way the source ip will be retained for traffic not coming from weave | |
| # Requires weave to be running, the script does wait for weave report to respond | |
| echo running $0 $1 | |
| action="${1:-start}" | |
| echo action: ${action} | |
| #functions taken from: https://stackoverflow.com/questions/10768160/ip-address-converter | |
| dec2ip () { | |
| local ip dec=$@ |
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
| #!/usr/bin/nodejs | |
| function showHelp(){ | |
| console.log('Usage: ipnum [ip] ...'); | |
| } | |
| function convert(ip){ | |
| if(typeof ip !== 'string') return false; | |
| if(!/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(ip)) return false; |
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
| @include "lib_netaddr.awk" | |
| function sanitize(ip) { | |
| split(ip, slice, ".") | |
| return slice[1]/1 "." slice[2]/1 "." slice[3]/1 "." slice[4]/1 | |
| } | |
| function snbounds(to,i) { | |
| sn_min=grp[1] | |
| sn_max=grp[to] |
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. |