mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 21:55:52 -05:00
All JavaScript code is now 'strict'
This commit is contained in:
parent
f6b6fe9506
commit
312b937e62
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a MeshAgent object, called upon connection
|
||||
module.exports.CreateAmtEventsHandler = function (parent) {
|
||||
var obj = {};
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a Intel AMT Scanner object
|
||||
module.exports.CreateAmtScanner = function (parent) {
|
||||
var obj = {};
|
||||
@ -68,11 +70,10 @@ module.exports.CreateAmtScanner = function (parent) {
|
||||
rangeinfo.server.on('listening', () => {
|
||||
for (var i = rangeinfo.min; i <= rangeinfo.max; i++) { rangeinfo.server.send(obj.rpacket, 623, obj.IPv4NumToStr(i)); }
|
||||
});
|
||||
rangeinfo.timer = setTimeout(function () {
|
||||
rangeinfo.timer = setTimeout(function () { // ************************* USER OF OUTER VARS!!!!!!!!!!!!!!!
|
||||
obj.parent.DispatchEvent(['*', userid], obj, { action: 'scanamtdevice', range: rangeinfo.range, results: rangeinfo.results, nolog: 1 });
|
||||
rangeinfo.server.close();
|
||||
delete rangeinfo.server;
|
||||
delete rangeinfo;
|
||||
}, 3000);
|
||||
return true;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.1.0e
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports.CreateAmtScriptEngine = function () {
|
||||
var o = {};
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports.CertificateOperations = function () {
|
||||
var obj = {};
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
// Binary encoding and decoding functions
|
||||
|
2
db.js
2
db.js
@ -6,6 +6,8 @@
|
||||
* @version v0.0.2
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
//
|
||||
// Construct Meshcentral database object
|
||||
//
|
||||
|
@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const exeJavaScriptGuid = 'B996015880544A19B7F7E9BE44914C18';
|
||||
const exeMeshPolicyGuid = 'B996015880544A19B7F7E9BE44914C19';
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.3
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
const common = require('./common.js');
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.2
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports.CreateLetsEncrypt = function (parent) {
|
||||
try {
|
||||
const greenlock = require('greenlock');;
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
var certStore = null;
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var AgentConnectCount = 0;
|
||||
|
||||
// Construct a MeshAgent object, called upon connection
|
||||
@ -423,9 +425,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
|
||||
// Process incoming agent JSON data
|
||||
function processAgentData(msg) {
|
||||
var str = msg.toString('utf8');
|
||||
var str = msg.toString('utf8'), command = null;
|
||||
if (str[0] == '{') {
|
||||
try { command = JSON.parse(str) } catch (e) { console.log('Unable to parse agent JSON (' + obj.remoteaddr + '): ' + str); return; } // If the command can't be parsed, ignore it.
|
||||
try { command = JSON.parse(str) } catch (ex) { console.log('Unable to parse agent JSON (' + obj.remoteaddr + '): ' + str, ex); return; } // If the command can't be parsed, ignore it.
|
||||
if (typeof command != 'object') { return; }
|
||||
switch (command.action) {
|
||||
case 'msg':
|
||||
{
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// If app metrics is available
|
||||
if (process.argv[2] == '--launch') { try { require('appmetrics-dash').monitor({ url: '/', title: 'MeshCentral', port: 88, host: '127.0.0.1' }); } catch (e) { } }
|
||||
|
||||
@ -420,7 +422,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
if ((obj.args.nousers == true) && (obj.args.userallowedip == null)) { obj.args.userallowedip = "::1,127.0.0.1"; }
|
||||
|
||||
// Set the session length to 60 minutes if not set and set a random key if needed
|
||||
if ((obj.args.sessiontime == null) || (typeof obj.args.sessiontime != 'number') || (obj.args.sessiontime < 1)) { obj.args.sessiontime = 60; }
|
||||
if ((obj.args.sessiontime != null) && ((typeof obj.args.sessiontime != 'number') || (obj.args.sessiontime < 1))) { delete obj.args.sessiontime; }
|
||||
if (!obj.args.sessionkey) { obj.args.sessionkey = buf.toString('hex').toUpperCase(); }
|
||||
|
||||
// Start eh web server and if needed, the redirection web server.
|
||||
@ -594,7 +596,6 @@ function CreateMeshCentralServer(config, args) {
|
||||
}
|
||||
}
|
||||
if ((fromPeerServer == null) && (obj.multiServer != null) && ((typeof event != 'object') || (event.nopeers != 1))) { obj.multiServer.DispatchEvent(ids, source, event); }
|
||||
delete targets;
|
||||
}
|
||||
|
||||
// Get the connection state of a node
|
||||
@ -742,6 +743,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
|
||||
if (obj.multiServer == null) {
|
||||
// Single server mode
|
||||
var eventConnectChange = 0;
|
||||
|
||||
// Remove the agent connection from the nodes connection list
|
||||
var state = obj.connectivityByNode[nodeid];
|
||||
@ -1082,7 +1084,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
if ((name != null) && (meshServerState[name] != val)) { if ((val == null) && (meshServerState[name] != null)) { delete meshServerState[name]; changed = true; } else { if (meshServerState[name] != val) { meshServerState[name] = val; changed = true; } } }
|
||||
if (changed == false) return;
|
||||
}
|
||||
r = 'time=' + Date.now() + '\r\n';
|
||||
var r = 'time=' + Date.now() + '\r\n';
|
||||
for (var i in meshServerState) { r += (i + '=' + meshServerState[i] + '\r\n'); }
|
||||
obj.fs.writeFileSync(obj.getConfigFilePath('serverstate.txt'), r);
|
||||
}
|
||||
@ -1173,7 +1175,6 @@ function InstallModules(modules, func) {
|
||||
function InstallModule(modulename, func, tag1, tag2) {
|
||||
try {
|
||||
var module = require(modulename);
|
||||
delete module;
|
||||
} catch (e) {
|
||||
console.log('Installing ' + modulename + '...');
|
||||
var child_process = require('child_process');
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a MeshAgent object, called upon connection
|
||||
module.exports.CreateMeshMain = function (parent) {
|
||||
var obj = {};
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports.CreateMeshRelay = function (parent, ws, req, domain) {
|
||||
var obj = {};
|
||||
obj.ws = ws;
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a Mesh Scanner object
|
||||
// TODO: We need once "server4" and "server6" per interface, or change the default multicast interface as we send.
|
||||
module.exports.CreateMeshScanner = function (parent) {
|
||||
@ -27,9 +29,9 @@ module.exports.CreateMeshScanner = function (parent) {
|
||||
var ipv4 = ['*'], ipv6 = ['*']; // Bind to IN_ADDR_ANY always
|
||||
var interfaces = require('os').networkInterfaces();
|
||||
for (var i in interfaces) {
|
||||
var interface = interfaces[i];
|
||||
for (var j in interface) {
|
||||
var interface2 = interface[j];
|
||||
var xinterface = interfaces[i];
|
||||
for (var j in xinterface) {
|
||||
var interface2 = xinterface[j];
|
||||
if ((interface2.mac != '00:00:00:00:00:00') && (interface2.internal == false)) {
|
||||
if (interface2.family == 'IPv4') { ipv4.push(interface2.address); }
|
||||
if (interface2.family == 'IPv6') { ipv6.push(interface2.address + '%' + i); }
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a MeshAgent object, called upon connection
|
||||
module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
var obj = {};
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a Intel AMT MPS server object
|
||||
module.exports.CreateMpsServer = function (parent, db, args, certificates) {
|
||||
var obj = {};
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a Mesh Multi-Server object. This is used for MeshCentral-to-MeshCentral communication.
|
||||
module.exports.CreateMultiServer = function (parent, args) {
|
||||
var obj = {};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.1.9-q",
|
||||
"version": "0.1.9-r",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
2
pass.js
2
pass.js
@ -1,5 +1,7 @@
|
||||
// check out https://github.com/tj/node-pwd
|
||||
|
||||
'use strict';
|
||||
|
||||
// Module dependencies.
|
||||
const crypto = require('crypto');
|
||||
|
||||
|
@ -754,21 +754,20 @@ function processSystemStatus(a,b,c,d){if(void 0==c.IPS_ScreenConfigurationServic
|
||||
QV("go13",!0);d=0;for(var f in c)null!=c[f]&&c[f].status>d&&(d=c[f].status);400!=d&&errcheck(d,a)||(amtsysstate=c,updateSystemStatus())}var DMTFPowerStates=";;Power on;Light sleep;Deep sleep;Power cycle (Soft off);Off - Hard;Hibernate (Off soft);Soft off;Power cycle (Off-hard);Master bus reset;Diagnostic interrupt (NMI);Not applicable;Off - Soft graceful;Off - Hard graceful;Master bus reset graceful;Power cycle (Off - Soft graceful);Power cycle (Off - Hard graceful);Diagnostic interrupt (INIT)".split(";");
|
||||
function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){var a=0,b,c,d=TableStart(),f="",n=amtsysstate.AMT_GeneralSettings.response;t="Unknown";null!=amtsysstate.CIM_ServiceAvailableToElement&&(t=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState]);n.PowerSource&&(t+=[", Plugged-in",", On Battery"][n.PowerSource]);d+=TableEntry("Power",addLink(t,"showPowerActionDlg()"));b=n.HostName;c=n.DomainName;null!=c&&0<c.length&&(b+="."+c);b=0==b.length?"<i>None</i>":EscapeHtml(b);
|
||||
d+=TableEntry("Name & Domain",addLinkConditional(b,"showEditNameDlg()",xxAccountAdminName));HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var p="",r=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==r.ProvisioningState&&5<amtversion&&(p=" activated in Admin Control Mode (ACM)",4==r.ProvisioningMode&&(p=" activated in Client Control Mode (CCM)",a=9));
|
||||
d+=TableEntry("Intel® ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+p)}QV("id_p13warning2",2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState);QV("id_p14warning2",2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState);if(200==amtsysstate.AMT_RedirectionService.status){var p=amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,r=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),l=amtfeatures[2]=
|
||||
0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),k=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(k=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);p&&(f+=", Redirection Port");r&&(f+=", Serial-over-LAN");l&&(f+=", IDE-Redirect");k&&(f+=", KVM");
|
||||
""==f&&(f=" None");d+=TableEntry("Active Features",addLinkConditional(f.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&(p=amtsysstate.IPS_KVMRedirectionSettingData.response,f="Primary display",7<amtversion&&void 0!==p.DefaultScreen&&255>p.DefaultScreen&&(f=["Primary display","Secondary display","3rd display"][p.DefaultScreen]),f='<span title="The default remote display is the '+f.toLowerCase()+
|
||||
'">'+f+"</span>",1==p.Is5900PortEnabled&&(f+=", Port 5900 enabled"),1==p.OptInPolicy&&(f+=", "+p.OptInPolicyTimeout+" second"+(0<p.OptInPolicyTimeout?"s":"")+" opt-in"),f+=", "+p.SessionTimeout+" minute"+(0<p.SessionTimeout?"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?((p=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&1))&&(f+=", Blanking Allowed"),QV("id_DeskSBspan",p),Q("id_DeskSB").checked=!1):QV("id_DeskSBspan",!1),d+=TableEntry("Remote Desktop",
|
||||
f));5<amtversion&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&(f="Unknown state",p=amtsysstate.IPS_OptInService.response.OptInRequired,0==p&&(f="Not Required"),1==p&&(f="Required for KVM only"),4294967295==p&&(f="Always Required"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&(f=addLinkConditional(f,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("User Consent",f));if(null!=AmtSystemPowerSchemes)for(f=amtsysstate.CIM_ElementSettingData.responses,
|
||||
p=0;p<f.length;p++)if(f[p].SettingData&&1==f[p].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==f[p].SettingData.ReferenceParameters.ResourceURI)for(r=f[p].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,l=0;l<AmtSystemPowerSchemes.length;l++)AmtSystemPowerSchemes[l].SchemeGUID==r&&(d+=TableEntry("Power Policy",addLinkConditional(AmtSystemPowerSchemes[l].Description.split(":")[1],'showPowerPolicyDlg("'+r+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Date & Time",
|
||||
(new Date((new Date).getTime()+amtdeltatime)).toLocaleString()));f=AddRefreshButton("PullSystemStatus()")+" ";f+=AddButton("Power Actions...","showPowerActionDlg()")+" ";f+=AddButton("Save State...","saveEntireAmtState()")+" ";f+=AddButton("Run Script...","script_runScriptDlg()")+" ";d+=TableEnd(f);QH(15,d);d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+TableEnd("<div> "+AddRefreshButton("PullSystemStatus(1)")+" Changing network settings may cause this page to becaume unavailable.");
|
||||
d=d+"<br><h2>General Settings</h2>"+TableStart();f="";"<i>None</i>"!=b&&(1==n.SharedFQDN&&(f=", shared with OS"),0==n.SharedFQDN&&(f=", different from OS"));d+=TableEntry("Name & Domain",addLinkConditional(b+f,"showEditNameDlg(1)",xxAccountAdminName));b="Disabled";1==n.DDNSUpdateEnabled?b="Enabled each "+n.DDNSPeriodicUpdateInterval+" minutes, TTL is "+n.DDNSTTL+" minutes":1==n.DDNSUpdateByDHCPServerEnabled&&(b="Update by DHCP server");d+=TableEntry("Dynamic DNS",addLinkConditional(b,"showEditDnsDlg()",
|
||||
xxAccountAdminName));d+=TableEnd();for(c in amtsysstate.AMT_EthernetPortSettings.responses){b=amtsysstate.AMT_EthernetPortSettings.responses[c];if(b.WLANLinkProtectionLevel||1==c)amtwirelessif=c;if(0!=c||amtwirelessif==c||"00-00-00-00-00-00"!=b.MACAddress){0==c&&a++;d+="<br><h2>"+(amtwirelessif==c?"Wireless":"Wired")+" Interface</h2>";d+=TableStart();d+=TableEntry("Link state",1==b.LinkIsUp?"Link is up":"Link is down");"00-00-00-00-00-00"!=b.MACAddress&&(d+=TableEntry("MAC address",b.MACAddress));
|
||||
amtwirelessif==c&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("State",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Radio State",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"<i>None</i>")));amtwirelessif!=c&&(d+=TableEntry("Respond to ping",addLinkConditional(["Disabled","ICMP response","RMCP response",
|
||||
"ICMP & RMCP response"][n.PingResponseEnabled+(n.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),d+=TableEntry("IPv4 state",addLinkConditional(1==b.DHCPEnabled?"Automatic using DHCP server":"Static IP address","showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4 address",isIpAddress(b.IPAddress,"None"));isIpAddress(b.DefaultGateway)&&(d+=TableEntry("IPv4 gateway / Mask",b.DefaultGateway+" / "+isIpAddress(b.SubnetMask,"None")));f=b.PrimaryDNS;isIpAddress(f)&&(b.SecondaryDNS&&
|
||||
(f+=" / "+b.SecondaryDNS),d+=TableEntry("IPv4 domain name server",f));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5<amtversion){b=amtsysstate.IPS_IPv6PortSettings.responses[c];for(var r="Disabled",u,f=amtsysstate.CIM_ElementSettingData.responses,p=0;p<f.length;p++)f[p].SettingData&&f[p].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+c&&(u=1==f[p].IsCurrent);1==u&&(f=isIpAddress(b.IPv6Address)||isIpAddress(b.DefaultRouter)||isIpAddress(b.PrimaryDNS)||
|
||||
isIpAddress(b.SecondaryDNS),r="Enabled, Automatic "+(f?"& manual":"")+" addresses");d+=TableEntry("IPv6 state",addLinkConditional(r,"showIPv6StateDlg("+c+","+u+")",xxAccountAdminName));if(1==u){if(b.CurrentAddressInfo&&0<b.CurrentAddressInfo.length){b.CurrentAddressInfo=MakeToArray(b.CurrentAddressInfo);ipv6addr="";for(p=0;p<b.CurrentAddressInfo.length;p++)0<ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=b.CurrentAddressInfo[p].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,"showIPv6AddrDlg("+
|
||||
c+',"'+b.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(b.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",b.CurrentDefaultRouter));isIpAddress(b.CurrentPrimaryDNS)&&(f=b.CurrentPrimaryDNS,isIpAddress(b.CurrentSecondaryDNS)&&(f+=" / "+b.CurrentSecondaryDNS),d+=TableEntry("IPv6 domain name server",f))}}d+=TableEnd()}}-1!=amtwirelessif&&0==(amtFirstPull&2)&&PullWireless();QH(19,d);1==a&&0==(amtFirstPull&4)&&PullSystemDefense();0==
|
||||
(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage();0==currentView&&go(1,1)}}function isIpAddress(a,b){return a&&null!=a&&0<a.length&&"::"!=a&&"::0"!=a?a:b}var IntelAmtEntireState,IntelAmtEntireStateCalls;
|
||||
d+=TableEntry("Intel® ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+p)}if(200==amtsysstate.AMT_RedirectionService.status){var p=amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,r=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),l=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),k=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(k=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&
|
||||
2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);p&&(f+=", Redirection Port");r&&(f+=", Serial-over-LAN");l&&(f+=", IDE-Redirect");k&&(f+=", KVM");""==f&&(f=" None");d+=TableEntry("Active Features",addLinkConditional(f.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&
|
||||
(p=amtsysstate.IPS_KVMRedirectionSettingData.response,f="Primary display",7<amtversion&&void 0!==p.DefaultScreen&&255>p.DefaultScreen&&(f=["Primary display","Secondary display","3rd display"][p.DefaultScreen]),f='<span title="The default remote display is the '+f.toLowerCase()+'">'+f+"</span>",1==p.Is5900PortEnabled&&(f+=", Port 5900 enabled"),1==p.OptInPolicy&&(f+=", "+p.OptInPolicyTimeout+" second"+(0<p.OptInPolicyTimeout?"s":"")+" opt-in"),f+=", "+p.SessionTimeout+" minute"+(0<p.SessionTimeout?
|
||||
"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&1)&&(f+=", Blanking Allowed"),d+=TableEntry("Remote Desktop",f));5<amtversion&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&(f="Unknown state",p=amtsysstate.IPS_OptInService.response.OptInRequired,0==p&&(f="Not Required"),1==p&&(f="Required for KVM only"),4294967295==p&&(f="Always Required"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&
|
||||
(f=addLinkConditional(f,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("User Consent",f));if(null!=AmtSystemPowerSchemes)for(f=amtsysstate.CIM_ElementSettingData.responses,p=0;p<f.length;p++)if(f[p].SettingData&&1==f[p].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==f[p].SettingData.ReferenceParameters.ResourceURI)for(r=f[p].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,l=0;l<AmtSystemPowerSchemes.length;l++)AmtSystemPowerSchemes[l].SchemeGUID==
|
||||
r&&(d+=TableEntry("Power Policy",addLinkConditional(AmtSystemPowerSchemes[l].Description.split(":")[1],'showPowerPolicyDlg("'+r+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Date & Time",(new Date((new Date).getTime()+amtdeltatime)).toLocaleString()));f=AddRefreshButton("PullSystemStatus()")+" ";f+=AddButton("Power Actions...","showPowerActionDlg()")+" ";f+=AddButton("Save State...","saveEntireAmtState()")+" ";f+=AddButton("Run Script...","script_runScriptDlg()")+" ";d+=TableEnd(f);QH(15,
|
||||
d);d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+TableEnd("<div> "+AddRefreshButton("PullSystemStatus(1)")+" Changing network settings may cause this page to becaume unavailable.");d=d+"<br><h2>General Settings</h2>"+TableStart();f="";"<i>None</i>"!=b&&(1==n.SharedFQDN&&(f=", shared with OS"),0==n.SharedFQDN&&(f=", different from OS"));d+=TableEntry("Name & Domain",addLinkConditional(b+f,"showEditNameDlg(1)",xxAccountAdminName));b="Disabled";1==n.DDNSUpdateEnabled?
|
||||
b="Enabled each "+n.DDNSPeriodicUpdateInterval+" minutes, TTL is "+n.DDNSTTL+" minutes":1==n.DDNSUpdateByDHCPServerEnabled&&(b="Update by DHCP server");d+=TableEntry("Dynamic DNS",addLinkConditional(b,"showEditDnsDlg()",xxAccountAdminName));d+=TableEnd();for(c in amtsysstate.AMT_EthernetPortSettings.responses){b=amtsysstate.AMT_EthernetPortSettings.responses[c];if(b.WLANLinkProtectionLevel||1==c)amtwirelessif=c;if(0!=c||amtwirelessif==c||"00-00-00-00-00-00"!=b.MACAddress){0==c&&a++;d+="<br><h2>"+
|
||||
(amtwirelessif==c?"Wireless":"Wired")+" Interface</h2>";d+=TableStart();d+=TableEntry("Link state",1==b.LinkIsUp?"Link is up":"Link is down");"00-00-00-00-00-00"!=b.MACAddress&&(d+=TableEntry("MAC address",b.MACAddress));amtwirelessif==c&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("State",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Radio State",
|
||||
xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"<i>None</i>")));amtwirelessif!=c&&(d+=TableEntry("Respond to ping",addLinkConditional(["Disabled","ICMP response","RMCP response","ICMP & RMCP response"][n.PingResponseEnabled+(n.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),d+=TableEntry("IPv4 state",addLinkConditional(1==b.DHCPEnabled?"Automatic using DHCP server":"Static IP address","showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4 address",
|
||||
isIpAddress(b.IPAddress,"None"));isIpAddress(b.DefaultGateway)&&(d+=TableEntry("IPv4 gateway / Mask",b.DefaultGateway+" / "+isIpAddress(b.SubnetMask,"None")));f=b.PrimaryDNS;isIpAddress(f)&&(b.SecondaryDNS&&(f+=" / "+b.SecondaryDNS),d+=TableEntry("IPv4 domain name server",f));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5<amtversion){b=amtsysstate.IPS_IPv6PortSettings.responses[c];for(var r="Disabled",u,f=amtsysstate.CIM_ElementSettingData.responses,p=0;p<f.length;p++)f[p].SettingData&&f[p].SettingData.ReferenceParameters.SelectorSet.Selector.Value==
|
||||
"Intel(r) IPS IPv6 Settings "+c&&(u=1==f[p].IsCurrent);1==u&&(f=isIpAddress(b.IPv6Address)||isIpAddress(b.DefaultRouter)||isIpAddress(b.PrimaryDNS)||isIpAddress(b.SecondaryDNS),r="Enabled, Automatic "+(f?"& manual":"")+" addresses");d+=TableEntry("IPv6 state",addLinkConditional(r,"showIPv6StateDlg("+c+","+u+")",xxAccountAdminName));if(1==u){if(b.CurrentAddressInfo&&0<b.CurrentAddressInfo.length){b.CurrentAddressInfo=MakeToArray(b.CurrentAddressInfo);ipv6addr="";for(p=0;p<b.CurrentAddressInfo.length;p++)0<
|
||||
ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=b.CurrentAddressInfo[p].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,"showIPv6AddrDlg("+c+',"'+b.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(b.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",b.CurrentDefaultRouter));isIpAddress(b.CurrentPrimaryDNS)&&(f=b.CurrentPrimaryDNS,isIpAddress(b.CurrentSecondaryDNS)&&(f+=" / "+b.CurrentSecondaryDNS),d+=TableEntry("IPv6 domain name server",f))}}d+=TableEnd()}}-1!=
|
||||
amtwirelessif&&0==(amtFirstPull&2)&&PullWireless();QH(19,d);1==a&&0==(amtFirstPull&4)&&PullSystemDefense();0==(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage();0==currentView&&go(1,1)}}function isIpAddress(a,b){return a&&null!=a&&0<a.length&&"::"!=a&&"::0"!=a?a:b}var IntelAmtEntireState,IntelAmtEntireStateCalls;
|
||||
function saveEntireAmtState(){if(!xxdialogMode){var a="",b=new Date;amtsysstate&&(a="-"+amtsysstate.AMT_GeneralSettings.response.HostName);a+="-"+b.getFullYear()+"-"+("0"+(b.getMonth()+1)).slice(-2)+"-"+("0"+b.getDate()).slice(-2)+"-"+("0"+b.getHours()).slice(-2)+"-"+("0"+b.getMinutes()).slice(-2);c18.value="amtstate"+a+".json";setDialogMode(19,"Save Entire Intel® AMT State",3,saveEntireAmtStateOk)}}
|
||||
function saveEntireAmtStateOk(){IntelAmtEntireState={webappversion:version,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()};QH(36,"Fetching entire state, please wait...");setDialogMode(1,"Save Entire Intel® AMT State",0,null);IntelAmtEntireStateCalls=3;amtstack.BatchEnum(null,AllWsman,saveEntireAmtStateOk2,null,!0);amtstack.GetAuditLog(saveEntireAmtStateOk3);amtstack.GetMessageLog(saveEntireAmtStateOk4)}
|
||||
function saveEntireAmtStateOk2(a,b,c,d){IntelAmtEntireState.wsmanenums=c;saveEntireAmtStateDone()}function saveEntireAmtStateOk3(a,b){IntelAmtEntireState.auditlog=b;saveEntireAmtStateDone()}function saveEntireAmtStateOk4(a,b){IntelAmtEntireState.eventlog=b;saveEntireAmtStateDone()}function saveEntireAmtStateDone(){0==--IntelAmtEntireStateCalls&&(setDialogMode(),saveAs(data2blob(JSON.stringify(IntelAmtEntireState,null," ").replace(/\n/g,"\r\n")),c18.value))}
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// ExpressJS login sample
|
||||
// https://github.com/expressjs/express/blob/master/examples/auth/index.js
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// Construct a legacy Swarm Server server object
|
||||
module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
|
||||
var obj = {};
|
||||
|
@ -513,12 +513,17 @@
|
||||
</div>
|
||||
<iframe name="fileUploadFrame" style=display:none></iframe>
|
||||
<script>
|
||||
'use strict';
|
||||
var debugLevel = parseInt('{{{debuglevel}}}');
|
||||
var features = parseInt('{{{features}}}');
|
||||
var sessionTime = parseInt("{{{sessiontime}}}");
|
||||
var domain = "{{{domain}}}";
|
||||
var domainUrl = "{{{domainurl}}}";
|
||||
var meshserver = null;
|
||||
var xdr = null;
|
||||
var serverinfo = null;
|
||||
var nodes = [];
|
||||
var meshes = {};
|
||||
var filetree = {};
|
||||
var userinfo = null;
|
||||
var serverinfo = null;
|
||||
@ -544,7 +549,7 @@
|
||||
go(1);
|
||||
|
||||
// Connect to the mesh server
|
||||
meshserver = MeshServerCreateControl("{{{domainurl}}}");
|
||||
meshserver = MeshServerCreateControl(domainUrl);
|
||||
meshserver.onStateChanged = onStateChanged;
|
||||
meshserver.onMessage = onMessage;
|
||||
meshserver.Start();
|
||||
@ -667,7 +672,7 @@
|
||||
switch (message.event.action) {
|
||||
case 'createmesh': {
|
||||
// A new mesh was created
|
||||
if (message.event.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()] != null) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
|
||||
if (message.event.links['user/' + domain + '/' + userinfo.name.toLowerCase()] != null) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
|
||||
meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
|
||||
updateMeshes();
|
||||
updateDevices();
|
||||
@ -688,7 +693,7 @@
|
||||
meshes[message.event.meshid].links = message.event.links;
|
||||
|
||||
// Check if we lost rights to this mesh in this change.
|
||||
if (meshes[message.event.meshid].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()] == null) {
|
||||
if (meshes[message.event.meshid].links['user/' + domain + '/' + userinfo.name.toLowerCase()] == null) {
|
||||
if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
|
||||
delete meshes[message.event.meshid];
|
||||
|
||||
@ -753,7 +758,8 @@
|
||||
var node = nodes[index];
|
||||
if (currentNode == node) {
|
||||
if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); }
|
||||
delete currentNode; // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
|
||||
currentNode = null;
|
||||
// TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
|
||||
}
|
||||
nodes.splice(index, 1);
|
||||
updateDevices();
|
||||
@ -831,7 +837,7 @@
|
||||
}
|
||||
case 'login': {
|
||||
// Update the last login time
|
||||
if (users != null && users['user/{{{domain}}}/' + message.event.username.toLowerCase()]) { users['user/{{{domain}}}/' + message.event.username.toLowerCase()].login = message.event.time; }
|
||||
if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) { users['user/' + domain + '/' + message.event.username.toLowerCase()].login = message.event.time; }
|
||||
break;
|
||||
}
|
||||
case 'notify': {
|
||||
@ -917,7 +923,7 @@
|
||||
|
||||
function account_showDeleteAccount() {
|
||||
if (xxdialogMode) return;
|
||||
var x = "<form action='{{{domainurl}}}deleteaccount' method=post><table style=margin-left:10px><tr>";
|
||||
var x = "<form action='" + domainUrl + "deleteaccount' method=post><table style=margin-left:10px><tr>";
|
||||
x += "<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";
|
||||
x += "</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";
|
||||
x += '</tr></table><div style=padding:10px;margin-bottom:4px>';
|
||||
@ -931,7 +937,7 @@
|
||||
|
||||
function account_showChangePassword() {
|
||||
if (xxdialogMode) return;
|
||||
var x = "<form action='{{{domainurl}}}changepassword' method=post><table style=margin-left:10px><tr>";
|
||||
var x = "<form action='" + domainUrl + "changepassword' method=post><table style=margin-left:10px><tr>";
|
||||
x += "<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /> <b><span id=dxPassWarn></span></b></td>";
|
||||
x += "</tr><tr><td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /></td>";
|
||||
x += "</tr><tr><td align=right>Hint:</td><td><input id=apasswordhint name=apasswordhint maxlength=250 type=text autocomplete=off /></td>";
|
||||
@ -991,7 +997,7 @@
|
||||
count++;
|
||||
|
||||
// Mesh rights
|
||||
var meshrights = meshes[i].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
var meshrights = meshes[i].links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
var rights = 'Partial Rights';
|
||||
if (meshrights == 0xFFFFFFFF) rights = 'Full Administrator'; else if (meshrights == 0) rights = 'No Rights';
|
||||
|
||||
@ -1003,7 +1009,7 @@
|
||||
r += '</div></div>';
|
||||
}
|
||||
|
||||
meshcount = count;
|
||||
//meshcount = count;
|
||||
QH('p3meshes', r);
|
||||
QV('p3noMeshFound', count == 0);
|
||||
}
|
||||
@ -1282,7 +1288,7 @@
|
||||
// Go thru the list of nodes and display them
|
||||
for (var i in nodes) {
|
||||
if (nodes[i].v == false) continue;
|
||||
var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
|
||||
var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/' + domain + '/' + userinfo.name.toLowerCase()];
|
||||
if (meshlinks == null) continue;
|
||||
var meshrights = meshlinks.rights;
|
||||
|
||||
@ -1353,7 +1359,7 @@
|
||||
// Display all empty meshes, we need to do this because users can add devices to these at any time.
|
||||
if (sort == 0) {
|
||||
for (var i in meshes) {
|
||||
var mesh = meshes[i], meshlink = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
|
||||
var mesh = meshes[i], meshlink = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()];
|
||||
if (meshlink != null) {
|
||||
var meshrights = meshlink.rights;
|
||||
if (displayedMeshes[mesh._id] == null) {
|
||||
@ -1414,7 +1420,7 @@
|
||||
if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
|
||||
deviceHeaders["DevxHeader" + deviceHeaderId] = ', ' + deviceHeaderTotal + ((deviceHeaderTotal == 1) ? ' node' : ' nodes');
|
||||
var title = '';
|
||||
for (x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
|
||||
for (var x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
|
||||
deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title;
|
||||
deviceHeaderId++;
|
||||
deviceHeaderCount = {};
|
||||
@ -1437,7 +1443,7 @@
|
||||
|
||||
function getNodeRights(nodeid) {
|
||||
var node = getNodeFromId(nodeid), mesh = meshes[node.meshid];
|
||||
return mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
return mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
}
|
||||
|
||||
var currentDevicePanel = 0;
|
||||
@ -1452,7 +1458,7 @@
|
||||
if (node == null) { goBack(); }
|
||||
var mesh = meshes[node.meshid];
|
||||
if (mesh == null) { goBack(); }
|
||||
var meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
if (!currentNode || currentNode._id != node._id || refresh == true) {
|
||||
currentNode = node;
|
||||
|
||||
@ -1580,7 +1586,7 @@
|
||||
QH('p10html3', x);
|
||||
|
||||
// Set the node power state
|
||||
powerstate = PowerStateStr(node.state);
|
||||
var powerstate = PowerStateStr(node.state);
|
||||
//if (node.state == 0) { powerstate = 'Unknown State'; }
|
||||
if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '<span style=font-size:10px title="Agent connected">Mesh Agent</span>'; }
|
||||
if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += ', '; } powerstate += '<span style=font-size:10px title="Intel® AMT connected">Intel® AMT connected</span>'; } else
|
||||
@ -1624,7 +1630,7 @@
|
||||
|
||||
function deviceActionFunction() {
|
||||
if (xxdialogMode) return;
|
||||
var meshrights = meshes[currentNode.meshid].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
var meshrights = meshes[currentNode.meshid].links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
var x = "Select an operation to perform on this device.<br /><br />";
|
||||
var y = '<select id=d2deviceop style=float:right;width:170px>';
|
||||
if ((meshrights & 64) != 0) { y += '<option value=100>Wake-up</option>'; } // Wake-up permission
|
||||
@ -1767,7 +1773,7 @@
|
||||
function p10showiconselector() {
|
||||
if (xxdialogMode) return;
|
||||
var mesh = meshes[currentNode.meshid];
|
||||
var meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
if ((meshrights & 4) == 0) return;
|
||||
|
||||
var x = '<table align=center><td>';
|
||||
@ -1822,7 +1828,7 @@
|
||||
var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50 };
|
||||
function setupDesktop() {
|
||||
// Setup the remote desktop
|
||||
if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); delete desktop; desktopNode = null; desktop = null; }
|
||||
if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
|
||||
|
||||
// If the device desktop is already connected in multi-desktop, use that.
|
||||
if ((desktopNode != currentNode) || (desktop == null)) {
|
||||
@ -1905,7 +1911,6 @@
|
||||
} else {
|
||||
// Disconnect and clean up the remote desktop
|
||||
desktop.Stop();
|
||||
delete desktop;
|
||||
desktopNode = desktop = null;
|
||||
}
|
||||
}
|
||||
@ -1921,7 +1926,6 @@
|
||||
case 0:
|
||||
// Disconnect and clean up the remote desktop
|
||||
desktop.Stop();
|
||||
delete desktop;
|
||||
desktopNode = desktop = null;
|
||||
QV('termdisplays', false);
|
||||
if (fullscreen == true) { deskToggleFull(); }
|
||||
@ -2143,7 +2147,7 @@
|
||||
filesNode = currentNode;
|
||||
var online = ((filesNode.conn & 1) != 0)?true:false; // If Agent (1) connected, enable Terminal
|
||||
QE('p13Connect', online);
|
||||
if (((samenode == false) || (online == false)) && files) { files.Stop(); delete files; files = null; }
|
||||
if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
|
||||
}
|
||||
|
||||
function onFilesStateChange(xfiles, state) {
|
||||
@ -2160,7 +2164,7 @@
|
||||
QH('p13currentpath', '');
|
||||
QE('p13FolderUp', false);
|
||||
p13setActions();
|
||||
if (files != null) { files.Stop(); delete files; files = null; }
|
||||
if (files != null) { files.Stop(); files = null; }
|
||||
break;
|
||||
case 3:
|
||||
p13targetpath = '';
|
||||
@ -2191,13 +2195,11 @@
|
||||
} else {
|
||||
//QH('Term', '');
|
||||
files.Stop();
|
||||
delete files;
|
||||
files = null;
|
||||
}
|
||||
p13clipboard = p13clipboardFolder = null;
|
||||
p13clipboardCut = 0;
|
||||
p13updateClipview();
|
||||
p13oldlinkpath = null;
|
||||
}
|
||||
|
||||
var p13filetree = null;
|
||||
@ -2236,7 +2238,6 @@
|
||||
return checkedNames;
|
||||
}
|
||||
|
||||
//var p13oldlinkpath = null;
|
||||
function p13updateFiles(checkedNames) {
|
||||
var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p13folderup(0)>Root</a>', fullPath = 'Root';
|
||||
|
||||
@ -2574,7 +2575,7 @@
|
||||
if (currentMesh == null) return;
|
||||
QH('p20meshName', EscapeHtml(currentMesh.name));
|
||||
var meshtype = 'Unknown #' + currentMesh.mtype;
|
||||
var meshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
var meshrights = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
if (currentMesh.mtype == 1) meshtype = 'Intel® AMT group';
|
||||
if (currentMesh.mtype == 2) meshtype = 'Mesh agent group';
|
||||
|
||||
@ -2587,7 +2588,7 @@
|
||||
//x += '<br><input type=button value=Notes title="View notes about this mesh" onclick=showNotes(false,"' + encodeURIComponent(currentMesh._id) + '") />';
|
||||
|
||||
x += '<br style=clear:both><br>';
|
||||
var currentMeshLinks = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
|
||||
var currentMeshLinks = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()];
|
||||
if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '<div style=margin-bottom:6px><a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a></div>'; }
|
||||
|
||||
/*
|
||||
@ -2699,7 +2700,7 @@
|
||||
}
|
||||
|
||||
function p20validateAddMeshUserDialog() {
|
||||
var meshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
|
||||
var meshrights = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights;
|
||||
QE('idx_dlgOkButton', (Q('dp20username').value.length > 0));
|
||||
QE('p20fulladmin', meshrights == 0xFFFFFFFF);
|
||||
QE('p20editmesh', (!Q('p20fulladmin').checked) && (meshrights == 0xFFFFFFFF));
|
||||
@ -2730,7 +2731,7 @@
|
||||
function p20viewuser(userid) {
|
||||
if (xxdialogMode) return;
|
||||
userid = decodeURIComponent(userid);
|
||||
var r = '', cmeshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights, meshrights = currentMesh.links[userid].rights;
|
||||
var r = '', cmeshrights = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights, meshrights = currentMesh.links[userid].rights;
|
||||
if (meshrights == 0xFFFFFFFF) r = ', Full Administrator'; else {
|
||||
if ((meshrights & 1) != 0) r += ', Edit Mesh';
|
||||
if ((meshrights & 2) != 0) r += ', Manage Mesh Users';
|
||||
@ -2745,7 +2746,7 @@
|
||||
if (r == '') { r = 'No Rights'; }
|
||||
var buttons = 1, x = addHtmlValue('User', userid.split('/')[2]);
|
||||
x += addHtmlValue('Permissions', r);
|
||||
if ((('user/{{{domain}}}/' + userinfo.name.toLowerCase()) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4;
|
||||
if ((('user/' + domain + '/' + userinfo.name.toLowerCase()) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4;
|
||||
setDialogMode(2, "Mesh User", buttons, p20viewuserEx, x, userid);
|
||||
}
|
||||
|
||||
|
@ -746,6 +746,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
var args;
|
||||
var powerStatetable = ['', 'Powered', 'Sleep', 'Sleep', 'Sleep', 'Hibernating', 'Power off', 'Present'];
|
||||
var StatusStrs = ['Disconnected', 'Connecting...', 'Setup...', 'Connected', 'Intel® AMT Connected'];
|
||||
@ -1268,7 +1269,8 @@
|
||||
var node = nodes[index];
|
||||
if (currentNode == node) {
|
||||
if (xxcurrentView >= 10 && xxcurrentView < 20) { setDialogMode(0); go(1); }
|
||||
delete currentNode; // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
|
||||
currentNode = null;
|
||||
// TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
|
||||
}
|
||||
nodes.splice(index, 1);
|
||||
updateDevices();
|
||||
@ -1502,6 +1504,8 @@
|
||||
function updateDevices() { if (updateDevicesTimer != null) return; updateDevicesTimer = setTimeout(updateDevicesEx, 200); }
|
||||
|
||||
var deviceHeaderId = 0;
|
||||
var deviceHeaderTotal = 0;
|
||||
var deviceHeadersTitles = {};
|
||||
var deviceHeaderCount;
|
||||
var deviceHeaders = {};
|
||||
var oldviewmode = 0;
|
||||
@ -2995,7 +2999,7 @@
|
||||
QH('p10html3', x);
|
||||
|
||||
// Set the node power state
|
||||
powerstate = PowerStateStr(node.state);
|
||||
var powerstate = PowerStateStr(node.state);
|
||||
//if (node.state == 0) { powerstate = 'Unknown State'; }
|
||||
if ((connectivity & 1) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected">Agent connected</span>'; }
|
||||
if ((connectivity & 2) != 0) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected">Intel® AMT connected</span>'; }
|
||||
@ -3374,7 +3378,7 @@
|
||||
var desktopNode;
|
||||
function setupDesktop() {
|
||||
// Setup the remote desktop
|
||||
if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); delete desktop; desktopNode = null; desktop = null; }
|
||||
if ((desktopNode != currentNode) && (desktop != null)) { desktop.Stop(); desktopNode = null; desktop = null; }
|
||||
|
||||
// If the device desktop is already connected in multi-desktop, use that.
|
||||
if ((desktopNode != currentNode) || (desktop == null)) {
|
||||
@ -3482,7 +3486,6 @@
|
||||
} else {
|
||||
// Disconnect and clean up the remote desktop
|
||||
desktop.Stop();
|
||||
delete desktop;
|
||||
desktopNode = desktop = null;
|
||||
}
|
||||
}
|
||||
@ -3498,7 +3501,6 @@
|
||||
case 0:
|
||||
// Disconnect and clean up the remote desktop
|
||||
desktop.Stop();
|
||||
delete desktop;
|
||||
desktopNode = desktop = null;
|
||||
QV('DeskFocus', false);
|
||||
QV('termdisplays', false);
|
||||
@ -3747,7 +3749,7 @@
|
||||
var terminalNode;
|
||||
function setupTerminal() {
|
||||
// Setup the terminal
|
||||
if ((terminalNode != currentNode) && (terminal != null)) { terminal.Stop(); delete terminal; terminal = null; }
|
||||
if ((terminalNode != currentNode) && (terminal != null)) { terminal.Stop(); terminal = null; }
|
||||
terminalNode = currentNode;
|
||||
updateTerminalButtons();
|
||||
}
|
||||
@ -3791,7 +3793,6 @@
|
||||
xterminal.m.TermDraw();
|
||||
if (terminal != null) {
|
||||
terminal.Stop();
|
||||
delete terminal;
|
||||
terminal = null;
|
||||
}
|
||||
break;
|
||||
@ -3832,7 +3833,6 @@
|
||||
} else {
|
||||
//QH('Term', '');
|
||||
terminal.Stop();
|
||||
delete terminal;
|
||||
terminal = null;
|
||||
}
|
||||
Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses.
|
||||
@ -3890,7 +3890,7 @@
|
||||
filesNode = currentNode;
|
||||
var online = ((filesNode.conn & 1) != 0)?true:false; // If Agent (1) connected, enable Terminal
|
||||
QE('p13Connect', online);
|
||||
if (((samenode == false) || (online == false)) && files) { files.Stop(); delete files; files = null; }
|
||||
if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
|
||||
}
|
||||
|
||||
function onFilesStateChange(xfiles, state) {
|
||||
@ -3907,7 +3907,7 @@
|
||||
QH('p13currentpath', '');
|
||||
QE('p13FolderUp', false);
|
||||
p13setActions();
|
||||
if (files != null) { files.Stop(); delete files; files = null; }
|
||||
if (files != null) { files.Stop(); files = null; }
|
||||
break;
|
||||
case 3:
|
||||
p13targetpath = '';
|
||||
@ -3938,13 +3938,11 @@
|
||||
} else {
|
||||
//QH('Term', '');
|
||||
files.Stop();
|
||||
delete files;
|
||||
files = null;
|
||||
}
|
||||
p13clipboard = p13clipboardFolder = null;
|
||||
p13clipboardCut = 0;
|
||||
p13updateClipview();
|
||||
p13oldlinkpath = null;
|
||||
}
|
||||
|
||||
var p13filetree = null;
|
||||
@ -3982,7 +3980,6 @@
|
||||
return checkedNames;
|
||||
}
|
||||
|
||||
//var p13oldlinkpath = null;
|
||||
function p13updateFiles(checkedNames) {
|
||||
var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p13folderup(0)>Root</a>', fullPath = 'Root';
|
||||
|
||||
|
@ -174,6 +174,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
'use strict';
|
||||
var passhint = "{{{passhint}}}";
|
||||
var newAccountPass = parseInt('{{{newAccountPass}}}');
|
||||
var emailCheck = parseInt('{{{emailcheck}}}');
|
||||
|
@ -168,6 +168,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
'use strict';
|
||||
var passhint = "{{{passhint}}}";
|
||||
var newAccountPass = parseInt('{{{newAccountPass}}}');
|
||||
var emailCheck = parseInt('{{{emailcheck}}}');
|
||||
|
25
webserver.js
25
webserver.js
@ -6,7 +6,7 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
class SerialTunnel extends require('stream').Duplex {
|
||||
@ -153,13 +153,22 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
obj.app.engine('handlebars', obj.exphbs({})); // defaultLayout: 'main'
|
||||
obj.app.set('view engine', 'handlebars');
|
||||
obj.app.use(obj.bodyParser.urlencoded({ extended: false }));
|
||||
obj.app.use(obj.session({
|
||||
name: 'xid', // Recommanded security practice to not use the default cookie name
|
||||
httpOnly: true,
|
||||
keys: [ obj.args.sessionkey ], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances
|
||||
secure: (obj.args.notls != true), // Use this cookie only over TLS
|
||||
maxAge: (obj.args.sessiontime * 60 * 1000) // 24 hours
|
||||
}));
|
||||
if (obj.args.sessiontime != null) {
|
||||
obj.app.use(obj.session({
|
||||
name: 'xid', // Recommanded security practice to not use the default cookie name
|
||||
httpOnly: true,
|
||||
keys: [obj.args.sessionkey], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances
|
||||
secure: (obj.args.notls != true), // Use this cookie only over TLS
|
||||
maxAge: (obj.args.sessiontime * 60 * 1000) // Number of minutes
|
||||
}));
|
||||
} else {
|
||||
obj.app.use(obj.session({
|
||||
name: 'xid', // Recommanded security practice to not use the default cookie name
|
||||
httpOnly: true,
|
||||
keys: [obj.args.sessionkey], // If multiple instances of this server are behind a load-balancer, this secret must be the same for all instances
|
||||
secure: (obj.args.notls != true) // Use this cookie only over TLS
|
||||
}));
|
||||
}
|
||||
|
||||
// Session-persisted message middleware
|
||||
obj.app.use(function (req, res, next) {
|
||||
|
@ -6,6 +6,8 @@
|
||||
* @version v0.0.1
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// This module is only called when MeshCentral is running as a Windows service.
|
||||
// In this case, we don't want to start a child process, so we launch directly without arguments.
|
||||
require('./meshcentral.js').mainStart({ "launch": true });
|
||||
|
Loading…
Reference in New Issue
Block a user