IP BOT [Mutor]
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

IP BOT [Mutor]

Started by speedX, 05 October, 2006, 22:16:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

speedX

Quote
--IPLog 1.0e LUA 5.1
--
--by Mutor 7/3/05
--requested by bigfnpump
--
-- Logs user IP & Nick, get info by command
-- Provides right click menu
--
--   +Changes from 1.0 7/5/05
--      +Now retrieves IP from nick input as well as nick from IP input
--
--
--   +Changes from 1.0b 7/7/05
--      +Reply now sent in PM   -Request by CaSaNoVa
--
--   +Changes from 1.0c 7/9/05
--      -Removed 2 table loops
--
--   +Changes from 1.0d 9/2/05
--      +Send IP info to all users.   --Request by hell
--
--   +Changes 5/11/06
--      +Converted to LUA 5.1
--
--User Settings----------------------------------------------------------------------------------------------------------------
--
--//-- Botname pulled from the hub
Bot = frmHub:GetHubBotName()
Prefix = "+"         -- Command Prefix
IpCmd = "ip"         -- Get IP User Command
IpMenu = frmHub:GetHubName()   -- Menu name pulled form hub, uses hub name for menu
SubMenu0 ="IP Log"      -- Custom submenu
IPFile="IPLog.dat"
--//--Set your profiles here.
--profile_idx, Commands/Menus enabled [0=no 1=yes], "Profile Name"
IpProfiles = {
[-1] = {1,"Unregistered User"},
  • = {1,"Master"},
    [1] = {1,"Operator"},
    [2] = {1,"Vip"},
    [3] = {1,"Registered User"},
    [4] = {1,"Moderator"},
    [5] = {1,"NetFounder"},
    }
    --
    --End User Settings-------------------------------------------------------------------------------------------------------------

    function Main()
       if loadfile(IPFile) ~= nil then
          dofile(IPFile)
       else
          IPLog ={}
          Save_File(IPFile,IPLog,"IPLog")
       end
    end

    function OnExit()
    Save_File(IPFile,IPLog,"IPLog")
    end

    function NewUserConnected(user, data)
    local timein=os.date("%B %d %Y %X ")
    IPLog[user.sIP]={user.sName,timein}
    Save_File(IPFile,IPLog,"IPLog")
       if IpProfiles[user.iProfile][1] == 1 then
          Commands(user)
          user:SendData(Bot, IpProfiles[user.iProfile][2].."'s IP Log commands enabled. Right click hub tab or user list for command menu.")
       end
    end

    OpConnected = NewUserConnected

    function ChatArrival(user, data)
    local s,e,pre,cmd = string.find(data, "%b<>%s+(%p)(%S+)")
    local s,e,addy = string.find(data, "%s(%d+%.%d+%.%d+%.%d+)|$")
    local s,e,nick = string.find(data, "%s(%S+)|$")
       if IpProfiles[user.iProfile][1] == 1 then
             if pre and pre==Prefix then
                if (cmd==IpCmd) then
                   if nick and nick ~= addy then
                      local errmsg="\r\n\r\n\tThe user "..nick.." was not found in the log.\r\n"
                      for i,v in pairs(IPLog) do
                         if v[1]==nick then
                            local reply2="\r\n\r\n\tThe user "..v[1].." was last seen "..
                            "using the IP Address of "..i.." on "..v[2]..".\r\n\r\n"
                            SendToAll(reply2)
                            errmsg = nil
                            break
                         end
                      end
                      if errmsg ~= nil then
                         SendToAll(errmsg)
                      --return 1
                      end
                   end
                   if addy and IPLog[addy]==nil then
                      local errmsg="\r\n\r\n\tThe IP Address "..addy.." was not found in the log.\r\n"
                      SendToAll(errmsg)
                      --return 1
                   else
                      for i,v in pairs(IPLog) do
                         if i==addy then
                            local reply1="\r\n\r\n\tThe IP Address "..i.." was last used "..
                            "by "..v[1].." on "..v[2]..".\r\n\r\n"
                            SendToAll(reply1)
                            break
                         end
                      end
                      --return 1
                   end
                elseif (pre==Prefix) and (cmd==IpCmd) and not addy then
                      SendToAll("\r\n\r\n\tSyntax Error, Syntax = "..Prefix..IpCmd.." <IP or Nick>\r\n")
                --return 1
                end
             end
       end
    end

    function Commands(user)
       user:SendData("$UserCommand 255 7")   --clear the menu first
       user:SendData("$UserCommand 1 1 "..IpMenu.."\\"..SubMenu0.."\\IP Info $<%[mynick]> "..Prefix..IpCmd.." %[line:IP or Nick]&#124;|")
       user:SendData("$UserCommand 1 2 "..IpMenu.."\\"..SubMenu0.."\\IP From Nick $<%[mynick]> "..Prefix..IpCmd.." %[nick]&#124;|")
       user:SendData("$UserCommand 1 2 "..IpMenu.."\\"..SubMenu0.."\\Nick From IP$<%[mynick]> "..Prefix..IpCmd.." %[line:IP]&#124;|")
    end

    Save_Serialize = function(tTable, sTableName, hFile, sTab)
       sTab = sTab or "";
       hFile:write(sTab..sTableName.." = {\n" );
       for key, value in pairs(tTable) do
          local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
          if(type(value) == "table") then
             Save_Serialize(value, sKey, hFile, sTab.."\t");
          else
             local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
             hFile:write( sTab.."\t"..sKey.." = "..sValue);
          end
          hFile:write( ",\n");
       end
       hFile:write( sTab.."}");
    end

    Save_File = function(file,table , tablename )
       local hFile = io.open (file , "w")
       Save_Serialize(table, tablename, hFile);
       hFile:close()
    end
Hello Mutor.....could u plzz modify the above teh script in such a way tht the command comes b4 the result.....?? plzzz
Thanking You,

speedX

speedX

ya....i kno...i was searchin for tht thread......but didnt get it.......tht's y i had to post a new thread......
Thanking You,

speedX

speedX

plzz would u help me out mutor......
Thanking You,

speedX

bastya_elvtars

Quote from: Mutor on 05 October, 2006, 22:53:33
Well I wonder what happened to that thread....   hmmm

Perhaps it was created between the DB save and the crash of the old server, therefore it's lost.
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

Quote from: Mutor on 05 October, 2006, 23:43:48
That was my first thought, but the dates don't jive.

Oh well

I don't know. It is a miracle in itself that we did not have to start from scratch.
Everything could have been anything else and it would have just as much meaning.

speedX

hey could plzz use
Quote
coz its diff to copy tht script.....
Thanking You,

speedX

Herodes

Quote from: speedX on 06 October, 2006, 07:09:55
hey could plzz use   coz its diff to copy tht script.....
click on the 'quote' button on Mutor's post and grab the code from the post 'reply page' that you get after clicking,...

speedX

Hey thx for the tip Herodes......hey Mutor when a user type !getip <nick>  it shows tht the bot is giving the command is it possible for the nick to come instead of Bot name ??
Thanking You,

speedX

Psycho_Chihuahua

well that seems so easy to do and i'm sure if you have a good look at the script you would find out what to change yourself.


My guess would be to change this line:
SendToAll(Bot,msg)

to something like:
SendToAll(user,msg)
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

speedX

nope....not workin with tht change..
Thanking You,

speedX

SMF spam blocked by CleanTalk