| Library file | Function | Sections | Content | help file |
|---|---|---|---|---|
| bmtNetwork | bmtNetworkFunc | 301-310 | Network | bmtNetwork.md |
- 301 Check if a website is up
- 302 Weather forecast
- 303 Get public/external IP address
- 304 Get local IP address of a named interface
- 305 Resolve hostname to IP
- 306 Check if a TCP port is open on a host
- 307 Ping
- 308 Download a file
- 309 Active Network Interfaces
- 310 ssh check
Keyword checknet, first option url of website. Returns 0 for connectivity , 2 for no connectivity
- Param $2 The URL
- Param $3 NOMES(optional) can be used to surpress verbose output.
- Return 0 success / 2 fail
bmtNetworkFunc checknet "www.google.ie"bmtNetworkFunc checknet "www.google.ie" "NOMES"Weather report by wttr.in, uses wget utility
- Param $2 Type a City name, airport code, domain name or area code:-
- Param $3 format 1-4
- Return 0 success / 2 fail
bmtNetworkFunc weather Dublin 4Get public/external IP address, tool: curl icanhazip.com
- Param $2: NOMES (optional) suppress output, result still returned via echo.
- Return 0 success / 2 fail
bmtNetworkFunc publicipGet local IP address of a named or default interface, tool: ip addr / hostname -I
- Param $2: interface name (optional, defaults to first non-loopback interface).
- Param $3: NOMES (optional) suppress output, result echoed for capture.
- Return 0 success / 2 fail
bmtNetworkFunc localipResolve hostname to IP (or IP to hostname), tool: dig / nslookup Uses the 'host' utility which is part of bind-utils / dnsutils.
- Param $2: hostname or IP to look up.
- Param $3: NOMES (optional) suppress output, raw result echoed for capture.
- Return 0 success / 2 fail
bmtNetworkFunc dnslookup www.google.comCheck if a TCP port is open on a host, tool: nc (netcat) Uses netcat zero-I/O mode with a 3 second timeout.
- Param $2: hostname or IP.
- Param $3: port number.
- Param $4: NOMES (optional) suppress output.
- Return 0 success / 2 fail
bmtNetworkFunc portcheck "www.google.ie" 80Ping a host N times, tool: ping
- Param $2: hostname or IP.
- Param $3: number of ping attempts (optional, default 4).
- Param $4: NOMES (optional) suppress output.
- Return 0 success / 2 fail
bmtNetworkFunc pingh "www.google.ie" 5Download a file to a destination with error handling, tool: wget / curl -O Uses wget; falls back to curl if wget is not available.
- Param $2: URL to download.
- Param $3: destination directory or file path (optional, defaults to current dir).
- Param $4: NOMES (optional) suppress progress output.
- Return 0 success / 2 fail
bmtNetworkFunc download "https://icanhazip.com" "/tmp" "NOMES"List active network interfaces and their IPv4 addresses, tool: ip -br addr
- Param $2: NOMES (optional) suppress headers, output raw lines for parsing.
- Return 0 success / 2 fail
bmtNetworkFunc netifCheck if SSH port is reachable on a host
- Param $2: hostname or IP.
- Param $3: port number (optional, default 22).
- Param $4: NOMES (optional) suppress output.
bmtNetworkFunc sshcheck "www.google.ie" 80