IP informer to OPs
 

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 informer to OPs

Started by catwo, 26 May, 2005, 22:02:52

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

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.

jiten

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?

catwo

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.

jiten

#3
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

catwo

Thank you very much jiten, i will test it now. :D

catwo

#5
Hmmmm loads ok no errors in script however, how do i use it?  Thanks in advance. ?(
Sorry i just found it, many thanks.

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

jiten

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

catwo

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.

jiten

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.

catwo

I try it now many thanks again jiten its much appreciated. :D

catwo

Works perfect, thanks for your time and efforts jiten much appreciated. :D

jiten

You're welcome :]

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

jiten

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?

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.

jiten

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:
[*] !command
[*] !command
and not both at the same time.
Hope you got it.

Best regards

catwo

#17
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.  ;)

jiten

First post updated with your request.

Cheers

catwo

PERFECT!, Thanks again jiten you are a star its much appreciated. :D

jiten

You're welcome :]

yoonohoo

#21
Can you make the rightclick invisible to certain users?
As it is the reg can see the command although it cannot use it.
Thanks

It might be simple for you but rocket science for me...

jiten

First post updated with that fix.

Cheers

yoonohoo

Thanks once again jiten

It might be simple for you but rocket science for me...

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 ??

SMF spam blocked by CleanTalk