How to use the mask function from ip
Find comprehensive JavaScript ip.mask code examples handpicked from public code repositorys.
87 88 89 90 91 92 93 94 95 96
//console.log(pool, "pool"); let arrayips = pool.split(';').filter(item => {return item != ""}); console.log(arrayips, "arrayips"); let i = 0; let ipnot = ip.not(mask); let networkIP = ip.mask(cidr, mask); let broadcaseIP = ip.or(cidr, ipnot); console.log(ipnot, networkIP, broadcaseIP); for (i = 0; i < arrayips.length; i++) { let lineips = arrayips[i].split(',');
17 18 19 20 21 22 23 24 25 26
var ip = require('ip') module.exports = function (log, config) { function getBaseIp(addr, prefixLength) { return ip.mask(addr, ip.fromPrefixLen(prefixLength)) } function parseRow(ipColumn) { // Ignore # lines
GitHub: atefBB/browserify-app
![atefBB profile picture](/atefBB.png?size=40)
391 392 393 394 395 396 397 398 399 400
if (cidrParts.length !== 2) throw new Error('invalid CIDR subnet: ' + addr); var mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); return ip.mask(addr, mask); }; ip.subnet = function(addr, mask) { var networkAddress = ip.toLong(ip.mask(addr, mask));
+ 2 other calls in file
GitHub: Stacced/netmonitor
![Stacced profile picture](/Stacced.png?size=40)
148 149 150 151 152 153 154 155 156 157
// Reset scanCancelled just in case scanCancelled = false; // Get local IP mask if not already defined if (localIpMask === null) { localIpMask = ip.mask(ip.address(), ip.fromPrefixLen(24)); } // Create new scan object with IP range and args // Args will run a fast scan with OS detection and XML output, which will be parsed for us by node-nmap
150 151 152 153 154 155 156 157 158 159
res.send({'status': req.param('status') == 'on'}); }, ping: function(req, res) { var hosts = req.param('hosts'); var mask = 24; var currentNetwork = ip.mask(ip.address(), ip.fromPrefixLen(24)); child = exec("sudo nmap -sP " + currentNetwork + "/" + mask + " ; sudo arp-scan --localnet ; sudo nmap -sP " + currentNetwork + "/" + mask, function (error, stdout, stderr) { if (error !== null) {
19 20 21 22 23 24 25 26 27 28
if(iface.length > 0) ifacenetmask = iface[0].netmask; } // ip: separate out the network using the subnet mask var ipnet = require('ip'); var network = ipnet.mask(`${ipaddress}`, `${ifacenetmask}`) // morgan: generate apache style logs to the console var morgan = require('morgan') app.use(morgan('combined'));
ip.address is the most popular function in ip (635 examples)