&1") -- redirect stderr to stdout local cmdOutput = pipe:read("*a") pipe:close() return cmdOutput end if (ButtonType and ButtonType == "ping") then local inputTable = web.cgiToLuaTable(cgi) local throughVpn = false local ipToPing = inputTable["ping.ip"] local pingfile = db.getAttribute("environment", "name", "PING_FILE_NAME", "value") local pingprog = "" if (inputTable["ping.throughVpn"] ~= nil and inputTable["ping.throughVpn"] == "1") then throughVpn = true end -- ping if(ipToPing:find(":")) then if (throughVpn) then NextPage = "systemCheck" statusMessage = "IPv6 support is not available for vipsecure" else pingprog = db.getAttribute("environment", "name", "PING6_PROGRAM", "value") local options1 = " 2>&1 " local cmd_pingIPv6 = pingprog .. " " .. ipToPing .. options1 .. " > " .. pingfile globalCmdOutput = runShellCmd (cmd_pingVPN) statusMessage = "Pinging " .. ipToPing end else if (throughVpn) then pingprog = db.getAttribute("environment", "name", "VPN_PING_PROGRAM", "value") local lanConfig = db.getRowWhere ("ifStatic","LogicalIfName = 'LAN' and AddressFamily = 2") if (lanConfig ~= nil) then local lanIpAddr = lanConfig["ifStatic.StaticIp"] options1 = " 2>&1 " local cmd_pingVPN = pingprog .. " " .. lanIpAddr .. " " .. ipToPing .. " " .. pingfile globalCmdOutput = runShellCmd (cmd_pingVPN) statusMessage = "Pinging " .. ipToPing else NextPage = "systemCheck" statusMessage = "Ping through vpn tunnel failed" end else pingprog = db.getAttribute("environment", "name", "PING_PROGRAM", "value") options1 = " 2>&1 " local cmd_ping = pingprog .. " " .. ipToPing .. " " .. options1 .. " > " .. pingfile globalCmdOutput = runShellCmd (cmd_ping) statusMessage = "Pinging " .. ipToPing end end web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "traceroute") then local inputTable = web.cgiToLuaTable(cgi) local options = " 2>&1 | grep -v argc" globalCmd = "2" -- join fields local ipToTraceRoute = inputTable["ping.ip"] -- trace route local traceRouteProg = "" if(ipToTraceRoute:find(".")) then traceRouteProg = db.getAttribute("environment", "name", "TRACEROUTE_PROGRAM", "value") elseif(ipToTraceRoute:find(":")) then traceRouteProg = db.getAttribute("environment", "name", "TRACEROUTE6_PROGRAM", "value") end if (traceRouteProg ~= "") then util.appendDebugOut(traceRouteProg .. ipToTraceRoute) local cmd = traceRouteProg .. " " .. ipToTraceRoute .. options globalCmdOutput = runShellCmd(cmd) end statusMessage = "Traceroute To " .. ipToTraceRoute .. "..." web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "dnslookup") then local internetNameToNsLookup = cgi.nslookup -- dnslookup local nsLookupProg = db.getAttribute("environment", "name", "NSLOOKUP_PROGRAM", "value") local nsLookupFile = db.getAttribute("environment", "name", "PING_FILE_NAME", "value") util.appendDebugOut("Exec = " .. os.execute(nsLookupProg .. " " .. internetNameToNsLookup .. " > " .. nsLookupFile)) statusMessage = "DNS Lookup for " .. internetNameToNsLookup web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "ipv4RouteDisplay") then -- ipv4 routing Display local routeProg = db.getAttribute("environment", "name", "ROUTE_PROGRAM", "value") local routeFile = db.getAttribute("environment", "name", "PING_FILE_NAME", "value") util.appendDebugOut("Exec = " .. os.execute(routeProg .. " > " .. routeFile)) statusMessage = "Route Display..." web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "ipv6RouteDisplay") then -- ipv6 routing Display local routeFile = db.getAttribute("environment", "name", "PING_FILE_NAME", "value") local route6Prog = db.getAttribute("environment", "name", "ROUTE6_PROGRAM", "value") util.appendDebugOut("Exec = " .. os.execute(route6Prog .. " > " .. routeFile)) statusMessage = "Route Display..." web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "packetTrace") then web.goToPage(NextPage, true, true) else local ipMode = db.getAttribute ("networkInfo", "_ROWID_", "1", "netWorkMode") or '' ?> $|COMPANY_NAME|$ : $|APP_NAME|$
$| statusMessage |$
System CheckLogout
$| initialDescription or '' |$
 
Ping or Trace an IP Address
IP Address / Domain Name:
 
 
Perform a DNS Lookup
Internet Name:
 
 
Router Options
Display the IPv4 Routing Table:
Display the IPv6 Routing Table:
Capture Packets:
Helpful Hints...
$| helpfullHints or '' |$