logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Beta Plugin: nwnx_system

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
acaos



Joined: 08 May 2007
Posts: 153

PostPosted: Thu Aug 28, 2008 23:26    Post subject: Beta Plugin: nwnx_system Reply with quote

I've just completed a new plugin, nwnx_system which provides access to various system functions, and integrates the nwnx_resetplugin and nwnx_tmi plugin functionality.

Note that the DirList and FileCopy functions are not yet complete. The plugin is available in Subversion.

Code:
string DirList (string sDir);
int FileCopy (string sFrom, string sTo);
int FileDelete (string sFile);
int FileLink (string sFrom, string sTo);
int FileRename (string sFrom, string sTo);
int FileSymlink (string sFrom, string sTo);
struct CPUUsage GetProcessCPUUsage ();
int GetProcessMemoryUsage ();
int GetSystemTime ();
int GetTMILimit ();
void SetTMILimit (int nLimit);
void ShutdownServer (int nForce=0);


Note that FileRename has UNIX semantics; it will overwrite the destination file. If you want to safely rename a file without overwriting, use FileLink() followed by FileDelete() after checking for the success of FileLink().

Acaos
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Fri Sep 05, 2008 23:45    Post subject: Reply with quote

The possibilities for this are very exciting, but also potentially lethal for servers. Is it possible for hackers to use this if such functions were available only to DMs with scripted-in powers to use this sort of thing? This is assuming that the code itself that is not part of the plugin is watertight.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Sep 06, 2008 1:03    Post subject: Reply with quote

If you are not cautious, then yes it is.

Get totally sure that person using this is person who should be.
Any conversation node should have extra GetIsDM check and I would check CDKEY and account too.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Sat Sep 06, 2008 1:06    Post subject: Reply with quote

The person in question would have to have the ability to set locals. The only thing I know with that capability other than the dm client is SIMTools, which checks cd key to confirm dm status. In other words, no, it isn't possible, unless your security coding is beyond poor. You do confirm dm logins against cd key, right?

I spose it's possible that DMFI allows local setting as well - I don't recall. In that case, you'd have a problem, since DMFI has a gaping security hole, though they are planning to fix it in the next release.

Funky
Back to top
View user's profile Send private message
acaos



Joined: 08 May 2007
Posts: 153

PostPosted: Sat Sep 06, 2008 5:58    Post subject: Reply with quote

Yes, this is potentially quite dangerous, but no more so than the nwnx_leto plugin, since Leto has file manipulation and deletion functions as well.

Acaos
Back to top
View user's profile Send private message
scarface



Joined: 12 Jun 2005
Posts: 94
Location: Sweden

PostPosted: Sat Sep 06, 2008 18:15    Post subject: Re: Beta Plugin: nwnx_system Reply with quote

acaos wrote:
I've just completed a new plugin, nwnx_system which provides access to various system functions, and integrates the nwnx_resetplugin and nwnx_tmi plugin functionality.

Note that the DirList and FileCopy functions are not yet complete. The plugin is available in Subversion.

Code:
string DirList (string sDir);
int FileCopy (string sFrom, string sTo);
int FileDelete (string sFile);
int FileLink (string sFrom, string sTo);
int FileRename (string sFrom, string sTo);
int FileSymlink (string sFrom, string sTo);
struct CPUUsage GetProcessCPUUsage ();
int GetProcessMemoryUsage ();
int GetSystemTime ();
int GetTMILimit ();
void SetTMILimit (int nLimit);
void ShutdownServer (int nForce=0);


Note that FileRename has UNIX semantics; it will overwrite the destination file. If you want to safely rename a file without overwriting, use FileLink() followed by FileDelete() after checking for the success of FileLink().

Acaos


How efficient ( or inefficient ) would it be to call GetProcessCPUUsage() & GetProcessMemoryUsage () every 6 seconds with a module heartbeat to display this info in game?
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Sat Sep 06, 2008 19:06    Post subject: Reply with quote

@scarface: Those two functions seem fairly harmless. Why not try it yourself? Get some statistics about these new functions.

I wrote:
This is assuming that the code itself that is not part of the plugin is watertight.


You've said that the plugin is dangerous if the code is NOT watertight, but I knew that anyway, we all do. And any scripter worth their salt (hopefully) knows how to make doubly sure that the person on the other end of the conversation is who it's meant to be.

So we're alright there. Smile

Acaos' response was the most helpful, thank you. I will definitely be using at least some of these functions.
Back to top
View user's profile Send private message
acaos



Joined: 08 May 2007
Posts: 153

PostPosted: Sun Sep 07, 2008 22:53    Post subject: Re: Beta Plugin: nwnx_system Reply with quote

scarface wrote:
How efficient ( or inefficient ) would it be to call GetProcessCPUUsage() & GetProcessMemoryUsage () every 6 seconds with a module heartbeat to display this info in game?


Should be totally fine. We do that on Higher Ground, actually. They are quite lightweight.

Acaos
Back to top
View user's profile Send private message
scarface



Joined: 12 Jun 2005
Posts: 94
Location: Sweden

PostPosted: Sun Sep 07, 2008 23:23    Post subject: Re: Beta Plugin: nwnx_system Reply with quote

acaos wrote:
scarface wrote:
How efficient ( or inefficient ) would it be to call GetProcessCPUUsage() & GetProcessMemoryUsage () every 6 seconds with a module heartbeat to display this info in game?


Should be totally fine. We do that on Higher Ground, actually. They are quite lightweight.

Acaos


Great thanks.
Back to top
View user's profile Send private message
Tsais



Joined: 18 Sep 2017
Posts: 6

PostPosted: Thu Oct 12, 2017 9:33    Post subject: Reply with quote

Trying to use a simple DirList() but not having much luck. The function calls for a string parameter and I'm assuming I'd use a Linux pwd path, like:

Code:
string sPath = DirList("/opt/nwn/servervault/");

... but it only returns the path I'm using plus a lot of ".............................."

Tried using DirList("servervault") and several other variations - no luck.

Any ideas?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group