PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: pHaTTy on 12 October, 2003, 16:07:34

Title: ShowPasses Bot
Post by: pHaTTy on 12 October, 2003, 16:07:34
Show all passes if you are master with -allpass


--/Password bot by Phatty
--/24aug03


Bot = "Allpasswordsbot"

Baduser = "is trying to access the passwords"

function Main()
end


function DataArrival(user,data)
if( strfind( strlower(data), strlower("-allpass")) ) then
if not (user.iProfile==GetProfileIdx("Master")) then SendToAll(Bot, "Someone is trying to get the paswords, so i am disconnecting him/her")
user:Disconnect()
else
if (user.iProfile==GetProfileIdx("Master")) then ISMAS=1
if (ISMAS==1) then
readfrom("../registeredusers.dat")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
end
end
end


-phatty
Title:
Post by: Alexei on 19 October, 2003, 12:38:45
better idea -- get Mean_Machine

It has that option... :)
Title:
Post by: pHaTTy on 19 October, 2003, 17:39:28
Why use mean machine i have my own Gekko v4.06 ;)

will have a better one soon ;)
Title:
Post by: Alexei on 19 October, 2003, 18:04:57
Ahh...sorry...good point....

Never tried it thou...
Title:
Post by: [NL]trucker on 28 October, 2003, 23:44:20
why use a bot when you can get the passes out the hubsoft?

it shows you all the passes in the ops and bans tab.

i cant see the use for such a bot.

but thnx anyway phatty for the effort to try to make such a bot.
i wasn,t trying to put you down with my comment  so please dont take any offense to it.
Title:
Post by: SaintSinner on 29 October, 2003, 14:17:16
QuoteOriginally posted by [NL]trucker
why use a bot when you can get the passes out the hubsoft?

it shows you all the passes in the ops and bans tab.

i cant see the use for such a bot.

but thnx anyway phatty for the effort to try to make such a bot.
i wasn,t trying to put you down with my comment  so please dont take any offense to it.

becouse
.....you can have two masters(only one hubsoft) in the machine, so one of these masters may need access to the passwords
.....or the master has his hubsoft running in another location
......or its more convinient
.....or its just plain kewl
Title:
Post by: TiMeTrAVelleR on 29 October, 2003, 15:41:40
Somthing  strange   i just tryed this script
but
passes  where showen in main   and names in pm
only thing a changed is instaed off -allpass  i made !allpas  because i have all my commands   so

TiM? ?(
Title:
Post by: Twix on 29 October, 2003, 22:00:48
I noticed that too.
However, if you change the following line from:

user:SendPM(Bot,line)

to:

user:SendData(Bot,line)

it sends it all in main chat.

If this is the wrong way to do it, please let me know, i'm only just learning LUA  :)
Title:
Post by: pHaTTy on 29 October, 2003, 22:49:28
Hmm yep my mistake, yep i think senddata will work ok, i think yep :o)
Title:
Post by: pHaTTy on 29 October, 2003, 22:59:02
here a little better for now


--/Password bot by Phatty 0.2
--/29oct03


Bot = "Keiko"
Baduser = " is trying to access the passwords, so i am disconnecting him/her"

Command = "!allpass"

function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

if cmd == Command then
if (user.iProfile==GetProfileIdx("Master")) then
readfrom("../registeredusers.dat")
while 1 do
line = read()
if line == nil then break end
user:SendData(Bot,line)
end
readfrom()
end
else
SendToAll(Bot,user.sName..Baduser)
user:Disconnect()
end
end
end


l8rr,,

-phatty
Title:
Post by: [G-T-E]Gate? on 18 November, 2003, 09:34:12
Nice easy scipt but a little suggestion.
Agree on reason on why to have such a scipt but how about adding possibility for a SU to get the Passwords aswell as Master.
Would it be as easy as editing the following line >>
 if (user.iProfile==GetProfileIdx("Master")) then
to >>
 if (user.iProfile==GetProfileIdx("Master", "SU")) then
Appreciate all ur work..
 Thanks.
Title:
Post by: kepp on 18 November, 2003, 17:29:40
There's nothing called SU...
it means SuperOperator....
The Master :S
Title:
Post by: pHaTTy on 18 November, 2003, 17:32:10
yep kepp is right
Title:
Post by: NightLitch on 18 November, 2003, 19:55:20
understand your problem... And this is how your line should be:


if (user.iProfile==GetProfileIdx("Master") or user.iProfile==GetProfileIdx("SU")) then


/NL
Title:
Post by: NightLitch on 18 November, 2003, 20:16:00
Since this is for Password Bot...

This is my version:

Hope you don't mind pH?tt?...  :-)

*UPDATED*


--=*=*=*=*=*=*=*=*=*=*=*=--
--  Password Bot 0.2     --
-- By NightLitch 2003    --
--                       --
-- !getpass       --
--                       --
-- Bug Fix:              --
-- Change some things    --
-- So You can send msg   --
-- in Main and not get   --
-- ** You don't have the --
-- sufficient rights to  --
-- run this command...   --
--=*=*=*=*=*=*=*=*=*=*=*=--

BOTNAME = "-P-Bot-"
PREFIX = "*"

REGFILE = ("../RegisteredUsers.dat")
REGGEDUSERS = {}

function Main()
frmHub:RegBot(BOTNAME)
end

function DataArrival(curUser,data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local _,_,cmd = strfind( data, "%b<>%s+(%S+)" )
if (cmd == PREFIX.."getpass" ) then
if (curUser.iProfile==GetProfileIdx("Master")) then
ShowPasses(curUser,data)
return 1
else
curUser:SendData(BOTNAME,"*** You don't have the sufficient rights to run this command...")
return 1
end
end
end
end

function ShowPasses(curUser,data)
local _,_,cmd,nick = strfind( data, "%b<>%s+(%S+)%s+(%S+)" )
if (nick == nil or nick == "") then
curUser:SendData(BOTNAME,"Syntax: !getpass ")
return 1
end
if nick then
local ViewOne = ""
curUser:SendData(BOTNAME,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
LoadRegistredFile(REGGEDUSERS,REGFILE)
for sNICK,sPASS in REGGEDUSERS do
if strlower(nick) == strlower(sNICK) then
curUser:SendData(BOTNAME,"Nick:"..nick)
curUser:SendData(BOTNAME,"Password: "..sPASS)
ViewOne = 1
end
end
if ViewOne == "" then
curUser:SendData(BOTNAME,"Searching:\r\nNick:"..nick.."\r\nPassword: Not Found")
end
curUser:SendData(BOTNAME,"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
end
end

function LoadRegistredFile(table,file)
local handle = openfile(file, "r")
if (handle) then
    local line = read(handle)
    while line do
s,e,nick,password,status = strfind( line, "(%S+)|(%S+)|(%S+)")
table[nick] = password
line = read(handle)
    end
  closefile(handle)
end
end
-- By: NightLitch

Enjoy / NL
Title:
Post by: pHaTTy on 18 November, 2003, 22:33:12
Nope not at all NL

Very nice :)
Title:
Post by: [G-T-E]Gate? on 19 November, 2003, 00:44:34
First off Thanks for the addd on to the script , Appreciate it.
Second off, not to tick anyone off but there is a SU and SU+ in my world(They just have different rights) and ofcourse Master.
Su=SuperUser
Su+= explains itself

And lastly
Master= Best of em all but has to deal with more shit...

Tks again y'll
Title:
Post by: pHaTTy on 19 November, 2003, 02:44:16
haha noo if you look at gekko i also have super user

but what we mean is, there is no getprofileidx(SU)

sort of thin
Title: Password List of all members improved
Post by: StrangeOtto on 13 January, 2004, 05:44:45
I have improved the first Script that looked very strange.
I have added a translation of the level numbers and a tablelike layout. Here is an example of the list, below is the code  :D
[05:38] Registered Users at the HUB
[05:38]
[05:38]    ? Level ?? nick ?? password ?? Online or Offline ?
[05:38]    ? Networkfounder ?? Cool ?? uiuiuiui ?? Offline ?
[05:38]    ? Networkfounder ?? StrangeOtto ?? hehehe ?? Online ?
[05:38]    ? Reg ?? test ?? test ?? Offline ?
[05:38]    ? Newbie ?? Sushi ?? kkkkk ?? Offline ?
[05:38]    ? Admin ?? Strength ?? wwwwww ?? Online ?
[05:38]    ? User ?? test2 ?? test2 ?? Offline ?
[05:38]


Here the code
Quote--/Password bot by StrangeOtto
--/13jan04

botName = "Botname"
Baduser = " is trying to access the passwords, so i am disconnecting him/her"
Command = "!userlist"

function TexteLoad(file,array,text) array[0]="" local x=0
readfrom(file)
repeat if (text) then text=text..array
  • .."\r\n" end x=x+1 array
  • =read() until (array
  • ==nil)
readfrom() return text
end

function doAdmin(user)
                              user:SendData(botName,"Registered Users at the HUB")
            user:SendData(botName,"|")
            user:SendData(botName,"   ? Level ?? nick ?? password ?? Online or Offline ? |")
name,pass,level=nil,nil,nil
local temp={}
TexteLoad("../RegisteredUsers.dat",temp)
   for x=1,getn(temp) do s,e,name,pass,level=strfind(temp
  • ,"(.-)\124(.-)\124(.+)")
   showArray = { sName=name, sPass = pass, slevel = level}
if level=="7" then lvl="Networkfounder" end
if level=="6" then lvl="Admin" end
if level=="5" then lvl="Moderator" end
if level=="4" then lvl="Newbie" end
if level=="3" then lvl="Reg" end
if level=="2" then lvl="VIP" end
if level=="1" then lvl="Operator" end
if level=="0" then lvl="Master" end
         if GetItemByName(name) then
            user:SendData(botName,"   ? "..lvl.." ?? "..name.." ?? "..pass.." ?? Online ? |")
         else
            user:SendData(botName,"   ? "..lvl.." ?? "..name.." ?? "..pass.." ?? Offline ? |")
         end
   end
            user:SendData(botName,"|")
end

function DataArrival(user,data)
   if strsub(data, 1, 1) == "<" then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")

      if cmd == Command then
         if (user.iProfile==GetProfileIdx("NetWorkFounder") or user.iProfile==GetProfileIdx("Admin")) then
            doAdmin(user)
         end
      else
                        user:SendData(botName,"You do not have the rights to run this command, you are being disconnected.")
         user:Disconnect()
      end
return 1
   end
end
Title: Found a bug :(
Post by: StrangeOtto on 13 January, 2004, 15:38:57
found a bug in the last IF expression, disconnection on every command except the PW command, haha. so this is the correct one, working :D
Quote--/Password bot by StrangeOtto

--/13jan04

botName = "Botname"
Baduser = " is trying to access the passwords, so i am disconnecting him/her"
Command = "!userlist"

function TexteLoad(file,array,text) array[0]="" local x=0
readfrom(file)
repeat if (text) then text=text..array
  • .."\r\n" end x=x+1 array
  • =read() until (array
  • ==nil)
readfrom() return text
end

function doAdmin(user)
                              user:SendData(botName,"Registered Users at the HUB")
            user:SendData(botName,"|")
            user:SendData(botName,"   ? Level ?? nick ?? password ?? Online or Offline ? |")
name,pass,level=nil,nil,nil
local temp={}
TexteLoad("../RegisteredUsers.dat",temp)
   for x=1,getn(temp) do s,e,name,pass,level=strfind(temp
  • ,"(.-)\124(.-)\124(.+)")
   showArray = { sName=name, sPass = pass, slevel = level}
if level=="7" then lvl="Networkfounder" end
if level=="6" then lvl="Admin" end
if level=="5" then lvl="Moderator" end
if level=="4" then lvl="Newbie" end
if level=="3" then lvl="Reg" end
if level=="2" then lvl="VIP" end
if level=="1" then lvl="Operator" end
if level=="0" then lvl="Master" end
         if GetItemByName(name) then
            user:SendData(botName,"   ? "..lvl.." ?? "..name.." ?? "..pass.." ?? Online ? |")
         else
            user:SendData(botName,"   ? "..lvl.." ?? "..name.." ?? "..pass.." ?? Offline ? |")
         end
   end
            user:SendData(botName,"|")
end

function DataArrival(user,data)
   if strsub(data, 1, 1) == "<" then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")

      if cmd == Command then
         if (user.iProfile==GetProfileIdx("NetWorkFounder") or user.iProfile==GetProfileIdx("Admin")) then
            doAdmin(user)          
              else
                        user:SendData(botName,"You do not have the rights to run this command, you are being disconnected.")
         user:Disconnect()
                        end
      end
return 1
   end
end
Title:
Post by: NightLitch on 13 January, 2004, 16:33:43
QuoteOriginally posted by  (uk-kingdom)pH?tt?  
 
haha noo if you look at gekko i also have super user
but what we mean is, there is no getprofileidx(SU)
sort of thin
 

Feel I need to argue a little bit about this Phatty.. :-)

Sure you could have SU:

(curUser.iProfile==GetProfileIdx("SU"))    

IF you have added it in PtokaX Profile Manager... or Am I wrong about that ???

So I fully stand on your side [G-T-E]Gate?. :-)

Note: This is not for causing mean faces... just some facts...  

Smile and be happy... :-D