• Welcome to Valhalla Legends Archive.
 

SCGP Client (VB6 Open Source)

Started by Ringo, November 03, 2008, 08:20 AM

Previous topic - Next topic
|

Mystical

Quote from: Ribose on January 12, 2009, 12:20 AM
Quote from: Ringo on January 11, 2009, 05:10 PM
Quote from: MyStiCaL on January 11, 2009, 04:35 PMYuck, now here comes a load bot ^ nes
heh yeah, thought it might be with a name like that :P
gonner take him a long time to figger out how to get it working for multiple connects at once :P
Fun times.
Converting it to C# almost unavoidably made it easy to use the class multiple times (there are not "modules" like there are in VB6, instead use a class), besides the part that I already had all of the RC4 and init with seed done from the first Warden work-around. :)

I really can't understand what the point of having Warden support for a load bot serves anyway. You're connected for less than two minutes...

well, vb6 has classes to and load bots are ment to be kept up for hours, days, somtimes weeks. the purpose of them was to keep channels full.

PunK

So when building 0x51, you have to use SHA1 to hash the first 4 bytes of the cdkeyhash?

Ribose

Quote from: PunK on January 13, 2009, 05:24 PM
So when building 0x51, you have to use SHA1 to hash the first 4 bytes of the cdkeyhash?
No, just take the computed hash for the CD-key.
For example, if you're using MBNCSUtil, you'd take the byte[] from [CdKey (instance)].GetHash([clientToken], [serverToken]) and the first four bytes in that array go straight into the WardenHandler's constructor, which (in my code) passes it through the WardenRandom struct then into the encryptor and decryptor with the WardenRandom data.
~Ribose

PunK

#48
Alright, I am pretty sure that I am generating the seed correctly now. What I find weird now is that it's not even replying to 0x5E. I pass the data into the handler when I receive 0x5E but I don't see any data being sent back. I don't get an error either. So I am stumped. I don't see any modules being downloaded either.

=x

--edit

So I fixed my problem. It's all good now. Thanks Ringo. Good job!

Paladin

So...now these are the last things I got in my debug box:

500 Of 17072
1000 Of 17072
2514 Of 17072


Why would it stop there?
I know that I'm generating my seed correctly.

What's wrong?

Ringo

Quote from: Paladin on January 14, 2009, 08:08 AM
So...now these are the last things I got in my debug box:

500 Of 17072
1000 Of 17072
2514 Of 17072


Why would it stop there?
I know that I'm generating my seed correctly.

What's wrong?
I'm going to take a wild guess, that you're not buffering split TCP packets correctly, not acounting for a brake in the TCP stream will also screw up/desynq the rc4 keys, since data that should of been decrypted, was lost.
See modBNET.OnBNETData()

xpeh

Wow n1ce! Probably the first starcraft game bot ever.

It's very simple, but it works :)

1. Can you make PvPGN support? It's a little different. Main difference is checkrevision, it's much easier than for bnet, you only have to take some constants from versioncheck.conf file instead of bnls. I can explain more if you agree.

2. How do you process unicode chat? The chat on server uses "unicode" - yes, it's not real unicode. It's cp1252 -> utf8 translation, and it's only seems like unicode for cp1252 (west european codepage), for any other codepage you'll get crap.
The in-lobby chat uses AFAIK ascii.

Barabajagal

StrToUTF will convert text you want to send to the server to UTF-8, UTFToStr will convert text from the server.
As for PvPGN, I don't think anyone on this site cares about it. We all tend to be strictly BNet dev if we're dealing with BNCS at all.

Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, lpUsedDefaultChar As Long) As Long

Public Function StrToUTF(ByVal sStr As String) As String
  If LenB(sStr) = 0 Then Exit Function
  StrToUTF = TrimNull(StrConv(WToA(sStr), vbUnicode))
  Exit Function
End Function

Public Function UTFToStr(ByVal sUTF As String) As String
Dim sConv As String
  If LenB(sUTF) = 0 Then Exit Function
  sConv = WToA(sUTF, 0)
  UTFToStr = AToW(sConv)
End Function

Private Function AToW(ByVal st As String) As String
Dim stBuffer  As String
Dim cwch      As Long
Dim pwz       As Long
Dim pwzBuffer As Long
  pwz = StrPtr(st)
  cwch = MultiByteToWideChar(65001, 0&, pwz, -1, 0&, 0&)
  stBuffer = String$(cwch + 1, vbNullChar)
  pwzBuffer = StrPtr(stBuffer)
  cwch = MultiByteToWideChar(65001, 0&, pwz, -1, pwzBuffer, Len(stBuffer))
  AToW = Left$(stBuffer, cwch - 1)
End Function

Private Function WToA(ByVal st As String, Optional ByVal cpg As Long = 65001) As String
Dim stBuffer          As String
Dim cwch              As Long
Dim pwz               As Long
Dim pwzBuffer         As Long
  pwz = StrPtr(st)
  cwch = WideCharToMultiByte(cpg, 0&, pwz, -1, 0&, 0&, ByVal 0&, ByVal 0&)
  stBuffer = String$(cwch + 1, vbNullChar)
  pwzBuffer = StrPtr(stBuffer)
  cwch = WideCharToMultiByte(cpg, 0&, pwz, -1, pwzBuffer, Len(stBuffer), ByVal 0&, ByVal 0&)
  WToA = Left$(stBuffer, cwch - 1)
End Function

xpeh

As for PvPGN, you only have to take  exeinfostring, versionbyte, verstr, checksum from config instead of bnls server.

Just take a look at this file: http://svn.berlios.de/svnroot/repos/pvpgn/trunk/pvpgn/conf/versioncheck.conf.in

As for your utf code, i didnt see there any point to what codepage do you en-/decode from/to. Probably it is taken from local computer settings, but for starcraft it must always be cp1252. I didnt tested it for asian fonts.

Barabajagal

65001 (0xFDE9). Notice the cpg in WToA. I don't like using constants if they're only going to be used once or twice and never modified.

xpeh

I'm not a VB user, sry :) I dont know what 65001 means, but if your functions always use cp1252, you are on the rigth way.

Barabajagal

65001 is CP_UTF8. You're looking at the system backwards, methinks. 1252 is ANSI, not Unicode.

Ringo

Quote from: xpeh on January 14, 2009, 01:27 PM
Wow n1ce! Probably the first starcraft game bot ever.

It's very simple, but it works :)

1. Can you make PvPGN support? It's a little different. Main difference is checkrevision, it's much easier than for bnet, you only have to take some constants from versioncheck.conf file instead of bnls. I can explain more if you agree.

2. How do you process unicode chat? The chat on server uses "unicode" - yes, it's not real unicode. It's cp1252 -> utf8 translation, and it's only seems like unicode for cp1252 (west european codepage), for any other codepage you'll get crap.
The in-lobby chat uses AFAIK ascii.
Use a BNLS server that supports all types of checkrevison, not just lockdown.

xpeh

Quote from: Andy on January 14, 2009, 03:25 PM
65001 is CP_UTF8. You're looking at the system backwards, methinks. 1252 is ANSI, not Unicode.
Yes, i mean you must use cp1252 <-> UTF8 translation. Regardless of the current codepage on the computer. Did you do it?


Quote from: Ringo on January 14, 2009, 03:25 PM
Use a BNLS server that supports all types of checkrevison, not just lockdown.
For example? I'm not familiar with bnet stuff, local hashing always worked fine for me. But .conf file use were better since it dont need to use extra connections.

Barabajagal

Why would I convert it to something other than the computer's default CP? It's for display, not for sending to the server.

|