New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

moira

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moira - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

65

lib/moira.js

@@ -1,37 +0,39 @@

"use strict";
'use strict';
var request = require('request');
var request = require( 'request' );
// HTTP requests to a service should return an IP address ONLY in the response body
var services = [
"http://ifconfig.me/ip",
"http://icanhazip.com/",
"http://ip.appspot.com/",
"http://curlmyip.com/",
"http://ident.me/",
"http://ipecho.net/plain",
"http://whatismyip.akamai.com/",
"http://tnx.nl/ip",
"http://myip.dnsomatic.com/"
'http://ifconfig.me/ip',
'http://icanhazip.com/',
'http://ip.appspot.com/',
'http://curlmyip.com/',
'http://ident.me/',
'http://ipecho.net/plain',
'http://whatismyip.akamai.com/',
'http://tnx.nl/ip',
'http://myip.dnsomatic.com/'
];
function getIP(callback) {
var GetIP = this,
completedRequests = 0,
done = false;
this.isDone = function() {done = true};
this.isNotDone = function() {return !done};
this.isOnItsLastResponse = function() {return completedRequests == services.length};
function getIP( callback ){
var GetIP = this;
services.forEach(function(service) {
request(service, function(err, response, address) {
if (address) address = address.replace(/\s+/,""); //Remove whitespace
if (GetIP.isNotDone() && thisIsAnIP(address)) {
GetIP.isDone();
callback(null, address, response.request.uri.href)
GetIP.done = false;
GetIP.isOnItsLastResponse = function() { return GetIP.completedRequests === services.length };
GetIP.completedRequests = 0;
services.forEach( function( service ){
request( service, function( err, response, address ){
GetIP.completedRequests++;
if ( address ) address = address.replace( /\s+/, '' ); //Remove whitespace
if ( GetIP.done === false && thisIsAnIP( address )){
GetIP.done = true;
callback( null, address, response.request.uri.href )
}
if (GetIP.isNotDone() && GetIP.isOnItsLastResponse()) {
callback(true, null, null)
if ( GetIP.done === false && GetIP.isOnItsLastResponse() ){
callback( 'All attempts to retrieve your IP address were exhausted', null, null )
}
completedRequests++
});

@@ -41,8 +43,9 @@ })

function thisIsAnIP(address) {
var octet = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.",
isIP = new RegExp("^" + octet + octet + octet + octet.slice(0, -1) + "$");
if(address) {return isIP.test(address)} else {return(null)}
function thisIsAnIP( address ){
var octet = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.',
isIP = new RegExp( '^' + octet + octet + octet + octet.slice( 0, -1 ) + '$' );
if( address ) { return isIP.test( address )} else { return( null )}
}
exports.getIP = getIP;
{
"name": "moira",
"description": "Most Outstanding IP Reporting Assistant",
"version": "1.0.5",
"homepage": "https://github.com/mjhasbach/MOIRA",
"keywords": [
"external",
"IP",
"address",
"retrieve",
"fetch",
"utility"
],
"repository": {
"type": "git",
"url": "https://github.com/mjhasbach/MOIRA.git"
},
"author": {
"name": "Matthew Hasbach",
"email": "hasbach.git@gmail.com",
"url": "https://github.com/mjhasbach"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/mjhasbach/MOIRA/blob/master/LICENSE.txt"
"name": "moira",
"description": "Most Outstanding IP Reporting Assistant",
"version": "1.0.6",
"homepage": "https://github.com/mjhasbach/MOIRA",
"main": "lib/moira.js",
"private": false,
"keywords": [
"external",
"IP",
"address",
"retrieve",
"fetch",
"utility"
],
"repository": {
"type": "git",
"url": "https://github.com/mjhasbach/MOIRA.git"
},
"author": {
"name": "Matthew Hasbach",
"email": "hasbach.git@gmail.com",
"url": "https://github.com/mjhasbach"
},
"licenses": [{
"type": "MIT",
"url": "https://github.com/mjhasbach/MOIRA/blob/master/LICENSE.txt"
}],
"dependencies": {
"request": ">= 2.34.0"
},
"bugs": {
"url": "https://github.com/mjhasbach/MOIRA/issues"
}
],
"main": "lib/moira.js",
"dependencies": {
"request": ">=2.31.0"
},
"private": false,
"bugs": {
"url": "https://github.com/mjhasbach/MOIRA/issues"
}
}

@@ -1,10 +0,8 @@

var moira = require('../lib/moira');
var moira = require( '../lib/moira' );
moira.getIP(function(err, IP, service) {
if(err) {
console.log("All attempts to retrieve your IP address were exhausted. Is there a problem with your connection?");
} else {
console.log("Your external IP address is " + IP);
console.log("The fastest service to return your IP address was " + service);
}
moira.getIP( function( err, ip, service ){
if( err ) throw err;
console.log( 'Your external IP address is ' + ip );
console.log( 'The fastest service to return your IP address was ' + service );
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc