How to Check if an IP Address is a Tor Exit Node Server using Java
Tor exit node servers aren’t always a threat, but they’re good to keep an eye on. To that end, our Tor node detection API can identify if an input IP address is, or is not, a Tor exit node server.
Just copy & paste code provided below to connect in Java, and if it’s your first time using a Cloudmersive API, create a free account on our website to get your API key (which provides a limit of 800 API calls per month).
To get started installing the Java SDK with Maven, first add this reference to the repository in pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Next, add this one to the dependency:
<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v4.25</version>
</dependency>
</dependencies>
Finally, copy in the import classes & call the function:
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.NetworkThreatDetectionApi;ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");NetworkThreatDetectionApi apiInstance = new NetworkThreatDetectionApi();
String 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 {
ThreatDetectionTorNodeResponse result = apiInstance.networkThreatDetectionIsTorNode(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling NetworkThreatDetectionApi#networkThreatDetectionIsTorNode");
e.printStackTrace();
}