first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

6
build/node_modules/macaddress/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,6 @@
.DS_Store
/node_modules
.*.swp
/.npmcache
/dist
*.log

12
build/node_modules/macaddress/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,12 @@
language: node_js
node_js:
- stable
- "0.12"
- "0.11"
- "0.10"
- "0.9"
- "0.8"
- iojs
- iojs-v1.0.4
install:
- npm install

124
build/node_modules/macaddress/README.md generated vendored Normal file
View File

@@ -0,0 +1,124 @@
node-macaddress
===============
[![Build Status](https://travis-ci.org/scravy/node-macaddress.svg?branch=master)](https://travis-ci.org/scravy/node-macaddress)
Retrieve MAC addresses in Linux, OS X, and Windows.
A common misconception about MAC addresses is that every *host* had *one* MAC address,
while a host may have *multiple* MAC addresses since *every network interface* may
have its own MAC address.
This library allows to discover the MAC address per network interface and chooses
an appropriate interface if all you're interested in is *one* MAC address identifying
the host system (see `API + Examples` below).
**Features:**
+ works on `Linux`, `Mac OS X`, `Windows`, and on most `UNIX` systems.
+ `node ≥ 0.12` and `io.js` report MAC addresses in `os.networkInterfaces()`
this library utilizes this information when available.
+ also features a sane replacement for `os.networkInterfaces()`
(see `API + Examples` below).
+ works with stoneage node versions ≥ v0.8 (...)
Usage
-----
```
npm install --save macaddress
```
```JavaScript
var macaddress = require('macaddress');
```
API + Examples
--------------
(async) .one(iface, callback) → string
(async) .one(callback) → string
(async) .all(callback) → { iface: { type: address } }
(sync) .networkInterfaces() → { iface: { type: address } }
---
### `.one([iface], callback)`
Retrieves the MAC address of the given `iface`.
If `iface` is omitted, this function automatically chooses an
appropriate device (e.g. `eth0` in Linux, `en0` in OS X, etc.).
**Without `iface` parameter:**
```JavaScript
macaddress.one(function (err, mac) {
console.log("Mac address for this host: %s", mac);
});
```
```
→ Mac address for this host: ab:42:de:13:ef:37
```
**With `iface` parameter:**
```JavaScript
macaddress.one('awdl0', function (err, mac) {
console.log("Mac address for awdl0: %s", mac);
});
```
```
→ Mac address for awdl0: ab:cd:ef:34:12:56
```
---
### `.all(callback)`
Retrieves the MAC addresses for all non-internal interfaces.
```JavaScript
macaddress.all(function (err, all) {
console.log(JSON.stringify(all, null, 2));
});
```
```JavaScript
{
"en0": {
"ipv6": "fe80::cae0:ebff:fe14:1da9",
"ipv4": "192.168.178.20",
"mac": "ab:42:de:13:ef:37"
},
"awdl0": {
"ipv6": "fe80::58b9:daff:fea9:23a9",
"mac": "ab:cd:ef:34:12:56"
}
}
```
---
### `.networkInterfaces()`
A useful replacement of `os.networkInterfaces()`. Reports only non-internal interfaces.
```JavaScript
console.log(JSON.stringify(macaddress.networkInterfaces(), null, 2));
```
```JavaScript
{
"en0": {
"ipv6": "fe80::cae0:ebff:fe14:1dab",
"ipv4": "192.168.178.22"
},
"awdl0": {
"ipv6": "fe80::58b9:daff:fea9:23a9"
}
}
```

13
build/node_modules/macaddress/gulpfile.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
// vim: set et sw=2 ts=2
var gulp = require('gulp');
var jshint = require('gulp-jshint');
gulp.task('lint', function (done) {
gulp.src([ "*.js", "lib/*.js" ])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.on('end', done);
});
gulp.task('default', [ 'lint' ]);

136
build/node_modules/macaddress/index.js generated vendored Normal file
View File

@@ -0,0 +1,136 @@
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];
(global.setImmediate || global.setTimeout)(function () {
task(doneIt.bind(null, key), 1);
});
});
}
lib.networkInterfaces = function () {
var ifaces = os.networkInterfaces();
var allAddresses = {};
Object.keys(ifaces).forEach(function (iface) {
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':
_getMacAddress = require('./lib/unix.js');
break;
default:
console.warn("node-macaddress: Unkown 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') {
callback("no interfaces found", null);
}
return null;
}
if (ifaces[iface].mac) {
if (typeof callback === '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') {
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;

11
build/node_modules/macaddress/lib/linux.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
var exec = require('child_process').exec;
module.exports = function (iface, callback) {
exec("cat /sys/class/net/" + iface + "/address", function (err, out) {
if (err) {
callback(err, null);
return;
}
callback(null, out.trim().toLowerCase());
});
};

16
build/node_modules/macaddress/lib/macosx.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
var exec = require('child_process').exec;
module.exports = function (iface, callback) {
exec("networksetup -getmacaddress " + iface, function (err, out) {
if (err) {
callback(err, null);
return;
}
var match = /[a-f0-9]{2}(:[a-f0-9]{2}){5}/.exec(out.toLowerCase());
if (!match) {
callback("did not find a mac address", null);
return;
}
callback(null, match[0]);
});
};

16
build/node_modules/macaddress/lib/unix.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
var exec = require('child_process').exec;
module.exports = function (iface, callback) {
exec("ifconfig " + iface, function (err, out) {
if (err) {
callback(err, null);
return;
}
var match = /[a-f0-9]{2}(:[a-f0-9]{2}){5}/.exec(out.toLowerCase());
if (!match) {
callback("did not find a mac address", null);
return;
}
callback(null, match[0].toLowerCase());
});
};

28
build/node_modules/macaddress/lib/windows.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
var exec = require('child_process').exec;
var regexRegex = /[-\/\\^$*+?.()|[\]{}]/g;
function escape(string) {
return string.replace(regexRegex, '\\$&');
}
module.exports = function (iface, callback) {
exec("ipconfig /all", function (err, out) {
if (err) {
callback(err, null);
return;
}
var match = new RegExp(escape(iface)).exec(out);
if (!match) {
callback("did not find interface in `ipconfig /all`", null);
return;
}
out = out.substring(match.index + iface.length);
match = /[A-Fa-f0-9]{2}(\-[A-Fa-f0-9]{2}){5}/.exec(out);
if (!match) {
callback("did not find a mac address", null);
return;
}
callback(null, match[0].toLowerCase().replace(/\-/g, ':'));
});
};

56
build/node_modules/macaddress/package.json generated vendored Normal file
View File

@@ -0,0 +1,56 @@
{
"_args": [
[
"macaddress@0.2.8",
"/Users/asciidisco/Desktop/asciidisco.com/build"
]
],
"_from": "macaddress@0.2.8",
"_id": "macaddress@0.2.8",
"_inBundle": false,
"_integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=",
"_location": "/macaddress",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "macaddress@0.2.8",
"name": "macaddress",
"escapedName": "macaddress",
"rawSpec": "0.2.8",
"saveSpec": null,
"fetchSpec": "0.2.8"
},
"_requiredBy": [
"/uniqid"
],
"_resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.2.8.tgz",
"_spec": "0.2.8",
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
"author": {
"name": "Julian Fleischer"
},
"bugs": {
"url": "https://github.com/scravy/node-macaddress/issues"
},
"description": "Get the MAC addresses (hardware addresses) of the hosts network interfaces.",
"homepage": "https://github.com/scravy/node-macaddress",
"keywords": [
"mac",
"mac-address",
"hardware-address",
"network",
"system"
],
"license": "MIT",
"main": "index.js",
"name": "macaddress",
"repository": {
"type": "git",
"url": "git+https://github.com/scravy/node-macaddress.git"
},
"scripts": {
"test": "node test.js"
},
"version": "0.2.8"
}

18
build/node_modules/macaddress/test.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
var macaddress = require('./index');
var sync = macaddress.one(function (err, mac) {
if (err || !/[a-f0-9]{2}(:[a-f0-9]{2}){5}/.test(mac)) {
throw err || mac;
}
console.log("Mac address for this host: %s", mac);
});
console.log("Mac address obtained synchronously: %s", sync);
macaddress.all(function (err, all) {
if (err) {
throw err;
}
console.log(JSON.stringify(all, null, 2));
});
console.log(JSON.stringify(macaddress.networkInterfaces(), null, 2));