Check if IP Address is a Tor Node Server in Node.js

Cloudmersive
2 min readJan 10, 2022

If you’re familiar with Tor node servers, you’re probably aware they aren’t necessarily a threat in and of themselves. Tor node servers simply make it possible for a user to browse the web anonymously, with exceptional privacy regarding the disclosure of their activities or location. It’s still a good thing to know if your site is being visited in this capacity, and there’s an easy way to check if an IP address is a Tor exit node server — let the Cloudmersive Security Threat Detection API do it for you. This API will take an IP address as an input, and simply identify whether said IP address is a Tor exit node server or not. It’s easy to use — let’s get it set up for Node.js.

First things first — you’ll need to use the below command line to install the SDK:

npm install cloudmersive-security-api-client --save

Make sure to use the below snippet for your package.json:

"dependencies": {
"cloudmersive-security-api-client": "^1.2.0"
}

Now, for our final step — all you need to do is copy and paste the below code into your environment. Your API key will be provisioned on Cloudmersive.com; please contact your Cloudmersive representative with any questions on this front.

var CloudmersiveSecurityApiClient = require('cloudmersive-security-api-client');
var defaultClient = CloudmersiveSecurityApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveSecurityApiClient.NetworkThreatDetectionApi();var value = "value_example"; // String | IP address to check, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.networkThreatDetectionIsTorNode(value, callback);

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.