Blocking malicious traffic and bots with IPLocate

Learn how to detect and block bots, scrapers, and abusive IPs using IPLocate's IP intelligence API. Practical techniques for threat detection, hosting provider identification, and dynamic response strategies.

Understanding Malicious Traffic and Bots

Malicious traffic encompasses unauthorized or harmful activities targeting your applications, such as data breaches, DDoS attacks, and fraud. Bots, especially malicious ones, can scrape content, perform credential stuffing, or engage in click fraud, disrupting your services and compromising user data. Effectively identifying and blocking such traffic is essential to maintain the integrity of your applications.

In real-world scenarios, malicious traffic can take many forms:

  • Login abuse: Brute-force or credential-stuffing attacks to hijack user accounts.
  • Web scraping: Unwanted bots scraping proprietary content or product listings.
  • Fraudulent activity: Fake form submissions, ad click fraud, or payment fraud.

While captchas, rate limiting, and WAFs are part of a solid defense strategy, they're not foolproof. IP-based intelligence adds a powerful layer of protection when integrated directly into your application logic. IPLocate gives you the building blocks to respond dynamically—whether that means blocking access, asking for additional verification, or throttling suspicious requests.

Leveraging IPLocate's API to help you detect and block threats

IPLocate provides a comprehensive API that delivers detailed information about IP addresses, including geolocation, ASN data, company details, and, importantly, privacy, hosting, and threat data. By integrating IPLocate's API into your system, you can programmatically assess incoming traffic and take appropriate actions against malicious actors.

You can make a simple request like this:

curl https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key

And get data like this:

{
  // ...
  "privacy": {
    "is_abuser": true,
    "is_tor": true,
    "is_vpn": true,
    "is_proxy": true,
    "is_hosting": true,
    // ...
  },
  "hosting": {
    "provider": "Amazon AWS",
    "domain": "amazonaws.com",
    "network": "54.239.16.0 - 54.239.31.255"
  },
  // ...
}

When analyzing incoming traffic, some fields in the IPLocate API response offer particularly high signal for identifying malicious or automated traffic. We'll explore each one in detail—what it tells you, when to use it, how to act on it, and where it fits into real-world abuse cases. We'll also touch on implementation examples and common caveats.

privacy.is_abuser: Blocking known bad IPs

This field is true if an IP address has recently engaged in spam, scanning, scraping, brute-force attacks, or other kinds of abuse. It's updated frequently and reflects short-term reputation.

Why it matters:

  • Very strong signal of recent bad behavior.
  • Low false-positive rate.
  • Ideal for automated blocking or aggressive throttling.

Use case example: Let’s say you run an e-commerce site. You notice bots flooding your login endpoint. Any request from an IP flagged as is_abuser: true can be immediately blocked or shown a CAPTCHA.

const response = await fetch('https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key');
const data = await response.json();

if (data.privacy.is_abuser) {
  block("IP flagged for abuse");
}

Caveat: Abuse signals decay over time. An IP might be reassigned or stop misbehaving. Use this for short-term, real-time filtering—not permanent blocks.

privacy.is_hosting and hosting.provider: Detecting bot infrastructure

Most human users connect from residential ISPs. If a request comes from a known hosting provider (e.g., Amazon AWS, DigitalOcean), it’s likely automated—unless you’re expecting API calls or crawlers.

Why it matters:

  • Hosting IPs are a common source of scraping, credential stuffing, and fraud.
  • The hosting.provider field helps you identify the source and take tailored action.

Use case example: You run a content site with exclusive product listings. You want to slow down scrapers without disrupting real users. You can apply friction to traffic from hosting networks:

const response = await fetch('https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key');
const data = await response.json();

if (data.privacy.is_hosting) {
  showCaptcha("hosting provider access");
}

Caveat: VPNs and corporate proxies may also use hosting infrastructure. Combine with other signals (like is_anonymous) to reduce false positives.

You can read more detail about detecting hosting providers.

privacy.is_proxy, privacy.is_vpn, privacy.is_tor: Detecting anonymized traffic

These fields flag IPs associated with anonymization services:

  • is_proxy: open proxies and generic anonymity services
  • is_vpn: commercial VPNs
  • is_tor: Tor exit nodes

Why it matters:

  • Anonymized users are harder to geofence or rate-limit accurately.
  • Fraudsters often spoof their origin using VPNs or Tor.

Use case example: You operate a survey platform restricted to US participants. A user claims to be in the US but is coming from a VPN server. You can reject the submission or ask for verification.

const response = await fetch('https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key');
const data = await response.json();

if (data.privacy.is_vpn || data.privacy.is_proxy) {
  require_phone_verification("geo-sensitive fraud check");
}

Caveat: Some legit users (e.g., journalists, privacy-conscious users) use VPNs. Avoid hard blocks unless abuse is confirmed.

asn.name and asn.type: Pattern detection and heuristics

These fields give insight into the organization behind an IP, including its name and classification (e.g., ISP, hosting, business).

Why it matters:

  • Known bad ASNs (e.g., bulletproof hosting providers) are a common denominator in abuse.
  • You can use ASN metadata to cluster and monitor abuse patterns.

Use case example: A burst of suspicious traffic comes from multiple IPs within a single ASN. You can dynamically throttle that ASN for an hour:

const response = await fetch('https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key');
const data = await response.json();

if (data.asn.name === "ExampleBadHost") {
  throttle("ASN-wide rate limiting");
}

Caveat: ASN data is only as good as the upstream registry and may be overly broad. Some large providers serve both good and bad traffic.

country_code: Geo-based filters during attacks

Country-level geolocation can support dynamic friction or risk scoring, especially during targeted attacks.

Why it matters:

  • Attacks often originate in bursts from specific regions.
  • You can use geofencing to apply context-aware defenses.

Use case example: You run a streaming service available only in North America. Suddenly, login attempts spike from Brazil and Russia. Temporarily showing CAPTCHAs to those countries can reduce risk:

const response = await fetch('https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key');
const data = await response.json();

if (["RU", "BR"].includes(data.country_code)) {
  showCaptcha("geo anomaly");
}

Caveat: Location detection is not perfect. Use with flexibility—never block entire countries permanently without good reason.

Putting it all together

You don't need a perfect model. Start with high-confidence signals (is_abuser, is_tor, is_hosting) and layer in more nuanced filters like geolocation or ASN heuristics. Here's a simplified example:

const response = await fetch('https://iplocate.io/api/lookup/54.239.28.85?apikey=your_api_key');
const data = await response.json();

if (data.privacy.is_abuser || data.privacy.is_tor) {
  blockRequest("known malicious");
} else if (data.privacy.is_hosting && data.privacy.is_anonymous) {
  showCaptcha("bot suspicion");
} else if (["RU", "CN", "BR"].includes(data.country_code)) {
  throttle("geo-based filter");
}

This logic can live in your backend middleware, reverse proxy (e.g., NGINX with Lua), or at the edge via a CDN worker. The key is that it’s flexible, fast, and based on live data.

Rather than relying solely on generic security tools, use IPLocate to build IP-aware protections that are tailored to your users and your application. Our hosting detection, threat intelligence, and ASN data give you the insight needed to make smart, data-driven security decisions.

Get started now or read the full documentation to explore all the available fields.