PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: nEgativE on 05 February, 2004, 17:21:18

Title: User ISP / Country, check..
Post by: nEgativE on 05 February, 2004, 17:21:18
Hi all..

didn't search well the forum.. i'm looking 4 a script that tell a user what ISP other user is.. (ip and hostname), something like:

--> [PT]user1: !isp
user2
--> [ISP-BOT]:
user2 is from (Brazil)  with IP/ISP: 200.*.net.br

"Brazil" could be (i think) that function (country/hostname) that is on new UserInfo script by Patthy..

Hope it's possible this script, i really need this, i have a lot users with traffic limits, and this could help to identify some country users, etc.

TkS all.
Title:
Post by: Yokozuna on 05 February, 2004, 17:30:41
Hi,

if I were you, i would implement a complete whois-query in my hubscript, that can be used by OPs only.
Normaly there is no need for normal users to know the IP from another user


Yokozuna
Title:
Post by: nEgativE on 05 February, 2004, 17:45:03
QuoteOriginally posted by Yokozuna
Hi,

if I were you, i would implement a complete whois-query in my hubscript, that can be used by OPs only.
Normaly there is no need for normal users to know the IP from another user


Yokozuna

yes, it could be just:

--> [ISP-BOT]:
user2 is from (Brazil), so.. international traffic to you !

this "so.. international/national traffic to you" only if was possible also identify the user that request the info, heh.

something like that.. who knows (i don't) =)

sorry the english !! TkS.
Title:
Post by: Yokozuna on 05 February, 2004, 19:06:31
Hi again,

made same quick tests with the tohostname function.
It works, BUT

most of my "hubbies" have .net and .com as hostname ending ---> not possible to tell country.


I will post a script for you tommorow (sorry, no time right now) if it is still wanted.


Yokozuna
Title:
Post by: Yokozuna on 06 February, 2004, 15:20:39
Here it is:

BOTNAME = "Trafficinfo"
PREFIX = "+"

function Main()
frmHub:RegBot(BOTNAME)
end

function DataArrival(user,data)
if (strsub(data,1,strlen(BOTNAME)+5) == "$To: "..BOTNAME) then
if strfind(data,PREFIX.."trafficto") then
_,_,_,userto = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
userto = strsub(userto,1,strlen(userto) - 1)
user2 = GetItemByName(userto)
hostname1 = tohostname(user.sIP)
hostname2 = tohostname(user2.sIP)
end
if hostname1 then
temp1 = strsub(hostname1,(strlen(hostname1)-4))
_,_,_,country1 = strfind(temp1,"(%a+).(%a+)")
end
if hostname2 then
temp2 = strsub(hostname2,(strlen(hostname2)-4))
_,_,_,country2 = strfind(temp2,"(%a+).(%a+)")
end
user:SendPM(BOTNAME1,country1.." "..country2)
if (country1 and country2) then
if (country1 ~= "net" and country1 ~= "com") then
if (country1 == country2) then
user:SendPM(BOTNAME,"Traffic from you to "..user2.sName.." is national traffic !")
else
user:SendPM(BOTNAME,"Traffic from you to "..user2.sName.." is international traffic !")
end
else
user:SendPM(BOTNAME,"It could not be determined if traffic from you to "..user2.sName.." is national or international traffic !")
end
else
user:SendPM(BOTNAME,"It could not be determined if traffic from you to "..user2.sName.." is national or international traffic !")
end
end
end

For info on traffic, a user sends a pm to the bot.
Syntax: +trafficto anotheruser

Hope it is what you wanted (I have not integrated your countrydetermination, the user who asks knows his country and can see if the user is from same country if the message says national traffic).

Give it a try, play with it and if you have additional questions contact me :-)


Yokozuna

P.S.
If someone wants to optimize this script, feel free to do so.
Title:
Post by: pHaTTy on 06 February, 2004, 16:19:56
or you can goto finsihed scripts and look at my userinfo bot, which also tell you the country using web extension, i will be adding my ideas soon, to my userinfo, so it will be more accurate ;)
Title:
Post by: nEgativE on 23 March, 2004, 07:48:58
well, thank u Yokozuna.. i think did not work so well as i really wanted.. tks anyway.

Phatty, have u finnished the userinfo bot ? is there a way to have a standalone script to check user with the that hostname funtion ?