Procs
proc cxDig(ipadd: string): tuple
-
cxDig
returns reverse DNS of an ip address
needs dig command available on system
may or may not return expected data
see showDig() for display
proc cxDns(dns: string): tuple
-
cxDns
also see showHosts()
proc cxPortCheck(cmd: string = "lsof -i") {. ...raises: [IOError, ValueError, OSError], tags: [WriteIOEffect, ReadEnvEffect, ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
-
cxPortCheck
shows the list of all network connections which are
listening and established.
This runs a linux system command to see what the ports are listening to
if no or partial output at all run your program with sudo
proc getIpInfo(ip: string): JsonNode {....raises: [IOError, KeyError, JsonParsingError, ValueError, HttpRequestError, ProtocolError, Exception, SslError, TimeoutError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect], forbids: [].}
-
getIpInfo
use ip-api.com free service limited to abt 250 requests/min
exceeding this you will need to unlock your wan ip manually at their site
the JsonNode is returned for further processing if needed
and can be queried like so
var jj = getIpInfo("208.80.152.201") for x in mpairs(jj): echo x echo() echo jj["city"].getstr
proc getWanIP(): string {....raises: [], tags: [ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
-
getWanIP
using curl and ifconfig to get the wanip alternatively use getWanIp2() .
proc getWanIp2(): string {.discardable, ...raises: [Exception], tags: [ ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect], forbids: [].}
- getWanIP2 https://www.myip.com/api-docs/
proc localIp(): seq[string] {....raises: [OSError, IOError], tags: [ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
proc localRouterIp(): string {....raises: [OSError, IOError], tags: [ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
proc myIdentIP(): string {....raises: [ValueError, HttpRequestError, KeyError, Exception, ProtocolError, SslError, IOError, TimeoutError], tags: [RootEffect, ReadIOEffect, WriteIOEffect, TimeEffect], forbids: [].}
proc pingy(dest: string; pingcc: int = 3; col: string = termwhite; show: bool = true): int {.discardable, ...raises: [OSError, IOError, ValueError], tags: [ ExecIOEffect, ReadIOEffect, RootEffect, WriteIOEffect, ReadEnvEffect], forbids: [].}
-
pingy
small utility to ping some server
pingy("yahoo.com",4,dodgerblue) # 4 pings and display progress in some color pingy("google.com",8,aqua) pingy("ping.sunet.se",4,lime)
proc showDig(hostip: string = $"172.217.5.14") {. ...raises: [IOError, OSError, ValueError, Exception], tags: [WriteIOEffect, ExecIOEffect, ReadIOEffect, RootEffect, ReadEnvEffect], forbids: [].}
-
showDig
reverse dns lookup , default a google ip
proc showDns(hostdns: string = "google.com") {. ...raises: [IOError, OSError, ValueError, Exception], tags: [WriteIOEffect, ExecIOEffect, ReadIOEffect, RootEffect, ReadEnvEffect], forbids: [].}
-
showDns
ip and connected hosts look up for a domain name
default = google.com
showDns("bbc.com")
proc showHosts(dm: string) {....raises: [IOError, ValueError], tags: [ WriteIOEffect, ReadEnvEffect, ReadIOEffect], forbids: [].}
-
showHosts
displays IP addresses for a domain name and
may resolve multiple IP pointing to same domain
import nimcx showHosts("bbc.co.uk") doFinish()
proc showIpInfo(ip: string) {....raises: [Exception, IOError, ValueError], tags: [ ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect, ReadEnvEffect], forbids: [].}
-
showIpInfo
Displays details for a given IP
Example:
showIpInfo("208.80.152.201") showIpInfo(getHosts("bbc.com")[0])
proc showLocalIpInfo() {....raises: [IOError, ValueError, OSError], tags: [ WriteIOEffect, ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
proc showMyIdentIP() {....raises: [ValueError, HttpRequestError, KeyError, Exception, ProtocolError, SslError, IOError, TimeoutError], tags: [RootEffect, ReadIOEffect, WriteIOEffect, TimeEffect], forbids: [].}
proc showWanIpInfo() {....raises: [IOError, ValueError], tags: [WriteIOEffect, ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}
proc wifiStatus() {....raises: [OSError, IOError], tags: [ExecIOEffect, ReadIOEffect, RootEffect], forbids: [].}