Added meshcore minification support.

This commit is contained in:
Ylian Saint-Hilaire 2018-12-29 15:24:33 -08:00
parent 4d307ca159
commit 1551f74637
47 changed files with 233 additions and 1989 deletions

View File

@ -21,7 +21,9 @@
<PropertyGroup Condition="'$(Configuration)' == 'Release'" /> <PropertyGroup Condition="'$(Configuration)' == 'Release'" />
<ItemGroup> <ItemGroup>
<Compile Include="agents\meshcmd.js" /> <Compile Include="agents\meshcmd.js" />
<Compile Include="agents\meshcmd.min.js" />
<Compile Include="agents\meshcore.js" /> <Compile Include="agents\meshcore.js" />
<Compile Include="agents\meshcore.min.js" />
<Compile Include="agents\modules_meshcmd\amt-lme.js" /> <Compile Include="agents\modules_meshcmd\amt-lme.js" />
<Compile Include="agents\modules_meshcmd\amt-mei.js" /> <Compile Include="agents\modules_meshcmd\amt-mei.js" />
<Compile Include="agents\modules_meshcmd\amt-scanner.js" /> <Compile Include="agents\modules_meshcmd\amt-scanner.js" />
@ -35,6 +37,19 @@
<Compile Include="agents\modules_meshcmd\service-manager.js" /> <Compile Include="agents\modules_meshcmd\service-manager.js" />
<Compile Include="agents\modules_meshcmd\smbios.js" /> <Compile Include="agents\modules_meshcmd\smbios.js" />
<Compile Include="agents\modules_meshcmd\user-sessions.js" /> <Compile Include="agents\modules_meshcmd\user-sessions.js" />
<Compile Include="agents\modules_meshcmd_min\amt-lme.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt-mei.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt-scanner.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt-script.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt-wsman-duk.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt-wsman.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt-xml.min.js" />
<Compile Include="agents\modules_meshcmd_min\amt.min.js" />
<Compile Include="agents\modules_meshcmd_min\process-manager.min.js" />
<Compile Include="agents\modules_meshcmd_min\service-host.min.js" />
<Compile Include="agents\modules_meshcmd_min\service-manager.min.js" />
<Compile Include="agents\modules_meshcmd_min\smbios.min.js" />
<Compile Include="agents\modules_meshcmd_min\user-sessions.min.js" />
<Compile Include="agents\modules_meshcore\amt-lme.js" /> <Compile Include="agents\modules_meshcore\amt-lme.js" />
<Compile Include="agents\modules_meshcore\amt-mei.js" /> <Compile Include="agents\modules_meshcore\amt-mei.js" />
<Compile Include="agents\modules_meshcore\amt-scanner.js" /> <Compile Include="agents\modules_meshcore\amt-scanner.js" />
@ -57,6 +72,28 @@
<Compile Include="agents\modules_meshcore\win-message-pump.js" /> <Compile Include="agents\modules_meshcore\win-message-pump.js" />
<Compile Include="agents\modules_meshcore\win-registry.js" /> <Compile Include="agents\modules_meshcore\win-registry.js" />
<Compile Include="agents\modules_meshcore\win-terminal.js" /> <Compile Include="agents\modules_meshcore\win-terminal.js" />
<Compile Include="agents\modules_meshcore_min\amt-lme.min.js" />
<Compile Include="agents\modules_meshcore_min\amt-mei.min.js" />
<Compile Include="agents\modules_meshcore_min\amt-scanner.min.js" />
<Compile Include="agents\modules_meshcore_min\amt-wsman-duk.min.js" />
<Compile Include="agents\modules_meshcore_min\amt-wsman.min.js" />
<Compile Include="agents\modules_meshcore_min\amt-xml.min.js" />
<Compile Include="agents\modules_meshcore_min\amt.min.js" />
<Compile Include="agents\modules_meshcore_min\linux-dbus.min.js" />
<Compile Include="agents\modules_meshcore_min\monitor-border.min.js" />
<Compile Include="agents\modules_meshcore_min\monitor-info.min.js" />
<Compile Include="agents\modules_meshcore_min\power-monitor.min.js" />
<Compile Include="agents\modules_meshcore_min\process-manager.min.js" />
<Compile Include="agents\modules_meshcore_min\service-manager.min.js" />
<Compile Include="agents\modules_meshcore_min\smbios.min.js" />
<Compile Include="agents\modules_meshcore_min\toaster.min.js" />
<Compile Include="agents\modules_meshcore_min\user-sessions.min.js" />
<Compile Include="agents\modules_meshcore_min\wifi-scanner-windows.min.js" />
<Compile Include="agents\modules_meshcore_min\wifi-scanner.min.js" />
<Compile Include="agents\modules_meshcore_min\win-console.min.js" />
<Compile Include="agents\modules_meshcore_min\win-message-pump.min.js" />
<Compile Include="agents\modules_meshcore_min\win-registry.min.js" />
<Compile Include="agents\modules_meshcore_min\win-terminal.min.js" />
<Compile Include="agents\testsuite.js" /> <Compile Include="agents\testsuite.js" />
<Compile Include="agents\tinycore.js" /> <Compile Include="agents\tinycore.js" />
<Compile Include="amtevents.js" /> <Compile Include="amtevents.js" />
@ -97,7 +134,11 @@
<Compile Include="redirserver.js" /> <Compile Include="redirserver.js" />
<Compile Include="webserver.js" /> <Compile Include="webserver.js" />
<Compile Include="winservice.js" /> <Compile Include="winservice.js" />
<Content Include="agents\compressModules.bat" />
<Content Include="agents\MeshAgentOSXPackager.zip" />
<Content Include="agents\meshagent_arm" /> <Content Include="agents\meshagent_arm" />
<Content Include="agents\meshagent_arm-linaro" />
<Content Include="agents\meshagent_osx-x86-64" />
<Content Include="agents\meshagent_pi" /> <Content Include="agents\meshagent_pi" />
<Content Include="agents\meshagent_pogo" /> <Content Include="agents\meshagent_pogo" />
<Content Include="agents\meshagent_poky" /> <Content Include="agents\meshagent_poky" />
@ -113,8 +154,11 @@
<Content Include="agents\meshinstall-linux.sh" /> <Content Include="agents\meshinstall-linux.sh" />
<Content Include="agents\MeshService-signed.exe" /> <Content Include="agents\MeshService-signed.exe" />
<Content Include="agents\MeshService.exe" /> <Content Include="agents\MeshService.exe" />
<Content Include="agents\MeshService.pdb" />
<Content Include="agents\MeshService64-signed.exe" /> <Content Include="agents\MeshService64-signed.exe" />
<Content Include="agents\MeshService64.exe" /> <Content Include="agents\MeshService64.exe" />
<Content Include="agents\MeshService64.pdb" />
<Content Include="CreateSourcePackage.bat" />
<Content Include="LICENSE" /> <Content Include="LICENSE" />
<Content Include="package.json" /> <Content Include="package.json" />
<Content Include="public\clickonce\minirouter\Application Files\MeshMiniRouter_1_0_0_70\MeshMiniRouter.application" /> <Content Include="public\clickonce\minirouter\Application Files\MeshMiniRouter_1_0_0_70\MeshMiniRouter.application" />
@ -125,6 +169,8 @@
<Content Include="public\clickonce\minirouter\MeshMiniRouter.application" /> <Content Include="public\clickonce\minirouter\MeshMiniRouter.application" />
<Content Include="public\clickonce\minirouter\publish.htm" /> <Content Include="public\clickonce\minirouter\publish.htm" />
<Content Include="public\commander.htm" /> <Content Include="public\commander.htm" />
<Content Include="public\compress.bat" />
<Content Include="public\compress.wcc" />
<Content Include="public\favicon.ico" /> <Content Include="public\favicon.ico" />
<Content Include="public\images-isdu\ComputerIcon.png" /> <Content Include="public\images-isdu\ComputerIcon.png" />
<Content Include="public\images-isdu\ComputerIcon2.png" /> <Content Include="public\images-isdu\ComputerIcon2.png" />
@ -232,7 +278,9 @@
<ItemGroup> <ItemGroup>
<Folder Include="agents\" /> <Folder Include="agents\" />
<Folder Include="agents\modules_meshcmd\" /> <Folder Include="agents\modules_meshcmd\" />
<Folder Include="agents\modules_meshcmd_min\" />
<Folder Include="agents\modules_meshcore\" /> <Folder Include="agents\modules_meshcore\" />
<Folder Include="agents\modules_meshcore_min\" />
<Folder Include="public" /> <Folder Include="public" />
<Folder Include="public\clickonce\" /> <Folder Include="public\clickonce\" />
<Folder Include="public\clickonce\minirouter\" /> <Folder Include="public\clickonce\minirouter\" />

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" compressalljs "modules_meshcore" "modules_meshcore_min"
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" compressalljs "modules_meshcmd" "modules_meshcmd_min"
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcore.js
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcmd.js
pause

View File

@ -1522,7 +1522,7 @@ function parseUrlArguments(url) {
// Remove a element from a array // Remove a element from a array
function removeItemFromArray(array, element) { function removeItemFromArray(array, element) {
const index = array.indexOf(element); var index = array.indexOf(element);
if (index !== -1) { array.splice(index, 1); } if (index !== -1) { array.splice(index, 1); }
} }

1
agents/meshcmd.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -22,15 +22,15 @@ process.on('uncaughtException', function (ex) {
//attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); }); //attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); });
// Mesh Rights // Mesh Rights
const MESHRIGHT_EDITMESH = 1; var MESHRIGHT_EDITMESH = 1;
const MESHRIGHT_MANAGEUSERS = 2; var MESHRIGHT_MANAGEUSERS = 2;
const MESHRIGHT_MANAGECOMPUTERS = 4; var MESHRIGHT_MANAGECOMPUTERS = 4;
const MESHRIGHT_REMOTECONTROL = 8; var MESHRIGHT_REMOTECONTROL = 8;
const MESHRIGHT_AGENTCONSOLE = 16; var MESHRIGHT_AGENTCONSOLE = 16;
const MESHRIGHT_SERVERFILES = 32; var MESHRIGHT_SERVERFILES = 32;
const MESHRIGHT_WAKEDEVICE = 64; var MESHRIGHT_WAKEDEVICE = 64;
const MESHRIGHT_SETNOTES = 128; var MESHRIGHT_SETNOTES = 128;
const MESHRIGHT_REMOTEVIEW = 256; var MESHRIGHT_REMOTEVIEW = 256;
function createMeshCore(agent) { function createMeshCore(agent) {
var obj = {}; var obj = {};

1
agents/meshcore.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function AMTScanner(){var a=require("events").inherits(this);a.createEvent("found");this.dgram=require("dgram");this.buildRmcpPing=function(c){var b=Buffer.from("06000006000011BE80000000","hex");b[9]=c;return b};this.parseRmcpPacket=function(h,b,g,d){if(b==null||b.length<20){return}var f={};if(((b[12]==0)||(b[13]!=0)||(b[14]!=1)||(b[15]!=87))&&(b[21]&32)){f.servertag=b[9];f.minorVersion=b[18]&15;f.majorVersion=(b[18]>>4)&15;f.provisioningState=b[19]&3;var e=(b[16]*256)+b[17];var c=((b[19]&4)!=0)?true:false;f.openPorts=[e];f.address=g.address;if(c==true){f.openPorts=[16992,16993]}if(d!==undefined){d(h,f)}}};this.parseIPv4Range=function(f){if(f==undefined||f==null){return null}var g=f.split("-");if(g.length==2){return{min:this.parseIpv4Addr(g[0]),max:this.parseIpv4Addr(g[1])}}g=f.split("/");if(g.length==2){var c=this.parseIpv4Addr(g[0]),e=parseInt(g[1]),d=0;if(e<=16||e>32){return null}e=32-e;for(var b=0;b<e;b++){d=(d<<1);d++}return{min:c&(4294967295-d),max:(c&(4294967295-d))+d}}g=this.parseIpv4Addr(f);if(g==null){return null}return{min:g,max:g}};this.parseIpv4Addr=function(b){var c=b.split(".");if(c.length==4){return(parseInt(c[0])<<24)+(parseInt(c[1])<<16)+(parseInt(c[2])<<8)+(parseInt(c[3])<<0)}return null};this.IPv4NumToStr=function(b){return((b>>24)&255)+"."+((b>>16)&255)+"."+((b>>8)&255)+"."+(b&255)};this.scan=function(d,g){var c=this.parseIPv4Range(d);var e=this.buildRmcpPing(0);var f=this.dgram.createSocket({type:"udp4"});f.parent=this;f.scanResults=[];f.on("error",function(i){console.log("Error:"+i)});f.on("message",function(i,j){if(j.size>4){this.parent.parseRmcpPacket(this,i,j,function(l,k){l.scanResults.push(k)})}});f.on("listening",function(){for(var j=c.min;j<=c.max;j++){f.send(e,623,f.parent.IPv4NumToStr(j))}});f.bind({address:"0.0.0.0",port:0,exclusive:true});var h=setTimeout(function b(){f.close();f.parent.emit("found",f.scanResults);delete f},g)}}module.exports=AMTScanner;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function CreateWsmanComm(){var a={};a.PendingAjax=[];a.ActiveAjaxCount=0;a.MaxActiveAjaxCount=1;a.FailAllError=0;a.digest=null;a.RequestCount=0;if(arguments.length==1&&typeof(arguments[0]=="object")){a.host=arguments[0].host;a.port=arguments[0].port;a.authToken=arguments[0].authToken;a.tls=arguments[0].tls}else{a.host=arguments[0];a.port=arguments[1];a.user=arguments[2];a.pass=arguments[3];a.tls=arguments[4]}a.PerformAjax=function(d,c,f,e,g,b){if((a.ActiveAjaxCount==0||((a.ActiveAjaxCount<a.MaxActiveAjaxCount)&&(a.challengeParams!=null)))&&a.PendingAjax.length==0){a.PerformAjaxEx(d,c,f,g,b)}else{if(e==1){a.PendingAjax.unshift([d,c,f,g,b])}else{a.PendingAjax.push([d,c,f,g,b])}}};a.PerformNextAjax=function(){if(a.ActiveAjaxCount>=a.MaxActiveAjaxCount||a.PendingAjax.length==0){return}var b=a.PendingAjax.shift();a.PerformAjaxEx(b[0],b[1],b[2],b[3],b[4]);a.PerformNextAjax()};a.PerformAjaxEx=function(d,c,g,h,b){if(a.FailAllError!=0){if(a.FailAllError!=999){a.gotNextMessagesError({status:a.FailAllError},"error",null,[d,c,g])}return}if(!d){d=""}if(a.digest==null){if(a.authToken){a.digest=require("http-digest").create({authToken:a.authToken})}else{a.digest=require("http-digest").create(a.user,a.pass)}a.digest.http=require("http")}var f={protocol:(a.tls==1?"https:":"http:"),method:"POST",host:a.host,path:"/wsman",port:a.port,rejectUnauthorized:false,checkServerIdentity:function(i){console.log("checkServerIdentity",JSON.stringify(i))}};var e=a.digest.request(f);e.on("error",function(i){a.gotNextMessagesError({status:600},"error",null,[d,c,g])});e.on("response",function(i){if(i.statusCode!=200){a.gotNextMessagesError({status:i.statusCode},"error",null,[d,c,g])}else{i.acc="";i.on("data",function(j){this.acc+=j});i.on("end",function(){a.gotNextMessages(i.acc,"success",{status:i.statusCode},[d,c,g])})}});e.end(d);a.ActiveAjaxCount++;return e};a.pendingAjaxCall=[];a.gotNextMessages=function(c,e,d,b){a.ActiveAjaxCount--;if(a.FailAllError==999){return}if(a.FailAllError!=0){b[1](null,a.FailAllError,b[2]);return}if(d.status!=200){b[1](null,d.status,b[2]);return}b[1](c,200,b[2]);a.PerformNextAjax()};a.gotNextMessagesError=function(d,e,c,b){a.ActiveAjaxCount--;if(a.FailAllError==999){return}if(a.FailAllError!=0){b[1](null,a.FailAllError,b[2]);return}if(a.FailAllError!=999){b[1]({Header:{HttpError:d.status}},d.status,b[2])}a.PerformNextAjax()};a.CancelAllQueries=function(b){while(a.PendingAjax.length>0){var c=a.PendingAjax.shift();c[1](null,b,c[2])}};return a}module.exports=CreateWsmanComm;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
agents/modules_meshcmd_min/amt.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
var GM=require("_GenericMarshal");function processManager(){this._ObjectID="process-manager";switch(process.platform){case"win32":this._kernel32=GM.CreateNativeProxy("kernel32.dll");this._kernel32.CreateMethod("GetLastError");this._kernel32.CreateMethod("CreateToolhelp32Snapshot");this._kernel32.CreateMethod("Process32First");this._kernel32.CreateMethod("Process32Next");break;case"linux":case"darwin":this._childProcess=require("child_process");break;default:throw (process.platform+" not supported");break}this.enumerateProcesses=function a(){var d=require("promise");var e=new d(function(g,f){this._res=g;this._rej=f});this.getProcesses(function(g,f){f._res(g)},e);return(e)};this.getProcesses=function b(d){switch(process.platform){default:throw ("Enumerating processes on "+process.platform+" not supported");break;case"win32":var n={};var e=this._kernel32.CreateToolhelp32Snapshot(2,0);var g=GM.CreateVariable(304);g.toBuffer().writeUInt32LE(304,0);var j=this._kernel32.Process32First(e,g);while(j.Val){n[g.Deref(8,4).toBuffer().readUInt32LE(0)]={pid:g.Deref(8,4).toBuffer().readUInt32LE(0),cmd:g.Deref(GM.PointerSize==4?36:44,260).String};j=this._kernel32.Process32Next(e,g)}if(d){d.apply(this,[n])}break;case"linux":if(!this._psp){this._psp={}}var l=this._childProcess.execFile("/bin/ps",["ps","-uxa"],{type:this._childProcess.SpawnTypes.TERM});this._psp[l.pid]=l;l.Parent=this;l.ps="";l.callback=d;l.args=[];for(var f=1;f<arguments.length;++f){l.args.push(arguments[f])}l.on("exit",function k(){delete this.Parent._psp[this.pid];var r={},q=this.ps.split("\x0D\x0A"),o={},p=0;for(var h in q){var t=q[h].split(" ");var s=[];for(var u in t){if(h==0&&t[u]){o[t[u]]=p++}if(h>0&&t[u]){s.push(t[u])}}if(h>0){if(s[o.PID]){r[s[o.PID]]={pid:o.PID,user:s[o.USER],cmd:s[o.COMMAND]}}}}if(this.callback){this.args.unshift(r);this.callback.apply(this.parent,this.args)}});l.stdout.on("data",function(h){this.parent.ps+=h.toString()});break;case"darwin":var m=require("promise");var l=new m(function(i,h){this._res=i;this._rej=h});l.pm=this;l.callback=d;l.args=[];for(var f=1;f<arguments.length;++f){l.args.push(arguments[f])}l.child=this._childProcess.execFile("/bin/ps",["ps","-xa"]);l.child.promise=l;l.child.stdout.ps="";l.child.stdout.on("data",function(h){this.ps+=h.toString()});l.child.on("exit",function(){var p=this.stdout.ps.split("\n");var q=p[0].split("PID")[0].length+3;var h=p[0].split("CMD")[0].length;var r={};for(var o=1;o<p.length;++o){if(p[o].length>0){r[p[o].substring(0,q).trim()]={pid:p[o].substring(0,q).trim(),cmd:p[o].substring(h)}}}this.promise._res(r)});l.then(function(h){this.args.unshift(h);this.callback.apply(this.pm,this.args)});break}};this.getProcessInfo=function c(g){switch(process.platform){default:throw ("getProcessInfo() not supported for "+process.platform);break;case"linux":var h=require("fs").readFileSync("/proc/"+g+"/status");var e={};var f=h.toString().split("\n");for(var d in f){var j=f[d].split(":");if(j.length>1){j[1]=j[1].trim()}e[j[0]]=j[1]}return(e);break}}}module.exports=new processManager();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function AMTScanner(){var a=require("events").inherits(this);a.createEvent("found");this.dgram=require("dgram");this.buildRmcpPing=function(c){var b=Buffer.from("06000006000011BE80000000","hex");b[9]=c;return b};this.parseRmcpPacket=function(h,b,g,d){if(b==null||b.length<20){return}var f={};if(((b[12]==0)||(b[13]!=0)||(b[14]!=1)||(b[15]!=87))&&(b[21]&32)){f.servertag=b[9];f.minorVersion=b[18]&15;f.majorVersion=(b[18]>>4)&15;f.provisioningState=b[19]&3;var e=(b[16]*256)+b[17];var c=((b[19]&4)!=0)?true:false;f.openPorts=[e];f.address=g.address;if(c==true){f.openPorts=[16992,16993]}if(d!==undefined){d(h,f)}}};this.parseIPv4Range=function(f){if(f==undefined||f==null){return null}var g=f.split("-");if(g.length==2){return{min:this.parseIpv4Addr(g[0]),max:this.parseIpv4Addr(g[1])}}g=f.split("/");if(g.length==2){var c=this.parseIpv4Addr(g[0]),e=parseInt(g[1]),d=0;if(e<=16||e>32){return null}e=32-e;for(var b=0;b<e;b++){d=(d<<1);d++}return{min:c&(4294967295-d),max:(c&(4294967295-d))+d}}g=this.parseIpv4Addr(f);if(g==null){return null}return{min:g,max:g}};this.parseIpv4Addr=function(b){var c=b.split(".");if(c.length==4){return(parseInt(c[0])<<24)+(parseInt(c[1])<<16)+(parseInt(c[2])<<8)+(parseInt(c[3])<<0)}return null};this.IPv4NumToStr=function(b){return((b>>24)&255)+"."+((b>>16)&255)+"."+((b>>8)&255)+"."+(b&255)};this.scan=function(d,g){var c=this.parseIPv4Range(d);var e=this.buildRmcpPing(0);var f=this.dgram.createSocket({type:"udp4"});f.parent=this;f.scanResults=[];f.on("error",function(i){console.log("Error:"+i)});f.on("message",function(i,j){if(j.size>4){this.parent.parseRmcpPacket(this,i,j,function(l,k){l.scanResults.push(k)})}});f.on("listening",function(){for(var j=c.min;j<=c.max;j++){f.send(e,623,f.parent.IPv4NumToStr(j))}});f.bind({address:"0.0.0.0",port:0,exclusive:true});var h=setTimeout(function b(){f.close();f.parent.emit("found",f.scanResults);delete f},g)}}module.exports=AMTScanner;

View File

@ -0,0 +1 @@
function CreateWsmanComm(){var a={};a.PendingAjax=[];a.ActiveAjaxCount=0;a.MaxActiveAjaxCount=1;a.FailAllError=0;a.digest=null;a.RequestCount=0;if(arguments.length==1&&typeof(arguments[0]=="object")){a.host=arguments[0].host;a.port=arguments[0].port;a.authToken=arguments[0].authToken;a.tls=arguments[0].tls}else{a.host=arguments[0];a.port=arguments[1];a.user=arguments[2];a.pass=arguments[3];a.tls=arguments[4]}a.PerformAjax=function(d,c,f,e,g,b){if((a.ActiveAjaxCount==0||((a.ActiveAjaxCount<a.MaxActiveAjaxCount)&&(a.challengeParams!=null)))&&a.PendingAjax.length==0){a.PerformAjaxEx(d,c,f,g,b)}else{if(e==1){a.PendingAjax.unshift([d,c,f,g,b])}else{a.PendingAjax.push([d,c,f,g,b])}}};a.PerformNextAjax=function(){if(a.ActiveAjaxCount>=a.MaxActiveAjaxCount||a.PendingAjax.length==0){return}var b=a.PendingAjax.shift();a.PerformAjaxEx(b[0],b[1],b[2],b[3],b[4]);a.PerformNextAjax()};a.PerformAjaxEx=function(d,c,g,h,b){if(a.FailAllError!=0){if(a.FailAllError!=999){a.gotNextMessagesError({status:a.FailAllError},"error",null,[d,c,g])}return}if(!d){d=""}if(a.digest==null){if(a.authToken){a.digest=require("http-digest").create({authToken:a.authToken})}else{a.digest=require("http-digest").create(a.user,a.pass)}a.digest.http=require("http")}var f={protocol:(a.tls==1?"https:":"http:"),method:"POST",host:a.host,path:"/wsman",port:a.port,rejectUnauthorized:false,checkServerIdentity:function(i){console.log("checkServerIdentity",JSON.stringify(i))}};var e=a.digest.request(f);e.on("error",function(i){a.gotNextMessagesError({status:600},"error",null,[d,c,g])});e.on("response",function(i){if(i.statusCode!=200){a.gotNextMessagesError({status:i.statusCode},"error",null,[d,c,g])}else{i.acc="";i.on("data",function(j){this.acc+=j});i.on("end",function(){a.gotNextMessages(i.acc,"success",{status:i.statusCode},[d,c,g])})}});e.end(d);a.ActiveAjaxCount++;return e};a.pendingAjaxCall=[];a.gotNextMessages=function(c,e,d,b){a.ActiveAjaxCount--;if(a.FailAllError==999){return}if(a.FailAllError!=0){b[1](null,a.FailAllError,b[2]);return}if(d.status!=200){b[1](null,d.status,b[2]);return}b[1](c,200,b[2]);a.PerformNextAjax()};a.gotNextMessagesError=function(d,e,c,b){a.ActiveAjaxCount--;if(a.FailAllError==999){return}if(a.FailAllError!=0){b[1](null,a.FailAllError,b[2]);return}if(a.FailAllError!=999){b[1]({Header:{HttpError:d.status}},d.status,b[2])}a.PerformNextAjax()};a.CancelAllQueries=function(b){while(a.PendingAjax.length>0){var c=a.PendingAjax.shift();c[1](null,b,c[2])}};return a}module.exports=CreateWsmanComm;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
try{Object.defineProperty(Array.prototype,"peek",{value:function(){return(this.length>0?this[this.length-1]:undefined)}})}catch(e){}function dbus(a,b){this._ObjectID="linux-dbus";require("events").EventEmitter.call(this,true).createEvent("signal");Object.defineProperty(this,"uid",{value:b});this._child=require("child_process").execFile("/bin/sh",["sh"],{type:require("child_process").SpawnTypes.TERM,uid:b==null?-1:b});this._child.stdin.write("dbus-monitor --session \"type='signal', interface='"+a+'\'" | ( while read X; do echo "$X"; done )\n');this._child.stdout.dbus=this;this._child.stdout.on("data",function(c){if(!this.ready){this.ready=true;return}var f=[];var g=c.toString().split("\r\n");for(var d in g){if(g[d]==""){this.dbus.preParseRecords(f);f=[]}else{f.push(g[d])}}});this.preParseRecords=function(d){var f=[];for(var c in d){if(d[c].startsWith("signal ")){if(f.length>0){this.parseRecords(f)}f=[]}f.push(d[c])}if(f.length>0){this.parseRecords(f)}};this.parseRecords=function(d){if(d[0].startsWith("signal ")){var g={};var h=d[0].split(" ");h.shift();for(var c in h){var f=h[c].split("=");if(f.length==2){g[f[0]]=f[1]}}d.shift();g.data=d;this.parseSignal(g)}};this.parseSignal=function(f){var c=f.data;f.data=[];for(var d=0;d<c.length;++d){if(c[d].startsWith("array ")){f.data.push([]);for(d=d+1;d<c.length;++d){this.parseSignal2(c[d],f.data.peek())}}else{this.parseSignal2(c[d],f.data)}}this.emit("signal",f)};this.parseSignal2=function(c,d){if(c.startsWith("string ")){d.push(JSON.parse(c.slice(7)))}else{if(c.startsWith("boolean ")){d.push(JSON.parse(c.slice(8)))}}}}module.exports=dbus;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function powerMonitor(){this._ObjectID="power-monitor";require("events").EventEmitter.call(this,true).createEvent("changed").createEvent("sx").createEvent("batteryLevel").createEvent("acdc").createEvent("display");this._i=setImmediate(function(a){require("user-sessions");delete a._i},this)}module.exports=new powerMonitor();

View File

@ -0,0 +1 @@
var GM=require("_GenericMarshal");function processManager(){this._ObjectID="process-manager";switch(process.platform){case"win32":this._kernel32=GM.CreateNativeProxy("kernel32.dll");this._kernel32.CreateMethod("GetLastError");this._kernel32.CreateMethod("CreateToolhelp32Snapshot");this._kernel32.CreateMethod("Process32First");this._kernel32.CreateMethod("Process32Next");break;case"linux":case"darwin":this._childProcess=require("child_process");break;default:throw (process.platform+" not supported");break}this.enumerateProcesses=function a(){var d=require("promise");var e=new d(function(g,f){this._res=g;this._rej=f});this.getProcesses(function(g,f){f._res(g)},e);return(e)};this.getProcesses=function b(d){switch(process.platform){default:throw ("Enumerating processes on "+process.platform+" not supported");break;case"win32":var n={};var e=this._kernel32.CreateToolhelp32Snapshot(2,0);var g=GM.CreateVariable(304);g.toBuffer().writeUInt32LE(304,0);var j=this._kernel32.Process32First(e,g);while(j.Val){n[g.Deref(8,4).toBuffer().readUInt32LE(0)]={pid:g.Deref(8,4).toBuffer().readUInt32LE(0),cmd:g.Deref(GM.PointerSize==4?36:44,260).String};j=this._kernel32.Process32Next(e,g)}if(d){d.apply(this,[n])}break;case"linux":if(!this._psp){this._psp={}}var l=this._childProcess.execFile("/bin/ps",["ps","-uxa"],{type:this._childProcess.SpawnTypes.TERM});this._psp[l.pid]=l;l.Parent=this;l.ps="";l.callback=d;l.args=[];for(var f=1;f<arguments.length;++f){l.args.push(arguments[f])}l.on("exit",function k(){delete this.Parent._psp[this.pid];var r={},q=this.ps.split("\x0D\x0A"),o={},p=0;for(var h in q){var t=q[h].split(" ");var s=[];for(var u in t){if(h==0&&t[u]){o[t[u]]=p++}if(h>0&&t[u]){s.push(t[u])}}if(h>0){if(s[o.PID]){r[s[o.PID]]={pid:o.PID,user:s[o.USER],cmd:s[o.COMMAND]}}}}if(this.callback){this.args.unshift(r);this.callback.apply(this.parent,this.args)}});l.stdout.on("data",function(h){this.parent.ps+=h.toString()});break;case"darwin":var m=require("promise");var l=new m(function(i,h){this._res=i;this._rej=h});l.pm=this;l.callback=d;l.args=[];for(var f=1;f<arguments.length;++f){l.args.push(arguments[f])}l.child=this._childProcess.execFile("/bin/ps",["ps","-xa"]);l.child.promise=l;l.child.stdout.ps="";l.child.stdout.on("data",function(h){this.ps+=h.toString()});l.child.on("exit",function(){var p=this.stdout.ps.split("\n");var q=p[0].split("PID")[0].length+3;var h=p[0].split("CMD")[0].length;var r={};for(var o=1;o<p.length;++o){if(p[o].length>0){r[p[o].substring(0,q).trim()]={pid:p[o].substring(0,q).trim(),cmd:p[o].substring(h)}}}this.promise._res(r)});l.then(function(h){this.args.unshift(h);this.callback.apply(this.pm,this.args)});break}};this.getProcessInfo=function c(g){switch(process.platform){default:throw ("getProcessInfo() not supported for "+process.platform);break;case"linux":var h=require("fs").readFileSync("/proc/"+g+"/status");var e={};var f=h.toString().split("\n");for(var d in f){var j=f[d].split(":");if(j.length>1){j[1]=j[1].trim()}e[j[0]]=j[1]}return(e);break}}}module.exports=new processManager();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
var toasters={};function Toaster(){this._ObjectID="toaster";this.Toast=function a(l,b){var h={};var d=require("events").inherits(h);d.createEvent("Dismissed");h.title=l;h.caption=b;if(process.platform=="win32"){d.createEvent("Clicked");var j=require("user-sessions").Current();for(var f in j){console.log(j[f])}try{console.log("Attempting Toast Mechanism 1");h._child=require("ScriptContainer").Create({processIsolation:true,sessionId:j.Active[0].SessionId})}catch(c){console.log(c);console.log("Attempting Toast Mechanism 2");h._child=require("ScriptContainer").Create({processIsolation:true})}h._child.parent=h;h._child.on("exit",function(e){this.parent.emit("Dismissed");delete this.parent._child});h._child.addModule("win-console",getJSModule("win-console"));h._child.addModule("win-message-pump",getJSModule("win-message-pump"));var k=" try{ var toast = require('win-console'); var balloon = toast.SetTrayIcon({ szInfo: '"+b+"', szInfoTitle: '"+l+"', balloonOnly: true }); balloon.on('ToastDismissed', function(){process.exit();}); } catch(e) { require('ScriptContainer').send(e); } require('ScriptContainer').send('done'); ";h._child.ExecuteString(k);toasters[h._hashCode()]=h;h.on("Dismissed",function(){delete toasters[this._hashCode()]});console.log("Returning");return(h)}else{if(!require("fs").existsSync("/usr/bin/notify-send")){throw ("Toast not supported on this platform")}Object.defineProperty(h,"_sessions",{value:require("user-sessions").Current(function g(e){this._cchild=require("child_process").execFile("/usr/bin/whoami",["whoami"],{type:require("child_process").SpawnTypes.TERM});this._cchild.stdout.on("data",function(i){if(i.toString().split("\r\n")[0]=="root"){if(e[":0"].State!="Connected"&&e[":0"].State!="Active"){this.parent.parent.Parent.emit("Dismissed");return}this.parent.parent._notify=require("child_process").execFile("/bin/sh",["sh"],{type:require("child_process").SpawnTypes.TERM});this.parent.parent._notify.stdin.write("su - "+e[":0"].Username+" -c \"DISPLAY=:0 notify-send '"+this.parent.parent.Parent.title+"' '"+this.parent.parent.Parent.caption+"'\"\n");this.parent.parent._notify.stdin.write("exit\n");this.parent.parent._notify.stdout.on("data",function(n){})}else{this.parent.parent._notify=require("child_process").execFile("/usr/bin/notify-send",["notify-send",this.parent.parent.Parent.title,this.parent.parent.Parent.caption],{type:require("child_process").SpawnTypes.TERM});this.parent.parent._notify.stdout.on("data",function(n){})}this.parent.parent.Parent._timeout=setTimeout(function m(n){n.emit("Dismissed")},10000,this.parent.parent.Parent)});this._cchild.parent=this})});h._sessions.Parent=h;toasters[h._hashCode()]=h;h.on("Dismissed",function(){delete toasters[this._hashCode()]});return(h)}}}module.exports=new Toaster();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
function _Scan(){var f=this.Marshal.CreatePointer();this.Native.WlanEnumInterfaces(this.Handle,0,f);var a=f.Deref().Deref(0,4).toBuffer().readUInt32LE(0);var d=f.Deref().Deref(8,532);var c=d.Deref(16,512).AnsiString;var e;switch(d.Deref(528,4).toBuffer().readUInt32LE(0)){case 0:e="NOT READY";break;case 1:e="CONNECTED";break;case 2:e="AD-HOC";break;case 3:e="DISCONNECTING";break;case 4:e="DISCONNECTED";break;case 5:e="ASSOCIATING";break;case 6:e="DISCOVERING";break;case 7:e="AUTHENTICATING";break;default:e="UNKNOWN";break}var b=d.Deref(0,16);if(this.Native.WlanScan(this.Handle,b,0,0,0).Val==0){return(true)}else{return(false)}}function AccessPoint(d,a,c,b){this.ssid=d;this.bssid=a;this.rssi=c;this.lq=b}AccessPoint.prototype.toString=function(){return(this.ssid+" ["+this.bssid+"]: "+this.lq)};function OnNotify(g){var h=g.Deref(0,4).toBuffer().readUInt32LE(0);var f=g.Deref(4,4).toBuffer().readUInt32LE(0);var c=g.Deref(8,16);if((h&8)&&(f==7)){var a=this.Parent.Marshal.CreatePointer();var k=this.Parent.Native.GetBSSList(this.Parent.Handle,c,0,3,0,0,a).Val;if(k==0){var n=a.Deref().Deref(0,4).toBuffer().readUInt32LE(0);var j=a.Deref().Deref(4,4).toBuffer().readUInt32LE(0);for(i=0;i<j;++i){var d=a.Deref().Deref(8+(360*i),360);var m=d.Deref(4,32).String.trim();var b=d.Deref(40,6).HexString2;var l=d.Deref(56,4).toBuffer().readUInt32LE(0);var e=d.Deref(60,4).toBuffer().readUInt32LE(0);this.Parent.emit("Scan",new AccessPoint(m,b,l,e))}}}}function Wireless(){var a=require("events").inherits(this);this.Marshal=require("_GenericMarshal");this.Native=this.Marshal.CreateNativeProxy("wlanapi.dll");this.Native.CreateMethod("WlanOpenHandle");this.Native.CreateMethod("WlanGetNetworkBssList","GetBSSList");this.Native.CreateMethod("WlanRegisterNotification");this.Native.CreateMethod("WlanEnumInterfaces");this.Native.CreateMethod("WlanScan");this.Native.CreateMethod("WlanQueryInterface");var c=this.Marshal.CreatePointer();var b=this.Marshal.CreatePointer();this.Native.WlanOpenHandle(2,0,c,b);this.Handle=b.Deref();this._NOTIFY_PROXY_OBJECT=this.Marshal.CreateCallbackProxy(OnNotify,2);this._NOTIFY_PROXY_OBJECT.Parent=this;var d=this.Marshal.CreatePointer();var e=this.Native.WlanRegisterNotification(this.Handle,65535,0,this._NOTIFY_PROXY_OBJECT.Callback,this._NOTIFY_PROXY_OBJECT.State,0,d);a.createEvent("Scan");a.addMethod("Scan",_Scan);this.GetConnectedNetwork=function(){var n=this.Marshal.CreatePointer();console.log("Success = "+this.Native.WlanEnumInterfaces(this.Handle,0,n).Val);var h=n.Deref().Deref(0,4).toBuffer().readUInt32LE(0);var m=n.Deref().Deref(8,532);var l=m.Deref(16,512).AnsiString;var o=m.Deref(528,4).toBuffer().readUInt32LE(0);if(m.Deref(528,4).toBuffer().readUInt32LE(0)==1){var j=this.Marshal.CreatePointer();var q=this.Marshal.CreatePointer();var s=this.Marshal.CreatePointer();var k=m.Deref(0,16);var r=this.Native.WlanQueryInterface(this.Handle,k,7,0,j,q,s).Val;if(r==0){var f=q.Deref().Deref(524,32).String;var g=q.Deref().Deref(560,6).HexString;var p=q.Deref().Deref(576,4).toBuffer().readUInt32LE(0);return(new AccessPoint(f,g,0,p))}}throw ("GetConnectedNetworks: FAILED (not associated to a network)")};return(this)}module.exports=new Wireless();

View File

@ -0,0 +1 @@
var MemoryStream=require("MemoryStream");var WindowsChildScript='var parent = require("ScriptContainer");var Wireless = require("wifi-scanner-windows");Wireless.on("Scan", function (ap) { parent.send(ap); });Wireless.Scan();';function AccessPoint(c,a,b){this.ssid=c;this.bssid=a;this.lq=b}AccessPoint.prototype.toString=function(){return("["+this.bssid+"]: "+this.ssid+" ("+this.lq+")")};function WiFiScanner(){var a=require("events").inherits(this);a.createEvent("accessPoint");this.hasWireless=function(){var d=false;var b=require("os").networkInterfaces();for(var c in b){if(b[c][0].type=="wireless"){d=true;break}}return(d)};this.Scan=function(){if(process.platform=="win32"){this.master=require("ScriptContainer").Create(15,ContainerPermissions.DEFAULT);this.master.parent=this;this.master.on("data",function(e){this.parent.emit("accessPoint",new AccessPoint(e.ssid,e.bssid,e.lq))});this.master.addModule("wifi-scanner-windows",getJSModule("wifi-scanner-windows"));this.master.ExecuteString(WindowsChildScript)}else{if(process.platform=="linux"){var c=require("os").networkInterfaces();var d=null;for(var b in c){if(c[b][0].type=="wireless"){d=b;break}}if(d!=null){this.child=require("child_process").execFile("/sbin/iwlist",["iwlist",d,"scan"]);this.child.parent=this;this.child.ms=new MemoryStream();this.child.ms.parent=this.child;this.child.stdout.on("data",function(e){this.parent.ms.write(e)});this.child.on("exit",function(){this.ms.end()});this.child.ms.on("end",function(){var l=this.buffer.toString();tokens=l.split(" - Address: ");for(var h in tokens){if(h==0){continue}var i=tokens[h].split("\n");var e=i[0];var f;var g;for(var j in i){j=i[j].trim();j=j.trim();if(j.startsWith("ESSID:")){g=j.slice(7,j.length-1);if(g=="<hidden>"){g=""}}if(j.startsWith("Signal level=")){f=j.slice(13,j.length-4)}else{if(j.startsWith("Quality=")){f=j.slice(8,10);var k=j.slice(11,13)}}}this.parent.parent.emit("accessPoint",new AccessPoint(g,e,f))}})}}}}}module.exports=WiFiScanner;

View File

@ -0,0 +1 @@
var TrayIconFlags={NIF_MESSAGE:1,NIF_ICON:2,NIF_TIP:4,NIF_STATE:8,NIF_INFO:16,NIF_GUID:32,NIF_REALTIME:64,NIF_SHOWTIP:128,NIM_ADD:0,NIM_MODIFY:1,NIM_DELETE:2,NIM_SETFOCUS:3,NIM_SETVERSION:4};var NOTIFYICON_VERSION_4=4;var MessageTypes={WM_APP:32768,WM_USER:1024};function WindowsConsole(){if(process.platform=="win32"){this._ObjectID="win-console";this._Marshal=require("_GenericMarshal");this._kernel32=this._Marshal.CreateNativeProxy("kernel32.dll");this._user32=this._Marshal.CreateNativeProxy("user32.dll");this._kernel32.CreateMethod("GetConsoleWindow");this._kernel32.CreateMethod("GetCurrentThread");this._user32.CreateMethod("ShowWindow");this._user32.CreateMethod("LoadImageA");this._user32.CreateMethod({method:"GetMessageA",threadDispatch:1});this._shell32=this._Marshal.CreateNativeProxy("Shell32.dll");this._shell32.CreateMethod("Shell_NotifyIconA");this._handle=this._kernel32.GetConsoleWindow();this.minimize=function(){this._user32.ShowWindow(this._handle,6)};this.restore=function(){this._user32.ShowWindow(this._handle,9)};this.hide=function(){this._user32.ShowWindow(this._handle,0)};this.show=function(){this._user32.ShowWindow(this._handle,5)};this._loadicon=function(c){var b=this._user32.LoadImageA(0,this._Marshal.CreateVariable(c),1,0,0,16|32768|64);return(b)};this.SetTrayIcon=function a(h){var b=this._Marshal.CreateVariable(this._Marshal.PointerSize==4?508:528);b.toBuffer().writeUInt32LE(b._size,0);var n=TrayIconFlags.NIF_TIP|TrayIconFlags.NIF_MESSAGE;h.filter=MessageTypes.WM_APP+1;b.Deref(this._Marshal.PointerSize==4?16:24,4).toBuffer().writeUInt32LE(h.filter);if(!h.noBalloon){n|=TrayIconFlags.NIF_INFO}if(h.icon){n|=TrayIconFlags.NIF_ICON;var c=b.Deref(this._Marshal.PointerSize==4?20:32,this._Marshal.PointerSize);h.icon.pointerBuffer().copy(c.toBuffer())}b.Deref(this._Marshal.PointerSize*2,4).toBuffer().writeUInt32LE(1);b.Deref(this._Marshal.PointerSize==4?12:20,4).toBuffer().writeUInt32LE(n);b.Deref(this._Marshal.PointerSize==4?416:432,4).toBuffer().writeUInt32LE(NOTIFYICON_VERSION_4);var m=b.Deref(this._Marshal.PointerSize==4?24:40,128);var k=b.Deref(this._Marshal.PointerSize==4?160:176,256);var l=b.Deref(this._Marshal.PointerSize==4?420:436,64);if(h.szTip){Buffer.from(h.szTip).copy(m.toBuffer())}if(h.szInfo){Buffer.from(h.szInfo).copy(k.toBuffer())}if(h.szInfoTitle){Buffer.from(h.szInfoTitle).copy(l.toBuffer())}var d=require("win-message-pump");retVal={_ObjectID:"WindowsConsole.TrayIcon",MessagePump:new d(h)};var j=require("events").inherits(retVal);j.createEvent("ToastClicked");j.createEvent("IconHover");j.createEvent("ToastDismissed");retVal.Options=h;retVal.MessagePump.TrayIcon=retVal;retVal.MessagePump.NotifyData=b;retVal.MessagePump.WindowsConsole=this;retVal.MessagePump.on("exit",function e(o){console.log("Pump Exited");if(this.TrayIcon){this.TrayIcon.remove()}});retVal.MessagePump.on("hwnd",function f(o){h.hwnd=o;o.pointerBuffer().copy(this.NotifyData.Deref(this.WindowsConsole._Marshal.PointerSize,this.WindowsConsole._Marshal.PointerSize).toBuffer());if(this.WindowsConsole._shell32.Shell_NotifyIconA(TrayIconFlags.NIM_ADD,this.NotifyData).Val==0){}});retVal.MessagePump.on("message",function g(p){if(p.message==this.TrayIcon.Options.filter){var o=false;if(p.wparam==1&&p.lparam==1029){this.TrayIcon.emit("ToastClicked");o=true}if(p.wparam==1&&p.lparam==512){this.TrayIcon.emit("IconHover");o=true}if(this.TrayIcon.Options.balloonOnly&&p.wparam==1&&(p.lparam==1028||p.lparam==1029)){this.TrayIcon.emit("ToastDismissed");this.TrayIcon.remove();o=true}if(!o){console.log(p)}}});retVal.remove=function i(){this.MessagePump.WindowsConsole._shell32.Shell_NotifyIconA(TrayIconFlags.NIM_DELETE,this.MessagePump.NotifyData);this.MessagePump.stop();delete this.MessagePump.TrayIcon;delete this.MessagePump};return(retVal)}}}module.exports=new WindowsConsole();

View File

@ -0,0 +1 @@
var WH_CALLWNDPROC=4;var WM_QUIT=18;var GM=require("_GenericMarshal");function WindowsMessagePump(d){this._ObjectID="win-message-pump";this._options=d;var b=require("events").inherits(this);b.createEvent("hwnd");b.createEvent("error");b.createEvent("message");b.createEvent("exit");this._msg=GM.CreateVariable(GM.PointerSize==4?28:48);this._kernel32=GM.CreateNativeProxy("Kernel32.dll");this._kernel32.mp=this;this._kernel32.CreateMethod("GetLastError");this._kernel32.CreateMethod("GetModuleHandleA");this._user32=GM.CreateNativeProxy("User32.dll");this._user32.mp=this;this._user32.CreateMethod("GetMessageA");this._user32.CreateMethod("CreateWindowExA");this._user32.CreateMethod("TranslateMessage");this._user32.CreateMethod("DispatchMessageA");this._user32.CreateMethod("RegisterClassExA");this._user32.CreateMethod("DefWindowProcA");this._user32.CreateMethod("PostMessageA");this.wndclass=GM.CreateVariable(GM.PointerSize==4?48:80);this.wndclass.mp=this;this.wndclass.hinstance=this._kernel32.GetModuleHandleA(0);this.wndclass.cname=GM.CreateVariable("MainWWWClass");this.wndclass.wndproc=GM.GetGenericGlobalCallback(4);this.wndclass.wndproc.mp=this;this.wndclass.toBuffer().writeUInt32LE(this.wndclass._size);this.wndclass.cname.pointerBuffer().copy(this.wndclass.Deref(GM.PointerSize==4?40:64,GM.PointerSize).toBuffer());this.wndclass.wndproc.pointerBuffer().copy(this.wndclass.Deref(8,GM.PointerSize).toBuffer());this.wndclass.hinstance.pointerBuffer().copy(this.wndclass.Deref(GM.PointerSize==4?20:24,GM.PointerSize).toBuffer());this.wndclass.wndproc.on("GlobalCallback",function c(h,i,g,f){if(this.mp._hwnd!=null&&this.mp._hwnd.Val==h.Val){this.mp.emit("message",{message:i.Val,wparam:g.Val,lparam:f.Val,lparam_hex:f.pointerBuffer().toString("hex")});return(this.mp._user32.DefWindowProcA(h,i,g,f))}else{if(this.mp._hwnd==null&&this.CallingThread()==this.mp._user32.RegisterClassExA.async.threadId()){return(this.mp._user32.DefWindowProcA(h,i,g,f))}}});this._user32.RegisterClassExA.async(this.wndclass).then(function(){this.nativeProxy.CreateWindowExA.async(this.nativeProxy.RegisterClassExA.async,136,this.nativeProxy.mp.wndclass.cname,0,8388608,0,0,100,100,0,0,0,0).then(function(f){if(f.Val==0){this.nativeProxy.mp.emit("error","Error creating hidden window")}else{this.nativeProxy.mp._hwnd=f;this.nativeProxy.mp.emit("hwnd",f);this.nativeProxy.mp._startPump()}})});this._startPump=function a(){this._user32.GetMessageA.async(this._user32.RegisterClassExA.async,this._msg,this._hwnd,0,0).then(function(f){if(f.Val>0){this.nativeProxy.TranslateMessage.async(this.nativeProxy.RegisterClassExA.async,this.nativeProxy.mp._msg).then(function(){this.nativeProxy.DispatchMessageA.async(this.nativeProxy.RegisterClassExA.async,this.nativeProxy.mp._msg).then(function(){this.nativeProxy.mp._startPump()})})}else{delete this.nativeProxy.mp._hwnd;this.nativeProxy.mp.emit("exit",0)}},function(f){this.nativeProxy.mp.stop()})};this.stop=function e(){if(this._hwnd){this._user32.PostMessageA(this._hwnd,WM_QUIT,0,0)}}}module.exports=WindowsMessagePump;

View File

@ -0,0 +1 @@
var KEY_QUERY_VALUE=1;var KEY_WRITE=131078;var KEY_DATA_TYPES={REG_NONE:0,REG_SZ:1,REG_EXPAND_SZ:2,REG_BINARY:3,REG_DWORD:4,REG_DWORD_BIG_ENDIAN:5,REG_LINK:6,REG_MULTI_SZ:7,REG_RESOURCE_LIST:8,REG_FULL_RESOURCE_DESCRIPTOR:9,REG_RESOURCE_REQUIREMENTS_LIST:10,REG_QWORD:11};function windows_registry(){this._ObjectId="win-registry";this._marshal=require("_GenericMarshal");this._AdvApi=this._marshal.CreateNativeProxy("Advapi32.dll");this._AdvApi.CreateMethod("RegCreateKeyExA");this._AdvApi.CreateMethod("RegOpenKeyExA");this._AdvApi.CreateMethod("RegQueryValueExA");this._AdvApi.CreateMethod("RegCloseKey");this._AdvApi.CreateMethod("RegDeleteKeyA");this._AdvApi.CreateMethod("RegDeleteValueA");this._AdvApi.CreateMethod("RegSetValueExA");this.HKEY={Root:Buffer.from("80000000","hex").swap32(),CurrentUser:Buffer.from("80000001","hex").swap32(),LocalMachine:Buffer.from("80000002","hex").swap32(),Users:Buffer.from("80000003","hex").swap32()};this.QueryKey=function b(g,k,i){var e=this._marshal.CreatePointer();var j=this._marshal.CreateVariable(4);var m=this._marshal.CreateVariable(4);i=this._marshal.CreateVariable(i);var f=this._marshal.CreatePointer(g);var l=null;if(this._AdvApi.RegOpenKeyExA(f,this._marshal.CreateVariable(k),0,KEY_QUERY_VALUE,e).Val!=0){throw ("Error Opening Registry Key: "+k)}if(this._AdvApi.RegQueryValueExA(e.Deref(),i,0,0,0,j).Val==0){var d=this._marshal.CreateVariable(j.toBuffer().readUInt32LE());if(this._AdvApi.RegQueryValueExA(e.Deref(),i,0,m,d,j).Val==0){switch(m.toBuffer().readUInt32LE()){case KEY_DATA_TYPES.REG_DWORD:l=d.toBuffer().readUInt32LE();break;case KEY_DATA_TYPES.REG_DWORD_BIG_ENDIAN:l=d.toBuffer().readUInt32BE();break;case KEY_DATA_TYPES.REG_SZ:l=d.String;break;case KEY_DATA_TYPES.REG_BINARY:default:l=d.toBuffer();l._data=d;break}}}else{this._AdvApi.RegCloseKey(e.Deref());throw ("Not Found")}this._AdvApi.RegCloseKey(e.Deref());return(l)};this.WriteKey=function c(g,j,i,l){var k;var f=this._marshal.CreatePointer();if(this._AdvApi.RegCreateKeyExA(this._marshal.CreatePointer(g),this._marshal.CreateVariable(j),0,0,0,KEY_WRITE,0,f,0).Val!=0){throw ("Error Opening Registry Key: "+j)}var d;var e;switch(typeof(l)){case"boolean":e=KEY_DATA_TYPES.REG_DWORD;d=this._marshal.CreateVariable(4);d.toBuffer().writeUInt32LE(l?1:0);break;case"number":e=KEY_DATA_TYPES.REG_DWORD;d=this._marshal.CreateVariable(4);d.toBuffer().writeUInt32LE(l);break;case"string":e=KEY_DATA_TYPES.REG_SZ;d=this._marshal.CreateVariable(l);break;default:e=KEY_DATA_TYPES.REG_BINARY;d=this._marshal.CreateVariable(l.length);l.copy(d.toBuffer());break}if(this._AdvApi.RegSetValueExA(f.Deref(),this._marshal.CreateVariable(i),0,e,d,d._size).Val!=0){this._AdvApi.RegCloseKey(f.Deref());throw ("Error writing reg key: "+i)}this._AdvApi.RegCloseKey(f.Deref())};this.DeleteKey=function a(e,g,f){if(!f){if(this._AdvApi.RegDeleteKeyA(this._marshal.CreatePointer(e),this._marshal.CreateVariable(g)).Val!=0){throw ("Error Deleting Key: "+g)}}else{var d=this._marshal.CreatePointer();var i;if(this._AdvApi.RegOpenKeyExA(this._marshal.CreatePointer(e),this._marshal.CreateVariable(g),0,KEY_QUERY_VALUE|KEY_WRITE,d).Val!=0){throw ("Error Opening Registry Key: "+g)}if((i=this._AdvApi.RegDeleteValueA(d.Deref(),this._marshal.CreateVariable(f)).Val)!=0){this._AdvApi.RegCloseKey(d.Deref());throw ("Error["+i+"] Deleting Key: "+g+"."+f)}this._AdvApi.RegCloseKey(d.Deref())}}}module.exports=new windows_registry();

File diff suppressed because one or more lines are too long

View File

@ -101,7 +101,33 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
if (msg.length == 4) { ChangeAgentCoreInfo({ "caps": 0 }); } // If the agent indicated that no core is running, clear the core information string. if (msg.length == 4) { ChangeAgentCoreInfo({ "caps": 0 }); } // If the agent indicated that no core is running, clear the core information string.
// Mesh core hash, sent by agent with the hash of the current mesh core. // Mesh core hash, sent by agent with the hash of the current mesh core.
if (obj.agentCoreCheck == 1000) return; // If we are using a custom core, don't try to update it. if (obj.agentCoreCheck == 1000) return; // If we are using a custom core, don't try to update it.
// We need to check if the core is current.
// Get the current meshcore hash
const agentMeshCoreHash = (msg.length == 52) ? msg.substring(4, 52) : null;
// We need to check if the core is current. First, figure out what core we need.
const corename = obj.parent.parent.meshAgentsArchitectureNumbers[obj.agentInfo.agentId].core;
if (corename != null) {
const meshcorehash = obj.parent.parent.defaultMeshCoresHash[corename];
if (agentMeshCoreHash != meshcorehash) {
if (obj.agentCoreCheck < 5) {
if (meshcorehash == null) {
// Update no core
obj.send(obj.common.ShortToStr(10) + obj.common.ShortToStr(0)); // Command 10, ask mesh agent to clear the core
obj.parent.parent.debug(1, 'Clearing core');
} else {
// Update new core
obj.send(obj.common.ShortToStr(10) + obj.common.ShortToStr(0) + meshcorehash + obj.parent.parent.defaultMeshCores[corename]);
obj.parent.parent.debug(1, 'Updating code ' + corename);
}
obj.agentCoreCheck++;
}
} else {
obj.agentCoreCheck = 0;
}
}
/*
// TODO: Check if we have a mesh specific core. If so, use that. // TODO: Check if we have a mesh specific core. If so, use that.
var agentMeshCoreHash = null; var agentMeshCoreHash = null;
if (msg.length == 52) { agentMeshCoreHash = msg.substring(4, 52); } if (msg.length == 52) { agentMeshCoreHash = msg.substring(4, 52); }
@ -123,6 +149,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
} else { } else {
obj.agentCoreCheck = 0; obj.agentCoreCheck = 0;
} }
*/
} }
else if (cmdid == 12) { // MeshCommand_AgentHash else if (cmdid == 12) { // MeshCommand_AgentHash
if ((msg.length == 52) && (obj.agentExeInfo != null) && (obj.agentExeInfo.update == true)) { if ((msg.length == 52) && (obj.agentExeInfo != null) && (obj.agentExeInfo.update == true)) {

View File

@ -48,10 +48,8 @@ function CreateMeshCentralServer(config, args) {
obj.dbconfig = {}; // Persistance values, loaded from database obj.dbconfig = {}; // Persistance values, loaded from database
obj.certificateOperations = null; obj.certificateOperations = null;
obj.defaultMeshCmd = null; obj.defaultMeshCmd = null;
obj.defaultMeshCore = null; obj.defaultMeshCores = {};
obj.defaultMeshCoreHash = null; obj.defaultMeshCoresHash = {};
obj.defaultMeshCoreNoMei = null;
obj.defaultMeshCoreNoMeiHash = null;
obj.meshAgentBinaries = {}; // Mesh Agent Binaries, Architecture type --> { hash:(sha384 hash), size:(binary size), path:(binary path) } obj.meshAgentBinaries = {}; // Mesh Agent Binaries, Architecture type --> { hash:(sha384 hash), size:(binary size), path:(binary path) }
obj.meshAgentInstallScripts = {}; // Mesh Install Scripts, Script ID -- { hash:(sha384 hash), size:(binary size), path:(binary path) } obj.meshAgentInstallScripts = {}; // Mesh Install Scripts, Script ID -- { hash:(sha384 hash), size:(binary size), path:(binary path) }
obj.multiServer = null; obj.multiServer = null;
@ -863,6 +861,23 @@ function CreateMeshCentralServer(config, args) {
} }
}; };
// Escape a code string
obj.escapeCodeString = function (str) {
const escapeCodeStringTable = { '\'': '\\\'', '\"': '\\"', '\\': '\\\\', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t' };
var r = '', c, cr, table;
for (var i = 0; i < str.length; i++) {
c = str[i];
table = escapeCodeStringTable[c];
if (table != null) {
r += table;
} else {
cr = c.charCodeAt(0);
if ((cr >= 32) && (cr <= 127)) { r += c; }
}
}
return r;
}
// Update the default mesh core // Update the default mesh core
obj.updateMeshCoreTimer = 'notset'; obj.updateMeshCoreTimer = 'notset';
obj.updateMeshCore = function (func) { obj.updateMeshCore = function (func) {
@ -871,35 +886,64 @@ function CreateMeshCentralServer(config, args) {
if (obj.fs.existsSync(obj.path.join(meshcorePath, 'meshcore.js')) == false) { if (obj.fs.existsSync(obj.path.join(meshcorePath, 'meshcore.js')) == false) {
meshcorePath = obj.path.join(__dirname, 'agents'); meshcorePath = obj.path.join(__dirname, 'agents');
if (obj.fs.existsSync(obj.path.join(meshcorePath, 'meshcore.js')) == false) { if (obj.fs.existsSync(obj.path.join(meshcorePath, 'meshcore.js')) == false) {
obj.defaultMeshCoreNoMei = obj.defaultMeshCoreNoMeiHash = obj.defaultMeshCore = obj.defaultMeshCoreHash = null; if (func != null) { func(false); } // meshcore.js not found obj.defaultMeshCores = obj.defaultMeshCoresHash = { }; if (func != null) { func(false); } // meshcore.js not found
} }
} }
// Read meshcore.js and all .js files in the modules folder. // Read meshcore.js and all .js files in the modules folder.
var moduleAdditions = 'var addedModules = [];', moduleAdditionsNoMei = 'var addedModules = [];', meshCore = null, modulesDir = null; var meshCore = null, modulesDir = null;
try { meshCore = obj.fs.readFileSync(obj.path.join(meshcorePath, 'meshcore.js')).toString(); } catch (e) { } const modulesAdd = {
'windows-amt': 'var addedModules = [];\r\n',
'linux-amt': 'var addedModules = [];\r\n',
'linux-noamt': 'var addedModules = [];\r\n'
};
try { meshCore = obj.fs.readFileSync(obj.path.join(meshcorePath, 'meshcore.min.js')).toString(); } catch (e) { } // Favor minified meshcore if present.
if (meshCore == null) { try { meshCore = obj.fs.readFileSync(obj.path.join(meshcorePath, 'meshcore.js')).toString(); } catch (e) { } } // Use non-minified meshcore.
if (meshCore != null) { if (meshCore != null) {
try { modulesDir = obj.fs.readdirSync(obj.path.join(meshcorePath, 'modules_meshcore')); } catch (e) { } var moduleDirPath = null;
try { moduleDirPath = obj.path.join(meshcorePath, 'modules_meshcore_min'); modulesDir = obj.fs.readdirSync(moduleDirPath); } catch (e) { } // Favor minified modules if present.
if (modulesDir == null) { try { moduleDirPath = obj.path.join(meshcorePath, 'modules_meshcore'); modulesDir = obj.fs.readdirSync(moduleDirPath); } catch (e) { } } // Use non-minified mofules.
if (modulesDir != null) { if (modulesDir != null) {
for (var i in modulesDir) { for (var i in modulesDir) {
if (modulesDir[i].toLowerCase().endsWith('.js')) { if (modulesDir[i].toLowerCase().endsWith('.js')) {
// Merge this module
var moduleName = modulesDir[i].substring(0, modulesDir[i].length - 3); var moduleName = modulesDir[i].substring(0, modulesDir[i].length - 3);
var moduleDataB64 = obj.fs.readFileSync(obj.path.join(meshcorePath, 'modules_meshcore', modulesDir[i])).toString('base64'); if (moduleName.endsWith('.min')) { moduleName = moduleName.substring(0, moduleName.length - 4); } // Remove the ".min" for ".min.js" files.
moduleAdditions += 'try { addModule("' + moduleName + '", Buffer.from("' + moduleDataB64 + '", "base64")); addedModules.push("' + moduleName + '"); } catch (e) { }\r\n'; var moduleData = 'try { addModule("' + moduleName + '", "' + obj.escapeCodeString(obj.fs.readFileSync(obj.path.join(moduleDirPath, modulesDir[i])).toString('binary')) + '"); addedModules.push("' + moduleName + '"); } catch (e) { }\r\n';
if ((moduleName != 'amt_heci') && (moduleName != 'lme_heci') && (moduleName != 'amt-0.2.0.js') && (moduleName != 'amt-script-0.2.0.js') && (moduleName != 'amt-wsman-0.2.0.js') && (moduleName != 'amt-wsman-duk-0.2.0.js')) {
moduleAdditionsNoMei += 'try { addModule("' + moduleName + '", Buffer.from("' + moduleDataB64 + '", "base64")); addedModules.push("' + moduleName + '"); } catch (e) { }\r\n'; // Merge this module
if (moduleName.startsWith('amt-')) {
// Add to Intel AMT cores only
modulesAdd['windows-amt'] += moduleData;
modulesAdd['linux-amt'] += moduleData;
} else if (moduleName.startsWith('win-')) {
// Add to Windows cores only
modulesAdd['windows-amt'] += moduleData;
} else if (moduleName.startsWith('linux-')) {
// Add to Linux cores only
modulesAdd['linux-amt'] += moduleData;
modulesAdd['linux-noamt'] += moduleData;
} else {
// Add to all cores
modulesAdd['windows-amt'] += moduleData;
modulesAdd['linux-amt'] += moduleData;
modulesAdd['linux-noamt'] += moduleData;
} }
} }
} }
} }
} else { meshCore = ''; } // No meshcore.js
// Set the new default meshcore.js with and without MEI support // Merge the cores and compute the hashes
obj.defaultMeshCore = obj.common.IntToStr(0) + moduleAdditions + meshCore; for (var i in modulesAdd) {
obj.defaultMeshCoreHash = obj.crypto.createHash('sha384').update(obj.defaultMeshCore).digest("binary"); obj.defaultMeshCores[i] = obj.common.IntToStr(0) + modulesAdd[i] + meshCore;
obj.defaultMeshCoreNoMei = obj.common.IntToStr(0) + moduleAdditionsNoMei + meshCore; obj.defaultMeshCoresHash[i] = obj.crypto.createHash('sha384').update(obj.defaultMeshCores[i]).digest("binary");
obj.defaultMeshCoreNoMeiHash = obj.crypto.createHash('sha384').update(obj.defaultMeshCoreNoMei).digest("binary"); obj.debug(1, 'Core module ' + i + ' is ' + obj.defaultMeshCores[i].length + ' bytes.');
//console.log('Core module ' + i + ' is ' + obj.defaultMeshCores[i].length + ' bytes.'); // DEBUG, Print the core size
//obj.fs.writeFile("C:\\temp\\" + i + ".js", obj.defaultMeshCores[i].substring(4)); // DEBUG, Write the core to file
}
}
// We are done creating all the mesh cores.
if (func != null) { func(true); } if (func != null) { func(true); }
// If meshcore.js is in the data folder, monitor the file for changes. // If meshcore.js is in the data folder, monitor the file for changes.
@ -990,34 +1034,34 @@ function CreateMeshCentralServer(config, args) {
// List of possible mesh agents // List of possible mesh agents
obj.meshAgentsArchitectureNumbers = { obj.meshAgentsArchitectureNumbers = {
0: { id: 0, localname: 'Unknown', rname: 'meshconsole.exe', desc: 'Unknown agent', update: false, amt: true, platform: 'unknown' }, 0: { id: 0, localname: 'Unknown', rname: 'meshconsole.exe', desc: 'Unknown agent', update: false, amt: true, platform: 'unknown', core: 'linux-noamt' },
1: { id: 1, localname: 'MeshConsole.exe', rname: 'meshconsole.exe', desc: 'Windows x86-32 console', update: true, amt: true, platform: 'win32' }, 1: { id: 1, localname: 'MeshConsole.exe', rname: 'meshconsole.exe', desc: 'Windows x86-32 console', update: true, amt: true, platform: 'win32', core: 'windows-amt' },
2: { id: 2, localname: 'MeshConsole64.exe', rname: 'meshconsole.exe', desc: 'Windows x86-64 console', update: true, amt: true, platform: 'win32' }, 2: { id: 2, localname: 'MeshConsole64.exe', rname: 'meshconsole.exe', desc: 'Windows x86-64 console', update: true, amt: true, platform: 'win32', core: 'windows-amt' },
3: { id: 3, localname: 'MeshService-signed.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' }, 3: { id: 3, localname: 'MeshService-signed.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32', core: 'windows-amt' },
4: { id: 4, localname: 'MeshService64-signed.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' }, 4: { id: 4, localname: 'MeshService64-signed.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32', core: 'windows-amt' },
5: { id: 5, localname: 'meshagent_x86', rname: 'meshagent', desc: 'Linux x86-32', update: true, amt: true, platform: 'linux' }, 5: { id: 5, localname: 'meshagent_x86', rname: 'meshagent', desc: 'Linux x86-32', update: true, amt: true, platform: 'linux', core: 'linux-amt' },
6: { id: 6, localname: 'meshagent_x86-64', rname: 'meshagent', desc: 'Linux x86-64', update: true, amt: true, platform: 'linux' }, 6: { id: 6, localname: 'meshagent_x86-64', rname: 'meshagent', desc: 'Linux x86-64', update: true, amt: true, platform: 'linux', core: 'linux-amt' },
7: { id: 7, localname: 'meshagent_mips', rname: 'meshagent', desc: 'Linux MIPS', update: true, amt: false, platform: 'linux' }, 7: { id: 7, localname: 'meshagent_mips', rname: 'meshagent', desc: 'Linux MIPS', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
8: { id: 8, localname: 'MeshAgent-Linux-XEN-x86-32', rname: 'meshagent', desc: 'XEN x86-64', update: true, amt: false, platform: 'linux' }, 8: { id: 8, localname: 'MeshAgent-Linux-XEN-x86-32', rname: 'meshagent', desc: 'XEN x86-64', update: true, amt: false, platform: 'linux', core: 'linux-amt' },
9: { id: 9, localname: 'meshagent_arm', rname: 'meshagent', desc: 'Linux ARM5', update: true, amt: false, platform: 'linux' }, 9: { id: 9, localname: 'meshagent_arm', rname: 'meshagent', desc: 'Linux ARM5', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
10: { id: 10, localname: 'MeshAgent-Linux-ARM-PlugPC', rname: 'meshagent', desc: 'Linux ARM PlugPC', update: true, amt: false, platform: 'linux' }, 10: { id: 10, localname: 'MeshAgent-Linux-ARM-PlugPC', rname: 'meshagent', desc: 'Linux ARM PlugPC', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
11: { id: 11, localname: 'meshagent_osx-x86-32', rname: 'meshosx', desc: 'Apple OSX x86-32', update: true, amt: false, platform: 'linux' }, 11: { id: 11, localname: 'meshagent_osx-x86-32', rname: 'meshosx', desc: 'Apple OSX x86-32', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
12: { id: 12, localname: 'MeshAgent-Android-x86', rname: 'meshandroid', desc: 'Android x86-32', update: true, amt: false, platform: 'linux' }, 12: { id: 12, localname: 'MeshAgent-Android-x86', rname: 'meshandroid', desc: 'Android x86-32', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
13: { id: 13, localname: 'meshagent_pogo', rname: 'meshagent', desc: 'Linux ARM PogoPlug', update: true, amt: false, platform: 'linux' }, 13: { id: 13, localname: 'meshagent_pogo', rname: 'meshagent', desc: 'Linux ARM PogoPlug', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
14: { id: 14, localname: 'MeshAgent-Android-APK', rname: 'meshandroid', desc: 'Android Market', update: false, amt: false, platform: 'android' }, // Get this one from Google Play 14: { id: 14, localname: 'MeshAgent-Android-APK', rname: 'meshandroid', desc: 'Android Market', update: false, amt: false, platform: 'android', core: 'linux-noamt' }, // Get this one from Google Play
15: { id: 15, localname: 'meshagent_poky', rname: 'meshagent', desc: 'Linux Poky x86-32', update: true, amt: false, platform: 'linux' }, 15: { id: 15, localname: 'meshagent_poky', rname: 'meshagent', desc: 'Linux Poky x86-32', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
16: { id: 16, localname: 'meshagent_osx-x86-64', rname: 'meshagent', desc: 'Apple OSX x86-64', update: true, amt: false, platform: 'osx' }, 16: { id: 16, localname: 'meshagent_osx-x86-64', rname: 'meshagent', desc: 'Apple OSX x86-64', update: true, amt: false, platform: 'osx', core: 'linux-noamt' },
17: { id: 17, localname: 'MeshAgent-ChromeOS', rname: 'meshagent', desc: 'Google ChromeOS', update: false, amt: false, platform: 'chromeos' }, // Get this one from Chrome store 17: { id: 17, localname: 'MeshAgent-ChromeOS', rname: 'meshagent', desc: 'Google ChromeOS', update: false, amt: false, platform: 'chromeos', core: 'linux-noamt' }, // Get this one from Chrome store
18: { id: 18, localname: 'meshagent_poky64', rname: 'meshagent', desc: 'Linux Poky x86-64', update: true, amt: false, platform: 'linux' }, 18: { id: 18, localname: 'meshagent_poky64', rname: 'meshagent', desc: 'Linux Poky x86-64', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
19: { id: 19, localname: 'meshagent_x86_nokvm', rname: 'meshagent', desc: 'Linux x86-32 NoKVM', update: true, amt: true, platform: 'linux' }, 19: { id: 19, localname: 'meshagent_x86_nokvm', rname: 'meshagent', desc: 'Linux x86-32 NoKVM', update: true, amt: true, platform: 'linux', core: 'linux-amt' },
20: { id: 20, localname: 'meshagent_x86-64_nokvm', rname: 'meshagent', desc: 'Linux x86-64 NoKVM', update: true, amt: true, platform: 'linux' }, 20: { id: 20, localname: 'meshagent_x86-64_nokvm', rname: 'meshagent', desc: 'Linux x86-64 NoKVM', update: true, amt: true, platform: 'linux', core: 'linux-amt' },
21: { id: 21, localname: 'MeshAgent-WinMinCore-Console-x86-32.exe', rname: 'meshagent.exe', desc: 'Windows MinCore Console x86-32', update: true, amt: false, platform: 'win32' }, 21: { id: 21, localname: 'MeshAgent-WinMinCore-Console-x86-32.exe', rname: 'meshagent.exe', desc: 'Windows MinCore Console x86-32', update: true, amt: false, platform: 'win32', core: 'windows-amt' },
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' }, 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', core: 'windows-amt' },
23: { id: 23, localname: 'MeshAgent-NodeJS', rname: 'meshagent', desc: 'NodeJS', update: false, amt: false, platform: 'node' }, // Get this one from NPM 23: { id: 23, localname: 'MeshAgent-NodeJS', rname: 'meshagent', desc: 'NodeJS', update: false, amt: false, platform: 'node', core: 'linux-noamt' }, // Get this one from NPM
24: { id: 24, localname: 'meshagent_arm-linaro', rname: 'meshagent', desc: 'Linux ARM Linaro', update: true, amt: false, platform: 'linux' }, 24: { id: 24, localname: 'meshagent_arm-linaro', rname: 'meshagent', desc: 'Linux ARM Linaro', update: true, amt: false, platform: 'linux', core: 'linux-noamt' },
25: { id: 25, localname: 'meshagent_pi', rname: 'meshagent', desc: 'Linux ARM - Raspberry Pi', update: true, amt: false, platform: 'linux' }, // "armv6l" and "armv7l" 25: { id: 25, localname: 'meshagent_pi', rname: 'meshagent', desc: 'Linux ARM - Raspberry Pi', update: true, amt: false, platform: 'linux', core: 'linux-noamt' }, // "armv6l" and "armv7l"
10003: { id: 3, localname: 'MeshService.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32' }, // Unsigned version of the Windows MeshAgent x86 10003: { id: 3, localname: 'MeshService.exe', rname: 'meshagent.exe', desc: 'Windows x86-32 service', update: true, amt: true, platform: 'win32', core: 'windows-amt' }, // Unsigned version of the Windows MeshAgent x86
10004: { id: 4, localname: 'MeshService64.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32' } // Unsigned version of the Windows MeshAgent x64 10004: { id: 4, localname: 'MeshService64.exe', rname: 'meshagent.exe', desc: 'Windows x86-64 service', update: true, amt: true, platform: 'win32', core: 'windows-amt' } // Unsigned version of the Windows MeshAgent x64
}; };
// Update the list of available mesh agents // Update the list of available mesh agents

View File

@ -1,41 +1,18 @@
@ECHO OFF @ECHO OFF
REM *** Remove all old minified files CALL:CompressHandlebars default
DEL ..\views\default-min.handlebars CALL:CompressHandlebars default-mobile
DEL ..\views\default-mobile-min.handlebars CALL:CompressHandlebars login
DEL ..\views\login-min.handlebars CALL:CompressHandlebars login-mobile
DEL ..\views\login-mobile-min.handlebars CALL:CompressHandlebars messenger
PAUSE
GOTO:eof
REM *** default.handlebars :CompressHandlebars
COPY ..\views\default.handlebars index.html ECHO COMPRESS ..\views\%~1.handlebars TO ..\views\%~1-min.handlebars
DEL ..\views\%~1-min.handlebars
COPY ..\views\%~1.handlebars index.html
..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c ..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c
COPY compress.htm ..\views\default-min.handlebars COPY compress.htm ..\views\%~1-min.handlebars
DEL compress.htm
DEL index.html
REM *** default-mobile.handlebars
COPY ..\views\default-mobile.handlebars index.html
..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c
COPY compress.htm ..\views\default-mobile-min.handlebars
DEL compress.htm
DEL index.html
REM *** login.handlebars
COPY ..\views\login.handlebars index.html
..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c
COPY compress.htm ..\views\login-min.handlebars
DEL compress.htm
DEL index.html
REM *** login-mobile.handlebars
COPY ..\views\login-mobile.handlebars index.html
..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c
COPY compress.htm ..\views\login-mobile-min.handlebars
DEL compress.htm
DEL index.html
REM *** messenger.handlebars
COPY ..\views\messenger.handlebars index.html
..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c
COPY compress.htm ..\views\messenger-min.handlebars
DEL compress.htm DEL compress.htm
DEL index.html DEL index.html
GOTO:eof