17 lines
612 B
JavaScript
17 lines
612 B
JavaScript
const os = require('os');
|
|
|
|
function getNetworkInterfaces () {
|
|
const interfaces = os.networkInterfaces();
|
|
console.log(interfaces)
|
|
for (const interface in interfaces) {
|
|
for (const config of interfaces[interface]) {
|
|
if (config.family === 'IPv4' && !config.internal && interface == 'WLAN') {
|
|
const mac = config.mac.replace(/:/g, '');
|
|
console.log(`${interface}: ${config.address}`);
|
|
console.log(`MAC Address: ${mac}`);
|
|
console.log(`Subnet Mask: ${config.netmask}`);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
getNetworkInterfaces(); |