Hi is it possible to have a script that on a command i.e. !IPWatch a message box pops up for you to enter a users IP then on enter another box pops up with reason. Then when the IP comes into the hub the script sends a message to OPs saying i.e. 192.168.1.1 Message = Disconnecting downloads without reason. Any help would be most appreciated as always, many thanks in advance.
QuoteOriginally posted by catwo
Hi is it possible to have a script that on a command i.e. !IPWatch a message box pops up for you to enter a users IP then on enter another box pops up with reason. Then when the IP comes into the hub the script sends a message to OPs saying i.e. 192.168.1.1 Message = Disconnecting downloads without reason. Any help would be most appreciated as always, many thanks in advance.
Do you mean a script that notifies all OPs when a certain IP logs in, and, at the same time, disconnects all its downloads?
Yes reference the IP logging in but with added message of why IP was being watched. i.e. User IP was watched because he/she disconnected other users downloads without reason. Sorry for my previous explanation and many thanks for quick reply.
Give this a try:
--/------------------------------------------------------------
-- IP Monitoring v1.0 by jiten (5/27/2005)
--/------------------------------------------------------------
sBot = frmHub:GetHubBotName()
wIP = {} IPFile = "IP.tbl"
Main = function()
if loadfile(IPFile) then dofile(IPFile) end
end
ChatArrival = function(sUser,sData)
local sData = string.sub(sData, 1, -2)
local s,e,cmd = string.find(sData,"%b<>%s+[%!%?%+%#](%S+)")
if cmd then
local tCmds = {
["online"] = function(sUser,sData)
local s,e,IP,reason = string.find(sData,"%b<>%s+%S+%s+(%S+)%s+(.*)")
if (IP == nil or reason == nil) then
sUser:SendData(sBot, "*** Syntax Error: Type !online ")
else
local _,_,a,b,c,d = string.find(IP,"(%d*).(%d*).(%d*).(%d*)")
if not (a == "" or b == "" or c == "" or d == "") then
if wIP[IP] == nil then
wIP[IP] = {} wIP[IP] = reason
sUser:SendData(sBot,IP.." is being sucessfuly monitored.") SaveToFile(IPFile,wIP,"wIP")
elseif wIP[IP] ~= nil then
sUser:SendData(sBot, "*** Error: "..IP.." is already being monitored.")
end
else
sUser:SendData(sBot, "*** Syntax Error: Type !online ")
end
end
end,
["ronline"] = function(sUser,sData)
local s,e,IP = string.find(sData,"%b<>%s+%S+%s+(%S+)")
local _,_,a,b,c,d = string.find(IP,"(%d*).(%d*).(%d*).(%d*)")
if (IP == nil) or (a == "" or b == "" or c == "" or d == "") then
sUser:SendData(sBot, "*** Syntax Error: Type !ronline ")
elseif wIP[IP] ~= nil then
wIP[IP] = nil
sUser:SendData(sBot,IP.." is no longer being monitored.") SaveToFile(IPFile,wIP,"wIP")
elseif wIP[IP] == nil then
sUser:SendData(sBot,"*** Error: "..IP.." isn't being monitored.")
end
end,
["sonline"] = function(sUser,sData)
if next(wIP) then
local msg = "\r\n\r\n".."\t??????????????????????????????????????????".."\r\n"
msg = msg.."\t\tMonitored IPs:\tReason:\r\n"
msg = msg.."\t??????????????????????????????????????????".."\r\n"
local i,v for i, v in wIP do msg = msg.."\t\t* "..i.."\t"..v.."\r\n" end
sUser:SendData(sBot,msg)
else
sUser:SendData(sBot,"*** Error: The IP monitoring list is empty.")
end
end,
}
if tCmds[cmd] and sUser.bOperator then return tCmds[cmd](sUser,sData),1 end
end
end
NewUserConnected = function(sUser,sData)
for i,v in wIP do
if i == sUser.sIP then SendPmToOps(frmHub:GetOpChatName(),os.date().." - "..sUser.sName.." is being monitored because: "..v)end
end
if sUser.bOperator then
sUser:SendData("$UserCommand 1 3 Online\\Monitor IP$<%[mynick]> !online %[line:IP] %[line:Reason]||")
sUser:SendData("$UserCommand 1 3 Online\\Remove IP$<%[mynick]> !ronline %[line:IP]||")
sUser:SendData("$UserCommand 1 3 Online\\Show IPs$<%[mynick]> !sonline||")
end
end
OpConnected = NewUserConnected
Serialize = function(tTable,sTableName,hFile,sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n");
for key,value in tTable do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
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
end
hFile:write(sTab.."}");
end
SaveToFile = function(file,table,tablename)
local hFile = io.open(file,"w+") Serialize(table,tablename,hFile); hFile:close()
end
Best regards,
jiten
Thank you very much jiten, i will test it now. :D
Hmmmm loads ok no errors in script however, how do i use it? Thanks in advance. ?(
Sorry i just found it, many thanks.
It works fine many thanks. Any chance of:
1. As well as the IP, it wil also display the users nick?
2. It could be added on the right click menu so that if a user in the userlist is selected on right mouse button menu, the users Nick and IP are automatically selected and then an input box pops up requesting the reason why the user is being watched?
Once again many thanks for the script and hope you can add the other 2 parts. :D
QuoteOriginally posted by catwo
It works fine many thanks. Any chance of:
1. As well as the IP, it wil also display the users nick?
2. It could be added on the right click menu so that if a user in the userlist is selected on right mouse button menu, the users Nick and IP are automatically selected and then an input box pops up requesting the reason why the user is being watched?
Once again many thanks for the script and hope you can add the other 2 parts. :D
First post updated with those requests ;)
Best regards
Hi jiten a lot better thanks for the prompt response again but it asks for IP input, it doesn't automatically get the users IP and Nick. Also when the user rejoins it displays IP and Nick but the reason doesn't display fully it only displays the word testing as follows:
05/27/05 18:14:34 - [XXX]nick (192.1.1.100) is being monitored because: testing
but i actually typed "testing new script nick". Once again thanks for your help.
QuoteOriginally posted by catwo
... it asks for IP input, it doesn't automatically get the users IP and Nick.
Well, the way the script is now, that's the only way.
For that to work, it would have to be based on user's nick and so, the script would need a "complete" rewrite. Something like: !online nick reason (and not IP). Is it really needed?
Also when the user rejoins it displays IP and Nick but the reason doesn't display fully
First post updated with that fix.
Best regards.
I try it now many thanks again jiten its much appreciated. :D
Works perfect, thanks for your time and efforts jiten much appreciated. :D
You're welcome :]
jiten, how about in between the IP input box and the Reason input box you could add a users nick input box? That would also be usefull. Many thanks. :D
QuoteOriginally posted by catwo
jiten, how about in between the IP input box and the Reason input box you could add a users nick input box? That would also be usefull. Many thanks. :D
Can you explain it better?
Something like "!online nick reason" also?
Sorry jiten, currently the script on selection of !online/MonitorIP pops up an input box for me to enter a users IP then when i enter the ip and select OK the Reason input box pops up so i can input the reason why the user is being watched. What i would like if possible is the following:
IP input box, Nick Input box, Reason Input box. I hope i have explained it ok. As always many thanks.
QuoteOriginally posted by catwo
Sorry jiten, currently the script on selection of !online/MonitorIP pops up an input box for me to enter a users IP then when i enter the ip and select OK the Reason input box pops up so i can input the reason why the user is being watched. What i would like if possible is the following:
IP input box, Nick Input box, Reason Input box. I hope i have explained it ok. As always many thanks.
So, you mean that it had to pop up IP, Nick and Reason at the same time? That's not possible with the current script. As I explained you some posts above this one, I'd have to rewrite it for that to work.
Just to mention, it had to be like:
and not both at the same time.
Hope you got it.
Best regards
Ok no problem many thanks for the script. :D
How about adding this:
Currently on Ionline/ShowIPs produces this:
??????????????????????????????????????????
Monitored IPs:
??????????????????????????????????????????
* 192.168.1.1
* 193.168.1.1
is it possible to also show reason like this?
??????????????????????????????????????????
Monitored IPs:
??????????????????????????????????????????
* 192.168.1.1 Slot locking
* 193.168.1.1 Incorrect hub/slot ratio
Thanks once again. ;)
First post updated with your request.
Cheers
PERFECT!, Thanks again jiten you are a star its much appreciated. :D
You're welcome :]
Can you make the rightclick invisible to certain users?
As it is the reg can see the command although it cannot use it.
Thanks
First post updated with that fix.
Cheers
Thanks once again jiten
The reason doesn't appear :
?????????????????????????????????????????
IPs surveill?es :
?????????????????????????????????????????
* 127.0.0.1
* 82.141.122.196
* 85.217.1.75
Anybody have this problem ??
QuoteOriginally posted by chettedeboeuf
The reason doesn't appear :
?????????????????????????????????????????
IPs surveill?es :
?????????????????????????????????????????
* 127.0.0.1
* 82.141.122.196
* 85.217.1.75
Anybody have this problem ??
Try copying the script all over again and see if that happens.
Cheers
I have tried this jiten, but nothing :
??????????????????????????????????????????
Monitored IPs:
??????????????????????????????????????????
* 82.141.122.196
* 127.0.0.1
* 85.217.1.75
* 80.181.189.211
It's the wonder of catwo of having reason
But nothing in my hub
Sorry for my poor english and thank you for your help
QuoteOriginally posted by chettedeboeuf
I have tried this jiten, but nothing :
Sorry, my bad. I had copied the first script and it didn't include those changes. Guess it's ok now. :D
You may try it now.
Cheers
Than you (Again !!!) jiten
--/------------------------------------------------------------
-- IP Monitoring v1.0 by jiten (5/27/2005)
-- Small personal edits by catwo (6/01/2005
--/------------------------------------------------------------
sBot = frmHub:GetHubBotName()
wIP = {} IPFile = "IP.tbl"
Main = function()
if loadfile(IPFile) then dofile(IPFile) end
end
ChatArrival = function(sUser,sData)
local sData = string.sub(sData, 1, -2)
local s,e,cmd = string.find(sData,"%b<>%s+[%!%?%+%#](%S+)")
if cmd then
local tCmds = {
["online"] = function(sUser,sData)
local s,e,IP,reason = string.find(sData,"%b<>%s+%S+%s+(%S+)%s+(.*)")
if (IP == nil or reason == nil) then
sUser:SendData(sBot, "*** Syntax Error: Type !online ")
else
local _,_,a,b,c,d = string.find(IP,"(%d*).(%d*).(%d*).(%d*)")
if not (a == "" or b == "" or c == "" or d == "") then
if wIP[IP] == nil then
wIP[IP] = {} wIP[IP] = reason
sUser:SendData(sBot,IP.." is being sucessfuly monitored.") SaveToFile(IPFile,wIP,"wIP")
elseif wIP[IP] ~= nil then
sUser:SendData(sBot, "*** Error: "..IP.." is already being monitored.")
end
else
sUser:SendData(sBot, "*** Syntax Error: Type !online ")
end
end
end,
["ronline"] = function(sUser,sData)
local s,e,IP = string.find(sData,"%b<>%s+%S+%s+(%S+)")
local _,_,a,b,c,d = string.find(IP,"(%d*).(%d*).(%d*).(%d*)")
if (IP == nil) or (a == "" or b == "" or c == "" or d == "") then
sUser:SendData(sBot, "*** Syntax Error: Type !ronline ")
elseif wIP[IP] ~= nil then
wIP[IP] = nil
sUser:SendData(sBot,IP.." is no longer being monitored.") SaveToFile(IPFile,wIP,"wIP")
elseif wIP[IP] == nil then
sUser:SendData(sBot,"*** Error: "..IP.." isn't being monitored.")
end
end,
["sonline"] = function(sUser,sData)
if next(wIP) then
local msg = "\r\n\r\n".."\????????????????????????????????????????????????????????????????????????????????????".."\r\n"
msg = msg.."\Monitored IP:\t\tReason:\r\n"
msg = msg.."\????????????????????????????????????????????????????????????????????????????????????".."\r\n"
local i,v for i, v in wIP do msg = msg.."* "..i.."\t\t"..v.."\r\n" end
sUser:SendData(sBot,msg)
else
sUser:SendData(sBot,"*** Error: The IP monitoring list is empty.")
end
end,
}
if tCmds[cmd] and sUser.bOperator then return tCmds[cmd](sUser,sData),1 end
end
end
NewUserConnected = function(sUser,sData)
for i,v in wIP do
if i == sUser.sIP then SendPmToOps(frmHub:GetOpChatName(),os.date().." - "..sUser.sName.." ("..i..") is being monitored because: "..v)end
end
if sUser.bOperator then
sUser:SendData("$UserCommand 1 3 Online\\Monitor IP$<%[mynick]> !online %[line:UsersIP] %[line:UsersNick/Reason/Date/OPsName]||")
sUser:SendData("$UserCommand 1 3 Online\\Remove IP$<%[mynick]> !ronline %[line:IP]||")
sUser:SendData("$UserCommand 1 3 Online\\Show IPs$<%[mynick]> !sonline||")
end
end
OpConnected = NewUserConnected
Serialize = function(tTable,sTableName,hFile,sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n");
for key,value in tTable do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
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
end
hFile:write(sTab.."}");
end
SaveToFile = function(file,table,tablename)
local hFile = io.open(file,"w+") Serialize(table,tablename,hFile); hFile:close()
end
This is what i have and it works perfect ALL CREDIT to jiten. My edit is just names on input boxes for OPs to all input the reason the same and left screen alignment.
With catwo's modif :
[08:45] Syntax D:\Program Files\Hub PtokaX\HUB 0.3.3.0 17.08\scripts\IP Monitoring.lua:98: unexpected symbol near `&'
QuoteOriginally posted by chettedeboeuf
With catwo's modif :
[08:45] Syntax D:\Program Files\Hub PtokaX\HUB 0.3.3.0 17.08\scripts\IP Monitoring.lua:98: unexpected symbol near `&'
Replace & quot;\ with " in lines 98 and 100 and the error should be gone.
Cheers
Hmmm how come i don't get that error then? Strange things these PCs! :D