Modification proxycheck
#1
Bonsoir,

Et oui c'est encore moi ...

Voici le TCL de base :

TCL
# open proxy checker for eggdrop
# (c) James Seward 2003/4
# version 1.0

# http://www.jamesoff.net/projects/eggdrop
# james@jamesoff.net

# Released under the GPL

## INSTRUCTIONS
###############################################################################

# This script will check the hosts of people joining channels against one or
# RBLs. Choose your RBLs wisely, some of them list DIALUP SPACE and that would
# be a bad thing to be matching your IRC users against :P
#
# Enable the 'proxycheck' flag for channels you want the script active on
# --> .chanset #somechannel +proxycheck
#
# Users who are +o, +v, or +f in your bot (local or global) won't be checked.
#
# Turn on console level d on the partyline to see some debug from the script
# --> .console +d (to enable)
# --> .console -d (to disable)

## CONFIG
###############################################################################

# space-separated list of RBLs to look in
set proxycheck_rbls { "cbl.abuseat.org" "opm.blitzed.org" "dnsbl.ahbl.org" }

# time in minutes to ban for
set proxycheck_bantime 15

# stop editing here unless you're TCL-proof

 
 
## CODE
###############################################################################

#add our channel flag
setudef flag proxycheck

#bind our events
bind join - *!*@* proxycheck_join

#swing your pants

# catch joins
proc proxycheck_join { nick host handle channel } {
  #check we're active
  if {![channel get $channel proxycheck]} {
    return 0
  }

  #don't apply to friends, voices, ops
  if {[matchattr $handle fov|fov $channel]} {
    return 0
  }

  #get the actual host
  regexp ".+@(.+)" $host matches newhost
  if [regexp {[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $newhost] {
    #it's a numeric host, skip the lookup
    proxycheck_check2 $newhost $newhost 1 $nick $newhost $channel
  } else {
    putloglev d * "proxycheck: doing dns lookup on $newhost to get IP"
    dnslookup $newhost proxycheck_check2 $nick $newhost $channel
  }
}

# first callback (runs RBL checks)
proc proxycheck_check2 { ip host status nick orighost channel } {
  global proxycheck_rbls
 
  if {$status} {
    putloglev d * "proxycheck: $host resolves to $ip"

    # reverse the IP
    regexp {([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})} $ip matches a b c d
    set newip "$d.$c.$b.$a"

    # look it up in the rbls
    foreach rbl $proxycheck_rbls {
      putloglev d * "proxycheck: looking up $newip.$rbl"
      dnslookup "$newip.$rbl" proxycheck_check3 $nick $host $channel $rbl
    }
  } else {
    putlog "proxycheck: Couldn't resolve $host. (No further action taken.)"
  }
}

# second callback (catches RBL results)
proc proxycheck_check3 { ip host status nick orighost channel rbl } {
  global proxycheck_bantime
 
  if {$status} {
    putlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
    newchanban $channel "*@$orighost" "proxychk" "proxycheck: $rbl" $proxycheck_bantime
  }
  #if we didn't get a host, they're not in RBL
}
 
putlog "proxycheck 1.0 by JamesOff loaded"



En fait ce que je souhaiterais faire, ( bien évidement, le bot est ircop ) c'est qu'il puisse détecter directement les host decrypter, étant donné que les hosts sur mon IRC sont crypté ...

TCL
bind raw - 320 whois:aa
 
proc whois:aa {from key arg} {
set ip [lindex $arg 5]
putserv "PRIVMSG $chan :host : $ip"
}



Le raw fonctionne et m'indique bien l'host décrypter.

néanmoins j'ai essayé de modifier comme ceci :

TCL
# open proxy checker for eggdrop
# (c) James Seward 2003/4
# version 1.0

# http://www.jamesoff.net/projects/eggdrop
# james@jamesoff.net

# Released under the GPL

## INSTRUCTIONS
###############################################################################

# This script will check the hosts of people joining channels against one or
# RBLs. Choose your RBLs wisely, some of them list DIALUP SPACE and that would
# be a bad thing to be matching your IRC users against :P
#
# Enable the 'proxycheck' flag for channels you want the script active on
# --> .chanset #somechannel +proxycheck
#
# Users who are +o, +v, or +f in your bot (local or global) won't be checked.
#
# Turn on console level d on the partyline to see some debug from the script
# --> .console +d (to enable)
# --> .console -d (to disable)

## CONFIG
###############################################################################

# space-separated list of RBLs to look in
set proxycheck_rbls { "cbl.abuseat.org" "opm.blitzed.org" "dnsbl.ahbl.org" }

# time in minutes to ban for
set proxycheck_bantime 15

# stop editing here unless you're TCL-proof

 
 
## CODE
###############################################################################

#add our channel flag
setudef flag proxycheck

#bind our events
bind join - *!*@* proxycheck_join
bind raw - 320 whois:aa

 
#swing your pants

# catch joins
 
proc proxycheck_join { nick host handle channel } {
proc whois:aa {from key arg} {
set ip [lindex $arg 5]
putserv "PRIVMSG #!accueil! :IP =>>>> $ip <<<<="

 
  #check we're active
  if {![channel get $channel proxycheck]} {
    return 0
  }

  #don't apply to friends, voices, ops
  if {[matchattr $handle fov|fov $channel]} {
    return 0
  }

  #get the actual host
  regexp ".+@(.+)" $host matches newhost
  if [regexp {[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $newhost] {
    #it's a numeric host, skip the lookup
    proxycheck_check2 $newhost $newhost 1 $nick $newhost $channel
  } else {
    putloglev d * "proxycheck: doing dns lookup on $newhost to get IP"
    dnslookup $newhost proxycheck_check2 $nick $newhost $channel
  }
}

# first callback (runs RBL checks)
proc proxycheck_check2 { ip host status nick orighost channel } {
  global proxycheck_rbls
 
  if {$status} {
    putloglev d * "proxycheck: $host resolves to $ip"
    # reverse the IP
    regexp {([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})} $ip matches a b c d
    set newip "$d.$c.$b.$a"

    # look it up in the rbls
    foreach rbl $proxycheck_rbls {
      putloglev d * "proxycheck: looking up $newip.$rbl"
      dnslookup "$newip.$rbl" proxycheck_check3 $nick $host $channel $rbl
    }
  } else {
       putlog "proxycheck: Couldn't resolve $host. (No further action taken.)"
  }
}

# second callback (catches RBL results)
proc proxycheck_check3 { ip host status nick orighost channel rbl } {
  global proxycheck_bantime
 
  if {$status} {
    putlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
    newchanban $channel "*@$orighost" "proxychk" "proxycheck: $rbl" $proxycheck_bantime
  }
  #if we didn't get a host, they're not in RBL
}
}
putlog "proxycheck 1.0 by JamesOff loaded"



Et ça ne fonctionne pas, je ne sais pas si c'est possible en TCL de pouvoir mettre deux proc ensemble ... car après le problème de variable non déclarée survienne.

Enfin dans le code c'était un test afin de pouvoir vérifier si le bot détecte bien les host décrypté mais j'arrive pas à y adapter dans ce code, pour qu'il puisse directement au join salon avoir l'host decrypter de l'user ... et vérifier au dnsbl.

j'ai également aussi tenté une méthode ou le bot whois l'user et obtient son host décrypter mais je n'ai toujours pas compris comment y adapter dedans.


Merci encore.
Répondre Avertir
#2
Bien sûr qu'on ne peut pas mettre une procédure dans une autre.
Il faut que ta procédure proxycheck_join lance un whois, et que ta procédure whois:aa effectue ce que faisait initialement proxycheck_join (en adaptant pour avoir les bonnes données)
Répondre
#3
CrazyCat a écrit :Bien sûr qu'on ne peut pas mettre une procédure dans une autre.

Techniquement on peut, ça permet par exemple de ne créer une proc qu'a certaines condition Wink

TCL
proc blabla {...} {
   if {coucou} {
      proc coucou {} {}
   }
}



Même si je ne m'en suis jamais servit, c'est tout à fait possible Wink
Répondre Avertir
#4
Oui, mais elle ne sera (à mon avis) pas accessible par un bind
Répondre
#5
Si, ta proc est définie dans ::, donc accessible dans le namespace global.
Répondre Avertir
#6
Bonjour,

Voici la modification :

TCL
# open proxy checker for eggdrop
# (c) James Seward 2003/4
# version 1.0

# http://www.jamesoff.net/projects/eggdrop
# james@jamesoff.net

# Released under the GPL

## INSTRUCTIONS
###############################################################################

# This script will check the hosts of people joining channels against one or
# RBLs. Choose your RBLs wisely, some of them list DIALUP SPACE and that would
# be a bad thing to be matching your IRC users against :P
#
# Enable the 'proxycheck' flag for channels you want the script active on
# --> .chanset #somechannel +proxycheck
#
# Users who are +o, +v, or +f in your bot (local or global) won't be checked.
#
# Turn on console level d on the partyline to see some debug from the script
# --> .console +d (to enable)
# --> .console -d (to disable)

## CONFIG
###############################################################################

# space-separated list of RBLs to look in
set proxycheck_rbls { "cbl.abuseat.org" "opm.blitzed.org" "dnsbl.ahbl.org" }

# time in minutes to ban for
set proxycheck_bantime 15

# stop editing here unless you're TCL-proof

 
 
## CODE
###############################################################################

#add our channel flag
setudef flag proxycheck

#bind our events
bind join - *!*@* whois:aa
bind raw - 320 whois:aa

 
#swing your pants

# catch joins
 
putserv "WHOIS $nick"
proc whois:aa {nick host handle channel arg} {
set ip [lindex $arg 5]
putserv "PRIVMSG #!accueil! :IP =>>>> $ip <<<<="

 
  #check we're active
  if {![channel get $channel proxycheck]} {
    return 0
  }

  #don't apply to friends, voices, ops
  if {[matchattr $handle fov|fov $channel]} {
    return 0
  }

  #get the actual host
  regexp ".+@(.+)" $host matches newhost
  if [regexp {[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $newhost] {
    #it's a numeric host, skip the lookup
    proxycheck_check2 $newhost $newhost 1 $nick $newhost $channel
  } else {
    putloglev d * "proxycheck: doing dns lookup on $newhost to get IP"
    dnslookup $newhost proxycheck_check2 $nick $newhost $channel
  }
}

# first callback (runs RBL checks)
proc proxycheck_check2 { ip host status nick orighost channel } {
  global proxycheck_rbls
 
  if {$status} {
    putloglev d * "proxycheck: $host resolves to $ip"
    # reverse the IP
    regexp {([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})} $ip matches a b c d
    set newip "$d.$c.$b.$a"

    # look it up in the rbls
    foreach rbl $proxycheck_rbls {
      putloglev d * "proxycheck: looking up $newip.$rbl"
      dnslookup "$newip.$rbl" proxycheck_check3 $nick $host $channel $rbl
    }
  } else {
       putlog "proxycheck: Couldn't resolve $host. (No further action taken.)"
  }
}

# second callback (catches RBL results)
proc proxycheck_check3 { ip host status nick orighost channel rbl } {
  global proxycheck_bantime
 
  if {$status} {
    putlog "proxycheck: got host $host = ip $ip from RBL $rbl ... banning"
    newchanban $channel "*@$orighost" "proxychk" "proxycheck: $rbl" $proxycheck_bantime
  }
  #if we didn't get a host, they're not in RBL
}
 
putlog "proxycheck 1.0 by JamesOff loaded"



Seulement je trouve pas comment faire => Tcl error [whois:aa]: wrong # args: should be "whois:aa nick host handle channel arg" <= avec cette erreur, je sais quelle vient de la proc après le whois, mais je comprend pas trop comment modifier ça pour mettre le raw dans la proc whois:aa.

Si vous avez une solution je suis preneur.

Merci.
Répondre Avertir
#7
Mais enfin !
Ta procédure whois:aa sert à la fois pour le join et pour le raw ???

Et ton putserv "WHOIS $nick" ne sera fait qu'une fois au lancement (ou rehash) ?

TCL
bind join - *!*@* whois:call
bind raw - 320 whois:aa
 
proc whois:call {nick uhost handle chan args } {
   putserv "WHOIS $nick"
}
proc whois:aa {from key text} {
   set args [split $text " "]
   ...
}


Et quand tu es dans la proc whois:aa, il faut aussi que tu récupères le nick et l'host, vu que tu ne sais plus à qui correspond le whois (donc en parsant $args)
Répondre


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté