Prerequisites
- Ruby 3.0+ with
ip-api-ioinstalled - A free ip-api.io API key
Read suspicious_factors on any lookup
No dedicated call needed — the predicates ride along with a normal lookup_ip.
client = Ipapi::Client.new(api_key: ENV.fetch("IP_API_IO_KEY"))
info = client.lookup_ip("185.220.101.1")
f = info.suspicious_factors
puts f.vpn? # VPN service
puts f.proxy? # open / anonymizing proxy
puts f.tor_node? # Tor node
puts f.datacenter? # hosting / datacenter IP (often a bot)
puts f.spam? # known spam source
puts f.crawler? # known crawler / bot
puts f.threat? # listed on a threat feed
if f.vpn? || f.proxy? || f.tor_node?
# require step-up verification (CAPTCHA, 2FA)
end Confirm a Tor exit node with tor_check
A dedicated check against the live Tor node list, with a count of matching nodes.
tor = client.tor_check("185.220.101.1")
puts tor.tor? # true
puts tor.tor_node_count # number of matching Tor nodes risk_score_ip.