How to use the macaddress.networkInterfaces 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 Nexusoft / NexusInterface / app / nxs_modules / api / core.js View on Github external
// TODO: Fix circular dependencies core -> configuration -> rpc -> core
import configuration from 'api/configuration';
import { LoadSettings, UpdateSettings } from 'api/settings';

const statusdelay = 1000;
var prevCoreProcess = 0;

var coreprocess = null;
var responding = false;
var user = 'rpcserver';
//Generate automatic daemon password from machines hardware info
var secret = 'secret';
if (process.platform === 'darwin') {
  secret = process.env.USER + process.env.HOME + process.env.SHELL;
} else {
  secret = JSON.stringify(macaddress.networkInterfaces(), null, 2);
}
var password = crypto
  .createHmac('sha256', secret)
  .update('pass')
  .digest('hex');

var port = '9336';
var ip = '127.0.0.1';
var host = 'http://' + ip + ':' + port;
var verbose = '2'; // <--Lower to 0 after beta ends

// console.log(process.env.APPDATA);configuration.GetAppDataDirectory();
console.log('core', process.env.HOME);
//Set data directory by OS for automatic daemon mode

// SetCoreParameters: Get the path to local resources for the application (depending on running packaged vs via npm start)
github Nexusoft / NexusInterface / src / shared / lib / settings / universal.js View on Github external
* Settings functionalities that can be used by both
 * renderer process and main process code
 */

import path from 'path';
import crypto from 'crypto';
import macaddress from 'macaddress';
import { homeDir, settingsFilePath, defaultCoreDataDir } from 'consts/paths';
import { readJson, writeJson } from 'utils/json';

const defaultBackupDir = path.join(homeDir, '/NexusBackups');

const secret =
  process.platform === 'darwin'
    ? process.env.USER + process.env.HOME + process.env.SHELL
    : JSON.stringify(macaddress.networkInterfaces(), null, 2);
const defaultPassword = crypto
  .createHmac('sha256', secret)
  .update('pass')
  .digest('hex');

export const defaultSettings = {
  // App
  locale: null,
  minimizeOnClose: false,
  autoUpdate: true,
  sendUsageData: true,
  fiatCurrency: 'USD',
  minConfirmations: 3,
  backupDirectory: defaultBackupDir,
  devMode: false,
  verifyModuleSource: true,
github Nexusoft / NexusInterface / app / nxs_modules / api / settings.js View on Github external
import crypto from 'crypto';
import macaddress from 'macaddress';
import config from 'api/configuration';
import normalizePath from 'utils/normalizePath';

const settingsFileName = 'settings.json';

const defaultBackupDir = normalizePath(config.GetHomeDir() + '/NexusBackups');

const secret =
  process.platform === 'darwin'
    ? process.env.USER + process.env.HOME + process.env.SHELL
    : JSON.stringify(macaddress.networkInterfaces(), null, 2);
const defaultPassword = crypto
  .createHmac('sha256', secret)
  .update('pass')
  .digest('hex');

export const defaultSettings = {
  // App
  locale: 'en',
  minimizeOnClose: false,
  autoUpdate: true,
  sendUsageData: true,
  fiatCurrency: 'USD',
  minConfirmations: 3,
  backupDirectory: defaultBackupDir,
  devMode: false,
  overviewDisplay: 'standard',
github Nexusoft / NexusInterface / src / shared / lib / coreConfig.js View on Github external
.split('');
  for (let index = 0; index < ranByte.length; index++) {
    const element = ranByte[index];
    if (index % 2) {
      randomNumbers[0] += element.charCodeAt(0);
    } else {
      randomNumbers[1] += element.charCodeAt(0);
    }
  }
  randomNumbers[0] = parseInt(randomNumbers[0]);
  randomNumbers[1] = parseInt(randomNumbers[1]);
  const randomValue = randomNumbers[0] * randomNumbers[1];
  const secret =
    process.platform === 'darwin'
      ? process.env.USER + process.env.HOME + process.env.SHELL + randomValue
      : JSON.stringify(macaddress.networkInterfaces(), null, 2) + randomValue;
  return crypto
    .createHmac('sha256', secret)
    .update('pass')
    .digest('hex');
}
github Nexusoft / NexusInterface / app / nxs_modules / api / core.js View on Github external
function setpassword() {
  let secret = 'secret';
  if (process.platform === 'darwin') {
    secret = process.env.USER + process.env.HOME + process.env.SHELL;
  } else {
    secret = JSON.stringify(macaddress.networkInterfaces(), null, 2);
  }

  return (
    nexusconfig.password ||
    crypto
      .createHmac('sha256', secret)
      .update('pass')
      .digest('hex')
  );
}
github sourcejs / Source / core / trackStats.js View on Github external
var generateMachineID = function(){
    var macNums = macaddress.networkInterfaces();
    var unique = '';

    _.forOwn(macNums, function(val){
        if (val.mac) {
            unique += val.mac;
        } else if (val.ipv4) {
            unique += val.ipv4;
        }
    });

    return 'host-' + crypto.createHash('md5').update(unique).digest('hex').slice(0, 5);
};

macaddress

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

MIT
Latest version published 3 years ago

Package Health Score

58 / 100
Full package analysis