uuid added mac addresses
This commit is contained in:
parent
7e3552f788
commit
cb66840407
@ -328,6 +328,7 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (m
|
|||||||
| si.uuid(cb) | {...} | X | X | X | X | X | object of several UUIDs |
|
| si.uuid(cb) | {...} | X | X | X | X | X | object of several UUIDs |
|
||||||
| | os | X | X | X | X | | os specific UUID |
|
| | os | X | X | X | X | | os specific UUID |
|
||||||
| | hardware | X | X | X | X | | hardware specific UUID |
|
| | hardware | X | X | X | X | | hardware specific UUID |
|
||||||
|
| | macs | X | X | X | X | | MAC addresses |
|
||||||
| si.versions(apps, cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...)<br />apps param is optional for detecting<br />only specific apps/libs<br />(string, comma separated) |
|
| si.versions(apps, cb) | {...} | X | X | X | X | X | version information (kernel, ssl, node, ...)<br />apps param is optional for detecting<br />only specific apps/libs<br />(string, comma separated) |
|
||||||
| si.shell(cb) | : string | X | X | X | | | standard shell |
|
| si.shell(cb) | : string | X | X | X | | | standard shell |
|
||||||
| si.users(cb) | [{...}] | X | X | X | X | X | array of users online |
|
| si.users(cb) | [{...}] | X | X | X | X | X | array of users online |
|
||||||
|
|||||||
30
docs/os.html
30
docs/os.html
@ -240,36 +240,6 @@ si.osInfo().then(data => console.log(data));</code></pre class="example">
|
|||||||
uefi: true
|
uefi: true
|
||||||
}</pre>
|
}</pre>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>si.uuid(cb)</td>
|
|
||||||
<td>{...}</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>object of several UUIDs</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td>os</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td></td>
|
|
||||||
<td>os specific UUID</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td>hardware</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td>X</td>
|
|
||||||
<td></td>
|
|
||||||
<td>hardware specific UUID</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>si.shell(cb)</td>
|
<td>si.shell(cb)</td>
|
||||||
<td>: string</td>
|
<td>: string</td>
|
||||||
|
|||||||
@ -182,6 +182,64 @@ si.system().then(data => console.log(data));</code></pre class="example">
|
|||||||
sku: 'Mac-99878xxxx...',
|
sku: 'Mac-99878xxxx...',
|
||||||
virtual: false,
|
virtual: false,
|
||||||
}
|
}
|
||||||
|
</pre>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>si.uuid(cb)</td>
|
||||||
|
<td>{...}</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>object of several UUIDs</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>os</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td></td>
|
||||||
|
<td>os specific UUID</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>hardware</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td></td>
|
||||||
|
<td>hardware specific UUID</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>macs</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td>X</td>
|
||||||
|
<td></td>
|
||||||
|
<td>MAC addresses</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="example">
|
||||||
|
<td></td>
|
||||||
|
<td colspan="7">
|
||||||
|
<h5>Example</h5>
|
||||||
|
<pre><code class="js">const si = require('systeminformation');
|
||||||
|
si.uuid().then(data => console.log(data));</code></pre class="example">
|
||||||
|
<pre class="example">
|
||||||
|
{
|
||||||
|
os: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
||||||
|
hardware: 'xxxxxxxxxxxxxx',
|
||||||
|
macs: [
|
||||||
|
'01:02:03:04:05:06',
|
||||||
|
'02:03:04:05:06:07',
|
||||||
|
'aa:bb:cc:dd:ee:ff'
|
||||||
|
]
|
||||||
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -960,13 +960,37 @@ function shell(callback) {
|
|||||||
|
|
||||||
exports.shell = shell;
|
exports.shell = shell;
|
||||||
|
|
||||||
|
function getUniqueMacAdresses() {
|
||||||
|
const ifaces = os.networkInterfaces();
|
||||||
|
let macs = [];
|
||||||
|
for (let dev in ifaces) {
|
||||||
|
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
||||||
|
ifaces[dev].forEach(function (details) {
|
||||||
|
if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
|
||||||
|
const mac = details.mac.toLowerCase();
|
||||||
|
if (macs.indexOf(mac) === -1) {
|
||||||
|
macs.push(mac);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
macs = macs.sort(function (a, b) {
|
||||||
|
if (a < b) { return -1; }
|
||||||
|
if (a > b) { return 1; }
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
return macs;
|
||||||
|
}
|
||||||
|
|
||||||
function uuid(callback) {
|
function uuid(callback) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
|
||||||
let result = {
|
let result = {
|
||||||
os: '',
|
os: '',
|
||||||
hardware: ''
|
hardware: '',
|
||||||
|
macs: getUniqueMacAdresses()
|
||||||
};
|
};
|
||||||
let parts;
|
let parts;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user