MeshAgents on Windows are now signed.
Ylian Saint-Hilaire committed
Mar 8, 2018 at 17:58 UTC
80545a7e57cbbfd44fbd179f2f530438721cd4b9
54 files changed
+135
-8640
MeshCentral
deleted
-1
@@ -1 +0,0 @@
1
-Subproject commit b6bfdbbc91375c12700a81048f29b6fc5dfd3e96
agents/MeshConsole.exe
Binary files a/agents/MeshConsole.exe and /dev/null differ
agents/MeshConsole64.exe
Binary files a/agents/MeshConsole64.exe and /dev/null differ
agents/MeshService-signed.exe
Binary files /dev/null and b/agents/MeshService-signed.exe differ
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64-signed.exe
Binary files /dev/null and b/agents/MeshService64-signed.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
agents/TestSuite.db
Binary files a/agents/TestSuite.db and /dev/null differ
agents/agent_debug/MeshService.exe
Binary files a/agents/agent_debug/MeshService.exe and /dev/null differ
agents/agent_debug/MeshService64.exe
Binary files a/agents/agent_debug/MeshService64.exe and /dev/null differ
agents/meshagent_arm
Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ
agents/meshagent_arm-linaro
Binary files a/agents/meshagent_arm-linaro and /dev/null differ
agents/meshagent_mips
Binary files a/agents/meshagent_mips and /dev/null differ
agents/meshagent_pi2
Binary files a/agents/meshagent_pi2 and /dev/null differ
agents/meshagent_pogo
Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ
agents/meshagent_poky
Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ
agents/meshagent_poky64
Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ
agents/meshagent_x86
Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ
agents/meshagent_x86-64
Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ
agents/meshagent_x86-64_nokvm
Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ
agents/meshagent_x86_nokvm
Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ
agents/meshcmd.js
+74
-4
@@ -455,15 +455,15 @@ function startLms(func) {
455
setupMeiOsAdmin(func, amtLms.connected == false ? 0 : 3);
456
});
457
amtLms.on('notify', function (data, options, str, code) {
458
- if (str != null) {
458
+ if (code == 'iAMT0052-3') {
459
+ kvmGetData(true);
460
+ } else if (str != null) {
461
var notify = { date: Date.now(), str: str, code: code };
462
lmsNotifications.push(notify);
463
while (lmsNotifications.length > 100) { lmsNotifications.shift(); }
464
var notifyBuf = Buffer.concat([Buffer.from('0900', 'hex'), Buffer.from(JSON.stringify(notify))]) // Add a notification
465
for (var i in lmsControlSockets) { lmsControlSockets[i].write(notifyBuf); }
464
- //console.log(str);
466
}
466
- //else { console.log(JSON.stringify(data)); }
467
});
468
//console.log('LME Connecting...');
469
amtLms.on('connect', function () {
@@ -539,9 +539,79 @@ function setupMeiOsAdmin(func, state) {
539
if (func) { func(state); }
540
//var AllWsman = "CIM_SoftwareIdentity,IPS_SecIOService,IPS_ScreenSettingData,IPS_ProvisioningRecordLog,IPS_HostBasedSetupService,IPS_HostIPSettings,IPS_IPv6PortSettings".split(',');
541
//osamtstack.BatchEnum(null, AllWsman, startLmsWsmanResponse, null, true);
542
+
543
+ tempTimer = setInterval(function () { kvmGetData(true); }, 2000);
544
+ kvmGetData(false);
545
+ kvmSetData(JSON.stringify({ action: 'restart', ver: 1 }));
546
});
547
}
548
549
+function kvmGetData(tag) {
550
+ osamtstack.IPS_KVMRedirectionSettingData_DataChannelRead(kvmDataGetResponse, tag);
551
+}
552
+
553
+function kvmDataGetResponse(stack, name, response, status, tag) {
554
+ if ((tag == true) && (status == 200) && (response.Body.ReturnValue == 0)) {
555
+ var val = null;
556
+ try { val = Buffer.from(response.Body.DataMessage, 'base64').toString(); } catch (e) { return }
557
+ if (val != null) kvmProcessData(response.Body.RealmsBitmap, response.Body.MessageId, val);
558
+ }
559
+}
560
+
561
+var webRtcDesktop = null;
562
+function kvmProcessData(realms, messageId, val) {
563
+ //console.log('kvmProcessData', val);
564
+ var data = null;
565
+ try { data = JSON.parse(val) } catch (e) { }
566
+ if ((data != null) && (data.action)) {
567
+ if (data.action == 'present') { kvmSetData(JSON.stringify({ action: 'present', ver: 1 })); }
568
+ if (data.action == 'offer') {
569
+ webRtcDesktop = {};
570
+ var rtc = require('ILibWebRTC');
571
+ webRtcDesktop.webrtc = rtc.createConnection();
572
+ webRtcDesktop.webrtc.on('connected', function () { });
573
+ webRtcDesktop.webrtc.on('disconnected', function () { webRtcCleanUp(); });
574
+ webRtcDesktop.webrtc.on('dataChannel', function (rtcchannel) {
575
+ webRtcDesktop.rtcchannel = rtcchannel;
576
+ var kvmmodule = require('meshDesktop');
577
+ webRtcDesktop.kvm = kvmmodule.getRemoteDesktopStream();
578
+ webRtcDesktop.kvm.pipe(webRtcDesktop.rtcchannel, { end: false });
579
+ webRtcDesktop.rtcchannel.pipe(webRtcDesktop.kvm, { end: false });
580
+ webRtcDesktop.rtcchannel.on('end', function () { webRtcCleanUp(); });
581
+ //webRtcDesktop.kvm.on('end', function () { console.log('WebRTC DataChannel closed2'); webRtcCleanUp(); });
582
+ //webRtcDesktop.rtcchannel.on('data', function (data) { console.log('WebRTC data: ' + data); });
583
+ });
584
+ kvmSetData(JSON.stringify({ action: 'answer', ver: 1, sdp: webRtcDesktop.webrtc.setOffer(data.sdp) }));
585
+ }
586
+ }
587
+}
588
+
589
+function webRtcCleanUp() {
590
+ if (webRtcDesktop == null) return;
591
+ if (webRtcDesktop.rtcchannel) {
592
+ try { webRtcDesktop.rtcchannel.close(); } catch (e) { }
593
+ try { webRtcDesktop.rtcchannel.removeAllListeners('data'); } catch (e) { }
594
+ try { webRtcDesktop.rtcchannel.removeAllListeners('end'); } catch (e) { }
595
+ delete webRtcDesktop.rtcchannel;
596
+ }
597
+ if (webRtcDesktop.webrtc) {
598
+ try { webRtcDesktop.webrtc.close(); } catch (e) { }
599
+ try { webRtcDesktop.webrtc.removeAllListeners('connected'); } catch (e) { }
600
+ try { webRtcDesktop.webrtc.removeAllListeners('disconnected'); } catch (e) { }
601
+ try { webRtcDesktop.webrtc.removeAllListeners('dataChannel'); } catch (e) { }
602
+ delete webRtcDesktop.webrtc;
603
+ }
604
+ if (webRtcDesktop.kvm) {
605
+ try { webRtcDesktop.kvm.end(); } catch (e) { }
606
+ delete webRtcDesktop.kvm;
607
+ }
608
+ webRtcDesktop = null;
609
+}
610
+
611
+function kvmSetData(x) {
612
+ osamtstack.IPS_KVMRedirectionSettingData_DataChannelWrite(Buffer.from(x).toString('base64'), function () { });
613
+}
614
+
615
function startLmsWsmanResponse(stack, name, responses, status) {
616
if (status == 600) { console.log('ERROR: Unable to connect to Intel(R) AMT.'); }
617
else if (status != 200) { console.log('ERROR: Unable to get object from Intel(R) AMT, status = ' + status + '.'); }
@@ -590,7 +660,7 @@ function processLmsControlData(data) {
660
661
function startRouter() {
662
tcpserver = net.createServer(OnTcpClientConnected);
593
- tcpserver.on('error', function (e) { console.log('ERRORa: ' + JSON.stringify(e)); exit(0); return; });
663
+ tcpserver.on('error', function (e) { console.log('ERROR: ' + JSON.stringify(e)); exit(0); return; });
664
tcpserver.listen(settings.localPort, function () {
665
// We started listening.
666
if (settings.remoteName == null) {
agents/meshcore.js
+6
-1
@@ -802,7 +802,12 @@ function createMeshCore(agent) {
802
var response = null;
803
switch (cmd) {
804
case 'help': { // Displays available commands
805
- response = 'Available commands: help, info, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, amt, netinfo, location, power, wakeonlan, scanwifi, scanamt.';
805
+ response = 'Available commands: help, info, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, amt, netinfo, location, power, wakeonlan, scanwifi, scanamt, setdebug.';
806
+ break;
807
+ }
808
+ case 'setdebug': {
809
+ if (args['_'].length < 1) { response = 'Proper usage: setdebug (target), 0 = StdOut, 1 = This Console, * = All Consoles, 2 = WebLog, 3 = Disabled'; } // Display usage
810
+ else { if (args['_'][0] == '*') { console.setDestination(1); } else { console.setDestination(parseInt(args['_'][0]), sessionid); } }
811
break;
812
}
813
case 'eval': { // Eval JavaScript
agents/meshinstall-linux-old.sh
deleted
-164
@@ -1,164 +0,0 @@
1
-#!/bin/bash
2
-
3
-CheckStartupType() {
4
-# echo "Checking process autostart system..."
5
- if [[ `systemctl` =~ -\.mount ]]; then return 1; # systemd;
6
- elif [[ `/sbin/init --version` =~ upstart ]]; then return 2; # upstart;
7
- elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then return 3; # sysv-init;
8
- fi
9
- return 0;
10
-}
11
-
12
-# Add "StartupType=(type)" to .msh file
13
-UpdateMshFile() {
14
- # Remove all lines that start with "StartupType="
15
- sed '/^StartupType=/ d' < /usr/local/mesh/meshagent.msh >> /usr/local/mesh/meshagent2.msh
16
- # Add the startup type to the file
17
- echo "StartupType=$starttype" >> /usr/local/mesh/meshagent2.msh
18
- mv /usr/local/mesh/meshagent2.msh /usr/local/mesh/meshagent.msh
19
-}
20
-
21
-CheckInstallAgent() {
22
-# echo "Checking mesh identifier..."
23
- if [ -e "/usr/local" ]
24
- then
25
- installpath="/usr/local/mesh"
26
- else
27
- installpath="/usr/mesh"
28
- fi
29
- if [ $# -eq 2 ]
30
- then
31
- url=$1
32
- meshid=$2
33
- meshidlen=${#meshid}
34
- if [ $meshidlen -eq 64 ]
35
- then
36
-# echo "Detecting computer type..."
37
- machinetype=$( uname -m )
38
- machineid=0
39
- if [ $machinetype == 'x86_64' ]
40
- then
41
-# Linux x86, 64 bit
42
- machineid=6
43
- fi
44
- if [ $machinetype == 'x86' ]
45
- then
46
-# Linux x86, 32 bit
47
- machineid=5
48
- fi
49
- if [ $machinetype == 'armv6l' ] || [ $machinetype == 'armv7l' ]
50
- then
51
-# RaspberryPi 1 (armv6l) or RaspberryPi 2/3 (armv7l)
52
- machineid=25
53
- fi
54
-# TODO: Add more machine types, detect KVM support, etc.
55
- if [ $machineid -eq 0 ]
56
- then
57
- echo "Unsupported machine type: $machinetype, check with server administrator."
58
- else
59
- DownloadAgent $url $meshid $machineid
60
- fi
61
- else
62
- echo "MeshID is not correct, must be 64 characters long."
63
- fi
64
- else
65
- echo "URI and/or MeshID have not been specified, must be passed in as arguments."
66
- return 0;
67
- fi
68
-}
69
-
70
-DownloadAgent() {
71
- url=$1
72
- meshid=$2
73
- machineid=$3
74
-# Create folder
75
- mkdir -p /usr/local/mesh
76
- cd /usr/local/mesh
77
-# echo "Downloading mesh agent..."
78
- wget $url/meshagents?id=$machineid -q --no-check-certificate -O /usr/local/mesh/meshagent
79
- if [ $? -eq 0 ]
80
- then
81
- echo "Mesh agent downloaded."
82
-# TODO: We could check the meshagent sha256 hash, but best to authenticate the server.
83
- chmod 755 /usr/local/mesh/meshagent
84
- wget $url/meshsettings?id=$meshid -q --no-check-certificate -O /usr/local/mesh/meshagent.msh
85
- if [ $? -eq 0 ]
86
- then
87
- UpdateMshFile
88
- if [ $starttype -eq 1 ]
89
- then
90
- echo -e "[Unit]\nDescription=MeshCentral Agent\n[Service]\nExecStart=/usr/local/mesh/meshagent\nStandardOutput=null\nRestart=always\nRestartSec=3\n[Install]\nWantedBy=multi-user.target\nAlias=meshagent.service\n" > /lib/systemd/system/meshagent.service
91
- systemctl enable meshagent
92
- systemctl start meshagent
93
- else
94
- ./meshagent start
95
- ln -s /usr/local/mesh/meshagent /sbin/meshcmd
96
- ln -s /usr/local/mesh/meshagent /etc/rc2.d/S20mesh
97
- ln -s /usr/local/mesh/meshagent /etc/rc3.d/S20mesh
98
- ln -s /usr/local/mesh/meshagent /etc/rc5.d/S20mesh
99
- fi
100
- echo "Mesh agent started."
101
- else
102
- echo "Unable to download mesh settings at: $url/meshsettings?id=$meshid."
103
- fi
104
- else
105
- echo "Unable to download mesh agent at: $url/meshagents?id=$machineid."
106
- fi
107
-}
108
-
109
-UninstallAgent() {
110
-# Uninstall agent
111
- if [ -e "/usr/local" ]
112
- then
113
- installpath="/usr/local/mesh"
114
- else
115
- installpath="/usr/mesh"
116
- fi
117
-
118
- if [ $starttype -eq 1 ]
119
- then
120
- rm -f /sbin/meshcmd /lib/systemd/system/meshagent.service
121
- systemctl disable meshagent
122
- systemctl stop meshagent
123
- else
124
- rm -f /sbin/meshcmd /etc/rc2.d/S20mesh /etc/rc3.d/S20mesh /etc/rc5.d/S20mesh
125
- fi
126
-
127
- if [ -e $installpath ]
128
- then
129
- cd $installpath
130
- if [ -e "$installpath/meshagent" ]
131
- then
132
- ./meshagent stop
133
- fi
134
- rm -rf $installpath/*
135
- rmdir $installpath
136
- fi
137
- echo "Agent uninstalled."
138
-}
139
-
140
-
141
-CheckStartupType
142
-starttype=$?
143
-#echo "Type: $starttype"
144
-
145
-currentuser=$( whoami )
146
-if [ $currentuser == 'root' ]
147
-then
148
- if [ $# -eq 0 ]
149
- then
150
- echo -e "This script will install or uninstall a mesh agent, usage:\n $0 [serverurl] [meshid]\n $0 uninstall"
151
- else
152
- if [ $# -eq 1 ]
153
- then
154
- if [ $1 == 'uninstall' ] || [ $1 == 'UNINSTALL' ]
155
- then
156
- UninstallAgent
157
- fi
158
- else
159
- CheckInstallAgent $1 $2
160
- fi
161
- fi
162
-else
163
- echo "Must be root to install or uninstall mesh agent."
164
-fi
agents/modules/MyTestModule.js
deleted
-7
@@ -1,7 +0,0 @@
1
-
2
-function MyTestModule()
3
-{
4
- this.getValue = function () { return 1245; };
5
-}
6
-
7
-module.exports = MyTestModule;
\ No newline at end of file
agents/modules/WifiScanner.js
deleted
-266
@@ -1,266 +0,0 @@
1
-var MemoryStream = require('MemoryStream');
2
-var WindowsWireless = new Buffer([
3
-0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x77, 0x6C, 0x61, 0x6E,
4
-0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
5
-0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45,
6
-0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x77, 0x6C,
7
-0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20,
8
-0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20,
9
-0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65,
10
-0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20,
11
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32,
12
-0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3B, 0x0A, 0x20,
13
-0x20, 0x20, 0x20, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x20, 0x28, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61,
14
-0x6C, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x30, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
15
-0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x4E, 0x4F, 0x54, 0x20, 0x52, 0x45, 0x41, 0x44, 0x59, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
16
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x31, 0x3A, 0x0A, 0x20, 0x20,
17
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A,
18
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20,
19
-0x32, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x44, 0x2D, 0x48, 0x4F, 0x43, 0x22,
20
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73,
21
-0x65, 0x20, 0x33, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F,
22
-0x4E, 0x4E, 0x45, 0x43, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
23
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x34, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65,
24
-0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
25
-0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x35, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
26
-0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x53, 0x53, 0x4F, 0x43, 0x49, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
27
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x36, 0x3A, 0x0A, 0x20, 0x20, 0x20,
28
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x56, 0x45, 0x52, 0x49, 0x4E, 0x47, 0x22, 0x3B,
29
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65,
30
-0x20, 0x37, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4E,
31
-0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
32
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74,
33
-0x65, 0x20, 0x3D, 0x20, 0x22, 0x55, 0x4E, 0x4B, 0x4E, 0x4F, 0x57, 0x4E, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B,
34
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65,
35
-0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E,
36
-0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20,
37
-0x30, 0x2C, 0x20, 0x30, 0x29, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E,
38
-0x20, 0x28, 0x74, 0x72, 0x75, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6C, 0x73, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20,
39
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66,
40
-0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69,
41
-0x64, 0x2C, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x5F, 0x6C, 0x71, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
42
-0x20, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69, 0x64, 0x3B,
43
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
44
-0x2E, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x5F, 0x6C, 0x71, 0x3B, 0x0A, 0x7D, 0x0A, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x2E, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x74, 0x79,
45
-0x70, 0x65, 0x2E, 0x74, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72,
46
-0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x20, 0x5B, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62,
47
-0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x5D, 0x3A, 0x20, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x6C, 0x71, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63,
48
-0x74, 0x69, 0x6F, 0x6E, 0x20, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x29, 0x0A,
49
-0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x4E,
50
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
51
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69,
52
-0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20,
53
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74,
54
-0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
55
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x26, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x38, 0x29, 0x20, 0x26, 0x26, 0x20, 0x28, 0x4E,
56
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x3D, 0x20, 0x37, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20,
57
-0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68,
58
-0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20,
59
-0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x47, 0x65, 0x74, 0x42,
60
-0x53, 0x53, 0x4C, 0x69, 0x73, 0x74, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47,
61
-0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x33, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69,
62
-0x66, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
63
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x74, 0x61, 0x6C, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
64
-0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76,
65
-0x61, 0x72, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
66
-0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x28, 0x69, 0x20, 0x3D, 0x20,
67
-0x30, 0x3B, 0x20, 0x69, 0x20, 0x3C, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x3B, 0x20, 0x2B, 0x2B, 0x69, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
68
-0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x20, 0x3D, 0x20, 0x62,
69
-0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x20, 0x2B, 0x20, 0x28, 0x33, 0x36, 0x30, 0x20, 0x2A, 0x20, 0x69, 0x29, 0x2C, 0x20,
70
-0x33, 0x36, 0x30, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
71
-0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x74, 0x72, 0x69, 0x6D, 0x28, 0x29,
72
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x74,
73
-0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x30, 0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x32, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
74
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65,
75
-0x66, 0x28, 0x35, 0x36, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61,
76
-0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x36, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20,
77
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x65, 0x6D, 0x69, 0x74, 0x28,
78
-0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x2C, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x62, 0x73,
79
-0x73, 0x69, 0x64, 0x2C, 0x20, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20,
80
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x57, 0x69, 0x72, 0x65,
81
-0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x20, 0x3D, 0x20,
82
-0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x27, 0x29, 0x2E, 0x69, 0x6E, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29,
83
-0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x5F,
84
-0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x27, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76,
85
-0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x72, 0x6F,
86
-0x78, 0x79, 0x28, 0x22, 0x77, 0x6C, 0x61, 0x6E, 0x61, 0x70, 0x69, 0x2E, 0x64, 0x6C, 0x6C, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
87
-0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x22,
88
-0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28,
89
-0x22, 0x57, 0x6C, 0x61, 0x6E, 0x47, 0x65, 0x74, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x42, 0x73, 0x73, 0x4C, 0x69, 0x73, 0x74, 0x22, 0x2C, 0x20, 0x22, 0x47, 0x65, 0x74, 0x42, 0x53, 0x53,
90
-0x4C, 0x69, 0x73, 0x74, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65,
91
-0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x22, 0x29,
92
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22,
93
-0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E,
94
-0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x22, 0x29, 0x3B, 0x0A,
95
-0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C,
96
-0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6E, 0x65, 0x67,
97
-0x6F, 0x74, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69,
98
-0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x68, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C,
99
-0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
100
-0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x28, 0x32, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6E, 0x65, 0x67, 0x6F, 0x74, 0x69, 0x61, 0x74,
101
-0x65, 0x64, 0x2C, 0x20, 0x68, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x20, 0x3D, 0x20, 0x68, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
102
-0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x20,
103
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x50, 0x72, 0x6F,
104
-0x78, 0x79, 0x28, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x2C, 0x20, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46,
105
-0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x3B, 0x0A, 0x20, 0x20,
106
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E,
107
-0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20,
108
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
109
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x46, 0x46, 0x46, 0x46, 0x2C, 0x20,
110
-0x30, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x43, 0x61, 0x6C,
111
-0x6C, 0x62, 0x61, 0x63, 0x6B, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54,
112
-0x2E, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6D, 0x69,
113
-0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6E, 0x74, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x29, 0x3B, 0x0A, 0x20,
114
-0x20, 0x20, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x61, 0x64, 0x64, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27,
115
-0x2C, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x47, 0x65, 0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64,
116
-0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20,
117
-0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61,
118
-0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
119
-0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E,
120
-0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
121
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E,
122
-0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
123
-0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44,
124
-0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20,
125
-0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32, 0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67,
126
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65,
127
-0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x69, 0x6E,
128
-0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x31, 0x29, 0x20, 0x2F, 0x2F,
129
-0x20, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
130
-0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65,
131
-0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x70, 0x44,
132
-0x61, 0x74, 0x61, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72,
133
-0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x3D, 0x20,
134
-0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20,
135
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66,
136
-0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20,
137
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
138
-0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x37, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53,
139
-0x69, 0x7A, 0x65, 0x2C, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2C, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
140
-0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
141
-0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65,
142
-0x64, 0x53, 0x53, 0x49, 0x44, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x34, 0x2C,
143
-0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72,
144
-0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x36, 0x30,
145
-0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
146
-0x76, 0x61, 0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x37, 0x36,
147
-0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
148
-0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64,
149
-0x53, 0x53, 0x49, 0x44, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
150
-0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x6F, 0x77, 0x20, 0x28, 0x22, 0x47, 0x65,
151
-0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x73, 0x3A, 0x20, 0x46, 0x41, 0x49, 0x4C, 0x45, 0x44, 0x20, 0x28, 0x6E, 0x6F, 0x74, 0x20,
152
-0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x61, 0x20, 0x6E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x29, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
153
-0x7D, 0x3B, 0x0A, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x6D, 0x6F, 0x64, 0x75, 0x6C,
154
-0x65, 0x2E, 0x65, 0x78, 0x70, 0x6F, 0x72, 0x74, 0x73, 0x20, 0x3D, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x3B, 0x0A]);
155
-
156
-
157
-
158
-var WindowsChildScript = new Buffer([
159
-0x76, 0x61, 0x72, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6F, 0x6E, 0x74,
160
-0x61, 0x69, 0x6E, 0x65, 0x72, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x76, 0x61, 0x72, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
161
-0x28, 0x27, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x6F, 0x6E, 0x28, 0x27, 0x53, 0x63,
162
-0x61, 0x6E, 0x27, 0x2C, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x61, 0x70, 0x29, 0x20, 0x7B, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x73, 0x65, 0x6E, 0x64,
163
-0x28, 0x61, 0x70, 0x29, 0x3B, 0x20, 0x7D, 0x29, 0x3B, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x3B, 0x0D, 0x0A]);
164
-
165
-
166
-function AccessPoint(_ssid, _bssid, _lq)
167
-{
168
- this.ssid = _ssid;
169
- this.bssid = _bssid;
170
- this.lq = _lq;
171
-}
172
-AccessPoint.prototype.toString = function ()
173
-{
174
- return (this.ssid + " [" + this.bssid + "]: " + this.lq);
175
-}
176
-
177
-function WiFiScanner()
178
-{
179
- var emitterUtils = require('events').inherits(this);
180
- emitterUtils.createEvent('accessPoint');
181
-
182
- this.hasWireless = function ()
183
- {
184
- var retVal = false;
185
- var interfaces = require('os').networkInterfaces();
186
- for (var name in interfaces)
187
- {
188
- if (interfaces[name][0].type == 'wireless') { retVal = true; break; }
189
- }
190
- return (retVal);
191
- };
192
-
193
- this.Scan = function ()
194
- {
195
- if (process.platform == 'win32')
196
- {
197
- this.master = require('ScriptContainer').Create(15, ContainerPermissions.DEFAULT);
198
- this.master.parent = this;
199
- this.master.on('data', function (j) { this.parent.emit('accessPoint', new AccessPoint(j.ssid, j.bssid, j.lq)); });
200
-
201
- this.master.addModule('Wireless', WindowsWireless.toString());
202
- this.master.ExecuteString(WindowsChildScript.toString());
203
- }
204
- else if (process.platform == 'linux')
205
- {
206
- // Need to get the wireless interface name
207
- var interfaces = require('os').networkInterfaces();
208
- var wlan = null;
209
- for (var i in interfaces)
210
- {
211
- if (interfaces[i][0].type == 'wireless')
212
- {
213
- wlan = i;
214
- break;
215
- }
216
- }
217
- if (wlan != null)
218
- {
219
- this.child = require('ILibProcessPipe').CreateProcess("/sbin/iwlist", "iwlist", wlan, "scan");
220
- this.child.parent = this;
221
- this.child.ms = new MemoryStream();
222
- this.child.ms.parent = this.child;
223
- this.child.on('data', function (buffer) { this.ms.write(buffer); });
224
- this.child.on('end', function () { this.ms.end(); });
225
- this.child.ms.on('end', function ()
226
- {
227
- var str = this.buffer.toString();
228
- tokens = str.split(' - Address: ');
229
- for (var block in tokens)
230
- {
231
- if (block == 0) continue;
232
- var ln = tokens[block].split('\n');
233
- var _bssid = ln[0];
234
- var _lq;
235
- var _ssid;
236
-
237
- for (var lnblock in ln)
238
- {
239
- lnblock = ln[lnblock].trim();
240
- lnblock = lnblock.trim();
241
- if (lnblock.startsWith('ESSID:'))
242
- {
243
- _ssid = lnblock.slice(7, lnblock.length - 1);
244
- if (_ssid == '<hidden>') { _ssid = ''; }
245
- }
246
- if (lnblock.startsWith('Signal level='))
247
- {
248
- _lq = lnblock.slice(13,lnblock.length-4);
249
- }
250
- }
251
- this.parent.parent.emit('accessPoint', new AccessPoint(_ssid, _bssid, _lq));
252
- }
253
- });
254
- }
255
- }
256
- }
257
-}
258
-
259
-module.exports = WiFiScanner;
260
-
261
-
262
-
263
-
264
-
265
-
266
-
agents/modules/WifiScanner.jsx
deleted
-266
@@ -1,266 +0,0 @@
1
-var MemoryStream = require('MemoryStream');
2
-var WindowsWireless = new Buffer([
3
-0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x77, 0x6C, 0x61, 0x6E,
4
-0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
5
-0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45,
6
-0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x77, 0x6C,
7
-0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20,
8
-0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20,
9
-0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65,
10
-0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20,
11
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32,
12
-0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3B, 0x0A, 0x20,
13
-0x20, 0x20, 0x20, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x20, 0x28, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61,
14
-0x6C, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x30, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
15
-0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x4E, 0x4F, 0x54, 0x20, 0x52, 0x45, 0x41, 0x44, 0x59, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
16
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x31, 0x3A, 0x0A, 0x20, 0x20,
17
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A,
18
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20,
19
-0x32, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x44, 0x2D, 0x48, 0x4F, 0x43, 0x22,
20
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73,
21
-0x65, 0x20, 0x33, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F,
22
-0x4E, 0x4E, 0x45, 0x43, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
23
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x34, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65,
24
-0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
25
-0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x35, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
26
-0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x53, 0x53, 0x4F, 0x43, 0x49, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
27
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x36, 0x3A, 0x0A, 0x20, 0x20, 0x20,
28
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x56, 0x45, 0x52, 0x49, 0x4E, 0x47, 0x22, 0x3B,
29
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65,
30
-0x20, 0x37, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4E,
31
-0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
32
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74,
33
-0x65, 0x20, 0x3D, 0x20, 0x22, 0x55, 0x4E, 0x4B, 0x4E, 0x4F, 0x57, 0x4E, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B,
34
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65,
35
-0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E,
36
-0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20,
37
-0x30, 0x2C, 0x20, 0x30, 0x29, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E,
38
-0x20, 0x28, 0x74, 0x72, 0x75, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6C, 0x73, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20,
39
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66,
40
-0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69,
41
-0x64, 0x2C, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x5F, 0x6C, 0x71, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
42
-0x20, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69, 0x64, 0x3B,
43
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
44
-0x2E, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x5F, 0x6C, 0x71, 0x3B, 0x0A, 0x7D, 0x0A, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x2E, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x74, 0x79,
45
-0x70, 0x65, 0x2E, 0x74, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72,
46
-0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x20, 0x5B, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62,
47
-0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x5D, 0x3A, 0x20, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x6C, 0x71, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63,
48
-0x74, 0x69, 0x6F, 0x6E, 0x20, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x29, 0x0A,
49
-0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x4E,
50
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
51
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69,
52
-0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20,
53
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74,
54
-0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
55
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x26, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x38, 0x29, 0x20, 0x26, 0x26, 0x20, 0x28, 0x4E,
56
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x3D, 0x20, 0x37, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20,
57
-0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68,
58
-0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20,
59
-0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x47, 0x65, 0x74, 0x42,
60
-0x53, 0x53, 0x4C, 0x69, 0x73, 0x74, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47,
61
-0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x33, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69,
62
-0x66, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
63
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x74, 0x61, 0x6C, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
64
-0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76,
65
-0x61, 0x72, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
66
-0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x28, 0x69, 0x20, 0x3D, 0x20,
67
-0x30, 0x3B, 0x20, 0x69, 0x20, 0x3C, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x3B, 0x20, 0x2B, 0x2B, 0x69, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
68
-0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x20, 0x3D, 0x20, 0x62,
69
-0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x20, 0x2B, 0x20, 0x28, 0x33, 0x36, 0x30, 0x20, 0x2A, 0x20, 0x69, 0x29, 0x2C, 0x20,
70
-0x33, 0x36, 0x30, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
71
-0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x74, 0x72, 0x69, 0x6D, 0x28, 0x29,
72
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x74,
73
-0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x30, 0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x32, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
74
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65,
75
-0x66, 0x28, 0x35, 0x36, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61,
76
-0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x36, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20,
77
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x65, 0x6D, 0x69, 0x74, 0x28,
78
-0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x2C, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x62, 0x73,
79
-0x73, 0x69, 0x64, 0x2C, 0x20, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20,
80
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x57, 0x69, 0x72, 0x65,
81
-0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x20, 0x3D, 0x20,
82
-0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x27, 0x29, 0x2E, 0x69, 0x6E, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29,
83
-0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x5F,
84
-0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x27, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76,
85
-0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x72, 0x6F,
86
-0x78, 0x79, 0x28, 0x22, 0x77, 0x6C, 0x61, 0x6E, 0x61, 0x70, 0x69, 0x2E, 0x64, 0x6C, 0x6C, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
87
-0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x22,
88
-0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28,
89
-0x22, 0x57, 0x6C, 0x61, 0x6E, 0x47, 0x65, 0x74, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x42, 0x73, 0x73, 0x4C, 0x69, 0x73, 0x74, 0x22, 0x2C, 0x20, 0x22, 0x47, 0x65, 0x74, 0x42, 0x53, 0x53,
90
-0x4C, 0x69, 0x73, 0x74, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65,
91
-0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x22, 0x29,
92
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22,
93
-0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E,
94
-0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x22, 0x29, 0x3B, 0x0A,
95
-0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C,
96
-0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6E, 0x65, 0x67,
97
-0x6F, 0x74, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69,
98
-0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x68, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C,
99
-0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
100
-0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x28, 0x32, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6E, 0x65, 0x67, 0x6F, 0x74, 0x69, 0x61, 0x74,
101
-0x65, 0x64, 0x2C, 0x20, 0x68, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x20, 0x3D, 0x20, 0x68, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
102
-0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x20,
103
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x50, 0x72, 0x6F,
104
-0x78, 0x79, 0x28, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x2C, 0x20, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46,
105
-0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x3B, 0x0A, 0x20, 0x20,
106
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E,
107
-0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20,
108
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
109
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x46, 0x46, 0x46, 0x46, 0x2C, 0x20,
110
-0x30, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x43, 0x61, 0x6C,
111
-0x6C, 0x62, 0x61, 0x63, 0x6B, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54,
112
-0x2E, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6D, 0x69,
113
-0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6E, 0x74, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x29, 0x3B, 0x0A, 0x20,
114
-0x20, 0x20, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x61, 0x64, 0x64, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27,
115
-0x2C, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x47, 0x65, 0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64,
116
-0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20,
117
-0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61,
118
-0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
119
-0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E,
120
-0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
121
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E,
122
-0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
123
-0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44,
124
-0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20,
125
-0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32, 0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67,
126
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65,
127
-0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x69, 0x6E,
128
-0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x31, 0x29, 0x20, 0x2F, 0x2F,
129
-0x20, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
130
-0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65,
131
-0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x70, 0x44,
132
-0x61, 0x74, 0x61, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72,
133
-0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x3D, 0x20,
134
-0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20,
135
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66,
136
-0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20,
137
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
138
-0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x37, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53,
139
-0x69, 0x7A, 0x65, 0x2C, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2C, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
140
-0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
141
-0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65,
142
-0x64, 0x53, 0x53, 0x49, 0x44, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x34, 0x2C,
143
-0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72,
144
-0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x36, 0x30,
145
-0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
146
-0x76, 0x61, 0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x37, 0x36,
147
-0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
148
-0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64,
149
-0x53, 0x53, 0x49, 0x44, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
150
-0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x6F, 0x77, 0x20, 0x28, 0x22, 0x47, 0x65,
151
-0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x73, 0x3A, 0x20, 0x46, 0x41, 0x49, 0x4C, 0x45, 0x44, 0x20, 0x28, 0x6E, 0x6F, 0x74, 0x20,
152
-0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x61, 0x20, 0x6E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x29, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
153
-0x7D, 0x3B, 0x0A, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x6D, 0x6F, 0x64, 0x75, 0x6C,
154
-0x65, 0x2E, 0x65, 0x78, 0x70, 0x6F, 0x72, 0x74, 0x73, 0x20, 0x3D, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x3B, 0x0A]);
155
-
156
-
157
-
158
-var WindowsChildScript = new Buffer([
159
-0x76, 0x61, 0x72, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6F, 0x6E, 0x74,
160
-0x61, 0x69, 0x6E, 0x65, 0x72, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x76, 0x61, 0x72, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
161
-0x28, 0x27, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x6F, 0x6E, 0x28, 0x27, 0x53, 0x63,
162
-0x61, 0x6E, 0x27, 0x2C, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x61, 0x70, 0x29, 0x20, 0x7B, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x73, 0x65, 0x6E, 0x64,
163
-0x28, 0x61, 0x70, 0x29, 0x3B, 0x20, 0x7D, 0x29, 0x3B, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x3B, 0x0D, 0x0A]);
164
-
165
-
166
-function AccessPoint(_ssid, _bssid, _lq)
167
-{
168
- this.ssid = _ssid;
169
- this.bssid = _bssid;
170
- this.lq = _lq;
171
-}
172
-AccessPoint.prototype.toString = function ()
173
-{
174
- return (this.ssid + " [" + this.bssid + "]: " + this.lq);
175
-}
176
-
177
-function WiFiScanner()
178
-{
179
- var emitterUtils = require('events').inherits(this);
180
- emitterUtils.createEvent('accessPoint');
181
-
182
- this.hasWireless = function ()
183
- {
184
- var retVal = false;
185
- var interfaces = require('os').networkInterfaces();
186
- for (var name in interfaces)
187
- {
188
- if (interfaces[name][0].type == 'wireless') { retVal = true; break; }
189
- }
190
- return (retVal);
191
- };
192
-
193
- this.Scan = function ()
194
- {
195
- if (process.platform == 'win32')
196
- {
197
- this.master = require('ScriptContainer').Create(15, ContainerPermissions.DEFAULT);
198
- this.master.parent = this;
199
- this.master.on('data', function (j) { this.parent.emit('accessPoint', new AccessPoint(j.ssid, j.bssid, j.lq)); });
200
-
201
- this.master.addModule('Wireless', WindowsWireless.toString());
202
- this.master.ExecuteString(WindowsChildScript.toString());
203
- }
204
- else if (process.platform == 'linux')
205
- {
206
- // Need to get the wireless interface name
207
- var interfaces = require('os').networkInterfaces();
208
- var wlan = null;
209
- for (var i in interfaces)
210
- {
211
- if (interfaces[i][0].type == 'wireless')
212
- {
213
- wlan = i;
214
- break;
215
- }
216
- }
217
- if (wlan != null)
218
- {
219
- this.child = require('ILibProcessPipe').CreateProcess("/sbin/iwlist", "iwlist", wlan, "scan");
220
- this.child.parent = this;
221
- this.child.ms = new MemoryStream();
222
- this.child.ms.parent = this.child;
223
- this.child.on('data', function (buffer) { this.ms.write(buffer); });
224
- this.child.on('end', function () { this.ms.end(); });
225
- this.child.ms.on('end', function ()
226
- {
227
- var str = this.buffer.toString();
228
- tokens = str.split(' - Address: ');
229
- for (var block in tokens)
230
- {
231
- if (block == 0) continue;
232
- var ln = tokens[block].split('\n');
233
- var _bssid = ln[0];
234
- var _lq;
235
- var _ssid;
236
-
237
- for (var lnblock in ln)
238
- {
239
- lnblock = ln[lnblock].trim();
240
- lnblock = lnblock.trim();
241
- if (lnblock.startsWith('ESSID:'))
242
- {
243
- _ssid = lnblock.slice(7, lnblock.length - 1);
244
- if (_ssid == '<hidden>') { _ssid = ''; }
245
- }
246
- if (lnblock.startsWith('Signal level='))
247
- {
248
- _lq = lnblock.slice(13,lnblock.length-4);
249
- }
250
- }
251
- this.parent.parent.emit('accessPoint', new AccessPoint(_ssid, _bssid, _lq));
252
- }
253
- });
254
- }
255
- }
256
- }
257
-}
258
-
259
-module.exports = WiFiScanner;
260
-
261
-
262
-
263
-
264
-
265
-
266
-
agents/modules_meshcmd/amt-0.2.0.js
deleted
-1002
@@ -1,1002 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-/**
18
-* @fileoverview Intel(r) AMT Communication StackXX
19
-* @author Ylian Saint-Hilaire
20
-* @version v0.2.0b
21
-*/
22
-
23
-/**
24
- * Construct a AmtStackCreateService object, this ia the main Intel AMT communication stack.
25
- * @constructor
26
- */
27
-function AmtStackCreateService(wsmanStack) {
28
- var obj = new Object();
29
- obj.wsman = wsmanStack;
30
- obj.pfx = ["http://intel.com/wbem/wscim/1/amt-schema/1/", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/", "http://intel.com/wbem/wscim/1/ips-schema/1/"];
31
- obj.PendingEnums = [];
32
- obj.PendingBatchOperations = 0;
33
- obj.ActiveEnumsCount = 0;
34
- obj.MaxActiveEnumsCount = 1; // Maximum number of enumerations that can be done at the same time.
35
- obj.onProcessChanged = null;
36
- var _MaxProcess = 0;
37
- var _LastProcess = 0;
38
-
39
- // Return the number of pending actions
40
- obj.GetPendingActions = function () { return (obj.PendingEnums.length * 2) + (obj.ActiveEnumsCount) + obj.wsman.comm.PendingAjax.length + obj.wsman.comm.ActiveAjaxCount + obj.PendingBatchOperations; }
41
-
42
- // Private Method, Update the current processing status, this gives the application an idea of what progress is being done by the WSMAN stack
43
- function _up() {
44
- var x = obj.GetPendingActions();
45
- if (_MaxProcess < x) _MaxProcess = x;
46
- if (obj.onProcessChanged != null && _LastProcess != x) {
47
- //console.log("Process Old=" + _LastProcess + ", New=" + x + ", PEnums=" + obj.PendingEnums.length + ", AEnums=" + obj.ActiveEnumsCount + ", PAjax=" + obj.wsman.comm.PendingAjax.length + ", AAjax=" + obj.wsman.comm.ActiveAjaxCount + ", PBatch=" + obj.PendingBatchOperations);
48
- _LastProcess = x;
49
- obj.onProcessChanged(x, _MaxProcess);
50
- }
51
- if (x == 0) _MaxProcess = 0;
52
- }
53
-
54
- // Perform a WSMAN "SUBSCRIBE" operation.
55
- obj.Subscribe = function (name, delivery, url, callback, tag, pri, selectors, opaque, user, pass) { obj.wsman.ExecSubscribe(obj.CompleteName(name), delivery, url, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri, selectors, opaque, user, pass); _up(); }
56
-
57
- // Perform a WSMAN "UNSUBSCRIBE" operation.
58
- obj.UnSubscribe = function (name, callback, tag, pri, selectors) { obj.wsman.ExecUnSubscribe(obj.CompleteName(name), function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri, selectors); _up(); }
59
-
60
- // Perform a WSMAN "GET" operation.
61
- obj.Get = function (name, callback, tag, pri) { obj.wsman.ExecGet(obj.CompleteName(name), function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri); _up(); }
62
-
63
- // Perform a WSMAN "PUT" operation.
64
- obj.Put = function (name, putobj, callback, tag, pri, selectors) { obj.wsman.ExecPut(obj.CompleteName(name), putobj, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri, selectors); _up(); }
65
-
66
- // Perform a WSMAN "CREATE" operation.
67
- obj.Create = function (name, putobj, callback, tag, pri) { obj.wsman.ExecCreate(obj.CompleteName(name), putobj, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri); _up(); }
68
-
69
- // Perform a WSMAN "DELETE" operation.
70
- obj.Delete = function (name, putobj, callback, tag, pri) { obj.wsman.ExecDelete(obj.CompleteName(name), putobj, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, response, xstatus, tag); }, 0, pri); _up(); }
71
-
72
- // Perform a WSMAN method call operation.
73
- obj.Exec = function (name, method, args, callback, tag, pri, selectors) { obj.wsman.ExecMethod(obj.CompleteName(name), method, args, function (ws, resuri, response, xstatus) { _up(); callback(obj, name, obj.CompleteExecResponse(response), xstatus, tag); }, 0, pri, selectors); _up(); }
74
-
75
- // Perform a WSMAN method call operation.
76
- obj.ExecWithXml = function (name, method, args, callback, tag, pri, selectors) { obj.wsman.ExecMethodXml(obj.CompleteName(name), method, execArgumentsToXml(args), function (ws, resuri, response, xstatus) { _up(); callback(obj, name, obj.CompleteExecResponse(response), xstatus, tag); }, 0, pri, selectors); _up(); }
77
-
78
- // Perform a WSMAN "ENUMERATE" operation.
79
- obj.Enum = function (name, callback, tag, pri) {
80
- if (obj.ActiveEnumsCount < obj.MaxActiveEnumsCount) {
81
- obj.ActiveEnumsCount++; obj.wsman.ExecEnum(obj.CompleteName(name), function (ws, resuri, response, xstatus, tag0) { _up(); _EnumStartSink(name, response, callback, resuri, xstatus, tag0); }, tag, pri);
82
- } else {
83
- obj.PendingEnums.push([name, callback, tag, pri]);
84
- }
85
- _up();
86
- }
87
-
88
- // Private method
89
- function _EnumStartSink(name, response, callback, resuri, status, tag, pri) {
90
- if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; }
91
- if (response == null || response.Header["Method"] != "EnumerateResponse" || !response.Body["EnumerationContext"]) { callback(obj, name, null, 603, tag); _EnumDoNext(1); return; }
92
- var enumctx = response.Body["EnumerationContext"];
93
- obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, [], xstatus, tag, pri); });
94
- }
95
-
96
- // Private method
97
- function _EnumContinueSink(name, response, callback, resuri, items, status, tag, pri) {
98
- if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; }
99
- if (response == null || response.Header["Method"] != "PullResponse") { callback(obj, name, null, 604, tag); _EnumDoNext(1); return; }
100
- for (var i in response.Body["Items"]) {
101
- if (response.Body["Items"][i] instanceof Array) {
102
- for (var j in response.Body["Items"][i]) { items.push(response.Body["Items"][i][j]); }
103
- } else {
104
- items.push(response.Body["Items"][i]);
105
- }
106
- }
107
- if (response.Body["EnumerationContext"]) {
108
- var enumctx = response.Body["EnumerationContext"];
109
- obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, items, xstatus, tag, 1); });
110
- } else {
111
- _EnumDoNext(1);
112
- callback(obj, name, items, status, tag);
113
- _up();
114
- }
115
- }
116
-
117
- // Private method
118
- function _EnumDoNext(dec) {
119
- obj.ActiveEnumsCount -= dec;
120
- if (obj.ActiveEnumsCount >= obj.MaxActiveEnumsCount || obj.PendingEnums.length == 0) return;
121
- var x = obj.PendingEnums.shift();
122
- obj.Enum(x[0], x[1], x[2]);
123
- _EnumDoNext(0);
124
- }
125
-
126
- // Perform a batch of WSMAN "ENUM" operations.
127
- obj.BatchEnum = function (batchname, names, callback, tag, continueOnError, pri) {
128
- obj.PendingBatchOperations += (names.length * 2);
129
- _BatchNextEnum(batchname, Clone(names), callback, tag, {}, continueOnError, pri); _up();
130
- }
131
-
132
- function Clone(v) { return JSON.parse(JSON.stringify(v)); }
133
-
134
- // Request each enum in the batch, stopping if something does not return status 200
135
- function _BatchNextEnum(batchname, names, callback, tag, results, continueOnError, pri) {
136
- obj.PendingBatchOperations -= 2;
137
- var n = names.shift(), f = obj.Enum;
138
- if (n[0] == '*') { f = obj.Get; n = n.substring(1); } // If the name starts with a star, do a GET instead of an ENUM. This will reduce round trips.
139
- //console.log((f == obj.Get?'Get ':'Enum ') + n);
140
- // Perform a GET/ENUM action
141
- f(n, function (stack, name, responses, status, tag0) {
142
- tag0[2][name] = { response: (responses==null?null:responses.Body), responses: responses, status: status };
143
- if (tag0[1].length == 0 || status == 401 || (continueOnError != true && status != 200 && status != 400)) { obj.PendingBatchOperations -= (names.length * 2); _up(); callback(obj, batchname, tag0[2], status, tag); }
144
- else { _up(); _BatchNextEnum(batchname, names, callback, tag, tag0[2], pri); }
145
- }, [batchname, names, results], pri);
146
- _up();
147
- }
148
-
149
- // Perform a batch of WSMAN "GET" operations.
150
- obj.BatchGet = function (batchname, names, callback, tag, pri) {
151
- _FetchNext({ name: batchname, names: names, callback: callback, current: 0, responses: {}, tag: tag, pri: pri }); _up();
152
- }
153
-
154
- // Private method
155
- function _FetchNext(batch) {
156
- if (batch.names.length <= batch.current) {
157
- batch.callback(obj, batch.name, batch.responses, 200, batch.tag);
158
- } else {
159
- obj.wsman.ExecGet(obj.CompleteName(batch.names[batch.current]), function (ws, resuri, response, xstatus) { _Fetched(batch, response, xstatus); }, batch.pri);
160
- batch.current++;
161
- }
162
- _up();
163
- }
164
-
165
- // Private method
166
- function _Fetched(batch, response, status) {
167
- if (response == null || status != 200) {
168
- batch.callback(obj, batch.name, null, status, batch.tag);
169
- } else {
170
- batch.responses[response.Header["Method"]] = response;
171
- _FetchNext(batch);
172
- }
173
- }
174
-
175
- // Private method
176
- obj.CompleteName = function(name) {
177
- if (name.indexOf("AMT_") == 0) return obj.pfx[0] + name;
178
- if (name.indexOf("CIM_") == 0) return obj.pfx[1] + name;
179
- if (name.indexOf("IPS_") == 0) return obj.pfx[2] + name;
180
- }
181
-
182
- obj.CompleteExecResponse = function (resp) {
183
- if (resp && resp != null && resp.Body && (resp.Body["ReturnValue"] != undefined)) { resp.Body.ReturnValueStr = obj.AmtStatusToStr(resp.Body["ReturnValue"]); }
184
- return resp;
185
- }
186
-
187
- obj.RequestPowerStateChange = function (PowerState, callback_func) {
188
- obj.CIM_PowerManagementService_RequestPowerStateChange(PowerState, "<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"CreationClassName\">CIM_ComputerSystem</Selector><Selector Name=\"Name\">ManagedSystem</Selector></SelectorSet></ReferenceParameters>", null, null, callback_func);
189
- }
190
-
191
- obj.SetBootConfigRole = function (Role, callback_func) {
192
- obj.CIM_BootService_SetBootConfigRole("<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"InstanceID\">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>", Role, callback_func);
193
- }
194
-
195
- // Cancel all pending queries with given status
196
- obj.CancelAllQueries = function (s) {
197
- obj.wsman.CancelAllQueries(s);
198
- }
199
-
200
- // Auto generated methods
201
- obj.AMT_AgentPresenceWatchdog_RegisterAgent = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "RegisterAgent", {}, callback_func); }
202
- obj.AMT_AgentPresenceWatchdog_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "AssertPresence", { "SequenceNumber": SequenceNumber }, callback_func); }
203
- obj.AMT_AgentPresenceWatchdog_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "AssertShutdown", { "SequenceNumber": SequenceNumber }, callback_func); }
204
- obj.AMT_AgentPresenceWatchdog_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func, tag, pri, selectors) { obj.Exec("AMT_AgentPresenceWatchdog", "AddAction", { "OldState": OldState, "NewState": NewState, "EventOnTransition": EventOnTransition, "ActionSd": ActionSd, "ActionEac": ActionEac }, callback_func, tag, pri, selectors); }
205
- obj.AMT_AgentPresenceWatchdog_DeleteAllActions = function (callback_func, tag, pri, selectors) { obj.Exec("AMT_AgentPresenceWatchdog", "DeleteAllActions", {}, callback_func, tag, pri, selectors); }
206
- obj.AMT_AgentPresenceWatchdogAction_GetActionEac = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdogAction", "GetActionEac", {}, callback_func); }
207
- obj.AMT_AgentPresenceWatchdogVA_RegisterAgent = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "RegisterAgent", {}, callback_func); }
208
- obj.AMT_AgentPresenceWatchdogVA_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AssertPresence", { "SequenceNumber": SequenceNumber }, callback_func); }
209
- obj.AMT_AgentPresenceWatchdogVA_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AssertShutdown", { "SequenceNumber": SequenceNumber }, callback_func); }
210
- obj.AMT_AgentPresenceWatchdogVA_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AddAction", { "OldState": OldState, "NewState": NewState, "EventOnTransition": EventOnTransition, "ActionSd": ActionSd, "ActionEac": ActionEac }, callback_func); }
211
- obj.AMT_AgentPresenceWatchdogVA_DeleteAllActions = function (_method_dummy, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions", { "_method_dummy": _method_dummy }, callback_func); }
212
- obj.AMT_AuditLog_ClearLog = function (callback_func) { obj.Exec("AMT_AuditLog", "ClearLog", {}, callback_func); }
213
- obj.AMT_AuditLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_AuditLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
214
- obj.AMT_AuditLog_ReadRecords = function (StartIndex, callback_func, tag) { obj.Exec("AMT_AuditLog", "ReadRecords", { "StartIndex": StartIndex }, callback_func, tag); }
215
- obj.AMT_AuditLog_SetAuditLock = function (LockTimeoutInSeconds, Flag, Handle, callback_func) { obj.Exec("AMT_AuditLog", "SetAuditLock", { "LockTimeoutInSeconds": LockTimeoutInSeconds, "Flag": Flag, "Handle": Handle }, callback_func); }
216
- obj.AMT_AuditLog_ExportAuditLogSignature = function (SigningMechanism, callback_func) { obj.Exec("AMT_AuditLog", "ExportAuditLogSignature", { "SigningMechanism": SigningMechanism }, callback_func); }
217
- obj.AMT_AuditLog_SetSigningKeyMaterial = function (SigningMechanismType, SigningKey, LengthOfCertificates, Certificates, callback_func) { obj.Exec("AMT_AuditLog", "SetSigningKeyMaterial", { "SigningMechanismType": SigningMechanismType, "SigningKey": SigningKey, "LengthOfCertificates": LengthOfCertificates, "Certificates": Certificates }, callback_func); }
218
- obj.AMT_AuditPolicyRule_SetAuditPolicy = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec("AMT_AuditPolicyRule", "SetAuditPolicy", { "Enable": Enable, "AuditedAppID": AuditedAppID, "EventID": EventID, "PolicyType": PolicyType }, callback_func); }
219
- obj.AMT_AuditPolicyRule_SetAuditPolicyBulk = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk", { "Enable": Enable, "AuditedAppID": AuditedAppID, "EventID": EventID, "PolicyType": PolicyType }, callback_func); }
220
- obj.AMT_AuthorizationService_AddUserAclEntryEx = function (DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec("AMT_AuthorizationService", "AddUserAclEntryEx", { "DigestUsername": DigestUsername, "DigestPassword": DigestPassword, "KerberosUserSid": KerberosUserSid, "AccessPermission": AccessPermission, "Realms": Realms }, callback_func); }
221
- obj.AMT_AuthorizationService_EnumerateUserAclEntries = function (StartIndex, callback_func) { obj.Exec("AMT_AuthorizationService", "EnumerateUserAclEntries", { "StartIndex": StartIndex }, callback_func); }
222
- obj.AMT_AuthorizationService_GetUserAclEntryEx = function (Handle, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "GetUserAclEntryEx", { "Handle": Handle }, callback_func, tag); }
223
- obj.AMT_AuthorizationService_UpdateUserAclEntryEx = function (Handle, DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec("AMT_AuthorizationService", "UpdateUserAclEntryEx", { "Handle": Handle, "DigestUsername": DigestUsername, "DigestPassword": DigestPassword, "KerberosUserSid": KerberosUserSid, "AccessPermission": AccessPermission, "Realms": Realms }, callback_func); }
224
- obj.AMT_AuthorizationService_RemoveUserAclEntry = function (Handle, callback_func) { obj.Exec("AMT_AuthorizationService", "RemoveUserAclEntry", { "Handle": Handle }, callback_func); }
225
- obj.AMT_AuthorizationService_SetAdminAclEntryEx = function (Username, DigestPassword, callback_func) { obj.Exec("AMT_AuthorizationService", "SetAdminAclEntryEx", { "Username": Username, "DigestPassword": DigestPassword }, callback_func); }
226
- obj.AMT_AuthorizationService_GetAdminAclEntry = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminAclEntry", {}, callback_func); }
227
- obj.AMT_AuthorizationService_GetAdminAclEntryStatus = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminAclEntryStatus", {}, callback_func); }
228
- obj.AMT_AuthorizationService_GetAdminNetAclEntryStatus = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminNetAclEntryStatus", {}, callback_func); }
229
- obj.AMT_AuthorizationService_SetAclEnabledState = function (Handle, Enabled, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "SetAclEnabledState", { "Handle": Handle, "Enabled": Enabled }, callback_func, tag); }
230
- obj.AMT_AuthorizationService_GetAclEnabledState = function (Handle, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "GetAclEnabledState", { "Handle": Handle }, callback_func, tag); }
231
- obj.AMT_EndpointAccessControlService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
232
- obj.AMT_EndpointAccessControlService_GetPosture = function (PostureType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetPosture", { "PostureType": PostureType }, callback_func); }
233
- obj.AMT_EndpointAccessControlService_GetPostureHash = function (PostureType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetPostureHash", { "PostureType": PostureType }, callback_func); }
234
- obj.AMT_EndpointAccessControlService_UpdatePostureState = function (UpdateType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "UpdatePostureState", { "UpdateType": UpdateType }, callback_func); }
235
- obj.AMT_EndpointAccessControlService_GetEacOptions = function (callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetEacOptions", {}, callback_func); }
236
- obj.AMT_EndpointAccessControlService_SetEacOptions = function (EacVendors, PostureHashAlgorithm, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "SetEacOptions", { "EacVendors": EacVendors, "PostureHashAlgorithm": PostureHashAlgorithm }, callback_func); }
237
- obj.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy = function (Policy, callback_func) { obj.Exec("AMT_EnvironmentDetectionSettingData", "SetSystemDefensePolicy", { "Policy": Policy }, callback_func); }
238
- obj.AMT_EnvironmentDetectionSettingData_EnableVpnRouting = function (Enable, callback_func) { obj.Exec("AMT_EnvironmentDetectionSettingData", "EnableVpnRouting", { "Enable": Enable }, callback_func); }
239
- obj.AMT_EthernetPortSettings_SetLinkPreference = function (LinkPreference, Timeout, callback_func) { obj.Exec("AMT_EthernetPortSettings", "SetLinkPreference", { "LinkPreference": LinkPreference, "Timeout": Timeout }, callback_func); }
240
- obj.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec("AMT_HeuristicPacketFilterStatistics", "ResetSelectedStats", { "SelectedStatistics": SelectedStatistics }, callback_func); }
241
- obj.AMT_KerberosSettingData_GetCredentialCacheState = function (callback_func) { obj.Exec("AMT_KerberosSettingData", "GetCredentialCacheState", {}, callback_func); }
242
- obj.AMT_KerberosSettingData_SetCredentialCacheState = function (Enable, callback_func) { obj.Exec("AMT_KerberosSettingData", "SetCredentialCacheState", { "Enable": Enable }, callback_func); }
243
- obj.AMT_MessageLog_CancelIteration = function (IterationIdentifier, callback_func) { obj.Exec("AMT_MessageLog", "CancelIteration", { "IterationIdentifier": IterationIdentifier }, callback_func); }
244
- obj.AMT_MessageLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_MessageLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
245
- obj.AMT_MessageLog_ClearLog = function (callback_func) { obj.Exec("AMT_MessageLog", "ClearLog", { }, callback_func); }
246
- obj.AMT_MessageLog_GetRecords = function (IterationIdentifier, MaxReadRecords, callback_func, tag) { obj.Exec("AMT_MessageLog", "GetRecords", { "IterationIdentifier": IterationIdentifier, "MaxReadRecords": MaxReadRecords }, callback_func, tag); }
247
- obj.AMT_MessageLog_GetRecord = function (IterationIdentifier, PositionToNext, callback_func) { obj.Exec("AMT_MessageLog", "GetRecord", { "IterationIdentifier": IterationIdentifier, "PositionToNext": PositionToNext }, callback_func); }
248
- obj.AMT_MessageLog_PositionAtRecord = function (IterationIdentifier, MoveAbsolute, RecordNumber, callback_func) { obj.Exec("AMT_MessageLog", "PositionAtRecord", { "IterationIdentifier": IterationIdentifier, "MoveAbsolute": MoveAbsolute, "RecordNumber": RecordNumber }, callback_func); }
249
- obj.AMT_MessageLog_PositionToFirstRecord = function (callback_func, tag) { obj.Exec("AMT_MessageLog", "PositionToFirstRecord", {}, callback_func, tag); }
250
- obj.AMT_MessageLog_FreezeLog = function (Freeze, callback_func) { obj.Exec("AMT_MessageLog", "FreezeLog", { "Freeze": Freeze }, callback_func); }
251
- obj.AMT_PublicKeyManagementService_AddCRL = function (Url, SerialNumbers, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddCRL", { "Url": Url, "SerialNumbers": SerialNumbers }, callback_func); }
252
- obj.AMT_PublicKeyManagementService_ResetCRLList = function (_method_dummy, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "ResetCRLList", { "_method_dummy": _method_dummy }, callback_func); }
253
- obj.AMT_PublicKeyManagementService_AddCertificate = function (CertificateBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddCertificate", { "CertificateBlob": CertificateBlob }, callback_func); }
254
- obj.AMT_PublicKeyManagementService_AddTrustedRootCertificate = function (CertificateBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddTrustedRootCertificate", { "CertificateBlob": CertificateBlob }, callback_func); }
255
- obj.AMT_PublicKeyManagementService_AddKey = function (KeyBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddKey", { "KeyBlob": KeyBlob }, callback_func); }
256
- obj.AMT_PublicKeyManagementService_GeneratePKCS10Request = function (KeyPair, DNName, Usage, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GeneratePKCS10Request", { "KeyPair": KeyPair, "DNName": DNName, "Usage": Usage }, callback_func); }
257
- obj.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx = function (KeyPair, SigningAlgorithm, NullSignedCertificateRequest, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GeneratePKCS10RequestEx", { "KeyPair": KeyPair, "SigningAlgorithm": SigningAlgorithm, "NullSignedCertificateRequest": NullSignedCertificateRequest }, callback_func); }
258
- obj.AMT_PublicKeyManagementService_GenerateKeyPair = function (KeyAlgorithm, KeyLength, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GenerateKeyPair", { "KeyAlgorithm": KeyAlgorithm, "KeyLength": KeyLength }, callback_func); }
259
- obj.AMT_RedirectionService_RequestStateChange = function (RequestedState, callback_func) { obj.Exec("AMT_RedirectionService", "RequestStateChange", { "RequestedState": RequestedState }, callback_func); }
260
- obj.AMT_RedirectionService_TerminateSession = function (SessionType, callback_func) { obj.Exec("AMT_RedirectionService", "TerminateSession", { "SessionType": SessionType }, callback_func); }
261
- obj.AMT_RemoteAccessService_AddMpServer = function (AccessInfo, InfoFormat, Port, AuthMethod, Certificate, Username, Password, CN, callback_func) { obj.Exec("AMT_RemoteAccessService", "AddMpServer", { "AccessInfo": AccessInfo, "InfoFormat": InfoFormat, "Port": Port, "AuthMethod": AuthMethod, "Certificate": Certificate, "Username": Username, "Password": Password, "CN": CN }, callback_func); }
262
- obj.AMT_RemoteAccessService_AddRemoteAccessPolicyRule = function (Trigger, TunnelLifeTime, ExtendedData, MpServer, callback_func) { obj.Exec("AMT_RemoteAccessService", "AddRemoteAccessPolicyRule", { "Trigger": Trigger, "TunnelLifeTime": TunnelLifeTime, "ExtendedData": ExtendedData, "MpServer": MpServer }, callback_func); }
263
- obj.AMT_RemoteAccessService_CloseRemoteAccessConnection = function (_method_dummy, callback_func) { obj.Exec("AMT_RemoteAccessService", "CloseRemoteAccessConnection", { "_method_dummy": _method_dummy }, callback_func); }
264
- obj.AMT_SetupAndConfigurationService_CommitChanges = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "CommitChanges", { "_method_dummy": _method_dummy }, callback_func); }
265
- obj.AMT_SetupAndConfigurationService_Unprovision = function (ProvisioningMode, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "Unprovision", { "ProvisioningMode": ProvisioningMode }, callback_func); }
266
- obj.AMT_SetupAndConfigurationService_PartialUnprovision = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "PartialUnprovision", { "_method_dummy": _method_dummy }, callback_func); }
267
- obj.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "ResetFlashWearOutProtection", { "_method_dummy": _method_dummy }, callback_func); }
268
- obj.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod = function (Duration, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "ExtendProvisioningPeriod", { "Duration": Duration }, callback_func); }
269
- obj.AMT_SetupAndConfigurationService_SetMEBxPassword = function (Password, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "SetMEBxPassword", { "Password": Password }, callback_func); }
270
- obj.AMT_SetupAndConfigurationService_SetTLSPSK = function (PID, PPS, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "SetTLSPSK", { "PID": PID, "PPS": PPS }, callback_func); }
271
- obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord", {}, callback_func); }
272
- obj.AMT_SetupAndConfigurationService_GetUuid = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetUuid", {}, callback_func); }
273
- obj.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetUnprovisionBlockingComponents", {}, callback_func); }
274
- obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2 = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecordV2", {}, callback_func); }
275
- obj.AMT_SystemDefensePolicy_GetTimeout = function (callback_func) { obj.Exec("AMT_SystemDefensePolicy", "GetTimeout", {}, callback_func); }
276
- obj.AMT_SystemDefensePolicy_SetTimeout = function (Timeout, callback_func) { obj.Exec("AMT_SystemDefensePolicy", "SetTimeout", { "Timeout": Timeout }, callback_func); }
277
- obj.AMT_SystemDefensePolicy_UpdateStatistics = function (NetworkInterface, ResetOnRead, callback_func, tag, pri, selectors) { obj.Exec("AMT_SystemDefensePolicy", "UpdateStatistics", { "NetworkInterface": NetworkInterface, "ResetOnRead": ResetOnRead }, callback_func, tag, pri, selectors); }
278
- obj.AMT_SystemPowerScheme_SetPowerScheme = function (callback_func, schemeInstanceId, tag) { obj.Exec("AMT_SystemPowerScheme", "SetPowerScheme", {}, callback_func, tag, 0, { "InstanceID": schemeInstanceId }); }
279
- obj.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch = function (callback_func, tag) { obj.Exec("AMT_TimeSynchronizationService", "GetLowAccuracyTimeSynch", {}, callback_func, tag); }
280
- obj.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch = function (Ta0, Tm1, Tm2, callback_func, tag) { obj.Exec("AMT_TimeSynchronizationService", "SetHighAccuracyTimeSynch", { "Ta0": Ta0, "Tm1": Tm1, "Tm2": Tm2 }, callback_func, tag); }
281
- obj.AMT_UserInitiatedConnectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_UserInitiatedConnectionService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
282
- obj.AMT_WebUIService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_WebUIService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
283
- obj.AMT_WiFiPortConfigurationService_AddWiFiSettings = function (WiFiEndpoint, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml("AMT_WiFiPortConfigurationService", "AddWiFiSettings", { "WiFiEndpoint": WiFiEndpoint, "WiFiEndpointSettingsInput": WiFiEndpointSettingsInput, "IEEE8021xSettingsInput": IEEE8021xSettingsInput, "ClientCredential": ClientCredential, "CACredential": CACredential }, callback_func); }
284
- obj.AMT_WiFiPortConfigurationService_UpdateWiFiSettings = function (WiFiEndpointSettings, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml("AMT_WiFiPortConfigurationService", "UpdateWiFiSettings", { "WiFiEndpointSettings": WiFiEndpointSettings, "WiFiEndpointSettingsInput": WiFiEndpointSettingsInput, "IEEE8021xSettingsInput": IEEE8021xSettingsInput, "ClientCredential": ClientCredential, "CACredential": CACredential }, callback_func); }
285
- obj.AMT_WiFiPortConfigurationService_DeleteAllITProfiles = function (_method_dummy, callback_func) { obj.Exec("AMT_WiFiPortConfigurationService", "DeleteAllITProfiles", { "_method_dummy": _method_dummy }, callback_func); }
286
- obj.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles = function (_method_dummy, callback_func) { obj.Exec("AMT_WiFiPortConfigurationService", "DeleteAllUserProfiles", { "_method_dummy": _method_dummy }, callback_func); }
287
- obj.CIM_Account_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Account", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
288
- obj.CIM_AccountManagementService_CreateAccount = function (System, AccountTemplate, callback_func) { obj.Exec("CIM_AccountManagementService", "CreateAccount", { "System": System, "AccountTemplate": AccountTemplate }, callback_func); }
289
- obj.CIM_BootConfigSetting_ChangeBootOrder = function (Source, callback_func) { obj.Exec("CIM_BootConfigSetting", "ChangeBootOrder", { "Source": Source }, callback_func); }
290
- obj.CIM_BootService_SetBootConfigRole = function (BootConfigSetting, Role, callback_func) { obj.Exec("CIM_BootService", "SetBootConfigRole", { "BootConfigSetting": BootConfigSetting, "Role": Role }, callback_func, 0, 1); }
291
- obj.CIM_Card_ConnectorPower = function (Connector, PoweredOn, callback_func) { obj.Exec("CIM_Card", "ConnectorPower", { "Connector": Connector, "PoweredOn": PoweredOn }, callback_func); }
292
- obj.CIM_Card_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_Card", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
293
- obj.CIM_Chassis_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_Chassis", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
294
- obj.CIM_Fan_SetSpeed = function (DesiredSpeed, callback_func) { obj.Exec("CIM_Fan", "SetSpeed", { "DesiredSpeed": DesiredSpeed }, callback_func); }
295
- obj.CIM_KVMRedirectionSAP_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_KVMRedirectionSAP", "RequestStateChange", { "RequestedState": RequestedState/*, "TimeoutPeriod": TimeoutPeriod */}, callback_func); }
296
- obj.CIM_MediaAccessDevice_LockMedia = function (Lock, callback_func) { obj.Exec("CIM_MediaAccessDevice", "LockMedia", { "Lock": Lock }, callback_func); }
297
- obj.CIM_MediaAccessDevice_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_MediaAccessDevice", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
298
- obj.CIM_MediaAccessDevice_Reset = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "Reset", {}, callback_func); }
299
- obj.CIM_MediaAccessDevice_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_MediaAccessDevice", "EnableDevice", { "Enabled": Enabled }, callback_func); }
300
- obj.CIM_MediaAccessDevice_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_MediaAccessDevice", "OnlineDevice", { "Online": Online }, callback_func); }
301
- obj.CIM_MediaAccessDevice_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_MediaAccessDevice", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
302
- obj.CIM_MediaAccessDevice_SaveProperties = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "SaveProperties", {}, callback_func); }
303
- obj.CIM_MediaAccessDevice_RestoreProperties = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "RestoreProperties", {}, callback_func); }
304
- obj.CIM_MediaAccessDevice_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_MediaAccessDevice", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
305
- obj.CIM_PhysicalFrame_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_PhysicalFrame", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
306
- obj.CIM_PhysicalPackage_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_PhysicalPackage", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); }
307
- obj.CIM_PowerManagementService_RequestPowerStateChange = function (PowerState, ManagedElement, Time, TimeoutPeriod, callback_func) { obj.Exec("CIM_PowerManagementService", "RequestPowerStateChange", { "PowerState": PowerState, "ManagedElement": ManagedElement, "Time": Time, "TimeoutPeriod": TimeoutPeriod }, callback_func, 0, 1); }
308
- obj.CIM_PowerSupply_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_PowerSupply", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
309
- obj.CIM_PowerSupply_Reset = function (callback_func) { obj.Exec("CIM_PowerSupply", "Reset", {}, callback_func); }
310
- obj.CIM_PowerSupply_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_PowerSupply", "EnableDevice", { "Enabled": Enabled }, callback_func); }
311
- obj.CIM_PowerSupply_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_PowerSupply", "OnlineDevice", { "Online": Online }, callback_func); }
312
- obj.CIM_PowerSupply_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_PowerSupply", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
313
- obj.CIM_PowerSupply_SaveProperties = function (callback_func) { obj.Exec("CIM_PowerSupply", "SaveProperties", {}, callback_func); }
314
- obj.CIM_PowerSupply_RestoreProperties = function (callback_func) { obj.Exec("CIM_PowerSupply", "RestoreProperties", {}, callback_func); }
315
- obj.CIM_PowerSupply_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_PowerSupply", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
316
- obj.CIM_Processor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Processor", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
317
- obj.CIM_Processor_Reset = function (callback_func) { obj.Exec("CIM_Processor", "Reset", {}, callback_func); }
318
- obj.CIM_Processor_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Processor", "EnableDevice", { "Enabled": Enabled }, callback_func); }
319
- obj.CIM_Processor_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Processor", "OnlineDevice", { "Online": Online }, callback_func); }
320
- obj.CIM_Processor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Processor", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
321
- obj.CIM_Processor_SaveProperties = function (callback_func) { obj.Exec("CIM_Processor", "SaveProperties", {}, callback_func); }
322
- obj.CIM_Processor_RestoreProperties = function (callback_func) { obj.Exec("CIM_Processor", "RestoreProperties", {}, callback_func); }
323
- obj.CIM_Processor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Processor", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
324
- obj.CIM_RecordLog_ClearLog = function (callback_func) { obj.Exec("CIM_RecordLog", "ClearLog", {}, callback_func); }
325
- obj.CIM_RecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_RecordLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
326
- obj.CIM_RedirectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_RedirectionService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
327
- obj.CIM_Sensor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Sensor", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
328
- obj.CIM_Sensor_Reset = function (callback_func) { obj.Exec("CIM_Sensor", "Reset", {}, callback_func); }
329
- obj.CIM_Sensor_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Sensor", "EnableDevice", { "Enabled": Enabled }, callback_func); }
330
- obj.CIM_Sensor_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Sensor", "OnlineDevice", { "Online": Online }, callback_func); }
331
- obj.CIM_Sensor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Sensor", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
332
- obj.CIM_Sensor_SaveProperties = function (callback_func) { obj.Exec("CIM_Sensor", "SaveProperties", {}, callback_func); }
333
- obj.CIM_Sensor_RestoreProperties = function (callback_func) { obj.Exec("CIM_Sensor", "RestoreProperties", {}, callback_func); }
334
- obj.CIM_Sensor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Sensor", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
335
- obj.CIM_StatisticalData_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec("CIM_StatisticalData", "ResetSelectedStats", { "SelectedStatistics": SelectedStatistics }, callback_func); }
336
- obj.CIM_Watchdog_KeepAlive = function (callback_func) { obj.Exec("CIM_Watchdog", "KeepAlive", {}, callback_func); }
337
- obj.CIM_Watchdog_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Watchdog", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
338
- obj.CIM_Watchdog_Reset = function (callback_func) { obj.Exec("CIM_Watchdog", "Reset", {}, callback_func); }
339
- obj.CIM_Watchdog_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Watchdog", "EnableDevice", { "Enabled": Enabled }, callback_func); }
340
- obj.CIM_Watchdog_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Watchdog", "OnlineDevice", { "Online": Online }, callback_func); }
341
- obj.CIM_Watchdog_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Watchdog", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
342
- obj.CIM_Watchdog_SaveProperties = function (callback_func) { obj.Exec("CIM_Watchdog", "SaveProperties", {}, callback_func); }
343
- obj.CIM_Watchdog_RestoreProperties = function (callback_func) { obj.Exec("CIM_Watchdog", "RestoreProperties", {}, callback_func); }
344
- obj.CIM_Watchdog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Watchdog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
345
- obj.CIM_WiFiPort_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_WiFiPort", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); }
346
- obj.CIM_WiFiPort_Reset = function (callback_func) { obj.Exec("CIM_WiFiPort", "Reset", {}, callback_func); }
347
- obj.CIM_WiFiPort_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_WiFiPort", "EnableDevice", { "Enabled": Enabled }, callback_func); }
348
- obj.CIM_WiFiPort_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_WiFiPort", "OnlineDevice", { "Online": Online }, callback_func); }
349
- obj.CIM_WiFiPort_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_WiFiPort", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); }
350
- obj.CIM_WiFiPort_SaveProperties = function (callback_func) { obj.Exec("CIM_WiFiPort", "SaveProperties", {}, callback_func); }
351
- obj.CIM_WiFiPort_RestoreProperties = function (callback_func) { obj.Exec("CIM_WiFiPort", "RestoreProperties", {}, callback_func); }
352
- obj.CIM_WiFiPort_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_WiFiPort", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
353
- obj.IPS_HostBasedSetupService_Setup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, Certificate, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "Setup", { "NetAdminPassEncryptionType": NetAdminPassEncryptionType, "NetworkAdminPassword": NetworkAdminPassword, "McNonce": McNonce, "Certificate": Certificate, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
354
- obj.IPS_HostBasedSetupService_AddNextCertInChain = function (NextCertificate, IsLeafCertificate, IsRootCertificate, callback_func) { obj.Exec("IPS_HostBasedSetupService", "AddNextCertInChain", { "NextCertificate": NextCertificate, "IsLeafCertificate": IsLeafCertificate, "IsRootCertificate": IsRootCertificate }, callback_func); }
355
- obj.IPS_HostBasedSetupService_AdminSetup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "AdminSetup", { "NetAdminPassEncryptionType": NetAdminPassEncryptionType, "NetworkAdminPassword": NetworkAdminPassword, "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
356
- obj.IPS_HostBasedSetupService_UpgradeClientToAdmin = function (McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "UpgradeClientToAdmin", { "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
357
- obj.IPS_HostBasedSetupService_DisableClientControlMode = function (_method_dummy, callback_func) { obj.Exec("IPS_HostBasedSetupService", "DisableClientControlMode", { "_method_dummy": _method_dummy }, callback_func); }
358
- obj.IPS_KVMRedirectionSettingData_TerminateSession = function (callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "TerminateSession", {}, callback_func); }
359
- obj.IPS_OptInService_StartOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "StartOptIn", {}, callback_func); }
360
- obj.IPS_OptInService_CancelOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "CancelOptIn", {}, callback_func); }
361
- obj.IPS_OptInService_SendOptInCode = function (OptInCode, callback_func) { obj.Exec("IPS_OptInService", "SendOptInCode", { "OptInCode": OptInCode }, callback_func); }
362
- obj.IPS_OptInService_StartService = function (callback_func) { obj.Exec("IPS_OptInService", "StartService", {}, callback_func); }
363
- obj.IPS_OptInService_StopService = function (callback_func) { obj.Exec("IPS_OptInService", "StopService", {}, callback_func); }
364
- obj.IPS_OptInService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_OptInService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
365
- obj.IPS_ProvisioningRecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_ProvisioningRecordLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
366
- obj.IPS_ProvisioningRecordLog_ClearLog = function (_method_dummy, callback_func) { obj.Exec("IPS_ProvisioningRecordLog", "ClearLog", { "_method_dummy": _method_dummy }, callback_func); }
367
- obj.IPS_SecIOService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_SecIOService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); }
368
-
369
- obj.AmtStatusToStr = function (code) { if (obj.AmtStatusCodes[code]) return obj.AmtStatusCodes[code]; else return "UNKNOWN_ERROR" }
370
- obj.AmtStatusCodes = {
371
- 0x0000: "SUCCESS",
372
- 0x0001: "INTERNAL_ERROR",
373
- 0x0002: "NOT_READY",
374
- 0x0003: "INVALID_PT_MODE",
375
- 0x0004: "INVALID_MESSAGE_LENGTH",
376
- 0x0005: "TABLE_FINGERPRINT_NOT_AVAILABLE",
377
- 0x0006: "INTEGRITY_CHECK_FAILED",
378
- 0x0007: "UNSUPPORTED_ISVS_VERSION",
379
- 0x0008: "APPLICATION_NOT_REGISTERED",
380
- 0x0009: "INVALID_REGISTRATION_DATA",
381
- 0x000A: "APPLICATION_DOES_NOT_EXIST",
382
- 0x000B: "NOT_ENOUGH_STORAGE",
383
- 0x000C: "INVALID_NAME",
384
- 0x000D: "BLOCK_DOES_NOT_EXIST",
385
- 0x000E: "INVALID_BYTE_OFFSET",
386
- 0x000F: "INVALID_BYTE_COUNT",
387
- 0x0010: "NOT_PERMITTED",
388
- 0x0011: "NOT_OWNER",
389
- 0x0012: "BLOCK_LOCKED_BY_OTHER",
390
- 0x0013: "BLOCK_NOT_LOCKED",
391
- 0x0014: "INVALID_GROUP_PERMISSIONS",
392
- 0x0015: "GROUP_DOES_NOT_EXIST",
393
- 0x0016: "INVALID_MEMBER_COUNT",
394
- 0x0017: "MAX_LIMIT_REACHED",
395
- 0x0018: "INVALID_AUTH_TYPE",
396
- 0x0019: "AUTHENTICATION_FAILED",
397
- 0x001A: "INVALID_DHCP_MODE",
398
- 0x001B: "INVALID_IP_ADDRESS",
399
- 0x001C: "INVALID_DOMAIN_NAME",
400
- 0x001D: "UNSUPPORTED_VERSION",
401
- 0x001E: "REQUEST_UNEXPECTED",
402
- 0x001F: "INVALID_TABLE_TYPE",
403
- 0x0020: "INVALID_PROVISIONING_STATE",
404
- 0x0021: "UNSUPPORTED_OBJECT",
405
- 0x0022: "INVALID_TIME",
406
- 0x0023: "INVALID_INDEX",
407
- 0x0024: "INVALID_PARAMETER",
408
- 0x0025: "INVALID_NETMASK",
409
- 0x0026: "FLASH_WRITE_LIMIT_EXCEEDED",
410
- 0x0027: "INVALID_IMAGE_LENGTH",
411
- 0x0028: "INVALID_IMAGE_SIGNATURE",
412
- 0x0029: "PROPOSE_ANOTHER_VERSION",
413
- 0x002A: "INVALID_PID_FORMAT",
414
- 0x002B: "INVALID_PPS_FORMAT",
415
- 0x002C: "BIST_COMMAND_BLOCKED",
416
- 0x002D: "CONNECTION_FAILED",
417
- 0x002E: "CONNECTION_TOO_MANY",
418
- 0x002F: "RNG_GENERATION_IN_PROGRESS",
419
- 0x0030: "RNG_NOT_READY",
420
- 0x0031: "CERTIFICATE_NOT_READY",
421
- 0x0400: "DISABLED_BY_POLICY",
422
- 0x0800: "NETWORK_IF_ERROR_BASE",
423
- 0x0801: "UNSUPPORTED_OEM_NUMBER",
424
- 0x0802: "UNSUPPORTED_BOOT_OPTION",
425
- 0x0803: "INVALID_COMMAND",
426
- 0x0804: "INVALID_SPECIAL_COMMAND",
427
- 0x0805: "INVALID_HANDLE",
428
- 0x0806: "INVALID_PASSWORD",
429
- 0x0807: "INVALID_REALM",
430
- 0x0808: "STORAGE_ACL_ENTRY_IN_USE",
431
- 0x0809: "DATA_MISSING",
432
- 0x080A: "DUPLICATE",
433
- 0x080B: "EVENTLOG_FROZEN",
434
- 0x080C: "PKI_MISSING_KEYS",
435
- 0x080D: "PKI_GENERATING_KEYS",
436
- 0x080E: "INVALID_KEY",
437
- 0x080F: "INVALID_CERT",
438
- 0x0810: "CERT_KEY_NOT_MATCH",
439
- 0x0811: "MAX_KERB_DOMAIN_REACHED",
440
- 0x0812: "UNSUPPORTED",
441
- 0x0813: "INVALID_PRIORITY",
442
- 0x0814: "NOT_FOUND",
443
- 0x0815: "INVALID_CREDENTIALS",
444
- 0x0816: "INVALID_PASSPHRASE",
445
- 0x0818: "NO_ASSOCIATION",
446
- 0x081B: "AUDIT_FAIL",
447
- 0x081C: "BLOCKING_COMPONENT",
448
- 0x0821: "USER_CONSENT_REQUIRED",
449
- 0x1000: "APP_INTERNAL_ERROR",
450
- 0x1001: "NOT_INITIALIZED",
451
- 0x1002: "LIB_VERSION_UNSUPPORTED",
452
- 0x1003: "INVALID_PARAM",
453
- 0x1004: "RESOURCES",
454
- 0x1005: "HARDWARE_ACCESS_ERROR",
455
- 0x1006: "REQUESTOR_NOT_REGISTERED",
456
- 0x1007: "NETWORK_ERROR",
457
- 0x1008: "PARAM_BUFFER_TOO_SHORT",
458
- 0x1009: "COM_NOT_INITIALIZED_IN_THREAD",
459
- 0x100A: "URL_REQUIRED"
460
- }
461
-
462
- //
463
- // Methods used for getting the event log
464
- //
465
-
466
- obj.GetMessageLog = function (func, tag) {
467
- obj.AMT_MessageLog_PositionToFirstRecord(_GetMessageLog0, [func, tag, []]);
468
- }
469
- function _GetMessageLog0(stack, name, responses, status, tag) {
470
- if (status != 200 || responses.Body["ReturnValue"] != '0') { tag[0](obj, null, tag[2], status); return; }
471
- obj.AMT_MessageLog_GetRecords(responses.Body["IterationIdentifier"], 390, _GetMessageLog1, tag);
472
- }
473
- function _GetMessageLog1(stack, name, responses, status, tag) {
474
- if (status != 200 || responses.Body["ReturnValue"] != '0') { tag[0](obj, null, tag[2], status); return; }
475
- var i, j, x, e, AmtMessages = tag[2], t = new Date(), TimeStamp, ra = responses.Body["RecordArray"];
476
- if (typeof ra === 'string') { responses.Body["RecordArray"] = [responses.Body["RecordArray"]]; }
477
-
478
- for (i in ra) {
479
- e = Buffer.from(ra[i], 'base64');
480
- if (e != null) {
481
- TimeStamp = ReadIntX(e, 0);
482
- if ((TimeStamp > 0) && (TimeStamp < 0xFFFFFFFF)) {
483
- x = { 'DeviceAddress': e[4], 'EventSensorType': e[5], 'EventType': e[6], 'EventOffset': e[7], 'EventSourceType': e[8], 'EventSeverity': e[9], 'SensorNumber': e[10], 'Entity': e[11], 'EntityInstance': e[12], 'EventData': [], 'Time': new Date((TimeStamp + (t.getTimezoneOffset() * 60)) * 1000) };
484
- for (j = 13; j < 21; j++) { x['EventData'].push(e[j]); }
485
- x['EntityStr'] = _SystemEntityTypes[x['Entity']];
486
- x['Desc'] = _GetEventDetailStr(x['EventSensorType'], x['EventOffset'], x['EventData'], x['Entity']);
487
- if (!x['EntityStr']) x['EntityStr'] = "Unknown";
488
- AmtMessages.push(x);
489
- }
490
- }
491
- }
492
-
493
- if (responses.Body["NoMoreRecords"] != true) { obj.AMT_MessageLog_GetRecords(responses.Body["IterationIdentifier"], 390, _GetMessageLog1, [tag[0], AmtMessages, tag[2]]); } else { tag[0](obj, AmtMessages, tag[2]); }
494
- }
495
-
496
- var _EventTrapSourceTypes = "Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split('|');
497
- var _SystemFirmwareError = "Unspecified.|No system memory is physically installed in the system.|No usable system memory, all installed memory has experienced an unrecoverable failure.|Unrecoverable hard-disk/ATAPI/IDE device failure.|Unrecoverable system-board failure.|Unrecoverable diskette subsystem failure.|Unrecoverable hard-disk controller failure.|Unrecoverable PS/2 or USB keyboard failure.|Removable boot media not found.|Unrecoverable video controller failure.|No video device detected.|Firmware (BIOS) ROM corruption detected.|CPU voltage mismatch (processors that share same supply have mismatched voltage requirements)|CPU speed matching failure".split('|');
498
- var _SystemFirmwareProgress = "Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split('|');
499
- var _SystemEntityTypes = "Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split('|');
500
- obj.RealmNames = "||Redirection|PT Administration|Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split('|');
501
- obj.WatchdogCurrentStates = { 1: 'Not Started', 2: 'Stopped', 4: 'Running', 8: 'Expired', 16: 'Suspended' };
502
-
503
- function _GetEventDetailStr(eventSensorType, eventOffset, eventDataField, entity) {
504
-
505
- if (eventSensorType == 15)
506
- {
507
- if (eventDataField[0] == 235) return "Invalid Data";
508
- if (eventOffset == 0) return _SystemFirmwareError[eventDataField[1]];
509
- return _SystemFirmwareProgress[eventDataField[1]];
510
- }
511
-
512
- if (eventSensorType == 18 && eventDataField[0] == 170) // System watchdog event
513
- {
514
- return "Agent watchdog " + char2hex(eventDataField[4]) + char2hex(eventDataField[3]) + char2hex(eventDataField[2]) + char2hex(eventDataField[1]) + "-" + char2hex(eventDataField[6]) + char2hex(eventDataField[5]) + "-... changed to " + obj.WatchdogCurrentStates[eventDataField[7]];
515
- }
516
-
517
- //if (eventSensorType == 5 && eventOffset == 0) // System chassis
518
- //{
519
- // return "Case intrusion";
520
- //}
521
-
522
- //if (eventSensorType == 192 && eventOffset == 0 && eventDataField[0] == 170 && eventDataField[1] == 48)
523
- //{
524
- // if (eventDataField[2] == 0) return "A remote Serial Over LAN session was established.";
525
- // if (eventDataField[2] == 1) return "Remote Serial Over LAN session finished. User control was restored.";
526
- // if (eventDataField[2] == 2) return "A remote IDE-Redirection session was established.";
527
- // if (eventDataField[2] == 3) return "Remote IDE-Redirection session finished. User control was restored.";
528
- //}
529
-
530
- //if (eventSensorType == 36)
531
- //{
532
- // long handle = ((long)(eventDataField[1]) << 24) + ((long)(eventDataField[2]) << 16) + ((long)(eventDataField[3]) << 8) + (long)(eventDataField[4]);
533
- // string nic = string.Format("#{0}", eventDataField[0]);
534
- // if (eventDataField[0] == 0xAA) nic = "wired"; // TODO: Add wireless *****
535
- // //if (eventDataField[0] == 0xAA) nic = "wireless";
536
-
537
- // if (handle == 4294967293) { return string.Format("All received packet filter was matched on {0} interface.", nic); }
538
- // if (handle == 4294967292) { return string.Format("All outbound packet filter was matched on {0} interface.", nic); }
539
- // if (handle == 4294967290) { return string.Format("Spoofed packet filter was matched on {0} interface.", nic); }
540
- // return string.Format("Filter {0} was matched on {1} interface.", handle, nic);
541
- //}
542
-
543
- //if (eventSensorType == 192)
544
- //{
545
- // if (eventDataField[2] == 0) return "Security policy invoked. Some or all network traffic (TX) was stopped.";
546
- // if (eventDataField[2] == 2) return "Security policy invoked. Some or all network traffic (RX) was stopped.";
547
- // return "Security policy invoked.";
548
- //}
549
-
550
- //if (eventSensorType == 193)
551
- //{
552
- // if (eventDataField[0] == 0xAA && eventDataField[1] == 0x30 && eventDataField[2] == 0x00 && eventDataField[3] == 0x00) { return "User request for remote connection."; }
553
- // if (eventDataField[0] == 0xAA && eventDataField[1] == 0x20 && eventDataField[2] == 0x03 && eventDataField[3] == 0x01) { return "EAC error: attempt to get posture while NAC in Intel(r) AMT is disabled."; // eventDataField = 0xAA20030100000000 }
554
- // if (eventDataField[0] == 0xAA && eventDataField[1] == 0x20 && eventDataField[2] == 0x04 && eventDataField[3] == 0x00) { return "Certificate revoked. "; }
555
- //}
556
-
557
- if (eventSensorType == 6) return "Authentication failed " + (eventDataField[1] + (eventDataField[2] << 8)) + " times. The system may be under attack.";
558
- if (eventSensorType == 30) return "No bootable media";
559
- if (eventSensorType == 32) return "Operating system lockup or power interrupt";
560
- if (eventSensorType == 35) return "System boot failure";
561
- if (eventSensorType == 37) return "System firmware started (at least one CPU is properly executing).";
562
- return "Unknown Sensor Type #" + eventSensorType;
563
- }
564
-
565
-// ###BEGIN###{AuditLog}
566
-
567
- // Useful link: https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Fsecurityadminevents.htm
568
-
569
- var _AmtAuditStringTable =
570
- {
571
- 16: 'Security Admin',
572
- 17: 'RCO',
573
- 18: 'Redirection Manager',
574
- 19: 'Firmware Update Manager',
575
- 20: 'Security Audit Log',
576
- 21: 'Network Time',
577
- 22: 'Network Administration',
578
- 23: 'Storage Administration',
579
- 24: 'Event Manager',
580
- 25: 'Circuit Breaker Manager',
581
- 26: 'Agent Presence Manager',
582
- 27: 'Wireless Configuration',
583
- 28: 'EAC',
584
- 29: 'KVM',
585
- 30: 'User Opt-In Events',
586
- 32: 'Screen Blanking',
587
- 33: 'Watchdog Events',
588
- 1600: 'Provisioning Started',
589
- 1601: 'Provisioning Completed',
590
- 1602: 'ACL Entry Added',
591
- 1603: 'ACL Entry Modified',
592
- 1604: 'ACL Entry Removed',
593
- 1605: 'ACL Access with Invalid Credentials',
594
- 1606: 'ACL Entry State',
595
- 1607: 'TLS State Changed',
596
- 1608: 'TLS Server Certificate Set',
597
- 1609: 'TLS Server Certificate Remove',
598
- 1610: 'TLS Trusted Root Certificate Added',
599
- 1611: 'TLS Trusted Root Certificate Removed',
600
- 1612: 'TLS Preshared Key Set',
601
- 1613: 'Kerberos Settings Modified',
602
- 1614: 'Kerberos Master Key Modified',
603
- 1615: 'Flash Wear out Counters Reset',
604
- 1616: 'Power Package Modified',
605
- 1617: 'Set Realm Authentication Mode',
606
- 1618: 'Upgrade Client to Admin Control Mode',
607
- 1619: 'Unprovisioning Started',
608
- 1700: 'Performed Power Up',
609
- 1701: 'Performed Power Down',
610
- 1702: 'Performed Power Cycle',
611
- 1703: 'Performed Reset',
612
- 1704: 'Set Boot Options',
613
- 1800: 'IDER Session Opened',
614
- 1801: 'IDER Session Closed',
615
- 1802: 'IDER Enabled',
616
- 1803: 'IDER Disabled',
617
- 1804: 'SoL Session Opened',
618
- 1805: 'SoL Session Closed',
619
- 1806: 'SoL Enabled',
620
- 1807: 'SoL Disabled',
621
- 1808: 'KVM Session Started',
622
- 1809: 'KVM Session Ended',
623
- 1810: 'KVM Enabled',
624
- 1811: 'KVM Disabled',
625
- 1812: 'VNC Password Failed 3 Times',
626
- 1900: 'Firmware Updated',
627
- 1901: 'Firmware Update Failed',
628
- 2000: 'Security Audit Log Cleared',
629
- 2001: 'Security Audit Policy Modified',
630
- 2002: 'Security Audit Log Disabled',
631
- 2003: 'Security Audit Log Enabled',
632
- 2004: 'Security Audit Log Exported',
633
- 2005: 'Security Audit Log Recovered',
634
- 2100: 'Intel® ME Time Set',
635
- 2200: 'TCPIP Parameters Set',
636
- 2201: 'Host Name Set',
637
- 2202: 'Domain Name Set',
638
- 2203: 'VLAN Parameters Set',
639
- 2204: 'Link Policy Set',
640
- 2205: 'IPv6 Parameters Set',
641
- 2300: 'Global Storage Attributes Set',
642
- 2301: 'Storage EACL Modified',
643
- 2302: 'Storage FPACL Modified',
644
- 2303: 'Storage Write Operation',
645
- 2400: 'Alert Subscribed',
646
- 2401: 'Alert Unsubscribed',
647
- 2402: 'Event Log Cleared',
648
- 2403: 'Event Log Frozen',
649
- 2500: 'CB Filter Added',
650
- 2501: 'CB Filter Removed',
651
- 2502: 'CB Policy Added',
652
- 2503: 'CB Policy Removed',
653
- 2504: 'CB Default Policy Set',
654
- 2505: 'CB Heuristics Option Set',
655
- 2506: 'CB Heuristics State Cleared',
656
- 2600: 'Agent Watchdog Added',
657
- 2601: 'Agent Watchdog Removed',
658
- 2602: 'Agent Watchdog Action Set',
659
- 2700: 'Wireless Profile Added',
660
- 2701: 'Wireless Profile Removed',
661
- 2702: 'Wireless Profile Updated',
662
- 2800: 'EAC Posture Signer SET',
663
- 2801: 'EAC Enabled',
664
- 2802: 'EAC Disabled',
665
- 2803: 'EAC Posture State',
666
- 2804: 'EAC Set Options',
667
- 2900: 'KVM Opt-in Enabled',
668
- 2901: 'KVM Opt-in Disabled',
669
- 2902: 'KVM Password Changed',
670
- 2903: 'KVM Consent Succeeded',
671
- 2904: 'KVM Consent Failed',
672
- 3000: 'Opt-In Policy Change',
673
- 3001: 'Send Consent Code Event',
674
- 3002: 'Start Opt-In Blocked Event'
675
- }
676
-
677
- // Return human readable extended audit log data
678
- // TODO: Just put some of them here, but many more still need to be added, helpful link here:
679
- // https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Fsecurityadminevents.htm
680
- obj.GetAuditLogExtendedDataStr = function (id, data) {
681
- if ((id == 1602 || id == 1604) && data[0] == 0) { return data.splice(2, 2 + data[1]).toString(); } // ACL Entry Added/Removed (Digest)
682
- if (id == 1603) { if (data[1] == 0) { return data.splice(3).toString(); } return null; } // ACL Entry Modified
683
- if (id == 1605) { return ["Invalid ME access", "Invalid MEBx access"][data[0]]; } // ACL Access with Invalid Credentials
684
- if (id == 1606) { var r = ["Disabled", "Enabled"][data[0]]; if (data[1] == 0) { r += ", " + data[3]; } return r; } // ACL Entry State
685
- if (id == 1607) { return "Remote " + ["NoAuth", "ServerAuth", "MutualAuth"][data[0]] + ", Local " + ["NoAuth", "ServerAuth", "MutualAuth"][data[1]]; } // TLS State Changed
686
- if (id == 1617) { return obj.RealmNames[ReadInt(data, 0)] + ", " + ["NoAuth", "Auth", "Disabled"][data[4]]; } // Set Realm Authentication Mode
687
- if (id == 1619) { return ["BIOS", "MEBx", "Local MEI", "Local WSMAN", "Remote WSAMN"][data[0]]; } // Intel AMT Unprovisioning Started
688
- if (id == 1900) { return "From " + ReadShort(data, 0) + "." + ReadShort(data, 2) + "." + ReadShort(data, 4) + "." + ReadShort(data, 6) + " to " + ReadShort(data, 8) + "." + ReadShort(data, 10) + "." + ReadShort(data, 12) + "." + ReadShort(data, 14); } // Firmware Updated
689
- if (id == 2100) { var t4 = new Date(); t4.setTime(ReadInt(data, 0) * 1000 + (new Date().getTimezoneOffset() * 60000)); return t4.toLocaleString(); } // Intel AMT Time Set
690
- if (id == 3000) { return "From " + ["None", "KVM", "All"][data[0]] + " to " + ["None", "KVM", "All"][data[1]]; } // Opt-In Policy Change
691
- if (id == 3001) { return ["Success", "Failed 3 times"][data[0]]; } // Send Consent Code Event
692
- return null;
693
- }
694
-
695
- obj.GetAuditLog = function (func) {
696
- obj.AMT_AuditLog_ReadRecords(1, _GetAuditLog0, [func, []]);
697
- }
698
-
699
- function MakeToArray(v) { if (!v || v == null || typeof v == 'object') return v; return [v]; }
700
- function ReadShort(v, p) { return (v[p] << 8) + v[p + 1]; }
701
- function ReadInt(v, p) { return (v[p] * 0x1000000) + (v[p + 1] << 16) + (v[p + 2] << 8) + v[p + 3]; } // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.
702
- function ReadIntX(v, p) { return (v[p + 3] * 0x1000000) + (v[p + 2] << 16) + (v[p + 1] << 8) + v[p]; }
703
- function btoa(x) { return Buffer.from(x).toString('base64'); }
704
- function atob(x) { var z = null; try { z = Buffer.from(x, 'base64').toString(); } catch (e) { console.log(e); } return z; }
705
-
706
- function _GetAuditLog0(stack, name, responses, status, tag) {
707
- if (status != 200) { tag[0](obj, [], status); return; }
708
- var ptr, i, e, es, x, r = tag[1], t = new Date(), TimeStamp;
709
-
710
- if (responses.Body['RecordsReturned'] > 0) {
711
- responses.Body['EventRecords'] = MakeToArray(responses.Body['EventRecords']);
712
-
713
- for (i in responses.Body['EventRecords']) {
714
- e = null;
715
- try {
716
- es = atob(responses.Body['EventRecords'][i]);
717
- e = new Buffer(es);
718
- } catch (ex) {
719
- console.log(ex + " " + responses.Body['EventRecords'][i])
720
- }
721
-
722
- x = { 'AuditAppID': ReadShort(e, 0), 'EventID': ReadShort(e, 2), 'InitiatorType': e[4] };
723
- x['AuditApp'] = _AmtAuditStringTable[x['AuditAppID']];
724
- x['Event'] = _AmtAuditStringTable[(x['AuditAppID'] * 100) + x['EventID']];
725
- if (!x['Event']) x['Event'] = '#' + x['EventID'];
726
-
727
- // Read and process the initiator
728
- if (x['InitiatorType'] == 0) {
729
- // HTTP digest
730
- var userlen = e[5];
731
- x['Initiator'] = e.slice(6, 6 + userlen).toString();
732
- ptr = 6 + userlen;
733
- }
734
- if (x['InitiatorType'] == 1) {
735
- // Kerberos
736
- x['KerberosUserInDomain'] = ReadInt(e, 5);
737
- var userlen = e[9];
738
- x['Initiator'] = GetSidString(e.slice(10, 10 + userlen));
739
- ptr = 10 + userlen;
740
- }
741
- if (x['InitiatorType'] == 2) {
742
- // Local
743
- x['Initiator'] = '<i>Local</i>';
744
- ptr = 5;
745
- }
746
- if (x['InitiatorType'] == 3) {
747
- // KVM Default Port
748
- x['Initiator'] = '<i>KVM Default Port</i>';
749
- ptr = 5;
750
- }
751
-
752
- // Read timestamp
753
- TimeStamp = ReadInt(e, ptr);
754
- x['Time'] = new Date((TimeStamp + (t.getTimezoneOffset() * 60)) * 1000);
755
- ptr += 4;
756
-
757
- // Read network access
758
- x['MCLocationType'] = e[ptr++];
759
- var netlen = e[ptr++];
760
-
761
- x['NetAddress'] = e.slice(ptr, ptr + netlen).toString();
762
-
763
- // Read extended data
764
- ptr += netlen;
765
- var exlen = e[ptr++];
766
- x['Ex'] = e.slice(ptr, ptr + exlen);
767
- x['ExStr'] = obj.GetAuditLogExtendedDataStr((x['AuditAppID'] * 100) + x['EventID'], x['Ex']);
768
- r.push(x);
769
- }
770
- }
771
- if (responses.Body['TotalRecordCount'] > r.length) {
772
- obj.AMT_AuditLog_ReadRecords(r.length + 1, _GetAuditLog0, [tag[0], r]);
773
- } else {
774
- tag[0](obj, r, status);
775
- }
776
- }
777
-
778
- // ###END###{AuditLog}
779
-
780
- /*
781
- // ###BEGIN###{Certificates}
782
-
783
- // Forge MD5
784
- function hex_md5(str) { return forge.md.md5.create().update(str).digest().toHex(); }
785
-
786
- // ###END###{Certificates}
787
-
788
- // ###BEGIN###{!Certificates}
789
-
790
- // TinyMD5 from https://github.com/jbt/js-crypto
791
-
792
- // Perform MD5 setup
793
- var md5_k = [];
794
- for (var i = 0; i < 64;) { md5_k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296); }
795
-
796
- // Perform MD5 on raw string and return hex
797
- function hex_md5(str) {
798
- var b, c, d, j,
799
- x = [],
800
- str2 = unescape(encodeURI(str)),
801
- a = str2.length,
802
- h = [b = 1732584193, c = -271733879, ~b, ~c],
803
- i = 0;
804
-
805
- for (; i <= a;) x[i >> 2] |= (str2.charCodeAt(i) || 128) << 8 * (i++ % 4);
806
-
807
- x[str = (a + 8 >> 6) * 16 + 14] = a * 8;
808
- i = 0;
809
-
810
- for (; i < str; i += 16) {
811
- a = h; j = 0;
812
- for (; j < 64;) {
813
- a = [
814
- d = a[3],
815
- ((b = a[1] | 0) +
816
- ((d = (
817
- (a[0] +
818
- [
819
- b & (c = a[2]) | ~b & d,
820
- d & b | ~d & c,
821
- b ^ c ^ d,
822
- c ^ (b | ~d)
823
- ][a = j >> 4]
824
- ) +
825
- (md5_k[j] +
826
- (x[[
827
- j,
828
- 5 * j + 1,
829
- 3 * j + 5,
830
- 7 * j
831
- ][a] % 16 + i] | 0)
832
- )
833
- )) << (a = [
834
- 7, 12, 17, 22,
835
- 5, 9, 14, 20,
836
- 4, 11, 16, 23,
837
- 6, 10, 15, 21
838
- ][4 * a + j++ % 4]) | d >>> 32 - a)
839
- ),
840
- b,
841
- c
842
- ];
843
- }
844
- for (j = 4; j;) h[--j] = h[j] + a[j];
845
- }
846
-
847
- str = '';
848
- for (; j < 32;) str += ((h[j >> 3] >> ((1 ^ j++ & 7) * 4)) & 15).toString(16);
849
- return str;
850
- }
851
-
852
- // ###END###{!Certificates}
853
-
854
- // Perform MD5 on raw string and return raw string result
855
- function rstr_md5(str) { return hex2rstr(hex_md5(str)); }
856
- */
857
- /*
858
- Convert arguments into selector set and body XML. Used by AMT_WiFiPortConfigurationService_UpdateWiFiSettings.
859
- args = {
860
- "WiFiEndpoint": {
861
- __parameterType: 'reference',
862
- __resourceUri: 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpoint',
863
- Name: 'WiFi Endpoint 0'
864
- },
865
- "WiFiEndpointSettingsInput":
866
- {
867
- __parameterType: 'instance',
868
- __namespace: 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpointSettings',
869
- ElementName: document.querySelector('#editProfile-profileName').value,
870
- InstanceID: 'Intel(r) AMT:WiFi Endpoint Settings ' + document.querySelector('#editProfile-profileName').value,
871
- AuthenticationMethod: document.querySelector('#editProfile-networkAuthentication').value,
872
- //BSSType: 3, // Intel(r) AMT supports only infrastructure networks
873
- EncryptionMethod: document.querySelector('#editProfile-encryption').value,
874
- SSID: document.querySelector('#editProfile-networkName').value,
875
- Priority: 100,
876
- PSKPassPhrase: document.querySelector('#editProfile-passPhrase').value
877
- },
878
- "IEEE8021xSettingsInput": null,
879
- "ClientCredential": null,
880
- "CACredential": null
881
- },
882
- */
883
- function execArgumentsToXml(args) {
884
- if (args === undefined || args === null) return null;
885
-
886
- var result = '';
887
- for (var argName in args) {
888
- var arg = args[argName];
889
- if (!arg) continue;
890
- if (arg['__parameterType'] === 'reference') result += referenceToXml(argName, arg);
891
- else result += instanceToXml(argName, arg);
892
- //if(arg['__isInstance']) result += instanceToXml(argName, arg);
893
- }
894
- return result;
895
- }
896
-
897
- /**
898
- * Convert JavaScript object into XML
899
-
900
- <r:WiFiEndpointSettingsInput xmlns:q="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpointSettings">
901
- <q:ElementName>Wireless-Profile-Admin</q:ElementName>
902
- <q:InstanceID>Intel(r) AMT:WiFi Endpoint Settings Wireless-Profile-Admin</q:InstanceID>
903
- <q:AuthenticationMethod>6</q:AuthenticationMethod>
904
- <q:EncryptionMethod>4</q:EncryptionMethod>
905
- <q:Priority>100</q:Priority>
906
- <q:PSKPassPhrase>P@ssw0rd</q:PSKPassPhrase>
907
- </r:WiFiEndpointSettingsInput>
908
- */
909
- function instanceToXml(instanceName, inInstance) {
910
- if (inInstance === undefined || inInstance === null) return null;
911
-
912
- var hasNamespace = !!inInstance['__namespace'];
913
- var startTag = hasNamespace ? '<q:' : '<';
914
- var endTag = hasNamespace ? '</q:' : '</';
915
- var namespaceDef = hasNamespace ? (' xmlns:q="' + inInstance['__namespace'] + '"') : '';
916
- var result = '<r:' + instanceName + namespaceDef + '>';
917
- for (var prop in inInstance) {
918
- if (!inInstance.hasOwnProperty(prop) || prop.indexOf('__') === 0) continue;
919
-
920
- if (typeof inInstance[prop] === 'function' || Array.isArray(inInstance[prop])) continue;
921
-
922
- if (typeof inInstance[prop] === 'object') {
923
- //result += startTag + prop +'>' + instanceToXml('prop', inInstance[prop]) + endTag + prop +'>';
924
- console.error('only convert one level down...');
925
- }
926
- else {
927
- result += startTag + prop + '>' + inInstance[prop].toString() + endTag + prop + '>';
928
- }
929
- }
930
- result += '</r:' + instanceName + '>';
931
- return result;
932
- }
933
-
934
-
935
- /**
936
- * Convert a selector set into XML. Expect no nesting.
937
- * {
938
- * selectorName : selectorValue,
939
- * selectorName : selectorValue,
940
- * ... ...
941
- * }
942
-
943
- <r:WiFiEndpoint>
944
- <a:Address>http://192.168.1.103:16992/wsman</a:Address>
945
- <a:ReferenceParameters>
946
- <w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_WiFiEndpoint</w:ResourceURI>
947
- <w:SelectorSet>
948
- <w:Selector Name="Name">WiFi Endpoint 0</w:Selector>
949
- </w:SelectorSet>
950
- </a:ReferenceParameters>
951
- </r:WiFiEndpoint>
952
-
953
- */
954
- function referenceToXml(referenceName, inReference) {
955
- if (inReference === undefined || inReference === null) return null;
956
-
957
- var result = '<r:' + referenceName + '><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + inReference['__resourceUri'] + '</w:ResourceURI><w:SelectorSet>';
958
- for (var selectorName in inReference) {
959
- if (!inReference.hasOwnProperty(selectorName) || selectorName.indexOf('__') === 0) continue;
960
-
961
- if (typeof inReference[selectorName] === 'function' ||
962
- typeof inReference[selectorName] === 'object' ||
963
- Array.isArray(inReference[selectorName]))
964
- continue;
965
-
966
- result += '<w:Selector Name="' + selectorName + '">' + inReference[selectorName].toString() + '</w:Selector>';
967
- }
968
-
969
- result += '</w:SelectorSet></a:ReferenceParameters></r:' + referenceName + '>';
970
- return result;
971
- }
972
-
973
- // Convert a byte array of SID into string
974
- function GetSidString(sid) {
975
- var r = "S-" + sid.charCodeAt(0) + "-" + sid.charCodeAt(7);
976
- for (var i = 2; i < (sid.length / 4) ; i++) r += "-" + ReadIntX(sid, i * 4);
977
- return r;
978
- }
979
-
980
- // Convert a SID readable string into bytes
981
- function GetSidByteArray(sidString) {
982
- if (!sidString || sidString == null) return null;
983
- var sidParts = sidString.split('-');
984
-
985
- // Make sure the SID has at least 4 parts and starts with 'S'
986
- if (sidParts.length < 4 || (sidParts[0] != 's' && sidParts[0] != 'S')) return null;
987
-
988
- // Check that each part of the SID is really an integer
989
- for (var i = 1; i < sidParts.length; i++) { var y = parseInt(sidParts[i]); if (y != sidParts[i]) return null; sidParts[i] = y; }
990
-
991
- // Version (8 bit) + Id count (8 bit) + 48 bit in big endian -- DO NOT use bitwise right shift operator. JavaScript converts the number into a 32 bit integer before shifting. In real world, it's highly likely this part is always 0.
992
- var r = String.fromCharCode(sidParts[1]) + String.fromCharCode(sidParts.length - 3) + ShortToStr(Math.floor(sidParts[2] / Math.pow(2, 32))) + IntToStr((sidParts[2]) & 0xFFFF);
993
-
994
- // the rest are in 32 bit in little endian
995
- for (var i = 3; i < sidParts.length; i++) r += IntToStrX(sidParts[i]);
996
- return r;
997
- }
998
-
999
- return obj;
1000
-}
1001
-
1002
-module.exports = AmtStackCreateService;
agents/modules_meshcmd/amt-script-0.2.0.js
deleted
-456
@@ -1,456 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-/**
18
-* @fileoverview Script Compiler / Decompiler / Runner
19
-* @author Ylian Saint-Hilaire
20
-* @version v0.1.0e
21
-*/
22
-
23
-// Core functions
24
-script_functionTable1 = ['nop', 'jump', 'set', 'print', 'dialog', 'getitem', 'substr', 'indexof', 'split', 'join', 'length', 'jsonparse', 'jsonstr', 'add', 'substract', 'parseint', 'wsbatchenum', 'wsput', 'wscreate', 'wsdelete', 'wsexec', 'scriptspeed', 'wssubscribe', 'wsunsubscribe', 'readchar', 'signwithdummyca'];
25
-
26
-// functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
27
-script_functionTable2 = ['encodeuri', 'decodeuri', 'passwordcheck', 'atob', 'btoa', 'hex2str', 'str2hex', 'random', 'md5', 'maketoarray', 'readshort', 'readshortx', 'readint', 'readsint', 'readintx', 'shorttostr', 'shorttostrx', 'inttostr', 'inttostrx'];
28
-
29
-// functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
30
-script_functionTableX2 = [encodeURI, decodeURI, passwordcheck, window.atob.bind(window), window.btoa.bind(window), hex2rstr, rstr2hex, random, rstr_md5, MakeToArray, ReadShort, ReadShortX, ReadInt, ReadSInt, ReadIntX, ShortToStr, ShortToStrX, IntToStr, IntToStrX];
31
-
32
-// Optional functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
33
-script_functionTable3 = ['pullsystemstatus', 'pulleventlog', 'pullauditlog', 'pullcertificates', 'pullwatchdog', 'pullsystemdefense', 'pullhardware', 'pulluserinfo', 'pullremoteaccess', 'highlightblock', 'disconnect', 'getsidstring', 'getsidbytearray', 'pulleventsubscriptions'];
34
-
35
-// Optional functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
36
-script_functionTableX3 = [
37
- PullSystemStatus
38
- ,
39
- // ###BEGIN###{EventLog}
40
- PullEventLog
41
- // ###END###{EventLog}
42
- ,
43
- // ###BEGIN###{AuditLog}
44
- PullAuditLog
45
- // ###END###{AuditLog}
46
- ,
47
- // ###BEGIN###{Certificates}
48
- PullCertificates
49
- // ###END###{Certificates}
50
- ,
51
- // ###BEGIN###{AgentPresence}
52
- PullWatchdog
53
- // ###END###{AgentPresence}
54
- ,
55
- // ###BEGIN###{SystemDefense}
56
- PullSystemDefense
57
- // ###END###{SystemDefense}
58
- ,
59
- // ###BEGIN###{HardwareInfo}
60
- PullHardware
61
- // ###END###{HardwareInfo}
62
- ,
63
- PullUserInfo
64
- ,
65
- // ###BEGIN###{RemoteAccess}
66
- PullRemoteAccess
67
- // ###END###{RemoteAccess}
68
- ,
69
- // ###BEGIN###{Scripting-Editor}
70
- script_HighlightBlock
71
- // ###END###{Scripting-Editor}
72
- ,
73
- // ###BEGIN###{ComputerSelector}
74
- disconnect
75
- // ###END###{ComputerSelector}
76
- ,
77
- function (runner, x) { return GetSidString(x); }
78
- ,
79
- function (runner, x) { return GetSidByteArray(x); }
80
- ,
81
- // ###BEGIN###{EventSubscriptions}
82
- PullEventSubscriptions
83
- // ###END###{EventSubscriptions}
84
-];
85
-
86
-// Setup the script state
87
-function script_setup(binary, startvars) {
88
- var obj = { startvars:startvars };
89
- if (binary.length < 6) { console.error('Invalid script length'); return null; } // Script must have at least 6 byte header
90
- if (ReadInt(binary, 0) != 0x247D2945) { console.error('Invalid binary script'); return null; } // Check the script magic header
91
- if (ReadShort(binary, 4) > 1) { console.error('Unsupported script version'); return null; } // Check the script version
92
- obj.script = binary.substring(6);
93
- // obj.onStep;
94
- // obj.onConsole;
95
-
96
- // Reset the script to the start
97
- obj.reset = function (stepspeed) {
98
- obj.stop();
99
- obj.ip = 0;
100
- obj.variables = startvars;
101
- obj.state = 1;
102
- }
103
-
104
- // Start the script
105
- obj.start = function (stepspeed) {
106
- obj.stop();
107
- obj.stepspeed = stepspeed;
108
- if (stepspeed > 0) { obj.timer = setInterval(function () { obj.step() }, stepspeed); }
109
- }
110
-
111
- // Stop the script
112
- obj.stop = function () {
113
- if (obj.timer != null) { clearInterval(obj.timer); }
114
- obj.timer = null;
115
- obj.stepspeed = 0;
116
- }
117
-
118
- // function used to load and store variable values
119
- obj.getVar = function (name) { if (name == undefined) return undefined; return obj.getVarEx(name.split('.'), obj.variables); }
120
- obj.getVarEx = function (name, val) { try { if (name == undefined) return undefined; if (name.length == 0) return val; return obj.getVarEx(name.slice(1), val[name[0]]); } catch (e) { return null; } }
121
- obj.setVar = function (name, val) { obj.setVarEx(name.split('.'), obj.variables, val); }
122
- obj.setVarEx = function (name, vars, val) { if (name.length == 1) { vars[name[0]] = val; } else { obj.setVarEx(name.slice(1), vars[name[0]], val); } }
123
-
124
- // Run the script one step forward
125
- obj.step = function () {
126
- if (obj.state != 1) return;
127
- if (obj.ip < obj.script.length) {
128
- var cmdid = ReadShort(obj.script, obj.ip);
129
- var cmdlen = ReadShort(obj.script, obj.ip + 2);
130
- var argcount = ReadShort(obj.script, obj.ip + 4);
131
- var argptr = obj.ip + 6;
132
- var args = [];
133
-
134
- // Clear all temp variables (This is optional)
135
- for (var i in obj.variables) { if (i.startsWith('__')) { delete obj.variables[i]; } }
136
-
137
- // Loop on each argument, moving forward by the argument length each time
138
- for (var i = 0; i < argcount; i++) {
139
- var arglen = ReadShort(obj.script, argptr);
140
- var argval = obj.script.substring(argptr + 2, argptr + 2 + arglen);
141
- var argtyp = argval.charCodeAt(0);
142
- argval = argval.substring(1);
143
- if (argtyp < 2) {
144
- // Get the value and replace all {var} with variable values
145
- while (argval.split("{").length > 1) { var t = argval.split("{").pop().split("}").shift(); argval = argval.replace('{' + t + '}', obj.getVar(t)); }
146
- if (argtyp == 1) { obj.variables['__' + i] = decodeURI(argval); argval = '__' + i; } // If argtyp is 1, this is a literal. Store in temp variable.
147
- args.push(argval);
148
- }
149
- if (argtyp == 2 || argtyp == 3) {
150
- obj.variables['__' + i] = ReadSInt(argval, 0);
151
- args.push('__' + i);
152
- }
153
- argptr += (2 + arglen);
154
- }
155
-
156
- // Move instruction pointer forward by command size
157
- obj.ip += cmdlen;
158
-
159
- // Get all variable values
160
- var argsval = [];
161
- for (var i = 0; i < 10; i++) { argsval.push(obj.getVar(args[i])); }
162
- var storeInArg0;
163
-
164
- try {
165
- if (cmdid < 10000) {
166
- // Lets run the actual command
167
- switch (cmdid) {
168
- case 0: // nop
169
- break;
170
- case 1: // jump(label) or jump(label, a, compare, b)
171
- if (argsval[2]) {
172
- if (
173
- (argsval[2] == '<' && argsval[1] < argsval[3]) ||
174
- (argsval[2] == '<=' && argsval[1] <= argsval[3]) ||
175
- (argsval[2] == '!=' && argsval[1] != argsval[3]) ||
176
- (argsval[2] == '=' && argsval[1] == argsval[3]) ||
177
- (argsval[2] == '>=' && argsval[1] >= argsval[3]) ||
178
- (argsval[2] == '>' && argsval[1] > argsval[3])
179
- ) { obj.ip = argsval[0]; }
180
- } else {
181
- obj.ip = argsval[0]; // Set the instruction pointer to the new location in the script
182
- }
183
- break;
184
- case 2: // set(variable, value)
185
- if (args[1] == undefined) delete obj.variables[args[0]]; else obj.setVar(args[0], argsval[1]);
186
- break;
187
- case 3: // print(message)
188
- if (obj.onConsole) { obj.onConsole(obj.toString(argsval[0]), obj); } else { console.log(obj.toString(argsval[0])); }
189
- // Q(obj.consoleid).value += () + '\n'); Q(obj.console).scrollTop = Q(obj.console).scrollHeight;
190
- break;
191
- case 4: // dialog(title, content, buttons)
192
- obj.state = 2;
193
- obj.dialog = true;
194
- setDialogMode(11, argsval[0], argsval[2], obj.xxStepDialogOk, argsval[1], obj);
195
- break;
196
- case 5: // getitem(a, b, c)
197
- for (var i in argsval[1]) { if (argsval[1][i][argsval[2]] == argsval[3]) { storeInArg0 = i; } };
198
- break;
199
- case 6: // substr(variable_dest, variable_src, index, len)
200
- storeInArg0 = argsval[1].substr(argsval[2], argsval[3]);
201
- break;
202
- case 7: // indexOf(variable_dest, variable_src, index, len)
203
- storeInArg0 = argsval[1].indexOf(argsval[2]);
204
- break;
205
- case 8: // split(variable_dest, variable_src, separator)
206
- storeInArg0 = argsval[1].split(argsval[2]);
207
- break;
208
- case 9: // join(variable_dest, variable_src, separator)
209
- storeInArg0 = argsval[1].join(argsval[2]);
210
- break;
211
- case 10: // length(variable_dest, variable_src)
212
- storeInArg0 = argsval[1].length;
213
- break;
214
- case 11: // jsonparse(variable_dest, json)
215
- storeInArg0 = JSON.parse(argsval[1]);
216
- break;
217
- case 12: // jsonstr(variable_dest, variable_src)
218
- storeInArg0 = JSON.stringify(argsval[1]);
219
- break;
220
- case 13: // add(variable_dest, variable_src, value)
221
- storeInArg0 = (argsval[1] + argsval[2]);
222
- break;
223
- case 14: // substract(variable_dest, variable_src, value)
224
- storeInArg0 = (argsval[1] - argsval[2]);
225
- break;
226
- case 15: // parseInt(variable_dest, variable_src)
227
- storeInArg0 = parseInt(argsval[1]);
228
- break;
229
- case 16: // wsbatchenum(name, objectList)
230
- obj.state = 2;
231
- obj.amtstack.BatchEnum(argsval[0], argsval[1], obj.xxWsmanReturn, obj);
232
- break;
233
- case 17: // wsput(name, args)
234
- obj.state = 2;
235
- obj.amtstack.Put(argsval[0], argsval[1], obj.xxWsmanReturn, obj);
236
- break;
237
- case 18: // wscreate(name, args)
238
- obj.state = 2;
239
- obj.amtstack.Create(argsval[0], argsval[1], obj.xxWsmanReturn, obj);
240
- break;
241
- case 19: // wsdelete(name, args)
242
- obj.state = 2;
243
- obj.amtstack.Delete(argsval[0], argsval[1], obj.xxWsmanReturn, obj);
244
- break;
245
- case 20: // wsexec(name, method, args, selectors)
246
- obj.state = 2;
247
- obj.amtstack.Exec(argsval[0], argsval[1], argsval[2], obj.xxWsmanReturn, obj, 0, argsval[3]);
248
- break;
249
- case 21: // Script Speed
250
- obj.stepspeed = argsval[0];
251
- if (obj.timer != null) { clearInterval(obj.timer); obj.timer = setInterval(function () { obj.step() }, obj.stepspeed); }
252
- break;
253
- case 22: // wssubscribe(name, delivery, url, selectors, opaque, user, pass)
254
- obj.state = 2;
255
- obj.amtstack.Subscribe(argsval[0], argsval[1], argsval[2], obj.xxWsmanReturn, obj, 0, argsval[3], argsval[4], argsval[5], argsval[6]);
256
- break;
257
- case 23: // wsunsubscribe(name, selectors)
258
- obj.state = 2;
259
- obj.amtstack.UnSubscribe(argsval[0], obj.xxWsmanReturn, obj, 0, argsval[1]);
260
- break;
261
- case 24: // readchar(str, pos)
262
- console.log(argsval[1], argsval[2], argsval[1].charCodeAt(argsval[2]));
263
- storeInArg0 = argsval[1].charCodeAt(argsval[2]);
264
- break;
265
- case 25: // signWithDummyCa
266
- // ###BEGIN###{Certificates}
267
- obj.state = 2;
268
- // DERKey, xxCaPrivateKey, certattributes, issuerattributes
269
- amtcert_signWithCaKey(argsval[0], null, argsval[1], { 'CN': 'Untrusted Root Certificate' }, obj.xxSignWithDummyCaReturn);
270
- // ###END###{Certificates}
271
- break;
272
- default: {
273
- obj.state = 9;
274
- console.error("Script Error, unknown command: " + cmdid);
275
- }
276
- }
277
- } else {
278
- if (cmdid < 20000) {
279
- // functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
280
- storeInArg0 = script_functionTableX2[cmdid - 10000](argsval[1], argsval[2], argsval[3], argsval[4], argsval[5], argsval[6]);
281
- } else {
282
- // Optional functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
283
- if (script_functionTableX3 && script_functionTableX3[cmdid - 20000]) {
284
- storeInArg0 = script_functionTableX3[cmdid - 20000](obj, argsval[1], argsval[2], argsval[3], argsval[4], argsval[5], argsval[6]); // Note that optional calls start with "obj" as first argument.
285
- }
286
- }
287
- }
288
-
289
- if (storeInArg0 != undefined) obj.setVar(args[0], storeInArg0);
290
- } catch (e) {
291
- if (typeof e == 'object') { e = e.message; }
292
- obj.setVar('_exception', e);
293
- }
294
- }
295
-
296
- if (obj.state == 1 && obj.ip >= obj.script.length) { obj.state = 0; obj.stop(); }
297
- if (obj.onStep) obj.onStep(obj);
298
- return obj;
299
- }
300
-
301
- obj.xxStepDialogOk = function (button) {
302
- obj.variables['DialogSelect'] = button;
303
- obj.state = 1;
304
- obj.dialog = false;
305
- if (obj.onStep) obj.onStep(obj);
306
- }
307
-
308
- // ###BEGIN###{**ClosureAdvancedMode}
309
- obj.xxWsmanReturnFix = function (x) {
310
- if (!x || x == null) return;
311
- if (x.Header) { x['Header'] = x.Header; delete x.Header; }
312
- if (x.Body) { x['Body'] = x.Body; delete x.Body; }
313
- if (x.Responses) { x['Responses'] = x.Responses; delete x.Responses; }
314
- if (x.Response) { x['Response'] = x.Response; delete x.Response; }
315
- if (x.ReturnValueStr) { x['ReturnValueStr'] = x.ReturnValueStr; delete x.ReturnValueStr; }
316
- }
317
- // ###END###{**ClosureAdvancedMode}
318
-
319
- obj.xxWsmanReturn = function (stack, name, responses, status) {
320
- // ###BEGIN###{**ClosureAdvancedMode}
321
- // This is required when Google Closure is used
322
- if (responses) {
323
- obj.xxWsmanReturnFix(responses);
324
- for (var i in responses) {
325
- obj.xxWsmanReturnFix(responses[i]);
326
- for (var j in responses[i]) { obj.xxWsmanReturnFix(responses[i][j]); }
327
- }
328
- }
329
- // ###END###{**ClosureAdvancedMode}
330
- obj.setVar(name, responses);
331
- obj.setVar('wsman_result', status);
332
- obj.setVar('wsman_result_str', ((httpErrorTable[status]) ? (httpErrorTable[status]) : ('Error #' + status)));
333
- obj.state = 1;
334
- if (obj.onStep) obj.onStep(obj);
335
- }
336
-
337
- // ###BEGIN###{Certificates}
338
- obj.xxSignWithDummyCaReturn = function (cert) {
339
- obj.setVar('signed_cert', btoa(_arrayBufferToString(cert)));
340
- obj.state = 1;
341
- if (obj.onStep) obj.onStep(obj);
342
- }
343
- // ###END###{Certificates}
344
-
345
- obj.toString = function (x) { if (typeof x == 'object') return JSON.stringify(x); return x; }
346
-
347
- obj.reset();
348
- return obj;
349
-}
350
-
351
-// Argument types: 0 = Variable, 1 = String, 2 = Integer, 3 = Label
352
-function script_compile(script, onmsg) {
353
- var r = '', scriptlines = script.split('\n'), labels = {}, labelswap = [], swaps = [];
354
- // Go thru each script line and encode it
355
- for (var i in scriptlines) {
356
- var scriptline = scriptlines[i];
357
- if (scriptline.startsWith('##SWAP ')) { var x = scriptline.split(' '); if (x.length == 3) { swaps[x[1]] = x[2]; } } // Add a swap instance
358
- if (scriptline[0] == '#' || scriptline.length == 0) continue; // Skip comments & blank lines
359
- for (var x in swaps) { scriptline = scriptline.split(x).join(swaps[x]); } // Apply all swaps
360
- var keywords = scriptline.match(/"[^"]*"|[^\s"]+/g);
361
- if (keywords.length == 0) continue; // Skip blank lines
362
- if (scriptline[0] == ':') { labels[keywords[0].toUpperCase()] = r.length; continue; } // Mark a label position
363
- var funcIndex = script_functionTable1.indexOf(keywords[0].toLowerCase());
364
- if (funcIndex == -1) { funcIndex = script_functionTable2.indexOf(keywords[0].toLowerCase()); if (funcIndex >= 0) funcIndex += 10000; }
365
- if (funcIndex == -1) { funcIndex = script_functionTable3.indexOf(keywords[0].toLowerCase()); if (funcIndex >= 0) funcIndex += 20000; } // Optional methods
366
- if (funcIndex == -1) { if (onmsg) { onmsg("Unabled to compile, unknown command: " + keywords[0]); } return ''; }
367
- // Encode CommandId, CmdSize, ArgCount, Arg1Len, Arg1, Arg2Len, Arg2...
368
- var cmd = ShortToStr(keywords.length - 1);
369
- for (var j in keywords) {
370
- if (j == 0) continue;
371
- if (keywords[j][0] == ':') {
372
- labelswap.push([keywords[j], r.length + cmd.length + 7]); // Add a label swap
373
- cmd += ShortToStr(5) + String.fromCharCode(3) + IntToStr(0xFFFFFFFF); // Put an empty label
374
- } else {
375
- var argint = parseInt(keywords[j]);
376
- if (argint == keywords[j]) {
377
- cmd += ShortToStr(5) + String.fromCharCode(2) + IntToStr(argint);
378
- } else {
379
- if (keywords[j][0] == '"' && keywords[j][keywords[j].length - 1] == '"') {
380
- cmd += ShortToStr(keywords[j].length - 1) + String.fromCharCode(1) + keywords[j].substring(1, keywords[j].length - 1);
381
- } else {
382
- cmd += ShortToStr(keywords[j].length + 1) + String.fromCharCode(0) + keywords[j];
383
- }
384
- }
385
- }
386
- }
387
- cmd = ShortToStr(funcIndex) + ShortToStr(cmd.length + 4) + cmd;
388
- r += cmd;
389
- }
390
- // Perform all the needed label swaps
391
- for (i in labelswap) {
392
- var label = labelswap[i][0].toUpperCase(), position = labelswap[i][1], target = labels[label];
393
- if (target == undefined) { if (onmsg) { onmsg("Unabled to compile, unknown label: " + label); } return ''; }
394
- r = r.substr(0, position) + IntToStr(target) + r.substr(position + 4);
395
- }
396
- return IntToStr(0x247D2945) + ShortToStr(1) + r;
397
-}
398
-
399
-// Decompile the script, intended for debugging only
400
-function script_decompile(binary, onecmd) {
401
- var r = '', ptr = 6, labelcount = 0, labels = {};
402
- if (onecmd >= 0) {
403
- ptr = onecmd; // If we are decompiling just one command, set the ptr to that command.
404
- } else {
405
- if (binary.length < 6) { return '# Invalid script length'; }
406
- var magic = ReadInt(binary, 0);
407
- var version = ReadShort(binary, 4);
408
- if (magic != 0x247D2945) { return '# Invalid binary script: ' + magic; }
409
- if (version != 1) { return '# Invalid script version'; }
410
- }
411
- // Loop on each command, moving forward by the command length each time.
412
- while (ptr < binary.length) {
413
- var cmdid = ReadShort(binary, ptr);
414
- var cmdlen = ReadShort(binary, ptr + 2);
415
- var argcount = ReadShort(binary, ptr + 4);
416
- var argptr = ptr + 6;
417
- var argstr = '';
418
- if (!(onecmd >= 0)) r += ":label" + (ptr - 6) + "\n";
419
- // Loop on each argument, moving forward by the argument length each time
420
- for (var i = 0; i < argcount; i++) {
421
- var arglen = ReadShort(binary, argptr);
422
- var argval = binary.substring(argptr + 2, argptr + 2 + arglen);
423
- var argtyp = argval.charCodeAt(0);
424
- if (argtyp == 0) { argstr += ' ' + argval.substring(1); } // Variable
425
- else if (argtyp == 1) { argstr += ' \"' + argval.substring(1) + '\"'; } // String
426
- else if (argtyp == 2) { argstr += ' ' + ReadInt(argval, 1); } // Integer
427
- else if (argtyp == 3) { // Label
428
- var target = ReadInt(argval, 1);
429
- var label = labels[target];
430
- if (!label) { label = ":label" + target; labels[label] = target; }
431
- argstr += ' ' + label;
432
- }
433
- argptr += (2 + arglen);
434
- }
435
- // Go in the script function table to decode the function
436
- if (cmdid < 10000) {
437
- r += script_functionTable1[cmdid] + argstr + "\n";
438
- } else {
439
- if (cmdid >= 20000) {
440
- r += script_functionTable3[cmdid - 20000] + argstr + "\n"; // Optional methods
441
- } else {
442
- r += script_functionTable2[cmdid - 10000] + argstr + "\n";
443
- }
444
- }
445
- ptr += cmdlen;
446
- if (onecmd >= 0) return r; // If we are decompiling just one command, exit now
447
- }
448
- // Remove all unused labels
449
- var scriptlines = r.split('\n');
450
- r = '';
451
- for (var i in scriptlines) {
452
- var line = scriptlines[i];
453
- if (line[0] != ':') { r += line + '\n'; } else { if (labels[line]) { r += line + '\n'; } }
454
- }
455
- return r;
456
-}
agents/modules_meshcmd/amt-wsman-0.2.0.js
deleted
-332
@@ -1,332 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-/**
18
-* @description Intel(r) AMT WSMAN Stack
19
-* @author Ylian Saint-Hilaire
20
-* @version v0.2.0
21
-*/
22
-
23
-// Construct a MeshServer object
24
-function WsmanStackCreateService(CreateWsmanComm, host, port, user, pass, tls, extra) {
25
- var obj = {};
26
- //obj.onDebugMessage = null; // Set to a function if you want to get debug messages.
27
- obj.NextMessageId = 1; // Next message number, used to label WSMAN calls.
28
- obj.Address = '/wsman';
29
- obj.comm = new CreateWsmanComm(host, port, user, pass, tls, extra);
30
-
31
- obj.PerformAjax = function (postdata, callback, tag, pri, namespaces) {
32
- if (namespaces == null) namespaces = '';
33
- obj.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns=\"http://www.w3.org/2003/05/soap-envelope\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) {
34
- if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; }
35
- var wsresponse = obj.ParseWsman(data);
36
- if (!wsresponse || wsresponse == null) { callback(obj, null, { Header: { HttpError: status } }, 601, tag); } else { callback(obj, wsresponse.Header["ResourceURI"], wsresponse, 200, tag); }
37
- }, tag, pri);
38
- }
39
-
40
- // Private method
41
- //obj.Debug = function (msg) { /*console.log(msg);*/ }
42
-
43
- // Cancel all pending queries with given status
44
- obj.CancelAllQueries = function (s) { obj.comm.CancelAllQueries(s); }
45
-
46
- // Get the last element of a URI string
47
- obj.GetNameFromUrl = function (resuri) {
48
- var x = resuri.lastIndexOf("/");
49
- return (x == -1)?resuri:resuri.substring(x + 1);
50
- }
51
-
52
- // Perform a WSMAN Subscribe operation
53
- obj.ExecSubscribe = function (resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) {
54
- var digest = "", digest2 = "", opaque = "";
55
- if (user != null && pass != null) { digest = '<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>' + user + '</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">' + pass + '</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>'; digest2 = '<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>'; }
56
- if (opaque != null) { opaque = '<a:ReferenceParameters><m:arg>' + opaque + '</m:arg></a:ReferenceParameters>'; }
57
- if (delivery == 'PushWithAck') { delivery = 'dmtf.org/wbem/wsman/1/wsman/PushWithAck'; } else if (delivery == 'Push') { delivery = 'xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push'; }
58
- var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + digest + '</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.' + delivery + '"><e:NotifyTo><a:Address>' + url + '</a:Address>' + opaque + '</e:NotifyTo>' + digest2 + '</e:Delivery></e:Subscribe>';
59
- obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"');
60
- }
61
-
62
- // Perform a WSMAN UnSubscribe operation
63
- obj.ExecUnSubscribe = function (resuri, callback, tag, pri, selectors) {
64
- var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + '</Header><Body><e:Unsubscribe/>';
65
- obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"');
66
- }
67
-
68
- // Perform a WSMAN PUT operation
69
- obj.ExecPut = function (resuri, putobj, callback, tag, pri, selectors) {
70
- var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>" + _PutObjToSelectorsXml(selectors) + '</Header><Body>' + _PutObjToBodyXml(resuri, putobj);
71
- obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri);
72
- }
73
-
74
- // Perform a WSMAN CREATE operation
75
- obj.ExecCreate = function (resuri, putobj, callback, tag, pri, selectors) {
76
- var objname = obj.GetNameFromUrl(resuri);
77
- var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>" + _PutObjToSelectorsXml(selectors) + "</Header><Body><g:" + objname + " xmlns:g=\"" + resuri + "\">";
78
- for (var n in putobj) { data += "<g:" + n + ">" + putobj[n] + "</g:" + n + ">" }
79
- obj.PerformAjax(data + "</g:" + objname + "></Body></Envelope>", callback, tag, pri);
80
- }
81
-
82
- // Perform a WSMAN DELETE operation
83
- obj.ExecDelete = function (resuri, putobj, callback, tag, pri) {
84
- var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>" + _PutObjToSelectorsXml(putobj) + "</Header><Body /></Envelope>";
85
- obj.PerformAjax(data, callback, tag, pri);
86
- }
87
-
88
- // Perform a WSMAN GET operation
89
- obj.ExecGet = function (resuri, callback, tag, pri) {
90
- obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>", callback, tag, pri);
91
- }
92
-
93
- // Perform a WSMAN method call operation
94
- obj.ExecMethod = function (resuri, method, args, callback, tag, pri, selectors) {
95
- var argsxml = "";
96
- for (var i in args) { if (args[i] != null) { if (Array.isArray(args[i])) { for (var x in args[i]) { argsxml += "<r:" + i + ">" + args[i][x] + "</r:" + i + ">"; } } else { argsxml += "<r:" + i + ">" + args[i] + "</r:" + i + ">"; } } }
97
- obj.ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors);
98
- }
99
-
100
- // Perform a WSMAN method call operation. The arguments are already formatted in XML.
101
- obj.ExecMethodXml = function (resuri, method, argsxml, callback, tag, pri, selectors) {
102
- obj.PerformAjax(resuri + "/" + method + "</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>" + _PutObjToSelectorsXml(selectors) + "</Header><Body><r:" + method + '_INPUT' + " xmlns:r=\"" + resuri + "\">" + argsxml + "</r:" + method + "_INPUT></Body></Envelope>", callback, tag, pri);
103
- }
104
-
105
- // Perform a WSMAN ENUM operation
106
- obj.ExecEnum = function (resuri, callback, tag, pri) {
107
- obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\" /></Body></Envelope>", callback, tag, pri);
108
- }
109
-
110
- // Perform a WSMAN PULL operation
111
- obj.ExecPull = function (resuri, enumctx, callback, tag, pri) {
112
- obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\"><EnumerationContext>" + enumctx + "</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>", callback, tag, pri);
113
- }
114
-
115
- // Private method
116
- obj.ParseWsman = function (xml) {
117
- try {
118
- if (!xml.childNodes) xml = _turnToXml(xml);
119
- var r = { Header:{} }, header = xml.getElementsByTagName("Header")[0], t;
120
- if (!header) header = xml.getElementsByTagName("a:Header")[0];
121
- if (!header) return null;
122
- for (var i = 0; i < header.childNodes.length; i++) {
123
- var child = header.childNodes[i];
124
- r.Header[child.localName] = child.textContent;
125
- }
126
- var body = xml.getElementsByTagName("Body")[0];
127
- if (!body) body = xml.getElementsByTagName("a:Body")[0];
128
- if (!body) return null;
129
- if (body.childNodes.length > 0) {
130
- t = body.childNodes[0].localName;
131
- if (t.indexOf("_OUTPUT") == t.length - 7) { t = t.substring(0, t.length - 7); }
132
- r.Header['Method'] = t;
133
- r.Body = _ParseWsmanRec(body.childNodes[0]);
134
- }
135
- return r;
136
- } catch (e) {
137
- console.log("Unable to parse XML: " + xml);
138
- return null;
139
- }
140
- }
141
-
142
- // Private method
143
- function _ParseWsmanRec(node) {
144
- var data, r = {};
145
- for (var i = 0; i < node.childNodes.length; i++) {
146
- var child = node.childNodes[i];
147
- if ((child.childElementCount == null) || (child.childElementCount == 0)) { data = child.textContent; } else { data = _ParseWsmanRec(child); }
148
- if (data == 'true') data = true; // Convert 'true' into true
149
- if (data == 'false') data = false; // Convert 'false' into false
150
- if ((parseInt(data) + '') === data) data = parseInt(data); // Convert integers
151
-
152
- var childObj = data;
153
- if ((child.attributes != null) && (child.attributes.length > 0)) {
154
- childObj = { 'Value': data };
155
- for(var j = 0; j < child.attributes.length; j++) {
156
- childObj['@' + child.attributes[j].name] = child.attributes[j].value;
157
- }
158
- }
159
-
160
- if (r[child.localName] instanceof Array) { r[child.localName].push(childObj); }
161
- else if (r[child.localName] == null) { r[child.localName] = childObj; }
162
- else { r[child.localName] = [r[child.localName], childObj]; }
163
- }
164
- return r;
165
- }
166
-
167
- function _PutObjToBodyXml(resuri, putObj) {
168
- if (!resuri || putObj == null) return '';
169
- var objname = obj.GetNameFromUrl(resuri);
170
- var result = '<r:' + objname + ' xmlns:r="' + resuri + '">';
171
-
172
- for (var prop in putObj) {
173
- if (!putObj.hasOwnProperty(prop) || prop.indexOf('__') === 0 || prop.indexOf('@') === 0) continue;
174
- if (putObj[prop] == null || typeof putObj[prop] === 'function') continue;
175
- if (typeof putObj[prop] === 'object' && putObj[prop]['ReferenceParameters']) {
176
- result += '<r:' + prop + '><a:Address>' + putObj[prop].Address + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + putObj[prop]['ReferenceParameters']["ResourceURI"] + '</w:ResourceURI><w:SelectorSet>';
177
- var selectorArray = putObj[prop]['ReferenceParameters']['SelectorSet']['Selector'];
178
- if (Array.isArray(selectorArray)) {
179
- for (var i=0; i< selectorArray.length; i++) {
180
- result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray[i]) + '>' + selectorArray[i]['Value'] + '</w:Selector>';
181
- }
182
- }
183
- else {
184
- result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray) + '>' + selectorArray['Value'] + '</w:Selector>';
185
- }
186
- result += '</w:SelectorSet></a:ReferenceParameters></r:' + prop + '>';
187
- }
188
- else {
189
- if (Array.isArray(putObj[prop])) {
190
- for (var i = 0; i < putObj[prop].length; i++) {
191
- result += '<r:' + prop + '>' + putObj[prop][i].toString() + '</r:' + prop + '>';
192
- }
193
- } else {
194
- result += '<r:' + prop + '>' + putObj[prop].toString() + '</r:' + prop + '>';
195
- }
196
- }
197
- }
198
-
199
- result += '</r:' + objname + '>';
200
- return result;
201
- }
202
-
203
- /*
204
- convert
205
- { @Name: 'InstanceID', @AttrName: 'Attribute Value'}
206
- into
207
- ' Name="InstanceID" AttrName="Attribute Value" '
208
- */
209
- function _ObjectToXmlAttributes(objWithAttributes) {
210
- if(!objWithAttributes) return '';
211
- var result = ' ';
212
- for (var propName in objWithAttributes) {
213
- if (!objWithAttributes.hasOwnProperty(propName) || propName.indexOf('@') !== 0) continue;
214
- result += propName.substring(1) + '="' + objWithAttributes[propName] + '" ';
215
- }
216
- return result;
217
- }
218
-
219
- function _PutObjToSelectorsXml(selectorSet) {
220
- if (!selectorSet) return '';
221
- if (typeof selectorSet == 'string') return selectorSet;
222
- if (selectorSet['InstanceID']) return "<w:SelectorSet><w:Selector Name=\"InstanceID\">" + selectorSet['InstanceID'] + "</w:Selector></w:SelectorSet>";
223
- var result = '<w:SelectorSet>';
224
- for(var propName in selectorSet) {
225
- if (!selectorSet.hasOwnProperty(propName)) continue;
226
- result += '<w:Selector Name="' + propName + '">';
227
- if (selectorSet[propName]['ReferenceParameters']) {
228
- result += '<a:EndpointReference>';
229
- result += '<a:Address>' + selectorSet[propName]['Address'] + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + selectorSet[propName]['ReferenceParameters']['ResourceURI'] + '</w:ResourceURI><w:SelectorSet>';
230
- var selectorArray = selectorSet[propName]['ReferenceParameters']['SelectorSet']['Selector'];
231
- if (Array.isArray(selectorArray)) {
232
- for (var i = 0; i < selectorArray.length; i++) {
233
- result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray[i]) + '>' + selectorArray[i]['Value'] + '</w:Selector>';
234
- }
235
- }
236
- else {
237
- result += '<w:Selector' + _ObjectToXmlAttributes(selectorArray) + '>' + selectorArray['Value'] + '</w:Selector>';
238
- }
239
- result += '</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>';
240
- } else {
241
- result += selectorSet[propName];
242
- }
243
- result += '</w:Selector>';
244
- }
245
- result += '</w:SelectorSet>';
246
- return result;
247
- }
248
-
249
- // This is a drop-in replacement to _turnToXml() that works without xml parser dependency.
250
- Object.defineProperty(Array.prototype, "peek", { value: function () { return (this.length > 0 ? this[this.length - 1] : null); } });
251
- function _treeBuilder() {
252
- this.tree = [];
253
- this.push = function (element) { this.tree.push(element); };
254
- this.pop = function () { var element = this.tree.pop(); if (this.tree.length > 0) { var x = this.tree.peek(); x.childNodes.push(element); x.childElementCount = x.childNodes.length; } return (element); };
255
- this.peek = function () { return (this.tree.peek()); }
256
- this.addNamespace = function (prefix, namespace) { this.tree.peek().nsTable[prefix] = namespace; if (this.tree.peek().attributes.length > 0) { for (var i = 0; i < this.tree.peek().attributes; ++i) { var a = this.tree.peek().attributes[i]; if (prefix == '*' && a.name == a.localName) { a.namespace = namespace; } else if (prefix != '*' && a.name != a.localName) { var pfx = a.name.split(':')[0]; if (pfx == prefix) { a.namespace = namespace; } } } } }
257
- this.getNamespace = function (prefix) { for (var i = this.tree.length - 1; i >= 0; --i) { if (this.tree[i].nsTable[prefix] != null) { return (this.tree[i].nsTable[prefix]); } } return null; }
258
- }
259
- function _turnToXml(text) { if (text == null) return null; return ({ childNodes: [_turnToXmlRec(text)], getElementsByTagName: _getElementsByTagName, getChildElementsByTagName: _getChildElementsByTagName, getElementsByTagNameNS: _getElementsByTagNameNS }); }
260
- function _getElementsByTagNameNS(ns, name) { var ret = []; _xmlTraverseAllRec(this.childNodes, function (node) { if (node.localName == name && (node.namespace == ns || ns == '*')) { ret.push(node); } }); return ret; }
261
- function _getElementsByTagName(name) { var ret = []; _xmlTraverseAllRec(this.childNodes, function (node) { if (node.localName == name) { ret.push(node); } }); return ret; }
262
- function _getChildElementsByTagName(name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name) { ret.push(this.childNodes[node]); } } } return (ret); }
263
- function _getChildElementsByTagNameNS(ns, name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name && (ns == '*' || this.childNodes[node].namespace == ns)) { ret.push(this.childNodes[node]); } } } return (ret); }
264
- function _xmlTraverseAllRec(nodes, func) { for (var i in nodes) { func(nodes[i]); if (nodes[i].childNodes) { _xmlTraverseAllRec(nodes[i].childNodes, func); } } }
265
- function _turnToXmlRec(text) {
266
- var elementStack = new _treeBuilder(), lastElement = null, x1 = text.split('<'), ret = [], element = null, currentElementName = null;
267
- for (var i in x1) {
268
- var x2 = x1[i].split('>'), x3 = x2[0].split(' '), elementName = x3[0];
269
- if ((elementName.length > 0) && (elementName[0] != '?')) {
270
- if (elementName[0] != '/') {
271
- var attributes = [], localName, localname2 = elementName.split(' ')[0].split(':'), localName = (localname2.length > 1) ? localname2[1] : localname2[0];
272
- Object.defineProperty(attributes, "get",
273
- {
274
- value: function () {
275
- if (arguments.length == 1) {
276
- for (var a in this) { if (this[a].name == arguments[0]) { return (this[a]); } }
277
- }
278
- else if (arguments.length == 2) {
279
- for (var a in this) { if (this[a].name == arguments[1] && (arguments[0] == '*' || this[a].namespace == arguments[0])) { return (this[a]); } }
280
- }
281
- else {
282
- throw ('attributes.get(): Invalid number of parameters');
283
- }
284
- }
285
- });
286
- elementStack.push({ name: elementName, localName: localName, getChildElementsByTagName: _getChildElementsByTagName, getElementsByTagNameNS: _getElementsByTagNameNS, getChildElementsByTagNameNS: _getChildElementsByTagNameNS, attributes: attributes, childNodes: [], nsTable: {} });
287
- // Parse Attributes
288
- if (x3.length > 0) {
289
- var skip = false;
290
- for (var j in x3) {
291
- if (x3[j] == '/') {
292
- // This is an empty Element
293
- elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':')));
294
- elementStack.peek().textContent = '';
295
- lastElement = elementStack.pop();
296
- skip = true;
297
- break;
298
- }
299
- var k = x3[j].indexOf('=');
300
- if (k > 0) {
301
- var attrName = x3[j].substring(0, k);
302
- var attrValue = x3[j].substring(k + 2, x3[j].length - 1);
303
- var attrNS = elementStack.getNamespace('*');
304
-
305
- if (attrName == 'xmlns') {
306
- elementStack.addNamespace('*', attrValue);
307
- attrNS = attrValue;
308
- } else if (attrName.startsWith('xmlns:')) {
309
- elementStack.addNamespace(attrName.substring(6), attrValue);
310
- } else {
311
- var ax = attrName.split(':');
312
- if (ax.length == 2) { attrName = ax[1]; attrNS = elementStack.getNamespace(ax[0]); }
313
- }
314
- var x = { name: attrName, value: attrValue }
315
- if (attrNS != null) x.namespace = attrNS;
316
- elementStack.peek().attributes.push(x);
317
- }
318
- }
319
- if (skip) { continue; }
320
- }
321
- elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':')));
322
- if (x2[1]) { elementStack.peek().textContent = x2[1]; }
323
- } else { lastElement = elementStack.pop(); }
324
- }
325
- }
326
- return lastElement;
327
- }
328
-
329
- return obj;
330
-}
331
-
332
-module.exports = WsmanStackCreateService;
agents/modules_meshcmd/amt-wsman-duk-0.2.0.js
deleted
-121
@@ -1,121 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-/**
18
-* @description WSMAN communication using duktape http
19
-* @author Ylian Saint-Hilaire
20
-* @version v0.2.0c
21
-*/
22
-
23
-// Construct a WSMAN communication object
24
-function CreateWsmanComm(host, port, user, pass, tls, extra) {
25
- var obj = {};
26
- obj.PendingAjax = []; // List of pending AJAX calls. When one frees up, another will start.
27
- obj.ActiveAjaxCount = 0; // Number of currently active AJAX calls
28
- obj.MaxActiveAjaxCount = 1; // Maximum number of activate AJAX calls at the same time.
29
- obj.FailAllError = 0; // Set this to non-zero to fail all AJAX calls with that error status, 999 causes responses to be silent.
30
- obj.host = host;
31
- obj.port = port;
32
- obj.user = user;
33
- obj.pass = pass;
34
- obj.tls = tls;
35
- obj.digest = null;
36
- obj.RequestCount = 0;
37
-
38
- // Private method
39
- // pri = priority, if set to 1, the call is high priority and put on top of the stack.
40
- obj.PerformAjax = function (postdata, callback, tag, pri, url, action) {
41
- if ((obj.ActiveAjaxCount == 0 || ((obj.ActiveAjaxCount < obj.MaxActiveAjaxCount) && (obj.challengeParams != null))) && obj.PendingAjax.length == 0) {
42
- // There are no pending AJAX calls, perform the call now.
43
- obj.PerformAjaxEx(postdata, callback, tag, url, action);
44
- } else {
45
- // If this is a high priority call, put this call in front of the array, otherwise put it in the back.
46
- if (pri == 1) { obj.PendingAjax.unshift([postdata, callback, tag, url, action]); } else { obj.PendingAjax.push([postdata, callback, tag, url, action]); }
47
- }
48
- }
49
-
50
- // Private method
51
- obj.PerformNextAjax = function () {
52
- if (obj.ActiveAjaxCount >= obj.MaxActiveAjaxCount || obj.PendingAjax.length == 0) return;
53
- var x = obj.PendingAjax.shift();
54
- obj.PerformAjaxEx(x[0], x[1], x[2], x[3], x[4]);
55
- obj.PerformNextAjax();
56
- }
57
-
58
- // Private method
59
- obj.PerformAjaxEx = function (postdata, callback, tag, url, action) {
60
- if (obj.FailAllError != 0) { if (obj.FailAllError != 999) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag]); } return; }
61
- if (!postdata) postdata = "";
62
- //console.log("SEND: " + postdata); // DEBUG
63
-
64
- // We are in a DukTape environement
65
- if (obj.digest == null) { obj.digest = require('http-digest').create(obj.user, obj.pass); obj.digest.http = require('http'); }
66
- var request = { protocol: (obj.tls == 1 ? 'https:' : 'http:'), method: 'POST', host: obj.host, path: '/wsman', port: obj.port, rejectUnauthorized: false, checkServerIdentity: function (cert) { console.log('checkServerIdentity', JSON.stringify(cert)); } };
67
- var req = obj.digest.request(request);
68
- //console.log('Request ' + (obj.RequestCount++));
69
- req.on('error', function (e) { obj.gotNextMessagesError({ status: 600 }, 'error', null, [postdata, callback, tag]); });
70
- req.on('response', function (response) {
71
- //console.log('Response: ' + response.statusCode);
72
- if (response.statusCode != 200) {
73
- console.log('ERR:' + JSON.stringify(response));
74
- obj.gotNextMessagesError({ status: response.statusCode }, 'error', null, [postdata, callback, tag]);
75
- } else {
76
- response.acc = '';
77
- response.on('data', function (data2) { this.acc += data2; });
78
- response.on('end', function () { obj.gotNextMessages(response.acc, 'success', { status: response.statusCode }, [postdata, callback, tag]); });
79
- }
80
- });
81
-
82
- // Send POST body, this work with binary.
83
- req.write(postdata);
84
- req.end();
85
- obj.ActiveAjaxCount++;
86
- return req;
87
- }
88
-
89
- // AJAX specific private method
90
- obj.pendingAjaxCall = [];
91
-
92
- // Private method
93
- obj.gotNextMessages = function (data, status, request, callArgs) {
94
- obj.ActiveAjaxCount--;
95
- if (obj.FailAllError == 999) return;
96
- //console.log("RECV: " + data); // DEBUG
97
- if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; }
98
- if (request.status != 200) { callArgs[1](null, request.status, callArgs[2]); return; }
99
- callArgs[1](data, 200, callArgs[2]);
100
- obj.PerformNextAjax();
101
- }
102
-
103
- // Private method
104
- obj.gotNextMessagesError = function (request, status, errorThrown, callArgs) {
105
- obj.ActiveAjaxCount--;
106
- if (obj.FailAllError == 999) return;
107
- if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; }
108
- //if (status != 200) { console.log("ERROR, status=" + status + "\r\n\r\nreq=" + callArgs[0]); } // Debug: Display the request & response if something did not work.
109
- if (obj.FailAllError != 999) { callArgs[1]({ Header: { HttpError: request.status } }, request.status, callArgs[2]); }
110
- obj.PerformNextAjax();
111
- }
112
-
113
- // Cancel all pending queries with given status
114
- obj.CancelAllQueries = function (s) {
115
- while (obj.PendingAjax.length > 0) { var x = obj.PendingAjax.shift(); x[1](null, s, x[2]); }
116
- }
117
-
118
- return obj;
119
-}
120
-
121
-module.exports = CreateWsmanComm;
agents/modules_meshcmd/amt.js
+2
-2
@@ -356,8 +356,8 @@ function AmtStackCreateService(wsmanStack) {
356
obj.IPS_HostBasedSetupService_UpgradeClientToAdmin = function (McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "UpgradeClientToAdmin", { "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); }
357
obj.IPS_HostBasedSetupService_DisableClientControlMode = function (_method_dummy, callback_func) { obj.Exec("IPS_HostBasedSetupService", "DisableClientControlMode", { "_method_dummy": _method_dummy }, callback_func); }
358
obj.IPS_KVMRedirectionSettingData_TerminateSession = function (callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "TerminateSession", {}, callback_func); }
359
- obj.IPS_KVMRedirectionSettingData_DataChannelRead = function (callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead", {}, callback_func); }
360
- obj.IPS_KVMRedirectionSettingData_DataChannelWrite = function (Data, callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "DataChannelWrite", { "DataMessage": Data }, callback_func); }
359
+ obj.IPS_KVMRedirectionSettingData_DataChannelRead = function (callback_func, tag) { obj.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead", {}, callback_func, tag); }
360
+ obj.IPS_KVMRedirectionSettingData_DataChannelWrite = function (Data, callback_func, tag) { obj.Exec("IPS_KVMRedirectionSettingData", "DataChannelWrite", { "DataMessage": Data }, callback_func, tag); }
361
obj.IPS_OptInService_StartOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "StartOptIn", {}, callback_func); }
362
obj.IPS_OptInService_CancelOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "CancelOptIn", {}, callback_func); }
363
obj.IPS_OptInService_SendOptInCode = function (OptInCode, callback_func) { obj.Exec("IPS_OptInService", "SendOptInCode", { "OptInCode": OptInCode }, callback_func); }
agents/modules_meshcmd/amt_heci.js
deleted
-297
@@ -1,297 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-var Q = require('queue');
18
-
19
-function amt_heci() {
20
- var emitterUtils = require('events').inherits(this);
21
- emitterUtils.createEvent('error');
22
- emitterUtils.createEvent('connect');
23
-
24
- var heci = require('heci');
25
-
26
- this._amt = heci.create();
27
- this._amt.BiosVersionLen = 65;
28
- this._amt.UnicodeStringLen = 20;
29
-
30
- this._amt.rq = new Q();
31
- this._amt.Parent = this;
32
- this._amt.on('error', function (e) { this.Parent.emit('error', e); });
33
- this._amt.on('connect', function () {
34
- this.Parent.emit('connect');
35
- this.on('data', function (chunk) {
36
- //console.log("Received: " + chunk.length + " bytes");
37
- var header = this.Parent.getCommand(chunk);
38
- //console.log("CMD = " + header.Command + " (Status: " + header.Status + ") Response = " + header.IsResponse);
39
-
40
- var user = this.rq.deQueue();
41
- var params = user.optional;
42
- var callback = user.func;
43
-
44
- params.unshift(header);
45
- callback.apply(this.Parent, params);
46
- });
47
- });
48
- this._amt.connect(heci.GUIDS.AMT, { noPipeline: 1 });
49
-
50
- this.getCommand = function (chunk) {
51
- var command = chunk.length == 0 ? (this._amt.rq.peekQueue().cmd | 0x800000) : chunk.readUInt32LE(4);
52
- var ret = { IsResponse: (command & 0x800000) == 0x800000 ? true : false, Command: (command & 0x7FFFFF), Status: chunk.length != 0 ? chunk.readUInt32LE(12) : -1, Data: chunk.length != 0 ? chunk.slice(16) : null };
53
- return (ret);
54
- };
55
-
56
- this.sendCommand = function () {
57
- if (arguments.length < 3 || typeof (arguments[0]) != 'number' || typeof (arguments[1]) != 'object' || typeof (arguments[2]) != 'function') { throw ('invalid parameters'); }
58
- var args = [];
59
- for (var i = 3; i < arguments.length; ++i) { args.push(arguments[i]); }
60
-
61
- this._amt.rq.enQueue({ cmd: arguments[0], func: arguments[2], optional: args });
62
-
63
- var header = Buffer.from('010100000000000000000000', 'hex');
64
- header.writeUInt32LE(arguments[0] | 0x04000000, 4);
65
- header.writeUInt32LE(arguments[1] == null ? 0 : arguments[1].length, 8);
66
-
67
- this._amt.write(arguments[1] == null ? header : Buffer.concat([header, arguments[1]]));
68
- }
69
-
70
- this.getVersion = function (callback) {
71
- var optional = [];
72
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
73
- this.sendCommand(26, null, function (header, fn, opt) {
74
- if (header.Status == 0) {
75
- var i, CodeVersion = header.Data, val = { BiosVersion: CodeVersion.slice(0, this._amt.BiosVersionLen), Versions: [] }, v = CodeVersion.slice(this._amt.BiosVersionLen + 4);
76
- for (i = 0; i < CodeVersion.readUInt32LE(this._amt.BiosVersionLen) ; ++i) {
77
- val.Versions[i] = { Description: v.slice(2, v.readUInt16LE(0) + 2).toString(), Version: v.slice(4 + this._amt.UnicodeStringLen, 4 + this._amt.UnicodeStringLen + v.readUInt16LE(2 + this._amt.UnicodeStringLen)).toString() };
78
- v = v.slice(4 + (2 * this._amt.UnicodeStringLen));
79
- }
80
- opt.unshift(val);
81
- } else {
82
- opt.unshift(null);
83
- }
84
- fn.apply(this, opt);
85
- }, callback, optional);
86
- };
87
-
88
- this.getProvisioningState = function (callback) {
89
- var optional = [];
90
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
91
- this.sendCommand(17, null, function (header, fn, opt) {
92
- if (header.Status == 0) {
93
- var result = {};
94
- result.state = header.Data.readUInt32LE(0);
95
- if (result.state < 3) { result.stateStr = ["PRE", "IN", "POST"][result.state]; }
96
- opt.unshift(result);
97
- } else {
98
- opt.unshift(null);
99
- }
100
- fn.apply(this, opt);
101
- }, callback, optional);
102
- };
103
- this.getProvisioningMode = function (callback) {
104
- var optional = [];
105
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
106
- this.sendCommand(8, null, function (header, fn, opt) {
107
- if (header.Status == 0) {
108
- var result = {};
109
- result.mode = header.Data.readUInt32LE(0);
110
- if (result.mode < 4) { result.modeStr = ["NONE", "ENTERPRISE", "SMALL_BUSINESS", "REMOTE_ASSISTANCE"][result.mode]; }
111
- result.legacy = header.Data.readUInt32LE(4) == 0 ? false : true;
112
- opt.unshift(result);
113
- } else {
114
- opt.unshift(null);
115
- }
116
- fn.apply(this, opt);
117
- }, callback, optional);
118
- };
119
- this.getEHBCState = function (callback) {
120
- var optional = [];
121
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
122
- this.sendCommand(132, null, function (header, fn, opt) {
123
- if (header.Status == 0) {
124
- opt.unshift({ EHBC: header.Data.readUInt32LE(0) != 0 });
125
- } else {
126
- opt.unshift(null);
127
- }
128
- fn.apply(this, opt);
129
- }, callback, optional);
130
- };
131
- this.getControlMode = function (callback) {
132
- var optional = [];
133
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
134
- this.sendCommand(107, null, function (header, fn, opt) {
135
- if (header.Status == 0) {
136
- var result = {};
137
- result.controlMode = header.Data.readUInt32LE(0);
138
- if (result.controlMode < 3) { result.controlModeStr = ["NONE_RPAT", "CLIENT", "ADMIN", "REMOTE_ASSISTANCE"][result.controlMode]; }
139
- opt.unshift(result);
140
- } else {
141
- opt.unshift(null);
142
- }
143
- fn.apply(this, opt);
144
- }, callback, optional);
145
- };
146
- this.getMACAddresses = function (callback) {
147
- var optional = [];
148
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
149
- this.sendCommand(37, null, function (header, fn, opt) {
150
- if (header.Status == 0) {
151
- opt.unshift({ DedicatedMAC: header.Data.slice(0, 6).toString('hex:'), HostMAC: header.Data.slice(6, 12).toString('hex:') });
152
- } else { opt.unshift({ DedicatedMAC: null, HostMAC: null }); }
153
- fn.apply(this, opt);
154
- }, callback, optional);
155
- };
156
- this.getDnsSuffix = function (callback) {
157
- var optional = [];
158
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
159
- this.sendCommand(54, null, function (header, fn, opt) {
160
- if (header.Status == 0) {
161
- var resultLen = header.Data.readUInt16LE(0);
162
- if (resultLen > 0) { opt.unshift(header.Data.slice(2, 2 + resultLen).toString()); } else { opt.unshift(null); }
163
- } else {
164
- opt.unshift(null);
165
- }
166
- fn.apply(this, opt);
167
- }, callback, optional);
168
- };
169
- this.getHashHandles = function (callback) {
170
- var optional = [];
171
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
172
- this.sendCommand(0x2C, null, function (header, fn, opt) {
173
- var result = [];
174
- if (header.Status == 0) {
175
- var resultLen = header.Data.readUInt32LE(0);
176
- for (var i = 0; i < resultLen; ++i) {
177
- result.push(header.Data.readUInt32LE(4 + (4 * i)));
178
- }
179
- }
180
- opt.unshift(result);
181
- fn.apply(this, opt);
182
- }, callback, optional);
183
- };
184
- this.getCertHashEntry = function (handle, callback) {
185
- var optional = [];
186
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
187
-
188
- var data = new Buffer(4);
189
- data.writeUInt32LE(handle, 0);
190
-
191
- this.sendCommand(0x2D, data, function (header, fn, opt) {
192
- if (header.Status == 0) {
193
- var result = {};
194
- result.isDefault = header.Data.readUInt32LE(0);
195
- result.isActive = header.Data.readUInt32LE(4);
196
- result.hashAlgorithm = header.Data.readUInt8(72);
197
- if (result.hashAlgorithm < 4) {
198
- result.hashAlgorithmStr = ["MD5", "SHA1", "SHA256", "SHA512"][result.hashAlgorithm];
199
- result.hashAlgorithmSize = [16, 20, 32, 64][result.hashAlgorithm];
200
- result.certificateHash = header.Data.slice(8, 8 + result.hashAlgorithmSize).toString('hex');
201
- }
202
- result.name = header.Data.slice(73 + 2, 73 + 2 + header.Data.readUInt16LE(73)).toString();
203
- opt.unshift(result);
204
- } else {
205
- opt.unshift(null);
206
- }
207
- fn.apply(this, opt);
208
- }, callback, optional);
209
- };
210
- this.getCertHashEntries = function (callback) {
211
- var optional = [];
212
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
213
-
214
- this.getHashHandles(function (handles, fn, opt) {
215
- var entries = [];
216
- this.getCertHashEntry(handles.shift(), this._getHashEntrySink, fn, opt, entries, handles);
217
- }, callback, optional);
218
- };
219
- this._getHashEntrySink = function (result, fn, opt, entries, handles) {
220
- entries.push(result);
221
- if (handles.length > 0) {
222
- this.getCertHashEntry(handles.shift(), this._getHashEntrySink, fn, opt, entries, handles);
223
- } else {
224
- opt.unshift(entries);
225
- fn.apply(this, opt);
226
- }
227
- }
228
- this.getLocalSystemAccount = function (callback) {
229
- var optional = [];
230
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
231
- this.sendCommand(103, Buffer.alloc(40), function (header, fn, opt) {
232
- if (header.Data.length == 68) { opt.unshift({ user: header.Data.slice(0, 34).toString(), pass: header.Data.slice(34, 67).toString(), raw: header.Data }); } else { opt.unshift(null); }
233
- fn.apply(this, opt);
234
- }, callback, optional);
235
- }
236
- this.unprovision = function (mode, callback) {
237
- var optional = [];
238
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
239
- var data = new Buffer(4);
240
- data.writeUInt32LE(mode, 0);
241
- this.sendCommand(16, data, function (header, fn, opt) {
242
- opt.unshift(header.Status);
243
- fn.apply(this, opt);
244
- }, callback, optional);
245
- }
246
- this.startConfiguration = function () {
247
- var optional = [];
248
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
249
- this.sendCommand(0x29, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
250
- }
251
- this.stopConfiguration = function () {
252
- var optional = [];
253
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
254
- this.sendCommand(0x5E, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
255
- }
256
- this.openUserInitiatedConnection = function () {
257
- var optional = [];
258
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
259
- this.sendCommand(0x44, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
260
- }
261
- this.closeUserInitiatedConnection = function () {
262
- var optional = [];
263
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
264
- this.sendCommand(0x45, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
265
- }
266
- this.getRemoteAccessConnectionStatus = function () {
267
- var optional = [];
268
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
269
- this.sendCommand(0x46, data, function (header, fn, opt) {
270
- if (header.Status == 0) {
271
- var hostname = v.slice(14, header.Data.readUInt16LE(12) + 14).toString()
272
- opt.unshift({ status: header.Status, networkStatus: header.Data.readUInt32LE(0), remoteAccessStatus: header.Data.readUInt32LE(4), remoteAccessTrigger: header.Data.readUInt32LE(8), mpsHostname: hostname, raw: header.Data });
273
- } else {
274
- opt.unshift({ status: header.Status });
275
- }
276
- fn.apply(this, opt);
277
- }, callback, optional);
278
- }
279
- this.getProtocolVersion = function (callback) {
280
- var optional = [];
281
- for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); }
282
-
283
- heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) {
284
- if (status == 0) {
285
- var result = buffer.readUInt8(0).toString() + '.' + buffer.readUInt8(1).toString() + '.' + buffer.readUInt8(2).toString() + '.' + buffer.readUInt16BE(3).toString();
286
- opt.unshift(result);
287
- fn.apply(self, opt);
288
- }
289
- else {
290
- opt.unshift(null);
291
- fn.apply(self, opt);
292
- }
293
- }, this, callback, optional);
294
- }
295
-}
296
-
297
-module.exports = amt_heci;
\ No newline at end of file
agents/modules_meshcmd/lme_heci.js
deleted
-324
@@ -1,324 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-var MemoryStream = require('MemoryStream');
18
-var lme_id = 0;
19
-var lme_port_offset = 0; // Debug: Set this to "-100" to bind to 16892 & 16893 and IN_ADDRANY. This is for LMS debugging.
20
-
21
-
22
-var APF_DISCONNECT = 1;
23
-var APF_SERVICE_REQUEST = 5;
24
-var APF_SERVICE_ACCEPT = 6;
25
-var APF_USERAUTH_REQUEST = 50;
26
-var APF_USERAUTH_FAILURE = 51;
27
-var APF_USERAUTH_SUCCESS = 52;
28
-var APF_GLOBAL_REQUEST = 80;
29
-var APF_REQUEST_SUCCESS = 81;
30
-var APF_REQUEST_FAILURE = 82;
31
-var APF_CHANNEL_OPEN = 90;
32
-var APF_CHANNEL_OPEN_CONFIRMATION = 91;
33
-var APF_CHANNEL_OPEN_FAILURE = 92;
34
-var APF_CHANNEL_WINDOW_ADJUST = 93;
35
-var APF_CHANNEL_DATA = 94;
36
-var APF_CHANNEL_CLOSE = 97;
37
-var APF_PROTOCOLVERSION = 192;
38
-
39
-
40
-function lme_object() {
41
- this.ourId = ++lme_id;
42
- this.amtId = -1;
43
- this.LME_CHANNEL_STATUS = 'LME_CS_FREE';
44
- this.txWindow = 0;
45
- this.rxWindow = 0;
46
- this.localPort = 0;
47
- this.errorCount = 0;
48
-}
49
-
50
-function stream_bufferedWrite() {
51
- var emitterUtils = require('events').inherits(this);
52
- this.buffer = [];
53
- this._readCheckImmediate = undefined;
54
-
55
- // Writable Events
56
- emitterUtils.createEvent('close');
57
- emitterUtils.createEvent('drain');
58
- emitterUtils.createEvent('error');
59
- emitterUtils.createEvent('finish');
60
- emitterUtils.createEvent('pipe');
61
- emitterUtils.createEvent('unpipe');
62
-
63
- // Readable Events
64
- emitterUtils.createEvent('readable');
65
- this.isEmpty = function () {
66
- return (this.buffer.length == 0);
67
- };
68
- this.isWaiting = function () {
69
- return (this._readCheckImmediate == undefined);
70
- };
71
- this.write = function (chunk) {
72
- for (var args in arguments) { if (typeof (arguments[args]) == 'function') { this.once('drain', arguments[args]); break; } }
73
- var tmp = Buffer.alloc(chunk.length);
74
- chunk.copy(tmp);
75
- this.buffer.push({ offset: 0, data: tmp });
76
- this.emit('readable');
77
- return (this.buffer.length == 0 ? true : false);
78
- };
79
- this.read = function () {
80
- var size = arguments.length == 0 ? undefined : arguments[0];
81
- var bytesRead = 0;
82
- var list = [];
83
- while ((size == undefined || bytesRead < size) && this.buffer.length > 0) {
84
- var len = this.buffer[0].data.length - this.buffer[0].offset;
85
- var offset = this.buffer[0].offset;
86
-
87
- if (len > (size - bytesRead)) {
88
- // Only reading a subset
89
- list.push(this.buffer[0].data.slice(offset, offset + size - bytesRead));
90
- this.buffer[0].offset += (size - bytesRead);
91
- bytesRead += (size - bytesRead);
92
- } else {
93
- // Reading the entire thing
94
- list.push(this.buffer[0].data.slice(offset));
95
- bytesRead += len;
96
- this.buffer.shift();
97
- }
98
- }
99
- this._readCheckImmediate = setImmediate(function (buffered) {
100
- buffered._readCheckImmediate = undefined;
101
- if (buffered.buffer.length == 0) {
102
- buffered.emit('drain'); // Drained
103
- } else {
104
- buffered.emit('readable'); // Not drained
105
- }
106
- }, this);
107
- return (Buffer.concat(list));
108
- };
109
-}
110
-
111
-
112
-function lme_heci(options) {
113
- var emitterUtils = require('events').inherits(this);
114
- emitterUtils.createEvent('error');
115
- emitterUtils.createEvent('connect');
116
-
117
- if (options.debug == true) { lme_port_offset = -100; } // LMS debug mode
118
-
119
- var heci = require('heci');
120
- this.INITIAL_RXWINDOW_SIZE = 4096;
121
-
122
- this._LME = heci.create();
123
- this._LME.LMS = this;
124
- this._LME.on('error', function (e) { this.LMS.emit('error', e); });
125
- this._LME.on('connect', function () {
126
- this.LMS.emit('connect');
127
- this.on('data', function (chunk) {
128
- // this = HECI
129
- var cmd = chunk.readUInt8(0);
130
-
131
- switch (cmd) {
132
- default:
133
- //console.log('Received ' + chunk.length + ' bytes of data for LMS');
134
- //console.log('Command = ' + cmd);
135
- break;
136
- case APF_SERVICE_REQUEST:
137
- var nameLen = chunk.readUInt32BE(1);
138
- var name = chunk.slice(5, nameLen + 5);
139
- //console.log("Service Request for: " + name);
140
- if (name == 'pfwd@amt.intel.com' || name == 'auth@amt.intel.com') {
141
- var outBuffer = Buffer.alloc(5 + nameLen);
142
- outBuffer.writeUInt8(6, 0);
143
- outBuffer.writeUInt32BE(nameLen, 1);
144
- outBuffer.write(name.toString(), 5);
145
- this.write(outBuffer);
146
- //console.log('Answering APF_SERVICE_REQUEST');
147
- } else {
148
- //console.log('UNKNOWN APF_SERVICE_REQUEST');
149
- }
150
- break;
151
- case APF_GLOBAL_REQUEST:
152
- var nameLen = chunk.readUInt32BE(1);
153
- var name = chunk.slice(5, nameLen + 5).toString();
154
-
155
- switch (name) {
156
- case 'tcpip-forward':
157
- var len = chunk.readUInt32BE(nameLen + 6);
158
- var port = chunk.readUInt32BE(nameLen + 10 + len);
159
- //console.log("[" + chunk.length + "/" + len + "] APF_GLOBAL_REQUEST for: " + name + " on port " + port);
160
- if (this[name] == undefined) {
161
- this[name] = {};
162
- }
163
- this[name][port] = require('net').createServer();
164
- this[name][port].HECI = this;
165
- if (lme_port_offset == 0) {
166
- this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
167
- } else {
168
- this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
169
- }
170
- this[name][port].on('connection', function (socket) {
171
- //console.log('New [' + socket.remoteFamily + '] TCP Connection on: ' + socket.remoteAddress + ' :' + socket.localPort);
172
- this.HECI.LMS.bindDuplexStream(socket, socket.remoteFamily, socket.localPort - lme_port_offset);
173
- });
174
- var outBuffer = Buffer.alloc(5);
175
- outBuffer.writeUInt8(81, 0);
176
- outBuffer.writeUInt32BE(port, 1);
177
- this.write(outBuffer);
178
- break;
179
- case 'cancel-tcpip-forward':
180
- break;
181
- case 'udp-send-to@amt.intel.com':
182
- break;
183
- default:
184
- //console.log("Unknown APF_GLOBAL_REQUEST for: " + name);
185
- break;
186
- }
187
- break;
188
- case APF_CHANNEL_OPEN_CONFIRMATION:
189
- var rChannel = chunk.readUInt32BE(1);
190
- var sChannel = chunk.readUInt32BE(5);
191
- var wSize = chunk.readUInt32BE(9);
192
- //console.log('rChannel/' + rChannel + ', sChannel/' + sChannel + ', wSize/' + wSize);
193
- if (this.sockets[rChannel] != undefined) {
194
- this.sockets[rChannel].lme.amtId = sChannel;
195
- this.sockets[rChannel].lme.rxWindow = wSize;
196
- this.sockets[rChannel].lme.txWindow = wSize;
197
- this.sockets[rChannel].lme.LME_CHANNEL_STATUS = 'LME_CS_CONNECTED';
198
- //console.log('LME_CS_CONNECTED');
199
- this.sockets[rChannel].bufferedStream = new stream_bufferedWrite();
200
- this.sockets[rChannel].bufferedStream.socket = this.sockets[rChannel];
201
- this.sockets[rChannel].bufferedStream.on('readable', function () {
202
- if (this.socket.lme.txWindow > 0) {
203
- var buffer = this.read(this.socket.lme.txWindow);
204
- var packet = Buffer.alloc(9 + buffer.length);
205
- packet.writeUInt8(APF_CHANNEL_DATA, 0);
206
- packet.writeUInt32BE(this.socket.lme.amtId, 1);
207
- packet.writeUInt32BE(buffer.length, 5);
208
- buffer.copy(packet, 9);
209
- this.socket.lme.txWindow -= buffer.length;
210
- this.socket.HECI.write(packet);
211
- }
212
- });
213
- this.sockets[rChannel].bufferedStream.on('drain', function () {
214
- this.socket.resume();
215
- });
216
- this.sockets[rChannel].on('data', function (chunk) {
217
- if (!this.bufferedStream.write(chunk)) { this.pause(); }
218
- });
219
- this.sockets[rChannel].on('end', function () {
220
- var outBuffer = Buffer.alloc(5);
221
- outBuffer.writeUInt8(APF_CHANNEL_CLOSE, 0);
222
- outBuffer.writeUInt32BE(this.lme.amtId, 1);
223
- this.HECI.write(outBuffer);
224
- });
225
- this.sockets[rChannel].resume();
226
- }
227
-
228
- break;
229
- case APF_PROTOCOLVERSION:
230
- var major = chunk.readUInt32BE(1);
231
- var minor = chunk.readUInt32BE(5);
232
- var reason = chunk.readUInt32BE(9);
233
- var outBuffer = Buffer.alloc(93);
234
- outBuffer.writeUInt8(192, 0);
235
- outBuffer.writeUInt32BE(1, 1);
236
- outBuffer.writeUInt32BE(0, 5);
237
- outBuffer.writeUInt32BE(reason, 9);
238
- //console.log('Answering PROTOCOL_VERSION');
239
- this.write(outBuffer);
240
- break;
241
- case APF_CHANNEL_WINDOW_ADJUST:
242
- var rChannelId = chunk.readUInt32BE(1);
243
- var bytesToAdd = chunk.readUInt32BE(5);
244
- if (this.sockets[rChannelId] != undefined) {
245
- this.sockets[rChannelId].lme.txWindow += bytesToAdd;
246
- if (!this.sockets[rChannelId].bufferedStream.isEmpty() && this.sockets[rChannelId].bufferedStream.isWaiting()) {
247
- this.sockets[rChannelId].bufferedStream.emit('readable');
248
- }
249
- } else {
250
- //console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_WINDOW_ADJUST');
251
- }
252
- break;
253
- case APF_CHANNEL_DATA:
254
- var rChannelId = chunk.readUInt32BE(1);
255
- var dataLen = chunk.readUInt32BE(5);
256
- var data = chunk.slice(9, 9 + dataLen);
257
- if (this.sockets[rChannelId] != undefined) {
258
- this.sockets[rChannelId].pendingBytes.push(data.length);
259
- this.sockets[rChannelId].write(data, function () {
260
- var written = this.pendingBytes.shift();
261
- var outBuffer = Buffer.alloc(9);
262
- outBuffer.writeUInt8(APF_CHANNEL_WINDOW_ADJUST, 0);
263
- outBuffer.writeUInt32BE(this.lme.amtId, 1);
264
- outBuffer.writeUInt32BE(written, 5);
265
- this.HECI.write(outBuffer);
266
- });
267
- } else {
268
- //console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_DATA');
269
- }
270
- break;
271
- case APF_CHANNEL_CLOSE:
272
- var rChannelId = chunk.readUInt32BE(1);
273
- if (this.sockets[rChannelId] != undefined) {
274
- this.sockets[rChannelId].end();
275
- var amtId = this.sockets[rChannelId].lme.amtId;
276
- var buffer = Buffer.alloc(5);
277
- delete this.sockets[rChannelId];
278
-
279
- buffer.writeUInt8(APF_CHANNEL_CLOSE, 0);
280
- buffer.writeUInt32BE(amtId, 1);
281
- this.write(buffer);
282
- } else {
283
- //console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_CLOSE');
284
- }
285
- break;
286
- }
287
- });
288
- });
289
-
290
- this.bindDuplexStream = function (duplexStream, remoteFamily, localPort) {
291
- var socket = duplexStream;
292
- //console.log('New [' + remoteFamily + '] Virtual Connection/' + socket.localPort);
293
- socket.pendingBytes = [];
294
- socket.HECI = this._LME;
295
- socket.LMS = this;
296
- socket.lme = new lme_object();
297
- socket.lme.Socket = socket;
298
- var buffer = new MemoryStream();
299
- buffer.writeUInt8(0x5A);
300
- buffer.writeUInt32BE(15);
301
- buffer.write('forwarded-tcpip');
302
- buffer.writeUInt32BE(socket.lme.ourId);
303
- buffer.writeUInt32BE(this.INITIAL_RXWINDOW_SIZE);
304
- buffer.writeUInt32BE(0xFFFFFFFF);
305
- for (var i = 0; i < 2; ++i) {
306
- if (remoteFamily == 'IPv6') {
307
- buffer.writeUInt32BE(3);
308
- buffer.write('::1');
309
- } else {
310
- buffer.writeUInt32BE(9);
311
- buffer.write('127.0.0.1');
312
- }
313
- buffer.writeUInt32BE(localPort);
314
- }
315
- this._LME.write(buffer.buffer);
316
- if (this._LME.sockets == undefined) { this._LME.sockets = {}; }
317
- this._LME.sockets[socket.lme.ourId] = socket;
318
- socket.pause();
319
- };
320
-
321
- this._LME.connect(heci.GUIDS.LME, { noPipeline: 0 });
322
-}
323
-
324
-module.exports = lme_heci;
agents/modules_meshcore/WifiScanner.js
deleted
-272
@@ -1,272 +0,0 @@
1
-var MemoryStream = require('MemoryStream');
2
-var WindowsWireless = new Buffer([
3
-0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x77, 0x6C, 0x61, 0x6E,
4
-0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
5
-0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45,
6
-0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x77, 0x6C,
7
-0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20,
8
-0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20,
9
-0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65,
10
-0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20,
11
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32,
12
-0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3B, 0x0A, 0x20,
13
-0x20, 0x20, 0x20, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x20, 0x28, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61,
14
-0x6C, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x30, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
15
-0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x4E, 0x4F, 0x54, 0x20, 0x52, 0x45, 0x41, 0x44, 0x59, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
16
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x31, 0x3A, 0x0A, 0x20, 0x20,
17
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A,
18
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20,
19
-0x32, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x44, 0x2D, 0x48, 0x4F, 0x43, 0x22,
20
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73,
21
-0x65, 0x20, 0x33, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F,
22
-0x4E, 0x4E, 0x45, 0x43, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
23
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x34, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65,
24
-0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
25
-0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x35, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
26
-0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x53, 0x53, 0x4F, 0x43, 0x49, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
27
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x36, 0x3A, 0x0A, 0x20, 0x20, 0x20,
28
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x56, 0x45, 0x52, 0x49, 0x4E, 0x47, 0x22, 0x3B,
29
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65,
30
-0x20, 0x37, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4E,
31
-0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
32
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74,
33
-0x65, 0x20, 0x3D, 0x20, 0x22, 0x55, 0x4E, 0x4B, 0x4E, 0x4F, 0x57, 0x4E, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B,
34
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65,
35
-0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E,
36
-0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20,
37
-0x30, 0x2C, 0x20, 0x30, 0x29, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E,
38
-0x20, 0x28, 0x74, 0x72, 0x75, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6C, 0x73, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20,
39
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66,
40
-0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69,
41
-0x64, 0x2C, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x5F, 0x6C, 0x71, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
42
-0x20, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69, 0x64, 0x3B,
43
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
44
-0x2E, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x5F, 0x6C, 0x71, 0x3B, 0x0A, 0x7D, 0x0A, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x2E, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x74, 0x79,
45
-0x70, 0x65, 0x2E, 0x74, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72,
46
-0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x20, 0x5B, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62,
47
-0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x5D, 0x3A, 0x20, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x6C, 0x71, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63,
48
-0x74, 0x69, 0x6F, 0x6E, 0x20, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x29, 0x0A,
49
-0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x4E,
50
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
51
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69,
52
-0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20,
53
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74,
54
-0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
55
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x26, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x38, 0x29, 0x20, 0x26, 0x26, 0x20, 0x28, 0x4E,
56
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x3D, 0x20, 0x37, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20,
57
-0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68,
58
-0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20,
59
-0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x47, 0x65, 0x74, 0x42,
60
-0x53, 0x53, 0x4C, 0x69, 0x73, 0x74, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47,
61
-0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x33, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69,
62
-0x66, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
63
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x74, 0x61, 0x6C, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
64
-0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76,
65
-0x61, 0x72, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
66
-0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x28, 0x69, 0x20, 0x3D, 0x20,
67
-0x30, 0x3B, 0x20, 0x69, 0x20, 0x3C, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x3B, 0x20, 0x2B, 0x2B, 0x69, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
68
-0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x20, 0x3D, 0x20, 0x62,
69
-0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x20, 0x2B, 0x20, 0x28, 0x33, 0x36, 0x30, 0x20, 0x2A, 0x20, 0x69, 0x29, 0x2C, 0x20,
70
-0x33, 0x36, 0x30, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
71
-0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x74, 0x72, 0x69, 0x6D, 0x28, 0x29,
72
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x74,
73
-0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x30, 0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x32, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
74
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65,
75
-0x66, 0x28, 0x35, 0x36, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61,
76
-0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x36, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20,
77
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x65, 0x6D, 0x69, 0x74, 0x28,
78
-0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x2C, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x62, 0x73,
79
-0x73, 0x69, 0x64, 0x2C, 0x20, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20,
80
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x57, 0x69, 0x72, 0x65,
81
-0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x20, 0x3D, 0x20,
82
-0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x27, 0x29, 0x2E, 0x69, 0x6E, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29,
83
-0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x5F,
84
-0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x27, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76,
85
-0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x72, 0x6F,
86
-0x78, 0x79, 0x28, 0x22, 0x77, 0x6C, 0x61, 0x6E, 0x61, 0x70, 0x69, 0x2E, 0x64, 0x6C, 0x6C, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
87
-0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x22,
88
-0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28,
89
-0x22, 0x57, 0x6C, 0x61, 0x6E, 0x47, 0x65, 0x74, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x42, 0x73, 0x73, 0x4C, 0x69, 0x73, 0x74, 0x22, 0x2C, 0x20, 0x22, 0x47, 0x65, 0x74, 0x42, 0x53, 0x53,
90
-0x4C, 0x69, 0x73, 0x74, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65,
91
-0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x22, 0x29,
92
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22,
93
-0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E,
94
-0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x22, 0x29, 0x3B, 0x0A,
95
-0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C,
96
-0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6E, 0x65, 0x67,
97
-0x6F, 0x74, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69,
98
-0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x68, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C,
99
-0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
100
-0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x28, 0x32, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6E, 0x65, 0x67, 0x6F, 0x74, 0x69, 0x61, 0x74,
101
-0x65, 0x64, 0x2C, 0x20, 0x68, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x20, 0x3D, 0x20, 0x68, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
102
-0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x20,
103
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x50, 0x72, 0x6F,
104
-0x78, 0x79, 0x28, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x2C, 0x20, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46,
105
-0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x3B, 0x0A, 0x20, 0x20,
106
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E,
107
-0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20,
108
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
109
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x46, 0x46, 0x46, 0x46, 0x2C, 0x20,
110
-0x30, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x43, 0x61, 0x6C,
111
-0x6C, 0x62, 0x61, 0x63, 0x6B, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54,
112
-0x2E, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6D, 0x69,
113
-0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6E, 0x74, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x29, 0x3B, 0x0A, 0x20,
114
-0x20, 0x20, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x61, 0x64, 0x64, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27,
115
-0x2C, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x47, 0x65, 0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64,
116
-0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20,
117
-0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61,
118
-0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
119
-0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E,
120
-0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
121
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E,
122
-0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
123
-0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44,
124
-0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20,
125
-0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32, 0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67,
126
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65,
127
-0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x69, 0x6E,
128
-0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x31, 0x29, 0x20, 0x2F, 0x2F,
129
-0x20, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
130
-0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65,
131
-0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x70, 0x44,
132
-0x61, 0x74, 0x61, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72,
133
-0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x3D, 0x20,
134
-0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20,
135
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66,
136
-0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20,
137
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
138
-0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x37, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53,
139
-0x69, 0x7A, 0x65, 0x2C, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2C, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
140
-0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
141
-0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65,
142
-0x64, 0x53, 0x53, 0x49, 0x44, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x34, 0x2C,
143
-0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72,
144
-0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x36, 0x30,
145
-0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
146
-0x76, 0x61, 0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x37, 0x36,
147
-0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
148
-0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64,
149
-0x53, 0x53, 0x49, 0x44, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
150
-0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x6F, 0x77, 0x20, 0x28, 0x22, 0x47, 0x65,
151
-0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x73, 0x3A, 0x20, 0x46, 0x41, 0x49, 0x4C, 0x45, 0x44, 0x20, 0x28, 0x6E, 0x6F, 0x74, 0x20,
152
-0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x61, 0x20, 0x6E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x29, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
153
-0x7D, 0x3B, 0x0A, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x6D, 0x6F, 0x64, 0x75, 0x6C,
154
-0x65, 0x2E, 0x65, 0x78, 0x70, 0x6F, 0x72, 0x74, 0x73, 0x20, 0x3D, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x3B, 0x0A]);
155
-
156
-
157
-
158
-var WindowsChildScript = new Buffer([
159
-0x76, 0x61, 0x72, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6F, 0x6E, 0x74,
160
-0x61, 0x69, 0x6E, 0x65, 0x72, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x76, 0x61, 0x72, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
161
-0x28, 0x27, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x6F, 0x6E, 0x28, 0x27, 0x53, 0x63,
162
-0x61, 0x6E, 0x27, 0x2C, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x61, 0x70, 0x29, 0x20, 0x7B, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x73, 0x65, 0x6E, 0x64,
163
-0x28, 0x61, 0x70, 0x29, 0x3B, 0x20, 0x7D, 0x29, 0x3B, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x3B, 0x0D, 0x0A]);
164
-
165
-
166
-function AccessPoint(_ssid, _bssid, _lq)
167
-{
168
- this.ssid = _ssid;
169
- this.bssid = _bssid;
170
- this.lq = _lq;
171
-}
172
-AccessPoint.prototype.toString = function ()
173
-{
174
- return ("[" + this.bssid + "]: " + this.ssid + " (" + this.lq + ")");
175
- //return (this.ssid + " [" + this.bssid + "]: " + this.lq);
176
-}
177
-
178
-function WiFiScanner()
179
-{
180
- var emitterUtils = require('events').inherits(this);
181
- emitterUtils.createEvent('accessPoint');
182
-
183
- this.hasWireless = function ()
184
- {
185
- var retVal = false;
186
- var interfaces = require('os').networkInterfaces();
187
- for (var name in interfaces)
188
- {
189
- if (interfaces[name][0].type == 'wireless') { retVal = true; break; }
190
- }
191
- return (retVal);
192
- };
193
-
194
- this.Scan = function ()
195
- {
196
- if (process.platform == 'win32')
197
- {
198
- this.master = require('ScriptContainer').Create(15, ContainerPermissions.DEFAULT);
199
- this.master.parent = this;
200
- this.master.on('data', function (j) { this.parent.emit('accessPoint', new AccessPoint(j.ssid, j.bssid, j.lq)); });
201
-
202
- this.master.addModule('Wireless', WindowsWireless.toString());
203
- this.master.ExecuteString(WindowsChildScript.toString());
204
- }
205
- else if (process.platform == 'linux')
206
- {
207
- // Need to get the wireless interface name
208
- var interfaces = require('os').networkInterfaces();
209
- var wlan = null;
210
- for (var i in interfaces)
211
- {
212
- if (interfaces[i][0].type == 'wireless')
213
- {
214
- wlan = i;
215
- break;
216
- }
217
- }
218
- if (wlan != null)
219
- {
220
- this.child = require('child_process').execFile('/sbin/iwlist', ['iwlist', wlan, 'scan']);
221
- this.child.parent = this;
222
- this.child.ms = new MemoryStream();
223
- this.child.ms.parent = this.child;
224
- this.child.stdout.on('data', function (buffer) { this.parent.ms.write(buffer); });
225
- this.child.on('exit', function () { this.ms.end(); });
226
- this.child.ms.on('end', function ()
227
- {
228
- var str = this.buffer.toString();
229
- tokens = str.split(' - Address: ');
230
- for (var block in tokens)
231
- {
232
- if (block == 0) continue;
233
- var ln = tokens[block].split('\n');
234
- var _bssid = ln[0];
235
- var _lq;
236
- var _ssid;
237
-
238
- for (var lnblock in ln)
239
- {
240
- lnblock = ln[lnblock].trim();
241
- lnblock = lnblock.trim();
242
- if (lnblock.startsWith('ESSID:'))
243
- {
244
- _ssid = lnblock.slice(7, lnblock.length - 1);
245
- if (_ssid == '<hidden>') { _ssid = ''; }
246
- }
247
- if (lnblock.startsWith('Signal level='))
248
- {
249
- _lq = lnblock.slice(13,lnblock.length-4);
250
- }
251
- else if (lnblock.startsWith('Quality='))
252
- {
253
- _lq = lnblock.slice(8, 10);
254
- var scale = lnblock.slice(11, 13);
255
- }
256
- }
257
- this.parent.parent.emit('accessPoint', new AccessPoint(_ssid, _bssid, _lq));
258
- }
259
- });
260
- }
261
- }
262
- }
263
-}
264
-
265
-module.exports = WiFiScanner;
266
-
267
-
268
-
269
-
270
-
271
-
272
-
agents/modules_meshcore/amt_heci.js
deleted
-297
@@ -1,297 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-var Q = require('queue');
18
-
19
-function amt_heci() {
20
- var emitterUtils = require('events').inherits(this);
21
- emitterUtils.createEvent('error');
22
- emitterUtils.createEvent('connect');
23
-
24
- var heci = require('heci');
25
-
26
- this._amt = heci.create();
27
- this._amt.BiosVersionLen = 65;
28
- this._amt.UnicodeStringLen = 20;
29
-
30
- this._amt.rq = new Q();
31
- this._amt.Parent = this;
32
- this._amt.on('error', function (e) { this.Parent.emit('error', e); });
33
- this._amt.on('connect', function () {
34
- this.Parent.emit('connect');
35
- this.on('data', function (chunk) {
36
- //console.log("Received: " + chunk.length + " bytes");
37
- var header = this.Parent.getCommand(chunk);
38
- //console.log("CMD = " + header.Command + " (Status: " + header.Status + ") Response = " + header.IsResponse);
39
-
40
- var user = this.rq.deQueue();
41
- var params = user.optional;
42
- var callback = user.func;
43
-
44
- params.unshift(header);
45
- callback.apply(this.Parent, params);
46
- });
47
- });
48
- this._amt.connect(heci.GUIDS.AMT, { noPipeline: 1 });
49
-
50
- this.getCommand = function (chunk) {
51
- var command = chunk.length == 0 ? (this._amt.rq.peekQueue().cmd | 0x800000) : chunk.readUInt32LE(4);
52
- var ret = { IsResponse: (command & 0x800000) == 0x800000 ? true : false, Command: (command & 0x7FFFFF), Status: chunk.length != 0 ? chunk.readUInt32LE(12) : -1, Data: chunk.length != 0 ? chunk.slice(16) : null };
53
- return (ret);
54
- };
55
-
56
- this.sendCommand = function () {
57
- if (arguments.length < 3 || typeof (arguments[0]) != 'number' || typeof (arguments[1]) != 'object' || typeof (arguments[2]) != 'function') { throw ('invalid parameters'); }
58
- var args = [];
59
- for (var i = 3; i < arguments.length; ++i) { args.push(arguments[i]); }
60
-
61
- this._amt.rq.enQueue({ cmd: arguments[0], func: arguments[2], optional: args });
62
-
63
- var header = Buffer.from('010100000000000000000000', 'hex');
64
- header.writeUInt32LE(arguments[0] | 0x04000000, 4);
65
- header.writeUInt32LE(arguments[1] == null ? 0 : arguments[1].length, 8);
66
-
67
- this._amt.write(arguments[1] == null ? header : Buffer.concat([header, arguments[1]]));
68
- }
69
-
70
- this.getVersion = function (callback) {
71
- var optional = [];
72
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
73
- this.sendCommand(26, null, function (header, fn, opt) {
74
- if (header.Status == 0) {
75
- var i, CodeVersion = header.Data, val = { BiosVersion: CodeVersion.slice(0, this._amt.BiosVersionLen), Versions: [] }, v = CodeVersion.slice(this._amt.BiosVersionLen + 4);
76
- for (i = 0; i < CodeVersion.readUInt32LE(this._amt.BiosVersionLen) ; ++i) {
77
- val.Versions[i] = { Description: v.slice(2, v.readUInt16LE(0) + 2).toString(), Version: v.slice(4 + this._amt.UnicodeStringLen, 4 + this._amt.UnicodeStringLen + v.readUInt16LE(2 + this._amt.UnicodeStringLen)).toString() };
78
- v = v.slice(4 + (2 * this._amt.UnicodeStringLen));
79
- }
80
- opt.unshift(val);
81
- } else {
82
- opt.unshift(null);
83
- }
84
- fn.apply(this, opt);
85
- }, callback, optional);
86
- };
87
-
88
- this.getProvisioningState = function (callback) {
89
- var optional = [];
90
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
91
- this.sendCommand(17, null, function (header, fn, opt) {
92
- if (header.Status == 0) {
93
- var result = {};
94
- result.state = header.Data.readUInt32LE(0);
95
- if (result.state < 3) { result.stateStr = ["PRE", "IN", "POST"][result.state]; }
96
- opt.unshift(result);
97
- } else {
98
- opt.unshift(null);
99
- }
100
- fn.apply(this, opt);
101
- }, callback, optional);
102
- };
103
- this.getProvisioningMode = function (callback) {
104
- var optional = [];
105
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
106
- this.sendCommand(8, null, function (header, fn, opt) {
107
- if (header.Status == 0) {
108
- var result = {};
109
- result.mode = header.Data.readUInt32LE(0);
110
- if (result.mode < 4) { result.modeStr = ["NONE", "ENTERPRISE", "SMALL_BUSINESS", "REMOTE_ASSISTANCE"][result.mode]; }
111
- result.legacy = header.Data.readUInt32LE(4) == 0 ? false : true;
112
- opt.unshift(result);
113
- } else {
114
- opt.unshift(null);
115
- }
116
- fn.apply(this, opt);
117
- }, callback, optional);
118
- };
119
- this.getEHBCState = function (callback) {
120
- var optional = [];
121
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
122
- this.sendCommand(132, null, function (header, fn, opt) {
123
- if (header.Status == 0) {
124
- opt.unshift({ EHBC: header.Data.readUInt32LE(0) != 0 });
125
- } else {
126
- opt.unshift(null);
127
- }
128
- fn.apply(this, opt);
129
- }, callback, optional);
130
- };
131
- this.getControlMode = function (callback) {
132
- var optional = [];
133
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
134
- this.sendCommand(107, null, function (header, fn, opt) {
135
- if (header.Status == 0) {
136
- var result = {};
137
- result.controlMode = header.Data.readUInt32LE(0);
138
- if (result.controlMode < 3) { result.controlModeStr = ["NONE_RPAT", "CLIENT", "ADMIN", "REMOTE_ASSISTANCE"][result.controlMode]; }
139
- opt.unshift(result);
140
- } else {
141
- opt.unshift(null);
142
- }
143
- fn.apply(this, opt);
144
- }, callback, optional);
145
- };
146
- this.getMACAddresses = function (callback) {
147
- var optional = [];
148
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
149
- this.sendCommand(37, null, function (header, fn, opt) {
150
- if (header.Status == 0) {
151
- opt.unshift({ DedicatedMAC: header.Data.slice(0, 6).toString('hex:'), HostMAC: header.Data.slice(6, 12).toString('hex:') });
152
- } else { opt.unshift({ DedicatedMAC: null, HostMAC: null }); }
153
- fn.apply(this, opt);
154
- }, callback, optional);
155
- };
156
- this.getDnsSuffix = function (callback) {
157
- var optional = [];
158
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
159
- this.sendCommand(54, null, function (header, fn, opt) {
160
- if (header.Status == 0) {
161
- var resultLen = header.Data.readUInt16LE(0);
162
- if (resultLen > 0) { opt.unshift(header.Data.slice(2, 2 + resultLen).toString()); } else { opt.unshift(null); }
163
- } else {
164
- opt.unshift(null);
165
- }
166
- fn.apply(this, opt);
167
- }, callback, optional);
168
- };
169
- this.getHashHandles = function (callback) {
170
- var optional = [];
171
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
172
- this.sendCommand(0x2C, null, function (header, fn, opt) {
173
- var result = [];
174
- if (header.Status == 0) {
175
- var resultLen = header.Data.readUInt32LE(0);
176
- for (var i = 0; i < resultLen; ++i) {
177
- result.push(header.Data.readUInt32LE(4 + (4 * i)));
178
- }
179
- }
180
- opt.unshift(result);
181
- fn.apply(this, opt);
182
- }, callback, optional);
183
- };
184
- this.getCertHashEntry = function (handle, callback) {
185
- var optional = [];
186
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
187
-
188
- var data = new Buffer(4);
189
- data.writeUInt32LE(handle, 0);
190
-
191
- this.sendCommand(0x2D, data, function (header, fn, opt) {
192
- if (header.Status == 0) {
193
- var result = {};
194
- result.isDefault = header.Data.readUInt32LE(0);
195
- result.isActive = header.Data.readUInt32LE(4);
196
- result.hashAlgorithm = header.Data.readUInt8(72);
197
- if (result.hashAlgorithm < 4) {
198
- result.hashAlgorithmStr = ["MD5", "SHA1", "SHA256", "SHA512"][result.hashAlgorithm];
199
- result.hashAlgorithmSize = [16, 20, 32, 64][result.hashAlgorithm];
200
- result.certificateHash = header.Data.slice(8, 8 + result.hashAlgorithmSize).toString('hex');
201
- }
202
- result.name = header.Data.slice(73 + 2, 73 + 2 + header.Data.readUInt16LE(73)).toString();
203
- opt.unshift(result);
204
- } else {
205
- opt.unshift(null);
206
- }
207
- fn.apply(this, opt);
208
- }, callback, optional);
209
- };
210
- this.getCertHashEntries = function (callback) {
211
- var optional = [];
212
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
213
-
214
- this.getHashHandles(function (handles, fn, opt) {
215
- var entries = [];
216
- this.getCertHashEntry(handles.shift(), this._getHashEntrySink, fn, opt, entries, handles);
217
- }, callback, optional);
218
- };
219
- this._getHashEntrySink = function (result, fn, opt, entries, handles) {
220
- entries.push(result);
221
- if (handles.length > 0) {
222
- this.getCertHashEntry(handles.shift(), this._getHashEntrySink, fn, opt, entries, handles);
223
- } else {
224
- opt.unshift(entries);
225
- fn.apply(this, opt);
226
- }
227
- }
228
- this.getLocalSystemAccount = function (callback) {
229
- var optional = [];
230
- for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); }
231
- this.sendCommand(103, Buffer.alloc(40), function (header, fn, opt) {
232
- if (header.Data.length == 68) { opt.unshift({ user: header.Data.slice(0, 34).toString(), pass: header.Data.slice(34, 67).toString(), raw: header.Data }); } else { opt.unshift(null); }
233
- fn.apply(this, opt);
234
- }, callback, optional);
235
- }
236
- this.unprovision = function (mode, callback) {
237
- var optional = [];
238
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
239
- var data = new Buffer(4);
240
- data.writeUInt32LE(mode, 0);
241
- this.sendCommand(16, data, function (header, fn, opt) {
242
- opt.unshift(header.Status);
243
- fn.apply(this, opt);
244
- }, callback, optional);
245
- }
246
- this.startConfiguration = function () {
247
- var optional = [];
248
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
249
- this.sendCommand(0x29, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
250
- }
251
- this.stopConfiguration = function () {
252
- var optional = [];
253
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
254
- this.sendCommand(0x5E, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
255
- }
256
- this.openUserInitiatedConnection = function () {
257
- var optional = [];
258
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
259
- this.sendCommand(0x44, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
260
- }
261
- this.closeUserInitiatedConnection = function () {
262
- var optional = [];
263
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
264
- this.sendCommand(0x45, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional);
265
- }
266
- this.getRemoteAccessConnectionStatus = function () {
267
- var optional = [];
268
- for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); }
269
- this.sendCommand(0x46, data, function (header, fn, opt) {
270
- if (header.Status == 0) {
271
- var hostname = v.slice(14, header.Data.readUInt16LE(12) + 14).toString()
272
- opt.unshift({ status: header.Status, networkStatus: header.Data.readUInt32LE(0), remoteAccessStatus: header.Data.readUInt32LE(4), remoteAccessTrigger: header.Data.readUInt32LE(8), mpsHostname: hostname, raw: header.Data });
273
- } else {
274
- opt.unshift({ status: header.Status });
275
- }
276
- fn.apply(this, opt);
277
- }, callback, optional);
278
- }
279
- this.getProtocolVersion = function (callback) {
280
- var optional = [];
281
- for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); }
282
-
283
- heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) {
284
- if (status == 0) {
285
- var result = buffer.readUInt8(0).toString() + '.' + buffer.readUInt8(1).toString() + '.' + buffer.readUInt8(2).toString() + '.' + buffer.readUInt16BE(3).toString();
286
- opt.unshift(result);
287
- fn.apply(self, opt);
288
- }
289
- else {
290
- opt.unshift(null);
291
- fn.apply(self, opt);
292
- }
293
- }, this, callback, optional);
294
- }
295
-}
296
-
297
-module.exports = amt_heci;
\ No newline at end of file
agents/modules_meshcore/lme_heci.js
deleted
-324
@@ -1,324 +0,0 @@
1
-/*
2
-Copyright 2018 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-var MemoryStream = require('MemoryStream');
18
-var lme_id = 0;
19
-var lme_port_offset = 0; // Debug: Set this to "-100" to bind to 16892 & 16893 and IN_ADDRANY. This is for LMS debugging.
20
-
21
-
22
-var APF_DISCONNECT = 1;
23
-var APF_SERVICE_REQUEST = 5;
24
-var APF_SERVICE_ACCEPT = 6;
25
-var APF_USERAUTH_REQUEST = 50;
26
-var APF_USERAUTH_FAILURE = 51;
27
-var APF_USERAUTH_SUCCESS = 52;
28
-var APF_GLOBAL_REQUEST = 80;
29
-var APF_REQUEST_SUCCESS = 81;
30
-var APF_REQUEST_FAILURE = 82;
31
-var APF_CHANNEL_OPEN = 90;
32
-var APF_CHANNEL_OPEN_CONFIRMATION = 91;
33
-var APF_CHANNEL_OPEN_FAILURE = 92;
34
-var APF_CHANNEL_WINDOW_ADJUST = 93;
35
-var APF_CHANNEL_DATA = 94;
36
-var APF_CHANNEL_CLOSE = 97;
37
-var APF_PROTOCOLVERSION = 192;
38
-
39
-
40
-function lme_object() {
41
- this.ourId = ++lme_id;
42
- this.amtId = -1;
43
- this.LME_CHANNEL_STATUS = 'LME_CS_FREE';
44
- this.txWindow = 0;
45
- this.rxWindow = 0;
46
- this.localPort = 0;
47
- this.errorCount = 0;
48
-}
49
-
50
-function stream_bufferedWrite() {
51
- var emitterUtils = require('events').inherits(this);
52
- this.buffer = [];
53
- this._readCheckImmediate = undefined;
54
-
55
- // Writable Events
56
- emitterUtils.createEvent('close');
57
- emitterUtils.createEvent('drain');
58
- emitterUtils.createEvent('error');
59
- emitterUtils.createEvent('finish');
60
- emitterUtils.createEvent('pipe');
61
- emitterUtils.createEvent('unpipe');
62
-
63
- // Readable Events
64
- emitterUtils.createEvent('readable');
65
- this.isEmpty = function () {
66
- return (this.buffer.length == 0);
67
- };
68
- this.isWaiting = function () {
69
- return (this._readCheckImmediate == undefined);
70
- };
71
- this.write = function (chunk) {
72
- for (var args in arguments) { if (typeof (arguments[args]) == 'function') { this.once('drain', arguments[args]); break; } }
73
- var tmp = Buffer.alloc(chunk.length);
74
- chunk.copy(tmp);
75
- this.buffer.push({ offset: 0, data: tmp });
76
- this.emit('readable');
77
- return (this.buffer.length == 0 ? true : false);
78
- };
79
- this.read = function () {
80
- var size = arguments.length == 0 ? undefined : arguments[0];
81
- var bytesRead = 0;
82
- var list = [];
83
- while ((size == undefined || bytesRead < size) && this.buffer.length > 0) {
84
- var len = this.buffer[0].data.length - this.buffer[0].offset;
85
- var offset = this.buffer[0].offset;
86
-
87
- if (len > (size - bytesRead)) {
88
- // Only reading a subset
89
- list.push(this.buffer[0].data.slice(offset, offset + size - bytesRead));
90
- this.buffer[0].offset += (size - bytesRead);
91
- bytesRead += (size - bytesRead);
92
- } else {
93
- // Reading the entire thing
94
- list.push(this.buffer[0].data.slice(offset));
95
- bytesRead += len;
96
- this.buffer.shift();
97
- }
98
- }
99
- this._readCheckImmediate = setImmediate(function (buffered) {
100
- buffered._readCheckImmediate = undefined;
101
- if (buffered.buffer.length == 0) {
102
- buffered.emit('drain'); // Drained
103
- } else {
104
- buffered.emit('readable'); // Not drained
105
- }
106
- }, this);
107
- return (Buffer.concat(list));
108
- };
109
-}
110
-
111
-
112
-function lme_heci(options) {
113
- var emitterUtils = require('events').inherits(this);
114
- emitterUtils.createEvent('error');
115
- emitterUtils.createEvent('connect');
116
-
117
- if (options.debug == true) { lme_port_offset = -100; } // LMS debug mode
118
-
119
- var heci = require('heci');
120
- this.INITIAL_RXWINDOW_SIZE = 4096;
121
-
122
- this._LME = heci.create();
123
- this._LME.LMS = this;
124
- this._LME.on('error', function (e) { this.LMS.emit('error', e); });
125
- this._LME.on('connect', function () {
126
- this.LMS.emit('connect');
127
- this.on('data', function (chunk) {
128
- // this = HECI
129
- var cmd = chunk.readUInt8(0);
130
-
131
- switch (cmd) {
132
- default:
133
- //console.log('Received ' + chunk.length + ' bytes of data for LMS');
134
- //console.log('Command = ' + cmd);
135
- break;
136
- case APF_SERVICE_REQUEST:
137
- var nameLen = chunk.readUInt32BE(1);
138
- var name = chunk.slice(5, nameLen + 5);
139
- //console.log("Service Request for: " + name);
140
- if (name == 'pfwd@amt.intel.com' || name == 'auth@amt.intel.com') {
141
- var outBuffer = Buffer.alloc(5 + nameLen);
142
- outBuffer.writeUInt8(6, 0);
143
- outBuffer.writeUInt32BE(nameLen, 1);
144
- outBuffer.write(name.toString(), 5);
145
- this.write(outBuffer);
146
- //console.log('Answering APF_SERVICE_REQUEST');
147
- } else {
148
- //console.log('UNKNOWN APF_SERVICE_REQUEST');
149
- }
150
- break;
151
- case APF_GLOBAL_REQUEST:
152
- var nameLen = chunk.readUInt32BE(1);
153
- var name = chunk.slice(5, nameLen + 5).toString();
154
-
155
- switch (name) {
156
- case 'tcpip-forward':
157
- var len = chunk.readUInt32BE(nameLen + 6);
158
- var port = chunk.readUInt32BE(nameLen + 10 + len);
159
- //console.log("[" + chunk.length + "/" + len + "] APF_GLOBAL_REQUEST for: " + name + " on port " + port);
160
- if (this[name] == undefined) {
161
- this[name] = {};
162
- }
163
- this[name][port] = require('net').createServer();
164
- this[name][port].HECI = this;
165
- if (lme_port_offset == 0) {
166
- this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
167
- } else {
168
- this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
169
- }
170
- this[name][port].on('connection', function (socket) {
171
- //console.log('New [' + socket.remoteFamily + '] TCP Connection on: ' + socket.remoteAddress + ' :' + socket.localPort);
172
- this.HECI.LMS.bindDuplexStream(socket, socket.remoteFamily, socket.localPort - lme_port_offset);
173
- });
174
- var outBuffer = Buffer.alloc(5);
175
- outBuffer.writeUInt8(81, 0);
176
- outBuffer.writeUInt32BE(port, 1);
177
- this.write(outBuffer);
178
- break;
179
- case 'cancel-tcpip-forward':
180
- break;
181
- case 'udp-send-to@amt.intel.com':
182
- break;
183
- default:
184
- //console.log("Unknown APF_GLOBAL_REQUEST for: " + name);
185
- break;
186
- }
187
- break;
188
- case APF_CHANNEL_OPEN_CONFIRMATION:
189
- var rChannel = chunk.readUInt32BE(1);
190
- var sChannel = chunk.readUInt32BE(5);
191
- var wSize = chunk.readUInt32BE(9);
192
- //console.log('rChannel/' + rChannel + ', sChannel/' + sChannel + ', wSize/' + wSize);
193
- if (this.sockets[rChannel] != undefined) {
194
- this.sockets[rChannel].lme.amtId = sChannel;
195
- this.sockets[rChannel].lme.rxWindow = wSize;
196
- this.sockets[rChannel].lme.txWindow = wSize;
197
- this.sockets[rChannel].lme.LME_CHANNEL_STATUS = 'LME_CS_CONNECTED';
198
- //console.log('LME_CS_CONNECTED');
199
- this.sockets[rChannel].bufferedStream = new stream_bufferedWrite();
200
- this.sockets[rChannel].bufferedStream.socket = this.sockets[rChannel];
201
- this.sockets[rChannel].bufferedStream.on('readable', function () {
202
- if (this.socket.lme.txWindow > 0) {
203
- var buffer = this.read(this.socket.lme.txWindow);
204
- var packet = Buffer.alloc(9 + buffer.length);
205
- packet.writeUInt8(APF_CHANNEL_DATA, 0);
206
- packet.writeUInt32BE(this.socket.lme.amtId, 1);
207
- packet.writeUInt32BE(buffer.length, 5);
208
- buffer.copy(packet, 9);
209
- this.socket.lme.txWindow -= buffer.length;
210
- this.socket.HECI.write(packet);
211
- }
212
- });
213
- this.sockets[rChannel].bufferedStream.on('drain', function () {
214
- this.socket.resume();
215
- });
216
- this.sockets[rChannel].on('data', function (chunk) {
217
- if (!this.bufferedStream.write(chunk)) { this.pause(); }
218
- });
219
- this.sockets[rChannel].on('end', function () {
220
- var outBuffer = Buffer.alloc(5);
221
- outBuffer.writeUInt8(APF_CHANNEL_CLOSE, 0);
222
- outBuffer.writeUInt32BE(this.lme.amtId, 1);
223
- this.HECI.write(outBuffer);
224
- });
225
- this.sockets[rChannel].resume();
226
- }
227
-
228
- break;
229
- case APF_PROTOCOLVERSION:
230
- var major = chunk.readUInt32BE(1);
231
- var minor = chunk.readUInt32BE(5);
232
- var reason = chunk.readUInt32BE(9);
233
- var outBuffer = Buffer.alloc(93);
234
- outBuffer.writeUInt8(192, 0);
235
- outBuffer.writeUInt32BE(1, 1);
236
- outBuffer.writeUInt32BE(0, 5);
237
- outBuffer.writeUInt32BE(reason, 9);
238
- //console.log('Answering PROTOCOL_VERSION');
239
- this.write(outBuffer);
240
- break;
241
- case APF_CHANNEL_WINDOW_ADJUST:
242
- var rChannelId = chunk.readUInt32BE(1);
243
- var bytesToAdd = chunk.readUInt32BE(5);
244
- if (this.sockets[rChannelId] != undefined) {
245
- this.sockets[rChannelId].lme.txWindow += bytesToAdd;
246
- if (!this.sockets[rChannelId].bufferedStream.isEmpty() && this.sockets[rChannelId].bufferedStream.isWaiting()) {
247
- this.sockets[rChannelId].bufferedStream.emit('readable');
248
- }
249
- } else {
250
- //console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_WINDOW_ADJUST');
251
- }
252
- break;
253
- case APF_CHANNEL_DATA:
254
- var rChannelId = chunk.readUInt32BE(1);
255
- var dataLen = chunk.readUInt32BE(5);
256
- var data = chunk.slice(9, 9 + dataLen);
257
- if (this.sockets[rChannelId] != undefined) {
258
- this.sockets[rChannelId].pendingBytes.push(data.length);
259
- this.sockets[rChannelId].write(data, function () {
260
- var written = this.pendingBytes.shift();
261
- var outBuffer = Buffer.alloc(9);
262
- outBuffer.writeUInt8(APF_CHANNEL_WINDOW_ADJUST, 0);
263
- outBuffer.writeUInt32BE(this.lme.amtId, 1);
264
- outBuffer.writeUInt32BE(written, 5);
265
- this.HECI.write(outBuffer);
266
- });
267
- } else {
268
- //console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_DATA');
269
- }
270
- break;
271
- case APF_CHANNEL_CLOSE:
272
- var rChannelId = chunk.readUInt32BE(1);
273
- if (this.sockets[rChannelId] != undefined) {
274
- this.sockets[rChannelId].end();
275
- var amtId = this.sockets[rChannelId].lme.amtId;
276
- var buffer = Buffer.alloc(5);
277
- delete this.sockets[rChannelId];
278
-
279
- buffer.writeUInt8(APF_CHANNEL_CLOSE, 0);
280
- buffer.writeUInt32BE(amtId, 1);
281
- this.write(buffer);
282
- } else {
283
- //console.log('Unknown Recipient ID/' + rChannelId + ' for APF_CHANNEL_CLOSE');
284
- }
285
- break;
286
- }
287
- });
288
- });
289
-
290
- this.bindDuplexStream = function (duplexStream, remoteFamily, localPort) {
291
- var socket = duplexStream;
292
- //console.log('New [' + remoteFamily + '] Virtual Connection/' + socket.localPort);
293
- socket.pendingBytes = [];
294
- socket.HECI = this._LME;
295
- socket.LMS = this;
296
- socket.lme = new lme_object();
297
- socket.lme.Socket = socket;
298
- var buffer = new MemoryStream();
299
- buffer.writeUInt8(0x5A);
300
- buffer.writeUInt32BE(15);
301
- buffer.write('forwarded-tcpip');
302
- buffer.writeUInt32BE(socket.lme.ourId);
303
- buffer.writeUInt32BE(this.INITIAL_RXWINDOW_SIZE);
304
- buffer.writeUInt32BE(0xFFFFFFFF);
305
- for (var i = 0; i < 2; ++i) {
306
- if (remoteFamily == 'IPv6') {
307
- buffer.writeUInt32BE(3);
308
- buffer.write('::1');
309
- } else {
310
- buffer.writeUInt32BE(9);
311
- buffer.write('127.0.0.1');
312
- }
313
- buffer.writeUInt32BE(localPort);
314
- }
315
- this._LME.write(buffer.buffer);
316
- if (this._LME.sockets == undefined) { this._LME.sockets = {}; }
317
- this._LME.sockets[socket.lme.ourId] = socket;
318
- socket.pause();
319
- };
320
-
321
- this._LME.connect(heci.GUIDS.LME, { noPipeline: 0 });
322
-}
323
-
324
-module.exports = lme_heci;
agents/webapppush.js
deleted
-172
@@ -1,172 +0,0 @@
1
-/*
2
-Copyright 2017 Intel Corporation
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-
18
-// Polyfill String.endsWith
19
-if (!String.prototype.endsWith) {
20
- String.prototype.endsWith = function (searchString, position) {
21
- var subjectString = this.toString();
22
- if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; }
23
- position -= searchString.length;
24
- var lastIndex = subjectString.lastIndexOf(searchString, position);
25
- return lastIndex !== -1 && lastIndex === position;
26
- };
27
-}
28
-
29
-// Replace a string with a number if the string is an exact number
30
-function toNumberIfNumber(x) { if ((typeof x == 'string') && (+parseInt(x) == x)) { x = parseInt(x); } return x; }
31
-
32
-// Convert decimal to hex
33
-function char2hex(i) { return (i + 0x100).toString(16).substr(-2).toUpperCase(); }
34
-
35
-// Convert a raw string to a hex string
36
-function rstr2hex(input) { var r = '', i; for (i = 0; i < input.length; i++) { r += char2hex(input.charCodeAt(i)); } return r; }
37
-
38
-// Convert a buffer into a string
39
-function buf2rstr(buf) { var r = ''; for (var i = 0; i < buf.length; i++) { r += String.fromCharCode(buf[i]); } return r; }
40
-
41
-// Convert a hex string to a raw string // TODO: Do this using Buffer(), will be MUCH faster
42
-function hex2rstr(d) {
43
- if (typeof d != "string" || d.length == 0) return '';
44
- var r = '', m = ('' + d).match(/../g), t;
45
- while (t = m.shift()) r += String.fromCharCode('0x' + t);
46
- return r
47
-}
48
-
49
-// Convert an object to string with all functions
50
-function objToString(x, p, ret) {
51
- if (ret == undefined) ret = '';
52
- if (p == undefined) p = 0;
53
- if (x == null) { return '[null]'; }
54
- if (p > 8) { return '[...]'; }
55
- if (x == undefined) { return '[undefined]'; }
56
- if (typeof x == 'string') { if (p == 0) return x; return '"' + x + '"'; }
57
- if (typeof x == 'buffer') { return '[buffer]'; }
58
- if (typeof x != 'object') { return x; }
59
- var r = '{' + (ret ? '\r\n' : ' ');
60
- for (var i in x) { r += (addPad(p + 2, ret) + i + ': ' + objToString(x[i], p + 2, ret) + (ret ? '\r\n' : ' ')); }
61
- return r + addPad(p, ret) + '}';
62
-}
63
-
64
-// Return p number of spaces
65
-function addPad(p, ret) { var r = ''; for (var i = 0; i < p; i++) { r += ret; } return r; }
66
-
67
-// Split a string taking into account the quoats. Used for command line parsing
68
-function splitArgs(str) {
69
- var myArray = [], myRegexp = /[^\s"]+|"([^"]*)"/gi;
70
- do { var match = myRegexp.exec(str); if (match != null) { myArray.push(match[1] ? match[1] : match[0]); } } while (match != null);
71
- return myArray;
72
-}
73
-
74
-// Parse arguments string array into an object
75
-function parseArgs(argv) {
76
- var results = { '_': [] }, current = null;
77
- for (var i = 1, len = argv.length; i < len; i++) {
78
- var x = argv[i];
79
- if (x.length > 2 && x[0] == '-' && x[1] == '-') {
80
- if (current != null) { results[current] = true; }
81
- current = x.substring(2);
82
- } else {
83
- if (current != null) { results[current] = toNumberIfNumber(x); current = null; } else { results['_'].push(toNumberIfNumber(x)); }
84
- }
85
- }
86
- if (current != null) { results[current] = true; }
87
- return results;
88
-}
89
-
90
-// Parge a URL string into an options object
91
-function parseUrl(url) {
92
- var x = url.split('/');
93
- if (x.length < 4) return null;
94
- var y = x[2].split(':');
95
- var options = {};
96
- var options = { protocol: x[0], hostname: y[0], path: '/' + x.splice(3).join('/') };
97
- if (y.length == 1) { options.port = ((x[0] == 'https:') || (x[0] == 'wss:')) ? 443 : 80; } else { options.port = parseInt(y[1]); }
98
- if (isNaN(options.port) == true) return null;
99
- return options;
100
-}
101
-
102
-// Read a entire file into a buffer
103
-function readFileToBuffer(filePath) {
104
- try {
105
- var fs = require('fs');
106
- var stats = fs.statSync(filePath);
107
- if (stats == null) { return null; }
108
- var fileData = new Buffer(stats.size);
109
- var fd = fs.openSync(filePath, 'r');
110
- fs.readSync(fd, fileData, 0, stats.size, 0);
111
- fs.closeSync(fd);
112
- return fileData;
113
- } catch (e) { return null; }
114
-}
115
-
116
-// Performs an HTTP get on a URL and return the data back
117
-function makeHttpGetRequest(url, func) {
118
- var http = require('http');
119
- var request = http.get(url, function (res) {
120
- var htmlData = '';
121
- res.on('data', function (d) { htmlData += d; });
122
- res.on('end', function (d) { func(res.statusCode, htmlData); });
123
- }).on('error', function (e) { func(0, null); });
124
-}
125
-
126
-// Performs an HTTP get on a URL and return the data back (Alternative implementation)
127
-function makeHttpGetRequest2(url, func) {
128
- var http = require('http');
129
- var options = http.parseUri(url);
130
- options.username = 'admin';
131
- options.password = 'P@ssw0rd';
132
- var request = http.request(options, function (res) {
133
- var htmlData = '';
134
- res.on('data', function (d) { htmlData += d; });
135
- res.on('end', function () { func(res.statusCode, htmlData); });
136
- });
137
- request.on('error', function (e) { func(0, null); });
138
- request.end();
139
-}
140
-
141
-// Performs an HTTP get on a URL and return the data back (Alternative implementation)
142
-function intelAmtSetStorage(url, buffer, func) {
143
- var http = require('http');
144
- var options = http.parseUri(url);
145
- options.user = 'admin'; // TODO: Does not support HTTP digest auth yet!!!!!!!!!!!!!!!!
146
- options.pass = 'P@ssw0rd';
147
- var request = http.request(options, function (res) {
148
- var htmlData = '';
149
- res.on('data', function (d) { htmlData += d; });
150
- res.on('end', function () { func(res.statusCode, htmlData); });
151
- });
152
- request.on('error', function (e) { func(0, null); });
153
- request.end();
154
-}
155
-
156
-//console.log(objToString(db2, 2, ' '));
157
-
158
-console.log('--- Start ---');
159
-
160
-var fileData = readFileToBuffer('MeshCommander-Small.gz');
161
-if (fileData != null) {
162
- makeHttpGetRequest2('http://192.168.2.105:16992/index.htm', function (status, htmlData) { console.log(status, htmlData); });
163
-
164
- /*
165
- intelAmtSetStorage('http://192.168.2.105:16992/amt-storage/index.htm', fileData, function (status, htmlData) {
166
- console.log('intelAmtSetStorage', status, htmlData);
167
- });
168
- */
169
-}
170
-
171
-console.log('--- End ---');
172
-//process.exit(2);
\ No newline at end of file
agents/xmodules/WifiScanner.js
deleted
-266
@@ -1,266 +0,0 @@
1
-var MemoryStream = require('MemoryStream');
2
-var WindowsWireless = new Buffer([
3
-0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x77, 0x6C, 0x61, 0x6E,
4
-0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
5
-0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45,
6
-0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x77, 0x6C,
7
-0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20,
8
-0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20,
9
-0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x77, 0x6C, 0x61, 0x6E, 0x49, 0x6E, 0x74, 0x65,
10
-0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20,
11
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32,
12
-0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x3B, 0x0A, 0x20,
13
-0x20, 0x20, 0x20, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x20, 0x28, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61,
14
-0x6C, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x30, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
15
-0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x4E, 0x4F, 0x54, 0x20, 0x52, 0x45, 0x41, 0x44, 0x59, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
16
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x31, 0x3A, 0x0A, 0x20, 0x20,
17
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A,
18
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20,
19
-0x32, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x44, 0x2D, 0x48, 0x4F, 0x43, 0x22,
20
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73,
21
-0x65, 0x20, 0x33, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F,
22
-0x4E, 0x4E, 0x45, 0x43, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
23
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x34, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65,
24
-0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62,
25
-0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x35, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
26
-0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x53, 0x53, 0x4F, 0x43, 0x49, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
27
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65, 0x20, 0x36, 0x3A, 0x0A, 0x20, 0x20, 0x20,
28
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x44, 0x49, 0x53, 0x43, 0x4F, 0x56, 0x45, 0x52, 0x49, 0x4E, 0x47, 0x22, 0x3B,
29
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x63, 0x61, 0x73, 0x65,
30
-0x20, 0x37, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x22, 0x41, 0x55, 0x54, 0x48, 0x45, 0x4E,
31
-0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4E, 0x47, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B, 0x3B, 0x0A, 0x20, 0x20,
32
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74,
33
-0x65, 0x20, 0x3D, 0x20, 0x22, 0x55, 0x4E, 0x4B, 0x4E, 0x4F, 0x57, 0x4E, 0x22, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x62, 0x72, 0x65, 0x61, 0x6B,
34
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65,
35
-0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E,
36
-0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20,
37
-0x30, 0x2C, 0x20, 0x30, 0x29, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E,
38
-0x20, 0x28, 0x74, 0x72, 0x75, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6C, 0x73, 0x65, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20,
39
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x66, 0x61, 0x6C, 0x73, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66,
40
-0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69,
41
-0x64, 0x2C, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x5F, 0x6C, 0x71, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
42
-0x20, 0x5F, 0x73, 0x73, 0x69, 0x64, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x5F, 0x62, 0x73, 0x73, 0x69, 0x64, 0x3B,
43
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x5F, 0x72, 0x73, 0x73, 0x69, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
44
-0x2E, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x5F, 0x6C, 0x71, 0x3B, 0x0A, 0x7D, 0x0A, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x2E, 0x70, 0x72, 0x6F, 0x74, 0x6F, 0x74, 0x79,
45
-0x70, 0x65, 0x2E, 0x74, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72,
46
-0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x20, 0x5B, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x62,
47
-0x73, 0x73, 0x69, 0x64, 0x20, 0x2B, 0x20, 0x22, 0x5D, 0x3A, 0x20, 0x22, 0x20, 0x2B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x6C, 0x71, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63,
48
-0x74, 0x69, 0x6F, 0x6E, 0x20, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x29, 0x0A,
49
-0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x4E,
50
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
51
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69,
52
-0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20,
53
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x44, 0x61, 0x74,
54
-0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
55
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x26, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x38, 0x29, 0x20, 0x26, 0x26, 0x20, 0x28, 0x4E,
56
-0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x3D, 0x3D, 0x20, 0x37, 0x29, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20,
57
-0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68,
58
-0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20,
59
-0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x47, 0x65, 0x74, 0x42,
60
-0x53, 0x53, 0x4C, 0x69, 0x73, 0x74, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x47,
61
-0x75, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x33, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69,
62
-0x66, 0x20, 0x28, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
63
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x74, 0x61, 0x6C, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
64
-0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76,
65
-0x61, 0x72, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x20, 0x3D, 0x20, 0x62, 0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28,
66
-0x34, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x28, 0x69, 0x20, 0x3D, 0x20,
67
-0x30, 0x3B, 0x20, 0x69, 0x20, 0x3C, 0x20, 0x6E, 0x75, 0x6D, 0x49, 0x74, 0x65, 0x6D, 0x73, 0x3B, 0x20, 0x2B, 0x2B, 0x69, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
68
-0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x20, 0x3D, 0x20, 0x62,
69
-0x73, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x20, 0x2B, 0x20, 0x28, 0x33, 0x36, 0x30, 0x20, 0x2A, 0x20, 0x69, 0x29, 0x2C, 0x20,
70
-0x33, 0x36, 0x30, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D,
71
-0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x2C, 0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x2E, 0x74, 0x72, 0x69, 0x6D, 0x28, 0x29,
72
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x74,
73
-0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x34, 0x30, 0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x32, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
74
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x73, 0x73, 0x69, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65,
75
-0x66, 0x28, 0x35, 0x36, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61,
76
-0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x69, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x36, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20,
77
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x65, 0x6D, 0x69, 0x74, 0x28,
78
-0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x2C, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x62, 0x73,
79
-0x73, 0x69, 0x64, 0x2C, 0x20, 0x72, 0x73, 0x73, 0x69, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20,
80
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x7D, 0x0A, 0x0A, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x57, 0x69, 0x72, 0x65,
81
-0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x0A, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x20, 0x3D, 0x20,
82
-0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x27, 0x29, 0x2E, 0x69, 0x6E, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29,
83
-0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x5F,
84
-0x47, 0x65, 0x6E, 0x65, 0x72, 0x69, 0x63, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x27, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76,
85
-0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x72, 0x6F,
86
-0x78, 0x79, 0x28, 0x22, 0x77, 0x6C, 0x61, 0x6E, 0x61, 0x70, 0x69, 0x2E, 0x64, 0x6C, 0x6C, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
87
-0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x22,
88
-0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28,
89
-0x22, 0x57, 0x6C, 0x61, 0x6E, 0x47, 0x65, 0x74, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x42, 0x73, 0x73, 0x4C, 0x69, 0x73, 0x74, 0x22, 0x2C, 0x20, 0x22, 0x47, 0x65, 0x74, 0x42, 0x53, 0x53,
90
-0x4C, 0x69, 0x73, 0x74, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65,
91
-0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x22, 0x29,
92
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22,
93
-0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E,
94
-0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C, 0x61, 0x6E, 0x53, 0x63, 0x61, 0x6E, 0x22, 0x29, 0x3B, 0x0A,
95
-0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x22, 0x57, 0x6C,
96
-0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x6E, 0x65, 0x67,
97
-0x6F, 0x74, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69,
98
-0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x68, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C,
99
-0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69,
100
-0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x4F, 0x70, 0x65, 0x6E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x28, 0x32, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6E, 0x65, 0x67, 0x6F, 0x74, 0x69, 0x61, 0x74,
101
-0x65, 0x64, 0x2C, 0x20, 0x68, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x20, 0x3D, 0x20, 0x68, 0x2E, 0x56, 0x61, 0x6C, 0x3B,
102
-0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x20,
103
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x50, 0x72, 0x6F,
104
-0x78, 0x79, 0x28, 0x4F, 0x6E, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x79, 0x2C, 0x20, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46,
105
-0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x50, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x3B, 0x0A, 0x20, 0x20,
106
-0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E,
107
-0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6C, 0x74, 0x20,
108
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4E, 0x6F, 0x74, 0x69, 0x66, 0x69,
109
-0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x58, 0x30, 0x30, 0x30, 0x30, 0x46, 0x46, 0x46, 0x46, 0x2C, 0x20,
110
-0x30, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54, 0x2E, 0x43, 0x61, 0x6C,
111
-0x6C, 0x62, 0x61, 0x63, 0x6B, 0x2C, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x5F, 0x4E, 0x4F, 0x54, 0x49, 0x46, 0x59, 0x5F, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x5F, 0x4F, 0x42, 0x4A, 0x45, 0x43, 0x54,
112
-0x2E, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x50, 0x72, 0x65, 0x76, 0x53, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x65, 0x6D, 0x69,
113
-0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6E, 0x74, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27, 0x29, 0x3B, 0x0A, 0x20,
114
-0x20, 0x20, 0x20, 0x65, 0x6D, 0x69, 0x74, 0x74, 0x65, 0x72, 0x55, 0x74, 0x69, 0x6C, 0x73, 0x2E, 0x61, 0x64, 0x64, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x28, 0x27, 0x53, 0x63, 0x61, 0x6E, 0x27,
115
-0x2C, 0x20, 0x5F, 0x53, 0x63, 0x61, 0x6E, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x47, 0x65, 0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64,
116
-0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x20, 0x3D, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20,
117
-0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61,
118
-0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x69, 0x73,
119
-0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x45, 0x6E, 0x75, 0x6D, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x28, 0x74, 0x68, 0x69, 0x73, 0x2E,
120
-0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
121
-0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E,
122
-0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x30, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
123
-0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44,
124
-0x65, 0x72, 0x65, 0x66, 0x28, 0x38, 0x2C, 0x20, 0x35, 0x33, 0x32, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6E, 0x61, 0x6D, 0x65, 0x20,
125
-0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x31, 0x36, 0x2C, 0x20, 0x35, 0x31, 0x32, 0x29, 0x2E, 0x41, 0x6E, 0x73, 0x69, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67,
126
-0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65,
127
-0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x28, 0x69, 0x6E,
128
-0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x38, 0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x31, 0x29, 0x20, 0x2F, 0x2F,
129
-0x20, 0x43, 0x4F, 0x4E, 0x4E, 0x45, 0x43, 0x54, 0x45, 0x44, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
130
-0x20, 0x76, 0x61, 0x72, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53, 0x69, 0x7A, 0x65, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65,
131
-0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x70, 0x44,
132
-0x61, 0x74, 0x61, 0x20, 0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72,
133
-0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x20, 0x3D, 0x20,
134
-0x74, 0x68, 0x69, 0x73, 0x2E, 0x4D, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6C, 0x2E, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x28, 0x29, 0x3B, 0x0A, 0x20, 0x20,
135
-0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x69, 0x6E, 0x66, 0x6F, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66,
136
-0x28, 0x30, 0x2C, 0x20, 0x31, 0x36, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20,
137
-0x3D, 0x20, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x4E, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2E, 0x57, 0x6C, 0x61, 0x6E, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
138
-0x28, 0x74, 0x68, 0x69, 0x73, 0x2E, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x2C, 0x20, 0x69, 0x67, 0x75, 0x69, 0x64, 0x2C, 0x20, 0x37, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x53,
139
-0x69, 0x7A, 0x65, 0x2C, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2C, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
140
-0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x72, 0x65, 0x74, 0x56, 0x61, 0x6C, 0x20, 0x3D, 0x3D, 0x20, 0x30, 0x29, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
141
-0x20, 0x7B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72, 0x20, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65,
142
-0x64, 0x53, 0x53, 0x49, 0x44, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x32, 0x34, 0x2C,
143
-0x20, 0x33, 0x32, 0x29, 0x2E, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x72,
144
-0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x36, 0x30,
145
-0x2C, 0x20, 0x36, 0x29, 0x2E, 0x48, 0x65, 0x78, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
146
-0x76, 0x61, 0x72, 0x20, 0x6C, 0x71, 0x20, 0x3D, 0x20, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x29, 0x2E, 0x44, 0x65, 0x72, 0x65, 0x66, 0x28, 0x35, 0x37, 0x36,
147
-0x2C, 0x20, 0x34, 0x29, 0x2E, 0x49, 0x6E, 0x74, 0x56, 0x61, 0x6C, 0x3B, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65,
148
-0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x6E, 0x65, 0x77, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6F, 0x69, 0x6E, 0x74, 0x28, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64,
149
-0x53, 0x53, 0x49, 0x44, 0x2C, 0x20, 0x62, 0x73, 0x73, 0x69, 0x64, 0x2C, 0x20, 0x30, 0x2C, 0x20, 0x6C, 0x71, 0x29, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
150
-0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x7D, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x74, 0x68, 0x72, 0x6F, 0x77, 0x20, 0x28, 0x22, 0x47, 0x65,
151
-0x74, 0x43, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x65, 0x64, 0x4E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x73, 0x3A, 0x20, 0x46, 0x41, 0x49, 0x4C, 0x45, 0x44, 0x20, 0x28, 0x6E, 0x6F, 0x74, 0x20,
152
-0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x61, 0x20, 0x6E, 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x29, 0x22, 0x29, 0x3B, 0x0A, 0x20, 0x20, 0x20, 0x20,
153
-0x7D, 0x3B, 0x0A, 0x0A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x3B, 0x0A, 0x7D, 0x0A, 0x0A, 0x6D, 0x6F, 0x64, 0x75, 0x6C,
154
-0x65, 0x2E, 0x65, 0x78, 0x70, 0x6F, 0x72, 0x74, 0x73, 0x20, 0x3D, 0x20, 0x6E, 0x65, 0x77, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x28, 0x29, 0x3B, 0x0A]);
155
-
156
-
157
-
158
-var WindowsChildScript = new Buffer([
159
-0x76, 0x61, 0x72, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x28, 0x27, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6F, 0x6E, 0x74,
160
-0x61, 0x69, 0x6E, 0x65, 0x72, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x76, 0x61, 0x72, 0x20, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x20, 0x3D, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
161
-0x28, 0x27, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x27, 0x29, 0x3B, 0x0D, 0x0A, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x6F, 0x6E, 0x28, 0x27, 0x53, 0x63,
162
-0x61, 0x6E, 0x27, 0x2C, 0x20, 0x66, 0x75, 0x6E, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x28, 0x61, 0x70, 0x29, 0x20, 0x7B, 0x20, 0x70, 0x61, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x73, 0x65, 0x6E, 0x64,
163
-0x28, 0x61, 0x70, 0x29, 0x3B, 0x20, 0x7D, 0x29, 0x3B, 0x0D, 0x0A, 0x57, 0x69, 0x72, 0x65, 0x6C, 0x65, 0x73, 0x73, 0x2E, 0x53, 0x63, 0x61, 0x6E, 0x28, 0x29, 0x3B, 0x0D, 0x0A]);
164
-
165
-
166
-function AccessPoint(_ssid, _bssid, _lq)
167
-{
168
- this.ssid = _ssid;
169
- this.bssid = _bssid;
170
- this.lq = _lq;
171
-}
172
-AccessPoint.prototype.toString = function ()
173
-{
174
- return (this.ssid + " [" + this.bssid + "]: " + this.lq);
175
-}
176
-
177
-function WiFiScanner()
178
-{
179
- var emitterUtils = require('events').inherits(this);
180
- emitterUtils.createEvent('accessPoint');
181
-
182
- this.hasWireless = function ()
183
- {
184
- var retVal = false;
185
- var interfaces = require('os').networkInterfaces();
186
- for (var name in interfaces)
187
- {
188
- if (interfaces[name][0].type == 'wireless') { retVal = true; break; }
189
- }
190
- return (retVal);
191
- };
192
-
193
- this.Scan = function ()
194
- {
195
- if (process.platform == 'win32')
196
- {
197
- this.master = require('ScriptContainer').Create(15, ContainerPermissions.DEFAULT);
198
- this.master.parent = this;
199
- this.master.on('data', function (j) { this.parent.emit('accessPoint', new AccessPoint(j.ssid, j.bssid, j.lq)); });
200
-
201
- this.master.addModule('Wireless', WindowsWireless.toString());
202
- this.master.ExecuteString(WindowsChildScript.toString());
203
- }
204
- else if (process.platform == 'linux')
205
- {
206
- // Need to get the wireless interface name
207
- var interfaces = require('os').networkInterfaces();
208
- var wlan = null;
209
- for (var i in interfaces)
210
- {
211
- if (interfaces[i][0].type == 'wireless')
212
- {
213
- wlan = i;
214
- break;
215
- }
216
- }
217
- if (wlan != null)
218
- {
219
- this.child = require('ILibProcessPipe').CreateProcess("/sbin/iwlist", "iwlist", wlan, "scan");
220
- this.child.parent = this;
221
- this.child.ms = new MemoryStream();
222
- this.child.ms.parent = this.child;
223
- this.child.on('data', function (buffer) { this.ms.write(buffer); });
224
- this.child.on('end', function () { this.ms.end(); });
225
- this.child.ms.on('end', function ()
226
- {
227
- var str = this.buffer.toString();
228
- tokens = str.split(' - Address: ');
229
- for (var block in tokens)
230
- {
231
- if (block == 0) continue;
232
- var ln = tokens[block].split('\n');
233
- var _bssid = ln[0];
234
- var _lq;
235
- var _ssid;
236
-
237
- for (var lnblock in ln)
238
- {
239
- lnblock = ln[lnblock].trim();
240
- lnblock = lnblock.trim();
241
- if (lnblock.startsWith('ESSID:'))
242
- {
243
- _ssid = lnblock.slice(7, lnblock.length - 1);
244
- if (_ssid == '<hidden>') { _ssid = ''; }
245
- }
246
- if (lnblock.startsWith('Signal level='))
247
- {
248
- _lq = lnblock.slice(13,lnblock.length-4);
249
- }
250
- }
251
- this.parent.parent.emit('accessPoint', new AccessPoint(_ssid, _bssid, _lq));
252
- }
253
- });
254
- }
255
- }
256
- }
257
-}
258
-
259
-module.exports = WiFiScanner;
260
-
261
-
262
-
263
-
264
-
265
-
266
-
exeHandler.js
+11
-19
@@ -97,45 +97,37 @@ module.exports.streamExeWithMeshPolicy = function (options) {
97
// Pipe the entire source binary without ending the stream.
98
options.destinationStream.sourceStream.pipe(options.destinationStream, { end: false });
99
} else if (options.platform == 'win32' && options.peinfo.CertificateTableAddress != 0) {
100
- // This is a signed windows binary, so we need to do some magic
101
- options.mshPadding = (8 - ((options.peinfo.certificateDwLength + options.msh.length + 20) % 8)) % 8; // Compute the padding with quad-align
102
-
103
- //console.log('old table size = ' + options.peinfo.CertificateTableSize);
104
- options.peinfo.CertificateTableSize += (options.msh.length + 20 + options.mshPadding); // Add to the certificate table size
105
- //console.log('new table size = ' + options.peinfo.CertificateTableSize);
106
- //console.log('old certificate dwLength = ' + options.peinfo.certificateDwLength);
107
- options.peinfo.certificateDwLength += (options.msh.length + 20 + options.mshPadding); // Add to the certificate size
108
- //console.log('new certificate dwLength = ' + options.peinfo.certificateDwLength);
109
- //console.log('values were padded with ' + options.mshPadding + ' bytes');
110
-
100
// Read up to the certificate table size and stream that out
101
options.destinationStream.sourceStream = require('fs').createReadStream(options.sourceFileName, { flags: 'r', start: 0, end: options.peinfo.CertificateTableSizePos - 1 });
102
+ options.destinationStream.sourceStream.mshPadding = (8 - ((options.peinfo.certificateDwLength + options.msh.length + 20) % 8)) % 8; // Compute the padding with quad-align
103
+ options.destinationStream.sourceStream.CertificateTableSize = (options.peinfo.CertificateTableSize + options.msh.length + 20 + options.destinationStream.sourceStream.mshPadding); // Add to the certificate table size
104
+ options.destinationStream.sourceStream.certificateDwLength = (options.peinfo.certificateDwLength + options.msh.length + 20 + options.destinationStream.sourceStream.mshPadding); // Add to the certificate size
105
options.destinationStream.sourceStream.options = options;
106
+
107
options.destinationStream.sourceStream.on('end', function () {
108
// We sent up to the CertificateTableSize, now we need to send the updated certificate table size
116
- //console.log('read first block');
109
var sz = Buffer.alloc(4);
118
- sz.writeUInt32LE(this.options.peinfo.CertificateTableSize, 0);
110
+ sz.writeUInt32LE(this.CertificateTableSize, 0);
111
this.options.destinationStream.write(sz); // New cert table size
112
113
// Stream everything up to the start of the certificate table entry
114
var source2 = require('fs').createReadStream(options.sourceFileName, { flags: 'r', start: this.options.peinfo.CertificateTableSizePos + 4, end: this.options.peinfo.CertificateTableAddress - 1 });
115
source2.options = this.options;
116
+ source2.mshPadding = this.mshPadding;
117
+ source2.certificateDwLength = this.certificateDwLength;
118
source2.on('end', function () {
119
// We've sent up to the Certificate DWLength, which we need to update
126
- //console.log('read second block');
120
var sz = Buffer.alloc(4);
128
- sz.writeUInt32LE(this.options.peinfo.certificateDwLength, 0);
121
+ sz.writeUInt32LE(this.certificateDwLength, 0);
122
this.options.destinationStream.write(sz); // New certificate length
123
124
// Stream the entire binary until the end
125
var source3 = require('fs').createReadStream(options.sourceFileName, { flags: 'r', start: this.options.peinfo.CertificateTableAddress + 4 });
126
source3.options = this.options;
127
+ source3.mshPadding = this.mshPadding;
128
source3.on('end', function () {
129
// We've sent the entire binary... Now send: Padding + MSH + MSHLength + GUID
136
- //console.log('read third block');
137
- if (this.options.mshPadding > 0) { this.options.destinationStream.write(Buffer.alloc(this.options.mshPadding)); } // Padding
138
-
130
+ if (this.mshPadding > 0) { this.options.destinationStream.write(Buffer.alloc(this.mshPadding)); } // Padding
131
this.options.destinationStream.write(this.options.msh); // MSH content
132
var sz = Buffer.alloc(4);
133
sz.writeUInt32BE(this.options.msh.length, 0);
@@ -148,7 +140,7 @@ module.exports.streamExeWithMeshPolicy = function (options) {
140
source2.pipe(this.options.destinationStream, { end: false });
141
this.options.destinationStream.sourceStream = source2;
142
});
151
- this.options.destinationStream.sourceStream.pipe(this.options.destinationStream, { end: false });
143
+ options.destinationStream.sourceStream.pipe(options.destinationStream, { end: false });
144
}
145
}
146
meshcentral.js
+9
-6
@@ -79,7 +79,7 @@ function CreateMeshCentralServer(config) {
79
try { require('./pass').hash('test', function () { }); } catch (e) { console.log('Old version of node, must upgrade.'); return; } // TODO: Not sure if this test works or not.
80
81
// Check for invalid arguments
82
- var validArguments = ['_', 'notls', 'user', 'port', 'mpsport', 'mpsaliasport', 'redirport', 'cert', 'mpscert', 'deletedomain', 'deletedefaultdomain', 'showall', 'showusers', 'shownodes', 'showmeshes', 'showevents', 'showpower', 'clearpower', 'showiplocations', 'help', 'exactports', 'install', 'uninstall', 'start', 'stop', 'restart', 'debug', 'filespath', 'datapath', 'noagentupdate', 'launch', 'noserverbackup', 'mongodb', 'mongodbcol', 'wanonly', 'lanonly', 'nousers', 'mpsdebug', 'mpspass', 'ciralocalfqdn', 'dbexport', 'dbimport', 'selfupdate', 'tlsoffload', 'userallowedip', 'fastcert', 'swarmport', 'swarmdebug', 'logintoken', 'logintokenkey', 'logintokengen', 'logintokengen', 'mailtokengen'];
82
+ var validArguments = ['_', 'notls', 'user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'cert', 'mpscert', 'deletedomain', 'deletedefaultdomain', 'showall', 'showusers', 'shownodes', 'showmeshes', 'showevents', 'showpower', 'clearpower', 'showiplocations', 'help', 'exactports', 'install', 'uninstall', 'start', 'stop', 'restart', 'debug', 'filespath', 'datapath', 'noagentupdate', 'launch', 'noserverbackup', 'mongodb', 'mongodbcol', 'wanonly', 'lanonly', 'nousers', 'mpsdebug', 'mpspass', 'ciralocalfqdn', 'dbexport', 'dbimport', 'selfupdate', 'tlsoffload', 'userallowedip', 'fastcert', 'swarmport', 'swarmdebug', 'logintoken', 'logintokenkey', 'logintokengen', 'logintokengen', 'mailtokengen'];
83
for (var arg in obj.args) { obj.args[arg.toLocaleLowerCase()] = obj.args[arg]; if (validArguments.indexOf(arg.toLocaleLowerCase()) == -1) { console.log('Invalid argument "' + arg + '", use --help.'); return; } }
84
if (obj.args.mongodb == true) { console.log('Must specify: --mongodb [connectionstring] \r\nSee https://docs.mongodb.com/manual/reference/connection-string/ for MongoDB connection string.'); return; }
85
for (var i in obj.config.settings) { obj.args[i] = obj.config.settings[i]; } // Place all settings into arguments, arguments have already been placed into settings so arguments take precedence.
@@ -106,7 +106,7 @@ function CreateMeshCentralServer(config) {
106
107
// Check if we need to install, start, stop, remove ourself as a background service
108
if ((obj.service != null) && ((obj.args.install == true) || (obj.args.uninstall == true) || (obj.args.start == true) || (obj.args.stop == true) || (obj.args.restart == true))) {
109
- var env = [], xenv = ['user', 'port', 'mpsport', 'mpsaliasport', 'redirport', 'exactport', 'debug'];
109
+ var env = [], xenv = ['user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'exactport', 'debug'];
110
for (var i in xenv) { if (obj.args[xenv[i]] != null) { env.push({ name: 'mesh' + xenv[i], value: obj.args[xenv[i]] }); } } // Set some args as service environement variables.
111
var svc = new obj.service({ name: 'MeshCentral', description: 'MeshCentral Remote Management Server', script: obj.path.join(__dirname, 'meshcentral.js'), env: env, wait: 2, grow: .5 });
112
svc.on('install', function () { console.log('MeshCentral service installed.'); svc.start(); });
@@ -224,6 +224,7 @@ function CreateMeshCentralServer(config) {
224
if ((obj.args.ciralocalfqdn != null) && ((obj.args.lanonly == true) || (obj.args.wanonly == true))) { console.log("WARNING: CIRA local FQDN's ignored when server in LAN-only or WAN-only mode."); }
225
if ((obj.args.ciralocalfqdn != null) && (obj.args.ciralocalfqdn.split(',').length > 4)) { console.log("WARNING: Can't have more than 4 CIRA local FQDN's. Ignoring value."); obj.args.ciralocalfqdn = null; }
226
if (obj.args.port == null || typeof obj.args.port != 'number') { if (obj.args.notls == null) { obj.args.port = 443; } else { obj.args.port = 80; } }
227
+ if (obj.args.aliasport != null && (typeof obj.args.aliasport != 'number')) obj.args.aliasport = null;
228
if (obj.args.mpsport == null || typeof obj.args.mpsport != 'number') obj.args.mpsport = 4433;
229
if (obj.args.mpsaliasport != null && (typeof obj.args.mpsaliasport != 'number')) obj.args.mpsaliasport = null;
230
if (obj.args.notls == null && obj.args.redirport == null) obj.args.redirport = 80;
@@ -848,8 +849,8 @@ function CreateMeshCentralServer(config) {
849
0: { id: 0, localname: 'Unknown', rname: 'meshconsole.exe', desc: 'Unknown agent', update: false, amt: true, platform: 'unknown' },
850
1: { id: 1, localname: 'MeshConsole.exe', rname: 'meshconsole.exe', desc: 'Windows x86-32 console', update: true, amt: true, platform: 'win32' },
851
2: { id: 2, localname: 'MeshConsole64.exe', rname: 'meshconsole.exe', desc: 'Windows x86-64 console', update: true, amt: true, platform: 'win32' },
851
- 3: { id: 3, localname: 'MeshService.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' },
852
- 4: { id: 4, localname: 'MeshService64.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' },
852
+ 3: { id: 3, localname: 'MeshService-signed.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' },
853
+ 4: { id: 4, localname: 'MeshService64-signed.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' },
854
5: { id: 5, localname: 'meshagent_x86', rname: 'meshagent', desc: 'Linux x86-32', update: true, amt: true, platform: 'linux' },
855
6: { id: 6, localname: 'meshagent_x86-64', rname: 'meshagent', desc: 'Linux x86-64', update: true, amt: true, platform: 'linux' },
856
7: { id: 7, localname: 'meshagent_mips', rname: 'meshagent', desc: 'Linux MIPS', update: true, amt: false, platform: 'linux' },
@@ -870,7 +871,9 @@ function CreateMeshCentralServer(config) {
871
22: { id: 22, localname: 'MeshAgent-WinMinCore-Service-x86-64.exe', rname: 'meshagent.exe', desc: 'Windows MinCore Service x86-32', update: true, amt: false, platform: 'win32' },
872
23: { id: 23, localname: 'MeshAgent-NodeJS', rname: 'meshagent', desc: 'NodeJS', update: false, amt: false, platform: 'node' }, // Get this one from NPM
873
24: { id: 24, localname: 'meshagent_arm-linaro', rname: 'meshagent', desc: 'Linux ARM Linaro', update: true, amt: false, platform: 'linux' },
873
- 25: { id: 25, localname: 'meshagent_pi', rname: 'meshagent', desc: 'Linux ARM - Raspberry Pi', update: true, amt: false, platform: 'linux' } // "armv6l" and "armv7l"
874
+ 25: { id: 25, localname: 'meshagent_pi', rname: 'meshagent', desc: 'Linux ARM - Raspberry Pi', update: true, amt: false, platform: 'linux' }, // "armv6l" and "armv7l"
875
+ 10003: { id: 3, localname: 'MeshService.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' }, // Unsigned version of the MeshAgent
876
+ 10004: { id: 4, localname: 'MeshService64.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' } // Unsigned version of the MeshAgent
877
};
878
879
// Update the list of available mesh agents
@@ -1091,7 +1094,7 @@ InstallModules(['minimist'], function () {
1094
if (config == null) { process.exit(); }
1095
1096
// Build the list of required modules
1094
- var modules = ['ws', 'nedb', 'https', 'unzip', 'xmldom', 'express', 'mongojs', 'archiver', 'multiparty', 'node-forge', 'express-ws', 'compression', 'body-parser', 'connect-redis', 'express-session', 'express-handlebars'];
1097
+ var modules = ['ws', 'nedb', 'https', 'unzip', 'xmldom', 'express', 'archiver', 'multiparty', 'node-forge', 'express-ws', 'compression', 'body-parser', 'connect-redis', 'express-session', 'express-handlebars'];
1098
if (require('os').platform() == 'win32') { modules.push('node-sspi'); modules.push('node-windows'); } // Add Windows modules
1099
if (config.letsencrypt != null) { modules.push('greenlock'); modules.push('le-store-certbot'); modules.push('le-challenge-fs'); modules.push('le-acme-core'); } // Add Greenlock Modules
1100
if (config.settings.mongodb != null) { modules.push('mongojs'); } // Add MongoDB
meshuser.js
+2
-1
@@ -928,9 +928,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
928
929
// Figure out the MPS port, use the alias if set
930
var mpsport = ((obj.args.mpsaliasport != null) ? obj.args.mpsaliasport : obj.args.mpsport);
931
+ var httpport = ((obj.args.aliasport != null) ? obj.args.aliasport : obj.args.port);
932
933
// Build server information object
933
- var serverinfo = { name: obj.parent.certificates.CommonName, mpsname: obj.parent.certificates.AmtMpsName, mpsport: mpsport, mpspass: obj.args.mpspass, port: obj.args.port, emailcheck: obj.parent.parent.mailserver != null }
934
+ var serverinfo = { name: obj.parent.certificates.CommonName, mpsname: obj.parent.certificates.AmtMpsName, mpsport: mpsport, mpspass: obj.args.mpspass, port: httpport, emailcheck: obj.parent.parent.mailserver != null }
935
if (obj.args.notls != true) { serverinfo.https = false; } else { serverinfo.https = true; serverinfo.redirport = obj.args.redirport; }
936
937
// Send server information
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.1.4-s",
3
+ "version": "0.1.4-v",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.application
deleted
-21
@@ -1,21 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
3
- <assemblyIdentity name="MeshMiniRouter.application" version="2.0.0.7" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
4
- <description asmv2:publisher="Meshcentral.com" asmv2:product="Meshcentral Mini-Router" asmv2:supportUrl="https://meshcentral.com/" xmlns="urn:schemas-microsoft-com:asm.v1" />
5
- <deployment install="false" mapFileExtensions="true" trustURLParameters="true" />
6
- <compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
7
- <framework targetVersion="4.5" profile="Full" supportedRuntime="4.0.30319" />
8
- </compatibleFrameworks>
9
- <dependency>
10
- <dependentAssembly dependencyType="install" codebase="Application Files\MeshMiniRouter_2_0_0_7\MeshMiniRouter.exe.manifest" size="4711">
11
- <assemblyIdentity name="MeshMiniRouter.exe" version="2.0.0.7" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
12
- <hash>
13
- <dsig:Transforms>
14
- <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
15
- </dsig:Transforms>
16
- <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
17
- <dsig:DigestValue>VsPkLYR71TSqI8oGBBeXzb5hGi4R2xtQaGQJ0zmsTic=</dsig:DigestValue>
18
- </hash>
19
- </dependentAssembly>
20
- </dependency>
21
-</asmv1:assembly>
\ No newline at end of file
public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.exe.config.deploy
deleted
-42
@@ -1,42 +0,0 @@
1
-<?xml version="1.0"?>
2
-<configuration>
3
- <configSections>
4
- <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
5
- <section name="MeshMiniRouterTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
6
- <section name="MeshMiniRouterTool.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
7
- <section name="MeshNetworkRouterTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
8
- </sectionGroup>
9
- </configSections>
10
- <userSettings>
11
- <MeshMiniRouterTool.Properties.Settings>
12
- <setting name="PuttyPath" serializeAs="String">
13
- <value/>
14
- </setting>
15
- <setting name="Upgraded" serializeAs="String">
16
- <value>False</value>
17
- </setting>
18
- <setting name="UltraVncPath" serializeAs="String">
19
- <value/>
20
- </setting>
21
- <setting name="HybridCloudManager" serializeAs="String">
22
- <value/>
23
- </setting>
24
- <setting name="TightVncPath" serializeAs="String">
25
- <value/>
26
- </setting>
27
- <setting name="WinSCPPath" serializeAs="String">
28
- <value/>
29
- </setting>
30
- </MeshMiniRouterTool.Properties.Settings>
31
- <MeshMiniRouterTool.Settings1>
32
- <setting name="puttypath" serializeAs="String">
33
- <value/>
34
- </setting>
35
- </MeshMiniRouterTool.Settings1>
36
- <MeshNetworkRouterTool.Properties.Settings>
37
- <setting name="Server" serializeAs="String">
38
- <value/>
39
- </setting>
40
- </MeshNetworkRouterTool.Properties.Settings>
41
- </userSettings>
42
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.exe.deploy
Binary files a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.exe.deploy and /dev/null differ
public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.exe.manifest
deleted
-82
@@ -1,82 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
3
- <asmv1:assemblyIdentity name="MeshMiniRouter.exe" version="2.0.0.7" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
4
- <description asmv2:iconFile="MeshMiniRouter.ico" xmlns="urn:schemas-microsoft-com:asm.v1" />
5
- <application />
6
- <entryPoint>
7
- <assemblyIdentity name="MeshMiniRouter" version="1.0.6505.20092" language="neutral" processorArchitecture="msil" />
8
- <commandLine file="MeshMiniRouter.exe" parameters="" />
9
- </entryPoint>
10
- <trustInfo>
11
- <security>
12
- <applicationRequestMinimum>
13
- <PermissionSet version="1" class="System.Security.NamedPermissionSet" Name="Internet" Description="Default rights given to Internet applications" Unrestricted="true" ID="Custom" SameSite="site" />
14
- <defaultAssemblyRequest permissionSetReference="Custom" />
15
- </applicationRequestMinimum>
16
- <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
17
- <!-- UAC Manifest Options
18
- If you want to change the Windows User Account Control level replace the
19
- requestedExecutionLevel node with one of the following.
20
-
21
- <requestedExecutionLevel level="asInvoker" uiAccess="false" />
22
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
23
- <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
24
-
25
- Specifying requestedExecutionLevel node will disable file and registry virtualization.
26
- If you want to utilize File and Registry Virtualization for backward
27
- compatibility then delete the requestedExecutionLevel node.
28
- -->
29
- <requestedExecutionLevel level="asInvoker" uiAccess="false" />
30
- </requestedPrivileges>
31
- </security>
32
- </trustInfo>
33
- <dependency>
34
- <dependentOS>
35
- <osVersionInfo>
36
- <os majorVersion="5" minorVersion="1" buildNumber="2600" servicePackMajor="0" />
37
- </osVersionInfo>
38
- </dependentOS>
39
- </dependency>
40
- <dependency>
41
- <dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
42
- <assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
43
- </dependentAssembly>
44
- </dependency>
45
- <dependency>
46
- <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="MeshMiniRouter.exe" size="193536">
47
- <assemblyIdentity name="MeshMiniRouter" version="1.0.6505.20092" language="neutral" processorArchitecture="msil" />
48
- <hash>
49
- <dsig:Transforms>
50
- <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
51
- </dsig:Transforms>
52
- <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
53
- <dsig:DigestValue>G2b79xma2HCz/aTfnkt2L3I8c7mPbDDlU8IsdlFiDg8=</dsig:DigestValue>
54
- </hash>
55
- </dependentAssembly>
56
- </dependency>
57
- <file name="MeshMiniRouter.exe.config" size="2397">
58
- <hash>
59
- <dsig:Transforms>
60
- <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
61
- </dsig:Transforms>
62
- <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
63
- <dsig:DigestValue>UylUFD4/o0KBti+5/eodTDgq4BkUJD0J0aUXNd3yHbY=</dsig:DigestValue>
64
- </hash>
65
- </file>
66
- <file name="MeshMiniRouter.ico" size="1078">
67
- <hash>
68
- <dsig:Transforms>
69
- <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
70
- </dsig:Transforms>
71
- <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
72
- <dsig:DigestValue>mkjbDQuo7YXa8wZxdKEu/ECXrORwwtpRgNj8NBKbzHo=</dsig:DigestValue>
73
- </hash>
74
- </file>
75
- <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
76
- <application>
77
- <!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
78
- <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
79
- <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
80
- </application>
81
- </compatibility>
82
-</asmv1:assembly>
\ No newline at end of file
public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.ico.deploy
Binary files a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_7/MeshMiniRouter.ico.deploy and /dev/null differ
public/index.html
deleted
-3091
@@ -1,3091 +0,0 @@
1
-<!DOCTYPE html>
2
-<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
3
-<head>
4
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
6
- <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />
7
- <meta name="apple-mobile-web-app-capable" content="yes" />
8
- <meta name="format-detection" content="telephone=no" />
9
- <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS" />
10
- <script type="text/javascript" src="scripts/common-0.0.1.js"></script>
11
- <script type="text/javascript" src="scripts/meshcentral.js"></script>
12
- <script type="text/javascript" src="scripts/amt-0.2.0.js"></script>
13
- <script type="text/javascript" src="scripts/amt-wsman-0.2.0.js"></script>
14
- <script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script>
15
- <script type="text/javascript" src="scripts/amt-terminal-0.0.2.js"></script>
16
- <script type="text/javascript" src="scripts/inflate.js"></script>
17
- <script type="text/javascript" src="scripts/amt-redir-ws-0.1.0.js"></script>
18
- <script type="text/javascript" src="scripts/amt-wsman-ws-0.2.0.js"></script>
19
- <script type="text/javascript" src="scripts/agent-redir-ws-0.1.0.js"></script>
20
- <script type="text/javascript" src="scripts/filesaver.1.1.20151003.js"></script>
21
- <title>MeshCentral</title>
22
-</head>
23
-
24
-<body onload="if (typeof(startup) !== 'undefined') startup();" oncontextmenu="handleContextMenu(event)">
25
- <!-- right click menu -->
26
- <div id="contextMenu" class="contextMenu" style="display: none">
27
- <div id="cxinfo" class="cmtext" onclick="cmaction(1)"><b>Information</b></div>
28
- <div id="cxterminal" class="cmtext" onclick="cmaction(2)">Terminal</div>
29
- <div id="cxdesktop" class="cmtext" onclick="cmaction(3)">Desktop</div>
30
- <div id="cxfiles" class="cmtext" onclick="cmaction(4)">Files</div>
31
- <div id="cxconsole" class="cmtext" onclick="cmaction(5)">Console</div>
32
- <hr id="cxmgroupsplit" />
33
- <div id="cxmdesktop" class="cmtext" onclick="cmaction(6)" style=display:none>Multi-Desktop</div>
34
- </div>
35
- <div id="meshContextMenu" class="contextMenu" style="display: none; min-width: 0px">
36
- <div id="cxselectall" class="cmtext" onclick="cmmeshaction(1)">Select All</div>
37
- <div id="cxselectnone" class="cmtext" onclick="cmmeshaction(2)">Select None</div>
38
- <hr id="cxmgroupsplit2" style=display:none />
39
- <div id="cxmmdesktop" class="cmtext" style=display:none onclick="cmmeshaction(3)">Multi-Desktop</div>
40
- </div>
41
- <!-- main page -->
42
- <div id=container style=max-height:100vh;position:relative>
43
- <div id="notifiyBox" class="notifiyBox" style="display:none"></div>
44
- <div id=mastheadx></div>
45
- <div id=masthead style="background:url(images/logoback.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden">
46
- <div style="float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px">
47
- <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title}}}</font></strong>
48
- </div>
49
- <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px">
50
- <strong><font style="font-size:14px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
51
- </div>
52
- <div style="float:right">
53
- <div id=notificationCount onclick="clickNotificationIcon()" class="unselectable" style="display:none;min-width:28px;font-size:20px;border-radius:5px;background-color:lightblue;text-align:center;margin:8px;cursor:pointer;padding:4px" title="Click to view current notifications">0</div>
54
- </div>
55
- <p>{{{logoutControl}}}</p>
56
- </div>
57
- <div id=topbar style=display:none>
58
- <div>
59
- <div>
60
- <table style=width:100%;height:22px cellpadding=0 cellspacing=0 class=style1>
61
- <tr>
62
- <td id=MainMenuMyDevices style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(1)>My Devices</td>
63
- <td id=MainMenuMyAccount style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(2)>My Account</td>
64
- <td id=MainMenuMyEvents style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(3)>My Events</td>
65
- <td id=MainMenuMyFiles style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(5)>My Files</td>
66
- <td id=MainMenuMyUsers style=width:100px;height:24px;cursor:pointer;display:none class=style3 onclick=go(4)>My Users</td>
67
- <td class=style3 style=height:24px> </td>
68
- </tr>
69
- </table>
70
- <div id="MainSubMenuSpan" style=display:none>
71
- <table id="MainSubMenu" style="width: 100%; height: 22px;" cellpadding=0 cellspacing=0 class=style1>
72
- <tr>
73
- <td id=MainDev style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(10)>General</td>
74
- <td id=MainDevDesktop style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(11)>Desktop</td>
75
- <td id=MainDevTerminal style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(12)>Terminal</td>
76
- <td id=MainDevFiles style=width:100px;height:24px;cursor:pointer;display:none class=style3 onclick=go(13)>Files</td>
77
- <td id=MainDevAmt style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(14)>Intel® AMT</td>
78
- <td id=MainDevConsole style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(15)>Console</td>
79
- <td class=style3 style=height:24px> </td>
80
- </tr>
81
- </table>
82
- </div>
83
- <div id="MeshSubMenuSpan" style=display:none>
84
- <table id="MeshSubMenu" style="width: 100%; height: 22px;" cellpadding=0 cellspacing=0 class=style1>
85
- <tr>
86
- <td id=MeshGeneral style=width:100px;height:24px;cursor:pointer class=style3 onclick=go(20)>General</td>
87
- <td class=style3 style=height:24px> </td>
88
- </tr>
89
- </table>
90
- </div>
91
- </div>
92
- </div>
93
- </div>
94
- <div id="page_content" style="max-height:calc(100vh - 138px)">
95
- <div id="column_l">
96
- <div id=p0 style=display:none>
97
- <div id=p0message style=margin:50px;text-align:center>Server disconnected, <href onclick=reload() style=cursor:pointer><u>click to reconnect</u></href>.</div>
98
- </div>
99
- <div id=p1 style=display:none>
100
- <h1>My Devices</h1>
101
- <div style=width:100%;height:24px;background-color:#d3d9d6>
102
- <div class=style7 style=width:84px;height:100%;float:left> </div>
103
- <div class=h1 style=height:100%;float:left> </div>
104
- <div class=style14 style=height:100%;float:left>
105
- <input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />
106
- <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction();" />
107
- <input id="SearchInput" type="text" style=width:120px placeholder=Search onchange="onSearchInputChanged()" onkeyup="onSearchInputChanged()" autocomplete=off onfocus="onSearchFocus(1);" onblur="onSearchFocus(0);" />
108
- <input type="checkbox" id="HostnameCheckBox" onclick="onHostnameCheckBox()" /><span title="Show device hostnames">Hostname</span>
109
- </div>
110
- <div class="auto-style1" style="height: 100%; float: right">
111
- <div style="height: 100%; width: 4px; float: right; background-color: #ffffff"></div>
112
- <div class="h2" style="height: 100%; float: right;"> </div>
113
- <div style="float: right">
114
- Sort
115
- <select id="sortselect" onchange="onSortSelectChange()">
116
- <option>Mesh</option>
117
- <option>Power</option>
118
- <option>Device</option>
119
- </select>
120
- </div>
121
- </div>
122
- </div>
123
- <div id=NoNodesPanel style=display:none>
124
- <table style="width: 100%">
125
- <tr>
126
- <td valign="top" style="width: 50px">
127
- <img src="images/info.png" height="48" width="47" />
128
- </td>
129
- <td>
130
- No nodes found with this search criteria. To create a mesh network and add devices, start at the <a onclick=go(2) style="cursor:pointer">My Account</a> page.
131
- </td>
132
- </tr>
133
- </table>
134
- <p></p>
135
- </div>
136
- <div id="xdevices" style="max-height:calc(100vh - 228px);overflow-y:auto;-webkit-overflow-scrolling:touch;"></div>
137
- </div>
138
- <div id=p2 style=display:none>
139
- <h1>My Account</h1>
140
- <p><strong><img alt="" width=150 height=103 src=images/mainaccount.png style=margin-bottom:10px;margin-right:20px;float:right />Account actions</strong></p>
141
- <p style="margin-left:40px">
142
- <a onclick="account_showChangePassword()" style="cursor:pointer">Change password</a><br />
143
- <a onclick="account_showDeleteAccount()" style="cursor:pointer">Delete account</a><br />
144
- </p>
145
- <p id="p2ServerActions"><strong>Server actions</strong></p>
146
- <p style="margin-left:40px">
147
- <a id="p2ServerActionsBackup" href="/backup.zip" target="_blank" style="cursor:pointer">Download server backup</a><br />
148
- <a id="p2ServerActionsRestore" onclick="server_showRestoreDlg()" style="cursor:pointer">Restore server with backup</a><br />
149
- </p>
150
- <br style=clear:both />
151
- <strong>Administrative Meshes</strong>
152
- ( <a onclick=account_createMesh() style=cursor:pointer><img height=12 src="images/icon-addnew.png" width=12 border=0 /> New</a> )
153
- <br /><br />
154
- <div id=p2meshes></div>
155
- <div id=p2noMeshFound style=margin-left:40px;display:none>No meshes found. <a onclick=account_createMesh() style=cursor:pointer><strong>Get started here!</strong></a><br /><br /></div>
156
- </div>
157
- <div id=p3 style=display:none>
158
- <h1>My Events</h1>
159
- <div style=width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px>
160
- <div class=style7 style=width:16px;height:100%;float:left> </div>
161
- <div class=h1 style=height:100%;float:left> </div>
162
- <div class=style14 style=height:100%;float:left> <input id=p2deleteall type=button onclick=showDeleteAllEventsDialog() style=display:none value="Delete All..." /> </div>
163
- <div class="auto-style1" style="height:100%;float:right">
164
- <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div>
165
- <div class="h2" style="height:100%;float:right;"> </div>
166
- </div>
167
- </div>
168
- <div id=p3events style="max-height:600px;overflow-y:scroll"></div>
169
- </div>
170
- <div id=p4 style=display:none>
171
- <h1>My Users</h1>
172
- <div style=width:100%;height:24px;background-color:#d3d9d6;margin-bottom:4px>
173
- <div class=style7 style=width:16px;height:100%;float:left> </div>
174
- <div class=h1 style=height:100%;float:left> </div>
175
- <div class=style14 style=height:100%;float:left> <input type=button onclick=showCreateNewAccountDialog() value="New Account..." /> </div>
176
- <div class=auto-style1 style="height:100%;float:right">
177
- <div style="height:100%;width:20px;float:right;background-color:#ffffff"></div>
178
- <div class=h2 style="height:100%;float:right"> </div>
179
- </div>
180
- </div>
181
- <div id="p3users" style="max-height:600px;overflow-y:auto"></div>
182
- </div>
183
- <div id=p5 style=display:none>
184
- <h1>My Files</h1>
185
- <table id="p5toolbar" style="width: 100%" cellpadding="0" cellspacing="0">
186
- <tr>
187
- <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign=bottom>
188
- <div id="p5rightOfButtons" style="float:right;margin-top:3px"></div>
189
- <div>
190
- <input type="button" id="p5FolderUp" disabled="disabled" onclick="p5folderup();" value="Up" />
191
- <input type="button" id="p5SelectAllButton" disabled="disabled" onclick="p5selectallfile();" value="Select All" onkeypress="return false;" onkeydown="return false;" />
192
- <input type="button" id="p5RenameFileButton" disabled="disabled" value="Rename" onclick="p5renamefile();" onkeypress="return false;" onkeydown="return false;" />
193
- <input type="button" id="p5DeleteFileButton" disabled="disabled" value="Delete" onclick="p5deletefile();" onkeypress="return false;" onkeydown="return false;" />
194
- <input type="button" id="p5NewFolderButton" disabled="disabled" value="New Folder" onclick="p5createfolder();" onkeypress="return false;" onkeydown="return false;" />
195
- <input type="button" id="p5UploadButton" disabled="disabled" value="Upload" onclick="p5uploadFile()" onkeypress="return false;" onkeydown="return false;" />
196
- </div>
197
- </td>
198
- </tr>
199
- <tr>
200
- <td style="background-color:#E4E9E7;height:28px">
201
- <div style=float:right>
202
- <select id=p5sortdropdown onchange=updateFiles()>
203
- <option value="1" selected="selected">Sort by name</option>
204
- <option value="2">Sort by size</option>
205
- <option value="3">Sort by date</option>
206
- <option value="4">Descend by name</option>
207
- <option value="5">Descend by size</option>
208
- <option value="6">Descend by date</option>
209
- </select>
210
- </div>
211
- <div> <span id="p5currentpath"></span></div>
212
- </td>
213
- </tr>
214
- </table>
215
- <div id="p5filetable" style="width:100%;height:500px;overflow:auto;-webkit-user-select:none">
216
- <div id="p5PublicShare" style="display:none;width:100%;padding:4px;overflow:auto;-webkit-user-select:none;background-color:lightsteelblue">This files is shared publically, click "link" to get public url.</div>
217
- <div id="bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div>
218
- <div id="bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div>
219
- <span id="p5files"></span>
220
- </div>
221
- <table id="p5toolbarBottom" style=width:100% cellpadding=0 cellspacing=0>
222
- <tr><td class=style6 style="text-align:left"> <span id="bottomstatus"></span></td></tr>
223
- </table>
224
- </div>
225
- <div id=p10 style=display:none>
226
- <table style="width:100%" cellpadding="0" cellspacing="0">
227
- <tr>
228
- <td style=width:auto valign=top>
229
- <h1><span id=p10deviceName></span> - General</h1>
230
- <div id=p10html></div>
231
- </td>
232
- <td style=width:20px></td>
233
- <td style=width:200px>
234
- <a style=cursor:pointer onclick=p10showiconselector()><img id=MainComputerImage style=border-width:0px;height:200px;width:200px></a>
235
- <div style="width:100%;text-align:center"><strong><span id=MainComputerState class=style7></span></strong></div>
236
- </td>
237
- </tr>
238
- </table><br>
239
- <div id=p10html2></div>
240
- <div id=p10html3></div>
241
- </div>
242
- <div id=p11 style=display:none>
243
- <h1 id=p11deviceNameHeader><span id=p11deviceName></span> - Desktop</h1>
244
- <div id="p14warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showFeaturesDlg()">
245
- <div class="icon2" style="float:left;margin:7px" />
246
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div>
247
- </div>
248
- </div>
249
- <div id="p14warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick="showPowerActionDlg()">
250
- <div class="icon2" style="float:left;margin:7px" />
251
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div>
252
- </div>
253
- </div>
254
- <table cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
255
- <tr id=deskarea1>
256
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
257
- <div style="float:right;text-align:right">
258
- <span id="p14power"></span>
259
- <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Left" onclick="drotate(-1)">↺</div>
260
- <div style='cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px' title="Rotate Right" onclick="drotate(1)">↻</div>
261
- <input id="deskFullBtn" type="button" title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value="Full" onclick="deskToggleFull()" style="margin-right:3px">
262
- <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px">
263
- <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick="deskSaveImage()" style="margin-right:3px">
264
- <input type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px">
265
- <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none">
266
- </div>
267
- <div>
268
- <div id="idx_deskFullBtn2" onclick="deskToggleFull()" style="float:left;font-size:large;cursor:pointer;display:none"> X</div>
269
- <input type="button" id="connectbutton1" value="Connect" onclick="connectDesktop(event)" onkeypress="return false" onkeydown="return false" disabled="disabled">
270
- <span id="deskstatus">Disconnected.</span>
271
- </div>
272
- </td>
273
- </tr>
274
- <tr id=deskarea2>
275
- <td>
276
- <div style="background-color:gray"><div id="progressbar" style="height:2px;width:0%;background-color:red"></div></div>
277
- </td>
278
- </tr>
279
- <tr id=deskarea3>
280
- <td id=deskarea3x style="background:black;text-align:center;height:400px;position:relative">
281
- <div id="DeskFocus" style="color:transparent;border:3px dotted rgba(255,0,0,.2);position:absolute;border-radius:5px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></div>
282
- <canvas id="Desk" width="640" height="400" style="width:100%;-ms-touch-action:none;margin-left:0px" oncontextmenu="return false" onmousedown="dmousedown(event)" onmouseup="dmouseup(event)" onmousemove="dmousemove(event)"></canvas>
283
- </td>
284
- </tr>
285
- <tr id=deskarea4>
286
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
287
- <div>
288
-
289
- <input id="DeskCAD" type="button" value="Ctrl-Alt-Del" onkeypress="return false" onkeydown="return false" onclick="sendCAD()">
290
- </div>
291
- </td>
292
- </tr>
293
- </table>
294
- </div>
295
- <div id=p12 style=display:none>
296
- <h1><span id=p12deviceName></span> - Terminal</h1>
297
- <div id="p12warning" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick=showFeaturesDlg()>
298
- <div class="icon2" style="float:left;margin:7px"></div>
299
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Intel® AMT Redirection port or KVM feature is disabled<span id="p14warninga">, click here to enable it.</span></div>
300
- </div>
301
- <div id="p12warning2" style='max-width:100%;display:none;cursor:pointer;margin-bottom:5px' onclick=showPowerActionDlg()>
302
- <div class="icon2" style="float:left;margin:7px"></div>
303
- <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div>
304
- </div>
305
- <table cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
306
- <tr>
307
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
308
- <div>
309
- <input type="button" id="connectbutton2" value="Connect" onclick="connectTerminal(event)" onkeypress="return false" onkeydown="return false" disabled="disabled">
310
- <span id="termstatus">Disconnected.</span>
311
- </div>
312
- </td>
313
- </tr>
314
- <tr>
315
- <td>
316
- <div style="background-color:gray"><div id="termprogressbar" style="height:2px;width:0%;background-color:red"></div></div>
317
- </td>
318
- </tr>
319
- <tr>
320
- <td style="background:black;text-align:center;height:400px;position:relative">
321
- <pre id="Term" style="background:black;margin:0;padding:0"></pre>
322
- </td>
323
- </tr>
324
- <tr>
325
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
326
- <div style="float:right;text-align:right">
327
- <input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()">
328
- <input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()">
329
- </div>
330
- <div>
331
-
332
- </div>
333
- </td>
334
- </tr>
335
- </table>
336
- </div>
337
- <div id=p13 style=display:none>
338
- <h1><span id=p13deviceName></span> - Files</h1>
339
- <table id="p13toolbar" style="width: 100%" cellpadding="0" cellspacing="0">
340
- <tr>
341
- <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px">
342
- <input id=p13Connect value="Connect" onclick=connectFiles(event) onkeypress="return false" onkeydown="return false" type="button">
343
- <span id=p13Status>Disconnected.</span>
344
- </td>
345
- </tr>
346
- <tr>
347
- <td style="width:100%;background-color:#d3d9d6;text-align:left;padding:4px" valign=bottom>
348
- <div id="p13rightOfButtons" style="float:right;margin-top:3px"></div>
349
- <div>
350
- <input type=button id="p13FolderUp" disabled="disabled" onclick="p13folderup()" value="Up" />
351
- <input type=button id="p13SelectAllButton" disabled="disabled" onclick="p13selectallfile()" value="Select All" onkeypress="return false;" onkeydown="return false;" />
352
- <input type=button id="p13RenameFileButton" disabled="disabled" value="Rename" onclick="p13renamefile()" onkeypress="return false;" onkeydown="return false;" />
353
- <input type=button id="p13DeleteFileButton" disabled="disabled" value="Delete" onclick="p13deletefile()" onkeypress="return false;" onkeydown="return false;" />
354
- <input type=button id="p13NewFolderButton" disabled="disabled" value="New Folder" onclick="p13createfolder()" onkeypress="return false;" onkeydown="return false;" />
355
- <input type=button id="p13UploadButton" disabled="disabled" value="Upload" onclick="p13uploadFile()" onkeypress="return false;" onkeydown="return false;" />
356
- </div>
357
- </td>
358
- </tr>
359
- <tr>
360
- <td style="background-color:#E4E9E7;height:28px">
361
- <div style=float:right>
362
- <select id=p13sortdropdown onchange=p13updateFiles()>
363
- <option value=1 selected="selected">Sort by name</option>
364
- <option value=2>Sort by size</option>
365
- <option value=3>Sort by date</option>
366
- <option value=4>Descend by name</option>
367
- <option value=5>Descend by size</option>
368
- <option value=6>Descend by date</option>
369
- </select>
370
- </div>
371
- <div> <span id="p13currentpath"></span></div>
372
- </td>
373
- </tr>
374
- </table>
375
- <div id="p13filetable" style="width:100%;height:500px;overflow:auto;-webkit-user-select:none">
376
- <div id="p13bigok" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✓</b></div>
377
- <div id="p13bigfail" style="width:256px;overflow:hidden;position:absolute;left:337px;top:200px;text-align:center;font-size:1600%;color:#AAAAAA;display:none"><b>✗</b></div>
378
- <span id="p13files"></span>
379
- </div>
380
- <table id="p13toolbarBottom" style=width:100% cellpadding=0 cellspacing=0>
381
- <tr><td class=style6 style="text-align:left"> <span id="bottomstatus"></span></td></tr>
382
- </table>
383
- </div>
384
- <div id=p14 style=display:none>
385
- <h1><span id=p14deviceName></span> - Intel® AMT</h1>
386
- <iframe id=p14iframe style="width:100%;height:650px;border:0;overflow:hidden" src="/commander.htm"></iframe>
387
- </div>
388
- <div id=p15 style=display:none>
389
- <h1><span id=p15deviceName></span> - Console</h1>
390
- <table cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
391
- <tr>
392
- <td style=background:#C0C0C0>
393
- <div style=float:right;padding-right:4px>
394
- <span id=p15coreName title="Information about current core running on this agent"></span>
395
- <input type=button id=p15uploadCore value="Change Core" onclick=p15uploadCore() title="Change the agent Java Script code module" />
396
- </div>
397
- <div id="p15statetext" style=padding:4px></div>
398
- </td>
399
- </tr>
400
- <tr>
401
- <td>
402
- <div style="background-color:gray"><div id="consoleprogressbar" style="height:2px;width:0%;background-color:red"></div></div>
403
- </td>
404
- </tr>
405
- <tr>
406
- <td style="background:black;text-align:center;height:500px;position:relative">
407
- <div id="p15agentConsole" style="background:black;margin:0;padding:0;color:lightgray;width:100%;max-width:930px;height:100%;text-align:left;overflow-y:scroll"></div>
408
- </td>
409
- </tr>
410
- <tr>
411
- <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
412
- <table style="width:100%">
413
- <tr>
414
- <td style="width:99%">
415
- <input id=p15consoleText list=p15history style="width:100%" onkeyup=p15consoleSend(event) />
416
- <datalist id="p15history"></datalist>
417
- </td>
418
- <td> </td>
419
- <td style="width:1%"><input id="id_p15consoleClear" type="button" onkeypress="return false" onkeydown="return false" class="bottombutton" value="Clear" onclick="p15consoleClear()"></td>
420
- </tr>
421
- </table>
422
- </td>
423
- </tr>
424
- </table>
425
- </div>
426
- <div id=p20 style=display:none>
427
- <h1><span id=p20meshName></span> - General</h1>
428
- <p id=p20info></p>
429
- </div>
430
- <br id="column_l_bottomgap" />
431
- </div>
432
- <div id=footer>
433
- <table cellpadding=0 cellspacing=10 style="width:100%">
434
- <tr>
435
- <td style="text-align:left"></td>
436
- <td style="text-align:right"><a href="terms">Terms & Privacy</a></td>
437
- </tr>
438
- </table>
439
- </div>
440
- <div id=dialog style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial,Helvetica,sans-serif;border-radius:5px;position:fixed;top:160px;width:400px;display:none">
441
- <div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0">
442
- <div id=id_dialogclose style=float:right;padding:5px;cursor:pointer onclick=setDialogMode()><b>X</b></div>
443
- <div id=id_dialogtitle style=padding:5px></div>
444
- <div style=width:100%;margin:6px></div>
445
- </div>
446
- <div style="margin-right:16px;margin-left:8px">
447
- <div id=dialog1 style="margin:auto;text-align:center;margin:3px">
448
- <div id=id_dialogMessage style="padding:10px"></div>
449
- </div>
450
- <div id=dialog2 style="margin:auto;margin:3px">
451
- <div id=id_dialogOptions></div>
452
- </div>
453
- <div id=dialog3 style="margin:auto;margin:3px">
454
- <div style=height:26px>
455
- <select id=d3uploadMode style=float:right;width:260px onchange=d3modechange()>
456
- <option value=1>Local file upload</option>
457
- <option value=2>Server file selection</option>
458
- </select>
459
- <div>File Selection</div>
460
- </div>
461
- <div id=d3localmode style=height:26px;display:none>
462
- <form id=d3localmodeform method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame>
463
- <input type=text id=d3attrib name=attrib style=display:none />
464
- <input type=file id=d3localFile name=files style=float:right;width:260px onchange=d3setActions() />
465
- <input type=submit id=d3submit style=display:none />
466
- </form>
467
- <div>Upload File</div>
468
- </div>
469
- <div id=d3servermode>
470
- <div style="width:100%;background-color:#d3d9d6;text-align:left;padding:3px" valign=bottom>
471
- <input type=button id=p3FolderUp disabled="disabled" onclick=d3folderup() value="Up" />
472
- </div>
473
- <div id=d3serverfiles style="width:100%;height:150px;background-color:white;padding:2px;border:1px solid gray;overflow-y:scroll"></div>
474
- </div>
475
- </div>
476
- <div id=dialog7 style="margin:auto;margin:3px">
477
- <br>
478
- <div style='height:26px'>
479
- <select id="d7desktopmode" style="float:right;width:200px">
480
- <option value="1">RLE8, Fastest</option>
481
- <option value="2">RLE16, Recommended</option>
482
- <option value="3">RAW8, Slow</option>
483
- <option value="4">RAW16, Very Slow</option>
484
- </select>
485
- <div>Image Encoding</div>
486
- </div>
487
- <div style="height:60px">
488
- <div style="float:right;border:1px solid #666;width:200px;height:60px;overflow-y:scroll;background-color:white">
489
- <input type="checkbox" id='d7showfocus'>Show Focus Tool<br>
490
- <input type="checkbox" id='d7showcursor'>Show Local Mouse Cursor<br>
491
- <input type="checkbox" id='d7showcad'>Show Ctrl-Alt-Del<br>
492
- </div>
493
- <div>Other Settings</div>
494
- </div>
495
- </div>
496
- </div>
497
- <div id="idx_dlgButtonBar" style="padding:10px;margin-bottom:4px">
498
- <input id="idx_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)">
499
- <input id="idx_dlgOkButton" type="button" value="OK" style="float:right;width:80px" onclick="dialogclose(1)">
500
- <div style="height:25px"><input id=idx_dlgDeleteButton type=button value=Delete style="width:80px;display:none" onclick="dialogclose(2)"></div>
501
- </div>
502
- </div>
503
- <iframe name="fileUploadFrame" style=display:none></iframe>
504
- <form style=display:none method=post action=uploadfile.ashx enctype=multipart/form-data target=fileUploadFrame><input id=p5fileDragName name="name"><input id=p5fileDragSize name="size"><input id=p5fileDragType name="type"><input id=p5fileDragData name="data"><input id=p5fileDragLink name="link"><input type=submit id=p5loginSubmit2 style=display:none /></form>
505
- <form style=display:none method=post action=uploadnodefile.ashx enctype=multipart/form-data target=fileUploadFrame><input id=p13fileDragName name="name"><input id=p13fileDragSize name="size"><input id=p13fileDragType name="type"><input id=p13fileDragData name="data"><input id=p13fileDragLink name="link"><input type=submit id=p13loginSubmit2 style=display:none /></form>
506
- <audio id="chimes"><source src="sounds/chimes.mp3" type="audio/mp3"></audio>
507
- <script type="text/javascript">
508
- var powerStatetable = ['', 'Powered', 'Sleep', 'Sleep', 'Sleep', 'Hibernating', 'Power off', 'Present'];
509
- var StatusStrs = ['Disconnected', 'Connecting...', 'Setup...', 'Connected'];
510
- var sort = 0;
511
- var searchFocus = 0;
512
- var showHostnames = false;
513
- var meshserver = null;
514
- var meshes = {};
515
- var nodes = [];
516
- var filetree = {};
517
- var userinfo = null;
518
- var serverinfo = null;
519
- var events = [];
520
- var users = null;
521
- var wssessions = null;
522
- var nodeShortIdent = 0;
523
- var desktop;
524
- var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true };
525
- var terminal;
526
- var files;
527
- var debugLevel = {{{debuglevel}}};
528
-
529
- function startup() {
530
- // Guard against other site's top frames (web bugs).
531
- var loc = null;
532
- try { loc = top.location.toString().toLowerCase(); } catch (e) { }
533
- if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
534
-
535
- // Setup page visuals
536
- p1updateInfo();
537
-
538
- // Setup the context menu
539
- document.onclick = function (e) { hideContextMenu(); }
540
- document.onkeypress = ondockeypress;
541
- document.onkeydown = ondockeydown;
542
- document.onkeyup = ondockeyup;
543
- window.onresize = center;
544
- center();
545
-
546
- // Connect to the mesh server
547
- meshserver = MeshServerCreateControl("{{{domainurl}}}");
548
- meshserver.onStateChanged = onStateChanged;
549
- meshserver.onMessage = onMessage;
550
- meshserver.Start();
551
-
552
- // Setup page controls
553
- document.getElementById("sortselect").selectedIndex = sort = getstore("sort", 0);
554
- Q('SearchInput').value = getstore("search", "");
555
- showHostnames = (getstore("showHostnames", 1) == 1);
556
- Q('HostnameCheckBox').checked = showHostnames;
557
-
558
- // Display the page devices
559
- onSortSelectChange();
560
- onSearchInputChanged();
561
- updateDevices();
562
-
563
- // Setup upload drag & drop
564
- Q('p5filetable').addEventListener("drop", p5fileDragDrop, false);
565
- Q('p5filetable').addEventListener("dragover", p5fileDragOver, false);
566
- Q('p5filetable').addEventListener("dragleave", p5fileDragLeave, false);
567
-
568
- // Setup upload drag & drop
569
- Q('p13filetable').addEventListener("drop", p13fileDragDrop, false);
570
- Q('p13filetable').addEventListener("dragover", p13fileDragOver, false);
571
- Q('p13filetable').addEventListener("dragleave", p13fileDragLeave, false);
572
-
573
- // Timeline update interval
574
- setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes
575
- }
576
-
577
- function getNodeFromId(id) {
578
- for (var i in nodes) { if (nodes[i]._id == id) return nodes[i]; }
579
- return null;
580
- }
581
-
582
- function reload() { window.location.href = window.location.href; }
583
-
584
- function onStateChanged(server, state) {
585
- if (state == 0) {
586
- // Control web socket disconnected
587
- go(0);
588
-
589
- // Clean up
590
- powerTimeline = null;
591
- powerTimelineReq = null;
592
- powerTimelineNode = null;
593
- powerTimelineUpdate = null;
594
- deleteAllNotifications(); // Close and clear notifications if present
595
- setDialogMode(0); // Close any dialog boxes if present
596
- hideContextMenu(); // Hide the context menu if present
597
- } else if (state == 2) {
598
- // Fetch list of meshes, nodes, files
599
- meshserver.Send({ action: 'meshes' });
600
- meshserver.Send({ action: 'nodes' });
601
- meshserver.Send({ action: 'files' });
602
- }
603
- }
604
-
605
- function updateSiteAdmin() {
606
- // Update account actions
607
- QV('p2ServerActions', userinfo.siteadmin & 5);
608
- QV('p2ServerActionsBackup', userinfo.siteadmin & 1);
609
- QV('p2ServerActionsRestore', userinfo.siteadmin & 4);
610
- QV('MainMenuMyFiles', userinfo.siteadmin & 8);
611
- if (((userinfo.siteadmin & 8) == 0) && (xxcurrentView == 5)) { go(1); }
612
-
613
- // Update user management state
614
- if ((userinfo.siteadmin & 2) != 0)
615
- {
616
- // We are user administrator
617
- if (users == null) { meshserver.Send({ action: 'users' }); }
618
- if (wssessions == null) { meshserver.Send({ action: 'wssessioncount' }); }
619
- } else {
620
- // We are not user administrator
621
- users = null;
622
- wssessions = null;
623
- updateUsers();
624
- if (xxcurrentView == 4) go(1);
625
- }
626
- meshserver.Send({ action: 'events' });
627
- QV('p2deleteall', userinfo.siteadmin == 0xFFFFFFFF);
628
- }
629
-
630
- function onMessage(server, message) {
631
- switch (message.action) {
632
- case 'userinfo': {
633
- userinfo = message.userinfo;
634
- updateSiteAdmin();
635
- break;
636
- }
637
- case 'serverinfo': {
638
- serverinfo = message.serverinfo;
639
- break;
640
- }
641
- case 'users': {
642
- users = {};
643
- for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
644
- updateUsers();
645
- break;
646
- }
647
- case 'wssessioncount': {
648
- wssessions = message.wssessions;
649
- updateUsers();
650
- break;
651
- }
652
- case 'meshes': {
653
- meshes = {};
654
- for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
655
- updateMeshes();
656
- updateDevices();
657
- break;
658
- }
659
- case 'files': {
660
- filetree = setupBackPointers(message.filetree);
661
- updateFiles();
662
- d3updatefiles();
663
- break;
664
- }
665
- case 'nodes': {
666
- nodes = [];
667
- for (var m in message.nodes) {
668
- for (var n in message.nodes[m]) {
669
- if (!meshes[m]) { console.log('Invalid mesh (1): ' + m); continue; }
670
- message.nodes[m][n].namel = message.nodes[m][n].name.toLowerCase();
671
- if (message.nodes[m][n].host) { message.nodes[m][n].hostl = message.nodes[m][n].host.toLowerCase(); } else { message.nodes[m][n].hostl = message.nodes[m][n].namel; }
672
- message.nodes[m][n].meshnamel = meshes[m].name.toLowerCase();
673
- message.nodes[m][n].meshid = m;
674
- message.nodes[m][n].state = (message.nodes[m][n].state)?(message.nodes[m][n].state):0;
675
- message.nodes[m][n].desc = message.nodes[m][n].desc;
676
- if (!message.nodes[m][n].icon) message.nodes[m][n].icon = 1;
677
- message.nodes[m][n].ident = ++nodeShortIdent;
678
- nodes.push(message.nodes[m][n]);
679
- }
680
- }
681
- onSortSelectChange();
682
- onSearchInputChanged();
683
- updateDevices();
684
- if (xxcurrentView == 0) { if ('{{viewmode}}' != '') { go({{viewmode}}); } else { go(1); } }
685
- if ('{{currentNode}}' != '') { gotoDevice('{{currentNode}}',{{viewmode}});}
686
- break;
687
- }
688
- case 'powertimeline': {
689
- if (message.nodeid != powerTimelineReq) break;
690
- powerTimelineNode = message.nodeid;
691
- powerTimeline = message.timeline;
692
- powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
693
- if (currentNode._id == message.nodeid) { drawDeviceTimeline(); }
694
- break;
695
- }
696
- case 'msg': {
697
- // Check if this is a message from a node
698
- if (message.nodeid != undefined) {
699
- var index = -1;
700
- for (var i in nodes) { if (nodes[i]._id == message.nodeid) { index = i; break; } }
701
- if (index != -1) {
702
- // Node was found, dispatch the message
703
- if (message.type == 'console') { p15consoleReceive(nodes[index], message.value); } // This is a console message.
704
- if (message.type == 'notify') { // This is a notification message.
705
- var n = { text:message.value };
706
- if (message.nodeid != undefined) { n.nodeid = message.nodeid; }
707
- if (message.tag != undefined) { n.tag = message.tag; }
708
- addNotification(n);
709
- }
710
- }
711
- }
712
- break;
713
- }
714
- case 'events': {
715
- events = message.events;
716
- events_update();
717
- break;
718
- }
719
- case 'event': {
720
- if (!message.event.nolog) { events.unshift(message.event); events_update(); }
721
- switch (message.event.action) {
722
- case 'accountcreate':
723
- case 'accountchange': {
724
- // An account was created or changed
725
- if (userinfo.name == message.event.account.name) {
726
- var newsiteadmin = message.event.account.siteadmin?message.event.account.siteadmin:0;
727
- var oldsiteadmin = userinfo.siteadmin?userinfo.siteadmin:0;
728
- if ((message.event.account.quota != userinfo.quota) || (((userinfo.siteadmin & 8) == 0) && ((message.event.account.siteadmin & 8) != 0))) { meshserver.Send({ action: 'files' }); }
729
- userinfo = message.event.account;
730
- if (oldsiteadmin != newsiteadmin) updateSiteAdmin();
731
- }
732
- if (users == null) break;
733
- users[message.event.account._id] = message.event.account;
734
- updateUsers();
735
- break;
736
- }
737
- case 'accountremove': {
738
- // An account was removed
739
- if (users == null) break;
740
- delete users['user/{{{domain}}}/' + message.event.username.toLowerCase()];
741
- updateUsers();
742
- break;
743
- }
744
- case 'createmesh': {
745
- // A new mesh was created
746
- if (message.event.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()] != undefined) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
747
- meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
748
- updateMeshes();
749
- updateDevices();
750
- meshserver.Send({ action: 'files' });
751
- }
752
- break;
753
- }
754
- case 'meshchange': {
755
- // Update mesh information
756
- if (meshes[message.event.meshid] == undefined) {
757
- // This is a new mesh for us
758
- meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
759
- meshserver.Send({ action: 'nodes' }); // Request a refresh of all nodes (TODO: We could optimize this to only request nodes for the new mesh).
760
- } else {
761
- // This is an existing mesh
762
- meshes[message.event.meshid].name = message.event.name;
763
- meshes[message.event.meshid].desc = message.event.desc;
764
- meshes[message.event.meshid].links = message.event.links;
765
-
766
- // Check if we lost rights to this mesh in this change.
767
- if (meshes[message.event.meshid].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()] == undefined) {
768
- if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2);
769
- delete meshes[message.event.meshid];
770
-
771
- // Delete all nodes in that mesh
772
- var newnodes = [];
773
- for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
774
- nodes = newnodes;
775
-
776
- // If we are looking at a node in the deleted mesh, move back to "My Devices"
777
- if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) go(1);
778
- }
779
- }
780
- updateMeshes();
781
- updateDevices();
782
- meshserver.Send({ action: 'files' });
783
-
784
- // If we are looking at a mesh that is now deleted, move back to "My Account"
785
- if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { p20updateMesh(); }
786
- break;
787
- }
788
- case 'deletemesh': {
789
- // Delete the mesh
790
- if (meshes[message.event.meshid]) {
791
- delete meshes[message.event.meshid];
792
- updateMeshes();
793
- meshserver.Send({ action: 'files' });
794
- }
795
-
796
- // Delete all nodes in that mesh
797
- var newnodes = [];
798
- for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } }
799
- nodes = newnodes;
800
- updateDevices();
801
-
802
- // If we are looking at a mesh that is now deleted, move back to "My Account"
803
- if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) go(2);
804
- // If we are looking at a node in the deleted mesh, move back to "My Devices"
805
- if (xxcurrentView >= 10 && xxcurrentView < 20 && currentNode && currentNode.meshid == message.event.meshid) go(1);
806
-
807
- break;
808
- }
809
- case 'addnode': {
810
- var node = message.event.node;
811
- if (!meshes[node.meshid]) break; // This is a node for a mesh we don't know. Happens when we are site administrator, we get all messages.
812
- node.namel = node.name.toLowerCase();
813
- if (node.host) { node.hostl = node.host.toLowerCase(); } else { node.hostl = node.namel; }
814
- node.meshnamel = meshes[node.meshid].name.toLowerCase();
815
- node.state = 0;
816
- if (!node.icon) node.icon = 1;
817
- node.ident = ++nodeShortIdent;
818
- nodes.push(node);
819
- onSortSelectChange();
820
- onSearchInputChanged();
821
- updateDevices();
822
- break;
823
- }
824
- case 'removenode': {
825
- var index = -1;
826
- for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
827
- if (index != -1) {
828
- var node = nodes[index];
829
- if (currentNode == node) {
830
- if (xxcurrentView >= 10 && xxcurrentView < 20) { go(1); }
831
- delete currentNode; // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
832
- }
833
- nodes.splice(index, 1);
834
- updateDevices();
835
- }
836
- break;
837
- }
838
- case 'changenode': {
839
- var index = -1;
840
- for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
841
- if (index != -1) {
842
- var node = nodes[index];
843
-
844
- // Change the node
845
- node.name = message.event.node.name;
846
- node.host = message.event.node.host;
847
- node.desc = message.event.node.desc;
848
- if (message.event.node.agent != undefined) {
849
- if (node.agent == undefined) node.agent = {};
850
- if (message.event.node.agent.ver != undefined) { node.agent.ver = message.event.node.agent.ver; }
851
- if (message.event.node.agent.id != undefined) { node.agent.id = message.event.node.agent.id; }
852
- if (message.event.node.agent.caps != undefined) { node.agent.caps = message.event.node.agent.caps; }
853
- if (message.event.node.agent.core != undefined) { node.agent.core = message.event.node.agent.core; } else { if (node.agent.core) { delete node.agent.core; } }
854
- }
855
- if (message.event.node.intelamt != undefined) {
856
- if (node.intelamt == undefined) node.intelamt = {};
857
- if (message.event.node.intelamt.host != undefined) { node.intelamt.user = message.event.node.intelamt.host; }
858
- if (message.event.node.intelamt.user != undefined) { node.intelamt.user = message.event.node.intelamt.user; }
859
- if (message.event.node.intelamt.tls != undefined) { node.intelamt.tls = message.event.node.intelamt.tls; }
860
- if (message.event.node.intelamt.ver != undefined) { node.intelamt.ver = message.event.node.intelamt.ver; }
861
- if (message.event.node.intelamt.state != undefined) { node.intelamt.state = message.event.node.intelamt.state; }
862
- }
863
- node.namel = node.name.toLowerCase();
864
- if (node.host) { node.hostl = node.host.toLowerCase(); } else { node.hostl = node.namel; }
865
- if (message.event.node.icon) { node.icon = message.event.node.icon; }
866
-
867
- updateDevices();
868
- drawNotifications();
869
- refreshDevice(node._id);
870
- }
871
- break;
872
- }
873
- case 'nodeconnect': {
874
- // Indicated a node has changed connectivity state
875
- var index = -1;
876
- for (var i in nodes) { if (nodes[i]._id == message.event.nodeid) { index = i; break; } }
877
- if (index != -1) {
878
- var node = nodes[index];
879
-
880
- // Change the node connection state
881
- node.conn = message.event.conn;
882
- node.pwr = message.event.pwr;
883
- if (message.event.agct != undefined) { node.agct = message.event.agct; }
884
- if (message.event.cict != undefined) { node.cict = message.event.cict; }
885
- updateDevices();
886
- refreshDevice(node._id);
887
- }
888
- break;
889
- }
890
- case 'wssessioncount': {
891
- // Update the active web socket session count for a user
892
- if (wssessions != null) {
893
- if (message.event.count == 0 && wssessions['user/{{{domain}}}/' + message.event.username]) {
894
- delete wssessions['user/{{{domain}}}/' + message.event.username];
895
- } else {
896
- wssessions['user/{{{domain}}}/' + message.event.username] = message.event.count;
897
- }
898
- updateUsers();
899
- }
900
- break;
901
- }
902
- case 'clearevents': {
903
- events = [];
904
- events_update();
905
- break;
906
- }
907
- case 'login': {
908
- // Update the last login time
909
- if (users != null && users['user/{{{domain}}}/' + message.event.username]) { users['user/{{{domain}}}/' + message.event.username].login = message.event.time; }
910
- break;
911
- }
912
- }
913
- break;
914
- }
915
- }
916
- }
917
-
918
- //
919
- // MY DEVICES
920
- //
921
-
922
- function onHostnameCheckBox() {
923
- showHostnames = Q('HostnameCheckBox').checked;
924
- putstore("showHostnames", showHostnames ? 1 : 0);
925
- onSortSelectChange();
926
- return;
927
- }
928
-
929
- function ondockeypress(e) {
930
- if (!xxdialogMode && xxcurrentView == 11 && desktop && desktop.State == 3) return desktop.m.handleKeys(e);
931
- if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) return terminal.m.TermHandleKeys(e);
932
- if (xxdialogMode || xxcurrentView != 1) return;
933
- if (e.ctrlKey == true && e.charCode == 96) {
934
- showHostnames = !showHostnames;
935
- Q('HostnameCheckBox').value = showHostnames;
936
- putstore("showHostnames", showHostnames ? 1 : 0);
937
- onSortSelectChange();
938
- return;
939
- }
940
- if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
941
- var processed = 0;
942
- if (e.key) {
943
- if (e.key.length === 1 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; }
944
- if (e.key === 'Backspace' && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; }
945
- if (e.key === 'Esc') { Q('SearchInput').value = ''; processed = 1; }
946
- } else {
947
- if (e.charCode != 0 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
948
- }
949
- if (processed > 0) { if (processed == 1) { onSearchInputChanged(); } if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
950
- }
951
-
952
- function ondockeydown(e) {
953
- if (!xxdialogMode && xxcurrentView == 11 && desktop && desktop.State == 3) return desktop.m.handleKeyDown(e);
954
- if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) return terminal.m.TermHandleKeyDown(e);
955
- if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
956
- var processed = 0;
957
- if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
958
- if (e.keyCode === 27) { Q('SearchInput').value = ''; processed = 1; }
959
- if (processed > 0) { if (processed == 1) { onSearchInputChanged(); } if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
960
- }
961
-
962
- function ondockeyup(e) {
963
- if (!xxdialogMode && xxcurrentView == 11 && desktop && desktop.State == 3) return desktop.m.handleKeyUp(e);
964
- if (!xxdialogMode && xxcurrentView == 12 && terminal && terminal.State == 3) return terminal.m.TermHandleKeyUp(e);
965
- if (xxdialogMode || xxcurrentView != 0 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
966
- if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
967
- }
968
-
969
- var deviceHeaderId = 0;
970
- var deviceHeaderCount;
971
- var deviceHeaders = {};
972
-
973
- function updateDevices() {
974
- var r = "", c = 0, current = null, count = 0, displayedMeshes = {};
975
- deviceHeaderId = 0;
976
- deviceHeaderCount = {};
977
- deviceHeaderTotal = 0;
978
- deviceHeaders = {};
979
- deviceHeadersTitles = {};
980
- for (var i in nodes) {
981
- if (nodes[i].v == false) continue;
982
- var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
983
- if (meshlinks == undefined) continue;
984
- if (sort == 0) {
985
- // Mesh header
986
- if (nodes[i].meshid != current) {
987
- deviceHeaderSet();
988
- var meshrights = meshlinks.rights;
989
- if (current != null) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } r += '</tr></table>'; }
990
- r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>';
991
- r += getMeshActions(mesh2, meshrights);
992
- r += '</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + nodes[i].meshid + '")>' + EscapeHtml(meshes[nodes[i].meshid].name) + '</span><span id=DevxHeader' + deviceHeaderId + ' class=devHeaderx></span></td></tr><tr>';
993
- current = nodes[i].meshid;
994
- displayedMeshes[current] = 1;
995
- c = 0;
996
- }
997
- } else if (sort == 1) {
998
- // Power header
999
- if (nodes[i].state != current) {
1000
- deviceHeaderSet();
1001
- if (current != null) { if (c == 2) { r += '<td><div style=width:301px></div></td>'; } r += '</tr></table>'; }
1002
- r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span>' + PowerStateStr2(nodes[i].state) + '</span><span id=DevxHeader' + deviceHeaderId + ' class="devHeaderx"></span></td></tr><tr>';
1003
- current = nodes[i].state;
1004
- c = 0;
1005
- }
1006
- } else if (sort == 2) {
1007
- // Device header
1008
- if (current == null) { r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr>'; current = '1'; }
1009
- }
1010
-
1011
- // Node positioning
1012
- if (c > 2) { r += '</tr><tr>'; c = 0; }
1013
- c++;
1014
- count++;
1015
-
1016
- var title = EscapeHtml(nodes[i].name);
1017
- if (nodes[i].host != undefined) title += " / " + EscapeHtml(nodes[i].host);
1018
- var name = EscapeHtml(nodes[i].name);
1019
- if (showHostnames == true && nodes[i].host != undefined) name = EscapeHtml(nodes[i].host);
1020
-
1021
- // Node
1022
- var icon = nodes[i].icon;
1023
- var nodestate = NodeStateStr(nodes[i]);
1024
- if ((!nodes[i].conn) || (nodes[i].conn == 0)) { icon += ' gray'; }
1025
- r += '<td><div id=devs style=width:301px;height:50px;padding-top:1px;padding-bottom:1px><div style=width:22px;height:50%;float:left;padding-top:12px><input class="' + nodes[i].meshid + ' DeviceCheckbox" onclick=p1updateInfo() value=devid_' + nodes[i]._id + ' type=checkbox></div><div style=height:100%;cursor:pointer onclick=gotoDevice(\'' + nodes[i]._id + '\')><div class="i' + icon + '" style=width:50px;float:left></div><div style=height:100%><div class=g1></div><div class=e2><div class=e1 title="' + title + '">' + name + '</div><div>' + nodestate + '</div></div><div class=g2></div></div></div></div></td>';
1026
- deviceHeaderTotal++;
1027
- if (typeof deviceHeaderCount[nodes[i].state] == 'undefined') { deviceHeaderCount[nodes[i].state] = 1; } else { deviceHeaderCount[nodes[i].state]++; }
1028
- }
1029
-
1030
- if (c == 2) r += '<td><div style=width:301px></div></td>'; // Adds device padding
1031
-
1032
- // Display all empty meshes, we need to do this because users can add devices to these at any time.
1033
- if (sort == 0 && Q('SearchInput').value == '') {
1034
- for (var i in meshes) {
1035
- var mesh = meshes[i], meshlink = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
1036
- if (meshlink != undefined) {
1037
- var meshrights = meshlink.rights;
1038
- if (displayedMeshes[mesh._id] == undefined) {
1039
- if (current != '') { r += '</tr></table>'; }
1040
- r += '<table style=width:100%;padding-top:4px cellpadding=0 cellspacing=0><tr><td colspan=3 class=DevSt><span style=float:right>';
1041
- r += getMeshActions(mesh, meshrights);
1042
- r += '</span><span id=MxMESH style=cursor:pointer onclick=gotoMesh("' + mesh._id + '")>' + EscapeHtml(mesh.name) + '</span></td></tr><tr>';
1043
- if (mesh.mtype == 1) {
1044
- r += '<td><div style=padding:10px><i>No Intel® AMT devices in this mesh';
1045
- if ((meshrights & 4) != 0) { r += ', <a style=cursor:pointer onclick=addDeviceToMesh(\"' + mesh._id + '\")>add one</a>'; }
1046
- }
1047
- if (mesh.mtype == 2) {
1048
- r += '<td><div style=padding:10px><i>No devices in this mesh';
1049
- if ((meshrights & 4) != 0) { r += ', <a style=cursor:pointer onclick=addAgentToMesh(\"' + mesh._id + '\")>add one</a>'; }
1050
- }
1051
- r += '.</i></div></td>';
1052
- current = mesh._id;
1053
- count++;
1054
- }
1055
- }
1056
- }
1057
- }
1058
- r += '</tr></table>';
1059
-
1060
- QH('xdevices', r);
1061
- deviceHeaderSet();
1062
- QV('NoNodesPanel', count == 0);
1063
-
1064
- for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
1065
- for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
1066
- }
1067
-
1068
- function getMeshActions(mesh, meshrights) {
1069
- if ((meshrights & 4) == 0) return '';
1070
- var r = '';
1071
- if (mesh.mtype == 1) {
1072
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the internet." onclick=addCiraDeviceToMesh(\"' + mesh._id + '\")>Add CIRA</a>';
1073
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new Intel® AMT computer that is located on the local network." onclick=addDeviceToMesh(\"' + mesh._id + '\")>Add Local</a>';
1074
- }
1075
- if (mesh.mtype == 2) {
1076
- r += ' <a style=cursor:pointer;font-size:10px title="Add a new computer to this mesh by installing the mesh agent." onclick=addAgentToMesh(\"' + mesh._id + '\")>Add Agent</a>';
1077
- }
1078
- return r;
1079
- }
1080
-
1081
- function addDeviceToMesh(meshid) {
1082
- if (xxdialogMode) return;
1083
- var mesh = meshes[meshid];
1084
- var x = "Add a new Intel® AMT device to mesh " + EscapeHtml(mesh.name) + ".<br /><br />";
1085
- x += addHtmlValue('Device Name', '<input id=dp1devicename style=width:230px maxlength=32 autocomplete=off onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1086
- x += addHtmlValue('Hostname', '<input id=dp1hostname style=width:230px maxlength=32 autocomplete=off placeholder="Same as device name" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1087
- x += addHtmlValue('Username', '<input id=dp1username style=width:230px maxlength=32 autocomplete=off placeholder="admin" onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1088
- x += addHtmlValue('Password', '<input id=dp1password type=password style=width:230px autocomplete=off maxlength=32 onchange=validateDeviceToMesh() onkeyup=validateDeviceToMesh() />');
1089
- x += addHtmlValue('Security', '<select id=dp1tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>');
1090
- setDialogMode(2, "Add Intel® AMT device", 3, addDeviceToMeshEx, x, meshid);
1091
- validateDeviceToMesh();
1092
- }
1093
-
1094
- function addCiraDeviceToMesh(meshid) {
1095
- if (xxdialogMode) return;
1096
- var mesh = meshes[meshid];
1097
- var meshidx = meshid.substring(5);
1098
- if (meshidx[0] == '/') meshidx = meshidx.substring(1);
1099
- var x = "To add a new Intel® AMT device to mesh " + EscapeHtml(mesh.name) + " with CIRA, load the following certificate as trusted root within Intel AMT, authenticate using a client certificate with the following common name and connect to the following server.<br /><br />";
1100
- x += addHtmlValue('Root Certificate', '<a href="MeshServerRootCert.cer" target="_blank">Root Certificate File</a>');
1101
- x += addHtmlValue('Organization', '<input style=width:230px readonly value="' + meshidx + '" />');
1102
- if (serverinfo != null) {
1103
- x += addHtmlValue('MPS Server', '<input style=width:230px readonly value="' + serverinfo.name + ':' + serverinfo.mpsport + '" />');
1104
- }
1105
- setDialogMode(2, "Add Intel® AMT CIRA device", 1, null, x);
1106
- }
1107
-
1108
- function addAgentToMesh(meshid) {
1109
- if (xxdialogMode) return;
1110
- var mesh = meshes[meshid];
1111
- var meshidx = meshid.substring(5);
1112
- if (meshidx[0] == '/') meshidx = meshidx.substring(1);
1113
- var x = "To add a new computer to mesh " + EscapeHtml(mesh.name) + ", download the mesh agent and configuration file and install the agent on the computer to manage.<br /><br />";
1114
- x += addHtmlValue('Mesh Agent', '<a href="meshagent?id=1" target="_blank">Windows executable (.exe)</a>');
1115
- x += addHtmlValue('Settings File', '<a href="meshsettings?id=' + meshid.split('/')[2] + '" target="_blank">' + EscapeHtml(mesh.name) + ' settings (.msh)</a>');
1116
- setDialogMode(2, "Add Mesh Agent", 1, null, x);
1117
- }
1118
-
1119
- function validateDeviceToMesh() {
1120
- QE('idx_dlgOkButton', (Q('dp1devicename').value.length > 0) && (passwordcheck(Q('dp1password').value)));
1121
- }
1122
-
1123
- function addDeviceToMeshEx(button, meshid) {
1124
- var amtuser = Q('dp1username').value;
1125
- if (amtuser == '') amtuser = 'admin';
1126
- var host = Q('dp1hostname').value;
1127
- if (host == '') host = Q('dp1devicename').value;
1128
- meshserver.Send({ action: 'addamtdevice', meshid: meshid, devicename: Q('dp1devicename').value, hostname: host, amtusername: amtuser, amtpassword: Q('dp1password').value, amttls: Q('dp1tls').value });
1129
- }
1130
-
1131
- function deviceHeaderSet() {
1132
- if (deviceHeaderId == 0) { deviceHeaderId = 1; return; }
1133
- deviceHeaders["DevxHeader" + deviceHeaderId] = ', ' + deviceHeaderTotal + ((deviceHeaderTotal == 1) ? ' node' : ' nodes');
1134
- var title = '';
1135
- for (x in deviceHeaderCount) { if (title.length > 0) title += ', '; title += deviceHeaderCount[x] + ' ' + PowerStateStr2(x); }
1136
- deviceHeadersTitles["DevxHeader" + deviceHeaderId] = title;
1137
- deviceHeaderId++;
1138
- deviceHeaderCount = {};
1139
- deviceHeaderTotal = 0;
1140
- }
1141
-
1142
- var powerStateStrings = ['', '<span title="Device is powered on.">Powered</span>', '<span title="Device is in sleep state (S1).">Sleeping</span>', '<span title="Device is in sleep state (S2).">Sleeping</span>', '<span title="Device is in deep sleep state (S3).">Deep Sleep</span>', '<span title="Device is in hibernating state (S4).">Hibernating</span>', '<span title="Device is in powered off state (S5).">Soft-Off</span>', '<span title="Device is detected but power state could not be obtained.">Present</span>'];
1143
- var powerStateStrings2 = ['', 'Device is powered', 'Device is in sleep state (S1)', 'Device is in sleep state (S2)', 'Device is in deep sleep state (S3)', 'Device is hibernating (S4)', 'Device is in soft-off state (S5)', 'Device is present, but power state cannot be determined'];
1144
- var powerColorTable = ['#00000000', 'black', 'blue', 'blue', 'lightblue', 'blueviolet', 'darkgreen', 'lightseagreen'];
1145
- function NodeStateStr(node) {
1146
- var states = [];
1147
- if (node.state > 0 && node.state < powerStatetable.length) state.push(powerStatetable[node.state]);
1148
- if (node.conn) {
1149
- if ((node.conn & 1) != 0) states.push('<span title="Mesh agent is connected and ready for use.">Agent</span>');
1150
- if ((node.conn & 2) != 0) states.push('<span title="Intel® AMT CIRA is connected and ready for use.">CIRA</span>');
1151
- if ((node.conn & 4) != 0) states.push('<span title="Intel® AMT is routable and ready for use.">AMT</span>');
1152
- if ((node.conn & 8) != 0) states.push('<span title="Mesh agent is reachable using another agent as relay.">Relay</span>');
1153
- }
1154
- if ((node.pwr != undefined) && (node.pwr != 0)) { states.push(powerStateStrings[node.pwr]); }
1155
- return states.join(', ');
1156
- }
1157
-
1158
- function PowerStateStr(x) {
1159
- if (x < powerStatetable.length) return powerStatetable[x];
1160
- return '';
1161
- }
1162
-
1163
- function PowerStateStr2(x) {
1164
- if ((x != 0) && (x < powerStatetable.length)) return powerStatetable[x];
1165
- return 'Unknown';
1166
- }
1167
-
1168
- function selectallButtonFunction() {
1169
- var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
1170
- for (var i in elements) { if (elements[i].checked) checkcount++; }
1171
- for (var i in elements) { elements[i].checked = (checkcount == 0); }
1172
- p1updateInfo();
1173
- }
1174
-
1175
- function p1updateInfo() {
1176
- var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
1177
- for (var i in elements) { if (elements[i].checked) checkcount++; }
1178
- if (checkcount > 0) {
1179
- QE('GroupActionButton', true);
1180
- Q('SelectAllButton').value = 'Select None';
1181
- QV('cxmgroupsplit', true);
1182
- QV('cxmdesktop', true);
1183
- } else {
1184
- QE('GroupActionButton', false);
1185
- Q('SelectAllButton').value = 'Select All';
1186
- QV('cxmgroupsplit', false);
1187
- QV('cxmdesktop', false);
1188
- }
1189
- }
1190
-
1191
- function groupActionFunction() {
1192
- // TODO
1193
- setDialogMode(2, "Group Action", 1, null, "This is a test");
1194
- }
1195
-
1196
- function onSortSelectChange() {
1197
- sort = document.getElementById("sortselect").selectedIndex;
1198
- putstore("sort", sort);
1199
- if (sort == 0) { nodes.sort(meshSort); }
1200
- if (sort == 1) { nodes.sort(powerSort); }
1201
- if (sort == 2) { if (showHostnames == true) { nodes.sort(deviceHostSort); } else { nodes.sort(deviceSort); } }
1202
- updateDevices();
1203
- }
1204
-
1205
- function meshSort(a, b) { if (a.meshnamel > b.meshnamel) return 1; if (a.meshnamel < b.meshnamel) return -1; if (a.meshid == b.meshid) { if (showHostnames == true) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } return 0; }
1206
- function powerSort(a, b) { if (a.state == b.state) { if (showHostnames == true) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } if (a.state > b.state) return 1; if (a.state < b.state) return -1; return 0; }
1207
- function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
1208
- function deviceHostSort(a, b) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; }
1209
- function onSearchInputChanged() { var x = Q('SearchInput').value.toLowerCase(); putstore("search", x); if (x == '') { for (var d in nodes) { nodes[d].v = true; } } else { for (var d in nodes) { nodes[d].v = (nodes[d].name.toLowerCase().indexOf(x) >= 0) || (nodes[d].hostl != undefined && nodes[d].hostl.toLowerCase().indexOf(x) >= 0); } } updateDevices(); }
1210
- function onSearchFocus(x) { searchFocus = x; }
1211
-
1212
- var contextelement = null;
1213
- function handleContextMenu(event) {
1214
- hideContextMenu();
1215
- var scrollLeft = (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
1216
- var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
1217
- var elem = document.elementFromPoint(event.pageX - scrollLeft, event.pageY - scrollTop);
1218
- if (elem && elem != null && elem.id == "MxMESH") {
1219
- contextelement = elem;
1220
- var contextmenudiv = document.getElementById("meshContextMenu");
1221
- contextmenudiv.style.left = event.pageX + "px";
1222
- contextmenudiv.style.top = event.pageY + "px";
1223
- contextmenudiv.style.display = "block";
1224
- } else {
1225
- while (elem && elem != null && elem.id != "devs") { elem = elem.parentElement; }
1226
- if (!elem || elem == null) return true;
1227
- contextelement = elem;
1228
- var contextmenudiv = document.getElementById("contextMenu");
1229
- contextmenudiv.style.left = event.pageX + "px";
1230
- contextmenudiv.style.top = event.pageY + "px";
1231
- contextmenudiv.style.display = "block";
1232
- }
1233
- event.preventDefault();
1234
- return false;
1235
- }
1236
-
1237
- function cmaction(action) {
1238
- var nodeid = contextelement.children[1].attributes.onclick.value;
1239
- nodeid = nodeid.substring(12, nodeid.length - 2);
1240
- if (action == 1) gotoDevice(nodeid, 10); // General
1241
- if (action == 2) gotoDevice(nodeid, 12); // Desktop
1242
- if (action == 3) gotoDevice(nodeid, 11); // Terminal
1243
- if (action == 4) gotoDevice(nodeid, 13); // Files
1244
- if (action == 5) gotoDevice(nodeid, 15); // Console
1245
- //if (action == 6) {
1246
- //var nodes = "";
1247
- //$(":checkbox").each(function () { if ($(this).is(':checked')) { nodes += ($(this).val() + ";"); } });
1248
- //window.location = "multidesktop.aspx?node=" + nodes + "&auto=1";
1249
- //}
1250
- }
1251
-
1252
- function cmmeshaction(action) {
1253
- var meshid = contextelement.attributes.onclick.value.substring(32, (32 + 69));
1254
- var elements = document.getElementsByClassName("DeviceCheckbox");
1255
- if (action == 1) { for (var i in elements) { if (elements[i].attributes && elements[i].attributes.class.value.substring(0, 69) == meshid) { elements[i].checked = true; } } }
1256
- if (action == 2) { for (var i in elements) { if (elements[i].attributes && elements[i].attributes.class.value.substring(0, 69) == meshid) { elements[i].checked = false; } } }
1257
- //if (action == 3) { window.location = "multidesktop.aspx?mesh=" + meshid + "&auto=1"; }
1258
- p1updateInfo();
1259
- }
1260
-
1261
- function hideContextMenu() {
1262
- QV('contextMenu', false);
1263
- QV('meshContextMenu', false);
1264
- contextelement = null;
1265
- }
1266
-
1267
- //
1268
- // MY DEVICE
1269
- //
1270
-
1271
- function refreshDevice(nodeid) {
1272
- if (!currentNode || currentNode._id != nodeid) return;
1273
- gotoDevice(nodeid, xxcurrentView, true);
1274
- }
1275
-
1276
- function getNodeRights(nodeid) {
1277
- var node = getNodeFromId(nodeid);
1278
- var mesh = meshes[node.meshid];
1279
- return mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
1280
- }
1281
-
1282
- var currentNode;
1283
- var powerTimelineNode = null;
1284
- var powerTimelineReq = null;
1285
- var powerTimelineUpdate = null;
1286
- var powerTimeline = null;
1287
- function getCurrentNode() { return currentNode; };
1288
- function gotoDevice(nodeid, panel, refresh) {
1289
- var node = getNodeFromId(nodeid);
1290
- var mesh = meshes[node.meshid];
1291
- var meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
1292
- if (!currentNode || currentNode._id != node._id || refresh == true) {
1293
- currentNode = node;
1294
-
1295
- // Add node name
1296
- var nname = EscapeHtml(node.name);
1297
- if ((meshrights & 4) != 0) { nname = '<span onclick=showEditNodeValueDialog(0) style=cursor:pointer>' + EscapeHtml(node.name) + '</span>'; }
1298
- QH('p10deviceName', nname);
1299
- QH('p11deviceName', nname);
1300
- QH('p12deviceName', nname);
1301
- QH('p13deviceName', nname);
1302
- QH('p14deviceName', nname);
1303
- QH('p15deviceName', nname);
1304
-
1305
- // Node attributes
1306
- var x = '<table style=width:100%>';
1307
-
1308
- // Attribute: Mesh
1309
- x += addDeviceAttribute('Mesh', '<a onclick=gotoMesh("' + node.meshid + '") style=cursor:pointer>' + EscapeHtml(meshes[node.meshid].name) + '</a>');
1310
-
1311
- // Attribute: Host
1312
- if ((mesh.mtype == 1) || (node.name != node.host)) {
1313
- if ((meshrights & 4) != 0) {
1314
- if (node.host) {
1315
- x += addDeviceAttribute('Hostname', '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer>' + EscapeHtml(node.host) + '</span>');
1316
- } else {
1317
- x += addDeviceAttribute('Hostname', '<span onclick=showEditNodeValueDialog(1) style=cursor:pointer><i>None</i></span>');
1318
- }
1319
- } else {
1320
- x += addDeviceAttribute('Hostname', EscapeHtml(node.host));
1321
- }
1322
- }
1323
-
1324
- // Attribute: Description
1325
- var description = node.desc?EscapeHtml(node.desc):"<i>None</i>";
1326
- if ((meshrights & 4) != 0) {
1327
- x += addDeviceAttribute('Description', '<span onclick=showEditNodeValueDialog(2) style=cursor:pointer>' + description + '</span>');
1328
- } else {
1329
- x += addDeviceAttribute('Description', description);
1330
- }
1331
-
1332
- // Attribute: Mesh Agent
1333
- var agentsStr = ['Unknown', 'Windows 32bit console', 'Windows 64bit console', 'Windows 32bit service', 'Windows 64bit service', 'Linux 32bit', 'Linux 64bit', 'MIPS', 'XENx86', 'Android ARM', 'Linux ARM', 'OSX 32bit', 'Android x86', 'PogoPlug ARM', 'Android APK', 'Linux Poky x86-32bit', 'OSX 64bit', 'ChromeOS', 'Linux Poky x86-64bit', 'Linux NoKVM x86-32bit', 'Linux NoKVM x86-64bit', 'Windows MinCore console', 'Windows MinCore service', 'NodeJS' ];
1334
- if ((node.agent != undefined) && (node.agent.id != undefined) && (node.agent.ver != undefined)) {
1335
- var str = '';
1336
- if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
1337
- str += ' v' + node.agent.ver;
1338
- x += addDeviceAttribute('Mesh Agent', str);
1339
- }
1340
-
1341
- // Attribute: Intel AMT
1342
- if (node.intelamt != undefined) {
1343
- var str = '';
1344
- if (node.intelamt.ver == undefined || node.intelamt.state == undefined) { str += '<i>Unknown Version & State</i>'; } else { str += ('v' + node.intelamt.ver); }
1345
- if (node.intelamt.user == undefined || node.intelamt.user == '') {
1346
- if ((meshrights & 4) != 0) {
1347
- str += ', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("' + node._id + '")>No Credentials</i>';
1348
- } else {
1349
- str += ', <i style=color:#FF0000>No Credentials</i>';
1350
- }
1351
- }
1352
- str += ' ';
1353
- if ((meshrights & 4) != 0) {
1354
- str += '<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
1355
- }
1356
- x += addDeviceAttribute('Intel® AMT', str);
1357
- }
1358
-
1359
- // Attribute: Intel AMT
1360
- //if (node.intelamt && node.intelamt.user) { x += addDeviceAttribute('Intel® AMT', node.intelamt.user); }
1361
-
1362
- // Attribute: Connectivity (Only show this if more than just the agent is connected).
1363
- var connectivity = node.conn;
1364
- if (connectivity && connectivity > 1) {
1365
- var cstate = [];
1366
- if ((node.conn & 1) != 0) cstate.push('<span title="Mesh agent is connected and ready for use.">Mesh Agent</span>');
1367
- if ((node.conn & 2) != 0) cstate.push('<span title="Intel® AMT CIRA is connected and ready for use.">Intel® AMT CIRA</span>');
1368
- if ((node.conn & 4) != 0) cstate.push('<span title="Intel® AMT is routable and ready for use.">Intel® AMT</span>');
1369
- if ((node.conn & 8) != 0) cstate.push('<span title="Mesh agent is reachable using another agent as relay.">Mesh Relay</span>');
1370
- x += addDeviceAttribute('Connectivity', cstate.join(', '));
1371
- }
1372
-
1373
- x += '</table>';
1374
- QH('p10html', x);
1375
-
1376
- // Show node last 7 days timeline
1377
- drawDeviceTimeline();
1378
-
1379
- // Show bottom buttons
1380
- x = '<div style=float:right;font-size:x-small>';
1381
- if ((meshrights & 4) != 0) x += '<a style=cursor:pointer onclick=p10showDeleteNodeDialog("' + node._id + '")>Delete Device</a>';
1382
- x += '</div><div style=font-size:x-small>';
1383
- x += '</div><br>'
1384
-
1385
- QH('p10html3', x);
1386
-
1387
- // Set the node power state
1388
- powerstate = PowerStateStr(node.state);
1389
- //if (node.state == 0) { powerstate = 'Unknown State'; }
1390
- if (node.agct && ((connectivity & 1) != 0)) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Agent connected since ' + new Date(node.agct).toLocaleString() + '">Agent connected</span>'; }
1391
- if (node.cict && ((connectivity & 2) != 0)) { if (powerstate.length > 0) { powerstate += '<br/>'; } powerstate += '<span style=font-size:12px title="Intel® AMT connected since ' + new Date(node.cict).toLocaleString() + '">Intel® AMT connected</span>'; }
1392
-
1393
- QH('MainComputerState', powerstate);
1394
-
1395
- // Set the node icon
1396
- Q('MainComputerImage').setAttribute("src", "images/icons200-" + node.icon + "-1.png");
1397
- Q('MainComputerImage').className = ((!node.conn) || (node.conn == 0)?'gray':'');
1398
-
1399
- // Setup/Refresh the desktop tab
1400
- setupDesktop();
1401
- setupTerminal();
1402
- setupFiles();
1403
- var consoleRights = ((meshrights & 16) != 0);
1404
- if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } }
1405
-
1406
- // Show or hide the tabs
1407
- // mesh.mtype: 1 = Intel AMT only, 2 = Mesh Agent
1408
- // node.agent.caps (bitmask): 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console
1409
- QV('MainDevDesktop', (mesh.mtype == 1) || (node.agent == undefined) || (node.agent.caps == undefined) || ((node.agent.caps & 1) != 0));
1410
- QV('MainDevTerminal', (mesh.mtype == 1) || (node.agent == undefined) || (node.agent.caps == undefined) || ((node.agent.caps & 2) != 0));
1411
- QV('MainDevFiles', (mesh.mtype == 2) && ((node.agent == undefined) || (node.agent.caps == undefined) || ((node.agent.caps & 4) != 0)));
1412
- QV('MainDevAmt', node.intelamt != undefined);
1413
- QV('MainDevConsole', consoleRights && (mesh.mtype == 2) && ((node.agent == undefined) || (node.agent.caps == undefined) || ((node.agent.caps & 8) != 0)));
1414
- QV('p15uploadCore', (node.agent != undefined) && (node.agent.caps != undefined) && ((node.agent.caps & 16) != 0));
1415
- QH('p15coreName', ((node.agent != undefined) && (node.agent.core != undefined))?node.agent.core:'');
1416
-
1417
- // Setup/Refresh Intel AMT tab
1418
- var amtFrameNode = Q('p14iframe').contentWindow.getCurrentMeshNode();
1419
- if ((amtFrameNode != null) && (amtFrameNode._id != currentNode._id)) { Q('p14iframe').contentWindow.disconnect(); }
1420
-
1421
- // Request the power timeline
1422
- if ((powerTimelineNode != currentNode._id) && (powerTimelineReq != currentNode._id)) { powerTimelineReq = currentNode._id; meshserver.Send({ action: 'powertimeline', nodeid: currentNode._id }); }
1423
- }
1424
- if (!panel) panel = 10;
1425
- go(panel);
1426
- }
1427
-
1428
- // Look to see if we need to update the device timeline
1429
- function updateDeviceTimeline() {
1430
- if ((meshserver.State != 2) || (powerTimelineNode == null) || (powerTimelineUpdate == null) || (currentNode == null)) return;
1431
- if ((powerTimelineNode == powerTimelineReq) && (currentNode._id == powerTimelineNode) && (powerTimelineUpdate < Date.now())) { powerTimelineUpdate = null; meshserver.Send({ action: 'powertimeline', nodeid: currentNode._id }); }
1432
- }
1433
-
1434
- // Draw device power bars. The bars are 766px wide.
1435
- function drawDeviceTimeline() {
1436
- var timeline = null, now = Date.now();
1437
- if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
1438
-
1439
- // Calculate when the timeline starts
1440
- var d = new Date();
1441
- d.setHours(0, 0, 0, 0);
1442
- d = new Date(d.getTime() - (1000 * 60 * 60 * 24 * 6));
1443
- var timelineStart = d.getTime();
1444
-
1445
- // De-compact the timeline
1446
- var timeline2 = [];
1447
- if (timeline != null && timeline.length > 1) {
1448
- timeline2.push([ 0, timeline[1], timeline[0] ]); // Start, End, Power
1449
- var ct = timeline[1];
1450
- for (var i = 2; i < timeline.length; i += 2) {
1451
- var power = timeline[i], dt = now;
1452
- if (timeline.length > (i + 1)) { dt = timeline[i + 1]; }
1453
- timeline2.push([ ct, ct + dt, power ]); // Start, End, Power
1454
- ct = ct + dt;
1455
- }
1456
- }
1457
-
1458
- // Draw the timeline
1459
- var x = '', count = 1, date = new Date();
1460
- date.setHours(0, 0, 0, 0);
1461
- for (var i = 0; i < 7; i++) {
1462
- var datavalue = '', start = date.getTime(), end = start + (1000 * 60 * 60 * 24);
1463
- for (var j in timeline2) {
1464
- var block = timeline2[j];
1465
- if (isTimeBlockInside(start, end, block[0], block[1]) == true) {
1466
- var ts = Math.max(start, block[0]);
1467
- var te = Math.min(Math.min(end, block[1]), now);
1468
- var width = Math.round((te - ts) / 112794);
1469
- if (width > 0) {
1470
- var title = powerStateStrings2[block[2]] + ' from ' + new Date(ts).toLocaleTimeString() + ' to ' + new Date(te).toLocaleTimeString() + '.';
1471
- datavalue += '<div title="' + title + '" style=display:table-cell;width:' + width + 'px;background-color:' + powerColor(block[2]) + ';height:16px></div>';
1472
- }
1473
- }
1474
- }
1475
- x += '<tr style=' + (((count % 2) == 0)?'background-color:#DDD':'') + '><td><div> ' + date.toLocaleDateString() + '<div></div></div></td><td><div>' + datavalue + '</div></td></tr>';
1476
- ++count;
1477
- date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
1478
- }
1479
- QH('p10html2', '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Power State</th></tr>' + x + '</tbody></table>');
1480
- }
1481
-
1482
- // Return a color for the given power state
1483
- function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'yellow'; }
1484
-
1485
- // Return true if the time block is visible within the start/end period
1486
- function isTimeBlockInside(start, end, blockStart, blockEnd) {
1487
- if ((blockStart < start) && (blockEnd > end)) return true; // Block is wider than timespan
1488
- if ((blockStart > start) && (blockStart < end)) return true;
1489
- if ((blockEnd > start) && (blockEnd < end)) return true;
1490
- return false;
1491
- }
1492
-
1493
- function addDeviceAttribute(name, value) { return '<tr><td class=style7 style=width:180px>' + name + '</td><td class=style9 style=max-width:400px;overflow:hidden>' + value + '</td></tr>'; }
1494
-
1495
- function editDeviceAmtSettings(nodeid, func) {
1496
- if (xxdialogMode) return;
1497
- var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid);
1498
- if ((meshrights & 4) == 0) return;
1499
- x += addHtmlValue('Username', '<input id=dp10username style=width:230px maxlength=32 autocomplete=nope placeholder="admin" onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
1500
- x += addHtmlValue('Password', '<input id=dp10password type=password style=width:230px autocomplete=nope maxlength=32 onchange=validateDeviceAmtSettings() onkeyup=validateDeviceAmtSettings() />');
1501
- x += addHtmlValue('Security', '<select id=dp10tls style=width:236px><option value=0>No TLS security</option><option value=1>TLS security required</option></select>');
1502
- if ((node.intelamt.user != undefined) && (node.intelamt.user != '')) { buttons = 7; }
1503
- setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func });
1504
- if ((node.intelamt.user != undefined) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; }
1505
- Q('dp10tls').value = node.intelamt.tls;
1506
- validateDeviceAmtSettings();
1507
- }
1508
-
1509
- function validateDeviceAmtSettings() {
1510
- QE('idx_dlgOkButton', passwordcheck(Q('dp10password').value));
1511
- }
1512
-
1513
- function editDeviceAmtSettingsEx(button, tag) {
1514
- if (button == 2) {
1515
- // Delete button pressed, remove credentials
1516
- meshserver.Send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: '', pass: '' } });
1517
- } else {
1518
- // Change Intel AMT credentials
1519
- var amtuser = Q('dp10username').value;
1520
- if (amtuser == '') amtuser = 'admin';
1521
- var amtpass = Q('dp10password').value;
1522
- if (amtpass == '') amtuser = '';
1523
- meshserver.Send({ action: 'changedevice', nodeid: tag.node._id, intelamt: { user: amtuser, pass: amtpass, tls: Q('dp10tls').value } });
1524
- tag.node.intelamt.user = amtuser;
1525
- tag.node.intelamt.tls = Q('dp10tls').value;
1526
- if (tag.func) { setTimeout(tag.func, 300); }
1527
- }
1528
- }
1529
-
1530
- function p10showDeleteNodeDialog(nodeid) {
1531
- if (xxdialogMode) return;
1532
- var x = "Are you sure you want to delete node \"" + EscapeHtml(currentNode.name) + "\"?<br /><br />";
1533
- x += "<input id=p10check type=checkbox onchange=p10validateDeleteNodeDialog() />Confirm";
1534
- setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid);
1535
- p10validateDeleteNodeDialog();
1536
- }
1537
-
1538
- function p10validateDeleteNodeDialog() {
1539
- QE('idx_dlgOkButton', Q('p10check').checked);
1540
- }
1541
-
1542
- function p10showDeleteNodeDialogEx(buttons, nodeid) {
1543
- meshserver.Send({ action: 'removedevice', nodeid: nodeid });
1544
- }
1545
-
1546
- function p10showiconselector() {
1547
- if (xxdialogMode) return;
1548
- var mesh = meshes[currentNode.meshid];
1549
- var meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
1550
- if ((meshrights & 4) == 0) return;
1551
-
1552
- var x = '<br><div style=display:inline-block;width:40px></div>';
1553
- x += '<div style=display:inline-block class=i1 onclick=p10setIcon(1)></div>';
1554
- x += '<div style=display:inline-block class=i2 onclick=p10setIcon(2)></div>';
1555
- x += '<div style=display:inline-block class=i3 onclick=p10setIcon(3)></div>';
1556
- x += '<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div>';
1557
- x += '<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>';
1558
- x += '<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div><br><br>';
1559
- setDialogMode(2, "Icon Selection", 0, null, x);
1560
- QV('id_dialogclose', true);
1561
- }
1562
-
1563
- function p10setIcon(icon) {
1564
- setDialogMode(0);
1565
- meshserver.Send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
1566
- }
1567
-
1568
- var showEditNodeValueDialog_modes = ['Device Name', 'Hostname', 'Description'];
1569
- var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc'];
1570
- function showEditNodeValueDialog(mode) {
1571
- if (xxdialogMode) return;
1572
- var x = addHtmlValue(showEditNodeValueDialog_modes[mode], '<input id=dp10devicevalue style=width:230px maxlength=32 onchange=p10editdevicevalueValidate(' + mode + ') onkeyup=p10editdevicevalueValidate(' + mode + ') />');
1573
- setDialogMode(2, "Edit Device", 3, showEditNodeValueDialogEx, x, mode);
1574
- var v = currentNode[showEditNodeValueDialog_modes2[mode]];
1575
- if (v == undefined) v = '';
1576
- Q('dp10devicevalue').value = v;
1577
- p10editdevicevalueValidate();
1578
- }
1579
-
1580
- function showEditNodeValueDialogEx(button, mode) {
1581
- var x = { action: 'changedevice', nodeid: currentNode._id };
1582
- x[showEditNodeValueDialog_modes2[mode]] = Q('dp10devicevalue').value;
1583
- meshserver.Send(x);
1584
- }
1585
-
1586
- function p10editdevicevalueValidate(mode) {
1587
- QE('idx_dlgOkButton', (mode > 1) || (Q('dp10devicevalue').value.length > 0));
1588
- }
1589
-
1590
- //
1591
- // DESKTOP
1592
- //
1593
-
1594
- var desktopNode;
1595
- function setupDesktop() {
1596
- // Setup the remote desktop
1597
- if (desktopNode == currentNode) return;
1598
- desktopNode = currentNode;
1599
- if (desktop) { desktop.Stop(); delete desktop; }
1600
- desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'));
1601
- desktop.onStateChanged = onDesktopStateChange;
1602
- QE('connectbutton1', true);
1603
- t = localStorage.getItem('desktopsettings');
1604
- if (t != null) { desktopsettings = JSON.parse(t); }
1605
- applyDesktopSettings();
1606
-
1607
- if (!Q('Desk')['toBlob']) { // On some browsers like IE, we can't save screen shots. Hide the scheenshot/capture buttons.
1608
- QV('deskSaveBtn', false);
1609
- }
1610
- }
1611
-
1612
- function connectDesktop(e) {
1613
- if (!desktop) return;
1614
- if (desktop.State == 0) {
1615
- if ((desktopNode.intelamt.user == undefined) || (desktopNode.intelamt.user == '')) { editDeviceAmtSettings(desktopNode._id, connectDesktop); return; }
1616
- desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
1617
- desktop.m.useZRLE = (desktopsettings.encoding < 3);
1618
- desktop.m.showmouse = desktopsettings.showmouse;
1619
- desktop.m.onScreenSizeChange = deskAdjust;
1620
- desktop.Start(desktopNode._id, 16994, '*', '*', 0);
1621
- } else {
1622
- desktop.Stop();
1623
- }
1624
- }
1625
-
1626
- function onDesktopStateChange(desktop, state) {
1627
- //console.log("onDesktopStateChange: " + state);
1628
- connectbutton1.value = (state == 0) ? 'Connect' : 'Disconnect';
1629
- Q('deskstatus').textContent = StatusStrs[state];
1630
- switch (state) {
1631
- case 0:
1632
- // desktop.m.ResetScreen();
1633
- break;
1634
- case 2:
1635
- break;
1636
- }
1637
- }
1638
-
1639
- function showDesktopSettings() {
1640
- setDialogMode(7, "Remote Desktop Settings", 3, showDesktopSettingsChanged);
1641
- }
1642
-
1643
- function showDesktopSettingsChanged() {
1644
- desktopsettings.encoding = d7desktopmode.value;
1645
- desktopsettings.showfocus = d7showfocus.checked;
1646
- desktopsettings.showmouse = d7showcursor.checked;
1647
- desktopsettings.showcad = d7showcad.checked;
1648
- localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
1649
- applyDesktopSettings();
1650
- if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = 'All Focus'; }
1651
- if (desktop.State != 0) { desktop.Stop(); setTimeout(connectDesktop, 50); }
1652
- }
1653
-
1654
- function applyDesktopSettings() {
1655
- d7desktopmode.value = desktopsettings.encoding;
1656
- d7showfocus.checked = desktopsettings.showfocus;
1657
- d7showcursor.checked = desktopsettings.showmouse;
1658
- d7showcad.checked = desktopsettings.showcad;
1659
- QV('deskFocusBtn', desktopsettings.showfocus);
1660
- QV('DeskCAD', desktopsettings.showcad);
1661
- }
1662
-
1663
- var fullscreen = false;
1664
- function deskToggleFull() {
1665
- fullscreen = !fullscreen;
1666
- QV('mastheadx', !fullscreen);
1667
- QV('masthead', !fullscreen);
1668
- QV('topbar', !fullscreen);
1669
- QV('p11deviceNameHeader', !fullscreen);
1670
- QV('footer', !fullscreen);
1671
- QV('column_l_bottomgap', !fullscreen);
1672
- QV('idx_deskFullBtn2', fullscreen);
1673
- QV('deskFullBtn', !fullscreen);
1674
- if (fullscreen) {
1675
- QS('container').width = '100%';
1676
- QS('container')['border-right'] = '0';
1677
- QS('container')['border-left'] = '0';
1678
- QS('column_l').padding = '0';
1679
- QS('column_l').width = '100%';
1680
- } else {
1681
- QS('container').width = '960px';
1682
- QS('container')['border-right'] = '1px solid #b7b7b7';
1683
- QS('container')['border-left'] = '1px solid #b7b7b7';
1684
- QS('column_l').padding = '0 15px';
1685
- QS('column_l').width = '930px';
1686
- }
1687
- deskAdjust();
1688
- }
1689
-
1690
- function deskToggleFocus() {
1691
- desktop.m.focusmode = (desktop.m.focusmode + 64) % 192;
1692
- Q('deskFocusBtn').value = ['All Focus', 'Small Focus', 'Large Focus'][desktop.m.focusmode / 64];
1693
- }
1694
-
1695
- function deskAdjust() {
1696
- console.log('deskAdjust');
1697
- var x = (Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - (Q('deskarea1').clientHeight + Q('deskarea2').clientHeight + Q('Desk').clientHeight + Q('deskarea4').clientHeight + 2)) / 2;
1698
- if (fullscreen) {
1699
- document.documentElement.style.overflow = 'hidden';
1700
- QS('deskarea3x').height = null;
1701
- if (x < 0) {
1702
- var mh = (Math.max(document.documentElement.clientHeight, window.innerHeight || 0) - (Q('deskarea1').clientHeight + Q('deskarea2').clientHeight + Q('deskarea4').clientHeight));
1703
- var mw = (desktop.m.width / desktop.m.height) * mh;
1704
- QS('Desk')['max-height'] = mh + 'px';
1705
- QS('Desk')['max-width'] = mw + 'px';
1706
- x = 0;
1707
- } else {
1708
- QS('Desk')['max-height'] = null;
1709
- QS('Desk')['max-width'] = null;
1710
- }
1711
- QS('Desk')['margin-top'] = x + 'px';
1712
- QS('Desk')['margin-bottom'] = x + 'px';
1713
- } else {
1714
- document.documentElement.style.overflow = 'auto';
1715
- QS('deskarea3x').height = '400px';
1716
- QS('Desk')['max-height'] = null;
1717
- QS('Desk')['max-width'] = null;
1718
- QS('Desk')['margin-top'] = '0';
1719
- QS('Desk')['margin-bottom'] = '0';
1720
- }
1721
- }
1722
-
1723
- // Send CTRL-ALT-DEL
1724
- function sendCAD() { desktop.m.sendcad(); }
1725
-
1726
- // Save the desktop image to file
1727
- function deskSaveImage() {
1728
- if (xxdialogMode || desktop.State != 3) return;
1729
- var n = 'Desktop', d = new Date();
1730
- if (amtsysstate) { n += "-" + amtsysstate['AMT_GeneralSettings'].response['HostName']; }
1731
- n += '-' + d.getFullYear() + "-" + ("0" + (d.getMonth() + 1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2);
1732
- Q("Desk")['toBlob'](function (blob) { saveAs(blob, n + ".jpg"); });
1733
- }
1734
-
1735
- // Send special keys
1736
- //function sendSpecialKey() { var k = Q('specialkeylist').value; desktop.m.sendkey(k, 1); desktop.m.sendkey(k, 0); }
1737
-
1738
- function dmousedown(e) { if (!xxdialogMode) desktop.m.mousedown(e) }
1739
- function dmouseup(e) { if (!xxdialogMode) desktop.m.mouseup(e) }
1740
- function dmousemove(e) { if (!xxdialogMode) desktop.m.mousemove(e) }
1741
-
1742
- function drotate(x) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); }
1743
-
1744
- //
1745
- // TERMINAL
1746
- //
1747
-
1748
- var terminalNode;
1749
- function setupTerminal() {
1750
- // Setup the terminal
1751
- var samenode = (terminalNode == currentNode);
1752
- terminalNode = currentNode;
1753
- var online = ((terminalNode.conn & 7) != 0)?true:false; // If Agent (1), CIRA (2) or AMT (3) connected, enable Terminal
1754
- QE('connectbutton2', online);
1755
- if (((samenode == false) || (online == false)) && terminal) { terminal.Stop(); delete terminal; terminal = undefined; }
1756
- }
1757
-
1758
- function onTerminalStateChange(terminal, state) {
1759
- connectbutton2.value = (state == 0) ? 'Connect' : 'Disconnect';
1760
- Q('termstatus').textContent = StatusStrs[state];
1761
- switch (state) {
1762
- case 0:
1763
- // Disconnected, clear the terminal
1764
- terminal.m.TermResetScreen();
1765
- terminal.m.TermDraw();
1766
- break;
1767
- case 3:
1768
- break;
1769
- }
1770
- }
1771
-
1772
- function connectTerminal(e) {
1773
- if (!terminal) {
1774
- // Take a look at the mesh for this node
1775
- var mesh = meshes[terminalNode.meshid];
1776
- if ((mesh.mtype == 1) && (terminalNode.intelamt != undefined)) {
1777
- // Setup the Intel AMT terminal
1778
- if ((terminalNode.intelamt.user == undefined) || (terminalNode.intelamt.user == '')) { editDeviceAmtSettings(terminalNode._id, connectTerminal); return; }
1779
- terminal = CreateAmtRedirect(CreateAmtRemoteTerminal('Term'));
1780
- terminal.onStateChanged = onTerminalStateChange;
1781
- terminal.Start(terminalNode._id, 16994, '*', '*', 0);
1782
- } else {
1783
- // Setup a mesh agent terminal
1784
- terminal = CreateAgentRedirect(meshserver, CreateAmtRemoteTerminal('Term'));
1785
- terminal.onStateChanged = onTerminalStateChange;
1786
- terminal.Start(terminalNode._id);
1787
- }
1788
- } else {
1789
- //QH('Term', '');
1790
- terminal.Stop();
1791
- delete terminal;
1792
- terminal = undefined;
1793
- }
1794
- }
1795
-
1796
- var terminalEmulations = ['UTF8 Terminal', 'Extended ASCII', 'Intel ASCII'];
1797
- function termToggleType() {
1798
- if (!terminal) return;
1799
- terminal.m.terminalEmulation = (terminal.m.terminalEmulation + 1) % 3;
1800
- Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
1801
- }
1802
-
1803
- var fxEmulations = ['Intel (F10 = ESC+[OM)', 'Alternate (F10 = ESC+0)', 'VT100+ (F10 = ESC+[OY)'];
1804
- function termToggleFx() {
1805
- if (!terminal) return;
1806
- terminal.m.fxEmulation = (terminal.m.fxEmulation + 1) % 3;
1807
- Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation];
1808
- }
1809
-
1810
- //
1811
- // FILES
1812
- //
1813
-
1814
- var filesNode;
1815
- function setupFiles() {
1816
- // Setup the files tab
1817
- var samenode = (filesNode == currentNode);
1818
- filesNode = currentNode;
1819
- var online = ((filesNode.conn & 1) != 0)?true:false; // If Agent (1) connected, enable Terminal
1820
- QE('p13Connect', online);
1821
- if (((samenode == false) || (online == false)) && files) { files.Stop(); delete files; files = undefined; }
1822
- }
1823
-
1824
- function onFilesStateChange(files, state) {
1825
- p13Connect.value = (state == 0) ? 'Connect' : 'Disconnect';
1826
- Q('p13Status').textContent = StatusStrs[state];
1827
- switch (state) {
1828
- case 0:
1829
- // Disconnected, clear the files
1830
- QH('p13files', '');
1831
- p13filetree = null;
1832
- p13filetreelocation = ['c:'];
1833
- QH('p13currentpath', '');
1834
- QE('p13FolderUp', false);
1835
- p13setActions();
1836
- break;
1837
- case 3:
1838
- files.Send(JSON.stringify({ action: 'ls', reqid: 1, path: 'c:\\' }));
1839
- break;
1840
- }
1841
- }
1842
-
1843
- function CreateRemoteFiles(onFileUpdate) {
1844
- var obj = { protocol: 5 };
1845
- obj.onFileUpdate = onFileUpdate;
1846
- obj.xxStateChange = function(state) { }
1847
- obj.ProcessData = function(data) { obj.onFileUpdate(data); }
1848
- return obj;
1849
- }
1850
-
1851
- function connectFiles(e) {
1852
- if (!files) {
1853
- // Setup a mesh agent files
1854
- files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles));
1855
- files.onStateChanged = onFilesStateChange;
1856
- files.Start(filesNode._id);
1857
- } else {
1858
- //QH('Term', '');
1859
- files.Stop();
1860
- delete files;
1861
- files = undefined;
1862
- }
1863
- }
1864
-
1865
- var p13filetree = null;
1866
- var p13filetreelocation = ['c:'];
1867
-
1868
- function p13gotFiles(data) {
1869
- p13filetree = JSON.parse(data);
1870
- p13updateFiles();
1871
- }
1872
-
1873
- function p13updateFiles() {
1874
- var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p13folderup(0)>Root</a>', fullPath = 'Root';
1875
-
1876
- // Save all existing checked boxes
1877
- var checkedBoxes = [], checkboxes = document.getElementsByName('fd');
1878
- for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedBoxes.push(checkboxes[i].value) }; } // Save all existing checked boxes
1879
-
1880
- // Work on parsing the file path
1881
- var oldlinkpath = p13filetreelocation.join('/');
1882
- p13filetree.path = p13filetree.path.replace(/\//g, "\\");
1883
- var x = p13filetree.path.split('\\');
1884
- p13filetreelocation = [];
1885
- for (var i in x) { if (x[i] != '') { p13filetreelocation.push(x[i]); } } // Remove empty spaces
1886
- for (var i in p13filetreelocation) { displayPath += ' / <a style=cursor:pointer onclick=p13folderup(' + (parseInt(i) + 1) + ')>' + p13filetreelocation[i] + '</a>' } // Setup the path we display
1887
- var newlinkpath = p13filetreelocation.join('/');
1888
-
1889
- // Sort the files
1890
- var filetreexx = p13sort_files(p13filetree.dir);
1891
-
1892
- // Display all files and folders at this location
1893
- for (var i in filetreexx) {
1894
- // Figure out the name and shortname
1895
- var f = filetreexx[i], name = f.n, shortname;
1896
- shortname = name;
1897
- if (name.length > 70) { shortname = '<span title="' + EscapeHtml(name) + '">' + EscapeHtml(name.substring(0, 70)) + "...</span>"; } else { shortname = EscapeHtml(name); }
1898
- name = EscapeHtml(name);
1899
-
1900
- // Figure out the date
1901
- var fdatestr = '';
1902
- if (f.d != undefined) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
1903
-
1904
- // Figure out the size
1905
- var fsize = '';
1906
- if (f.s != undefined) { fsize = getFileSizeStr(f.s); }
1907
-
1908
- var h = '';
1909
- if (f.t < 3) {
1910
- var right = '', title = '';
1911
- h = "<div class=filelist file=999><input style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='" + name + "'> <span style=float:right title=\"" + title + "\">" + right + "</span><span><div class=fileIcon" + f.t + "></div><a style=cursor:pointer onclick=p13folderset(\"" + encodeURIComponent(f.nx) + "\")>" + shortname + "</a></span></div>";
1912
- } else {
1913
- var link = shortname;
1914
- if (f.s > 0) { link = "<a target=_blank href=\"downloadfile.ashx?link=" + encodeURIComponent(filetreelinkpath + '/' + f.nx) + "\">" + shortname + "</a>"; }
1915
- h = "<div class=filelist file=3><input style=float:left name=fd class=fcb type=checkbox onchange=p13setActions() value='" + f.nx + "'> <span class=fsize>" + fdatestr + "</span><span style=float:right>" + fsize + "</span><span><div class=fileIcon" + f.t + "></div>" + link + "</span></div>";
1916
- }
1917
-
1918
- if (f.t < 3) { html1 += h; } else { html2 += h; }
1919
- }
1920
-
1921
- // Display the files and path
1922
- QH('p13files', html1 + html2);
1923
- QH('p13currentpath', displayPath);
1924
- QE('p13FolderUp', p13filetreelocation.length != 0);
1925
-
1926
- // Re-check all boxes if needed
1927
- if (oldlinkpath == newlinkpath) {
1928
- checkboxes = document.getElementsByName('fd');
1929
- for (var i = 0; i < checkboxes.length; i++) {
1930
- checkboxes[i].checked = (checkedBoxes.indexOf(checkboxes[i].value) >= 0);
1931
- }
1932
- }
1933
-
1934
- // Update the actions buttons
1935
- p13setActions();
1936
- }
1937
-
1938
- function p13folderset(x) { files.Send(JSON.stringify({ action: 'ls', reqid: 1, path: p13filetree.path + '/' + p13filetree.dir[x].n })); }
1939
-
1940
- function p13folderup(x) {
1941
- if (x == undefined) { p13filetreelocation.pop(); } else { while (p13filetreelocation.length > x) { p13filetreelocation.pop(); } }
1942
- files.Send(JSON.stringify({ action: 'ls', reqid: 1, path: p13filetreelocation.join('/') }));
1943
- }
1944
-
1945
- var p13sortorder;
1946
- function p13sort_filename(a, b) { if (a.ln > b.ln) return (1 * p13sortorder); if (a.ln < b.ln) return (-1 * p13sortorder); return 0; }
1947
- function p13sort_timestamp(a, b) { if (a.d > b.d) return (1 * p13sortorder); if (a.d < b.d) return (-1 * p13sortorder); return 0; }
1948
- function p13sort_bysize(a, b) { if (a.s == b.s) return p13sort_filename(a, b); return (((a.s - b.s)) * p13sortorder); }
1949
-
1950
- function p13sort_files(files) {
1951
- var r = [], sortselection = Q('p13sortdropdown').value;
1952
- for (var i in files) { files[i].nx = i; if (files[i].n == undefined) { files[i].n = i; } files[i].ln = files[i].n.toLowerCase(); r.push(files[i]); }
1953
- p13sortorder = 1;
1954
- if (sortselection > 3) { p13sortorder = -1; sortselection -= 3; }
1955
- if (sortselection == 1) { r.sort(p13sort_filename); }
1956
- else if (sortselection == 2) { r.sort(p13sort_bysize); }
1957
- else if (sortselection == 3) { r.sort(p13sort_timestamp); }
1958
- return r;
1959
- }
1960
-
1961
- function p13setActions() {
1962
- if (p13filetree == null) {
1963
- QE('p13DeleteFileButton', false);
1964
- QE('p13NewFolderButton', false);
1965
- QE('p13UploadButton', false);
1966
- QE('p13RenameFileButton', false);
1967
- QE('p13SelectAllButton', false)
1968
- Q('p13SelectAllButton').value = 'Select All';
1969
- } else {
1970
- var cc = p13getFileSelCount(), tc = p13getFileCount();
1971
- QE('p13DeleteFileButton', (cc > 0) && (p13filetreelocation.length > 0));
1972
- QE('p13NewFolderButton', p13filetreelocation.length > 0);
1973
- QE('p13UploadButton', p13filetreelocation.length > 0);
1974
- QE('p13RenameFileButton', (cc == 1) && (p13filetreelocation.length > 0));
1975
- QE('p13SelectAllButton', tc > 0)
1976
- Q('p13SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
1977
- }
1978
- }
1979
-
1980
- function p13getFileSelCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) cc++; } return cc; }
1981
- function p13getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); return checkboxes.length; }
1982
- function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); }
1983
- function p13createfolder() { setDialogMode(2, "New Folder", 3, p13createfolderEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck() style=width:100% />'); Q('p13renameinput').focus(); }
1984
- function p13createfolderEx() { meshserver.Send({ action: 'fileoperation', fileop: 'createfolder', path: filetreelocation, newfolder: Q('p13renameinput').value}); }
1985
- function p13deletefile() { var cc = getFileSelCount(); setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1)?('Delete ' + cc + ' selected items?'):('Delete selected item?')); }
1986
- function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(checkboxes[i].value); } } meshserver.Send({ action: 'fileoperation', fileop: 'delete', path: filetreelocation, delfiles: delfiles}); }
1987
- function p13renamefile() { var renamefile, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = checkboxes[i].value; } } setDialogMode(2, "Rename", 3, p13renamefileEx, '<input type=text id=p13renameinput maxlength=64 onkeyup=p13fileNameCheck() style=width:100% value="' + renamefile + '" />', { action: 'fileoperation', fileop: 'rename', path: filetreelocation, oldname: renamefile}); Q('p13renameinput').focus(); }
1988
- function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; meshserver.Send(t); }
1989
- function p13fileNameCheck() { QE('idx_dlgOkButton', isFilenameValid(Q('p13renameinput').value)); }
1990
- function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, '<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p13uploadpath value=\"' + encodeURIComponent(filetreelinkpath) + '\" /><input type=file name=files id=p13uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p13uploadinput\')" /><input type=submit id=p13loginSubmit style=display:none /></form>'); updateUploadDialogOk('p13uploadinput'); }
1991
- function p13uploadFileEx() { Q('p13loginSubmit').click(); }
1992
- function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); }
1993
-
1994
- function p13fileDragDrop(e) {
1995
- e.preventDefault();
1996
- e.stopPropagation();
1997
- QV('p13bigfail', false);
1998
- QV('p13bigok', false);
1999
- if (e.dataTransfer == null || e.dataTransfer.files.length == 0) return;
2000
- var names = [], sizes = [], types = [], datas = [], readercount = e.dataTransfer.files.length;
2001
- for (var i = 0; i < e.dataTransfer.files.length; i++) {
2002
- var reader = new FileReader(), file = e.dataTransfer.files[i];
2003
- names.push(file.name);
2004
- sizes.push(file.size);
2005
- types.push(file.type);
2006
- reader.onload = function(event) {
2007
- datas.push(event.target.result);
2008
- if (--readercount == 0) {
2009
- Q('p13fileDragName').value = names.join('*');
2010
- Q('p13fileDragSize').value = sizes.join('*');
2011
- Q('p13fileDragType').value = types.join('*');
2012
- Q('p13fileDragData').value = datas.join('*');
2013
- Q('p13fileDragLink').value = encodeURIComponent(filetreelinkpath);
2014
- Q('p13loginSubmit2').click();
2015
- }
2016
- }
2017
- reader.readAsDataURL(file);
2018
- }
2019
- }
2020
-
2021
- var p13dragtimer = null;
2022
- function p13fileDragOver(e) {
2023
- e.preventDefault();
2024
- e.stopPropagation();
2025
- if (p13dragtimer != null) { clearTimeout(p13dragtimer); p13dragtimer = null; }
2026
- var ac = true; // TODO: Set to true if we can accept the file
2027
- QV('p13bigok', ac);
2028
- QV('p13bigfail', !ac);
2029
- }
2030
-
2031
- function p13fileDragLeave(e) {
2032
- e.preventDefault();
2033
- e.stopPropagation();
2034
- if (e.target.id != "p13filetable") {
2035
- QV('p13bigfail', false);
2036
- QV('p13bigok', false);
2037
- } else {
2038
- p13dragtimer = setTimeout("QV('p13bigfail',false);QV('p13bigok',false);p13dragtimer=null;", 200);
2039
- }
2040
- }
2041
-
2042
- //
2043
- // MESH AGENT CONSOLE
2044
- //
2045
-
2046
- var consoleNode;
2047
- function setupConsole() {
2048
- // Setup the console
2049
- var samenode = (consoleNode == currentNode);
2050
- consoleNode = currentNode;
2051
-
2052
- var mesh = meshes[consoleNode.meshid];
2053
- var meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
2054
- if ((meshrights & 16) != 0) {
2055
- if (consoleNode.consoleText == undefined) { consoleNode.consoleText = ''; }
2056
- if (samenode == false) {
2057
- QH('p15agentConsole', consoleNode.consoleText);
2058
- Q('p15agentConsole').scrollTop = Q('p15agentConsole').scrollHeight;
2059
- }
2060
- var online = ((consoleNode.conn & 1) != 0)?true:false;
2061
- QH('p15statetext', online?"Mesh Agent is online":"Mesh Agent is offline");
2062
- QE('p15consoleText', online);
2063
- QE('p15uploadCore', online);
2064
- } else {
2065
- QH('p15statetext', 'Access Denied');
2066
- QE('p15consoleText', false);
2067
- QE('p15uploadCore', false);
2068
- }
2069
-
2070
- QV('p15uploadCore', (userinfo.siteadmin == 0xFFFFFFFF));
2071
- }
2072
-
2073
- // Clear the console for this node
2074
- function p15consoleClear() {
2075
- QH('p15agentConsole', '');
2076
- consoleNode.consoleText = '';
2077
- }
2078
-
2079
- // Send a command to to agent
2080
- var consoleHistory = [];
2081
- function p15consoleSend(e) {
2082
- if (e && e.keyCode != 13) return;
2083
- var v = Q('p15consoleText').value, t = '<div style=color:green>> ' + EscapeHtml(Q('p15consoleText').value) + '<br/></div>';
2084
- Q('p15agentConsole').innerHTML += t;
2085
- consoleNode.consoleText += t;
2086
- Q('p15agentConsole').scrollTop = Q('p15agentConsole').scrollHeight;
2087
- Q('p15consoleText').value = '';
2088
- Q('p15consoleText').focus();
2089
-
2090
- // Send the command to the mesh agent
2091
- meshserver.Send({ action: 'msg', type:'console', nodeid: consoleNode._id, value: v });
2092
-
2093
- // Add comment to history list
2094
- if (v.length > 0) {
2095
- // Move this command to the top if it already exists
2096
- var j = consoleHistory.indexOf(v);
2097
- if (j >= 0) { consoleHistory.splice(j, 1); }
2098
- consoleHistory.unshift(v);
2099
- consoleHistory.splice(10);
2100
-
2101
- // Clear the history from the drop down
2102
- var history = Q('p15history');
2103
- while (history.firstChild) { history.removeChild(history.firstChild); }
2104
-
2105
- // Put the new history of commands into the dropdown
2106
- for (var i in consoleHistory) {
2107
- var text = consoleHistory[i];
2108
- var option = document.createElement("option");
2109
- option.text = text;
2110
- history.appendChild(option);
2111
- }
2112
- }
2113
- }
2114
-
2115
- // Handle Mesh Agent console data
2116
- function p15consoleReceive(node, data) {
2117
- data = '<div>' + EscapeHtmlBreaks(data) + '</div>'
2118
- if (node.consoleText == undefined) { node.consoleText = data; } else { node.consoleText += data; }
2119
- if (consoleNode == node) {
2120
- Q('p15agentConsole').innerHTML += data;
2121
- Q('p15agentConsole').scrollTop = Q('p15agentConsole').scrollHeight;
2122
- }
2123
- }
2124
-
2125
- // Called then user presses the "Change Core" button
2126
- function p15uploadCore() {
2127
- if (xxdialogMode) return;
2128
- var x = '<select id=d3coreMode style=float:right;width:260px><option value=1>Upload default server core</option><option value=2>Clear the core</option><option value=3>Upload a core file</option></select><div>Change Core</div>';
2129
- setDialogMode(2, "Change Mesh Agent Core", 3, p15uploadCoreEx, x);
2130
- }
2131
-
2132
- function p15uploadCoreEx() {
2133
- if (Q('d3coreMode').value == 1) {
2134
- // Upload default core
2135
- meshserver.Send({ action: 'uploadagentcore', nodeid: consoleNode._id, path:'*' });
2136
- } else if (Q('d3coreMode').value == 2) {
2137
- // Clear the core
2138
- meshserver.Send({ action: 'uploadagentcore', nodeid: consoleNode._id });
2139
- } else if (Q('d3coreMode').value == 3) {
2140
- // Upload file as core
2141
- p15uploadCore2();
2142
- }
2143
- }
2144
-
2145
- // Called then user opts to upload a file as core
2146
- function p15uploadCore2() {
2147
- if (xxdialogMode) return;
2148
- Q('d3localmodeform').action = 'uploadmeshcorefile.ashx';
2149
- Q('d3attrib').value = currentNode._id;
2150
- setDialogMode(3, "Upload Mesh Agent Core", 3, p15uploadCoreEx2);
2151
- d3init();
2152
- }
2153
-
2154
- function p15uploadCoreEx2() {
2155
- var mode = Q('d3uploadMode').value;
2156
- if (mode == 1) {
2157
- // Upload local mesh agent core
2158
- Q('d3submit').click();
2159
- } else {
2160
- // Upload server mesh agent code
2161
- var files = d3getFileSel();
2162
- if (files.length == 1) { meshserver.Send({ action: 'uploadagentcore', nodeid: consoleNode._id, path: d3filetreelocation.join('/') + '/' + files[0] }); }
2163
- }
2164
- }
2165
-
2166
- //
2167
- // MY ACCOUNT
2168
- //
2169
-
2170
- function account_showDeleteAccount() {
2171
- if (xxdialogMode) return;
2172
- var x = "To delete this account, type in the account password in both boxes below and hit ok.<br /><br />";
2173
- x += "<form action='{{{domainurl}}}deleteaccount' method='post'><table style=margin-left:80px><tr>";
2174
- x += "<td align=right>Password:</td><td><input id=apassword1 type=password name=apassword1 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";
2175
- x += "</tr><tr>";
2176
- x += "<td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateDeleteAccount() onkeyup=account_validateDeleteAccount() /></td>";
2177
- x += '</tr></table><br /><div style="padding:10px;margin-bottom:4px">';
2178
- x += '<input id="account_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)">';
2179
- x += '<input id="account_dlgOkButton" type="submit" value="OK" style="float:right;width:80px" onclick="dialogclose(1)">';
2180
- x += '</div><br /></form>';
2181
- setDialogMode(2, "Delete Account", 0, null, x);
2182
- account_validateDeleteAccount();
2183
- }
2184
-
2185
- function account_showChangePassword() {
2186
- if (xxdialogMode) return;
2187
- var x = "Change your account password by entering the new password twice in the boxes below.<br /><br />";
2188
- x += "<form action='{{{domainurl}}}changepassword' method='post'><table style=margin-left:60px><tr>";
2189
- 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>";
2190
- x += "</tr><tr>";
2191
- x += "<td align=right>Password:</td><td><input id=apassword2 type=password name=apassword2 autocomplete=off onchange=account_validateNewPassword() onkeyup=account_validateNewPassword() /></td>";
2192
- x += '</tr></table><br /><div style="padding:10px;margin-bottom:4px">';
2193
- x += '<input id="account_dlgCancelButton" type="button" value="Cancel" style="float:right;width:80px;margin-left:5px" onclick="dialogclose(0)">';
2194
- x += '<input id="account_dlgOkButton" type="submit" value="OK" style="float:right;width:80px" onclick="dialogclose(1)">';
2195
- x += '</div><br /></form>';
2196
- setDialogMode(2, "Change Password", 0, null, x);
2197
- account_validateDeleteAccount();
2198
- }
2199
-
2200
- function account_createMesh() {
2201
- if (xxdialogMode) return;
2202
- var x = "Create a new mesh computer group using the options below.<br /><br />";
2203
- x += addHtmlValue('Mesh Name', '<input id=dp2meshname style=width:230px maxlength=32 onchange=account_validateMeshCreate() onkeyup=account_validateMeshCreate() />');
2204
- x += addHtmlValue('Mesh Type', '<div style=width:230px;margin:0;padding:0><select id=dp2meshtype style=width:100% onchange=account_validateMeshCreate() ><option value=2>Mesh Agent Policy</option><option value=1>Intel® AMT Agent-less Policy</option></select></div>');
2205
- x += addHtmlValue('Description', '<div style=width:230px;margin:0;padding:0><textarea id=dp2meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>');
2206
- setDialogMode(2, "Create Mesh", 3, account_createMeshEx, x);
2207
- account_validateMeshCreate();
2208
- }
2209
-
2210
- function account_validateMeshCreate() {
2211
- QE('idx_dlgOkButton', Q('dp2meshname').value.length > 0);
2212
- }
2213
-
2214
- function account_createMeshEx(button, tag) {
2215
- meshserver.Send({ action: 'createmesh', meshname: Q('dp2meshname').value, meshtype: Q('dp2meshtype').value, desc: Q('dp2meshdesc').value });
2216
- }
2217
-
2218
- function account_validateDeleteAccount() {
2219
- QE('account_dlgOkButton', (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value));
2220
- }
2221
-
2222
- function account_validateNewPassword() {
2223
- QE('account_dlgOkButton', (Q('apassword1').value.length > 0) && (Q('apassword1').value == Q('apassword2').value));
2224
- var r = '';
2225
- if (Q('apassword1').value != '') {
2226
- var passStrength = checkPasswordStrength(Q('apassword1').value);
2227
- if (passStrength >= 80) { r = '<span style=color:green>Strong<span>'; } else if (passStrength >= 60) { r = '<span style=color:blue>Good<span>'; } else { r = '<span style=color:red>Weak<span>'; }
2228
- }
2229
- QH('dxPassWarn', r);
2230
- }
2231
-
2232
- // Return a password strength score
2233
- function checkPasswordStrength(password) {
2234
- var r = 0, letters = {}, varCount = 0, variations = { digits: /\d/.test(password), lower: /[a-z]/.test(password), upper: /[A-Z]/.test(password), nonWords: /\W/.test(password) }
2235
- if (!password) return 0;
2236
- for (var i = 0; i< password.length; i++) { letters[password[i]] = (letters[password[i]] || 0) + 1; r += 5.0 / letters[password[i]]; }
2237
- for (var c in variations) { varCount += (variations[c] == true) ? 1 : 0; }
2238
- return parseInt(r + (varCount - 1) * 10);
2239
- }
2240
-
2241
- function updateMeshes() {
2242
- var r = '<table><tr>';
2243
- var c = 0, count = 0;
2244
- for (i in meshes) {
2245
- // Mesh positioning
2246
- if (c > 1) { r += '</tr><tr>'; c = 0; }
2247
- c++;
2248
- count++;
2249
-
2250
- // Mesh
2251
- var rights = 'Administrator'; // TODO
2252
- r += '<td><div style=width:431px;height:50px;padding-top:1px;padding-bottom:1px;float:left><div style=float:left;width:30px;height:100%></div><div style=height:100%;cursor:pointer onclick=gotoMesh(\'' + i + '\')><div class=mi style=float:left;width:50px;height:50px></div><div style=height:100%><div class=g1></div><div class=e2 style=width:300px><div class=e1>' + EscapeHtml(meshes[i].name) + '</div><div>' + rights + '</div></div><div class=g2 style=float:left></div></div></div></div></td>';
2253
- }
2254
- r += '</tr></table>';
2255
-
2256
- QH('p2meshes', r);
2257
- QV('p2noMeshFound', count == 0);
2258
- }
2259
-
2260
- function gotoMesh(meshid) {
2261
- currentMesh = meshes[meshid];
2262
- p20updateMesh();
2263
- go(20);
2264
- }
2265
-
2266
- function server_showRestoreDlg() {
2267
- if (xxdialogMode) return;
2268
- var x = 'Restore the server using a backup, <span style=color:red>this will delete the existing server data</span>. Only do this if you know what you are doing.<br /><br />';
2269
- x += '<form action="/restoreserver.ashx" enctype="multipart/form-data" method="post"><div>';
2270
- x += '<input id=account_dlgFileInput type=file name=datafile style=width:100% accept=".zip,application/octet-stream,application/zip,application/x-zip,application/x-zip-compressed" onchange=account_validateServerRestore()>';
2271
- x += '<input id=account_dlgCancelButton type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)>';
2272
- x += '<input id=account_dlgOkButton type=submit value=OK style=float:right;width:80px onclick=dialogclose(1)>';
2273
- x += '</div><br /><br /></form>';
2274
- setDialogMode(2, "Restore Server", 0, null, x);
2275
- account_validateServerRestore();
2276
- }
2277
-
2278
- function account_validateServerRestore() {
2279
- QE('account_dlgOkButton', Q('account_dlgFileInput').files.length == 1);
2280
- }
2281
-
2282
- //
2283
- // MY MESHS
2284
- //
2285
-
2286
- var currentMesh;
2287
- function p20updateMesh() {
2288
- QH('p20meshName', EscapeHtml(currentMesh.name));
2289
- var meshtype = 'Unknown #' + currentMesh.mtype;
2290
- var meshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
2291
- if (currentMesh.mtype == 1) meshtype = 'Intel® AMT computer group (No Agent)';
2292
- if (currentMesh.mtype == 2) meshtype = 'Mesh agent computer group';
2293
-
2294
- var x = '';
2295
- x += addHtmlValue('Name', addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh()', (meshrights & 1) != 0));
2296
- x += addHtmlValue('Description', addLinkConditional(((currentMesh.desc && currentMesh.desc != '')?EscapeHtml(currentMesh.desc):'<i>None</i>'), 'p20editmesh()', (meshrights & 1) != 0));
2297
- x += addHtmlValue('Type', meshtype);
2298
- x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]);
2299
-
2300
- x += '<br>';
2301
- var currentMeshLinks = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
2302
- if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += '<a onclick=p20showAddMeshUserDialog() style=cursor:pointer><img src=images/icon-addnew.png border=0 height=12 width=12> Add User</a>'; }
2303
- x += '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:left;width:430px>User Authorizations</th><th scope=col style=text-align:left></th></tr>';
2304
-
2305
- var count = 1;
2306
- for (var i in currentMesh.links) {
2307
- var rights = 'Partial Rights', r = currentMesh.links[i].rights, xusername = i.split('/')[2];
2308
- if (r == 0xFFFFFFFF) rights = 'Full Administrator'; else if (r == 0) rights = 'No Rights';
2309
- var trash = '';
2310
- if ((i != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0) && (rights != 0xFFFFFFFF)))) { trash = '<a onclick=p20deleteUser(event,"' + i + '") title="Remote user rights to this mesh" style=cursor:pointer><img src=images/trash.png border=0 height=10 width=10></a>'; }
2311
- x += '<tr onclick=p20viewuser("' + i + '") style=cursor:pointer' + (((count % 2) == 0)?';background-color:#DDD':'') + '><td><div title="Mesh User" class=m2></div><div> ' + xusername + '<div></div></div></td><td><div style=float:right>' + trash + '</div><div>' + rights + '</div></td></tr>';
2312
- ++count;
2313
- }
2314
-
2315
- x += '</tbody></table>';
2316
-
2317
- // If we are full administrator on this mesh, allow deletion of the mesh
2318
- if (meshrights == 0xFFFFFFFF) { x += '<div style=font-size:x-small;text-align:right><span><a onclick=p20showDeleteMeshDialog() style=cursor:pointer>Delete Mesh</a></span></div>'; }
2319
-
2320
- QH('p20info', x);
2321
- }
2322
-
2323
- function p20showDeleteMeshDialog() {
2324
- if (xxdialogMode) return;
2325
- var x = "Are you sure you want to delete mesh \"" + EscapeHtml(currentMesh.name) + "\"? Deleting the mesh will also delete all information about computers within this mesh.<br /><br />";
2326
- x += "<input id=p20check type=checkbox onchange=p20validateDeleteMeshDialog() />Confirm";
2327
- setDialogMode(2, "Delete Mesh", 3, p20showDeleteMeshDialogEx, x);
2328
- p20validateDeleteMeshDialog();
2329
- }
2330
-
2331
- function p20validateDeleteMeshDialog() {
2332
- QE('idx_dlgOkButton', Q('p20check').checked);
2333
- }
2334
-
2335
- function p20showDeleteMeshDialogEx(buttons, tag) {
2336
- meshserver.Send({ action: 'deletemesh', meshid: currentMesh._id, meshname: currentMesh.name });
2337
- }
2338
-
2339
- function p20editmesh() {
2340
- if (xxdialogMode) return;
2341
- x = "Create a new mesh computer group using the options below.<br /><br />";
2342
- x += addHtmlValue('Mesh Name', '<input id=dp20meshname style=width:230px maxlength=32 onchange=p20editmeshValidate() onkeyup=p20editmeshValidate() />');
2343
- x += addHtmlValue('Description', '<div style=width:230px;margin:0;padding:0><textarea id=dp20meshdesc maxlength=1024 style=width:100%;resize:none></textarea></div>');
2344
- setDialogMode(2, "Edit Mesh", 3, p20editmeshEx, x);
2345
- Q('dp20meshname').value = currentMesh.name;
2346
- if (currentMesh.desc) Q('dp20meshdesc').value = currentMesh.desc;
2347
- p20editmeshValidate();
2348
- }
2349
-
2350
- function p20editmeshEx() {
2351
- meshserver.Send({ action: 'editmesh', meshid: currentMesh._id, meshname: Q('dp20meshname').value, desc: Q('dp20meshdesc').value });
2352
- }
2353
-
2354
- function p20editmeshValidate() {
2355
- QE('idx_dlgOkButton', Q('dp20meshname').value.length > 0);
2356
- }
2357
-
2358
- function p20showAddMeshUserDialog() {
2359
- if (xxdialogMode) return;
2360
- x = "Allow a user to manage the mesh and computers on this mesh<br /><br />";
2361
- x += addHtmlValue('User Name', '<input id=dp20username style=width:230px maxlength=32 onchange=p20validateAddMeshUserDialog() onkeyup=p20validateAddMeshUserDialog() />');
2362
- x += '<br><div>';
2363
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20fulladmin>Full Administrator<br>';
2364
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20editmesh>Edit Mesh<br>';
2365
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20manageusers>Manage Mesh Users<br>';
2366
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20managecomputers>Manage Mesh Computers<br>';
2367
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20remotecontrol>Remote Control<br>';
2368
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshagentconsole>Mesh Agent Console<br>';
2369
- x += '<input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20meshserverfiles>Server Files<br>';
2370
- x += '</div>';
2371
- setDialogMode(2, "Add User to Mesh", 3, p20showAddMeshUserDialogEx, x);
2372
- p20validateAddMeshUserDialog();
2373
- }
2374
-
2375
- function p20validateAddMeshUserDialog() {
2376
- var meshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
2377
- QE('idx_dlgOkButton', (Q('dp20username').value.length > 0));
2378
- QE('p20fulladmin', meshrights == 0xFFFFFFFF);
2379
- QE('p20editmesh', (!Q('p20fulladmin').checked) && (meshrights == 0xFFFFFFFF));
2380
- QE('p20manageusers', !Q('p20fulladmin').checked);
2381
- QE('p20managecomputers', !Q('p20fulladmin').checked);
2382
- QE('p20remotecontrol', !Q('p20fulladmin').checked);
2383
- QE('p20meshagentconsole', !Q('p20fulladmin').checked);
2384
- QE('p20meshserverfiles', !Q('p20fulladmin').checked);
2385
- }
2386
-
2387
- function p20showAddMeshUserDialogEx() {
2388
- var meshadmin = 0;
2389
- if (Q('p20fulladmin').checked == true) { meshadmin = 0xFFFFFFFF; } else {
2390
- if (Q('p20editmesh').checked == true) meshadmin += 1;
2391
- if (Q('p20manageusers').checked == true) meshadmin += 2;
2392
- if (Q('p20managecomputers').checked == true) meshadmin += 4;
2393
- if (Q('p20remotecontrol').checked == true) meshadmin += 8;
2394
- if (Q('p20meshagentconsole').checked == true) meshadmin += 16;
2395
- if (Q('p20meshserverfiles').checked == true) meshadmin += 32;
2396
- }
2397
- meshserver.Send({ action: 'addmeshuser', meshid: currentMesh._id, meshname: currentMesh.name, username: Q('dp20username').value , meshadmin: meshadmin});
2398
- }
2399
-
2400
- function p20viewuser(userid) {
2401
- if (xxdialogMode) return;
2402
- var cmeshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights;
2403
- var meshrights = currentMesh.links[userid].rights;
2404
- var r = '';
2405
- if (meshrights == 0xFFFFFFFF) r = ', Full Administrator (all rights)'; else {
2406
- if ((meshrights & 1) != 0) r += ', Edit Mesh';
2407
- if ((meshrights & 2) != 0) r += ', Manage Mesh Users';
2408
- if ((meshrights & 4) != 0) r += ', Manage Mesh Computers';
2409
- if ((meshrights & 8) != 0) r += ', Remote Control';
2410
- if ((meshrights & 16) != 0) r += ', Agent Console';
2411
- if ((meshrights & 32) != 0) r += ', Server Files';
2412
- }
2413
- r = r.substring(2);
2414
- var x = addHtmlValue('User Name', userid.split('/')[2]);
2415
- x += addHtmlValue('Permissions', r);
2416
- var buttons = 1;
2417
- if ((('user/{{{domain}}}/' + userinfo.name.toLowerCase()) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4;
2418
- setDialogMode(2, "Mesh User", buttons, p20viewuserEx, x, userid);
2419
- }
2420
-
2421
- function p20viewuserEx(button, userid) {
2422
- if (button != 2) return;
2423
- setDialogMode(2, "Remote Mesh User", 3, p20viewuserEx2, "Confirm removal of user " + userid.split('/')[2] + "?", userid);
2424
- }
2425
-
2426
- function p20deleteUser(e, userid) {
2427
- haltEvent(e);
2428
- p20viewuserEx(2, userid);
2429
- }
2430
-
2431
- function p20viewuserEx2(button, userid) {
2432
- meshserver.Send({ action: 'removemeshuser', meshid: currentMesh._id, meshname: currentMesh.name, userid: userid});
2433
- }
2434
-
2435
- //
2436
- // MY FILES
2437
- //
2438
-
2439
- var filetreelinkpath;
2440
- var filetreelocation = [];
2441
-
2442
- function updateFiles() {
2443
- var html1 = '', html2 = '', displayPath = '<a style=cursor:pointer onclick=p5folderup(0)>Root</a>', fullPath = 'Root', publicPath, filetreex = filetree, folderdepth = 1;
2444
-
2445
- // Navigate to path location, build the paths at the same time
2446
- var filetreelocation2 = [], oldlinkpath = filetreelinkpath, checkedBoxes = [], checkboxes = document.getElementsByName('fc');
2447
- for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedBoxes.push(checkboxes[i].value) }; } // Save all existing checked boxes
2448
-
2449
- filetreelinkpath = '';
2450
- for (var i in filetreelocation) {
2451
- if ((filetreex.f != undefined) && (filetreex.f[filetreelocation[i]] != undefined)) {
2452
- filetreelocation2.push(filetreelocation[i]);
2453
- fullPath += ' / ' + filetreelocation[i];
2454
- if ((folderdepth == 1)) {
2455
- var sp = filetreelocation[i].split('/');
2456
- publicPath = window.location + sp[0] + 'files/' + sp[2];
2457
- //if (filetreelocation[i] === userinfo._id) { filetreelinkpath += 'self'; } else { filetreelinkpath += (sp[0] + '/' + sp[2]); }
2458
- filetreelinkpath += filetreelocation[i];
2459
- } else {
2460
- if (filetreelinkpath != '') { filetreelinkpath += '/' + filetreelocation[i]; if (folderdepth > 2) { publicPath += '/' + filetreelocation[i]; } }
2461
- }
2462
- filetreex = filetreex.f[filetreelocation[i]];
2463
- displayPath += ' / <a style=cursor:pointer onclick=p5folderup(' + folderdepth + ')>' + (filetreex.n != undefined?filetreex.n:filetreelocation[i]) + '</a>';
2464
- folderdepth++;
2465
- } else {
2466
- break;
2467
- }
2468
- }
2469
- filetreelocation = filetreelocation2; // In case we could not go down the full path, we set the new path location here.
2470
- var publicfolder = fullPath.toLowerCase().startsWith("root / " + userinfo._id + " / public");
2471
-
2472
- // Sort the files
2473
- var filetreexx = p5sort_files(filetreex.f);
2474
-
2475
- // Display all files and folders at this location
2476
- for (var i in filetreexx) {
2477
- // Figure out the name and shortname
2478
- var f = filetreexx[i], name = f.n, shortname;
2479
- shortname = name;
2480
- if (name.length > 70) { shortname = '<span title="' + EscapeHtml(name) + '">' + EscapeHtml(name.substring(0, 70)) + "...</span>"; } else { shortname = EscapeHtml(name); }
2481
- name = EscapeHtml(name);
2482
-
2483
- // Figure out the date
2484
- var fdatestr = '';
2485
- if (f.d != undefined) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + " "; }
2486
-
2487
- // Figure out the size
2488
- var fsize = '';
2489
- if (f.s != undefined) { fsize = getFileSizeStr(f.s); }
2490
-
2491
- var h = '';
2492
- if (f.t < 3) {
2493
- var right = (f.t == 1)?p5getQuotabar(f):'', title = '';
2494
- h = "<div class=filelist file=999><input style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='" + name + "'> <span style=float:right title=\"" + title + "\">" + right + "</span><span><div class=fileIcon" + f.t + "></div><a style=cursor:pointer onclick=p5folderset(\"" + encodeURIComponent(f.nx) + "\")>" + shortname + "</a></span></div>";
2495
- } else {
2496
- var link = shortname;
2497
- var publiclink = '';
2498
- if (publicfolder) { publiclink = ' (<a style=cursor:pointer title=\"Display public link\" onclick=\'p5showPublicLink(\"' + publicPath + '/' + f.nx + '\")\'>Link</a>)'; }
2499
- if (f.s > 0) { link = "<a target=_blank href=\"downloadfile.ashx?link=" + encodeURIComponent(filetreelinkpath + '/' + f.nx) + "\">" + shortname + "</a>" + publiclink; }
2500
- h = "<div class=filelist file=3><input style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='" + f.nx + "'> <span class=fsize>" + fdatestr + "</span><span style=float:right>" + fsize + "</span><span><div class=fileIcon" + f.t + "></div>" + link + "</span></div>";
2501
- }
2502
-
2503
- if (f.t < 3) { html1 += h; } else { html2 += h; }
2504
- }
2505
-
2506
- //if (f.parent == undefined) { }
2507
- QH('p5rightOfButtons', p5getQuotabar(filetreex));
2508
-
2509
- QH('p5files', html1 + html2);
2510
- QH('p5currentpath', displayPath);
2511
- QE('p5FolderUp', filetreelocation.length != 0);
2512
- QV('p5PublicShare', publicfolder);
2513
-
2514
- // Re-check all boxes if needed
2515
- if (oldlinkpath == filetreelinkpath) {
2516
- checkboxes = document.getElementsByName('fc');
2517
- for (var i = 0; i < checkboxes.length; i++) {
2518
- checkboxes[i].checked = (checkedBoxes.indexOf(checkboxes[i].value) >= 0);
2519
- }
2520
- }
2521
-
2522
- p5setActions();
2523
- }
2524
-
2525
- function p5getQuotabar(f) {
2526
- while (f.t > 1) { f = f.parent; }
2527
- if ((f.t != 1) || (f.maxbytes == undefined)) return '';
2528
- var tf = Math.floor(f.s / 1024), tq = Math.floor((f.maxbytes - f.s) / 1024);
2529
- return '<span title="' + tf + "k in " + f.c + " file" + (f.c > 1?'s':'') + ". " + (Math.floor(f.maxbytes / 1024)) + 'k maxinum">' + ((tq < 0)?('Storage limit exceed'):(tq + 'k remaining')) + ' <progress style=height:10px;width:200px value=' + f.s + ' max=' + f.maxbytes + ' /></span>';
2530
- }
2531
-
2532
- function p5showPublicLink(u) { setDialogMode(2, "Public Link", 1, null, '<input type=text style=width:100% value="' + u + '" readonly />'); }
2533
-
2534
- var sortorder;
2535
- function p5sort_filename(a, b) { if (a.ln > b.ln) return (1 * sortorder); if (a.ln < b.ln) return (-1 * sortorder); return 0; }
2536
- function p5sort_timestamp(a, b) { if (a.d > b.d) return (1 * sortorder); if (a.d < b.d) return (-1 * sortorder); return 0; }
2537
- function p5sort_bysize(a, b) { if (a.s == b.s) return p5sort_filename(a, b); return (((a.s - b.s)) * sortorder); }
2538
-
2539
- function p5sort_files(files) {
2540
- var r = [], sortselection = Q('p5sortdropdown').value;
2541
- for (var i in files) { files[i].nx = i; if (files[i].n == undefined) { files[i].n = i; } files[i].ln = files[i].n.toLowerCase(); r.push(files[i]); }
2542
- sortorder = 1;
2543
- if (sortselection > 3) { sortorder = -1; sortselection -= 3; }
2544
- if (sortselection == 1) { r.sort(p5sort_filename); }
2545
- else if (sortselection == 2) { r.sort(p5sort_bysize); }
2546
- else if (sortselection == 3) { r.sort(p5sort_timestamp); }
2547
- return r;
2548
- }
2549
-
2550
- function p5setActions() {
2551
- var cc = getFileSelCount(), tc = getFileCount();
2552
- QE('p5DeleteFileButton', (cc > 0) && (filetreelocation.length > 0));
2553
- QE('p5NewFolderButton', filetreelocation.length > 0);
2554
- QE('p5UploadButton', filetreelocation.length > 0);
2555
- QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0));
2556
- QE('p5SelectAllButton', tc > 0)
2557
- Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
2558
- }
2559
-
2560
- function getFileSelCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) cc++; } return cc; }
2561
- function getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); return checkboxes.length; }
2562
- function p5selectallfile() { var nv = (getFileSelCount() == 0), checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p5setActions(); }
2563
- function setupBackPointers(x) { if (x.f != undefined) { var fs = 0, fc = 0; for (var i in x.f) { setupBackPointers(x.f[i]); x.f[i].parent = x; if (x.f[i].s) { fs += x.f[i].s; } if (x.f[i].c) { fc += x.f[i].c; } if (x.f[i].t == 3) { fc++; } } x.s = fs; x.c = fc; } return x; }
2564
- function getFileSizeStr(size) { if (size == 1) return "1 byte"; return "" + size + " bytes"; }
2565
- function p5folderup(x) { if (x == undefined) { filetreelocation.pop(); } else { while (filetreelocation.length > x) { filetreelocation.pop(); } } updateFiles(); }
2566
- function p5folderset(x) { filetreelocation.push(decodeURIComponent(x)); updateFiles(); }
2567
- function p5createfolder() { setDialogMode(2, "New Folder", 3, p5createfolderEx, '<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck() style=width:100% />'); Q('p5renameinput').focus(); }
2568
- function p5createfolderEx() { meshserver.Send({ action: 'fileoperation', fileop: 'createfolder', path: filetreelocation, newfolder: Q('p5renameinput').value}); }
2569
- function p5deletefile() { var cc = getFileSelCount(); setDialogMode(2, "Delete", 3, p5deletefileEx, (cc > 1)?('Delete ' + cc + ' selected items?'):('Delete selected item?')); }
2570
- function p5deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(checkboxes[i].value); } } meshserver.Send({ action: 'fileoperation', fileop: 'delete', path: filetreelocation, delfiles: delfiles}); }
2571
- function p5renamefile() { var renamefile, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = checkboxes[i].value; } } setDialogMode(2, "Rename", 3, p5renamefileEx, '<input type=text id=p5renameinput maxlength=64 onkeyup=p5fileNameCheck() style=width:100% value="' + renamefile + '" />', { action: 'fileoperation', fileop: 'rename', path: filetreelocation, oldname: renamefile}); Q('p5renameinput').focus(); }
2572
- function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.Send(t); }
2573
- function p5fileNameCheck() { QE('idx_dlgOkButton', isFilenameValid(Q('p5renameinput').value)); }
2574
- var isFilenameValid = (function(){ var x1=/^[^\\/:\*\?"<>\|]+$/, x2=/^\./, x3=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i; return function isFilenameValid(fname){ return x1.test(fname)&&!x2.test(fname)&&!x3.test(fname)&&(fname[0] != '.'); } })();
2575
- function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, '<form method=post enctype=multipart/form-data action=uploadfile.ashx target=fileUploadFrame><input type=text name=link style=display:none id=p5uploadpath value=\"' + encodeURIComponent(filetreelinkpath) + '\" /><input type=file name=files id=p5uploadinput style=width:100% multiple=multiple onchange="updateUploadDialogOk(\'p5uploadinput\')" /><input type=submit id=p5loginSubmit style=display:none /></form>'); updateUploadDialogOk('p5uploadinput'); }
2576
- function p5uploadFileEx() { Q('p5loginSubmit').click(); }
2577
- function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); }
2578
-
2579
- function p5fileDragDrop(e) {
2580
- e.preventDefault();
2581
- e.stopPropagation();
2582
- QV('bigfail', false);
2583
- QV('bigok', false);
2584
- if (e.dataTransfer == null || e.dataTransfer.files.length == 0) return;
2585
- var names = [], sizes = [], types = [], datas = [], readercount = e.dataTransfer.files.length;
2586
- for (var i = 0; i < e.dataTransfer.files.length; i++) {
2587
- var reader = new FileReader(), file = e.dataTransfer.files[i];
2588
- names.push(file.name);
2589
- sizes.push(file.size);
2590
- types.push(file.type);
2591
- reader.onload = function(event) {
2592
- datas.push(event.target.result);
2593
- if (--readercount == 0) {
2594
- Q('p5fileDragName').value = names.join('*');
2595
- Q('p5fileDragSize').value = sizes.join('*');
2596
- Q('p5fileDragType').value = types.join('*');
2597
- Q('p5fileDragData').value = datas.join('*');
2598
- Q('p5fileDragLink').value = encodeURIComponent(filetreelinkpath);
2599
- Q('p5loginSubmit2').click();
2600
- }
2601
- }
2602
- reader.readAsDataURL(file);
2603
- }
2604
- }
2605
-
2606
- var p5dragtimer = null;
2607
- function p5fileDragOver(e) {
2608
- e.preventDefault();
2609
- e.stopPropagation();
2610
- if (p5dragtimer != null) { clearTimeout(p5dragtimer); p5dragtimer = null; }
2611
- var ac = true; // TODO: Set to true if we can accept the file
2612
- QV('bigok', ac);
2613
- QV('bigfail', !ac);
2614
- }
2615
-
2616
- function p5fileDragLeave(e) {
2617
- e.preventDefault();
2618
- e.stopPropagation();
2619
- if (e.target.id != "p5filetable") {
2620
- QV('bigfail', false);
2621
- QV('bigok', false);
2622
- } else {
2623
- p5dragtimer = setTimeout("QV('bigfail',false);QV('bigok',false);p5dragtimer=null;", 200);
2624
- }
2625
- }
2626
-
2627
- //
2628
- // MY EVENTS
2629
- //
2630
-
2631
- function events_update() {
2632
- var x = '', dateHeader = null;
2633
- for (var i in events) {
2634
- var event = events[i];
2635
- var time = new Date(event.time);
2636
- if (time.toLocaleDateString() != dateHeader) {
2637
- if (dateHeader != null) x += '</table>';
2638
- x += '<table style=width:100% cellpadding=0 cellspacing=0><tr><td class=DevSt>' + time.toLocaleDateString() + '</td></tr>';
2639
- dateHeader = time.toLocaleDateString();
2640
- }
2641
- var icon = 'si3';
2642
- if (event.etype == 'user') icon = 'm2';
2643
- if (event.etype == 'server') icon = 'si3';
2644
-
2645
- var msg = event.msg.split('(R)').join('®');
2646
- if (event.username && event.username != userinfo.name) { msg += ': ' + event.username; }
2647
- x += '<tr><td><div class=' + icon + ' style=float:left;width:16px;margin-top:2px;margin-left:2px;height:16px></div><div class=g1 style=height:18px></div><div class=bar18 style=height:18px;width:140px;font-size:14px>' + time.toLocaleTimeString() + '</div><div class=bar18 style=height:18px;width:724px;font-size:14px>' + msg + '</div><div class=g2 style=height:18px;float:left></div><div class=bar182 style=float:none></div></td></tr>';
2648
- }
2649
- if (dateHeader != null) x += '</table>';
2650
- if (x == '') x = "<br><i>No Events Found</i><br><br>";
2651
- QH('p3events', x);
2652
- }
2653
-
2654
- function showDeleteAllEventsDialog() {
2655
- if (xxdialogMode) return;
2656
- var x = "Delete all events in the server event log?<br /><br />";
2657
- x += "<input id=p3check type=checkbox onchange=validateDeleteAllEventsDialog() />Confirm";
2658
- setDialogMode(2, "Delete All Events", 3, showDeleteAllEventsDialogEx, x);
2659
- validateDeleteAllEventsDialog();
2660
- }
2661
-
2662
- function validateDeleteAllEventsDialog() {
2663
- QE('idx_dlgOkButton', Q('p3check').checked);
2664
- }
2665
-
2666
- function showDeleteAllEventsDialogEx(buttons, tag) {
2667
- meshserver.Send({ action: 'clearevents' });
2668
- }
2669
-
2670
-
2671
- //
2672
- // MY USERS
2673
- //
2674
-
2675
- function updateUsers() {
2676
- QV('MainMenuMyUsers', users != null);
2677
- if (users == null) { QH('p3users', ''); return; }
2678
- var x = '<table style=width:100% cellpadding=0 cellspacing=0>';
2679
- for (var i in users) {
2680
- var user = users[i], icon = 'm2', msg = '';
2681
- if (wssessions != null && wssessions[user._id]) {
2682
- var sessions = wssessions[user._id];
2683
- if (sessions == 1) { msg = '1 active session'; } else { msg = sessions + ' active sessions'; }
2684
- }
2685
- if (msg != '') msg += ', ';
2686
- if (user.name != userinfo.name) { msg += "<a onclick=showUserAdminDialog(event,\"" + user._id + "\")>"; }
2687
- if ((user.siteadmin == undefined) || (user.siteadmin == 0)) {
2688
- msg += "User";
2689
- } else if (user.siteadmin == 8) {
2690
- msg += "User with server files";
2691
- } else if (user.siteadmin == 0xFFFFFFFF) {
2692
- msg += "Full Admin";
2693
- } else {
2694
- msg += "Partial Admin";
2695
- }
2696
- if ((user.quota != undefined) && ((user.siteadmin & 8) != 0)) { msg += ", " + (user.quota / 1024) + " k"; }
2697
- if (user.name != userinfo.name) { msg += "</a>"; }
2698
- msg = '<table style="width:100%"><tr><td>' + EscapeHtml(user.name) + ', <a onclick=doemail(event,\"' + user.email + '\")>' + user.email + '</a><td align=right>' + msg + '</table>';
2699
- x += '<tr><td style=cursor:pointer onclick=showUserInfoDialog(\"' + user._id + '\")><div class=' + icon + ' style=float:left;width:16px;margin-top:4px;margin-left:2px;height:16px></div><div class=g1 style=height:24px></div><div class=bar style=height:24px;width:864px;font-size:medium>' + msg + '</div><div class=g2 style=height:24px;float:left></div><div class=bar2 style=float:none></div></td></tr>';
2700
- }
2701
- x += '</table>';
2702
- QH('p3users', x);
2703
- }
2704
-
2705
- function doemail(e, addr) {
2706
- if (xxdialogMode) return;
2707
- haltEvent(e);
2708
- window.open("mailto:" + addr);
2709
- return false;
2710
- }
2711
-
2712
- function showUserInfoDialog(userid) {
2713
- var user = users[userid], x = '';
2714
- if (xxdialogMode) return;
2715
- x += addHtmlValue('Name', EscapeHtml(user.name));
2716
- x += addHtmlValue('Email', EscapeHtml(user.email));
2717
- x += addHtmlValue('Creation', new Date(user.creation).toLocaleString());
2718
- if (user.login) x += addHtmlValue('Last Login', new Date(user.login).toLocaleString());
2719
- if (user.quota) x += addHtmlValue('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k');
2720
- var deletePossible = true;
2721
- if (user._id == userinfo._id) deletePossible = false;
2722
- if (user.siteadmin && user.siteadmin > 0 && userinfo.siteadmin != 0xFFFFFFFF) deletePossible = false;
2723
- setDialogMode(2, "User " + EscapeHtml(user.name), deletePossible?5:1, showUserInfoDialogDelete, x, user);
2724
- }
2725
-
2726
- function showUserInfoDialogDelete(button, user) {
2727
- if (button == 2) { meshserver.Send({ action: 'deleteuser', userid: user._id, username: user.name }); }
2728
- }
2729
-
2730
- function showCreateNewAccountDialog() {
2731
- if (xxdialogMode) return;
2732
- var x = '';
2733
- x += addHtmlValue('Name', '<input id=p4name style=width:230px maxlength=32 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
2734
- x += addHtmlValue('Email', '<input id=p4email style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
2735
- x += addHtmlValue('Password', '<input id=p4pass1 type=password style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
2736
- x += addHtmlValue('Password', '<input id=p4pass2 type=password style=width:230px maxlength=64 onchange=showCreateNewAccountDialogValidate() onkeyup=showCreateNewAccountDialogValidate() />');
2737
- setDialogMode(2, "Create Account", 3, showCreateNewAccountDialogEx, x);
2738
- showCreateNewAccountDialogValidate();
2739
- }
2740
-
2741
- function showCreateNewAccountDialogValidate() {
2742
- QE('idx_dlgOkButton', Q('p4name').value.length > 0 && Q('p4pass1').value.length > 0 && Q('p4pass1').value == Q('p4pass2').value);
2743
- }
2744
-
2745
- function showCreateNewAccountDialogEx() {
2746
- meshserver.Send({ action: 'adduser', username: Q('p4name').value, email: Q('p4email').value, pass: Q('p4pass1').value });
2747
- }
2748
-
2749
- function showUserAdminDialog(e, userid) {
2750
- if (xxdialogMode) return;
2751
- haltEvent(e);
2752
- var x = '<div>';
2753
- x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fileaccess>Server Files, <input type=number onchange=showUserAdminDialogValidate() maxlength=10 style=width:80px;text-align:right id=ua_fileaccessquota>k max, blank for default<br><hr/>';
2754
- x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_fulladmin>Full Administrator<br>';
2755
- x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverbackup>Server Backup<br>';
2756
- x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_serverrestore>Server Restore<br>';
2757
- x += '<input type=checkbox onchange=showUserAdminDialogValidate() id=ua_manageusers>Manage Users<br>';
2758
- x += '</div>';
2759
- var user = users[userid];
2760
- setDialogMode(2, "Site Permissions", 3, showUserAdminDialogEx, x, user);
2761
- if (user.siteadmin && user.siteadmin != 0) {
2762
- Q('ua_fulladmin').checked = (user.siteadmin == 0xFFFFFFFF);
2763
- Q('ua_serverbackup').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 1) != 0)); // Server Backup
2764
- Q('ua_manageusers').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 2) != 0)); // Manage Users
2765
- Q('ua_serverrestore').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 4) != 0)); // Server Restore
2766
- Q('ua_fileaccess').checked = ((user.siteadmin != 0xFFFFFFFF) && ((user.siteadmin & 8) != 0)); // Server Files
2767
- }
2768
- QE('ua_fulladmin', userinfo.siteadmin == 0xFFFFFFFF);
2769
- QE('ua_serverbackup', userinfo.siteadmin == 0xFFFFFFFF);
2770
- QE('ua_manageusers', userinfo.siteadmin == 0xFFFFFFFF);
2771
- QE('ua_serverrestore', userinfo.siteadmin == 0xFFFFFFFF);
2772
- QE('ua_fileaccess', userinfo.siteadmin == 0xFFFFFFFF);
2773
- Q('ua_fileaccessquota').value = (user.quota != undefined)?(user.quota / 1024):'';
2774
- showUserAdminDialogValidate();
2775
- return false;
2776
- }
2777
-
2778
- function showUserAdminDialogValidate() {
2779
- if (userinfo.siteadmin == 0xFFFFFFFF) {
2780
- QE('ua_serverbackup', !Q('ua_fulladmin').checked);
2781
- QE('ua_manageusers', !Q('ua_fulladmin').checked);
2782
- QE('ua_serverrestore', !Q('ua_fulladmin').checked);
2783
- QE('ua_fileaccess', !Q('ua_fulladmin').checked);
2784
- QE('ua_fileaccessquota', Q('ua_fileaccess').checked || Q('ua_fulladmin').checked);
2785
- }
2786
- }
2787
-
2788
- function showUserAdminDialogEx(button, user) {
2789
- var siteadmin = 0, quota = parseInt(Q('ua_fileaccessquota').value);
2790
- if (Q('ua_fulladmin').checked == true) { siteadmin = 0xFFFFFFFF; } else {
2791
- if (Q('ua_serverbackup').checked == true) siteadmin += 1;
2792
- if (Q('ua_manageusers').checked == true) siteadmin += 2;
2793
- if (Q('ua_serverrestore').checked == true) siteadmin += 4;
2794
- if (Q('ua_fileaccess').checked == true) siteadmin += 8;
2795
- }
2796
- var x = { action: 'edituser', name: user.name, siteadmin: siteadmin };
2797
- if (isNaN(quota) == false) { x.quota = (quota * 1024); }
2798
- meshserver.Send(x);
2799
- }
2800
-
2801
- //
2802
- // FILE SELECTOR, DIALOG 3
2803
- //
2804
-
2805
- function d3init() {
2806
- Q('d3localFile').value = '';
2807
- d3modechange();
2808
- }
2809
-
2810
- function d3modechange() {
2811
- var mode = Q('d3uploadMode').value;
2812
- QV('d3localmode', mode == 1);
2813
- QV('d3servermode', mode == 2);
2814
- if (mode == 1) { d3setActions(); } else { d3updatefiles(); }
2815
- }
2816
-
2817
- var d3filetreelinkpath;
2818
- var d3filetreelocation = [];
2819
-
2820
- function d3updatefiles() {
2821
- if (Q('d3uploadMode').value == 1) return;
2822
- var html1 = '', html2 = '', filetreex = filetree, folderdepth = 1;
2823
-
2824
- // Navigate to path location, build the paths at the same time
2825
- var d3filetreelocation2 = [], oldlinkpath = d3filetreelinkpath, checkedBoxes = [], checkboxes = document.getElementsByName('fc');
2826
- for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedBoxes.push(checkboxes[i].value) }; } // Save all existing checked boxes
2827
-
2828
- d3filetreelinkpath = '';
2829
- for (var i in d3filetreelocation) {
2830
- if ((filetreex.f != undefined) && (filetreex.f[d3filetreelocation[i]] != undefined)) {
2831
- d3filetreelocation2.push(d3filetreelocation[i]);
2832
- if ((folderdepth == 1)) {
2833
- var sp = d3filetreelocation[i].split('/');
2834
- publicPath = window.location + sp[0] + 'files/' + sp[2];
2835
- if (d3filetreelocation[i] === userinfo._id) { d3filetreelinkpath += 'self'; } else { d3filetreelinkpath += (sp[0] + '/' + sp[2]); }
2836
- } else {
2837
- if (d3filetreelinkpath != '') { d3filetreelinkpath += '/' + d3filetreelocation[i]; if (folderdepth > 2) { publicPath += '/' + d3filetreelocation[i]; } }
2838
- }
2839
- filetreex = filetreex.f[d3filetreelocation[i]];
2840
- folderdepth++;
2841
- } else {
2842
- break;
2843
- }
2844
- }
2845
- d3filetreelocation = d3filetreelocation2; // In case we could not go down the full path, we set the new path location here.
2846
-
2847
- // Sort the files
2848
- var filetreexx = p5sort_files(filetreex.f);
2849
-
2850
- // Display all files and folders at this location
2851
- for (var i in filetreexx) {
2852
- // Figure out the name and shortname
2853
- var f = filetreexx[i], name = f.n, shortname;
2854
- shortname = name;
2855
- if (name.length > 70) { shortname = '<span title="' + EscapeHtml(name) + '">' + EscapeHtml(name.substring(0, 70)) + "...</span>"; } else { shortname = EscapeHtml(name); }
2856
- name = EscapeHtml(name);
2857
-
2858
- // Figure out the size
2859
- var fsize = '';
2860
- if (f.s != undefined) { fsize = getFileSizeStr(f.s); }
2861
-
2862
- var h = '';
2863
- if (f.t < 3) {
2864
- var title = '';
2865
- h = "<div class=filelist file=999><span style=float:right title=\"" + title + "\"></span><span><div class=fileIcon" + f.t + "></div> <a style=cursor:pointer onclick=d3folderset(\"" + encodeURIComponent(f.nx) + "\")>" + shortname + "</a></span></div>";
2866
- } else {
2867
- var link = shortname;
2868
- //if (f.s > 0) { link = "<a target=_blank href=\"downloadfile.ashx?link=" + encodeURIComponent(filetreelinkpath + '/' + f.nx) + "\">" + shortname + "</a>"; }
2869
- h = "<div class=filelist file=3><input style=float:left name=fcx class=fcb type=checkbox onchange=d3setActions() value='" + f.nx + "'> <span style=float:right>" + fsize + "</span><span><div class=fileIcon" + f.t + "></div>" + link + "</span></div>";
2870
- }
2871
-
2872
- if (f.t < 3) { html1 += h; } else { html2 += h; }
2873
- }
2874
-
2875
- QH('d3serverfiles', html1 + html2);
2876
- QE('p3FolderUp', d3filetreelocation.length > 0);
2877
- d3setActions();
2878
- }
2879
-
2880
- function d3folderset(x) { d3filetreelocation.push(decodeURIComponent(x)); d3updatefiles(); }
2881
- function d3folderup(x) { if (x == undefined) { d3filetreelocation.pop(); } else { while (d3filetreelocation.length > x) { d3filetreelocation.pop(); } } d3updatefiles(); }
2882
- function d3getFileSel() { var cc = []; var checkboxes = document.getElementsByName('fcx'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { cc.push(checkboxes[i].value) } } return cc; }
2883
- function d3setActions() {
2884
- var mode = Q('d3uploadMode').value;
2885
- if (mode == 1) {
2886
- QE('idx_dlgOkButton', Q('d3localFile').value.length > 0);
2887
- } else {
2888
- QE('idx_dlgOkButton', d3getFileSel().length == 1);
2889
- }
2890
- }
2891
-
2892
- //
2893
- // NOTIFICATIONS
2894
- //
2895
-
2896
- var notifications = [];
2897
-
2898
- // Toggle showing notifications
2899
- function clickNotificationIcon(show) {
2900
- //addNotification({ icon:0, text:'test' });
2901
- if (show == true) { QV('notifiyBox', true); } else if (show == false) { QV('notifiyBox', false); } else { QV('notifiyBox', QS('notifiyBox')['display'] == 'none'); }
2902
- drawNotifications();
2903
- }
2904
-
2905
- // Set the notification count on the upper right oft he screen
2906
- function setNotificationCount(c) {
2907
- if (parseInt(Q('notificationCount').innerHTML) == c) return; // If the count did not change, exit now.
2908
- QH('notificationCount', c);
2909
- QS('notificationCount')['background-color'] = (c == 0)?'lightblue':'orange';
2910
- QV('notificationCount', c > 0);
2911
- }
2912
-
2913
- // Refresh the notification box
2914
- function drawNotifications() {
2915
- var r = '';
2916
- if (notifications.length == 0) {
2917
- r = '<div style=margin:5px>There are currently no notifications</div>';
2918
- } else {
2919
- for (var i in notifications) {
2920
- var n = notifications[i];
2921
- var t = '';
2922
- var d = new Date(n.time);
2923
- var icon = 0;
2924
- if (n.nodeid != undefined) {
2925
- var node = getNodeFromId(n.nodeid);
2926
- if (node != null) {
2927
- console.log(node);
2928
- icon = node.icon;
2929
- t = '<b>' + node.name + '</b>: '
2930
- }
2931
- }
2932
-
2933
- r += '<div title="Occured at ' + d.toLocaleString() + '" id="notifyx' + n.id + '" class=notification style="cursor:pointer;border-top:1px solid ' + ((r == '')?'transparent':'orange') + '"><div class=j' + icon + ' onclick="notificationSelected(' + n.id + ')" style=margin:5px;float:left></div><div onclick="notificationDelete(' + n.id + ')" class=unselectable title="Clear this notification" style=margin:5px;float:right;color:orange><b>X</b></div><div onclick="notificationSelected(' + n.id + ')" style=margin:5px>' + t + n.text + '</div></div>';
2934
- }
2935
- }
2936
- var deleteall = '';
2937
- if (notifications.length > 1) { deleteall = '<div id="notifyRemoveAll" onclick="deleteAllNotifications()" style="cursor:pointer;border-top:1px solid orange;margin:5px;color:orange;text-align:right;padding-right:3px">Clear all</div>'; }
2938
- QH('notifiyBox', '<div class=customScroll style="max-height:170px;overflow-y:auto;margin:5px">' + r + '</div>' + deleteall );
2939
- }
2940
-
2941
- // A notification was selected
2942
- function notificationSelected(id) {
2943
- var j = -1;
2944
- for (var i in notifications) { if (notifications[i].id == id) { j = i; } }
2945
- if (j != -1) {
2946
- var n = notifications[j];
2947
- if (n.nodeid != undefined) {
2948
- if (n.tag == 'desktop') gotoDevice(n.nodeid, 12); // Desktop
2949
- else if (n.tag == 'terminal') gotoDevice(n.nodeid, 11); // Terminal
2950
- else if (n.tag == 'files') gotoDevice(n.nodeid, 13); // Files
2951
- else if (n.tag == 'intelamt') gotoDevice(n.nodeid, 14); // Intel AMT
2952
- else if (n.tag == 'console') gotoDevice(n.nodeid, 15); // Files
2953
- else gotoDevice(n.nodeid, 10); // General
2954
- }
2955
- }
2956
- }
2957
-
2958
- // Remove one notification
2959
- function notificationDelete(id) {
2960
- var j = -1; e = Q('notifyx' + id);
2961
- if (e != null) {
2962
- for (var i in notifications) { if (notifications[i].id == id) { j = i; } }
2963
- if (j != -1) {
2964
- notifications.splice(j, 1);
2965
- e.parentNode.removeChild(e);
2966
- setNotificationCount(notifications.length);
2967
- if (notifications.length == 0) { QV('notifiyBox', false); }
2968
- if (notifications.length == 1) { QV('notifyRemoveAll', false); }
2969
- if ((notifications.length > 0) && (j == 0)) {
2970
- var n = notifications[0];
2971
- QS('notifyx' + n.id)['border-top'] = '1px solid transparent';
2972
- }
2973
- }
2974
- }
2975
- }
2976
-
2977
- // Add a new notification and play the notification sound
2978
- function addNotification(n) {
2979
- if (n.time == undefined) { n.time = Date.now(); }
2980
- if (n.id == undefined) { n.id = Math.random(); }
2981
- notifications.unshift(n);
2982
- setNotificationCount(notifications.length);
2983
- Q('chimes').play();
2984
- clickNotificationIcon(true);
2985
- }
2986
-
2987
- // Remove all notifications
2988
- function deleteAllNotifications() {
2989
- notifications = [];
2990
- setNotificationCount(0);
2991
- drawNotifications();
2992
- QV('notifiyBox', false);
2993
- }
2994
-
2995
- //
2996
- // POPUP DIALOG
2997
- //
2998
-
2999
- // undefined = Hidden, 1 = Generic Message
3000
- var xxdialogMode;
3001
- var xxdialogFunc;
3002
- var xxdialogButtons;
3003
- var xxdialogTag;
3004
- var xxcurrentView = 0;
3005
-
3006
- // Display a dialog box
3007
- // Parameters: Dialog Mode (0 = none), Dialog Title, Buttons (1 = OK, 2 = Cancel, 3 = OK & Cancel), Call back function(0 = Cancel, 1 = OK), Dialog Content (Mode 2 only)
3008
- function setDialogMode(x, y, b, f, c, tag) {
3009
- xxdialogMode = x;
3010
- xxdialogFunc = f;
3011
- xxdialogButtons = b;
3012
- xxdialogTag = tag;
3013
- QE('idx_dlgOkButton', true);
3014
- QV('idx_dlgOkButton', b & 1);
3015
- QV('idx_dlgCancelButton', b & 2);
3016
- QV('id_dialogclose', (b & 2) || (b & 8));
3017
- QV('idx_dlgDeleteButton', b & 4);
3018
- QV('idx_dlgButtonBar', b & 7);
3019
- if (y) QH('id_dialogtitle', y);
3020
- for (var i = 1; i < 24; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
3021
- QV('dialog', x);
3022
- if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
3023
- }
3024
-
3025
- function dialogclose(x) {
3026
- var f = xxdialogFunc;
3027
- var b = xxdialogButtons;
3028
- var t = xxdialogTag;
3029
- setDialogMode();
3030
- if (((b & 8) || x) && f) f(x, t);
3031
- }
3032
-
3033
- function center() { QS('dialog').left = ((((getDocWidth() - 400) / 2)) + "px"); deskAdjust(); }
3034
- function messagebox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
3035
- function statusbox(t, m) { QH('id_dialogMessage', m); setDialogMode(1, t); }
3036
- function getDocWidth() { if (window.innerWidth) return window.innerWidth; if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; return document.getElementsByTagName('body')[0].clientWidth; }
3037
-
3038
- function go(x) {
3039
- if (xxdialogMode || xxcurrentView == x) return;
3040
- // Edit this line when adding a new screen
3041
- for (var i = 0; i < 22; i++) { QV('p' + i, i == x); }
3042
- xxcurrentView = x;
3043
-
3044
- QV('topbar', x != 0);
3045
- if (x >= 10 && x < 20) { QS('MainMenuMyDevices')["background-color"] = "#606060"; } else { QS('MainMenuMyDevices')["background-color"] = ((x == 1) ? "#003366" : "#808080"); }
3046
- if (x >= 20 && x < 30) { QS('MainMenuMyAccount')["background-color"] = "#606060"; } else { QS('MainMenuMyAccount')["background-color"] = ((x == 2) ? "#003366" : "#808080"); }
3047
- QS('MainMenuMyEvents')["background-color"] = ((x == 3) ? "#003366" : "#808080");
3048
- QS('MainMenuMyUsers')["background-color"] = ((x == 4) ? "#003366" : "#808080");
3049
- QS('MainMenuMyFiles')["background-color"] = ((x == 5) ? "#003366" : "#808080");
3050
- QV('MainSubMenuSpan', x >= 10 && x < 20);
3051
- QS('MainDev')["background-color"] = ((x == 10) ? "#003366" : "#808080");
3052
- QS('MainDevDesktop')["background-color"] = ((x == 11) ? "#003366" : "#808080");
3053
- QS('MainDevTerminal')["background-color"] = ((x == 12) ? "#003366" : "#808080");
3054
- QS('MainDevFiles')["background-color"] = ((x == 13) ? "#003366" : "#808080");
3055
- QS('MainDevAmt')["background-color"] = ((x == 14) ? "#003366" : "#808080");
3056
- QS('MainDevConsole')["background-color"] = ((x == 15) ? "#003366" : "#808080");
3057
- QV('MeshSubMenuSpan', x >= 20 && x < 30);
3058
- QS('MeshGeneral')["background-color"] = ((x == 20) ? "#003366" : "#808080");
3059
- if (x == 15) { Q('p15consoleText').focus(); }
3060
- }
3061
-
3062
- // Generic methods
3063
- function putstore(name, val) { try { if (typeof (localStorage) === "undefined") return; localStorage.setItem(name, val); } catch (e) { } }
3064
- function getstore(name, val) { try { if (typeof (localStorage) === "undefined") return val; var v = localStorage.getItem(name); if (typeof (v) === "undefined") return val; return v; } catch (e) { return val; } }
3065
- function addLink(x, f) { return "<a style=cursor:pointer;color:darkblue;text-decoration:none onclick='" + f + "'>♦ " + x + "</a>"; }
3066
- function addLinkConditional(x, f, c) { if (c) return addLink(x, f); return x; }
3067
- function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
3068
- function addOption(q, t, i) { var option = document.createElement("option"); option.text = t; option.value = i; Q(q).add(option); }
3069
- function passwordcheck(p) { var re = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}/; return re.test(p); }
3070
- function methodcheck(r) { if (r && r != null && r.Body && r.Body.ReturnValueStr != "SUCCESS") { messagebox("Call Error", r.Header.Method + ": " + r.Body.ReturnValueStr.replace("_", " ")); return true; } return false; }
3071
- function TableStart() { return "<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"; }
3072
- function TableStart2() { return "<table cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"; }
3073
- function TableEntry(n, v) { return "<tr><td><p>" + n + "<td>" + v; }
3074
- function FullTable(x, e) { var r = TableStart(); for (i in x) { if (i && x[i]) r += TableEntry(i, x[i]); } return r + TableEnd(e); }
3075
- function TableEnd(n) { return "<tr><td colspan=2><p>" + (n?n:'') + "</table>"; }
3076
- function AddButton(v, f) { return "<input type=button value='" + v + "' onclick='" + f + "' style=margin:4px>"; }
3077
- function AddButton2(v, f) { return "<input type=button value='" + v + "' onclick='" + f + "'>"; }
3078
- function AddRefreshButton(f) { return "<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);" + f + "' style=margin:4px " + (refreshButtonsState==false?"disabled":"") + ">"; }
3079
- function MoreStart() { return "<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV(\"morexxx1\",false);QV(\"morexxx2\",true)>▼ More</a><div id=morexxx2 style=display:none><br><hr>"; };
3080
- function MoreEnd() { return "<a style=cursor:pointer;color:blue onclick=QV(\"morexxx2\",false);QV(\"morexxx1\",true)>▲ Less</a></div>"; };
3081
- function getSelectedOptions(sel) { var opts = [], opt; for (var i = 0, len = sel.options.length; i < len; i++) { opt = sel.options[i]; if (opt.selected) { opts.push(opt.value); } } return opts; }
3082
- function getInstance(x, y) { for (var i in x) { if (x[i]["InstanceID"] == y) return x[i]; } return null; }
3083
- function getItem(x, y, z) { for (var i in x) { if (x[i][y] == z) return x[i]; } return null; }
3084
- function guidToStr(g) { return g.substring(6, 8) + g.substring(4, 6) + g.substring(2, 4) + g.substring(0, 2) + "-" + g.substring(10, 12) + g.substring(8, 10) + "-" + g.substring(14, 16) + g.substring(12, 14) + "-" + g.substring(16, 20) + "-" + g.substring(20); }
3085
- function getUrlVars() { var j, hash, vars = [], hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { j = hashes[i].indexOf('='); if (j > 0) { vars[hashes[i].substring(0, j)] = hashes[i].substring(j + 1, hashes[i].length); } } return vars; }
3086
- function getDocWidth() { if (window.innerWidth) return window.innerWidth; if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; return document.getElementsByTagName('body')[0].clientWidth; }
3087
- //function addHtmlValue(t, v) { return '<div style=height:20px><div style=float:right;width:220px><b>' + v + '</b></div><div>' + t + '</div></div>'; }
3088
- function addHtmlValue(t, v) { return '<table><td style=width:120px>' + t + '<td><b>' + v + '</b></table>'; }
3089
- </script>
3090
-</body>
3091
-</html>
public/relay.htm
deleted
-10
@@ -1,10 +0,0 @@
1
-<html>
2
-<head>
3
- <script type="text/javascript" src="relay.js"></script>
4
-</head>
5
-<body>
6
- <script>
7
- var relay = createMeshConnection('0D49FDEFFB778D40C062DD34A3E96113:1485387591408:b2970207326684b4de5375d097db23c85e64497eaa72013b56a8ecd8063fb9b3').connect();
8
- </script>
9
-</body>
10
-</html>
\ No newline at end of file
public/relay.js
deleted
-48
@@ -1,48 +0,0 @@
1
-/**
2
-* @fileoverview Dynamic interface to MeshCentral2
3
-* @author Ylian Saint-Hilaire
4
-* @version v0.0.1
5
-*/
6
-
7
-var createMeshConnection = function (connectionId) {
8
- var obj = {};
9
- obj.connectionId = connectionId;
10
- obj.state = 0;
11
- obj.websocket = null;
12
- obj.onStateChanged = null;
13
- obj.onData = null;
14
-
15
- obj.connect = function () {
16
- if (obj.state == 0) {
17
- obj.websocket = new WebSocket(window.location.protocol.replace('http', 'ws') + '//' + window.location.host + '/meshrelay.ashx?id=' + obj.connectionId);
18
- obj.websocket.binaryType = "arraybuffer";
19
- obj.websocket.onopen = function (e) { console.log('WebSocket Connected', e); };
20
- obj.websocket.onmessage = function (e) {
21
- console.log('WebSocket Message', e);
22
- if ((obj.state = 1) && (e.data == 'c')) {
23
- obj.state = 2;
24
- if (obj.onStateChanged) { onStateChanged(obj, 2); }
25
- console.log('WebSocket Peer Connection', e);
26
- obj.send('bob');
27
- } else {
28
- if (obj.onData != null) { obj.onData(obj, e.data); }
29
- }
30
- };
31
- obj.websocket.onclose = function (e) {
32
- console.log('WebSocket Closed', e);
33
- obj.state = 0;
34
- if (obj.onStateChanged) { onStateChanged(obj, 0); }
35
- };
36
- obj.websocket.onerror = function (e) { console.log('WebSocket Error', e); };
37
- obj.state = 1;
38
- if (obj.onStateChanged) { onStateChanged(obj, 1); }
39
- }
40
- return obj;
41
- };
42
-
43
- obj.send = function (data) {
44
- if ((obj.state == 2) && (obj.websocket != null)) { obj.websocket.send(data); }
45
- };
46
-
47
- return obj;
48
-}
\ No newline at end of file
public/scripts/inflate.js
deleted
-732
@@ -1,732 +0,0 @@
1
- /*
2
- * Port of script by Masanao Izumo.
3
- *
4
- * Wrapped all the variables in a function, created a
5
- * constructor for interacting with the lib. Everything
6
- * else was written by M. Izumo.
7
- *
8
- * Original code can be found here: http://www.onicos.com/staff/iz/amuse/javascript/expert/inflate.txt
9
- *
10
- */
11
-
12
- var zip_WSIZE = 32768; // Sliding Window size
13
- var zip_STORED_BLOCK = 0;
14
- var zip_STATIC_TREES = 1;
15
- var zip_DYN_TREES = 2;
16
-
17
- /* for inflate */
18
- var zip_lbits = 9; // bits in base literal/length lookup table
19
- var zip_dbits = 6; // bits in base distance lookup table
20
- var zip_INBUFSIZ = 32768; // Input buffer size
21
- var zip_INBUF_EXTRA = 64; // Extra buffer
22
-
23
- /* variables (inflate) */
24
- var zip_slide;
25
- var zip_wp; // current position in slide
26
- var zip_fixed_tl = null; // inflate static
27
- var zip_fixed_td; // inflate static
28
- var zip_fixed_bl, fixed_bd; // inflate static
29
- var zip_bit_buf; // bit buffer
30
- var zip_bit_len; // bits in bit buffer
31
- var zip_method;
32
- var zip_eof;
33
- var zip_copy_leng;
34
- var zip_copy_dist;
35
- var zip_tl, zip_td; // literal/length and distance decoder tables
36
- var zip_bl, zip_bd; // number of bits decoded by tl and td
37
-
38
- var zip_inflate_data;
39
- var zip_inflate_pos;
40
-
41
-
42
- /* constant tables (inflate) */
43
- var zip_MASK_BITS = new Array(
44
- 0x0000,
45
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
46
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff);
47
- // Tables for deflate from PKZIP's appnote.txt.
48
- var zip_cplens = new Array( // Copy lengths for literal codes 257..285
49
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
50
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0);
51
- /* note: see note #13 above about the 258 in this list. */
52
- var zip_cplext = new Array( // Extra bits for literal codes 257..285
53
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
54
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99); // 99==invalid
55
- var zip_cpdist = new Array( // Copy offsets for distance codes 0..29
56
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
57
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
58
- 8193, 12289, 16385, 24577);
59
- var zip_cpdext = new Array( // Extra bits for distance codes
60
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
61
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
62
- 12, 12, 13, 13);
63
- var zip_border = new Array( // Order of the bit length code lengths
64
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15);
65
- /* objects (inflate) */
66
-
67
- function zip_HuftList() {
68
- this.next = null;
69
- this.list = null;
70
- }
71
-
72
- function zip_HuftNode() {
73
- this.e = 0; // number of extra bits or operation
74
- this.b = 0; // number of bits in this code or subcode
75
-
76
- // union
77
- this.n = 0; // literal, length base, or distance base
78
- this.t = null; // (zip_HuftNode) pointer to next level of table
79
- }
80
-
81
- function zip_HuftBuild(b, // code lengths in bits (all assumed <= BMAX)
82
- n, // number of codes (assumed <= N_MAX)
83
- s, // number of simple-valued codes (0..s-1)
84
- d, // list of base values for non-simple codes
85
- e, // list of extra bits for non-simple codes
86
- mm // maximum lookup bits
87
- ) {
88
- this.BMAX = 16; // maximum bit length of any code
89
- this.N_MAX = 288; // maximum number of codes in any set
90
- this.status = 0; // 0: success, 1: incomplete table, 2: bad input
91
- this.root = null; // (zip_HuftList) starting table
92
- this.m = 0; // maximum lookup bits, returns actual
93
-
94
- /* Given a list of code lengths and a maximum table size, make a set of
95
- tables to decode that set of codes. Return zero on success, one if
96
- the given code set is incomplete (the tables are still built in this
97
- case), two if the input is invalid (all zero length codes or an
98
- oversubscribed set of lengths), and three if not enough memory.
99
- The code with value 256 is special, and the tables are constructed
100
- so that no bits beyond that code are fetched when that code is
101
- decoded. */
102
- {
103
- var a; // counter for codes of length k
104
- var c = new Array(this.BMAX + 1); // bit length count table
105
- var el; // length of EOB code (value 256)
106
- var f; // i repeats in table every f entries
107
- var g; // maximum code length
108
- var h; // table level
109
- var i; // counter, current code
110
- var j; // counter
111
- var k; // number of bits in current code
112
- var lx = new Array(this.BMAX + 1); // stack of bits per table
113
- var p; // pointer into c[], b[], or v[]
114
- var pidx; // index of p
115
- var q; // (zip_HuftNode) points to current table
116
- var r = new zip_HuftNode(); // table entry for structure assignment
117
- var u = new Array(this.BMAX); // zip_HuftNode[BMAX][] table stack
118
- var v = new Array(this.N_MAX); // values in order of bit length
119
- var w;
120
- var x = new Array(this.BMAX + 1);// bit offsets, then code stack
121
- var xp; // pointer into x or c
122
- var y; // number of dummy codes added
123
- var z; // number of entries in current table
124
- var o;
125
- var tail; // (zip_HuftList)
126
-
127
- tail = this.root = null;
128
- for (i = 0; i < c.length; i++)
129
- c[i] = 0;
130
- for (i = 0; i < lx.length; i++)
131
- lx[i] = 0;
132
- for (i = 0; i < u.length; i++)
133
- u[i] = null;
134
- for (i = 0; i < v.length; i++)
135
- v[i] = 0;
136
- for (i = 0; i < x.length; i++)
137
- x[i] = 0;
138
-
139
- // Generate counts for each bit length
140
- el = n > 256 ? b[256] : this.BMAX; // set length of EOB code, if any
141
- p = b; pidx = 0;
142
- i = n;
143
- do {
144
- c[p[pidx]]++; // assume all entries <= BMAX
145
- pidx++;
146
- } while (--i > 0);
147
- if (c[0] == n) { // null input--all zero length codes
148
- this.root = null;
149
- this.m = 0;
150
- this.status = 0;
151
- return;
152
- }
153
-
154
- // Find minimum and maximum length, bound *m by those
155
- for (j = 1; j <= this.BMAX; j++)
156
- if (c[j] != 0)
157
- break;
158
- k = j; // minimum code length
159
- if (mm < j)
160
- mm = j;
161
- for (i = this.BMAX; i != 0; i--)
162
- if (c[i] != 0)
163
- break;
164
- g = i; // maximum code length
165
- if (mm > i)
166
- mm = i;
167
-
168
- // Adjust last length count to fill out codes, if needed
169
- for (y = 1 << j; j < i; j++, y <<= 1)
170
- if ((y -= c[j]) < 0) {
171
- this.status = 2; // bad input: more codes than bits
172
- this.m = mm;
173
- return;
174
- }
175
- if ((y -= c[i]) < 0) {
176
- this.status = 2;
177
- this.m = mm;
178
- return;
179
- }
180
- c[i] += y;
181
-
182
- // Generate starting offsets into the value table for each length
183
- x[1] = j = 0;
184
- p = c;
185
- pidx = 1;
186
- xp = 2;
187
- while (--i > 0) // note that i == g from above
188
- x[xp++] = (j += p[pidx++]);
189
-
190
- // Make a table of values in order of bit lengths
191
- p = b; pidx = 0;
192
- i = 0;
193
- do {
194
- if ((j = p[pidx++]) != 0)
195
- v[x[j]++] = i;
196
- } while (++i < n);
197
- n = x[g]; // set n to length of v
198
-
199
- // Generate the Huffman codes and for each, make the table entries
200
- x[0] = i = 0; // first Huffman code is zero
201
- p = v; pidx = 0; // grab values in bit order
202
- h = -1; // no tables yet--level -1
203
- w = lx[0] = 0; // no bits decoded yet
204
- q = null; // ditto
205
- z = 0; // ditto
206
-
207
- // go through the bit lengths (k already is bits in shortest code)
208
- for (; k <= g; k++) {
209
- a = c[k];
210
- while (a-- > 0) {
211
- // here i is the Huffman code of length k bits for value p[pidx]
212
- // make tables up to required level
213
- while (k > w + lx[1 + h]) {
214
- w += lx[1 + h]; // add bits already decoded
215
- h++;
216
-
217
- // compute minimum size table less than or equal to *m bits
218
- z = (z = g - w) > mm ? mm : z; // upper limit
219
- if ((f = 1 << (j = k - w)) > a + 1) { // try a k-w bit table
220
- // too few codes for k-w bit table
221
- f -= a + 1; // deduct codes from patterns left
222
- xp = k;
223
- while (++j < z) { // try smaller tables up to z bits
224
- if ((f <<= 1) <= c[++xp])
225
- break; // enough codes to use up j bits
226
- f -= c[xp]; // else deduct codes from patterns
227
- }
228
- }
229
- if (w + j > el && w < el)
230
- j = el - w; // make EOB code end at table
231
- z = 1 << j; // table entries for j-bit table
232
- lx[1 + h] = j; // set table size in stack
233
-
234
- // allocate and link in new table
235
- q = new Array(z);
236
- for (o = 0; o < z; o++) {
237
- q[o] = new zip_HuftNode();
238
- }
239
-
240
- if (tail == null)
241
- tail = this.root = new zip_HuftList();
242
- else
243
- tail = tail.next = new zip_HuftList();
244
- tail.next = null;
245
- tail.list = q;
246
- u[h] = q; // table starts after link
247
-
248
- /* connect to last table, if there is one */
249
- if (h > 0) {
250
- x[h] = i; // save pattern for backing up
251
- r.b = lx[h]; // bits to dump before this table
252
- r.e = 16 + j; // bits in this table
253
- r.t = q; // pointer to this table
254
- j = (i & ((1 << w) - 1)) >> (w - lx[h]);
255
- u[h - 1][j].e = r.e;
256
- u[h - 1][j].b = r.b;
257
- u[h - 1][j].n = r.n;
258
- u[h - 1][j].t = r.t;
259
- }
260
- }
261
-
262
- // set up table entry in r
263
- r.b = k - w;
264
- if (pidx >= n)
265
- r.e = 99; // out of values--invalid code
266
- else if (p[pidx] < s) {
267
- r.e = (p[pidx] < 256 ? 16 : 15); // 256 is end-of-block code
268
- r.n = p[pidx++]; // simple code is just the value
269
- } else {
270
- r.e = e[p[pidx] - s]; // non-simple--look up in lists
271
- r.n = d[p[pidx++] - s];
272
- }
273
-
274
- // fill code-like entries with r //
275
- f = 1 << (k - w);
276
- for (j = i >> w; j < z; j += f) {
277
- q[j].e = r.e;
278
- q[j].b = r.b;
279
- q[j].n = r.n;
280
- q[j].t = r.t;
281
- }
282
-
283
- // backwards increment the k-bit code i
284
- for (j = 1 << (k - 1) ; (i & j) != 0; j >>= 1)
285
- i ^= j;
286
- i ^= j;
287
-
288
- // backup over finished tables
289
- while ((i & ((1 << w) - 1)) != x[h]) {
290
- w -= lx[h]; // don't need to update q
291
- h--;
292
- }
293
- }
294
- }
295
-
296
- /* return actual size of base table */
297
- this.m = lx[1];
298
-
299
- /* Return true (1) if we were given an incomplete table */
300
- this.status = ((y != 0 && g != 1) ? 1 : 0);
301
- } /* end of constructor */
302
- }
303
-
304
-
305
- /* routines (inflate) */
306
-
307
- function zip_GET_BYTE() {
308
- if (zip_inflate_data.length == zip_inflate_pos)
309
- return -1;
310
- return zip_inflate_data.charCodeAt(zip_inflate_pos++) & 0xff;
311
- }
312
-
313
- function zip_NEEDBITS(n) {
314
- while (zip_bit_len < n) {
315
- zip_bit_buf |= zip_GET_BYTE() << zip_bit_len;
316
- zip_bit_len += 8;
317
- }
318
- }
319
-
320
- function zip_GETBITS(n) {
321
- return zip_bit_buf & zip_MASK_BITS[n];
322
- }
323
-
324
- function zip_DUMPBITS(n) {
325
- zip_bit_buf >>= n;
326
- zip_bit_len -= n;
327
- }
328
-
329
- function zip_inflate_codes(buff, off, size) {
330
- /* inflate (decompress) the codes in a deflated (compressed) block.
331
- Return an error code or zero if it all goes ok. */
332
- var e; // table entry flag/number of extra bits
333
- var t; // (zip_HuftNode) pointer to table entry
334
- var n;
335
-
336
- if (size == 0)
337
- return 0;
338
-
339
- // inflate the coded data
340
- n = 0;
341
- for (; ;) { // do until end of block
342
- zip_NEEDBITS(zip_bl);
343
- t = zip_tl.list[zip_GETBITS(zip_bl)];
344
- e = t.e;
345
- while (e > 16) {
346
- if (e == 99)
347
- return -1;
348
- zip_DUMPBITS(t.b);
349
- e -= 16;
350
- zip_NEEDBITS(e);
351
- t = t.t[zip_GETBITS(e)];
352
- e = t.e;
353
- }
354
- zip_DUMPBITS(t.b);
355
-
356
- if (e == 16) { // then it's a literal
357
- zip_wp &= zip_WSIZE - 1;
358
- buff[off + n++] = zip_slide[zip_wp++] = t.n;
359
- if (n == size)
360
- return size;
361
- continue;
362
- }
363
-
364
- // exit if end of block
365
- if (e == 15)
366
- break;
367
-
368
- // it's an EOB or a length
369
-
370
- // get length of block to copy
371
- zip_NEEDBITS(e);
372
- zip_copy_leng = t.n + zip_GETBITS(e);
373
- zip_DUMPBITS(e);
374
-
375
- // decode distance of block to copy
376
- zip_NEEDBITS(zip_bd);
377
- t = zip_td.list[zip_GETBITS(zip_bd)];
378
- e = t.e;
379
-
380
- while (e > 16) {
381
- if (e == 99)
382
- return -1;
383
- zip_DUMPBITS(t.b);
384
- e -= 16;
385
- zip_NEEDBITS(e);
386
- t = t.t[zip_GETBITS(e)];
387
- e = t.e;
388
- }
389
- zip_DUMPBITS(t.b);
390
- zip_NEEDBITS(e);
391
- zip_copy_dist = zip_wp - t.n - zip_GETBITS(e);
392
- zip_DUMPBITS(e);
393
-
394
- // do the copy
395
- while (zip_copy_leng > 0 && n < size) {
396
- zip_copy_leng--;
397
- zip_copy_dist &= zip_WSIZE - 1;
398
- zip_wp &= zip_WSIZE - 1;
399
- buff[off + n++] = zip_slide[zip_wp++]
400
- = zip_slide[zip_copy_dist++];
401
- }
402
-
403
- if (n == size)
404
- return size;
405
- }
406
-
407
- zip_method = -1; // done
408
- return n;
409
- }
410
-
411
- function zip_inflate_stored(buff, off, size) {
412
- /* "decompress" an inflated type 0 (stored) block. */
413
- var n;
414
-
415
- // go to byte boundary
416
- n = zip_bit_len & 7;
417
- zip_DUMPBITS(n);
418
-
419
- // get the length and its complement
420
- zip_NEEDBITS(16);
421
- n = zip_GETBITS(16);
422
- zip_DUMPBITS(16);
423
- zip_NEEDBITS(16);
424
- if (n != ((~zip_bit_buf) & 0xffff))
425
- return -1; // error in compressed data
426
- zip_DUMPBITS(16);
427
-
428
- // read and output the compressed data
429
- zip_copy_leng = n;
430
-
431
- n = 0;
432
- while (zip_copy_leng > 0 && n < size) {
433
- zip_copy_leng--;
434
- zip_wp &= zip_WSIZE - 1;
435
- zip_NEEDBITS(8);
436
- buff[off + n++] = zip_slide[zip_wp++] =
437
- zip_GETBITS(8);
438
- zip_DUMPBITS(8);
439
- }
440
-
441
- if (zip_copy_leng == 0)
442
- zip_method = -1; // done
443
- return n;
444
- }
445
-
446
- function zip_inflate_fixed(buff, off, size) {
447
- /* decompress an inflated type 1 (fixed Huffman codes) block. We should
448
- either replace this with a custom decoder, or at least precompute the
449
- Huffman tables. */
450
-
451
- // if first time, set up tables for fixed blocks
452
- if (zip_fixed_tl == null) {
453
- var i; // temporary variable
454
- var l = new Array(288); // length list for huft_build
455
- var h; // zip_HuftBuild
456
-
457
- // literal table
458
- for (i = 0; i < 144; i++)
459
- l[i] = 8;
460
- for (; i < 256; i++)
461
- l[i] = 9;
462
- for (; i < 280; i++)
463
- l[i] = 7;
464
- for (; i < 288; i++) // make a complete, but wrong code set
465
- l[i] = 8;
466
- zip_fixed_bl = 7;
467
-
468
- h = new zip_HuftBuild(l, 288, 257, zip_cplens, zip_cplext,
469
- zip_fixed_bl);
470
- if (h.status != 0) {
471
- alert("HufBuild error: " + h.status);
472
- return -1;
473
- }
474
- zip_fixed_tl = h.root;
475
- zip_fixed_bl = h.m;
476
-
477
- // distance table
478
- for (i = 0; i < 30; i++) // make an incomplete code set
479
- l[i] = 5;
480
- zip_fixed_bd = 5;
481
-
482
- h = new zip_HuftBuild(l, 30, 0, zip_cpdist, zip_cpdext, zip_fixed_bd);
483
- if (h.status > 1) {
484
- zip_fixed_tl = null;
485
- alert("HufBuild error: " + h.status);
486
- return -1;
487
- }
488
- zip_fixed_td = h.root;
489
- zip_fixed_bd = h.m;
490
- }
491
-
492
- zip_tl = zip_fixed_tl;
493
- zip_td = zip_fixed_td;
494
- zip_bl = zip_fixed_bl;
495
- zip_bd = zip_fixed_bd;
496
- return zip_inflate_codes(buff, off, size);
497
- }
498
-
499
- function zip_inflate_dynamic(buff, off, size) {
500
- // decompress an inflated type 2 (dynamic Huffman codes) block.
501
- var i; // temporary variables
502
- var j;
503
- var l; // last length
504
- var n; // number of lengths to get
505
- var t; // (zip_HuftNode) literal/length code table
506
- var nb; // number of bit length codes
507
- var nl; // number of literal/length codes
508
- var nd; // number of distance codes
509
- var ll = new Array(286 + 30); // literal/length and distance code lengths
510
- var h; // (zip_HuftBuild)
511
-
512
- for (i = 0; i < ll.length; i++)
513
- ll[i] = 0;
514
-
515
- // read in table lengths
516
- zip_NEEDBITS(5);
517
- nl = 257 + zip_GETBITS(5); // number of literal/length codes
518
- zip_DUMPBITS(5);
519
- zip_NEEDBITS(5);
520
- nd = 1 + zip_GETBITS(5); // number of distance codes
521
- zip_DUMPBITS(5);
522
- zip_NEEDBITS(4);
523
- nb = 4 + zip_GETBITS(4); // number of bit length codes
524
- zip_DUMPBITS(4);
525
- if (nl > 286 || nd > 30)
526
- return -1; // bad lengths
527
-
528
- // read in bit-length-code lengths
529
- for (j = 0; j < nb; j++) {
530
- zip_NEEDBITS(3);
531
- ll[zip_border[j]] = zip_GETBITS(3);
532
- zip_DUMPBITS(3);
533
- }
534
- for (; j < 19; j++)
535
- ll[zip_border[j]] = 0;
536
-
537
- // build decoding table for trees--single level, 7 bit lookup
538
- zip_bl = 7;
539
- h = new zip_HuftBuild(ll, 19, 19, null, null, zip_bl);
540
- if (h.status != 0)
541
- return -1; // incomplete code set
542
-
543
- zip_tl = h.root;
544
- zip_bl = h.m;
545
-
546
- // read in literal and distance code lengths
547
- n = nl + nd;
548
- i = l = 0;
549
- while (i < n) {
550
- zip_NEEDBITS(zip_bl);
551
- t = zip_tl.list[zip_GETBITS(zip_bl)];
552
- j = t.b;
553
- zip_DUMPBITS(j);
554
- j = t.n;
555
- if (j < 16) // length of code in bits (0..15)
556
- ll[i++] = l = j; // save last length in l
557
- else if (j == 16) { // repeat last length 3 to 6 times
558
- zip_NEEDBITS(2);
559
- j = 3 + zip_GETBITS(2);
560
- zip_DUMPBITS(2);
561
- if (i + j > n)
562
- return -1;
563
- while (j-- > 0)
564
- ll[i++] = l;
565
- } else if (j == 17) { // 3 to 10 zero length codes
566
- zip_NEEDBITS(3);
567
- j = 3 + zip_GETBITS(3);
568
- zip_DUMPBITS(3);
569
- if (i + j > n)
570
- return -1;
571
- while (j-- > 0)
572
- ll[i++] = 0;
573
- l = 0;
574
- } else { // j == 18: 11 to 138 zero length codes
575
- zip_NEEDBITS(7);
576
- j = 11 + zip_GETBITS(7);
577
- zip_DUMPBITS(7);
578
- if (i + j > n)
579
- return -1;
580
- while (j-- > 0)
581
- ll[i++] = 0;
582
- l = 0;
583
- }
584
- }
585
-
586
- // build the decoding tables for literal/length and distance codes
587
- zip_bl = zip_lbits;
588
- h = new zip_HuftBuild(ll, nl, 257, zip_cplens, zip_cplext, zip_bl);
589
- if (zip_bl == 0) // no literals or lengths
590
- h.status = 1;
591
- if (h.status != 0) {
592
- if (h.status == 1)
593
- ;// **incomplete literal tree**
594
- return -1; // incomplete code set
595
- }
596
- zip_tl = h.root;
597
- zip_bl = h.m;
598
-
599
- for (i = 0; i < nd; i++)
600
- ll[i] = ll[i + nl];
601
- zip_bd = zip_dbits;
602
- h = new zip_HuftBuild(ll, nd, 0, zip_cpdist, zip_cpdext, zip_bd);
603
- zip_td = h.root;
604
- zip_bd = h.m;
605
-
606
- if (zip_bd == 0 && nl > 257) { // lengths but no distances
607
- // **incomplete distance tree**
608
- return -1;
609
- }
610
-
611
- if (h.status == 1) {
612
- ;// **incomplete distance tree**
613
- }
614
- if (h.status != 0)
615
- return -1;
616
-
617
- // decompress until an end-of-block code
618
- return zip_inflate_codes(buff, off, size);
619
- }
620
-
621
- function zip_inflate_internal(buff, off, size) {
622
- // decompress an inflated entry
623
- var n, i;
624
-
625
- n = 0;
626
- while (n < size) {
627
- if (zip_eof && zip_method == -1)
628
- return n;
629
-
630
- if (zip_copy_leng > 0) {
631
- if (zip_method != zip_STORED_BLOCK) {
632
- // STATIC_TREES or DYN_TREES
633
- while (zip_copy_leng > 0 && n < size) {
634
- zip_copy_leng--;
635
- zip_copy_dist &= zip_WSIZE - 1;
636
- zip_wp &= zip_WSIZE - 1;
637
- buff[off + n++] = zip_slide[zip_wp++] =
638
- zip_slide[zip_copy_dist++];
639
- }
640
- } else {
641
- while (zip_copy_leng > 0 && n < size) {
642
- zip_copy_leng--;
643
- zip_wp &= zip_WSIZE - 1;
644
- zip_NEEDBITS(8);
645
- buff[off + n++] = zip_slide[zip_wp++] = zip_GETBITS(8);
646
- zip_DUMPBITS(8);
647
- }
648
- if (zip_copy_leng == 0)
649
- zip_method = -1; // done
650
- }
651
- if (n == size)
652
- return n;
653
- }
654
-
655
- if (zip_method == -1) {
656
- if (zip_eof)
657
- break;
658
-
659
- // read in last block bit
660
- zip_NEEDBITS(1);
661
- if (zip_GETBITS(1) != 0)
662
- zip_eof = true;
663
- zip_DUMPBITS(1);
664
-
665
- // read in block type
666
- zip_NEEDBITS(2);
667
- zip_method = zip_GETBITS(2);
668
- zip_DUMPBITS(2);
669
- zip_tl = null;
670
- zip_copy_leng = 0;
671
- }
672
-
673
- switch (zip_method) {
674
- case 0: // zip_STORED_BLOCK
675
- i = zip_inflate_stored(buff, off + n, size - n);
676
- break;
677
-
678
- case 1: // zip_STATIC_TREES
679
- if (zip_tl != null)
680
- i = zip_inflate_codes(buff, off + n, size - n);
681
- else
682
- i = zip_inflate_fixed(buff, off + n, size - n);
683
- break;
684
-
685
- case 2: // zip_DYN_TREES
686
- if (zip_tl != null)
687
- i = zip_inflate_codes(buff, off + n, size - n);
688
- else
689
- i = zip_inflate_dynamic(buff, off + n, size - n);
690
- break;
691
-
692
- default: // error
693
- i = -1;
694
- break;
695
- }
696
-
697
- if (i == -1) {
698
- if (zip_eof)
699
- return 0;
700
- return -1;
701
- }
702
- n += i;
703
- }
704
- return n;
705
- }
706
-
707
- function zip_inflate_start() {
708
- if (zip_slide == null) zip_slide = new Array(2 * zip_WSIZE);
709
- zip_wp = 0;
710
- zip_bit_buf = 0;
711
- zip_bit_len = 0;
712
- zip_method = -1;
713
- zip_eof = false;
714
- zip_copy_leng = zip_copy_dist = 0;
715
- zip_tl = null;
716
- }
717
-
718
- inflate_start = function () { zip_inflate_start(); };
719
- inflate = function (data) {
720
- var out = "", buff = [], i, j;
721
- zip_bit_buf = 0;
722
- zip_bit_len = 0;
723
- zip_method = -1;
724
- zip_eof = false;
725
- zip_inflate_data = data;
726
- zip_inflate_pos = 0;
727
-
728
- do { i = zip_inflate_internal(buff, buff.length, 1024); } while (i > 0);
729
- zip_inflate_data = null; // G.C.
730
-
731
- return buff;
732
- };
redirserver.js
+2
-1
@@ -29,7 +29,8 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
29
host = obj.certificates.CommonName;
30
if ((obj.certificates.CommonName == 'sample.org') || (obj.certificates.CommonName == 'un-configured')) { host = req.headers.host; }
31
}
32
- if (req.headers && req.headers.host && (req.headers.host.split(':')[0].toLowerCase() == 'localhost')) { res.redirect('https://localhost:' + args.port + req.url); } else { res.redirect('https://' + host + ':' + args.port + req.url); }
32
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
33
+ if (req.headers && req.headers.host && (req.headers.host.split(':')[0].toLowerCase() == 'localhost')) { res.redirect('https://localhost:' + httpsPort + req.url); } else { res.redirect('https://' + host + ':' + httpsPort + req.url); }
34
}
35
36
// Return the current domain of the request
webserver.js
+28
-12
@@ -685,14 +685,16 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
685
686
// Send the master web application
687
if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button
688
- res.render(obj.path.join(__dirname, 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: args.port, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer });
688
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
689
+ res.render(obj.path.join(__dirname, 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer });
690
} else {
691
// Send back the login application
692
var loginmode = req.session.loginmode;
693
delete req.session.loginmode; // Clear this state, if the user hits refresh, we want to go back to the login page.
694
var features = 0;
695
if ((parent.config != null) && (parent.config.settings != null) && (parent.config.settings.allowframing == true)) { features += 32; } // Allow site within iframe
695
- res.render(obj.path.join(__dirname, 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: obj.args.port, emailcheck: obj.parent.mailserver != null, features: features, footer: (domain.footer == null) ? '' : domain.footer });
696
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
697
+ res.render(obj.path.join(__dirname, 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, footer: (domain.footer == null) ? '' : domain.footer });
698
}
699
}
700
@@ -767,6 +769,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
769
var scriptEngine = require('./amtscript.js').CreateAmtScriptEngine();
770
var runscript = scriptEngine.script_blocksToScript(scriptFile.blocks, scriptFile.scriptBlocks);
771
scriptFile.mescript = new Buffer(scriptEngine.script_compile(runscript), 'binary').toString('base64');
772
+ scriptFile.scriptText = runscript;
773
774
// Send the script
775
res.send(new Buffer(JSON.stringify(scriptFile, null, ' ')));
@@ -792,6 +795,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
795
var scriptEngine = require('./amtscript.js').CreateAmtScriptEngine();
796
var runscript = scriptEngine.script_blocksToScript(scriptFile.blocks, scriptFile.scriptBlocks);
797
scriptFile.mescript = new Buffer(scriptEngine.script_compile(runscript), 'binary').toString('base64');
798
+ scriptFile.scriptText = runscript;
799
800
// Send the script
801
res.send(new Buffer(JSON.stringify(scriptFile, null, ' ')));
@@ -1434,13 +1438,14 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1438
1439
var meshidhex = new Buffer(req.query.meshid.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase();
1440
var serveridhex = new Buffer(obj.agentCertificateHashBase64.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase();
1441
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
1442
1443
// Build the agent connection URL. If we are using a sub-domain or one with a DNS, we need to craft the URL correctly.
1444
var xdomain = (domain.dns == null) ? domain.id : '';
1445
if (xdomain != '') xdomain += "/";
1446
var meshsettings = "MeshName=" + mesh.name + "\r\nMeshType=" + mesh.mtype + "\r\nMeshID=0x" + meshidhex + "\r\nServerID=" + serveridhex + "\r\n";
1442
- if (obj.args.lanonly != true) { meshsettings += "MeshServer=ws" + (obj.args.notls ? '' : 's') + "://" + getWebServerName(domain) + ":" + obj.args.port + "/" + xdomain + "agent.ashx\r\n"; } else { meshsettings += "MeshServer=local"; }
1443
- if (req.query.tag != true) { meshsettings += "Tag=" + req.query.tag + "\r\n"; }
1447
+ if (obj.args.lanonly != true) { meshsettings += "MeshServer=ws" + (obj.args.notls ? '' : 's') + "://" + getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "agent.ashx\r\n"; } else { meshsettings += "MeshServer=local"; }
1448
+ if (req.query.tag != null) { meshsettings += "Tag=" + req.query.tag + "\r\n"; }
1449
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=' + argentInfo.rname });
1450
obj.parent.exeHandler.streamExeWithMeshPolicy({ platform: 'win32', sourceFileName: obj.parent.meshAgentBinaries[req.query.id].path, destinationStream: res, msh: meshsettings, peinfo: obj.parent.meshAgentBinaries[req.query.id].pe });
1451
});
@@ -1453,11 +1458,19 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1458
res.sendFile(scriptInfo.path);
1459
} else if (req.query.meshcmd != null) {
1460
// Send meshcmd for a specific platform back
1456
- var argentInfo = obj.parent.meshAgentBinaries[req.query.meshcmd];
1461
+ var agentid = parseInt(req.query.meshcmd);
1462
+ if ((agentid < 10000) && (obj.parent.meshAgentBinaries[agentid + 10000] != null)) { agentid += 10000; } // Avoid merging javascript to a signed mesh agent.
1463
+ var argentInfo = obj.parent.meshAgentBinaries[agentid];
1464
if ((argentInfo == null) || (obj.parent.defaultMeshCmd == null)) { res.sendStatus(404); return; }
1465
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=meshcmd' + ((req.query.meshcmd <= 4) ? '.exe' : '') });
1466
res.statusCode = 200;
1460
- obj.parent.exeHandler.streamExeWithJavaScript({ platform: argentInfo.platform, sourceFileName: argentInfo.path, destinationStream: res, js: new Buffer(obj.parent.defaultMeshCmd, 'utf8'), peinfo: argentInfo.pe });
1467
+ if (argentInfo.signedMeshCmdPath != null) {
1468
+ // If we hav a pre-signed MeshCmd, send that.
1469
+ res.sendFile(argentInfo.signedMeshCmdPath);
1470
+ } else {
1471
+ // Merge JavaScript to a unsigned agent and send that.
1472
+ obj.parent.exeHandler.streamExeWithJavaScript({ platform: argentInfo.platform, sourceFileName: argentInfo.path, destinationStream: res, js: new Buffer(obj.parent.defaultMeshCmd, 'utf8'), peinfo: argentInfo.pe });
1473
+ }
1474
} else if (req.query.meshaction != null) {
1475
var domain = checkUserIpAddress(req, res);
1476
if (domain == null) { res.sendStatus(404); return; }
@@ -1480,7 +1493,8 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1493
debugLevel: 0
1494
}
1495
if (user != null) { meshaction.username = user.name; }
1483
- if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + getWebServerName(domain) + ':' + obj.args.port + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; }
1496
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
1497
+ if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + getWebServerName(domain) + ':' + httpsPort + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; }
1498
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename=meshaction.txt' });
1499
res.send(JSON.stringify(meshaction, null, ' '));
1500
});
@@ -1494,7 +1508,8 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1508
debugLevel: 0
1509
}
1510
if (user != null) { meshaction.username = user.name; }
1497
- if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + getWebServerName(domain) + ':' + obj.args.port + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; }
1511
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
1512
+ if (obj.args.lanonly != true) { meshaction.serverUrl = ((obj.args.notls == true) ? 'ws://' : 'wss://') + getWebServerName(domain) + ':' + httpsPort + '/' + ((domain.id == '') ? '' : ('/' + domain.id)) + 'meshrelay.ashx'; }
1513
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'text/plain', 'Content-Disposition': 'attachment; filename=meshaction.txt' });
1514
res.send(JSON.stringify(meshaction, null, ' '));
1515
} else {
@@ -1550,7 +1565,8 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1565
var xdomain = (domain.dns == null) ? domain.id : '';
1566
if (xdomain != '') xdomain += "/";
1567
var meshsettings = "MeshName=" + mesh.name + "\r\nMeshType=" + mesh.mtype + "\r\nMeshID=0x" + meshidhex + "\r\nServerID=" + serveridhex + "\r\n";
1553
- if (obj.args.lanonly != true) { meshsettings += "MeshServer=ws" + (obj.args.notls ? '' : 's') + "://" + getWebServerName(domain) + ":" + obj.args.port + "/" + xdomain + "agent.ashx\r\n"; } else { meshsettings += "MeshServer=local"; }
1568
+ var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
1569
+ if (obj.args.lanonly != true) { meshsettings += "MeshServer=ws" + (obj.args.notls ? '' : 's') + "://" + getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "agent.ashx\r\n"; } else { meshsettings += "MeshServer=local"; }
1570
1571
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=meshagent.msh' });
1572
res.send(meshsettings);
@@ -1643,12 +1659,12 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1659
obj.args.port = port;
1660
if (obj.tlsServer != null) {
1661
if (obj.args.lanonly == true) {
1646
- obj.tcpServer = obj.tlsServer.listen(port, function () { console.log('MeshCentral HTTPS web server running on port ' + port + '.'); });
1662
+ obj.tcpServer = obj.tlsServer.listen(port, function () { console.log('MeshCentral HTTPS web server running on port ' + port + ((args.aliasport != null) ? (', alias port ' + args.aliasport) : '') + '.'); });
1663
} else {
1648
- obj.tcpServer = obj.tlsServer.listen(port, function () { console.log('MeshCentral HTTPS web server running on ' + certificates.CommonName + ':' + port + '.'); });
1664
+ obj.tcpServer = obj.tlsServer.listen(port, function () { console.log('MeshCentral HTTPS web server running on ' + certificates.CommonName + ':' + port + ((args.aliasport != null) ? (', alias port ' + args.aliasport) : '') + '.'); });
1665
}
1666
} else {
1651
- obj.tcpServer = obj.app.listen(port, function () { console.log('MeshCentral HTTP web server running on port ' + port + '.'); });
1667
+ obj.tcpServer = obj.app.listen(port, function () { console.log('MeshCentral HTTP web server running on port ' + port + ((args.aliasport != null) ? (', alias port ' + args.aliasport) : '') + '.'); });
1668
}
1669
}
1670