עמוד ראשי מירק סקריפטינג סניפטים איתור מיקום IP

איתור מיקום IP

mIRC Snippets - בפורום זה יפורסמו קודים שימושיים למירק. לפרסום קודים יש לפרסמם תחילה בפורום "פרסום קודים ומדריכים" ולאחר מכאן הם יועברו לפורום זה.

Ohad
מנהל האתר
איתור מיקום IP
הצטרף: 29 יוני 2010, 16:13
הודעות: 112
פורסם: 01 יולי 2010, 12:27
שם הקוד: IP to country
יוצר: Ohad
גירסא: 1.03
תיאור: הקוד מאתר את מיקום ה IP/hostname ונותן את הארץ, העיר ועוד מידע על מיקום ה IP/hostname.
הפעלה: מפורט בתחילת הקוד
תמונה:
תמונה

; ——————————————————————————————————————————————— ;
; IP to country v1.03 by Ohad
;
; This code will locate the IP/hostname and will give the country, city and more information about the IP/hostname.
; You use the command /itc <IP|hostname> to get information about the IP/hostname or by the ITC trigger (the default is !itc).
; To change settings click right click in channel/query/status/menubar and then 'IP to country' or use /_itc (for dialog settings).
;
; Thanks for 'www.geoiptool.com' on the Geo IP Tool.
; ——————————————————————————————————————————————— ;

on *:load:{ itc_default }
on *:unload: { unset %itc.* | .remove itc-channels.ini | sockclose ip_to_country }
on *:text:*:#:{
  if (%itc.status) {
    if ($1 == %itc.trigger) && ((%itc.all || $readini(itc-channels.ini,$network,$chan))) && (!%itc.ignore.check) { set %itc.status.channel 1 | itc $cid $chan $nick $$2 | set $+(-u,$iif(%itc.flood.ignore,$v1,3)) %itc.ignore.check 1 }
    elseif ($1 == !credits) && (!%itc.credits.flood)  { $itc.type $replace(%itc.type,channel,$chan,private,$nick,notice,$nick,action,$chan) 'IP to country' code created by Ohad v1.01 | set -u10 %itc.credits.flood 1 }
  }
}
alias itc { if ($1) && ((%itc.get && *.?* iswm $4 && %itc.status.channel) || (!%itc.status.channel)) { sockclose ip_to_country | sockopen ip_to_country www.geoiptool.com 80 | sockmark ip_to_country $iif(!%itc.status.channel,1 1 1) $1- } }
on *:sockopen:ip_to_country: {
  if (!$sockerr) {
    var %a sockwrite -tn $sockname
    %a GET /en/?IP= $+ $gettok($sock($sockname).mark,4,32) HTTP/1.1
    %a Accept: image/png,image/*;q=0.8,*/*;q=0.5
    %a User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
    %a Host: www.geoiptool.com
    %a Connection: Keep-Alive
    %a
    set %itc.mark $sock($sockname).mark
    unset %itc.msg %itc.num
  }
}
on *:sockread:ip_to_country:{
  var %itc
  sockread %itc
  if (<td align="right"><span class="arial"> isin %itc) { .signal ip_to_country $+(1,@,$gettok($gettok(%itc,3,62),1,60)) }
  elseif (align="left" class="arial_bold"> isin %itc) { var %text $gettok($iif(<a href="* iswm $gettok(%itc,2,62),$gettok(%itc,3,62),$gettok(%itc,2,62)),1,60) | .signal ip_to_country $+(2,@,$iif(%text == /td || %text == /a,N/A,%text)) }
}
on *:signal:ip_to_country:{
  tokenize 64 $remove($1-,:)
  if ($1 == 1) {
    if ($itc.find($2-)) { set %itc.name $2- }
    else { unset %itc.name }
  }
  elseif ($1 == 2) { inc %itc.num | if (%itc.name) { set %itc.msg %itc.msg $replace(%itc.message,<name>,%itc.name,<value>,$iif($left($2-,1) == $chr(32),$mid($2-,2),$2-)) } }
  if (%itc.num == 10) {
    if (%itc.status.channel) {
      tokenize 32 %itc.mark
      scid $1
      $itc.type $replace(%itc.type,channel,$2,private,$3,notice,$3,action,$2) %itc.msg
    }
    else { echo -agt %itc.msg }
    unset %itc.msg %itc.name %itc.num %itc.status.channel
    sockclose $signal
  }
}
menu menubar,status,channel,query {
  -
  IP to country
  .$style(2) Coded by Ohad v1.01:noop
  .-
  .$iif($itc.find(Host Name),$style(1)) Host Name:ip_to_country_menu Host Name
  .$iif($itc.find(IP Address),$style(1)) IP Address:ip_to_country_menu IP Address
  .$iif($itc.find(Country),$style(1)) Country:ip_to_country_menu Country
  .$iif($itc.find(Country code,44),$style(1)) Country code:ip_to_country_menu Country code
  .$iif($itc.find(Region,44),$style(1)) Region:ip_to_country_menu Region
  .$iif($itc.find(City,44),$style(1)) City:ip_to_country_menu City
  .$iif($itc.find(Postal code,44),$style(1)) Postal code:ip_to_country_menu Postal code
  .$iif($itc.find(Calling code,44),$style(1)) Calling code:ip_to_country_menu Calling code
  .$iif($itc.find(Longitude,44),$style(1)) Longitude:ip_to_country_menu Longitude
  .$iif($itc.find(Latitude,44),$style(1)) Latitude:ip_to_country_menu Latitude
  .-
  .All:set %itc.get $itc.all
  .None:unset %itc.get
  .-
  .Message type
  ..$iif(%itc.type == channel,$style(1)) Channel:set %itc.type channel
  ..$iif(%itc.type == private,$style(1)) Private:set %itc.type private
  ..$iif(%itc.type == notice,$style(1)) Notice:set %itc.type notice
  ..$iif(%itc.type == action,$style(1)) Action:set %itc.type action
  .Trigger:set %itc.trigger $gettok($$input(Enter trigger for "IP to country",e,IP to country,%itc.trigger),1,32)
  .-
  .Status
  ..$iif(%itc.status == 1,$style(3)) On:set %itc.status 1
  ..$iif(%itc.status != 1,$style(3)) Off:unset %itc.status
  .-
  .Dialog:_itc
  .Restore default:if ($input(Are you sure you want to restore settings to default?,w,IP to country)) { itc_default }
}

alias -l ip_to_country_menu {
  if ($itc.find($1-)) { set %itc.get $remtok(%itc.get,$1-,44) }
  else { set %itc.get $addtok(%itc.get,$1-,44) }
}

;
; Dialog stuff
;

alias _itc { if ($dialog(itc)) { dialog -rv itc } | else { dialog -m itc itc } }
dialog itc {
  title "IP to country settings [/_itc]"
  size -1 -1 132 138
  option dbu
  box "Options", 1, 1 0 129 38
  text "Networks:", 2, 3 7 25 8
  combo 3, 30 6 48 50, size edit drop
  button "Add", 4, 79 6 25 10
  button "Remove", 5, 104 6 25 10
  text "Channels:", 6, 3 17 25 8
  combo 7, 30 16 48 50, size edit drop
  button "Add", 8, 79 17 25 10
  button "Remove", 9, 104 17 25 10
  text "Flood ignore:", 35, 3 29 35 8
  edit "", 36, 37 28 40 9, autohs limit 4
  text "second/s", 37, 80 29 35 8
  check "All", 10, 112 29 17 8
  box "Message", 11, 1 38 129 86
  text "Message type:", 12, 3 47 36 8
  combo 13, 41 46 83 50, size drop
  text "Trigger:", 14, 20 57 20 8
  edit "", 15, 41 56 83 10, autohs
  check "Host Name", 16, 3 67 36 9
  check "IP Address", 17, 50 67 37 9
  check "Country", 18, 93 67 30 9
  check "Country code", 19, 3 75 43 9
  check "Region", 20, 50 75 27 9
  check "City", 21, 93 75 21 9
  check "Postal code", 22, 3 83 38 9
  check "Calling code", 23, 50 83 40 9
  check "Longitude", 24, 93 83 34 9
  check "Latitude", 25, 3 91 30 9
  button "All", 26, 49 92 27 10
  button "None", 27, 92 92 27 10
  text "Message:", 28, 3 104 24 8
  edit "", 29, 29 103 99 10, autohs
  text "<name> - name | <value> -  value of name", 30, 3 114 125 8
  check "&Enable script", 31, 2 126 41 10
  button "&Save", 32, 43 125 29 12
  button "&Default", 33, 72 125 29 12
  button "&Exit", 34, 101 125 29 12,cancel
}
on *:dialog:itc:*:*:{
  if ($devent == init) {
    var %c did -c $dname
    didtok $dname 13 32 Channel Private Notice Action
    %c 13 $iif($replace(%itc.type,Channel,1,Private,2,Notice,3,Action,4),$ifmatch,1)
    did -a $dname 15 %itc.trigger
    if (%itc.status) { %c 31 }
    var %i 1
    while (%i <= 10) {
      if ($itc.find($gettok($itc.all,%i,44))) { %c $calc(%i +15) }
      inc %i
    }
    did -a $dname 29 %itc.message
    did -a $dname 36 %itc.flood.ignore
    if (%itc.all) { %c 10 | did -b $dname 2-9 }
    else {
      var %x 1,%y 1
      while ($ini(itc-channels.ini,%x)) { did -a $dname 3 $v1 | inc %x }
      while ($ini(itc-channels.ini,$did(3,1),%y)) { did -a $dname 7 $v1 | inc %y }
      %c 3,7 1
    }
    did -f $dname 1
  }
  elseif ($devent == sclick) {
    var %c did -c $dname
    if ($did == 3) { did -r $dname 7 | var %x 1 | while ($ini(itc-channels.ini,$did(3),%x)) { did -a $dname 7 $v1 | inc %x } | %c 7 1 }
    elseif ($did == 4) { if (!$ini(itc-channels.ini,$did(3))) { write itc-channels.ini $+([,$$did(3),]) | did -a $dname 3 $did(3) | %c $did(3).lines } }
    elseif ($did == 5) { if ($ini(itc-channels.ini,$did(3))) { var %x $did(3).sel | noop $read(itc-channels.ini,w,$+([,$did(3),])) | write -dl $+ $readn itc-channels.ini | did -d $dname 3 %x | %c 3 $calc(%x -1) } }
    elseif ($did == 8) { if (!$readini(itc-channels.ini,$did(3),$did(7))) { var %x $iif($left($$did(7),1) == $chr(35),$did(7),$chr(35) $+ $did(7)) | writeini itc-channels.ini $$did(3) %x 1 | did -a $dname 7 %x | %c 7 $did(7).lines } }
    elseif ($did == 9) { if ($readini(itc-channels.ini,$did(3),$did(7))) { var %x $did(7).sel | remini itc-channels.ini $did(3) $did(7) | did -d $dname 7 %x | %c 7 $calc(%x -1) | if (!$ini(itc-channels.ini,$did(3))) { write itc-channels.ini $did(3) } } }
    elseif ($did == 10) { if ($did(10).state) { did -b $dname 2-9 } | else { did -e $dname 2-9 } }
    elseif ($did == 26) { %c 16-25 }
    elseif ($did == 27) { did -u $dname 16-25 }
    elseif ($did == 32) {
      set %itc.message $did(29)
      set %itc.type $did(13)
      set %itc.trigger $gettok($did(15),1,32)
      set %itc.status $did(31).state
      set %itc.all $did(10).state
      set %itc.flood.ignore $did(36)
      unset %itc.get
      var %i 1
      while (%i <= 10) {
        if ($did($calc(%i +15)).state) { set %itc.get $addtok(%itc.get,$gettok($itc.all,%i,44),44) }
        inc %i
      }
    }
    elseif ($did == 33) { if ($input(Are you sure you want to restore settings to default?,w,IP to country)) { itc_default | did -ra $dname 15 !itc | %c 13 1 | did -u $dname 16-25 | %c 16-18,21,26,31,10 | did -r $dname 3,7 | did -b $dname 2-9 | did -ra $dname 29 $+($chr(31),$chr(2),<name>,$chr(2),$chr(31),:) <value> | did -ra $dname 36 3 } }
  }
}

;
; Aliases
;

alias -l itc_default { set %itc.get Host Name,IP Address,Country,City | set %itc.type channel | set %itc.trigger !itc | set %itc.message $+($chr(31),$chr(2),<name>,$chr(2),$chr(31),:) <value> | set %itc.status 1 | set %itc.all 1 | set %itc.flood.ignore 3 | .remove itc-channels.ini }
alias -l itc.type { return $replace(%itc.type,channel,msg,private,msg,action,describe) }
alias itc.find { return $istok(%itc.get,$1,44)) }
alias -l itc.all { return Host Name,IP Address,Country,Country code,Region,City,Postal code,Calling code,Longitude,Latitude }

הצטרף: 29 יוני 2010, 16:19
הודעות: 113
פורסם: 13 יולי 2010, 17:40
אחד הדברים!

Nixxo
משתמש רשום
Re: איתור מיקום IP
הצטרף: 13 יולי 2010, 18:38
הודעות: 20
פורסם: 13 יולי 2010, 18:39
תודה גבר..
תמונה

uns
משתמש רשום
Re: איתור מיקום IP
הצטרף: 01 יולי 2010, 07:18
הודעות: 95
פורסם: 14 יולי 2010, 15:32
ענק !
תמונה


חזור אל סניפטים

cron