IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   TCL Scriptler (https://www.ircforumlari.net/tcl-scriptler/)
-   -   PING - Tcl (https://www.ircforumlari.net/tcl-scriptler/615133-ping-tcl.html)

saywhat 19 Eylül 2014 04:06

PING - Tcl
 
Uzun süredir script paylaşmıyordum. yazmadığımdan değil,yazdıklarımın Türkçe olmamasından, burada kullanan çıkmayacağından dolayı paylaşmıyordum....
bari bunu paylaşayım dedim (aslında bunun orjinali de Türkçe değil .. di .. buraya postalamak için Türkçe'leştirdim.Belki kullanan/kullanmak isteyen çıkabilir...)

bu scripti , şu -> [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] egghelp forumu script istekleri bölümünde istekte bulunan vatandaşın,orada sonuç alamayınca, IRC üzerinden gelip istemesi üzerine yazmış olduğum bir script idi....

IPv4 ve IPv6 IP adreslerine , hostlarına yada kanal üzerindeki nicklere , shell üzerinden ping atıp dönen çıktıyı kanala yansıtır. (çıktılar sistem Türkçe olsa dahi İngilizce olarak dönecektir... kullanmak isteyecekler bunu dikkate almalıdır..)

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

Kod:

# kanal/lar üstünde aktif etmek için ,
# botunuza DCC/telnet ile bağlanın ve :
# .chanset #kanal +pinging

# IPv4 ping istek komut/ları :
set pcmds "p ping pingin pinging"

# IPv6 istek komut/ları :
set p6cmd "p6 ping6"

# komut/ların başına gelecek sembol/işaret/trigger
set ptrig "."

# komut/ları kullanma erişimi olacak kullanıcı flagları
set pflags "-|-"

# herbir kişi için,yeniden komut/ları kullanabilmesi için,arada beklemesi gereken süre: (saniye)
set pflud "10"

# ayarlar bitti #


proc ping6_pub {nick uhost hand chan text} {
      if {![channel get $chan pinging]} { return }

            set user [lindex [split $uhost "@"] 1]
           
      if {[throttled $user,$chan $::pflud]} {
              puthelp "notice $nick :\002Flood algılandı !!!\002 - \
              \00314[expr {[clock seconds] - $::throttled($user,$chan)}] saniye sonra deneyin...\003"
              return
      }


        if {[llength [lindex [split $text] 0]] eq "0"} {
            puthelp "notice $nick :Kullanımı :\002$::lastbind \00304<\003 IPv6 adresi / IPv6 hostu / nick \00304>\003\002"
            return 0
        }
         
      if {[string match "*:*:*" [lindex [split $text] 0]]} {
            set cmd "ping6 -c 3 [lindex [split $text] 0]"
        }
       
      if {[string match -nocase "*.*" [lindex [split $text] 0]]} {
            set host "host -t AAAA [lindex [split $text] 0]"
         
          catch { eval exec $host } out
         
          foreach lines [split $out "\n"] {
            if {[regexp {has IPv6 address ([^\s]+)} $lines - ipv]} {
                  if {[info exists ipv] eq "1"} {
                        set cmd "ping6 -c 3 $ipv"
                        putlog "$ipv"
                      } else {
                        puthelp "privmsg $chan :[lindex [split $text] 0] geçerli ipv6 adresi değil..."
                      }
                }
            }
      }
     
    if {![string match "*.*" [lindex [split $text] 0]] && \
          [onchan [lindex [split $text] 0] $chan] && \
          [string match "*.*" [lindex [split [getchanhost [lindex [split $text] 0] $chan] "@"] 1]]} {
         
            set target [lindex [split [getchanhost [lindex [split $text] 0] $chan] "@"] 1]
            set host "host -t AAAA $target"
            putlog "$target"
         
          catch { eval exec $host } out
         
          foreach lines [split $out "\n"] {
            if {[regexp {has IPv6 address ([^\s]+)} $lines - ipv]} {
                  if {[info exists ipv] eq "1"} {
                        set cmd "ping6 -c 3 $ipv"
                        putlog "$ipv"
                      } else {
                        puthelp "privmsg $chan :$target geçerli ipv6 adresi değil..."
                      }
                }
            }
      }
     
      if {![string match "*.*" [lindex [split $text] 0]] && \
          [onchan [lindex [split $text] 0] $chan] && \
          [string match "*:*:*" [lindex [split [getchanhost [lindex [split $text] 0] $chan] "@"] 1]]} {
         
            set target [lindex [split [getchanhost [lindex [split $text] 0] $chan] "@"] 1]
        }
                 
            set i 0
    catch { eval exec $cmd } output
         
        foreach line [split $output "\n"] {
            puthelp "privmsg $chan :\00303$line\003"
            incr i
            }
    return 0
}

# http://is.gd/SVU9r1

proc throttled {id time} {
          global throttled 
      if {[info exists throttled($id)]} {
          return 1
        } {
          set throttled($id) [clock seconds]
          utimer $time [list unset throttled($id)]
          return 0
        }
 }

foreach bind [split $pcmds " "] {
    bind pub $pflags $ptrig$bind pingin_pub
}

foreach bind [split $p6cmd " "] {
    bind pub $pflags $ptrig$bind ping6_pub
}

setudef flag pinging

proc pingin_pub {nick uhost hand chan text} {
  if {![channel get $chan pinging]} { return }

          set user [lindex [split $uhost "@"] 1]
           
      if {[throttled $user,$chan $::pflud]} {
              puthelp "notice $nick :\002Flood algılandı !!!\002 - \
              \00314[expr {[clock seconds] - $::throttled($user,$chan)}] saniye sonra deneyin...\003"
              return
      }
 
          set target [lindex [split $text] 0]
   
  if {[llength $target] eq "0"} {
        puthelp "notice $nick :Kullanımı :\002$::lastbind \00304<\003 IP / host / nick \00304>\003\002"
          return 0
    }

  if {![string match "*.*" [lindex [split $text] 0]] && [onchan [lindex [split $text] 0] $chan]} {
            set target [lindex [split [getchanhost [lindex [split $text] 0] $chan] "@"] 1]
            putlog "$target"
    }
   
      set i 0
      set cmd "ping -c 3 $target"
     
    catch { eval exec $cmd } output
         
        foreach line [split $output "\n"] {
            regsub -all -- {^[0-9]+} $line {\00303^[0-9]+\003} line
            set line [string map {"PING" "\002PING\002" \( \002(\002 \) \002)\002} $line]
            puthelp "privmsg $chan :\00303$line\003"
            incr i
            }
    return 0
}

putlog "ok..."



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 13:17.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk