Ford

IpInfo / #ipinfo trigger

Jun 23rd, 2011
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.99 KB | None | 0 0
  1. ;iplocator by Ford_Lawnmower irc.GeekShed.net #Script-Help
  2. #IpInfo on
  3. On $*:Text:/^#IpInfo.*/Si:#: {
  4. if ($timer($+(IpInfo,$network,$nick))) { return }
  5. .timer $+ $+(IpInfo,$network,$nick) 1 6 noop
  6. GetIpInfo .msg $chan $2-
  7. }
  8. #IpInfo end
  9. alias IpInfo { GetIpInfo echo -a $1- }
  10. alias -l GetIpInfo {
  11. $1-2 07Searching........
  12. var %sockname $+(IpInfo,$network,$2,$ticks)
  13. sockopen %sockname www.melissadata.com 80
  14. sockmark %sockname $1-2 $+(/lookups/iplocation.asp?ipaddress=,$3)
  15. }
  16. On *:sockopen:IpInfo*: {
  17. if (!$sockerr) {
  18. sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
  19. sockwrite -n $sockname Host: www.melissadata.com
  20. sockwrite -n $sockname $crlf
  21. }
  22. else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  23. }
  24. On *:sockread:IpInfo*: {
  25. if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  26. else {
  27. var %IpInfo | sockread %IpInfo
  28. if ($regex(%IpInfo,/<td class='columresult'>([^<]*)<\/td><td align='left'><b>([^<]*)<\/b><\/td><\/tr>/gi)) {
  29. put $gettok($sock($sockname).mark,1-2,32) $remove($+(07,$regml(1),:,$chr(32),06,$regml(2)),&nbsp;)
  30. }
  31. elseif ($regex(%IpInfo,/<div align='center' class='Lookupserror'>([^<]*)<b>([^<]*)<\/b>([^<]*)<br>([^<]*)<\/div>/gi)) {
  32. $gettok($sock($sockname).mark,1-2,32) $regml(1) $regml(2) $regml(3) $regml(4) 07Syntax !IpInfo 1.2.3.4
  33. sockclose $sockname
  34. }
  35. }
  36. }
  37. dialog IP_Locator {
  38. title "Ip Locator"
  39. size -1 -1 96 144
  40. option dbu
  41. text "Country:", 1, 0 8 33 8, right
  42. text "Region:", 2, 0 16 33 8, right
  43. text "City:", 3, 0 24 33 8, right
  44. text "Certainty:", 4, 0 32 33 8, right
  45. text "Latitude:", 5, 0 40 33 8, right
  46. text "Longitude:", 6, 0 48 33 8, right
  47. text "Time Zone:", 7, 0 56 33 8, right
  48. text "Population:", 8, 0 64 33 8, right
  49. text "Proxy?:", 9, 0 72 33 8, right
  50. text "Currency:", 10, 0 80 33 8, right
  51. text "", 11, 40 8 57 8
  52. text "", 12, 40 16 57 8
  53. text "", 13, 40 24 57 8
  54. text "", 14, 40 32 57 8
  55. text "", 15, 40 40 57 8
  56. text "", 16, 40 48 57 8
  57. text "", 17, 40 56 57 8
  58. text "", 18, 40 64 57 8
  59. text "", 19, 40 72 57 8
  60. text "", 20, 40 80 57 8
  61. text "IP Address:", 21, 0 120 33 8, right
  62. edit "", 22, 40 120 54 10
  63. button "Find", 23, 65 131 29 12
  64. text "", 24, 0 0 97 8, center
  65. icon 25, 40 92 47 23
  66. text "Flag:", 26, 0 98 33 8, right
  67. check "Check for Drones", 27, 2 131 58 10
  68. }
  69. On *:dialog:Ip_Locator:Sclick:23: {
  70. if ($gettok($did(ip_locator,22).text,0,46) != 4) {
  71. did -a Ip_Locator 24 You must enter a ip address
  72. .timer 1 3 did -a Ip_Locator 24
  73. return
  74. }
  75. else {
  76. did -a Ip_Locator 24
  77. IpLocator $did(ip_locator,22).text
  78. if ($did(Ip_Locator,27).state == 1) { dronebl $did(ip_locator,22).text }
  79. }
  80. }
  81. On *:dialog:Ip_Locator:init:*: {
  82. IpLocator $ip
  83. $iif($ip,did -a Ip_locator 22 $ip)
  84. }
  85. alias IpLocator.timeout {
  86. if (%IpLocator.chan == dialog) && ($dialog(IP_Locator)) {
  87. did -a Ip_locator 24 Connection Timed Out!
  88. .timer 1 3 did -a Ip_Locator 24
  89. }
  90. else { echo -a Connection Timed Out! }
  91. IpLocator.clear
  92. }
  93. alias IpLocator.clear {
  94. unset %IpLocator*
  95. sockclose IpLocator
  96. .timer-IpLocator off
  97. halt
  98. }
  99. alias IpLocator {
  100. set %IpLocator.nick $me
  101. set %IpLocator.chan dialog
  102. sockclose IpLocator
  103. set %IpLocatorurl $+(/IpLocator.htm?GetLocation&IpAddress=,$1)
  104. set %IpLocatorsite www.geobytes.com
  105. sockopen IpLocator %IpLocatorsite 80
  106. .timer-IpLocator 1 10 IpLocator.timeout
  107. }
  108. on *:sockopen:IpLocator: {
  109. if (!$sockerr) {
  110. sockwrite -n $sockname GET %IpLocatorurl HTTP/1.1
  111. sockwrite -n $sockname Host: %IpLocatorsite $+ $CRLF $+ $CRLF
  112. }
  113. else { echo -st Unknown Socket error $script | return }
  114. }
  115. on *:sockread:IpLocator: {
  116. if ($sockerr > 0) { echo -a IpLocator >sock error< | IpLocator.clear }
  117. else {
  118. var %IpLocatorvar | sockread %IpLocatorvar
  119. if (<td align="right">Country</td> isin %IpLocatorvar) { set %IpLocator.Country on }
  120. if (<td align="right">Region</td> isin %IpLocatorvar) { set %IpLocator.Region on }
  121. if (<td align="right">City</td> isin %IpLocatorVar) { set %IpLocator.city on }
  122. if (<td align="right">Certainty</td> isin %IpLocatorvar) { set %IpLocator.certainty on }
  123. if (<td align="right">Latitude</td> isin %IpLocatorvar) { set %IpLocator.latitude on }
  124. if (<td align="right">Longitude</td> isin %IpLocatorvar) { set %IpLocator.longitude on }
  125. if (<td align="right">TimeZone</td> isin %IpLocatorvar) { set %IpLocator.timezone on }
  126. if (<td align="right">Population</td> isin %IpLocatorvar) { set %IpLocator.population on }
  127. if (<td align="right">Is proxy</td> isin %IpLocatorvar) { set %IpLocator.proxy on }
  128. if (<td align="right">Currency</td> isin %IpLocatorvar) { set %IpLocator.currency on }
  129. if (<td align="right">Flag</td> isin %IpLocatorvar) { set %Iplocator.flag on }
  130. if (<input name="ro-no_bots_pls isin %IpLocatorvar) {
  131. if (%IpLocator.Country == on) { set %IpLocator.country $between(%IpLocatorvar,value="," size,1) }
  132. if (%IpLocator.region == on) { set %IpLocator.region $between(%IpLocatorvar,value="," size,1) }
  133. if (%IpLocator.City == on) { set %IpLocator.city $between(%IpLocatorvar,value="," size,1) }
  134. if (%IpLocator.certainty == on) { set %IpLocator.certainty $between(%IpLocatorvar,value="," size,1) }
  135. if (%IpLocator.latitude == on) { set %IpLocator.latitude $between(%IpLocatorvar,value="," size,1) }
  136. if (%IpLocator.longitude == on) { set %IpLocator.longitude $between(%IpLocatorvar,value="," size,1) }
  137. if (%IpLocator.timezone == on) { set %IpLocator.timezone $between(%IpLocatorvar,value=",",1) }
  138. if (%IpLocator.population == on) { set %IpLocator.population $between(%IpLocatorvar,value=",",1) }
  139. if (%IpLocator.proxy == on) { set %IpLocator.proxy $between(%IpLocatorvar,value=",",1) }
  140. if (%IpLocator.currency == on) { set %IpLocator.currency $between(%IpLocatorvar,value="," size,1) }
  141. }
  142. if (<a href="FreeServices.htm"> isin %IpLocatorvar) && (%IpLocator.flag == on) {
  143. var %flaglink $between(%IpLocatorvar,<a href="FreeServices.htm"><img border="0" src="," width="107",1)
  144. getflag %flaglink $nopath(%flaglink)
  145. if (%IpLocator.chan == dialog) && ($dialog(IP_Locator)) {
  146. did -a IP_Locator 11 $iif(%IpLocator.country,$v1,N/A)
  147. did -a IP_Locator 12 $iif(%IpLocator.region,$v1,N/A)
  148. did -a IP_Locator 13 $iif(%IpLocator.city,$v1,N/A)
  149. did -a IP_Locator 14 $iif(%IpLocator.certainty,$v1 $+ %,N/A)
  150. did -a IP_Locator 15 $iif(%IpLocator.latitude,$v1,N/A)
  151. did -a IP_Locator 16 $iif(%IpLocator.longitude,$v1,N/A)
  152. did -a IP_Locator 17 $iif(%IpLocator.timezone,$v1,N/A)
  153. did -a IP_Locator 18 $iif(%IpLocator.population,$v1,N/A)
  154. did -a IP_Locator 19 $iif(%IpLocator.proxy,$v1,N/A)
  155. did -a IP_Locator 20 $iif(%IpLocator.currency,$v1,N/A)
  156. .timer 1 4 did -g IP_Locator 25 $qt($+($mircdir,flags\,$nopath(%flaglink)))
  157. }
  158. IpLocator.clear
  159. }
  160. }
  161. }
  162. alias -l IP_Locator {
  163. if ($dialog(IP_Locator)) { dialog -v IP_Locator IP_Locator }
  164. else { dialog -m IP_Locator IP_Locator }
  165. }
  166. menu status,channel {
  167. IP Locator
  168. .Dialog:IP_Locator
  169. .$iif($group(#IpInfo) == On,$style(1)) IpInfo Trigger
  170. ..$iif($group(#IpInfo) == On,$style(2)) On: .enable #IpInfo
  171. ..$iif($group(#IpInfo) == Off,$style(2)) Off: .disable #IpInfo
  172. }
  173. Alias -l GetFlag {
  174. if ($isfile($+(flags\,$2))) { return }
  175. set %Getflag.Site $gettok($remove($1,http://),1,47)
  176. set %Getflag.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  177. set %Getflag.PicName $2
  178. if (!$isdir($+($mircdir,flags))) { mkdir flags }
  179. sockclose Getflag
  180. sockopen Getflag %Getflag.site 80
  181. }
  182. On *:sockopen:Getflag:{
  183. sockwrite -nt $sockname GET %Getflag.url HTTP/1.0
  184. sockwrite $sockname Host: %Getflag.site $+ $crlf $+ $crlf
  185. }
  186. On *:sockread:Getflag:{
  187. if (!$sock($sockname).mark) {
  188. var %Getflag.var | sockread %Getflag.var
  189. if (%Getflag.var == $null) { sockmark $sockname 1 }
  190. }
  191. else {
  192. sockread &flag
  193. bwrite $qt($+($mircdir,flags\,%Getflag.picname)) -1 -1 &flag
  194. }
  195. }
  196. On *:sockclose:Getflag:{
  197. unset %Getflag.*
  198. }
  199. alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | return $remove($replace(%x,&amp;,&),&nbsp;,&lt;) }
  200. alias -l Put {
  201. if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
  202. var %tokens $0, %Tstart 3, %Dtimer 1500
  203. if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
  204. while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
  205. dec %tokens
  206. if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
  207. .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  208. inc %Dtimer 1500
  209. %Tstart = $calc(%tokens + 1)
  210. %tokens = $0
  211. }
  212. }
  213. .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  214. .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
  215. }
  216. ;alias by Gummo
  217. alias -l between {
  218. noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi)
  219. return $regml($4)
  220. }
  221. alias -l dronebl {
  222. .enable #dronecheck
  223. var %dronebl $gettok($1,4,46) $+ . $+ $gettok($1,3,46) $+ . $+ $gettok($1,2,46) $+ . $+ $gettok($1,1,46) $+ .dnsbl.dronebl.org
  224. set %dns.ip $1
  225. .dns %dronebl
  226. }
  227. menu nicklist {
  228. IP Locator for $$1:{
  229. IP_Locator
  230. .enable #nicklistcheck
  231. userip $$1
  232. .timer 1 2 .disable #nicklistcheck
  233. }
  234. }
  235. #nicklistcheck off
  236. Raw 340:*: {
  237. haltdef
  238. var %tempip $gettok($1-,2,64)
  239. echo -a %tempip
  240. if ($gettok(%tempip,4,46) isnum) {
  241. iplocator %tempip
  242. did -r Ip_locator 22
  243. did -a Ip_locator 22 %tempip
  244. }
  245. }
  246. #nicklistcheck end
  247. #dronecheck off
  248. On 1:DNS: {
  249. if ($dialog(IP_Locator)) {
  250. if ($dns(0)) { did -a Ip_Locator 24 $qt(%dns.ip) Is a Drone! | .timer 1 2 did -a IP_Locator 19 True }
  251. else { did -a Ip_Locator 24 $qt(%dns.ip) is Not a Drone | .timer 1 2 did -a IP_Locator 19 False }
  252. }
  253. unset %dns.ip
  254. .disable #dronecheck
  255. halt
  256. }
  257. #dronecheck End
Advertisement
Add Comment
Please, Sign In to add comment