How to use the macaddress.one function in macaddress

To help you get started, we’ve selected a few macaddress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sx1989827 / DOClever / Desktop / node_modules / uniqid / index.js View on Github external
/* 
(The MIT License)
Copyright (c) 2014 Halász Ádám 
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

//  Unique Hexatridecimal ID Generator
// ================================================

//  Dependencies
// ================================================
var pid = process && process.pid ? process.pid.toString(36) : '' ;
var mac = typeof __webpack_require__ !== 'function' ? require('macaddress').one(macHandler) : null ;
var address = mac ? parseInt(mac.replace(/\:|\D+/gi, '')).toString(36) : '' ;

//  Exports
// ================================================
module.exports         = function(prefix){ return (prefix || '') + address + pid + now().toString(36); }
module.exports.process = function(prefix){ return (prefix || '')           + pid + now().toString(36); }
module.exports.time    = function(prefix){ return (prefix || '')                 + now().toString(36); }

//  Helpers
// ================================================
function now(){
    var time = Date.now();
    var last = now.last || time;
    return now.last = time > last ? time : last + 1;
}
github TimDurward / xfinity-wifi-hack / index.js View on Github external
function (data) {
                macaddress.one(DRIVER_INTERFACE, function (err, mac) {
                    console.log("Generated temporary Mac address for " + DRIVER_INTERFACE + ": %s", mac);
                    var macAdr = mac;
                    callback(null, macAdr);
                });
            }
        );
github getgridea / gridea / src / helpers / analytics.ts View on Github external
public getClientId(callback: any) {
    if (this.clientId) {
      callback(this.clientId)
    }
    macaddress.one((err: any, mac: string) => {
      this.clientId = mac
      callback(mac)
    })
  }
github prixe / lindo / electron / settings / settings.ts View on Github external
public static resetSettings(): void {

        Logger.info("[SETTING] Restoring the settings..")

        settings.setAll(SettingsDefault);

        macAddress.one((err, addr) => {
            if(err || !addr){
                settings.set('macAddress',  Math.random().toString());
                Logger.warn("[SETTING] Unable to retrieve the mac address");
            }else{
                settings.set('macAddress', Buffer.from(addr).toString('base64'));
            }

            Logger.info("[SETTING] All settings are restored.");
            this.reloadSettings();
        });
    };
github umijs / umi / packages / umi-ui / src / scripts.ts View on Github external
return new Promise(resolve => {
    macaddress.one((err, mac) => {
      macId = err ? '' : mac;
      resolve(macId);
    });
  });
};
github rnehra01 / arp-validator / lib / spoof-detector.js View on Github external
var args = require('./args.js');
var pcap = require('pcap');
var ip = require('ip');
var tcp = require('./tcp.js');
var logger = require('./logger.js');
var macaddress = require('macaddress');
const util = require('util');
const fs = require('fs');
var my_mac = '';
macaddress.one(args.params.iface, function (err, mac) {
  my_mac = mac;
});

var pendingSYNs = {};

if (!fs.existsSync(args.params.hostdb)){
    fs.writeFileSync(args.params.hostdb, JSON.stringify({}));
}
var validatedHostsRaw = fs.readFileSync(args.params.hostdb);
var validatedHosts = JSON.parse(validatedHostsRaw);

//send a TCP SYN to the host and wait for 2 sec to receive a RST or ACK
function validateHost(host_ip, host_mac){
  logger.log('[?] Validating: '+host_ip+' is at '+host_mac, 'debug');
  if(validatedHosts[host_ip] != undefined){ //host is already validated
    if(validatedHosts[host_ip] === host_mac){//lets check current situation matches with validated one
github eclipse-theia / theia / packages / plugin-ext / src / plugin / node / env-node-ext.ts View on Github external
constructor(rpc: RPCProtocol) {
        super(rpc);
        mac.one((err, macAddress) => {
            if (err) {
                this.macMachineId = v4();
            } else {
                this.macMachineId = createHash('sha256').update(macAddress, 'utf8').digest('hex');
            }
        });

    }

macaddress

Get the MAC addresses (hardware addresses) of the hosts network interfaces.

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis