How to Check IP Addresses for Tor Exit Node Servers in C#

Cloudmersive
1 min readMay 4, 2023

--

While Tor Exit Node Servers aren’t necessarily indications of malicious activity by default, they’re certainly suspicious and sometimes worth blocking outright. Using the code provided below, you can quickly check if an IP address is a Tor Exit Node Server; you’ll receive a simple Boolean response to direct subsequent action however you see fit.

To structure your API call, start by running the following command in your Package Manager console. This installs the client SDK via NuGet:

Install-Package Cloudmersive.APIClient.NET.Security -Version 3.0.1

With that out of the way, now you can copy from the below C# code examples to form your request. To authenticate your request, grab a free-tier API key (with a limit of 800 API calls per month) from the Cloudmersive website:

using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.Security.Api;
using Cloudmersive.APIClient.NET.Security.Client;
using Cloudmersive.APIClient.NET.Security.Model;

namespace Example
{
public class NetworkThreatDetectionIsTorNodeExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");

var apiInstance = new 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.

try
{
// Check if IP address is a Tor node server
ThreatDetectionTorNodeResponse result = apiInstance.NetworkThreatDetectionIsTorNode(value);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling NetworkThreatDetectionApi.NetworkThreatDetectionIsTorNode: " + e.Message );
}
}
}
}

It’s just that easy — no more code required.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet