SIMPLE Online ip checker
 

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

SIMPLE Online ip checker

Started by Dessamator, 20 April, 2005, 23:10:12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dessamator

   
--By Dessamator
--SIMPLE Online ip finder, and server nick finder
bot=frmHub:GetHubBotName()

function ChatArrival(user, data)

data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")

local s,e,ip = string.find(data, "%b<>%s+%S+%s+(.+)")
	if cmd=="!findip" and user.bOperator then
		findip(user,ip,1)
		return 1
	elseif cmd=="!getserver" and user.bOperator then
		local hubip=frmHub:GetHubIp()
		findip(user,hubip,0)
		return 1	
	end
end	
ToArrival=ChatArrival

function findip(user,ip,i)
local check =""
	if i==1 and ip then 
		temp= "\r\n".."\t".."The ip: "..ip.." Belongs to :".."\r\n"
	else
		temp= "\r\n".."\t".."The Current server is: ".."\r\n"
	end
	if ip==nil or ip=="" then
		user:SendPM(bot,"Syntax error. Correct Syntax is : !findip ")
	else
		temp=temp.."\t".."??????????????????????".."\r\n"
		for _,nick in frmHub:GetOnlineUsers() do
			serverip=string.sub(nick.sIP,1,4)
			if nick.sIP==ip then
				temp=temp.."\t\t".."•"..nick.sName.."\r\n"
				check=check..nick.sName
			elseif i==0 and serverip=="127." then 
				temp=temp.."\t\t".."•"..nick.sName.."\r\n"
				check=check..nick.sName
			elseif (i==0) and not(nick.sIP==ip )  then
				temp="The person with the server isnt online!!"
			end
		end
		if check=="" then
			user:SendPM(bot,"The User with that ip isnt online")
		else
			user:SendPM(bot,temp)
			temp=nil
			serverip=""
			check=""
		end
	end
end


for those who love to ask what the script does, it simply searches for an ip, to c if its online and finds the nick, and reports it to the person, and it also finds the nick which the hubs server is using !!
Ignorance is Bliss.

Dessamator

#1
--By Dessamator
--SIMPLE Online/offline ip checker v2
bot=frmHub:GetHubBotName()

function ChatArrival(user, data)

data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")

local s,e,ip = string.find(data, "%b<>%s+%S+%s+(.+)")
	if  user.bOperator then
		if cmd=="!findip"  then
			findip(user,ip,1)
		return 1
		elseif cmd=="!getserver" then
			findip(user,"127.0.0.1",0)
		return 1	
		elseif cmd=="!findserver" then
			findip(user,findlocalip(),0)
		return 1
		end
	end
end	
ToArrival=ChatArrival

function findip(user,ip,i)
local check =""
	if i==1 and ip then 
		temp= "\r\n".."\t".."The ip: "..ip.." Belongs to :".."\r\n"
	else
		temp= "\r\n".."\t".."The Current server is: ".."\r\n"
	end
		temp=temp.."\t".."??????????????????????".."\r\n"
		for _,nick in frmHub:GetOnlineUsers() do
			if nick.sIP==ip and i==1 then
				temp=temp.."\t\t".."?"..nick.sName.."\r\n"
				check=check..nick.sIP
			elseif i==0 and nick.sIP==frmHub:GetHubIp() or nick.sIP==ip then 
				temp=temp.."\t\t".."?"..nick.sName.."\r\n"
				check=check..nick.sIP
			elseif i==0 and not(nick.sIP==ip )and check==nil then
				temp="The person with the server isnt online!! "
			end
		end
		if check=="" then
			user:SendPM(bot,"The User with that ip isnt online")
		elseif not(check=="") then 
			user:SendPM(bot,temp)
		end
			temp=""
			check=""
end

-- ping localhost to find ip --
function findlocalip()
os.execute("ping -n 1 localhost >localip.txt")
local stuff =""
	for line in io.lines("localip.txt") do
    	stuff = stuff..line.."\r\n"
	end
s,l =string.find(stuff,"%[")
e,f=string.find(stuff,"%]")
local hubip=(string.sub(stuff,s+1,e-1))
os.execute("del localip.txt")
return hubip 

end
Ignorance is Bliss.

Herodes

couldnt resist.. ;)
--By Dessamator
--SIMPLE Online/offline ip checker v2

bot=frmHub:GetHubBotName()

function ChatArrival(user, data)
	local data = string.sub(data,1, -2)
	local s,e,cmd,ip = string.find(data, "%b<>%s+(%S+)%s*(%S*)")
	if user.bOperator then
		if cmd=="!findip"  then
			findip(user,ip,1);
			return 1
		elseif cmd=="!getserver" then
			findip(user,"127.0.0.1",0);
			return 1	
		elseif cmd=="!findserver" then
			findip(user,findlocalip(),0)
			return 1
		end
	end
end	
ToArrival=ChatArrival

function findip(user,ip,i)

	local check, temp, hubip  = nil, "\r\n\tThe Current server is: \r\n", frmHub:GetHubIP()

	if ( (i==1) and ip ) then temp = "\r\n\tThe ip: "..ip.." Belongs to :\r\n" end;

	temp = temp.."\t??????????????????????\r\n"

	for _,nick in frmHub:GetOnlineUsers() do
		if i == 0 then
			if ( (nick.sIP == hub.ip ) or (nick.sIP == ip) )  then
				temp=temp.."\t\t".."?"..nick.sName.."\r\n"
			elseif not ( ( nick.sIP == ip ) or check ) then
				 temp="The person with the server isnt online!! "
			end
		elseif i == 1 end
			if user.sIP == ip then
			temp=temp.."\t\t".."?"..nick.sName.."\r\n"
			check = nick.sIP
		end
	end

	if not check then
		user:SendPM(bot,"The User with that ip isnt online")
	else
		user:SendPM(bot,temp)
	end
end

-- ping localhost to find ip --
function findlocalip()
	os.execute("ping -n 1 localhost >localip.txt")
	local hubip = nil
	for line in io.lines("localip.txt") do
		if string.find ( line , "%[") then
			s,e, hubip = string.find( line , "%[(%d+%.%d+%.%d+%.%d+)%]")
			break
		end
	end
	os.execute("del localip.txt")
	return hubip
end

Dessamator

arrrgh, ur code is cleaner than mine, curses,  ;) , but anyways thnx, it gave me a new perspective on how to do such things , :]
Ignorance is Bliss.

Dessamator

herodes, ur script had some syntax errors solved here, hmm nice use of string.find, still have quite a lot to learn about that, ;)

--By Dessamator
--SIMPLE Online/offline ip checker v2

bot=frmHub:GetHubBotName()

function ChatArrival(user, data)
	local data = string.sub(data,1, -2)
	local s,e,cmd,ip = string.find(data, "%b<>%s+(%S+)%s*(%S*)")
	if user.bOperator then
		if cmd=="!findip"  then
			findip(user,ip,1);
			return 1
		elseif cmd=="!getserver" then
			findip(user,"127.0.0.1",0);
			return 1	
		elseif cmd=="!findserver" then
			findip(user,findlocalip(),0)
			return 1
		end
	end
end	
ToArrival=ChatArrival

function findip(user,ip,i)

	local check, temp, hubip  = nil, "\r\n\tThe Current server is: \r\n", frmHub:GetHubIp()

	if ( (i==1) and ip ) then temp = "\r\n\tThe ip: "..ip.." Belongs to :\r\n" end;

	temp = temp.."\t??????????????????????\r\n"

	for _,nick in frmHub:GetOnlineUsers() do
		if i == 0 then
			if ( (nick.sIP == hubip ) or (nick.sIP == ip) )  then
				temp=temp.."\t\t".."?"..nick.sName.."\r\n"
				check = nick.sIP
			elseif not ( ( nick.sIP == ip ) or (check) ) then
				 temp="The person with the server isnt online!! "
			end
		elseif i == 1 then
			if nick.sIP == ip then
			temp=temp.."\t\t".."?"..nick.sName.."\r\n"
			check = nick.sIP
			end
		end
	end

	if not check then
		user:SendPM(bot,"The User with that ip isnt online")
	else
		user:SendPM(bot,temp)
	end
end

-- ping localhost to find ip --
function findlocalip()
	os.execute("ping -n 1 localhost >localip.txt")
	local hubip = nil
	for line in io.lines("localip.txt") do
		if string.find ( line , "%[") then
			s,e, hubip = string.find( line , "%[(%d+%.%d+%.%d+%.%d+)%]")
			break
		end
	end
	os.execute("del localip.txt")
	return hubip
end
Ignorance is Bliss.

CaSaNoVa

I want to know if an IP was in my hub.or is now on my hub.not only now,but even if is offline andi i was here.

Dessamator

QuoteOriginally posted by CaSaNoVa
I want to know if an IP was in my hub.or is now on my hub.not only now,but even if is offline andi i was here.

use userinfo database by Night litch, search the forum !
Ignorance is Bliss.

jiten

QuoteOriginally posted by CaSaNoVa
I want to know if an IP was in my hub.or is now on my hub.not only now,but even if is offline andi i was here.
Then, you'll need an IP Logger too. What do you think about it, Dessamator? :D

Cheers

Dessamator

QuoteOriginally posted by jiten
QuoteOriginally posted by CaSaNoVa
I want to know if an IP was in my hub.or is now on my hub.not only now,but even if is offline andi i was here.
Then, you'll need an IP Logger too. What do you think about it, Dessamator? :D

Cheers

hmm, yah sure, it really isnt that hard, i had already done something like that for robocop,  although it used robos logs, but then the script will change its name, its not simple any more, unless u do it first jiten, :)
Ignorance is Bliss.

SMF spam blocked by CleanTalk