Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: OuTLawZGoSu on February 24, 2004, 10:55 PM

Title: Profile help
Post by: OuTLawZGoSu on February 24, 2004, 10:55 PM

'TCPConnections (Module)

Public Sub Profile(Data As String)
On Error Resume Next
Dim x As Integer
Dim ProfileEnd As String
    Dim SplitProfile As Variant
    Dim splt() As String
    ProfileEnd = Mid(Data, 17, Len(Data))
    SplitProfile = Split(ProfileEnd, Chr(&H0))
    splt() = Split(SplitProfile(3), vbCrLf)
    'SplitProfile (0) 'name
   '' form2.txtSex.text = SplitProfile(1)  'sex
  ''  form2.txtLocation.text = SplitProfile(2)  'location
   '' form2.txtDescription.text = SplitProfile(3)  'description
'     Form1.AddC vbRed, "Sex: " & SplitProfile(1)
'     Form1.AddC vbRed, "Location: " & SplitProfile(2)
'     Form1.AddC vbRed, "Description: " & SplitProfile(3)
''form2.UserToProfile = SplitProfile(0)
    fprofile.txtSex.Text = SplitProfile(1)
    fprofile.txtLocation.Text = SplitProfile(2)
    fprofile.txtDescription.Text = SplitProfile(3)

fprofile.Visible = True
     End Sub

Public Sub RequestProfile(strUser As String)
On Error Resume Next
PBuffer.InsertDWORD 1
PBuffer.InsertDWORD 4
PBuffer.InsertDWORD &H45
PBuffer.InsertNTString strUser
PBuffer.InsertNTString "System\strUser"
PBuffer.InsertNTString "system\Last Logon"
PBuffer.InsertNTString "system\Account Expires"
PBuffer.InsertNTString "system\Time Logged"
PBuffer.InsertNTString "system\Last Logoff"
PBuffer.sendPacket &H26
End Sub

Public Sub setprofile(Info As String, Data As String)

   PBuffer.InsertDWORD 1
   PBuffer.InsertDWORD 1
   PBuffer.InsertBYTE 0
   PBuffer.InsertNTString "profile\age"
   PBuffer.InsertNTString Data
   PBuffer.sendPacket &H27
End Sub

'_____________________________

'This, I put in a manual command, like stealthbot has.

If Left(text1.Text, 8) = "/profile" Then
   Dim whoProfile As String
   whoProfile = Mid(text1.Text, InStr(text1.Text, "e") + 2)
   fprofile.Caption = whoProfile
   fprofile.txtname = whoProfile & "'s Profile"
   PBuffer.InsertDWORD 1
   PBuffer.InsertDWORD 4
   PBuffer.InsertDWORD &H405
   PBuffer.InsertNTString whoProfile
   PBuffer.InsertNTString "Profile\Age"
   PBuffer.InsertNTString "Profile\Sex"
   PBuffer.InsertNTString "Profile\Location"
   PBuffer.InsertNTString "Profile\Description"
   PBuffer.sendPacket &H26
   text1.Text = ""



I cant figure out why this keeps disconnecting me.
Title: Re:Profile help
Post by: Eric on February 24, 2004, 11:30 PM
QuotePublic Sub RequestProfile(strUser As String)
On Error Resume Next
PBuffer.InsertDWORD 1
PBuffer.InsertDWORD 4
PBuffer.InsertDWORD &H45
PBuffer.InsertNTString strUser
PBuffer.InsertNTString "System\strUser"
PBuffer.InsertNTString "system\Last Logon"
PBuffer.InsertNTString "system\Account Expires"
PBuffer.InsertNTString "system\Time Logged"
PBuffer.InsertNTString "system\Last Logoff"
PBuffer.sendPacket &H26
End Sub

The second DWORD of 0x26 should contain how many profile keys you are requesting, you said that there were 4 keys being requested, but in reality, there were 5 keys being requested.
Also: System\Account Expires is not a valid profile key, but currently Battle.net does not disconnect and/or IPBan you for sending invalid profile keys.
Title: Re:Profile help
Post by: Zakath on February 24, 2004, 11:51 PM
Quote from: LoRd[nK] on February 24, 2004, 11:30 PM
QuotePublic Sub RequestProfile(strUser As String)
On Error Resume Next
PBuffer.InsertDWORD 1
PBuffer.InsertDWORD 4
PBuffer.InsertDWORD &H45
PBuffer.InsertNTString strUser
PBuffer.InsertNTString "System\strUser"
PBuffer.InsertNTString "system\Last Logon"
PBuffer.InsertNTString "system\Account Expires"
PBuffer.InsertNTString "system\Time Logged"
PBuffer.InsertNTString "system\Last Logoff"
PBuffer.sendPacket &H26
End Sub

The second DWORD of 0x26 should contain how many profile keys you are requesting, you said that there were 4 keys being requested, but in reality, there were 5 keys being requested.
Also: System\Account Expires is not a valid profile key, but currently Battle.net does not disconnect and/or IPBan you for sending invalid profile keys.

System\strUser is also not a valid key. The one you're looking for is System\Username.

And incidentally, why are you hardcoding all profile request IDs to be 0x45? Seems to me like that would make it difficult to figure out which person's profile you've got if you had multiple pending profile responses.
Title: Re:Profile help
Post by: OuTLawZGoSu on February 25, 2004, 08:47 AM
My firend put in this code in my project. It worked fine untill I modfied some of the code in my project with out testing it out. ( Didn't have my dsl then.)
I think I edited something that I sholdnt of had.

PS:

Is there a better code you might put up here, or help me wit?
I dont know shit about Editing, Receiving profiles.
Title: Re:Profile help
Post by: Eric on February 25, 2004, 01:08 PM
Quote
Packet ID: 0x26
Direction: Client -> Server (Sent)
Format:
Help (DWORD)       Number of Accounts
(DWORD)       Number of Keys
(DWORD)       Request ID
(STRING[])    Requested Accounts
(STRING[])    Requested Keys
Remarks: Requests an extended profile.

Some profile keys - this is not an exhaustive list:

profile\sex
profile\age
profile\location
profile\description
record\GAME\0\wins
record\GAME\0\losses
record\GAME\0\disconnects
record\GAME\0\last GAME
record\GAME\0\last GAME result
record\GAME\1\wins
record\GAME\1\losses
record\GAME\1\disconnects
record\GAME\1\last game
record\GAME\1\last game result
record\GAME\1\rating
record\GAME\1\high rating
record\GAME\1\rank
record\GAME\1\high rank

Packet ID: 0x26
Direction: Server -> Client (Received)
Format:
Help (DWORD)       Number of accounts
(DWORD)       Number of keys
(DWORD)       Request ID
(STRING[])    Requested Key Values
Remarks: Contains profile information as requested in C->S 0x26.
Title: Re:Profile help
Post by: FuzZ on February 26, 2004, 05:20 PM
Quote from: OuTLawZGoSu on February 24, 2004, 10:55 PM
PBuffer.InsertDWORD 1
PBuffer.InsertDWORD 4
PBuffer.InsertDWORD &H405
PBuffer.InsertNTString whoProfile
PBuffer.InsertNTString "Profile\Age"
PBuffer.InsertNTString "Profile\Sex"
PBuffer.InsertNTString "Profile\Location"
PBuffer.InsertNTString "Profile\Description"
PBuffer.sendPacket &H26
Notice the "PBuffer.InsertDWORD &H405"

Maybe that's contributing to the problem?

:EDIT: My mistake.
Title: Re:Profile help
Post by: Eric on February 26, 2004, 05:48 PM
Quote from: FuzZ on February 26, 2004, 05:20 PM
Quote from: OuTLawZGoSu on February 24, 2004, 10:55 PM
PBuffer.InsertDWORD 1
PBuffer.InsertDWORD 4
PBuffer.InsertDWORD &H405
PBuffer.InsertNTString whoProfile
PBuffer.InsertNTString "Profile\Age"
PBuffer.InsertNTString "Profile\Sex"
PBuffer.InsertNTString "Profile\Location"
PBuffer.InsertNTString "Profile\Description"
PBuffer.sendPacket &H26
Notice the "PBuffer.InsertDWORD &H405"

Maybe that's contributing to the problem?

The token can be anything, Battle.net will just reply with the same token back. The token is used to help identify one profile from another in multiple requests, as Zakath stated.
Title: Re:Profile help
Post by: OuTLawZGoSu on February 27, 2004, 08:30 AM
Aight, I found the problem.

Where it shows:

fprofile.Caption = whoProfile
fprofile.txtname = whoProfile & "'s Profile"


It should be fprofile.txtname.Caption = whoProfile & "'s Profile"

Thats why I kept on gettin disonnected
Title: Re:Profile help
Post by: Eric on February 27, 2004, 10:06 AM
Quote from: OuTLawZGoSu on February 27, 2004, 08:30 AM
Aight, I found the problem.

Where it shows:

fprofile.Caption = whoProfile
fprofile.txtname = whoProfile & "'s Profile"


It should be fprofile.txtname.Caption = whoProfile & "'s Profile"

Thats why I kept on gettin disonnected

That makes no sense, but ok!
Title: Re:Profile help
Post by: Networks on March 01, 2004, 10:21 AM
Where would u add the system keys to:

Packet ID: 0x26
Direction: Client -> Server (Sent)
Format:
Help (DWORD)       Number of Accounts
(DWORD)       Number of Keys
(DWORD)       Request ID
(STRING[])    Requested Accounts
(STRING[])    Requested Keys
Remarks: Requests an extended profile.

Some profile keys - this is not an exhaustive list:

profile\sex
profile\age
profile\location
profile\description
record\GAME\0\wins
record\GAME\0\losses
record\GAME\0\disconnects
record\GAME\0\last GAME
record\GAME\0\last GAME result
record\GAME\1\wins
record\GAME\1\losses
record\GAME\1\disconnects
record\GAME\1\last game
record\GAME\1\last game result
record\GAME\1\rating
record\GAME\1\high rating
record\GAME\1\rank
record\GAME\1\high rank

Packet ID: 0x26
Direction: Server -> Client (Received)
Format:
Help (DWORD)       Number of accounts
(DWORD)       Number of keys
(DWORD)       Request ID
(STRING[])    Requested Key Values
Remarks: Contains profile information as requested in C->S 0x26.


Also I having trouble be able to split the system keys so that I can parse it correctly which I also am having trouble with any help with that?
Title: Re:Profile help
Post by: UserLoser. on March 01, 2004, 08:03 PM
Quote from: Networks on March 01, 2004, 10:21 AM
Where would u add the system keys to:

Whereever you want
Title: Re:Profile help
Post by: Eric on March 01, 2004, 08:17 PM
Quote from: UserLoser. on March 01, 2004, 08:03 PM
Quote from: Networks on March 01, 2004, 10:21 AM
Where would u add the system keys to:

Whereever you want

Keep in mind that the keys are returned in the order that they are requested in.
Title: Re:Profile help
Post by: UserLoser. on March 01, 2004, 08:25 PM
Quote from: LoRd[nK] on March 01, 2004, 08:17 PM
Quote from: UserLoser. on March 01, 2004, 08:03 PM
Quote from: Networks on March 01, 2004, 10:21 AM
Where would u add the system keys to:

Whereever you want

Keep in mind that the keys are returned in the order that they are requested in.

I don't understand what that has to do with putting them in whatever order you want
Title: Re:Profile help
Post by: CrAz3D on March 10, 2004, 08:36 AM
I know I'm somewhat reviving a dead topic here, but it is still on topic.
VB6

When I request my keys, whether it be:
   PacketBuf.InsertNTString "System\Username"
   PacketBuf.InsertNTString "System\Account Created"
   PacketBuf.InsertNTString "System\Last Logon"
   PacketBuf.InsertNTString "System\Last Logoff"
   PacketBuf.InsertNTString "System\Time Logged"

or
   PacketBuf.InsertNTString "profile\sex"
   PacketBuf.InsertNTString "profile\age"
   PacketBuf.InsertNTString "profile\location"
   PacketBuf.InsertNTString "profile\description"

They are return in the order that I sent them, but not in the order that they Split().

IE:
Quote'[6:41:54 PM] 2 29608520 1681102539     created
'[6:41:54 PM] 3 29623872 3218976033         logon
'[6:41:54 PM] 4 29623863 3142340068         log off
'[6:41:54 PM] 5 97642                       time logged
Today is being returned as:
Quote
[7:33:35 AM] 4 29622090 1673424946               created
[7:33:35 AM] 5 29623980 2731395027               logon
[7:33:35 AM] 6 29623979 2869513927               logoff
[7:33:35 AM] 7 509            time logged
The index of the order in the string as each is returned is infront of the rest for the string.  Is there a way to display the Profile info with trying to display SplitProfile(4)?


EDIT:Forgot Splitting code

   For i = 1 To UBound(SplitProfile)
       If i = 3 Then
           SPP = Split(SplitProfile(3), " ")
           FT.dwHighDateTime = SPP(0)
           FT.dwLowDateTime = SPP(1)
           Call FileTimeToLocalFileTime(FT, FT)
           Call FileTimeToSystemTime(FT, st)
           TIMEO = st.wHour & ":" & st.wMinute & ":" & st.wSecond
           TIMEO = Format(TIMEO, "hh:mm:ss ampm")
           AddChat vbGreen, "Account Created: ", vbCrLf & &HC0C000, st.wMonth & "/" & st.wDay & "/" & st.wYear, vbCrLf & vbRed, " @ ", vbCrLf & &HC0C000, TIMEO
       ElseIf i = 4 Then
           SPP = Split(SplitProfile(4), " ")
           FT.dwHighDateTime = SPP(0)
           FT.dwLowDateTime = SPP(1)
           Call FileTimeToLocalFileTime(FT, FT)
           Call FileTimeToSystemTime(FT, st)
           TIMEO = st.wHour & ":" & st.wMinute & ":" & st.wSecond
           TIMEO = Format(TIMEO, "hh:mm:ss ampm")
           AddChat vbGreen, "Last Logon: ", vbCrLf & &HC0C000, st.wMonth & "/" & st.wDay & "/" & st.wYear, vbCrLf & vbRed, " @ ", vbCrLf & &HC0C000, TIMEO
       ElseIf i = 5 Then
           SPP = Split(SplitProfile(5), " ")
           FT.dwHighDateTime = SPP(0)
           FT.dwLowDateTime = SPP(1)
           Call FileTimeToLocalFileTime(FT, FT)
           Call FileTimeToSystemTime(FT, st)
           TIMEO = st.wHour & ":" & st.wMinute & ":" & st.wSecond
           TIMEO = Format(TIMEO, "hh:mm:ss ampm")
           AddChat vbGreen, "Last Log Off: ", vbCrLf & &HC0C000, st.wMonth & "/" & st.wDay & "/" & st.wYear, vbCrLf & vbRed, " @ ", vbCrLf & &HC0C000, TIMEO
       ElseIf i = 6 Then
           AddChat vbGreen, "Time Logged: ", vbCrLf & &HC0C000, ConvertTime(SplitProfile(6) * 1000)
       End If
   Next i
Title: Re:Profile help
Post by: Networks on March 10, 2004, 08:46 AM
Crazed how did you parse them so that you were able to use the addchat function. I cant figure that out. I can't even get to that step can anyone show the light?
Title: Re:Profile help
Post by: CrAz3D on March 10, 2004, 08:55 AM
FILTTIME & SYSTEMTIME
Once you put in the proper declares & types do:
Dim FT as New FILETIME, ST as New SystemTime
FT.dwHighDate = *the highdate*
FT.dwLowDate = *low date*
call FileTimeToLocalFileTime(FT, FT)
call FileTimeToSystemTime(FT, ST)

And there you go.  Then just look @ what is NOW in ST.

How do I parse the Profile Return better though?
Title: Re:Profile help
Post by: UserLoser. on March 10, 2004, 07:00 PM
Quote
IE:
Quote:
'[6:41:54 PM] 2 29608520 1681102539    created
'[6:41:54 PM] 3 29623872 3218976033        logon
'[6:41:54 PM] 4 29623863 3142340068        log off
'[6:41:54 PM] 5 97642                      time logged

Today is being returned as:
Quote:
[7:33:35 AM] 4 29622090 1673424946              created
[7:33:35 AM] 5 29623980 2731395027              logon
[7:33:35 AM] 6 29623979 2869513927              logoff
[7:33:35 AM] 7 509            time logged


That's not a very good example, showing two different accounts when saying here's the difference between yesterday and today
Title: Re:Profile help
Post by: CrAz3D on March 10, 2004, 08:09 PM
Ok, I'll make sure next time...it probably could've ME some somewhere.

ANSWER:
http://forum.valhallalegends.com/phpbbs/index.php?board=31;action=display;threadid=5712 (http://forum.valhallalegends.com/phpbbs/index.php?board=31;action=display;threadid=5712)