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 = './c4_lan/c4_lan_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
sudo apt-get -y install doxygen pandoc flex lzip lcov git gcc cmake libpcre3-dev zlib1g-dev libssl-dev libnghttp2-dev autoconf-archive nettle-dev libtool python-is-python3 autopoint texinfo nettle-dev nettle-dev nettle-bin libunistring-dev gettext make libbz2-dev lzma brotli libbrotli-dev libzstd-dev zstd lzip liblz-dev libpcre2-dev libmicrohttpd-dev libgpgme-dev liblzma-dev libgnutls28-dev libgcrypt20-dev git-merge-changelog | |
cd ~/Downloads | |
mkdir wget-dev | |
cd wget-dev | |
git clone https://gitlab.com/rockdaboot/libhsts | |
cd libhsts | |
autoreconf -fi | |
./configure | |
make |
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 | |
# Copyright (C) 2016 The Linux Containers Project | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
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 | |
#Converting decimal to binary | |
##Source: https://stackoverflow.com/questions/55239476/awk-convert-decimal-to-binary | |
gawk ' | |
function d2b(d, b) { | |
while(d) { | |
b=d%2b | |
d=int(d/2) | |
} |
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
#!/usr/bin/env bash | |
# Print usage | |
function usage { | |
echo -n "$(basename $0) CIDR... | |
$(basename $0) [OPTION] CIDR... | |
This script prints the ip range or full list of ip addresses for one or more CIDR. | |
Options: |
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 to convert cidr to a mask | |
cidr2mask () { | |
# Number of args to shift, 255..255, first non-255 byte, zeroes | |
set -- $(( 5 - (${1} / 8) )) 255 255 255 255 $(( (255 << (8 - (${1} % 8))) & 255 )) 0 0 0 | |
[ ${1} -gt 1 ] && shift ${1} || shift | |
echo ${1-0}.${2-0}.${3-0}.${4-0} | |
} |
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
// 2018.12.03 Atienza, Chris | |
// Given a slash specified network (ie: 10.1.1.1/24) returns the low and hi IPs in the defined range | |
// does not exclude any special reserved addresses | |
function _cidrToRange(cidr) { | |
var range = [2]; | |
cidr = cidr.split('/'); | |
var cidr_1 = parseInt(cidr[1]) | |
range[0] = long2ip((ip2long(cidr[0])) & ((-1 << (32 - cidr_1)))); | |
start = ip2long(range[0]) |
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 | |
############################ | |
## Methods | |
############################ | |
prefix_to_bit_netmask() { | |
prefix=$1; | |
shift=$(( 32 - prefix )); | |
bitmask="" |
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) { |
NewerOlder