Changes to Discovery commands
The following sections show the discovery command changes between BMC Discovery versions.
The following changes are not shown:
- Entirely new discovery platforms
- Changes to comments only
- Commands which have been removed and not replaced
- Changes to echo only statements
Discovery command changes from 22.2 to 23.1
Tru64
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_HWMGR() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_SETLD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
############################################################################
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
OpenBSD
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_DMIDECODE() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
Mac OS X
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
FreeBSD
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_DMIDECODE() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
VMware ESXi
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
VMware ESX
getNetworkInterfaces
The following code is added:
# GCE interfaces
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
echo "nic$i: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " ether $mac"
done
fi
# Azure public interface from the loadbalancer metadata if present
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
echo "public0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " ether 00:00:00:00:00:00"
The following code is added:
# GCE interfaces
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
echo "$i: nic$i: <UP> link/ether $mac"
done
fi
# Azure public interface from the loadbalancer metadata if present
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
echo "0: public0: <UP> link/ether 00:00:00:00:00:00"
initialise
The following code:
if [ $TW_DETECT_AZURE -eq 1 ]; then
# see: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service
TW_CLOUD_ID=`curl --connect-timeout 5 --max-time 10 --fail -H 'Metadata:true' "http://169.254.169.254/metadata/instance/compute/vmId?api-version=2019-06-01&format=text" 2>/dev/null`
if [ -n "$TW_CLOUD_ID" ]; then
TW_CLOUD_PLATFORM=AZURE
TW_CLOUD_IMDS_CMD="curl --connect-timeout 5 --max-time 10 --fail -H 'Metadata:true' http://169.254.169.254/metadata"
return 0
fi
fi
is replaced with:
if [ $TW_DETECT_AZURE -eq 1 ]; then
# see: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service
TW_CLOUD_ID=`curl --connect-timeout 5 --max-time 10 --fail --header Metadata:true "http://169.254.169.254/metadata/instance/compute/vmId?api-version=2019-06-01&format=text" 2>/dev/null`
if [ -n "$TW_CLOUD_ID" ]; then
TW_CLOUD_PLATFORM=AZURE
TW_CLOUD_IMDS_CMD="curl --connect-timeout 5 --max-time 10 --fail --header Metadata:true http://169.254.169.254/metadata"
return 0
fi
fi
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_DMIDECODE() {
"$@"
}
PRIV_ESXCFG() {
"$@"
}
PRIV_ETHTOOL() {
"$@"
}
PRIV_HBACMD() {
"$@"
}
PRIV_HWINFO() {
"$@"
}
PRIV_LPUTIL() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSHW() {
"$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_MIITOOL() {
"$@"
}
PRIV_NETSTAT() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_SS() {
"$@"
}
PRIV_TEST() {
test "$@"
}
PRIV_XE() {
"$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
getDeviceInfo
The following code:
elif [ -f /etc/oracle-release ]; then
os=`cat /etc/oracle-release`
fi
fi
fi
fi
is replaced with:
os=`cat /etc/oracle-release`
fi
elif [ -r /etc/system-release ]; then
igel_os=`grep 'IGEL OS' /etc/system-release`
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
fi
getIPAddresses
The following code:
tw_detect_cloud_platform
if [ $? -eq 0 ]; then
# AWS EC2 public/elastic IPs
if [ "$TW_CLOUD_PLATFORM" = "AWS" ]; then
macs=`$TW_CLOUD_IMDS_CMD/network/interfaces/macs/ 2>/dev/null | sed -e 's/\///g'`
is replaced with:
if [ $? -eq 0 ]; then
tw_detect_cloud_platform
# AWS EC2 public/elastic IPs
if [ "$TW_CLOUD_PLATFORM" = "AWS" ]; then
macs=`$TW_CLOUD_IMDS_CMD/network/interfaces/macs/ 2>/dev/null | sed -e 's/\///g'`
The following code is added:
# GCE public IPs
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
public_ip=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/access-configs/0/external-ip 2>/dev/null`
echo "$i: nic$i: <UP> mtu 1500 state UP"
echo " link/ether $mac brd ff:ff:ff:ff:ff:ff"
echo " inet $public_ip/0 brd 0.0.0.0 scope tw:internet nic$i"
done
fi
# Azure public IPs
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
found_public_ip=false
# First try with Load Balancer Metadata API in case we have Standard SKU Public IP address
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
found_public_ip=true
echo "0: public0: <UP> mtu 1500 state UP"
echo " link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff"
for entry in $frontend_ip_addrs
do
public_ipv4_addr=`echo $entry | grep -E '^([0-9]{1,3}\.){3}[0-9]+'`
public_ipv6_addr=`echo $entry | grep -E '^\[[0-9a-f:]+' | tr -d "["`
if [ ! -z "$public_ipv4_addr" ]; then
echo " inet $public_ipv4_addr/0 brd 0.0.0.0 scope tw:internet public0"
fi
if [ ! -z "$public_ipv6_addr" ]; then
echo " inet6 $public_ipv6_addr/0 scope tw:internet"
fi
done
fi
# Now try with instance metadata, Basic SKU Public IP address are shown there
# (but not the Standard SKU ones)
if ! $found_public_ip; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network/interface?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$interfaces" ]; then
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/macAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's/[0-9A-F]\{2\}/&:/g' -e 's/:$//'`
if [ -z "$mac" ]; then
break
fi
# IPv4 address
ipv4_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv4_addrs" ]; then
for ipv4 in $ipv4_addrs
do
public_ipv4_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress/$ipv4/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv4_addr" ]; then
echo "$i: eth$i: <UP> mtu 1500 state UP"
echo " link/ether $mac brd ff:ff:ff:ff:ff:ff"
echo " inet $public_ipv4_addr/0 brd 0.0.0.0 scope tw:internet eth$i"
fi
done
fi
# IPv6 address
ipv6_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv6_addrs" ]; then
for ipv6 in $ipv6_addrs
do
public_ipv6_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress/$ipv6/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv6_addr" ]; then
echo " inet6 $public_ipv6_addr/0 scope tw:internet"
fi
done
fi
done
fi
fi
fi
fi
getIPAddresses
The following code is added:
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
public_ip=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/access-configs/0/external-ip 2>/dev/null`
echo "nic$i: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " inet $public_ip netmask 0.0.0.0 scope tw:internet"
echo " ether $mac"
done
fi
# Azure public IPs
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
found_public_ip=false
# First try with Load Balancer Metadata API in case we have Standard SKU Public IP address
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
found_public_ip=true
echo "public0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
for entry in $frontend_ip_addrs
do
public_ipv4_addr=`echo $entry | grep -E '^([0-9]{1,3}\.){3}[0-9]+'`
public_ipv6_addr=`echo $entry | grep -E '^\[[0-9a-f:]+' | tr -d "["`
if [ ! -z "$public_ipv4_addr" ]; then
echo " inet $public_ipv4_addr netmask 0.0.0.0 broadcast 0.0.0.0 scope tw:internet"
fi
if [ ! -z "$public_ipv6_addr" ]; then
echo " inet6 $public_ipv6_addr prefixlen 0 scopeid 0xtw:internet"
fi
done
echo " ether 00:00:00:00:00:00"
fi
# Now try with instance metadata, Basic SKU Public IP address are shown there
# (but not the Standard SKU ones)
if ! $found_public_ip; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network/interface?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$interfaces" ]; then
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/macAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's/[0-9A-F]\{2\}/&:/g' -e 's/:$//'`
if [ -z "$mac" ]; then
break
fi
# IPv4 address
ipv4_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv4_addrs" ]; then
for ipv4 in $ipv4_addrs
do
public_ipv4_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress/$ipv4/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv4_addr" ]; then
found_public_ip=true
echo "eth$i: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " inet $public_ipv4_addr netmask 0.0.0.0 broadcast 0.0.0.0 scope tw:internet"
fi
done
fi
# IPv6 address
ipv6_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv6_addrs" ]; then
for ipv6 in $ipv6_addrs
do
####################
public_ipv6_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress/$ipv6/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv6_addr" ]; then
found_public_ip=true
echo " inet6 $public_ipv6_addr prefixlen 0 scopeid 0xtw:internet"
fi
done
fi
if $found_public_ip; then
echo " ether $mac"
fi
done
fi
fi
fi
fi
NetBSD
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_DMIDECODE() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
AIX
initialise
The following code is added:
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSCFG() {
"$@"
}
PRIV_LSLPP() {
"$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_LSWPAR() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
UnixWare
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
Windows
getProcessToConnectionMapping
A new method.
initialise
The following code:
}
if ($global:TW_CLOUD_ID) {
$global:TW_CLOUD_PLATFORM="GCE";
return;
}
}
is replaced with:
if ($global:TW_CLOUD_ID) {
$global:TW_CLOUD_PLATFORM="GCE";
$global:TW_CLOUD_IMDS_HEADERS = @{
"Metadata-Flavor" = "Google"
};
return;
}
}
getIPAddresses
The following code:
# AWS EC2 public/elastic IPs
if ($TW_CLOUD_PLATFORM -eq "AWS") {
...
Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs" -ErrorAction SilentlyContinue | ForEach-Object {
try {
$interface_id = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$_/interface-id" -ErrorAction SilentlyContinue;
- Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$_/public-ips" -ErrorAction SilentlyContinue | ForEach-Object {
"interface_id: {0}" -f $interface_id;
"ip_addr: {0}" -f $_;
"netmask: 0.0.0.0";
...
}
}
is replaced with:
# Detect cloud platform, if any
tw_detect_cloud_platform;
# AWS EC2 public/elastic IPs
if ($TW_CLOUD_PLATFORM -eq "AWS") {
...
Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs" -ErrorAction SilentlyContinue | ForEach-Object {
try {
$interface_id = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$_/interface-id" -ErrorAction SilentlyContinue;
Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$_/public-ipv4s" -ErrorAction SilentlyContinue | ForEach-Object {
"interface_id: {0}" -f $interface_id;
"ip_addr: {0}" -f $_;
"netmask: 0.0.0.0";
...
}
}
The following code is added:
# GCP public IPs
elseif ($TW_CLOUD_PLATFORM -eq "GCE") {
try {
$network_interfaces = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/" -ErrorAction SilentlyContinue;
if ($network_interfaces) {
$network_interfaces.Split([System.Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object {
try {
$id = "$_" -replace "/","";
$mac = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$id/mac" -ErrorAction SilentlyContinue;
$public_ip = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$id/access-configs/0/external-ip" -ErrorAction SilentlyContinue;
"interface_id: nic{0}" -f $id;
"ip_addr: {0}" -f $public_ip;
"netmask: 0.0.0.0";
"address_type: IPv4";
"scope: tw:internet";
"";
}
catch {
}
};
};
}
catch {
}
}
# Azure public IPs
elseif ($TW_CLOUD_PLATFORM -eq "AZURE") {
$found_public_ip = $False
# First try with Load Balancer Metadata API in case we have Standard SKU Public IP address
try {
$load_balancer_metadata = Invoke-RestMethod -Headers @{"Metadata"="true"} -TimeoutSec 5 -URI "http://169.254.169.254/metadata/loadbalancer?api-version=2021-12-13" -ErrorAction SilentlyContinue;
if ($load_balancer_metadata) {
$load_balancer_metadata.loadbalancer.publicIpAddresses.frontendIpAddress | ForEach-Object {
# IPv6 address
if($_.StartsWith("[")) {
"interface_id: public0";
"ip_addr: {0}" -f $_ -replace "[\[\]]","";
"prefix_length: 0";
"address_type: IPv6";
"scope: tw:internet";
"";
# IPv4 address
} else {
"interface_id: public0";
"ip_addr: {0}" -f $_;
"netmask: 0.0.0.0";
"address_type: IPv4";
"scope: tw:internet";
"";
};
};
$found_public_ip = $True;
};
}
catch {
};
# Now try with instance metadata, Basic SKU Public IP address are shown there
# (but not the Standard SKU ones)
if (-Not $found_public_ip) {
try {
$interfaces = Invoke-RestMethod -Headers @{"Metadata"="true"} -TimeoutSec 5 -URI "http://169.254.169.254/metadata/instance/network/interface?api-version=2021-12-13&format=json" -ErrorAction SilentlyContinue
if ($interfaces) {
$if_counter=1;
$interfaces | ForEach-Object {
try {
$_.ipv4.ipAddress | ForEach-Object {
if ($_.publicIpAddress) {
if ($if_counter -eq 1) {
"interface_id: Ethernet";
} else {
"interface_id: Ethernet {0}" -f $if_counter;
};
"ip_addr: {0}" -f $_.publicIpAddress;
"netmask: 0.0.0.0";
"address_type: IPv4";
"scope: tw:internet";
"";
}
};
$_.ipv6.ipAddress | ForEach-Object {
if ($_.publicIpAddress) {
if ($if_counter -eq 1) {
"interface_id: Ethernet";
} else {
"interface_id: Ethernet {0}" -f $if_counter;
};
"ip_addr: {0}" -f $_.publicIpAddress;
"prefix_length: 0";
"address_type: IPv6";
"scope: tw:internet";
"";
}
};
}
catch {
}
$if_counter++;
}
}
}
catch {
}
}
}
getHostInfo
The following code:
$boot_time = $os.LastBootUpTime;
if ($boot_time) {
# Older PowerShell returns a string not a date time :(
#if ($boot_time -is [string]) {
#$boot_time = [datetime]::ParseExact($boot_time, "yyyyMMddHHmmss", $null)
#}
"boot_time: {0}" -f $boot_time;
}
$uptime = $null;
is replaced with:
$boot_time = $os.LastBootUpTime;
if ($boot_time) {
"boot_time: {0}" -f $boot_time.toString("yyyy-MM-dd HH:mm:ss K");
}
$uptime = $null;
getNetworkInterfaces
The following code is added:
###########################################################################
# Detect cloud platform, if any
tw_detect_cloud_platform;
# AWS ENIs
if ($TW_CLOUD_PLATFORM -eq "AWS") {
try {
$macs = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs" -ErrorAction SilentlyContinue;
$macs.Split([System.Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object {
try {
$mac = "$_" -replace "/","";
$interface_id = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$mac/interface-id" -ErrorAction SilentlyContinue;
Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$mac/public-ipv4s" -ErrorAction SilentlyContinue | ForEach-Object {
"interface_id: {0}" -f $interface_id;
"name: {0}" -f $id;
"mac_addr: {0}" -f $mac;
"adapter_type: Ethernet 802.3";
"";
}
}
catch {
}
};
}
catch {
}
}
# GCP
elseif ($TW_CLOUD_PLATFORM -eq "GCE") {
try {
$network_interfaces = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/" -ErrorAction SilentlyContinue;
if ($network_interfaces) {
$network_interfaces.Split([System.Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries) | ForEach-Object {
try {
$id = "$_" -replace "/","";
$mac = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$id/mac" -ErrorAction SilentlyContinue;
$public_ip = Invoke-RestMethod -TimeoutSec 5 -Headers $TW_CLOUD_IMDS_HEADERS -Uri "http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$id/access-configs/0/external-ip" -ErrorAction SilentlyContinue;
"interface_id: nic{0}" -f $id;
"name: nic{0}" -f $id;
"mac_addr: {0}" -f $mac;
"adapter_type: Ethernet 802.3";
"";
}
catch {
}
};
};
}
catch {
}
}
# Azure
elseif ($TW_CLOUD_PLATFORM -eq "AZURE") {
try {
$load_balancer_metadata = Invoke-RestMethod -Headers @{"Metadata"="true"} -TimeoutSec 5 -URI "http://169.254.169.254/metadata/loadbalancer?api-version=2021-12-13" -ErrorAction SilentlyContinue;
if ($load_balancer_metadata.loadbalancer.publicIpAddresses.frontendIpAddress) {
"interface_id: public0";
"name: public0";
"mac_addr: 00:00:00:00:00:00";
"adapter_type: Ethernet 802.3";
};
}
catch {
}
}
getPackageList
The following code:
if ($os_arch -match '64-bit') {
$queries['Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'] = "x86_64";
$queries['Registry::HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'] = 'x86';
} else {
is replaced with:
if ($os_arch -match '^64') {
$queries['Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'] = "x86_64";
$queries['Registry::HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'] = 'x86';
} else {
Linux
getNetworkInterfaces
The following code:
echo "$id: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " ether $mac"
done
fi
fi
fi
is replaced with:
echo " ether $mac"
done
fi
fi
# GCE interfaces
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
echo "nic$i: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " ether $mac"
done
fi
# Azure public interface from the loadbalancer metadata if present
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
echo "public0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " ether 00:00:00:00:00:00"
fi
fi
fi
getNetworkInterfaces
The following code:
echo "$n: $id: <UP> link/ether $mac"
done
fi
fi
fi
is replaced with:
echo "$n: $id: <UP> link/ether $mac"
done
fi
fi
# GCE interfaces
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
echo "$i: nic$i: <UP> link/ether $mac"
done
fi
# Azure public interface from the loadbalancer metadata if present
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
echo "0: public0: <UP> link/ether 00:00:00:00:00:00"
fi
fi
fi
initialise
The following code:
# Try Azure?
if [ $TW_DETECT_AZURE -eq 1 ]; then
# see: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service
TW_CLOUD_ID=`curl --connect-timeout 5 --max-time 10 --fail -H 'Metadata:true' "http://169.254.169.254/metadata/instance/compute/vmId?api-version=2019-06-01&format=text" 2>/dev/null`
if [ -n "$TW_CLOUD_ID" ]; then
TW_CLOUD_PLATFORM=AZURE
TW_CLOUD_IMDS_CMD="curl --connect-timeout 5 --max-time 10 --fail -H 'Metadata:true' http://169.254.169.254/metadata"
return 0
fi
fi
is replaced with:
if [ $TW_DETECT_AZURE -eq 1 ]; then
# see: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service
TW_CLOUD_ID=`curl --connect-timeout 5 --max-time 10 --fail --header Metadata:true "http://169.254.169.254/metadata/instance/compute/vmId?api-version=2019-06-01&format=text" 2>/dev/null`
if [ -n "$TW_CLOUD_ID" ]; then
TW_CLOUD_PLATFORM=AZURE
TW_CLOUD_IMDS_CMD="curl --connect-timeout 5 --max-time 10 --fail --header Metadata:true http://169.254.169.254/metadata"
return 0
fi
fi
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_DMIDECODE() {
"$@"
}
PRIV_ESXCFG() {
"$@"
}
PRIV_ETHTOOL() {
"$@"
}
PRIV_HBACMD() {
"$@"
}
PRIV_HWINFO() {
"$@"
}
PRIV_LPUTIL() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSHW() {
"$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_MIITOOL() {
"$@"
}
PRIV_NETSTAT() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_SS() {
"$@"
}
PRIV_TEST() {
test "$@"
}
PRIV_XE() {
"$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
getDeviceInfo
The following code:
elif [ -f /etc/oracle-release ]; then
os=`cat /etc/oracle-release`
fi
fi
fi
fi
is replaced with:
os=`cat /etc/oracle-release`
fi
elif [ -r /etc/system-release ]; then
igel_os=`grep 'IGEL OS' /etc/system-release`
if [ "$igel_os" != "" ]; then
os=$igel_os
fi
fi
fi
fi
getIPAddresses
The following code:
ip address show 2>/dev/null
tw_detect_cloud_platform
if [ $? -eq 0 ]; then
# AWS EC2 public/elastic IPs
if [ "$TW_CLOUD_PLATFORM" = "AWS" ]; then
is replaced with:
if [ $? -eq 0 ]; then
tw_detect_cloud_platform
# AWS EC2 public/elastic IPs
if [ "$TW_CLOUD_PLATFORM" = "AWS" ]; then
The following code is added:
# GCE public IPs
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
public_ip=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/access-configs/0/external-ip 2>/dev/null`
echo "$i: nic$i: <UP> mtu 1500 state UP"
echo " link/ether $mac brd ff:ff:ff:ff:ff:ff"
echo " inet $public_ip/0 brd 0.0.0.0 scope tw:internet nic$i"
done
fi
# Azure public IPs
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
found_public_ip=false
# First try with Load Balancer Metadata API in case we have Standard SKU Public IP address
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
found_public_ip=true
echo "0: public0: <UP> mtu 1500 state UP"
echo " link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff"
for entry in $frontend_ip_addrs
do
public_ipv4_addr=`echo $entry | grep -E '^([0-9]{1,3}\.){3}[0-9]+'`
public_ipv6_addr=`echo $entry | grep -E '^\[[0-9a-f:]+' | tr -d "["`
if [ ! -z "$public_ipv4_addr" ]; then
echo " inet $public_ipv4_addr/0 brd 0.0.0.0 scope tw:internet public0"
fi
if [ ! -z "$public_ipv6_addr" ]; then
echo " inet6 $public_ipv6_addr/0 scope tw:internet"
fi
done
fi
# Now try with instance metadata, Basic SKU Public IP address are shown there
# (but not the Standard SKU ones)
if ! $found_public_ip; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network/interface?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$interfaces" ]; then
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/macAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's/[0-9A-F]\{2\}/&:/g' -e 's/:$//'`
if [ -z "$mac" ]; then
break
fi
# IPv4 address
ipv4_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv4_addrs" ]; then
for ipv4 in $ipv4_addrs
do
public_ipv4_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress/$ipv4/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv4_addr" ]; then
echo "$i: eth$i: <UP> mtu 1500 state UP"
echo " link/ether $mac brd ff:ff:ff:ff:ff:ff"
echo " inet $public_ipv4_addr/0 brd 0.0.0.0 scope tw:internet eth$i"
fi
done
fi
# IPv6 address
ipv6_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv6_addrs" ]; then
for ipv6 in $ipv6_addrs
do
public_ipv6_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress/$ipv6/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv6_addr" ]; then
echo " inet6 $public_ipv6_addr/0 scope tw:internet"
fi
done
fi
done
fi
fi
fi
getIPAddresses
The following code is added:
# GCE public IPs
if [ "$TW_CLOUD_PLATFORM" = "GCE" ]; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/ 2>/dev/null | sed -e 's#/$##'`
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/mac 2>/dev/null`
public_ip=`$TW_CLOUD_IMDS_CMD/instance/network-interfaces/$i/access-configs/0/external-ip 2>/dev/null`
echo "nic$i: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " inet $public_ip netmask 0.0.0.0 scope tw:internet"
echo " ether $mac"
done
fi
# Azure public IPs
if [ "$TW_CLOUD_PLATFORM" = "AZURE" ]; then
found_public_ip=false
# First try with Load Balancer Metadata API in case we have Standard SKU Public IP address
frontend_ip_addrs=`$TW_CLOUD_IMDS_CMD/loadbalancer?api-version=2021-12-13 2>/dev/null | sed 's/frontendIpAddress":"/\n/g' | grep -oE '^([0-9\.]+|\[[0-9a-f:]+)'`
if [ ! -z "$frontend_ip_addrs" ]; then
found_public_ip=true
echo "public0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
for entry in $frontend_ip_addrs
do
public_ipv4_addr=`echo $entry | grep -E '^([0-9]{1,3}\.){3}[0-9]+'`
public_ipv6_addr=`echo $entry | grep -E '^\[[0-9a-f:]+' | tr -d "["`
if [ ! -z "$public_ipv4_addr" ]; then
echo " inet $public_ipv4_addr netmask 0.0.0.0 broadcast 0.0.0.0 scope tw:internet"
fi
if [ ! -z "$public_ipv6_addr" ]; then
echo " inet6 $public_ipv6_addr prefixlen 0 scopeid 0xtw:internet"
fi
done
echo " ether 00:00:00:00:00:00"
fi
# Now try with instance metadata, Basic SKU Public IP address are shown there
# (but not the Standard SKU ones)
if ! $found_public_ip; then
interfaces=`$TW_CLOUD_IMDS_CMD/instance/network/interface?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$interfaces" ]; then
for i in $interfaces
do
mac=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/macAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's/[0-9A-F]\{2\}/&:/g' -e 's/:$//'`
if [ -z "$mac" ]; then
break
fi
# IPv4 address
ipv4_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv4_addrs" ]; then
for ipv4 in $ipv4_addrs
do
public_ipv4_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv4/ipAddress/$ipv4/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv4_addr" ]; then
found_public_ip=true
echo "eth$i: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500"
echo " inet $public_ipv4_addr netmask 0.0.0.0 broadcast 0.0.0.0 scope tw:internet"
fi
done
fi
# IPv6 address
ipv6_addrs=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress?api-version=2021-12-13\&format=text 2>/dev/null | sed -e 's#/$##'`
if [ ! -z "$ipv6_addrs" ]; then
for ipv6 in $ipv6_addrs
do
####################
public_ipv6_addr=`$TW_CLOUD_IMDS_CMD/instance/network/interface/$i/ipv6/ipAddress/$ipv6/publicIpAddress?api-version=2021-12-13\&format=text 2>/dev/null`
if [ ! -z "$public_ipv6_addr" ]; then
found_public_ip=true
echo " inet6 $public_ipv6_addr prefixlen 0 scopeid 0xtw:internet"
fi
done
fi
if $found_public_ip; then
echo " ether $mac"
fi
done
fi
fi
fi
HP-UX
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_CSTM() {
"$@"
}
PRIV_CPROP() {
"$@"
}
PRIV_DF() {
"$@"
}
PRIV_FCMSUTIL() {
"$@"
}
PRIV_LANADMIN() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_SWLIST() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
Solaris
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_DLADM() {
"$@"
}
PRIV_DMIDECODE() {
"$@"
}
PRIV_EMLXADM() {
"$@"
}
PRIV_FCINFO() {
"$@"
}
PRIV_HBACMD() {
"$@"
}
PRIV_IFCONFIG() {
"$@"
}
PRIV_LPUTIL() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_NDD() {
"$@"
}
PRIV_PARGS() {
"$@"
}
PRIV_PFILES() {
"$@"
}
PRIV_PS() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
PRIV_VIRTINFO() {
"$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
############################################################################
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user
getHostInfo
The following code:
fi
echo 'model:' `uname -i 2>/dev/null`
if [ `uname -p` = i386 ]; then
echo 'begin prtconf:'
is replaced with:
echo 'model:' `uname -i 2>/dev/null`
if [ -x /usr/sbin/virtinfo ]; then
# LDOM support for Solaris 11 in system/core-os, and Solaris 9/10 in SUNWcsu
echo 'begin virtinfo:'
PRIV_VIRTINFO /usr/sbin/virtinfo -ap 2>/dev/null
echo 'end virtinfo:'
fi
if [ `uname -p` = i386 ]; then
echo 'begin prtconf:'
The following code:
/usr/sbin/zoneadm list -ip 2>/dev/null
echo 'end zoneadm:'
fi
if [ -x /usr/sbin/virtinfo ]; then
# LDOM support for Solaris 11 in system/core-os, and Solaris 9/10 in SUNWcsu
echo 'begin virtinfo:'
PRIV_VIRTINFO /usr/sbin/virtinfo -ap 2>/dev/null
echo 'end virtinfo:'
fi
echo 'begin solaris_uptime_string:'
uptime 2>/dev/null
echo 'end solaris_uptime_string:'
is replaced with:
echo 'end zoneadm:'
fi
echo 'begin solaris_uptime_string:'
uptime 2>/dev/null
echo 'end solaris_uptime_string:'
IRIX
initialise
The following code is added:
# If we are running as root there is no need for privilege elevation
if [ `whoami` = "root" ]; then
PRIV_CAT() {
cat "$@"
}
PRIV_DF() {
"$@"
}
PRIV_LS() {
ls "$@"
}
PRIV_LSOF() {
"$@"
}
PRIV_RUNCMD() {
"$@"
}
PRIV_TEST() {
test "$@"
}
else
## BEGIN PRIVILEGE FUNCTIONS ###############################################
# Privilege command : None
############################################################################
...
## END PRIVILEGE FUNCTIONS ###############################################
fi # End of check for root user