This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

needs an upgrade :oops:

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

needs an upgrade :oops:

Post by RoKiTo »

Some improvement for this script. I leave the errors below. I hope some teacher helps.
⌠06:18:46 PM⌡ 「@admin」 .gline bandido
⌠06:18:48 PM⌡ 「@F」 admin - NO/Invalid IP pattern. USAGE: !gline 193.193.193.193
⌠06:19:14 PM⌡ 「@admin」 .gline 2806:10be:a:7699:e094:f36d:6b6c:7a23
⌠06:19:15 PM⌡ 「@F」 admin - NO/Invalid IP pattern. USAGE: !gline 193.193.193.193



Code: Select all

#### ++++ Author: MadaliN <madalinmen28@yahoo.com>
### +++ Website: www.Ascenture.ro
## +++ TCL Name: GLine
# +++ Version: 1.0
## ++++
# Commands:
#   !gline 45.432.12.1
#
# For the command to work you need to have VOICE or OP in the main channel
#

bind PUBM - * gline:main

set temp(trigger) {! . `}

proc gline:main {nick uhost hand chan arg} {
   global temp

   if {[string index $arg 0] in $temp(trigger)} {
      set temp(cmd) [string range $arg 1 end]
      set temp(cmd) [lindex [split $temp(cmd)] 0]
      set arg [join [lrange [split $arg] 1 end]]
   } elseif {[isbotnick [lindex [split $arg] 0]]} {
      set temp(cmd) [lindex [split $arg] 1]
      set arg [join [lrange [split $arg] 2 end]]
   } else { return 0 }

   if {[info commands command:$temp(cmd)] != ""} { command:$temp(cmd) $nick $uhost $hand $chan $arg }
}

proc command:gline {nick uhost hand chan arg} {
   global top temp

   if {[isvoice $nick $chan] || [isop $nick $chan]} {

      set ip [lindex [split $arg] 0]

      if {![regexp {^(?:(?:[01]?\d?\d|2[0-4]\d|25[0-5])(\.|$)){4}$} $ip]} { putserv "PRIVMSG $chan :\002$nick\002 -  NO/Invalid IP  USAGE: !gline 193.193.193.193"; return }

      set temp(gchan) $chan
      set temp(gnick) $nick

      putquick "GLINE *@$ip +0  :D" 
      bind raw - 280 gline:valid
      bind raw - 512 gline:invalid
   }
}

proc gline:valid {from cmd arg} {
   global temp

   set glineI [lindex [split $arg] 1]
   set glineT [lindex [split $arg] 4]
   set glineE [lindex [split $arg] 3]
   set glineR [join [lrange [split $arg] 7 end]]

   putserv "PRIVMSG $temp(gchan) :\002$temp(gnick)\002 - GLine para \00304$glineI\003 creado en \00312[clock format $glineE]\003 duracion \00303[duration [expr $glineT - $glineE]]\003 expira \00312[clock format $glineT]\003 segs \00303[duration [expr $glineT - [clock seconds]]]\003. Razon: \00306$glineR"

   catch {unbind RAW - 280 gline:valid}
   catch {unbind RAW - 512 gline:invalid}
}

proc gline:invalid {from cmd arg} {
   global temp

   putserv "PRIVMSG $temp(gchan) :\002$temp(gnick)\002 - No hay GLine para esa IP"

   catch {unbind RAW - 280 gline:valid}
   catch {unbind RAW - 512 gline:invalid}
}

putlog "++ Succesfully loaded: \00312GLine"
Last edited by RoKiTo on Mon Jun 26, 2023 10:22 pm, edited 1 time in total.
User avatar
CrazyCat
Revered One
Posts: 1240
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

You can change your regexp to add the IPv6 mask:

Code: Select all

(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
(this is the more complete so really heavy :))
If your network uses cloaked hosts, you can't gline by nick with this script as you need to /who the user to get his real IP.
s
simo
Revered One
Posts: 1081
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

depending on the ircd type and network and wether the bot is opered or not
you could use different raw numerics or just the nick and the ircd will retreive the ip of the nick (if nick is still connected to the network that is) but im not sure what you are trying to do or achieve perhaps you could elaborate.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I mentioned the IP package (comes with TCLlib) before (link), that offers some tools to validate IP v4 or v6.
Once the game is over, the king and the pawn go back in the same box.
User avatar
CrazyCat
Revered One
Posts: 1240
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

caesar wrote:I mentioned the IP package (comes with TCLlib) before (link), that offers some tools to validate IP v4 or v6.
Right.
Reinvent the wheel is not a good way :)
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

Post by RoKiTo »

Thank you for your help, teacher.. but you could teach me how to place that code since I have put it according to substituting the other one but I could not. I hope you help me in this, thank you very much for your infinite patience.
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

Post by RoKiTo »

according to I have added that part of "package require ip"

but I couldn't boot or get it to recognize. Debian has it installed in its libraries. Would you be kind enough to help me place it in the gline.tcl code and see what my mistake was. Thank you very much for your help and this help will be useful to others.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Open a shell on the Debian server and then type tclsh, and then package require ip and reply back with what it says.

I have Debian 11:

Code: Select all

cezar@ax41:~$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
and works:

Code: Select all

cezar@ax41:~$ tclsh
% package require ip
1.4
If this fails, you can download that ip.tcl and load it before other scrips and should work.
Once the game is over, the king and the pawn go back in the same box.
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

Post by RoKiTo »

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
debian@vps-593ab049:~$ tclsh
% package require ip
1.4
%
I have followed the rules that you have set me and it remains the same

there is a change, it no longer gives me that unknown error, but it does not execute the gline or the simplest

Code: Select all

⌠06:04:47 PM⌡ 「admin」 !gline 2806:10be:a:65cf:1d25:6a54:1326:8b23
⌠06:05:07 PM⌡ 「admin」 !gline 2806:10be:a:65cf:1d25:6a54:1326:8b23
⌠06:05:09 PM⌡ 「admin」 !gline 2806:10be:a:65cf:1d25:6a54:1326:8b23
⌠06:05:12 PM⌡ 「admin」 !gline 2806:10be:a:65cf:1d25:6a54:1326:8b23
User avatar
CrazyCat
Revered One
Posts: 1240
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Try this:

Code: Select all

#### ++++ Author: MadaliN <madalinmen28@yahoo.com>
### +++ Website: www.Ascenture.ro
## +++ TCL Name: GLine
# +++ Version: 1.0
## ++++
# Commands:
#   !gline 45.432.12.1
#
# For the command to work you need to have VOICE or OP in the main channel
#

package require ip

bind PUBM - * gline:main

set temp(trigger) {! . `}

proc gline:main {nick uhost hand chan arg} {
   global temp

   if {[string index $arg 0] in $temp(trigger)} {
      set temp(cmd) [string range $arg 1 end]
      set temp(cmd) [lindex [split $temp(cmd)] 0]
      set arg [join [lrange [split $arg] 1 end]]
   } elseif {[isbotnick [lindex [split $arg] 0]]} {
      set temp(cmd) [lindex [split $arg] 1]
      set arg [join [lrange [split $arg] 2 end]]
   } else { return 0 }

   if {[info commands command:$temp(cmd)] != ""} { command:$temp(cmd) $nick $uhost $hand $chan $arg }
}

proc command:gline {nick uhost hand chan arg} {
   global top temp

   if {[isvoice $nick $chan] || [isop $nick $chan]} {

      set ip [lindex [split $arg] 0]

      if {[::ip::version $ip] == -1} { putserv "PRIVMSG $chan :\002$nick\002 -  NO/Invalid IP  USAGE: !gline 193.193.193.193"; return }

      set temp(gchan) $chan
      set temp(gnick) $nick

      putquick "GLINE *@$ip +0  :D"
      bind raw - 280 gline:valid
      bind raw - 512 gline:invalid
   }
}

proc gline:valid {from cmd arg} {
   global temp

   set glineI [lindex [split $arg] 1]
   set glineT [lindex [split $arg] 4]
   set glineE [lindex [split $arg] 3]
   set glineR [join [lrange [split $arg] 7 end]]

   putserv "PRIVMSG $temp(gchan) :\002$temp(gnick)\002 - GLine para \00304$glineI\003 creado en \00312[clock format $glineE]\003 duracion \00303[duration [expr $glineT - $glineE]]\003 expira \00312[clock format $glineT]\003 segs \00303[duration [expr $glineT - [clock seconds]]]\003. Razon: \00306$glineR"

   catch {unbind RAW - 280 gline:valid}
   catch {unbind RAW - 512 gline:invalid}
}

proc gline:invalid {from cmd arg} {
   global temp

   putserv "PRIVMSG $temp(gchan) :\002$temp(gnick)\002 - No hay GLine para esa IP"

   catch {unbind RAW - 280 gline:valid}
   catch {unbind RAW - 512 gline:invalid}
}

putlog "++ Succesfully loaded: \00312GLine"
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

Post by RoKiTo »

I hope I don't abuse your time, but it would be great if you give me a fragment of how I would place the regex in the event that in another vps I don't add the TCL IP. Thanks for your time.
User avatar
CrazyCat
Revered One
Posts: 1240
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Rather than have two versions of the script, copy the /usr/share/tcltk/tcllib1.20/dns/ip.tcl file from your host having the package to your other VPS and load the file before loading the script.

But ip exists in tcllib since version 8.2 (august 1999), can you check your version (do package require Tcl (capital T is important))
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

Post by RoKiTo »

Code: Select all

#
# $Id: ip.tcl,v 1.12 2007/08/20 20:03:04 andreas_kupries Exp $

# @mdgen EXCLUDE: ipMoreC.tcl

package require Tcl 8.2;                # tcl minimum version
but for me it would be to see how they put each code in the right place since that's how I learn and not ask weird questions XD, and yes I feel like a newbie but what else can I ask at the moment. I hope you understand me and help.
User avatar
CrazyCat
Revered One
Posts: 1240
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I don't understand you and don't really care about the answer.
I just told you tp do in shell console:

Code: Select all

# tclsh
package require Tcl
And put here the result of the command.
R
RoKiTo
Voice
Posts: 17
Joined: Thu Jul 22, 2021 3:07 pm

Post by RoKiTo »

Code: Select all

root@viral:/usr/share/tcltk# cat /usr/share/tcltk/tcllib1.20/dns/ip.tcl
*sniped*
root@viral:/usr/share/tcltk#
Post Reply