Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   read player.ip through script (https://forums.graalonline.com/forums/showthread.php?t=134269506)

Jakov_the_Jakovasaur 08-25-2014 01:53 PM

read player.ip through script
 
how come its not possible for a scripter on a server to read a players ip through script, while it is possible for any random guild member to view a players ip through the global guilds control panel log?

http://i.imgur.com/mk6kQ9J.png

scriptless 08-25-2014 02:56 PM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1730493)
how come its not possible for a scripter on a server to read a players ip through script, while it is possible for any random guild member to view a players ip through the global guilds control panel log?

http://i.imgur.com/mk6kQ9J.png

It is possible via script but I think you have to read the player file on the server. I know at least 1 serve, not mentioning names, reads both computerid and ipaddress to verify people are not abusing systems using multiple accounts.

Tho I do not know if that's with special permission, or against the rules. I think that the guild cp might have been an oversight. Also guild cp limits to only guild members where-as a server could do a larger number of damage.

callimuc 08-25-2014 02:56 PM

Might be only a login server thing, but player.ipaddress?

edit: nvm just saw it's an authorized server only thing, should be changed!

Quote:

Originally Posted by scripthelp
TServerPlayer.ipaddress - string (read only) - only accessible on authorized servers


scriptless 08-25-2014 02:57 PM

Quote:

Originally Posted by callimuc (Post 1730498)
Might be only a login server thing, but player.ipaddress?

That is what we use on one of the servers I script on. Notice I my post above I typed the variable "ipaddress" the same way :)

Restraint 08-28-2014 12:32 AM

It's possible already, but a pain in the ass. On UN, I made it so players get clientr.ip set to their IP when they log on.

How do you retrieve their IP?

First, you have to give your NPC server:

r accounts/*/*

DON'T give it rw, or else I might log onto your server and give myself a full RC.

Once you've done that, you get the filepath to the player's file. For example -

For my account (Restraint), my account file would be in the following location:

accounts/Re/Restraint.txt

And if you .loadlines() it, you will find a line listed as "IP x.x.x.x" -- I *think*it's near the bottom (under comments but above rights, if I recall).

If it's near the bottom, you loop from the end towards the beginning and break; when you reach it.

If it's near the top, you loop from the beginning to the end and break; when you reach it.

There are some "special" cases with the accounts/ folder, though.

An account like "(npcserver)" would not go under:

accounts/(n/(npcserver).txt

It goes under:

accounts/special/%00npcserver%00.txt

(where %00's are the 'escaped' versions of ( and ) )

So basically you do SOMETHING LIKE the following:

PHP Code:

const template "accounts/%s/%s.txt";
public function 
getIP(acc) {
 
temp.escape acc.escape(); // Or whatever. Is this the SQL one? Whatever it is.
 
temp.folder escape.substring(02);
 if (
folder.contains("%")) { // Could also do .pos()
  
folder "special";
 }
 
 
temp.directory format(templatefolderescape);
 
temp.lines.loadLines(directory);

 for (
temp.linelines) { // If it's near top, loop from top
  
if (line.starts("IP")) {
   
temp.ip line.substring(2).trim(); // .trim() because I think it has garbage spaces
   
break;
  }
 }

 return(
ip);


Or something. That's really just a guess mostly, but you should be able to figure it out from there.

Jakov_the_Jakovasaur 08-28-2014 06:19 AM

thank you!

but i already have a very simple method of retrieving ip, was just wondering why the default variable is still restricted as if that is somehow improving security, especially as seemingly everyone works around it anyway

Restraint 08-28-2014 09:14 PM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1730627)
thank you!

but i already have a very simple method of retrieving ip, was just wondering why the default variable is still restricted as if that is somehow improving security, especially as seemingly everyone works around it anyway

I was mainly replying to others in the thread who were discussing it. I generally assume you know these things by now!

Also, for others in the thread: I remembered on a whim this morning in bed that .escape() IS the SQL one. It's escapefilename() that I was thinking of.

I agree with you there, though. I'm not sure why certain aspects of the game are "pretend"-secure, causing more inconvenience than anything.


All times are GMT +2. The time now is 11:44 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.