mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2014
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Sep 2014
Posts: 5
I'm trying to make a quote system work, and the only commands that don't are the !delquote # and !clearquotes commands. Everything else appears to be working as expected. Any ideas as to why? I copied this code from a friend and plugged my channel into it.

Code:
on *:LOAD:{ guser owner $$?"Enter the bot's owner" }
on $*:TEXT:/^[!](quote?)/Si:#marcusraven86:{
  if ((%floodjquote) || ($($+(%,floodjquote.,$nick),2))) { return }
  set -u120 %floodjquote On
  set -u120 %floodjquote. $+ $nick On
  if ($2) {
    if ($2 !isnum) { msg $chan /me > $+ $2 isn't a number. | halt }
    if ($2 isnum) {
      if ($read(Quotes.txt,$2)) {
        msg $chan /me > Quote #$2 - $read(Quotes.txt,$2)
      }
      else {
        msg $chan /me > No quote on line $2 $+
      }
    }
  }
  else {
    var %x $rand(1,$lines(Quotes.txt))
    msg $chan /me > Quote #( $+ %x $+ ) - $read(Quotes.txt,%x)
  }
}
on $*:TEXT:/^[!](t(otal)?quotes)$/Si:#marcusraven86:{ msg $chan /me > Total Quotes: $lines(Quotes.txt) }
on $*:TEXT:/^[!](s(earch)?quotes)/Si:#marcusraven86:{
  if (!$2) {
    msg $chan /me > Enter a search term!
  }
  else {
    msg $chan /me > Searching through quotes for $2 $+ ...
    var %search
    var %x 1
    while ($read(Quotes.txt,%x)) {
      if ($2 isin $read(Quotes.txt,%x)) { var %search $addtok(%search,%x,32) }
      inc %x
    }
    if (!%search) { .timer 1 2 msg $chan /me > No quotes found matchng $2 $+  }
    else { .timer 1 2 msg $chan /me > Found quotes matching $2 $+ : %search }
  }
}
on $*:TEXT:/^[!](l(ast)?quote)$/Si:#marcusraven86:{ msg $chan /me > Last Quote( $+ $lines(Quotes.txt) $+ ): $read(Quotes.txt,$lines(Quotes.txt)) }
on $*:TEXT:/^[!](a(dd)?quote)/Si:#marcusraven86:{
  if (!$2) { msg $iif($chan,$chan,$nick) /me > Enter a quote to add! }
  else {
    if ($nick isop #) {
      write Quotes.txt $2-
      msg $iif($chan,$chan,$nick) /me > Added quote - $2- $+
    }
  }
}
on $owner:TEXT:/^[!](d(el)?quote)/Si:#marcusraven86:{
  if (!$2) { msg $iif($chan,$chan,$nick) Enter a quote number to delete! }
  else {
    if ($2 isnum) {
      msg $iif($chan,$chan,$nick) /me > Deleted $2 from quotes.
      write -dl $+ $2 Quotes.txt
    }
    else { msg $nick /me > $2 is not a number }
  }
}
 
on $owner:TEXT:/^[!](c(lear)?quotes$/Si:#marcusraven86:{
  msg $iif($chan,$chan,$nick) /me > Cleared all $lines(Quotes.txt) quotes.
  write -c Quotes.txt
}

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try use this code:

Code:
on *:LOAD: { guser owner $$?"Enter the bot's owner" }
on $*:TEXT:/^[!](quote?)/Si:#marcusraven86:{
  if ((%floodjquote) || ($($+(%,floodjquote.,$nick),2))) { return }
  set -u120 %floodjquote On
  set -u120 %floodjquote. $+ $nick On
  if ($2) {
    if ($2 !isnum) { msg $chan /me > $+ $2 isn't a number. | halt }
    if ($2 isnum) {
      if ($read(Quotes.txt,$2)) {
        msg $chan /me > Quote #$2 - $read(Quotes.txt,$2)
      }
      else {
        msg $chan /me > No quote on line $2 $+
      }
    }
  }
  else {
    var %x $rand(1,$lines(Quotes.txt))
    msg $chan /me > Quote #( $+ %x $+ ) - $read(Quotes.txt,%x)
  }
}
on $*:TEXT:/^[!](t(otal)?quotes)$/Si:#marcusraven86:{ msg $chan /me > Total Quotes: $lines(Quotes.txt) }
on $*:TEXT:/^[!](s(earch)?quotes)/Si:#marcusraven86:{
  if (!$2) {
    msg $chan /me > Enter a search term!
  }
  else {
    msg $chan /me > Searching through quotes for $2 $+ ...
    var %search
    var %x 1
    while ($read(Quotes.txt,%x)) {
      if ($2 isin $read(Quotes.txt,%x)) { var %search $addtok(%search,%x,32) }
      inc %x
    }
    if (!%search) { .timer 1 2 msg $chan /me > No quotes found matchng $2 $+  }
    else { .timer 1 2 msg $chan /me > Found quotes matching $2 $+ : %search }
  }
}
on $*:TEXT:/^[!](l(ast)?quote)$/Si:#marcusraven86:{ msg $chan /me > Last Quote( $+ $lines(Quotes.txt) $+ ): $read(Quotes.txt,$lines(Quotes.txt)) }
on $*:TEXT:/^[!](a(dd)?quote)/Si:#marcusraven86:{
  if (!$2) { msg $iif($chan,$chan,$nick) /me > Enter a quote to add! }
  else {
    if ($nick isop #) {
      write Quotes.txt $2-
      msg $iif($chan,$chan,$nick) /me > Added quote - $2- $+
    }
  }
}

on owner:TEXT:!*:#marcusraven86: {
  if ($1 == !delquote) {
    if (!$2) { msg $chan Enter a quote number to delete! | return }
    if ($2 !isnum) { msg $chan /me > $2 is not a number! | return }
    if (!$read(quotes.txt),$2) { msg $chan /me > $2 quote cannot be found! | return }
    msg $chan /me > Deleted $2 from quotes.
    write -dl $+ $2 Quotes.txt
  }
  if ($1 == !clearquote) {
    if (!$lines(quotes.txt)) { msg $chan /me > Quotes are currently empty! | return }
    msg $chan /me > Cleared all $lines(Quotes.txt) quotes.
    write -c Quotes.txt
  }
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I think rather than a problem with the regex he hasn't added himself to the owner access level.

Code:
//auser -a owner $address($me,5)

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: Loki12583
I think rather than a problem with the regex he hasn't added himself to the owner access level.

Code:
//auser -a owner $address($me,5)


I used the command but before used /guser owner westor but the command does not worked that's the way that i change the regex.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Sep 2014
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Sep 2014
Posts: 5
So I plugged in the changes, and they still aren't working. I type in !delquote without a number and the message doesn't show up. I do it with a number and nothing happens. Same for !clearquote. It is JUST those two commands. Everything else works just as expected. >.<

I really do appreciate the help. I kind of understand this code, so explaining things out may be beneficial. I click the checkmark to examine the code and no errors pop up.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try adding your self to the users list.

Code:
//auser -a owner $me


NOTE: Use this command on the BOT and not on your client.

And then retry to use these commands.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Feb 2011
Posts: 451
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 451
DO NOT USE THIS SCRIPT. The script can be used to take control of your computer/channel. Use another quote script.

This script use to exist on hawkee at http://hawkee.com/snippet/8225/. I finally got around to messaging an admin to remove it, so hopefully that should be enough validation for you to not run it.

https://web.archive.org/web/http://hawkee.com/snippet/8225/

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
IMPORTANT: Remove the older code and paste this one!

Code:
on *:LOAD: { guser owner $$?"Enter the bot's owner" }
on $*:TEXT:/^[!](quote?)/Si:#marcusraven86:{
  if ((%floodjquote) || ($($+(%,floodjquote.,$nick),2))) { return }
  set -u120 %floodjquote On
  set -u120 %floodjquote. $+ $nick On
  if ($2) {
    if ($2 !isnum) { msg $chan /me > $+ $2 isn't a number. | halt }
    if ($2 isnum) {
      if ($read(Quotes.txt,n,$2)) {
        msg $chan /me > Quote #$2 - $read(Quotes.txt,n,$2)
      }
      else {
        msg $chan /me > No quote on line $2 $+
      }
    }
  }
  else {
    var %x $rand(1,$lines(Quotes.txt))
    msg $chan /me > Quote #( $+ %x $+ ) - $read(Quotes.txt,n,%x)
  }
}
on $*:TEXT:/^[!](t(otal)?quotes)$/Si:#marcusraven86:{ msg $chan /me > Total Quotes: $lines(Quotes.txt) }
on $*:TEXT:/^[!](s(earch)?quotes)/Si:#marcusraven86:{
  if (!$2) {
    msg $chan /me > Enter a search term!
  }
  else {
    msg $chan /me > Searching through quotes for $2 $+ ...
    var %search
    var %x 1
    while ($read(Quotes.txt,n,%x)) {
      if ($2 isin $read(Quotes.txt,n,%x)) { var %search $addtok(%search,%x,32) }
      inc %x
    }
    if (!%search) { msg $chan /me > No quotes found matchng $2 $+  }
    else { msg $chan /me > Found quotes matching $2 $+ : %search }
  }
}
on $*:TEXT:/^[!](l(ast)?quote)$/Si:#marcusraven86:{ msg $chan /me > Last Quote( $+ $lines(Quotes.txt) $+ ): $read(Quotes.txt,n,$lines(Quotes.txt)) }
on $*:TEXT:/^[!](a(dd)?quote)/Si:#marcusraven86:{
  if (!$2) { msg $iif($chan,$chan,$nick) /me > Enter a quote to add! }
  else {
    if ($nick isop #) {
      write Quotes.txt $2-
      msg $iif($chan,$chan,$nick) /me > Added quote - $2- $+
    }
  }
}

on owner:TEXT:!*:#marcusraven86: {
  if ($1 == !delquote) {
    if (!$2) { msg $chan Enter a quote number to delete! | return }
    if ($2 !isnum) { msg $chan /me > $2 is not a number! | return }
    if (!$read(quotes.txt),$2) { msg $chan /me > $2 quote cannot be found! | return }
    msg $chan /me > Deleted $2 from quotes.
    write -dl $+ $2 Quotes.txt
  }
  if ($1 == !clearquote) {
    if (!$lines(quotes.txt)) { msg $chan /me > Quotes are currently empty! | return }
    msg $chan /me > Cleared all $lines(Quotes.txt) quotes.
    write -c Quotes.txt
  }
}


- Thanks!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Sep 2014
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Sep 2014
Posts: 5
Originally Posted By: KindOne
DO NOT USE THIS SCRIPT. The script can be used to take control of your computer/channel. Use another quote script.

This script use to exist on hawkee at http://hawkee.com/snippet/8225/. I finally got around to messaging an admin to remove it, so hopefully that should be enough validation for you to not run it.

https://web.archive.org/web/http://hawkee.com/snippet/8225/


How exactly can this one get hijacked? You have me curious, but I'd like to know what parts are vulnerable and how.

Last edited by MarcusRaven; 15/09/14 03:15 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$read and /timer were used in the original script and both evaluate their contents. If the events were defined with a wildcard channel match instead of static text $chan would also need to be sanitized when passed to the timer.

http://en.wikichip.org/wiki/mirc/msl_injection

Joined: Sep 2014
Posts: 5
M
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Sep 2014
Posts: 5
Originally Posted By: Loki12583
$read and /timer were used in the original script and both evaluate their contents. If the events were defined with a wildcard channel match instead of static text $chan would also need to be sanitized when passed to the timer.

http://en.wikichip.org/wiki/mirc/msl_injection


So, recommendations on a quote system that works in a similar fashion that's safer to use? I would also be interested in Google Doc integration if that's possible, but if not, I'll just update things manually.


Link Copied to Clipboard