Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: MyndFyre on November 04, 2007, 02:03 AM

Title: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 04, 2007, 02:03 AM
MBNCSUtil v2.0.4.17 (http://www.jinxbot.net/mbncsutil/) (Beta 2) has been uploaded.  This version addresses a number of bugs and adds a couple of new features.

The following is the list of updates in this release:
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: Homerlan on November 04, 2007, 12:59 PM
First of all, thank you for releasing this new version so fast.

I've spent couple of hours testing it. I've faced new problems. Thus, I'm trying to compare all the different computation steps with JavaOp SRP class.

First problem (in CalculateM1):
BigInteger local_S = ((s_modulus + local_B - verifier) % s_modulus);
local_S = local_S.ModPow((a + (u * x)), s_modulus);
byte[] bytes_s = local_S.GetBytes();

Here, bytes_s is 32-bytes long, so is local_k array (code below).

byte[] even_hash = s_sha.ComputeHash(even_s);
byte[] odds_hash = s_sha.ComputeHash(odds_s);
byte[] local_k = new byte[bytes_s.Length];

Hashing with SHA-1 returns a 20-bytes long array. So, even_hash and odds_hash are both 20-bytes long arrays.
But the loop following this code fills local_k (32-bytes long) alternatively with odds_hash & even_hash bytes : the loop stop condition is based on local_k length (32). So, the resulting array is a 32-bytes long array with 16 bytes from odds_hash and 16 bytes from even_hash.
Shouldn't it be a 40-bytes long array as a result?

PS: an exception is raised from CalculateM1 ("Index was outside the bounds of the array").

Second problem (in CalculateVerifier):
byte[] data2 = new byte[salt.Length + hash1.Length];
Array.Copy(salt, data2, salt.Length);
Array.Copy(data1, 0, data2, salt.Length, data1.Length);

In the third line, we can see a copy of data1 content that is actually "USERNAME:PASSWORD" string and not its hashed value. I think data1 has to be replaced by hash1 (hashed value of data1 string).

Currently, I didn't go further but I'll try to ;)
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 04, 2007, 01:58 PM
I think I'm just going to rewrite this from the SRP spec.  I'm sick of trying to patch it up. 

Ironically enough it uses the same naming conventions as my WoW auth (which does work).  So I wonder if I didn't copy stuff over.

Anyway, again I apologize.  I have not had the time to write a client to test this class, and I appreciate the updates.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: Chriso on November 04, 2007, 07:08 PM
My problem still exists:
if ((stream.Position + 65 + userNameAscii.Length) > stream.Length)
                throw new IOException(Resources.nlsAcctCreateSpace);

There is insufficient space in the data buffer for the account creation packet.

stream.Position==0, stream.Length==73, userNameAscii.Length==9

0 + 65 + 9 > 73

Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 04, 2007, 07:13 PM
Hm, I have a theory that it's line 375.  I'll look at it tonight or tomorrow.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 09, 2007, 12:51 AM
I've fixed the problem with logging in thanks to some help from Homerlan (it turned out I wasn't truncating the buffer, something that I struggled to find in my WoW SRP implementation too, as well as some other stuff). 

@Chriso: I've had mixed results with NLS.CreateAccount, so I'm not releasing a new DLL yet.  Good news is that there's no longer an exception being generated.  Bad news is that it appears that if you create an account it could send the wrong verifier in which case you're screwed.  However, the latest bits for NLS.cs as well as DataFormatter.cs and BigInteger.cs (which are needed) are in SVN.  You can get them out using the instructions on the MBNCSUtil website.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: Chriso on November 09, 2007, 06:13 AM
I see, thanks for the update.  I'll have a look at the repository later.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 09, 2007, 07:46 PM
@Chriso: I fixed CreateAccount.  It's in the repository, revision 18.  I'm not making a final release until I've fixed the last two functions (ValidateServerProof and ValidateServerSignature).
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 09, 2007, 08:25 PM
Corrected VerifyServerProof.  Checked in at revision 19.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on November 09, 2007, 09:30 PM
Corrected VerifyServerSignature.  Checked in at revision 20.  I'll make a build later this weekend.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: Chriso on November 10, 2007, 03:12 AM
Sweet, can't wait.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on December 04, 2007, 02:32 PM
Apparently my SVN URL has changed:

https://svn2.hosted-projects.com/robpaveza/mbncsutil/

I suggest going for the /trunk folder:

https://svn2.hosted-projects.com/robpaveza/mbncsutil/trunk/

The /branches/ folder has some utilities and testing tools, and the /releases/ folder has the .zip files I make.
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: Hell-Lord on December 04, 2007, 08:57 PM
Passworded?
Title: Re: MBNCSUtil v2.0.4.17 (Beta 2) Released
Post by: MyndFyre on December 05, 2007, 09:47 AM
As has always been the case, the username is mbncsutil_anonymous with no password.