Skip to content

Instantly share code, notes, and snippets.

@westor7
Last active May 28, 2023 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save westor7/687a787300fbc872362dfbe4fd7ea9ac to your computer and use it in GitHub Desktop.
Save westor7/687a787300fbc872362dfbe4fd7ea9ac to your computer and use it in GitHub Desktop.
IP Proxy Scan On Join for HelpMe
alias -l channels { return #freeirc,#irccloud,#diaspora } ; Place the channels here (use comma to add more).
alias -l api_key { return A2chYE3RMNd737Sr3uWMh1xON1AlauuBSKiGPVNp1F453Zwqsi } ; Register on https://isproxyip.com/ to get an free API key.
alias -l ban_time { return 3600 } ; Enter ban time value in seconds only.
alias -l ban_type { return 2 } ; Enter the ban type to ban (/help $mask).
alias -l ban_reason { return [Banned]: Open Proxy founded for your IP address! } ; Enter here the ban reason (extra identifiers: $1 for nickname, $2 for #channel, $3 for IP).
ON !*:JOIN:$($channels): {
if ($me !isop $chan) { return }
var %host = $ial($nick).host
if ($iptype(%host) !== ipv4) && ($iptype(%host) !== ipv6) { ip_proxy_dns_then_scan $nick $chan %host | return }
ip_proxy_scan $nick $chan %host
}
ON *:DNS: {
if (!$hget(IP_PROXY_SCAN)) { return }
var %addr = $dns(1).addr
var %ip = $dns(1).ip
var %hash = $hget(IP_PROXY_SCAN,%addr)
if (%hash) && (%ip) && ($iptype(%ip)) { ip_proxy_scan %hash %ip | hdel IP_PROXY_SCAN %addr }
}
alias ip_proxy_dns_then_scan {
; /ip_proxy_dns_then_scan <nick> <#channel> <host>
if ($0 !== 3) { return }
if ($1 !ison $2) || ($1 !isreg $2) { return }
hadd -m IP_PROXY_SCAN $3 $1-2
.dns -h $3
}
alias ip_proxy_scan {
; /ip_proxy_scan <nick> <#channel> <IP>
if ($0 !== 3) { return }
if ($1 !ison $2) || ($1 !isreg $2) { return }
var %url = https://api.isproxyip.com/v1/check.php?key= $+ $api_key $+ &ip= $+ $3 $+ &format=json
var %name = scanip_ $+ $ticks $+ $rands(1,100000)
jsonopen -ud %name %url
if ($jsonerror) { return }
var %status = $json(%name,status).value
if (!%status) || (%status !== success) { return }
var %proxy = $json(%name,proxy).value
if (%proxy) { ban $+(-ku,$ban_time) $2 $1 $ban_type $ban_reason }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment