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_if.sh | |
( # linux | |
file /sys/class/net/* | | |
sed 's/.*\///g' || | |
# macos | |
networksetup -listallhardwareports | | |
grep "Device:" | | |
awk '{ print $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
# net_mac_addresses.sh | |
( # linux (NetworkManager) | |
nmcli -terse -fields GENERAL.HWADDR device show || | |
# macos | |
networksetup -listallhardwareports || | |
# linux/bsd | |
( ip address || ifconfig ) | |
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
# uuid.sh | |
uuidgen 2>/dev/null || | |
exit 1 #fail | |
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
# password.sh | |
declare -r length=$(($(($RANDOM%17))+23)) 2>/dev/null && #23-39 | |
( #openssl | |
openssl rand -base64 "${length-32}" || | |
#os random | |
base64 < /dev/urandom | | |
fold --width="${length-32}" | |
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 | |
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
# 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
# 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
# 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
# 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 |