Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/macaddress/ |
Upload File : |
/* jshint node: true */ 'use strict'; var os = require('os'); var lib = {}; function parallel(tasks, done) { var results = []; var errs = []; var length = 0; var doneLength = 0; function doneIt(ix, err, result) { if (err) { errs[ix] = err; } else { results[ix] = result; } doneLength += 1; if (doneLength >= length) { done(errs.length > 0 ? errs : errs, results); } } Object.keys(tasks).forEach(function (key) { length += 1; var task = tasks[key]; (process.nextTick || global.setImmediate || global.setTimeout)(function () { task(doneIt.bind(null, key), 1); }); }); } lib.networkInterfaces = function () { var allAddresses = {}; try { var ifaces = os.networkInterfaces(); } catch (e) { // At October 2016 WSL does not support os.networkInterfaces() and throws // Return empty object as if no interfaces were found // https://github.com/Microsoft/BashOnWindows/issues/468 if (e.syscall === 'uv_interface_addresses') { return allAddresses; } else { throw e; }; }; Object.keys(ifaces).forEach(function (iface) { var addresses = {}; var hasAddresses = false; ifaces[iface].forEach(function (address) { if (!address.internal) { addresses[(address.family || "").toLowerCase()] = address.address; hasAddresses = true; if (address.mac) { addresses.mac = address.mac; } } }); if (hasAddresses) { allAddresses[iface] = addresses; } }); return allAddresses; }; var _getMacAddress; switch (os.platform()) { case 'win32': _getMacAddress = require('./lib/windows.js'); break; case 'linux': _getMacAddress = require('./lib/linux.js'); break; case 'darwin': case 'sunos': case 'freebsd': _getMacAddress = require('./lib/unix.js'); break; default: console.warn("node-macaddress: Unknown os.platform(), defaulting to 'unix'."); _getMacAddress = require('./lib/unix.js'); break; } lib.one = function (iface, callback) { if (typeof iface === 'function') { callback = iface; var ifaces = lib.networkInterfaces(); var alleged = [ 'eth0', 'eth1', 'en0', 'en1' ]; iface = Object.keys(ifaces)[0]; for (var i = 0; i < alleged.length; i++) { if (ifaces[alleged[i]]) { iface = alleged[i]; break; } } if (!ifaces[iface]) { if (typeof callback === 'function') { process.nextTick(function() { callback(new Error("no interfaces found"), null); }); } return null; } if (ifaces[iface].mac) { if (typeof callback === 'function') { process.nextTick(function() { callback(null, ifaces[iface].mac); }); } return ifaces[iface].mac; } } if (typeof callback === 'function') { _getMacAddress(iface, callback); } return null; }; lib.all = function (callback) { var ifaces = lib.networkInterfaces(); var resolve = {}; Object.keys(ifaces).forEach(function (iface) { if (!ifaces[iface].mac) { resolve[iface] = _getMacAddress.bind(null, iface); } }); if (Object.keys(resolve).length === 0) { if (typeof callback === 'function') { process.nextTick(function(){ callback(null, ifaces); }); } return ifaces; } parallel(resolve, function (err, result) { Object.keys(result).forEach(function (iface) { ifaces[iface].mac = result[iface]; }); if (typeof callback === 'function') { callback(null, ifaces); } }); return null; }; module.exports = lib;