pony

this is hat i built mine off of

Mar 12th, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. ; IP Info v1.5 - by entropy 2019
  2. ; Grabs JSON from: http://ipinfo.io/{$ip}/geo
  3. ; Syntax: !ipinfo <IP>
  4.  
  5. #ipx on
  6. on *:text:*:#:{ if (?ipinfo iswm $1 && $2 && $left($1,1) isin .@!) { getip $2 # } }
  7. on *:input:#:{ if (?ipinfo iswm $1 && $server && /* !iswm $1 && $2 && $left($1,1) isin .@!) { getip $2 # } }
  8. #ipx end
  9.  
  10. alias -l getip {
  11. sockclose xip
  12. sockopen -46 xip ipinfo.io 80
  13. sockmark xip $1
  14. %xchan = $2
  15. %xline = ""
  16. }
  17. on *:sockopen:xip:{
  18. if ($sockerr) { msg %xchan [IPinfo] $c Open Error! | unset %xchan %xline | return }
  19. sockwrite -n $sockname GET $+(http://ipinfo.io/,$sock($sockname).mark,/geo) HTTP/1.1
  20. sockwrite -n $sockname Host: ipinfo.io
  21. sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
  22. sockwrite -n $sockname Accept-Language: en-US
  23. sockwrite -n $sockname Content-Type: application/json; charset=utf-8
  24. sockwrite -n $sockname $str($crlf,2)
  25. }
  26. on *:sockread:xip:{
  27. if ($sockerr) { msg %xchan [IPinfo] $c Read Error! | unset %xchan %xline | return }
  28. var %x, %2
  29. sockread -f %x
  30. tokenize 32 %x
  31. if ("*": * iswm $1-) {
  32. var %2 = $remove($2-,",$chr(44))
  33. if ($1 == "ip":) { %xline = [IPinfo] $c IP: %2 }
  34. if ($1 == "city":) { %xline = %xline $c City: %2 }
  35. if ($1 == "region":) { %xline = %xline $c Region: %2 }
  36. if ($1 == "country":) { %xline = %xline $c Country: %2 }
  37. if ($1 == "loc":) { %xline = %xline $c Location: $replace(%2,-,$+($chr(44),-)) }
  38. if ($1 == "timezone":) { %xline = %xline $c Timezone: %2 | endxit | sockclose $sockname }
  39. }
  40. if ($chr(125) isin $1) { endxit | sockclose $sockname }
  41. }
  42. alias -l endxit {
  43. if (%xline) { msg %xchan %xline }
  44. else { msg %xchan [IPinfo] $c Nothing found! }
  45. unset %xline %xchan
  46. }
  47. alias -l c { return $chr(9679) }
Advertisement
Add Comment
Please, Sign In to add comment