PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Janhouse on 16 April, 2004, 13:43:43

Title: I am looking for !getpasswrd script
Post by: Janhouse on 16 April, 2004, 13:43:43
Can somebody give me script that shows passwords.
Is it posible to show passwords only for masters?
Title: Hope this helps......
Post by: Percyonline on 16 April, 2004, 14:24:49
Hope this is something like yr looking for, dug this out of my script archive has been run and it works... not an expert on scripts so if you need it re-fining for owners only ide ask someone who is comfortable with lua scripting..     :D  8)

-- simple standalone get-password-by-nick-bot by bonki 09/06/03

sBotName         = "Bot-name";
sGetPasswdPhrase = "!getpasswd";
sPasswdFile      = "../RegisteredUsers.dat";

function DataArrival(curUser, sData)
  local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");

  if(cmd == nil) then
    return 0; end

  cmd = strlower(cmd);

  if (cmd == sGetPasswdPhrase) then
    curUser:SendData(sData);

    if (curUser.bOperator) then
      if (strlen(args) > 0) then
        local sPasswd = GetPassword(args);
        if (sPasswd) then
          curUser:SendData(sBotName, args.."'s password is: '"..sPasswd.."'");
        else
          curUser:SendData(sBotName, "User "..args.." doesn't exist!");
        end
      else
        curUser:SendData(sBotName, "Syntax: "..sGetPasswdPhrase.." ");
      end
    else
      curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
    end
    return 1;
  end

  return 0;
end

function GetPassword(sFrom)
  local flPasswdFile = openfile(sPasswdFile, "r");
  local line         = "";

  sFrom = strlower(sFrom);

  if (flPasswdFile) then
    line = read(flPasswdFile);
    while (line) do
      _, _, sNick, sPasswd = strfind(line, "^(%S+)|(%S+)|");
      if (strlower(sNick) == sFrom) then
        return sPasswd;
      end
      line = read(flPasswdFile);
    end
    closefile(flPasswdFile);
  end

  return nil;
end
Title:
Post by: Janhouse on 16 April, 2004, 14:31:40
Can operator see those passwords. I hope  not.
Title: No expert
Post by: Percyonline on 16 April, 2004, 15:02:41
as i say im no expert on scripts, it is currently vis by ops,  im sure someone out there can help ya more than i can, think the bit that could need altering is the
 if (curUser.bOperator)  part at a guess, but dont have time to play with it and test it due to work.... hope it helps ya anyhow
Title:
Post by: nErBoS on 17 April, 2004, 01:30:34
Hi,

Only for masters...

-- simple standalone get-password-by-nick-bot by bonki 09/06/03

sBotName = "Bot-name";
sGetPasswdPhrase = "!getpasswd";
sPasswdFile = "../RegisteredUsers.dat";

function DataArrival(curUser, sData)
local _, _, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");

if(cmd == nil) then
return 0; end

cmd = strlower(cmd);

if (cmd == sGetPasswdPhrase) then
curUser:SendData(sData);

if (curUser.iProfile == 0) then
if (strlen(args) > 0) then
local sPasswd = GetPassword(args);
if (sPasswd) then
curUser:SendData(sBotName, args.."'s password is: '"..sPasswd.."'");
else
curUser:SendData(sBotName, "User "..args.." doesn't exist!");
end
else
curUser:SendData(sBotName, "Syntax: "..sGetPasswdPhrase.." ");
end
else
curUser:SendData(sBotName, "You don't have sufficient rights to run that command!");
end
return 1;
end

return 0;
end

function GetPassword(sFrom)
local flPasswdFile = openfile(sPasswdFile, "r");
local line = "";

sFrom = strlower(sFrom);

if (flPasswdFile) then
line = read(flPasswdFile);
while (line) do
_, _, sNick, sPasswd = strfind(line, "^(%S+)|(%S+)|");
if (strlower(sNick) == sFrom) then
return sPasswd;
end
line = read(flPasswdFile);
end
closefile(flPasswdFile);
end

return nil;
end

Best regards, nErBoS
Title:
Post by: Janhouse on 17 April, 2004, 11:10:24
Thank you nErBoS. You are the best!
Title:
Post by: [G-T-E]Gate? on 17 April, 2004, 11:17:03
Quick nErBoS...
Found This in my locker..

----------------------------------------------------------------------

--/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") or user.iProfile==GetProfileIdx("SU")) 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
----------------------------------------------------------------------