2023年1月6日 星期五

Detect if a VM is running in Google Compute Engine

Detect if a VM is running in Compute Engine

sudo dmidecode -s system-product-name | grep "Google Compute Engine"
這個需要 root 權限,實際上是去讀取 /sys/firmware/dmi/tables/DMI
用 strings /sys/firmware/dmi/tables/DMI | grep "Google Compute Engine" 也行

若程式沒有 root 權限,可以去讀取 /etc/hosts 有沒有包含 Added by Google 字樣
grep "Added by Google" /etc/hosts

沒有留言:

IPv4/IPv6 Country CIDR API

台灣的 IPv4 https://ip4.tw/geoip/tw/ipv4 台灣的 IPv6 https://ip4.tw/geoip/tw/ipv6 台灣的 IPv4+IPv6 https://ip4.tw/geoip/tw 把 tw 換成其他 國碼 即可查其他國家 此 API...