Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Extensions » Should Stars! files structures be publically available?
Re: Should Stars! files structures be publically available? Thu, 14 June 2012 02:21 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Any details? URL? Docs? Sources? Rolling Eyes


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Should Stars! files structures be publically available? Thu, 28 August 2014 14:41 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 185
Registered: February 2004
Location: Norway
m.a@stars wrote on Thu, 09 February 2012 14:08

That is to some extent already solved, since there's tools for guessing/changing passwords. Sherlock

Is this tool available anywhere? Me and my friends started up a game recently, with races we created about a month ago (one of them was not available to start for a while after all), and naturally one of them has forgot his password. I guess we could just start over, but I'm playing joat, and my scanners show a habitable planet just inside my penscanning range in year one... would have been great to continue that game. And this has happened before too, that one of them forgot their password. It would be great to have a tool to extract passwords available, I guess stars passwords are mostly not used on autohost anyway, since we use the autohost passwords instead. And it would also be great if the encryption became available knowledge. After all, there are not that many players left. Having the options to build tools would be much better than hiding the encryption for the few players that are left. I don't think the few dedicated players that are left are cheaters, I just think they love the game, and everything that can improve the game is good.

Report message to a moderator

Re: Should Stars! files structures be publically available? Fri, 29 August 2014 14:55 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
FYI, the encryption is now public and posted to a git repo here:

https://github.com/raptor/stars

Python and Java code is available for decryption. What is lacking is building out the file structures. I have sadly not had much time to do this and I am hoping other people will do most of the work and contribute. Smile

Report message to a moderator

Re: Should Stars! files structures be publically available? Sat, 30 August 2014 01:55 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 185
Registered: February 2004
Location: Norway
That is great news Smile
Hopefully this will be used for the greater good. Maybe someone will even write ais that actually work.

Report message to a moderator

Re: Should Stars! files structures be publically available? Sat, 30 August 2014 07:10 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 185
Registered: February 2004
Location: Norway
Hm, I Wonder how the various blocks beside the FileHeaderBlock are coded. Eg I git cloned your project and tried decrypting a simple race file with default Humanoid values and password set to aaaaa, but I only got the following from the PlayerBlock:
-- Decrypted Block Data --
255 0 0 0 0 0 15 0 0 0 0 0 67 18 14 0 50 50 50 15 15 15 85 85 85 15 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 10 10 10 10 10 5 10
0 1 1 1 1 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 6 183 222 219 22 116 214 7 183 222 219 22 116 214 159
Converting these values to ascii gave me no useful info. I hadn't expected the password to pop up in clear text, but at least i had expected some reference to the 'Humanoid' race name somewhere. Are there any info somewhere explaining how decrypted blocks are coded? Or is something wrong with the decryption?

Report message to a moderator

Re: Should Stars! files structures be publically available? Sun, 31 August 2014 04:11 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
platon79 wrote on Sat, 30 August 2014 13:10
50 50 50 15 15 15 85 85 85

That's the Hab info (center, lower, upper). Pop GR and techs must be there too. Since it's a race file, I guess 99% of it is just numbers defining the race itself. Sherlock

(note) From the RW code:

//positions related to racefile positions
STAT_RES_PER_COL	=0;
STAT_TEN_FAC_RES	=1;
STAT_FAC_COST		=2;
STAT_FAC_OPERATE	=3;
STAT_TEN_MINES_PROD	=4;
STAT_MINE_COST		=5;
STAT_MINE_OPERATE	=6;
STAT_SPEND_LEFTOVER	=7;
STAT_ENERGY_COST	=8;	//0 if expensive, 1 if normal, 2 if cheap
STAT_WEAP_COST		=9;
STAT_PROP_COST		=10;
STAT_CONST_COST		=11;
STAT_ELEC_COST		=12;
STAT_BIO_COST		=13;
STAT_PRT		=14;

GRBIT_TECH75_LVL3	=29;
GRBIT_FACT_GER_LESS	=31;

// values for the PRT byte
PRT_HE =0;
PRT_SS =1;
PRT_WM =2;
PRT_CA =3;
PRT_IS =4;
PRT_SD =5;
PRT_PP =6;
PRT_IT =7;
PRT_AR =8;
PRT_JT =9;

// bits inside the LRT byte
GRBIT_LRT_IFE	=0;
GRBIT_LRT_TT	=1;
GRBIT_LRT_ARM	=2;
GRBIT_LRT_ISB	=3;
GRBIT_LRT_GR	=4;
GRBIT_LRT_UR	=5;
GRBIT_LRT_MA	=6;
GRBIT_LRT_NRSE	=7;
GRBIT_LRT_CE	=8;
GRBIT_LRT_OBRM	=9;
GRBIT_LRT_NAS	=10;
GRBIT_LRT_LSP	=11;
GRBIT_LRT_BET	=12;
GRBIT_LRT_RS	=13;


So,
Quote:
10 10 10 10 10 5 10

means "1 res per 10 (*100) cols", vanilla Facs and Mines

and
Quote:
1 1 1 1 1 1 9

mean "all techs Normal", PRT = JOAT.

So I reckon the decryption is working. Cool


[Updated on: Sun, 31 August 2014 04:38]




So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Should Stars! files structures be publically available? Sun, 31 August 2014 20:20 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
platon79 wrote on Sat, 30 August 2014 07:10
... Are there any info somewhere explaining how decrypted blocks are coded? Or is something wrong with the decryption?


I've thoroughly tested the decryption, and it matches everything that other utilities have decrypted (so far).

Decoding the blocks is the next step. Some of the decoded data is found within the 'decompiled' sources for PaulCr's utilities. It just needs to be translated and tested properly.

m.a@stars wrote
From the RW code


Where is that source code you're pulling from?? (Forgive me for not knowing what 'RW' is)


[Updated on: Sun, 31 August 2014 21:32]

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 01:47 Go to previous messageGo to next message
mrvan is currently offline mrvan

 
Officer Cadet 1st Year

Messages: 220
Registered: May 2014
(I would presume RW=Race Wizard)

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 05:35 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
platon79 wrote on Sat, 30 August 2014 07:10

-- Decrypted Block Data --
255 0 0 0 0 0 15 0 0 0 0 0 67 18 14 0 50 50 50 15 15 15 85 85 85 15 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 10 10 10 10 10 5 10
0 1 1 1 1 1 1 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 6 183 222 219 22 116 214 7 183 222 219 22 116 214 159


The password is hashed as a 32 bit integer at index 12 of the data: [67 18 14 0]. When read as a little-endian integer, this is the number 922179.

Your password is 'aaaaa' Smile

I'll post the algorithm and brute-forcing code to my repo soon.

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 10:07 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
raptor wrote on Mon, 01 September 2014 02:20
Where is that source code you're pulling from?? (Forgive me for not knowing what 'RW' is)

Seems I received it by PM. I could have sworn it was published somewhere, perhaps lurking inside FreeStars? Confused



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 11:50 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Could you please send me that source code? What utility is it?

[Updated on: Mon, 01 September 2014 11:50]

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 14:49 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 185
Registered: February 2004
Location: Norway
raptor wrote on Mon, 01 September 2014 05:35

The password is hashed as a 32 bit integer at index 12 of the data: [67 18 14 0]. When read as a little-endian integer, this is the number 922179.
Your password is 'aaaaa' Smile
I'll post the algorithm and brute-forcing code to my repo soon.


Before you posted this, I started pounding on the hashing algorithm myself. And after a couple of hours I managed to solve it! Very Happy
It is strange that you should be so certain that my password is aaaaa. It actually is, but due to the hashing into just 4 bytes it could also be something completely different. In fact, my own password-routine that I have now written suggests aaba instead of aaaaa Smile And my race with password AAAA it suggested a902 for. Wink And both passwords worked in stars. Very Happy
Unfortunately, I have not been able to find the password I actually wanted to find yet Sad My own brute-force-approach is a little bit too brute-force, calculating all permutations of [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456 789] , starting with 1 characters, then advancing to 2, then 3 etc. For each permutation I calculate a hash and compares with the decrypted number.
4 characters takes up to 2458 ms, 5 characters up to 130136 ms. It is still calculating for 6 characters..
It would probably be more speedy if I wrote it in C or something instead of Java, and I should probably try it out on my stationary computer instead of my laptop, maybe give the java-process a bit more memory for the recursion etc. But I guess the code could also be optimized also somehow. I'll have a look into your code when you publish it Smile

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 15:46 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
I was not certain that it was 'aaaaa'. It just seemed likely given human nature and the other possibilities that came up (through the same brute-force method you describe.)

I posted my code in python:

https://github.com/raptor/stars/blob/master/python/util/__in it__.py

This algorithm can be easily broken, however, by going backwards and attempting to divide by all char values with no remainder, then subtracting a another char value, and keep doing that until your left with only an ascii char left. This would be orders of magnitude faster than brute-forcing because the hash is not one-way. The only thing you have to watch out for is the integer overflow, which seems to happen after only 6 or 7 characters in a password.


[Updated on: Mon, 01 September 2014 15:47]

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 19:33 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
raptor wrote on Mon, 01 September 2014 17:50
Could you please send me that source code? What utility is it?

It's already published in FreeStars, as mentioned here and here.

The function you want is GetAdvantagePoints(), in Server/Race.cpp Work at computer



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Should Stars! files structures be publically available? Mon, 01 September 2014 20:34 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Interesting - was FreeStars meant to be a clone, even at the ABI level? Can I rely on the accuracy of its structures to conform with the original stars! structures?

Also, I don't see that header code in the freestars project to which you linked. Is it somewhere else?


[Updated on: Mon, 01 September 2014 20:44]

Report message to a moderator

Re: Should Stars! files structures be publically available? Tue, 02 September 2014 15:06 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
raptor wrote on Tue, 02 September 2014 02:34
Interesting - was FreeStars meant to be a clone, even at the ABI level? Can I rely on the accuracy of its structures to conform with the original stars! structures?

Clone, yes, but with their own file and data formats. File compatibility was never the goal, AFAIK.


Quote:
Also, I don't see that header code in the freestars project to which you linked.

Me neither. Confused



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Should Stars! files structures be publically available? Tue, 02 September 2014 20:44 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Could you please send me the code from which your snippet above comes? It looks very descriptive of the race block.

Report message to a moderator

Re: Should Stars! files structures be publically available? Wed, 03 September 2014 14:57 Go to previous messageGo to next message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 185
Registered: February 2004
Location: Norway
raptor wrote on Mon, 01 September 2014 15:46

I posted my code in python:
https://github.com/raptor/stars/blob/master/python/util/__in it__.py

I have now tried to upload my java code to that address too. I have to admit, I have never used github before, I hope that I have done it right, I just tried adding a file using their web interface, and it said it got forked and it seems to be created and is probably ready for your inspection/merge, but I don't know if it is created in the correct directory etc. I wonder if it is possible to do it from my eclipse or command line instead the next time I try to upload something to another persons github? Pushing directly to the master branch from eclipse as I tried first definitely did not work. Very Happy

Report message to a moderator

Re: Should Stars! files structures be publically available? Wed, 03 September 2014 17:02 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Hi,

You just have to do a 'pull request' from within github and it'll then shoot a notice off to me to accept,reject. Your code looks fine to me, but does your hashing code correctly handle the integer overflow? (I'm not sure how Java would handle it)

This is exciting... someone is contributing!

P.S. Is there a reason you've decided to do the Java instead of the python?

Report message to a moderator

Re: Should Stars! files structures be publically available? Wed, 03 September 2014 20:59 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
raptor wrote on Wed, 03 September 2014 02:44
Could you please send me the code from which your snippet above comes? It looks very descriptive of the race block.

Done. Seems I already posted the interesting bits, tho. Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Should Stars! files structures be publically available? Wed, 03 September 2014 21:56 Go to previous messageGo to next message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
Thanks!

Report message to a moderator

Re: Should Stars! files structures be publically available? Fri, 05 September 2014 15:44 Go to previous message
platon79 is currently offline platon79

 
Chief Warrant Officer 3

Messages: 185
Registered: February 2004
Location: Norway
raptor wrote on Wed, 03 September 2014 17:02
Hi,

You just have to do a 'pull request' from within github and it'll then shoot a notice off to me to accept,reject. Your code looks fine to me, but does your hashing code correctly handle the integer overflow? (I'm not sure how Java would handle it)

This is exciting... someone is contributing!

P.S. Is there a reason you've decided to do the Java instead of the python?


No I have not looked at the integer overflow. But my code only worked ok on small passwords anyway, it took way too much time on larger ones. I wrote the code in Java because it is a language I know by heart, and I have not coded in python before.

Report message to a moderator

Previous Topic: "message pane" scraper
Next Topic: Stars Core Engine
Goto Forum:
  


Current Time: Fri Mar 29 04:37:16 EDT 2024