| 
 | 
 
| 
 
MarcusRaven
 
 | 
 
| 
 MarcusRaven 
 | 
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. 
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,483  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2008 
Posts: 1,483  | 
Try use this 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
  }
}
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jan 2004 
Posts: 1,330  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jan 2004 
Posts: 1,330  | 
I think rather than a problem with the regex he hasn't added himself to the owner access level. //auser -a owner $address($me,5)  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2008 
Posts: 1,483  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2008 
Posts: 1,483  | 
I think rather than a problem with the regex he hasn't added himself to the owner access level. //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.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
MarcusRaven
 
 | 
 
| 
 MarcusRaven 
 | 
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,483  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2008 
Posts: 1,483  | 
Try adding your self to the users list. NOTE: Use this command on the BOT and not on your client. And then retry to use these commands.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Feb 2011 
Posts: 472  
Pan-dimensional mouse 
 | 
 
 
Pan-dimensional mouse 
Joined:  Feb 2011 
Posts: 472  | 
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,483  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2008 
Posts: 1,483  | 
IMPORTANT: Remove the older code and paste this one! 
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!  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
MarcusRaven
 
 | 
 
| 
 MarcusRaven 
 | 
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,330  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jan 2004 
Posts: 1,330  | 
$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 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
MarcusRaven
 
 | 
 
| 
 MarcusRaven 
 | 
$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.  
 
 |  
 
 | 
 
 
 |  
 
   |  
 
 |