• Welcome to Valhalla Legends Archive.
 

[MBNCSUtil] LoginProof

Started by Homerlan, October 19, 2007, 05:38 PM

Previous topic - Next topic

Homerlan

I am currently developing a C# bot using MBNCSUtil library.

Unfortunately, I'm stuck in calling LoginProof method. Actually, my problem is exactly the one described in this topic. I got a "nullReferenceException" when calling this method with valid arguments and after "LoginAccount" method call as stated in the documentation.

Here's a simplified overview of how I proceed ("A", "B" and "salt" are byte[] typed and read from the previous received packets):
_nls = new NLS(_username, _password);
                       
byte[] A = new byte[33 + _username.Length];
_nls.LoginAccount(A, 0, A.Length);
_nls.LoginProof(M1, 0, 20, salt, B); // nullReferenceException here


If I rebuild and use the library according to the change suggested by MyndFyre in the previously quoted topic, I get the problem about "k" in "CalculateM1" (same as the one also described in the quoted topic).

So, I'd like to know where is my mistake in these methods calls or find a way to bypass this to make it work :D

Thanks in advance for your help ;)

PS: I used different versions of MBNCSUtil (1.3.X and the two last Beta versions).

MyndFyre

The problem is with MBNCSUtil itself.  You can download the code from the old documentation page located here to recompile it.  The problem can be fixed in one of two places:

The better place to do it is in the BigInteger class, in overloaded operator==.  Correct code is in the current beta of MBNCSUtil; you can see it here, line 722.  The alternative place to fix it is within the NLS class - do a search for "== null".  Any instances of BigInteger compared to null will generate this exception.  Replace these comparisons with object.ReferenceEquals(instanceName, null).

The preferred method is the former one - correct the operator==.  Or, use a newer version of MBNCSUtil.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Homerlan

Thanks for your reply ;)

Indeed, the correction is in the latest Beta versions (I was still including Reference of the 1.3.x version instead of Beta version actually ;D).

So, my problem changed: in this code from CalculateM1:
byte[] even_hash = s_sha.ComputeHash(even_s);
byte[] odds_hash = s_sha.ComputeHash(odds_s);
byte[] local_k = new byte[bytes_s.Length];
           
for (int i = 0; i < k.Length; i++)

Here, an exception is raised, "k" variable is "null". I just checked every occurrence of this variable in NLS class and I can't find any initializations of it.
Any ideas ? ???

MyndFyre

Which version of 1.3 are you using?  I believe there were 1.3.0.6, 1.3.1.7, 1.3.1.8.  Each of these contains fixes for issues found later.

I believe I've corrected this issue once (I'd hate to see that I had regression), but I need to know which version specifically you're using.

The QFE number is incremented at every release - that's the last number in the version string.  The build number (the third item) is increased whenever a major fix or change is made (the current beta was incremented to 3 because it implemented lockdown since the original beta; the build was increased to 1 each when I implemented ver-IX86-x.dll checking).  The minor version is changed when I add new features and classes.  The major version is now changed because of major architectural changes.

So as you might imagine, the small version numbers are very important in this case.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Homerlan

#4
Sorry for not being enough clear: for my last post (about raised exception on "k"), I was using 2.0.3.16 BETA 1 which seems to be the newest.
Should I use another one ?

MyndFyre

Ahh, now I see what you're saying.

I don't have time to correct this right now.  I have, however, set the timeline for the next release to be 10/28 - over the next week, I'll be updating the code in Subversion.  If you correct it, you're welcome to submit a .patch - I'd welcome the help - or, you can simply wait on it.  At the moment, I don't have time to determine the right way to solve it.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

leax

i had the same problem back then, if u want a work around for now, just get the NLS class from JavaOP which is open sourced, compile it in J# into a dll and use that for the fix, its basically fix the calculateM1 function
Warcarft3 Custom Game Host Bot Development
http://www.codelain.com

Homerlan

Quote from: MyndFyre[vL] on October 20, 2007, 09:53 PM
Ahh, now I see what you're saying.

I don't have time to correct this right now.  I have, however, set the timeline for the next release to be 10/28 - over the next week, I'll be updating the code in Subversion.  If you correct it, you're welcome to submit a .patch - I'd welcome the help - or, you can simply wait on it.  At the moment, I don't have time to determine the right way to solve it.
Okay, take your time :)

By the way, I basically tried to initialize "k" variable with a byte[40] (then filled with the two hashes of 20 bytes long) and I got a "Wrong password" error from Battle.net. So, there might be something else than this single initialization but I think you know it better than I do ^^

Thanks Leax for the tip, I'm gonna try to see with JavaOp NLS class :)

iNsaNe

I've had the exact same problems as you Homerlan. You're better off just using bnls

MyndFyre

Quote from: iNsaNe on October 21, 2007, 09:14 PM
I've had the exact same problems as you Homerlan.

Ever consider using the "Send Comments" link?  Can't fix problems if I'm not aware of them....
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

iNsaNe

I was the one who made you aware of this error in the first place... this was a few months ago

leax

Warcarft3 Custom Game Host Bot Development
http://www.codelain.com