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 | |
ROUTER_IP="192.168.1.1" | |
COOKIES="$(curl -v "https://${ROUTER_IP}/" \ | |
-H 'Connection: keep-alive' \ | |
-H 'Cache-Control: max-age=0' \ | |
-H "Origin: https://${ROUTER_IP}" \ | |
-H 'Upgrade-Insecure-Requests: 1' \ | |
-H 'DNT: 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
#!/usr/bin/env expect | |
# USAGE: ./install_ssh_key_on_edgeos_via_ssh.exp 192.168.1.1 ubnt ubnt #EdgeOS Defaults | |
# WARNING: This script will delete any existing keys on local and remote hosts for the specified user | |
set timeout 8 | |
set host [lindex $argv 0] | |
set user [lindex $argv 1] | |
set password [lindex $argv 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
#!/usr/bin/env expect | |
set timeout 4 | |
set host [lindex $argv 0] | |
set user ubnt | |
set password ubnt | |
spawn telnet "$host" | |
expect { |
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
# mem_modules.sh | |
# slot size type ecc make model serial | |
# linux/bsd x86 | |
dmidecode --type memory | | |
grep --extended-regexp --regexp='^[[:space:]]*Size:|^[[:space:]]*Locator:|^[[:space:]]*Type:|^[[:space:]]*Type Detail:|^[[:space:]]*Manufacturer:|^[[:space:]]*Serial Number:|^[[:space:]]*Part Number:' | | |
sed 's/^[[:space:]]*Size: /@\&/g' | #add @& placeholder for beginning of each valid entry | |
sed 's/^.*: //g' | #remove labels | |
sed 's/[[:space:]]*$//g' | #remove trailing whitespace | |
tr '\n' '\t' | #tab delimit |
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
# net_nics.sh | |
set -o pipefail && | |
( #macos | |
system_profiler SPEthernetDataType | | |
grep "BSD name" -B 11 | #hardware NICs have BSD names (excludes virtual interaces and bridges) | |
grep -v -E "Name|Type|Bus|ID|Sub|Link" | #remove lines we're not concerned with | |
sed 's/BSD name://g' | #remove labels | |
sed 's/://g' | #remove colons |
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
# cpu_arch.sh | |
uname -m | | |
sed 's/amd64/x86_64/' || #x86_64 is the generic name for amd64 | |
exit 1 #failure | |
exit 0 #success | |
#https://forums.fedoraforum.org/showthread.php?186239-x86_64-vs-amd64 |
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
# users_loggedin.sh | |
w -h | | |
awk '{ print $1 }' 2>/dev/null || | |
exit 1 #failure | |
exit 0 #success |
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
# user.sh | |
whoami 2>/dev/null || | |
exit 1 #failure | |
exit 0 #success |
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
# os.sh | |
( # linux | |
grep ^ID= /etc/os-release | | |
sed 's/PRETTY_NAME=//' | | |
sed 's/"//g' || | |
# macos | |
system_profiler SPSoftwareDataType | | |
grep "System Version: " | |
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
# cpu_model.sh | |
( # linux (proc) | |
grep "model name" /proc/cpuinfo | | |
uniq | | |
sed 's/[[:space:]]\{1,\}/ /g' | | |
sed 's/^model name : //' || | |
# linux (lscpu) | |
lscpu | |