mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-11-20 18:06:05 -05:00
fix defender and add defender to console command
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
@@ -4038,7 +4038,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
|
|||||||
var response = null;
|
var response = null;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'help': { // Displays available commands
|
case 'help': { // Displays available commands
|
||||||
var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coreinfoupdate,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,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,task,uninstallagent,display,openfile';
|
var fin = '', f = '', availcommands = 'domain,translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coreinfoupdate,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg,task,uninstallagent,display,openfile';
|
||||||
if (require('os').dns != null) { availcommands += ',dnsinfo'; }
|
if (require('os').dns != null) { availcommands += ',dnsinfo'; }
|
||||||
try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
|
try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { }
|
||||||
if (process.platform == 'win32') {
|
if (process.platform == 'win32') {
|
||||||
@@ -4046,7 +4046,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
|
|||||||
if (bcdOK()) { availcommands += ',safemode'; }
|
if (bcdOK()) { availcommands += ',safemode'; }
|
||||||
if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; }
|
if (require('notifybar-desktop').DefaultPinned != null) { availcommands += ',privacybar'; }
|
||||||
try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { }
|
try { require('win-utils'); availcommands += ',taskbar'; } catch (ex) { }
|
||||||
try { require('win-info'); availcommands += ',installedapps,qfe'; } catch (ex) { }
|
try { require('win-info'); availcommands += ',installedapps,qfe,defender,av'; } catch (ex) { }
|
||||||
}
|
}
|
||||||
if (amt != null) { availcommands += ',amt,amtconfig,amtevents'; }
|
if (amt != null) { availcommands += ',amt,amtconfig,amtevents'; }
|
||||||
if (process.platform != 'freebsd') { availcommands += ',vm'; }
|
if (process.platform != 'freebsd') { availcommands += ',vm'; }
|
||||||
@@ -4884,6 +4884,14 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
|
|||||||
response = 'Not supported on the platform';
|
response = 'Not supported on the platform';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'defender':
|
||||||
|
if (process.platform == 'win32') {
|
||||||
|
// Windows Command: "wmic /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct get /FORMAT:CSV"
|
||||||
|
response = JSON.stringify(require('win-info').defender(), null, 1);
|
||||||
|
} else {
|
||||||
|
response = 'Not supported on the platform';
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'log':
|
case 'log':
|
||||||
if (args['_'].length != 1) { response = 'Proper usage: log "sample text"'; } else { MeshServerLog(args['_'][0]); response = 'ok'; }
|
if (args['_'].length != 1) { response = 'Proper usage: log "sample text"'; } else { MeshServerLog(args['_'][0]); response = 'ok'; }
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -244,7 +244,10 @@ function defender(){
|
|||||||
try {
|
try {
|
||||||
var tokens = require('win-wmi').query('ROOT\\Microsoft\\Windows\\Defender', 'SELECT * FROM MSFT_MpComputerStatus', ['RealTimeProtectionEnabled','IsTamperProtected','AntivirusSignatureVersion','AntivirusSignatureLastUpdated']);
|
var tokens = require('win-wmi').query('ROOT\\Microsoft\\Windows\\Defender', 'SELECT * FROM MSFT_MpComputerStatus', ['RealTimeProtectionEnabled','IsTamperProtected','AntivirusSignatureVersion','AntivirusSignatureLastUpdated']);
|
||||||
if (tokens[0]){
|
if (tokens[0]){
|
||||||
return ({ RealTimeProtection: tokens[0].RealTimeProtectionEnabled, TamperProtected: tokens[0].IsTamperProtected, AntivirusSignatureVersion: tokens[0].AntivirusSignatureVersion, AntivirusSignatureLastUpdated: tokens[0].AntivirusSignatureLastUpdated });
|
var info = { RealTimeProtection: tokens[0].RealTimeProtectionEnabled, TamperProtected: tokens[0].IsTamperProtected };
|
||||||
|
if (tokens[0].AntivirusSignatureVersion) { info.AntivirusSignatureVersion = tokens[0].AntivirusSignatureVersion; }
|
||||||
|
if (tokens[0].AntivirusSignatureLastUpdated) { info.AntivirusSignatureLastUpdated = tokens[0].AntivirusSignatureLastUpdated; }
|
||||||
|
return (info);
|
||||||
} else {
|
} else {
|
||||||
return ({});
|
return ({});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user