Bot Login

By LucSatise on Jun 06, 2008

This is an Advanced Bot login script.

Instrucitons:

Copy into Bot Remotes (ALT+R)

Run the Load Commands (if doesn't work press CTRL + F1

Type: /msg Botname (command_symbol)login

Start having Fun =]

Features:
Ability to Change Nicks
Logs in 3 Different Files
Case Sensitive Password
Has a Log Channel
3 Different Ranks
Can Add new Users (Owners Only)
Can Delete Certain users (Owners Only)
Can Clear All Users (Will return bot to Factory Settings - Owners Only)

NOTE: Most of the Code is in 1 File.
Only the VERY LAST PART Is in a Different File (has ;;;;;;;;;;;)

EDIT: SERIOUS SECURITY FLAW FOUND FIXED THANKS TO CraigW

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;                                                    ;;;
;;;        Bot Login Scipt by Rayth/LucSatise          ;;;
;;;                                                    ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;====================
;Part 1
;====================
on *:TEXT:*:?:{
  if ($1 == %cmd $+ login) {
    if ($istok(%Ignore,$nick,32)) { notice $nick $l WTF??? IM IGNORING U!! $r | halt }
    if (!$readini(Staff.ini,$2,Password)) { notice $nick $l Error: User Not Found. Please contact an Owner $r | write LoginFails.txt $nick Tried to Login with a Username not in Database at at $asctime(HH:nntt) on $day $asctime(dd mmmm yyyy) | halt }
    if ($readini(Staff.ini,$2,Password)) {
      if ($3 === $readini(Staff.ini,$2,Password)) {
        if ($nick ison %MainChannel) {
          auser $readini(Staff.ini,$2,Rank) $nick
          if ($readini(Staff.ini,$2,Rank) == Owner) { mode %MainChannel +q $nick }
          if ($readini(Staff.ini,$2,Rank) == Admin) { mode %MainChannel +a $nick }
          if ($readini(Staff.ini,$2,Rank) == Op) { mode %MainChannel +o $nick }
          msg %MainChannel $l $nick Has Logged in as $2 $r
          write Logins.txt $nick Logged in as $2 at $asctime(HH:nntt) on $day $asctime(dd mmmm yyyy)
        }
        if ($nick !ison %MainChannel) {
          notice $nick $l You must be on %MainChannel to Login. $r 
          msg %MainChannel $l $nick Tried to Login with User $2 while Not in Channel $r
          write LoginFails.txt $nick Tried Logging in with $2 out of %MainChannel at $asctime(HH:nntt) on $day $asctime(dd mmmm yyyy)
          halt
        }
      }
      else { 
        notice $nick $l Incorrect Password. Please Try Again in 5 Minutes. $r
        msg %MainChannel $l $Nick Tried to Login with User $2 $+ , But got the Password Wrong. Ignoring for 5 Minutes $r
        set %Ignore $addtok(%Ignore,$nick,32)
        timerUnIgnore. $+ $nick 1 300 Unignore $nick
        write LoginFails.txt $nick Tried to Login as $2 and got Incorrect Password at $asctime(HH:nntt) on $day $asctime(dd mmmm yyyy)
      }
    }
  }
}
alias Unignore {
  set %Ignore $remtok(%Ignore,$1,32)
  msg %MainChannel $l $1 Is No Longer Being Ignored. $r
}
on op:QUIT:{
  ruser $nick
  msg %MainChannel $l $nick Logged out by Quit $r
  write LogoutLog.txt $nick logged out by Quit.
}
on admin:QUIT:{
  ruser $nick
  msg %MainChannel $l $nick Logged out by Quit $r
  write LogoutLog.txt $nick logged out by Quit.
}
on owner:QUIT:{
  ruser $nick
  msg %MainChannel $l $nick Logged out by Quit $r
  write LogoutLog.txt $nick logged out by Quit.
}
on op:PART:%MainChannel:{
  ruser $nick
  msg %MainChannel $l $nick Logged out by Quit $r
  write LogoutLog.txt $nick logged out by Quit.
  notice $nick $l You have been logged out. $r
}
on admin:PART:%MainChannel:{
  ruser $nick
  msg %MainChannel $l $nick Logged out by Part $r
  write LogoutLog.txt $nick logged out by Part.
  notice $nick $l You have been logged out. $r
}
on owner:PART:%MainChannel:{
  ruser $nick
  msg %MainChannel $l $nick Logged out by Part $r
  write LogoutLog.txt $nick logged out by Part.
  notice $nick $l You have been logged out. $r
}
on op:NICK:{
  ruser $nick
  auser op $newnick
  notice $newnick $l Your Name has Been Updated. $r
  write NickLogs.txt Op $nick has changed name to $newnick
}
on admin:NICK:{
  ruser $nick
  auser admin $newnick
  notice $newnick $l Your Name has Been Updated. $r
  write NickLogs.txt Admin $nick has changed name to $newnick
}
on owner:NICK:{
  ruser $nick
  auser Owner $newnick
  notice $newnick $l Your Name has Been Updated. $r
  write NickLogs.txt Owner $nick has changed name to $newnick
}
alias cF1 {
  set %MainChannel $$?="Enter Main Channel (include # eg: #Moo)"
  set %Owner $$?="Enter Owner Username:"
  set %Password $$?="Enter Owner Password" 
  set %MasterPass $$?="Enter Master Password"
  set %Cmd $$?="Enter Command Symbol (eg ! will make command !command)"
  writeini Staff.ini %Owner Password %Password
  writeini Staff.ini %Owner Rank Owner
  unset %Owner %Password
  echo $active $l Complete $r
}
alias l {
  return 12,1«0¤12»0
}
alias r {
  return 12,1«0¤12»
}
on *:LOAD:{
  if (!%MainChannel) || (!%Cmd) { cF1 }
}
on owner:TEXT:*:%MainChannel:{
  if ($1 == %Cmd $+ clearStaff) { 
    if ($2 === %MasterPass) { 
      remove Staff.ini
      msg %MainChannel $l Staff Erased... Please Go into Bot Window and Press CTRL + F1 $r
      unset %MainChannel %MasterPass %Cmd 
      Quit
    }
    else {
      notice $nick $l Incorrect Master Password $r
      msg %MainChannel $l $Nick tried to erase Staff File $r
    }
  }
  if ($1 == %Cmd $+ delStaff) {
    remini Staff.ini $2
    msg %MainChannel $l Deleted Staff Member $2 $r
  }
  if ($1 == %Cmd $+ addStaff) {
    if ($2) && ($3) {
      notice $2 $l You have been Given access to MegaBot as $3 $r
      notice $2 $l Please Type: /msg $me %cmd $+ register <username> <password> $r
      if ($3 == Op) { set %PendingOp $addtok(%PendingOp,$2,32) }
      if ($3 == Admin) { set %PendingAdmin $addtok(%PendingAdmin,$2,32) }
      if ($3 == Owner) { set %PendingOwner $addtok(%PendingOwner,$2,32) }
      msg %MainChannel $l Adding $2 to Staff as $3 $r
    }
    else { msg %MainChannel $l ERROR: %cmd $+ addStaff <name> <rank> $r }
  }
}

;==============================
;Part 2
;==============================
on *:TEXT:*:?:{
  if ($1 == %Cmd $+ register) { 
    if ($2 != $null) && ($3 != $null) {
      if (!$readini(Staff.ini,$2,Rank)) {
        writeini Staff.ini $2 Password $3
        if ($istok(%PendingOp,$nick,32)) { writeini Staff.ini $2 Rank Op }
        if ($istok(%PendingAdmin,$nick,32)) { writeini Staff.ini $2 Rank Admin | set %PendingAdmin $remtok(%PendingAdmin,$nick,32) }
        if ($istok(%PendingOwner,$nick,32)) { writeini Staff.ini $2 Rank Owner }
        notice $Nick $l You are now Registered. Login: /msg $me %cmd $+ login <username> <password> $r
        msg %MainChannel $l $nick Has registered with name $2 $r
      }
      else { notice $nick $L That Username is Already Taken! $r | halt }
    }
    else { notice $nick $l Incorrect Syntax: %cmd $+ register <username> <pass> $r }
  }

Comments

Sign in to comment.
AdrianF   -  Jul 16, 2008

List All Commands In Intro Please

 Respond  
LucSatise   -  Jun 08, 2008

I had to keep tweaking it before release as i wanted more and more stuff lol

 Respond  
AdrianF   -  Jun 07, 2008

kool

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.