Fixed Intel AMT local network scanning.

This commit is contained in:
Ylian Saint-Hilaire 2020-06-26 16:25:12 -07:00
parent 677cbfe016
commit 59a7653c9c
3 changed files with 7 additions and 8 deletions

View File

@ -71,11 +71,9 @@ module.exports.CreateAmtScanner = function (parent) {
rangeinfo.server = obj.dgram.createSocket("udp4");
rangeinfo.server.bind(0);
rangeinfo.server.on('error', (err) => { console.log(err); });
rangeinfo.server.on('message', (data, rinfo) => { obj.parseRmcpPacket(data, rinfo, 0, obj.reportMachineState, rangeinfo); });
rangeinfo.server.on('listening', () => {
for (var i = rangeinfo.min; i <= rangeinfo.max; i++) { rangeinfo.server.send(obj.rpacket, 623, obj.IPv4NumToStr(i)); }
});
rangeinfo.timer = setTimeout(function () { // ************************* USER OF OUTER VARS!!!!!!!!!!!!!!!
rangeinfo.server.on('message', function (data, rinfo) { obj.parseRmcpPacket(data, rinfo, 0, obj.reportMachineState, rangeinfo); });
rangeinfo.server.on('listening', function() { for (var i = rangeinfo.min; i <= rangeinfo.max; i++) { rangeinfo.server.send(obj.rpacket, 623, obj.IPv4NumToStr(i)); } });
rangeinfo.timer = setTimeout(function () { // ************************* USE OF OUTER VARS!!!!!!!!!!!!!!!
obj.parent.DispatchEvent(['*', userid], obj, { action: 'scanamtdevice', range: rangeinfo.range, results: rangeinfo.results, nolog: 1 });
rangeinfo.server.close();
delete rangeinfo.server;

File diff suppressed because one or more lines are too long

View File

@ -3865,6 +3865,7 @@
x += addHtmlValue("IP Range", '<input id=dp1range list=iprangelist style=width:184px value="192.168.1.0/24" onkeyup=addAmtScanToMeshKeyUp(event) /><input id=dp1rangebutton type=button value="' + "Scan" + '" onclick=addAmtScanToMeshButton()></input>');
}
x += '<div id=dp1results style="width:100%;height:200px;background-color:white;border:1px gray solid;overflow-y:scroll"></div>';
x += '<input type=hidden id=amtScanMeshId value="' + meshid + '" />';
setDialogMode(2, "Scan for Intel&reg; AMT devices", 3, addAmtScanToMeshEx, x, meshid);
QE('idx_dlgOkButton', false);
QH('dp1results', '<div style=width:100%;text-align:center;margin-top:12px;color:gray;line-height:1.5>Sample IP range values<br />192.168.0.100<br />192.168.1.0/24<br />192.167.0.1-192.168.0.100</div>');
@ -3879,7 +3880,7 @@
}
// Called when OK is pressed on the Intel AMT scanning box
function addAmtScanToMeshEx(button, meshid) {
function addAmtScanToMeshEx(button) {
var elements = document.getElementsByClassName('DevScanCheckbox'), checkcount = 0;
for (var i=0;i<elements.length;i++) {
if (elements[i].checked) {
@ -3887,7 +3888,7 @@
var amtinfo = amtScanResults[ipaddr];
var name = amtinfo.hostname;
if (amtinfo.hosttype == 'host') { name = capitalizeFirstLetter(name.split('.')[0]); }
meshserver.send({ action: 'addamtdevice', meshid: meshid, devicename: name, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls });
meshserver.send({ action: 'addamtdevice', meshid: Q('amtScanMeshId').value, devicename: name, hostname: amtinfo.hostname, amtusername: '', amtpassword: '', amttls: amtinfo.tls });
}
}
}