I'm trying to wean my bot off of external DLLs a bit more, and in doing so, I would like to hash CDKeys and Passwords locally in VB. Right now I'm using BNCSutil (which does a wonderful job, btw), but I'd really like to be able to do it internally. Can someone point me towards what I need to have? I know I need a Broken SHA-1 function, and some outline on how to hash and double-hash. Any help would be much appreciated.
Quote from: RealityRipple on September 16, 2006, 03:55 AM
I'm trying to wean my bot off of external DLLs a bit more, and in doing so, I would like to hash CDKeys and Passwords locally in VB. Right now I'm using BNCSutil (which does a wonderful job, btw), but I'd really like to be able to do it internally. Can someone point me towards what I need to have? I know I need a Broken SHA-1 function, and some outline on how to hash and double-hash. Any help would be much appreciated.
Unless there's a Bignum library for VB, I don't think you can.
http://www.vbcode.com/Asp/showzip.asp?ZipFile=http%3A%2F%2Fwww%2Evbcode%2Ecom%2Fcode%2FBigNum3002042002%2Ezip&theID=6141
Would that be of use?
Quote from: RealityRipple on September 16, 2006, 04:46 AM
http://www.vbcode.com/Asp/showzip.asp?ZipFile=http%3A%2F%2Fwww%2Evbcode%2Ecom%2Fcode%2FBigNum3002042002%2Ezip&theID=6141
Would that be of use?
Hrmm I believe that would work but you may want to get a second opinion, but when it comes to vb6 doing your hashing from the dll would be quicker then actually doing the hashing yourself....
I understand that. I just don't want to be so dependant on other files (seems like an oxymoron for a vb programmer). How do the games do it? is it a function built into the program, or is there a dll you can use like storm's MPQ functions?
Quote from: RealityRipple on September 16, 2006, 08:42 AM
I understand that. I just don't want to be so dependant on other files (seems like an oxymoron for a vb programmer). How do the games do it? is it a function built into the program, or is there a dll you can use like storm's MPQ functions?
Check out the source code of bnetauth.dll. It has the functions you are looking for. You should have atleast a basic knowledge of C/++ before trying to understand it.
well i highly doubt you'll be able to do the NLS functions in VB, but if you do manage that, and everything else, there is still the problem of CheckRevision() taking ~5 seconds in VB (and ~20 seconds for war3)
hmm... so in short it's really not worth it. I guess I'll stick to bncsutil for decoding and NLS. Thanks anyway, guys.
imho you should use all functions BNCSUtil has to offer, considering the fact that C++ code will execute faster than VB code no matter what.
unless it was really really poorly coded c++ code. ;\
I'm using Lord[nK]'s BNLib.dll to use the actual MPQ files to run checkrevision. Everything else is BNCSUtil based.
Quote from: RealityRipple on September 16, 2006, 09:27 PM
I'm using Lord[nK]'s BNLib.dll to use the actual MPQ files to run checkrevision. Everything else is BNCSUtil based.
Where is BNLib.dll located? Upload it ::)?
Quote from: heRo on September 16, 2006, 09:37 PM
Quote from: RealityRipple on September 16, 2006, 09:27 PM
I'm using Lord[nK]'s BNLib.dll to use the actual MPQ files to run checkrevision. Everything else is BNCSUtil based.
Where is BNLib.dll located? Upload it ::)?
the lib is awesome.
Quote
[7:56:10 PM] [BNET] Connecting...
[7:56:15 PM] [BNET] Connected!
[7:56:16 PM] [BNFTP] Connecting...
[7:56:20 PM] [BNFTP] Connected!
[7:56:20 PM] [BNFTP] Requesting ver-IX86-1.mpq...
[7:56:21 PM] [BNFTP] ver-IX86-1.mpq received!
[7:56:21 PM] Extracting CheckRevision library...
[7:56:21 PM] Library extracted!
[7:56:21 PM] [BNLib] Calling CheckRevision...
[7:56:21 PM] [BNLib] CheckRevision call succeeded!
[7:56:21 PM] [BNET] Sending version and CD-key check...
http://forum.valhallalegends.com/index.php?topic=15671.msg158208#msg158208
Thanks for the link, I kinda over looked that, I guess. Can't wait to try it.
If you want just the dll, it's in HDX's downloads folder on his site. I also made a nice icon for the dll if you want to put it somewhere on your programs. http://realityripple.com/Uploads/BNLib.ico
Someone's written a CheckRevision function in Visual Basic and got it to work. It CheckRevisioned StarCraft in 20 seconds. WarCraft III takes notably longer, I believe around three times as long, using C code. So, it'd be impractical to do it in VB in a bot you actually use (bragging rights, of course, are worth going for).
O.O... that's insanely long. What kind of processor was that recorded on?
Ah, come to think of it, I can't say I know. My computer is personally a 2.8GHz single-core P4 and I notice slowdowns with VB math-intensive things. Nothing near 20 seconds with the CheckRevision work I did, but it never even neared completion, so whatever.
Your best bet if you are hell-bent on being non-dependant on a library would be to download and extract ver-IX86-X.dll and run it, but be prepared for memory leaks (apparently around 24MB each run, ow) and some hard work. BNFTP is pretty easy -- I implemented automatic download and display of PCX ads in JBBE (lost the code, unfortunately), but MPQ seems to be quite complicated, perhaps moreso than running the DLL itself.
I already do that to run CheckRevision. But I was looking for how to do cdkey and password hashing in vb. If it's really that bad, though, I'll keep using BNCSutil instead (with the checkrevision through BNLib).
Quote from: Joex86] link=topic=15718.msg158371#msg158371 date=1158583973]
Someone's written a CheckRevision function in Visual Basic and got it to work.
Who?
I don't know. Hdx, maybe, l2k-Shadow. Both are pretty good programmers and I'm sure they'd have optimised it reasonably.
RealityRipple, how well can you read Java? For XSHA1 you should port this (http://www.javaop.com/javaop2/src/BNetLogin/src/password/BrokenSHA1.java) (dependant on this (http://www.javaop.com/javaop2/src/BNetLogin/src/password/ByteFromIntArray.java) and this (http://www.javaop.com/javaop2/src/BNetLogin/src/password/IntFromByteArray.java), and expanded for double-hashing by this (http://www.javaop.com/javaop2/src/BNetLogin/src/password/DoubleHash.java)), and for CDKey hashing use this (http://www.javaop.com/javaop2/src/BNetLogin/src/cdkey/CDKeyDecode.java), which is also expanded for 16-char alpha keys (http://www.javaop.com/javaop2/src/BNetLogin/src/cdkey/AlphaKeyDecode.java) and WarCraft III keys (http://www.javaop.com/javaop2/src/BNetLogin/src/cdkey/War3Decode.java). Also, iago's implementation of CheckRevision (http://www.javaop.com/javaop2/src/BNetLogin/src/versioning/CheckRevision.java), but with the new version string formats it always reverts to it's slower checking (at least, when they don't by chance send the formula in A B C order, about a one of nine chance). Also, it's not updated for the new file padding.
EDIT -
I forgot to mention that CheckRevision's slowness was from VB's poor handling of I/O, apparently, and not math, so CD-Keys and hashing should be much faster (note, faster, not fast :P).
Quote from: Joex86] link=topic=15718.msg158477#msg158477 date=1158708096]
I don't know. Hdx, maybe, l2k-Shadow. Both are pretty good programmers and I'm sure they'd have optimised it reasonably.
/me raises hand.
It sucked horrably, I deleted it after i finished it.
also http://jbls.org/CheckRevision.java
Supports the new format, w/o reverting to the Slower CRev.
Andy, what you COULD do is stop useing VB. And learn a better language.
~-~(HDX)~-~
I wrote a CheckRevision class in VB 6 about a year ago but it worked rougly 50% of the time due to the lovely limitation of no unsigned variables in VB, it was also very very slow, I ended up trashing it with much enthusiasm.
Quote from: l2k-Shadow on September 19, 2006, 10:42 PM
I wrote a CheckRevision class in VB 6 about a year ago but it worked rougly 50% of the time due to the lovely limitation of no unsigned variables in VB, it was also very very slow, I ended up trashing it with much enthusiasm.
A mess of strings, copymemory, and an array of longs should solve all your problems. :)
:( stop insulting vb so much. I've learned or tried many other languages, and te BASIC series is just the one I'm comfortable with. It feels like it's my native language. I'm not switching (though I may move to REALbasic some day). I'll continue to use BNCSutil because it's good, fast, and easy.
Quote from: Joex86] link=topic=15718.msg158502#msg158502 date=1158753164]
Quote from: l2k-Shadow on September 19, 2006, 10:42 PM
I wrote a CheckRevision class in VB 6 about a year ago but it worked rougly 50% of the time due to the lovely limitation of no unsigned variables in VB, it was also very very slow, I ended up trashing it with much enthusiasm.
A mess of strings, copymemory, and an array of longs should solve all your problems. :)
ya and have fun doing all that work especially for the fact that the values are now 64bit.
Quote from: RealityRipple on September 20, 2006, 07:43 AM
:( stop insulting vb so much. I've learned or tried many other languages, and te BASIC series is just the one I'm comfortable with. It feels like it's my native language. I'm not switching (though I may move to REALbasic some day). I'll continue to use BNCSutil because it's good, fast, and easy.
VB is an amazing language, the problem with it is that the limitations just aren't worth it that much.. there are certain things that you just sometimes need in your projects that are extremely difficult in VB or just not at all possible, BUT if you can manage to write .dlls in other languages to surpass those limitations than yeah, you get rid of the limitation problem... Now all you have to deal with is slowness, and unless you're coding like an engine or something intensive as such, yay for VB :D