added dnsinfo console command
Bryan Roe committed
Jan 26, 2021 at 14:39 UTC
2f4d584c83dcad2bc66b8b628d1c7aa94b1fa6a1
1 file changed
+17
agents/meshcore.js
+17
@@ -2654,6 +2654,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
2654
switch (cmd) {
2655
case 'help': { // Displays available commands
2656
var fin = '', f = '', availcommands = 'agentupdate,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg';
2657
+ if (require('os').dns != null) { availcommands += ',dnsinfo'; }
2658
if (process.platform == 'win32') { availcommands += ',safemode,wpfhwacceleration,uac'; }
2659
if (amt != null) { availcommands += ',amt,amtconfig,amtevents'; }
2660
if (process.platform != 'freebsd') { availcommands += ',vm'; }
@@ -2679,6 +2680,22 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
2680
case 'msh':
2681
response = JSON.stringify(_MSH(), null, 2);
2682
break;
2683
+ case 'dnsinfo':
2684
+ if (require('os').dns == null)
2685
+ {
2686
+ response = "Unknown command \"" + cmd + "\", type \"help\" for list of avaialble commands.";
2687
+ }
2688
+ else
2689
+ {
2690
+ response = 'DNS Servers: ';
2691
+ var dns = require('os').dns();
2692
+ for(var i=0;i<dns.length;++i)
2693
+ {
2694
+ if (i > 0) { response += ', ';}
2695
+ response += dns[i];
2696
+ }
2697
+ }
2698
+ break;
2699
case 'timerinfo':
2700
response = require('ChainViewer').getTimerInfo();
2701
break;