Author Topic: Remote Admin  (Read 4959 times)

Remote Admin
« on: August 30, 2016, 03:52:35 pm »
Hi guys, I was building a server and find in the config file a "Remote Admin Port" it's in 0 by default - I try to change it to another port, and the put this port in the client or something like that but not work - It's posible to get a remote admin control? Not loged in the game? or that config it's just a forget function ?

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #1 on: August 30, 2016, 07:07:23 pm »
If you want control without being logged ingame, why do you try to connect with a client? :P
Games are meant to be created, not played...

Re: Remote Admin
« Reply #2 on: August 30, 2016, 07:22:27 pm »
Jaja well I mean a remote admin without enter the game, I check the client you can change de port - I was imagine if you put the port of the "Admin panel" you don't load the game just a console to send commands or stuff like that but I believe its impossible - And there's no information about the admin panel port or how to log using that port.-

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #3 on: August 30, 2016, 09:16:03 pm »
Just use telnet, connect, and type password. Then just use hardcoded ~commands like you'd do in client after getaccess -- be warned lot of them won't work :P

In my opinion it ain't worth it... some of design choices are silly, annoying, or simply dangerous; but hey, it's just me.
Games are meant to be created, not played...

Re: Remote Admin
« Reply #4 on: August 30, 2016, 09:30:01 pm »
Ahhh you are the best! - Great well I know its probably a "beta" of that but its a good option have a possible telnet connection for any quick access.-

By the way, there's a way to send a Global Message in admin mode? Like... "~say_global Hello" something like that

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #5 on: August 31, 2016, 02:22:35 am »
No. None of hardcoded commands can be (ab)used to pass strings~

If you know bit C++ you can check my attempt on admin panel via dll, which one of purposes was to bypass exactly this limitation; never had a chance to test it on live server so beware :P Everything is in here and here, except actual starting whole thing, which should be done by calling InitDevConnect(port) in main@init and ProcessDevConnect() in main@loop.

Highly experimental, untested, unsafe (if you don't modify dev_login() function), probably bit slow... but at least you can edit it any way you like and -most important i think- it's prepared for two-way communication and tied to game scripts, instead of hardcoded commands (which can, in most cases, be simulated by scripts anyway).
Luckily, that's really small amount of code so it should be pretty easy to understand for anyone who worked with fonline dlls before.
« Last Edit: August 31, 2016, 02:24:52 am by Wipe »
Games are meant to be created, not played...

Re: Remote Admin
« Reply #6 on: August 31, 2016, 04:37:03 am »
I see, so by default there's no way to send a message if you are and admin in a "global" way to all connected users ? -

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #7 on: August 31, 2016, 08:39:08 am »
Best i can think of is - predefined messages with assigned id numbers and ~run command which sends them (by providing message id as one of params)
Games are meant to be created, not played...

Re: Remote Admin
« Reply #8 on: August 31, 2016, 03:09:03 pm »
That exactly what i mean Wipe - Im a noob in coding, but you can give me an example of predefined message and how to call it?

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #9 on: September 01, 2016, 02:34:32 am »
It can be anything as simple as
Code: [Select]
void msg( Critter&, int, int, int type )
{
   string msg;
   if( type == 1 )
       msg = "Yay!";
   else if( type == 2 )
       msg = "Wee!";
   else
       return;
   array<Critter@> players;
   for( uint p=0, pLen=GetAllPlayers(players); p<pLen; p++ )
   {
         players[p].Say( SAY_NETMSG, msg );
   }
}
and called as ~run some_modulke msg 0 0 1
Oh, and remember to never access Critter object in any function called from admin panel... In best case it will result in script exception, in worst - server crash (don't remember AS behaviour now)
Games are meant to be created, not played...

JovankaB

  • Guest
Re: Remote Admin
« Reply #10 on: September 01, 2016, 06:20:40 am »
Can't you just send ascii values with ~run commands one by one, store them in a buffer and then a special command to "show whole message"? :D

And then modify the admin panel to make this automatically, you just write "say hello" and the panel sends all necesary ~run commands
« Last Edit: September 01, 2016, 10:28:47 am by JovankaB »

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #11 on: September 01, 2016, 03:46:31 pm »
Technically yes, but!
  • There's no way to detect who said hello
  • If you say hello to specific player, you'll never see if/what s/he answered
  • Probably would need external application to send messages
  • As you can pass maximum 3 characters during one call, you'd have to call the function at least 2 times even for such short message as "hello". And that's where problems begin (see point 1)... consider following scenario:
    • Admin#1 wants to greet player with a nice, warm "hello". That string have 5 bytes, so we need to call function at least 2 times
    • After receiving first 3 bytes, we store it somewhere in scripts
    • At same time, Admin#2 decides to Interact With Playerbase, by sending his greetings. He's very excited to do that so decides to send text "hi!". We don't know yet if it's the end of message so we store it somewhere... in scripts...
    • Second part of Admin#1's message comes in - "lo" and end-of-string marker (let it be '\n' to makes things easier)
    • We add received string to already cached value... but... oh noes! Our cached var value is now "helhi!lo"
    • Our message has been sent to player. It's horrible, it's gibberish, and it probably will make player post GM ABUSE thread.
      WHAT A DISASTER
    • But wait, there's more! Just millisecond later there comes end-of-string marker from Admin#2. Now not only we sent gibberish but also a blank line.
      GAEM LITERALLY UNPLAYABLE

Taking all the problems together - general idea is nice, but as you can see it works only on paper. Please address mentioned issues when updating your suggestion.

Sincerely,
#Rotators
Games are meant to be created, not played...

JovankaB

  • Guest
Re: Remote Admin
« Reply #12 on: September 02, 2016, 12:09:53 pm »
Taking all the problems together - general idea is nice, but as you can see it works only on paper.

Phew, it would work in reality too! - just not 100% of the time :P
« Last Edit: September 02, 2016, 05:28:25 pm by JovankaB »

Re: Remote Admin
« Reply #13 on: September 03, 2016, 05:11:46 am »
Hi Wipe,

Well I made a few test but no luck - Im sure im doing something wrong, I copy the code and create a .fos file call it "text" and save it into script folder of the server then load that in script.cfg like "@ server module text" and no luck fail to start the server say "'SAY_NETMSG' is not declared" then try to load id in "_scripts.fos" the server load but in the "chat" I type "run text msg 0 0 1" and still no luck to made it work.-

Im wrong in the load of the code?

Offline Wipe

  • Rotator
  • Random is god
Re: Remote Admin
« Reply #14 on: September 04, 2016, 10:52:54 am »
Just include _defines.fos (and get used to that, that file is required for virtually everything)
Games are meant to be created, not played...