Author |
Message |
fatrolls Novice
Age:36 Gender: Joined: Jul 25 2013 Posts: 35 Offline
|
Posted: Mon Dec 01, 2014 2:36 am Post subject: SubGame Server Decompiled, Continuum Support! |
|
|
|
|
I wanted to make SubGame open source so I could work off it because ASSS got alot of shortcomings like bad commands hard structure to work with and other stuff.
I took subgame.exe which is pretty clean server not subgame2.exe this one has no patch work to Fix.dll so it is pretty clean when decompiled.
Pretty much wasted my whole summer re factoring the names so they make more sense.
Got it to fully compile a week ago and it didn't even run just crashed, I don't know C that well I can fix stuff though.
Started breakpointing and fixing things little by little and in the end got SubSpace 1.34 to connect and fly around etc..
Then 2 days ago I wanted to add Continuum support found a good article explaining how Continuum encryption worked by Snrrrub.
Got Continuum encryption implemented and now you can fly around using Continuum.
Well it's pretty stable atm just got issues with multiplayer support don't know how it can handle packets simultaneously from multiple users without threading. I see it creates extra subgame processes for each user but I never figured out how to activate it.
Pretty much I gave up and decided to release it maybe somebody will pick up where I left off and I could start working on it again..
If someone wants to fix the multiplayer support I would start working on it again.
Uploaded the project on Google Code:
https://code.google.com/p/subgame-continuum-subspace-clone/source/browse/
You could download that rar file which is all the folder structures.
To work on it download the updated Dev-C++ by Orwell
http://sourceforge.net/projects/orwelldevcpp/
also get the plugin for AStyle which you can install into Dev-C++ quick tools
now you can code pretty sloppy and let it auto beautify your code for you.
Run's without crashing
P.S.> The old 1.34 Subgame server folder is before I started to add the Continuum Encryption it has alot of outdated code and will crash more often then the Continuum version.
SubSpace Open Source.rar - 34969.81 KB
File downloaded or viewed 195 time(s)
Last edited by fatrolls on Sun Dec 07, 2014 8:25 pm, edited 1 time in total |
|
Back to top |
|
|
CypherJF I gargle nitroglycerin
Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Mon Dec 01, 2014 11:52 pm Post subject: |
|
|
|
|
Nice, thanks for your hard work! _________________ Performance is often the art of cheating carefully. - James Gosling
|
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Thu Dec 04, 2014 1:56 pm Post subject: |
|
|
|
|
Uploaded a copy of the rar to your post.
|
|
Back to top |
|
|
cycad Novice
Gender: Joined: Feb 12 2004 Posts: 29 Offline
|
Posted: Sat Dec 06, 2014 12:30 am Post subject: |
|
|
|
|
That is good work. Part of the problem is IDA and Hex-Rays do not always produce correct disassembly/decompiled source. Another part of the problem is that there are some bugs that fix.dll & the subgame2 patches fix. Still, looking at vanilla subgame.exe instead of subgame2.exe is the correct way to do it. Unfortunately there are bound to be tons of necessary fixups in general and especially around optimized areas.
|
|
Back to top |
|
|
fatrolls Novice
Age:36 Gender: Joined: Jul 25 2013 Posts: 35 Offline
|
Posted: Sun Dec 07, 2014 8:07 pm Post subject: |
|
|
|
|
Learned some secret commands on subgame that people never documented such as Shift+F12 to shutdown the subgame. Some incorrect packets on the twcore Subspace Protocol could be figured out easily here such as the SendAdvertisements people didn't know how to calculate the size of the bitmap, but it turns out it doesn't even send a bitmap but just pixels, you have to build the bitmap by hand it must use the same palette that subspace uses for its 256 colors. The player voice packet was misunderstood I figured it out.. Also figured out a few vulnerabilities that could possibly be used to cause problems.
Didn't even know it hosted a server on server port + 1 just to display number of users and lag of the zone in the zone list lol, could easily be spoofed up to 65,555 players in your zone most likely even show up on directory list haha.
Yes it has no problems submitting your zone to the directory list and it even shows up there (didn't bother the spoof trick as it would probably ban my zone from the list).
Has no problem connecting/communiating with the biller server uses standard subspace encryption for that with encryption turned off by echoing the same server key or echoing a 0 client key i forgot.
My biggest problem was getting BinarySearch to work right and the solution turned out to be very very simple turns out Hex-Ray's doesn't do Parenthesis correctly had to resort to asking stackoverflow for a solution here so it just did the math too early without doing inner-math first.
This was a very good learning experience with Hex-Rays as now I could see exactly what it can't do, I was going to write a regular expression script that automatically fixes all the fixes I did by hand to Hex-Ray generated code to make perfect compiles but I figured some areas require a parser and I would need to get some IDE code that parses C code properly and abandoned that idea.
Most importantly I wanted a plugin for Hex-Rays that automatically searched for the same address offsets and figured out what structure needed to be used maybe even traced each function that uses other functions with the same structures and automatically filled in all the structures so renaming would all that would of been needed in the process.
Found a plugin that does that surprisingly very poor performance from it had to resort to structuring the structs by hand.
Things like HugeChunk Packet transfers required a structs inside of another struct.
Kept it all C no typedef's none of that garbage
I liked how subgame wrapped malloc/free with AllocateMemory/ExpandedMemory/FreeMemory gives it nice feel like visual basic with Redim Preserve memory resizing memory and its all clean without getting those segmentation faults and other crap.
Yeah I removed nearly all ugly optmizations that HexRays couldn't figure out such as strcat/strcpy some memset's which are represented as a bunch of nested loops.
Removed optimizations that multiply to represent negative numbers.
Removed optimizations of the __OFSUB__ and __SETS__ which looked ugly..
I left in only 2 or 3 __OFSUB__'s which I wasn't sure of.
Some good things could be learned from this C code like how to properly drop the flags. Such as
SpawnOnMap
Any numbers which used __PAIR__ all removed
Represented all float/doubles properly not shifted by some power, figured out the shifting is the same as dividing by a certain power.
And made sure it has no C++ code only used new[]; in a few areas which I replaced with mallocs
It still has no multi-threading and never did but it seems to work like that.. but I think something because multi-threading is missing all the packets should probably suffer some kind of delay as they are all processed by one pipe a while loop and I think this is the reason why the server doesn't support mulitplayer atm..
You can login Continuum / Subspace with it and it works fine (Well I broke Subspace haha, now you always get warning of a mismatch login.)
Continuum works perfectly after I added the Continuum version packet.
Only problem right now it doesn't support multiplayer as you can login one person and fly around no problem.. but a second person wouldn't be able to even get past the login screen. It either thinks that connection is already online and ignores it or it just has some bug somewhere..
I want to make this run without problems so I could possibly run this on a Linux computer. Only problem is I wouldn't be able to run "Continuum.exe Z" command so I would always have to use the old scrty1 / scrty files which is probably no problem as no one really cheats.
Thats about the only problems that it has right now.
P.S.> I fixed up OpenCore you released with a ton of bug fixes, added mysql support and others added ASSS Support, I'll attach it here if you want to update your github with it.
OpenCore fixed by fatrolls
OpenCore bot fixed.zip - 1224.84 KB
File downloaded or viewed 174 time(s)
|
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:41 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Mon Dec 08, 2014 12:45 pm Post subject: |
|
|
|
|
As a reminder, the original subgame.exe combine with the original Subspace.exe do have some exploit issues. You can potentially have full read/write access to any file on the client's drive (*getfile and *putfile). There are other exploits on the server side that also have been patched against.
Things like Shift+F12 were known and was used as a griefing attack against small zone owners a long time ago ("Hey dude, Shift+F12 opens this cool admin panel in subgame"). Needing to open both the main Port and Port+1 is mentioned a lot in all the Router FAQs (https://forums.minegoboom.com/viewtopic.php?t=2443).
|
|
Back to top |
|
|
cycad Novice
Gender: Joined: Feb 12 2004 Posts: 29 Offline
|
Posted: Tue Dec 09, 2014 7:50 pm Post subject: |
|
|
|
|
fatrolls wrote: | P.S.> I fixed up OpenCore you released with a ton of bug fixes, added mysql support and others added ASSS Support, I'll attach it here if you want to update your github with it. |
I'll look at pull requests on GitHub if they are per-feature (not one giant pull request for everything), but there's no way I'm going to manually merge by hand from a zip file. I doubt it has tons of bugs as you say since it has reliably stable performance from those who use it in EG. As for MySQL last I remember was it couldn't be added due to licensing issues. That would be useful to have though.
|
|
Back to top |
|
|
fatrolls Novice
Age:36 Gender: Joined: Jul 25 2013 Posts: 35 Offline
|
Posted: Tue Dec 09, 2014 9:55 pm Post subject: |
|
|
|
|
It had bugs for one the PacketClustering was not properly implemented didn't take into account packets already over 255 in size as the size byte could only represent 1 byte so the size sometimes cycled on itself and crashed (very long chat messages)..
It had bugs like connecting to ASSS and couldn't support those C plugins like baseduel/eliteduel/duel that were coded for PowerBot I believe. I added support for them
bugs all around to be honest I think the BigChunk !getfile !putfile were broken fixed those.
I guess it's just a very outdated version on github
|
|
Back to top |
|
|
cycad Novice
Gender: Joined: Feb 12 2004 Posts: 29 Offline
|
Posted: Tue Dec 09, 2014 11:30 pm Post subject: |
|
|
|
|
ASSS compatibility is a non-goal for opencore, so I'm not at all surprised about incompatibilities there. That's because ASSS was designed considering what Continum will accept whereas opencore was designed considering what subgame will produce, and those aren't the same.
That being said clustering shouldn't crash so I looked over the cluster parsing code (phand.cpp:230) and don't see anything wrong there?
Your're right those bots you mentioned were for PowerBot which is a different core so those wouldn't work with opencore without modification. That's not a bug although it is cool you added support for those PowerBot plugins to opencore.
What's on GitHub is .19pr1 (prerelease 1) so it has mid development, non-functional features and file transfers are one of them. .19 did eventually come around but the source was lost when the VPS I did dev on crashed, and I realized I didn't care enough to rewrite what was gone. This was in 2007 when I abandoned the project.
I can't post more detail or look at code since I'm on travel using an iPad and this post has taken like 2 hours. Maybe next week if I don't get RSI from using this thing.
|
|
Back to top |
|
|
fatrolls Novice
Age:36 Gender: Joined: Jul 25 2013 Posts: 35 Offline
|
|
Back to top |
|
|
cycad Novice
Gender: Joined: Feb 12 2004 Posts: 29 Offline
|
Posted: Thu Dec 11, 2014 10:07 pm Post subject: |
|
|
|
|
It's not wrong and neither is TWCore. It's the format that subgame accepts so it's a limitation of the protocol, so guess what -- nobody is stealing from anybody; both groups have correctly implemented packet generation. I'm not sure what you're trying to accomplish with an asinine accusation like that about stealing code.
The code you are referring to is a non-exported function so it doesn't do bounds checking. You can't just call into it with bogus data and expect it to work. Exported functions that do eventually make that call limit the message size accordingly to prevent the non-issue you've described.
This thread has really turned counterproductive so I don't think I'll be responding further unless there's something relevant to current dev or subgame reversing that we can talk about.
|
|
Back to top |
|
|
fatrolls Novice
Age:36 Gender: Joined: Jul 25 2013 Posts: 35 Offline
|
|
Back to top |
|
|
|