Page 1 of 5

[PROGRAM]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:24 am
by Flake
Image
Orb: YSFlight Proxy Server Script

NEWS: Orb is now being developed in C# See the later pages of the thread for more info!

Current Stable Version: Orb_0.3.2
Current Test Version: --/--/--


NOTICE: Due to security concerns with YSFHQ, Orb is now being released as closed source to the public. To gain access to the source code, Please PM me or join the Project on SourceForce. Thanks!
Features:
  • Admin:
    • Optional YSFlight Headquarters Authentication Module: Login with your YSFHQ Username.
      Groups Structure: Assign users to groups, promote and demote from the server directly.
      Ability to appear offline on a server.
      Server Security Locks
      Ban/Kick/Mute/Freeze Naughty Users
      Optional YSFHQ Login Mode - Connect with your YSFHQ username and password!
      Run Orb on a different PC to your server for extra speed! (Internal networks only!)
      Detailed Console Log of the Servers happenings.
      Private Messaging (@Username Message)
Planned Features:
  • Admin:
    • Kill Users
      Limit aircraft to certain users only
      Disable Weapons to certain users.
      CronTasks: Repeat a message every hour, a command every minute, etc. (DECREPTED)
      Frequently Change the weather/wind.
    Virtual Airline:
    • Have IFR Flight Plan Generation/Execution
      Have Virtual Traffic Controller.
      YSATC Radar support.
      Virtual Pilots Licences and Traffic Control Licenes.
    Military:
    • Have Artifical Wingmen, commandable via F12 chat messages. (already have made an offline processor for formation flights.)
      Spawn Aircraft/Grounds out of group funds, have creative "command and conquer" style battles. (not as hard to do as you'd think)
      K:D Ratio
    Economy:
    • Funds: make money from flying! VA's make money, Military makes money, crashes lose money, licences cost money.
Readme: Download

Download:
  • Stable Version: Orb_0.3.2
    Test Version: --/--/--
[right]Like Orb? Consider Donating a small ammount to help me pay the bills and keep development going! Image[/right]
Please Provide Your Bug Reports to me via private message/sourceforge! Each bug report will earn bonuses once said bonuses are coded!

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:52 am
by Flake
Alrighty. After 7 hours straight work, I've made a very simple YSFlight Proxy Server for now.

Image

The server can do the following:

Have Multiple Clients at once (Via Threaded Coding) (Correct Approach.)
Back and Forth via a select structure in Python (Will change to threading later...) (Two threads now listen independtly to the client sockets, so they also work asynchronously.)
Reject Users based off their username and/or IP Address. (Can be intergrated with YSFHQ in future for "passwordless" log in. The player just visits YSFHQ from the comupter they wish to play from! :D) (Users a password login instead atm. IP Address login would be very nice though...)
Send and Receive Text Messages to players (Possible to have private messages via "With" statements catching the player names. (Done, working.)
Intercept, edit, and resend any packet type (currently only intercepts type 32) (now READS most data types, edits a few, forwards all)
From packet 32 (The YSFlight Text Packet) Commands are available:
Current commands are just testing only, but future commands could include generation of IFR Flight Plans, ATC, etc. (See devlog. should be available in 3.0)

This proxy server is the base end for a predominantly web based control system for ysflight servers. (This will probably be orb 2.0/3.0)

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:53 am
by FrenchTOZT
That is actually really awesome, good job.

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:54 am
by Midnight Rambler
Sweet! What sort of lag has been found and when is it stable to use on servers?

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:55 am
by Flake
With the select structure it's quite bad but (This is because it's only doing one things at a time.)with the threading it's not really noticable (theres more lag due to my cpu being overloaded with 5 million copies of ysf running then packet data) (asynchronous, much faster and independant.)

Thanks guys. I need to swap to threads between the send and receive next. (done, working.)

EDIT: Stuff is in the dropbox guys. Included is a weathergenerator.gmk, chatinterceptingclient and this server (i've only just started using classes, mmkay? :geek: ) (classes are used more in c#.)

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:55 am
by Flake
Changed the relay to threading, and fixed some doubled socket bugs in that relay as well as the server and client socket timeouts.

The result is LAGLESS (I may as well be flying offline in a replay)

Proof:

Image

EDIT: Dropbox version updated. (./Flake/Proxy/)

Next step: Graceful socket close catching. :ugeek: (never managed to work that out.)

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:56 am
by Flake
MORE WORK! :D

Image

I'm putting off graceful socket closing until the thread cleanup stage as I found it doesn't affect all the other threads anyway. (well, duh.)

I've made the foundations for a the user login database.

Of course, this has a massive permissions net behind it, but I'll need to code permissions changing later. (net will soon use a true/false override WITH the numbers as an underride.)

The framework for simple commands is dropped in and ready to run. such commands are Mute/Unmute, Ban/Unban, Freeze/Unfreeze (prevent join), Kick, Promote, Demote. (freeze can also stop a user midair for all other clients.)

I've also coded an easy to access and edit database structure as you can see, which is fairly consistent across the data types (they are group and user)

I've mashed everything into classes and methods, and it is very efficient.

eg: Group["YSRAAF"].Rank[0].RankName would return what you'd expect. That may not look hard, but it adds a lot of flexibility down on the coding level, as I can just change the value of an input string and get completely different values for completely different groups. (this is good, but if an object is NULL then shit is all fucked up...)

Also, within the classes are subfunctions that are specific to them, so I could type User["Flake"].Ban(); and a ban is applied to that username, or User["Flake"].Promote("YSRAAF") to go up a rank.

The latest version is in the dropbox. I've moved to folders now that the project is growing to be quite large (about 1000+ lines atm)

Next step: Link the database and the proxy server together. :ugeek:

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:56 am
by Honey Badger
I would click thanks but it seems to have disappeared. Good work!

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:57 am
by Midnight Rambler
Can't wait to give this a go :)

Edit: Would it be possible to change weapon set ups while hosting a server through this system? Say I wanted to turn all weapons off without closing the server and changing the settings, would I just be able to flick a few buttons and have weapons off/on?

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:58 am
by Flake
Of course.

I just need ONE thing before I can start doing that, and that is all the data regarding a join request packet. (nothing exists yet) :|(requests aircraft, start position, loadout, iff. expects .dat data, abs position, velocity, loadout, id.)

In the join request, the client requests to spawn at the startposition, with aircraft, with all the loading info. I can set it to either reject requests with the weapons, or edit the requests to give NONE. There is also a server weapons enabled option but i'll need to double check that it can be sent at anytime. (can do, this is another packet type.)

I'll need to sniff packets to work that all out, though, so it may have to wait. (done)

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:58 am
by Flake
LolsServer.

Image

The above is a driver test for per user settings and permissions module.

In other news, my keyboard is acting up. making it really hard/slow to code. :(

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:58 am
by Shutter
It still doesn't print bacon.

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:59 am
by Flake
A small amount of work tonight as I have been riding all over the top half of the state looking for a new house, Quite sore. (i never got that house...)

I've coded permissions loading into the program now. Permissions can be applied to individual group ranks as well as individual users. The use a simple math system. If the permission ends up being "1" or higher, the user can perform said action. (still going to use this, but will have bool overrides as well.)

1 gives power, 0 has no effect, and -1 takes it away. (will still use.)

So for example, i can assign "cantalk" to all ranks as being 1, but to all users, i make it 0. 1+0 = 1, so the user can talk.
If i wanted to mute that user, i set there "can talk" to -1. 1-1 = 0, so the user can no longer talk. I hope this will make my life a lot easier in future.

Currently, the database side of the program dual loads and creates the user as it is loaded. (create, set defaults, load) so it finds the username, then assigns all the default variables, then overwrites them with whatever permissions are specified in the username file. This way, no variable is left undeclared.

I still need to have the reverse of this coded, that is, dump changed variables back to the file on the fly (I can't wait for server shutdown... what if it crashes? all the data is lost! D:) (user save functions for every variable change will work just fine.), and I also need to seperate the groups loading and permissions loading into seperate folders. I'm thinking for every "x.txt" to load user settings, there should be a "x" folder to go with it, with file names "0.txt" so on, so forth, until the ranks are all given permissions. This would keep things very organised, rather then have a huge group file which is hard to edit (precisely why i dislike bukkit) (Database/Users/<USER>/info.txt/permissions.txt, Database/Groups/<GROUP>/Info.txt/permissions.txt)

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:59 am
by Shutter
NOW we're talking bacon.

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 7:59 am
by Flake
You guys are going to freaking love this next feature, courtesy of Eric-the freaking wizard-T. (cheers ET.)

He's established a polling service to check usernames and passwords against the YSFHQ database. Don't worry, as this can not possibly be sent to the ysflight server for everyone to see (as it is not even connected to the server yet!)(true story.)

this makes this program functionally safer then YSPS. :D (true story bro.)

the login process is simple. you join the server with your exact YSFHQ Username(The login packet only gives 15chr, need a username 15chr or less. I need to work around this.). after that, it asks you to provide a password. if those match with the YSFHQ database, THEN it will connect to the server on your behalf. pretty sweet huh? :)

Here's a pic of it in action:

Image

EDIT: Dropbox updated. try it for yourself! just run "Core.py" (database not linked (yet))

EDIT2: WHOOPPS turns out i cropped the server message out of the screenshot that went to the flying aircraft. NONE THE LESS, it got the message too.

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 8:00 am
by Shutter
Bacon achieved. Give yourself a pat on the back bro.

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 8:00 am
by Eric
But it's not sending a hashed version of the password and the script is using GET requests instead of POST, so only limited bacon. :geek: (Will need to redo this with C#.)
Check this out (see python port to hash the password locally): http://www.openwall.com/phpass/

Send me a PM and I can show you how to hook everything up to make it more secure.

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 8:01 am
by Midnight Rambler
<3

I'm guessing it'll be possible to join without a HQ account as well...?

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 8:01 am
by Flake
Massive update. Organised the project into much easier to manage files and modules.(re-organised again. Final, I think.)

Sorted the permissions loading to load from the permissions folder. Undelcared permissions are treated as default. :) (classes now auto manage this.)

Database is fully compatible with the Core, and I just need to link them together. (done.)

After that is done, I'll just need to add some actual functions, then we can roll out beta. (done.)

Re: [Development]Orb: YSFlight Proxy Server Script

Posted: Sun Mar 11, 2012 8:02 am
by Harm
Makes me with I were back home on the flight rig. This is freakin great stuff. I had always hoped for password system back in the ysp days. Sure would have prevented a lot of the havoc wreaked 99% of the time by MRNAMELESSAWESOMEMAVERICK101... :lol:

Flake, you mentioned it being relatively "Lagless" in an earlier post. I'm assuming there's still some distance lag, right? Or are you really able to fly formation and have your partner in crime see you where you actually are? :o