Valhalla Legends Forums Archive | Battle.net Bot Development | (socks4) NON NLS.dll Questions!!!!112

AuthorMessageTime
NetNX
YAY!, Non-NLS.dll questions!

[code]
Dim splt() As String, str As String, i As Integer
Server = LCase(Server)

splt = Split(Server, ".")
For i = 0 To UBound(splt)
str = str & Chr(CStr(splt(i)))
Next i

sckBnet.SendData Chr(&H4) & Chr(&H1) & Chr(&H17) & Chr(&HE0) & str & "anonymous" & Chr(&H0)
RaiseEvent ProxyInfo("Connected!")
[/code]

im trying to reverse this:

could someone explain to me

[code]Chr(&H4) & Chr(&H1) & Chr(&H17) & Chr(&HE0)[/code]

Thanks to baddblood for redirecting me to the socks4 protocol information page. I have figured out that somewhere within these for bytes it specifys the port #. it also says that the first and second byte... well look

[quote]
+----+----+----+----+----+----+----+----+----+----+....+----+
      | VN | CD | DSTPORT | DSTIP | USERID |NULL|
      +----+----+----+----+----+----+----+----+----+----+....+----+
# of bytes:    1 1 2 4 variable 1
[/quote]

VN = Chr(&H4)
CD = Chr(&H1)
DSPORT= ?!?! 'Remore port
DSTIP = Forwarding IPaddress
USERID = "anonymous"

What im trying to figure out is how 2 bytes turns into 6112(the battle.net port #)
September 25, 2004, 4:50 PM
St0rm.iD
Wow...and you say you've written a binary bot?

Hint: those two bytes are a WORD.
September 25, 2004, 5:00 PM
NetNX
yes i understand that?
September 25, 2004, 5:02 PM
shadypalm88
[quote author=NetNX link=board=17;threadid=8835;start=0#msg81965 date=1096131016]What im trying to figure out is how 2 bytes turns into 6112(the battle.net port #)[/quote]Umm....

2 bytes is just the size (i.e. in memory) of the number. In Visual Basic this is called an integer. In the protocol documentation I'm familiar with, this is called a WORD.

Surely if you're writing a bot in Visual Basic, you're using DM's packetbuffer or something similar, and know about .InsertWORD.

The only difference with this particular number (the port) is it must be converted to network byte order through a call to htons().

The declaration of this (just typing it in here) is:[code]Public Declare Function htons Lib "ws2_32.dll" (ByVal Number As Integer) As Integer[/code]Note: This may really be winsock2.dll or something similar, I don't quite remember.
September 25, 2004, 5:02 PM
NetNX
so your saying that if u do htons(6112) that is equal to Chr(&H17) & Chr(&HE0) ?
September 25, 2004, 5:06 PM
shadypalm88
[quote author=NetNX link=board=17;threadid=8835;start=0#msg81970 date=1096132005]
so your saying that if u do htons(6112) that is equal to Chr(&H17) & Chr(&HE0) ?
[/quote]By a quick check, yes. But that won't help you much when you try and put the IP in.

Note: My quick check follows (I didn't really have to use htons since this is a mac, but whatever).
[code]#include <stdio.h>
#include <machine/endian.h>

int main() {
printf("htons(6112) = 0x%X\n", htons(6112));
return 0;
}[/code][code]$ ./test
htons(6112) = 0x17E0[/code]
September 25, 2004, 5:16 PM
NetNX
well i got the ip part of it down
September 25, 2004, 5:21 PM
BaDDBLooD
This should be all you need

https://davnit.net/bnet/vL/phpbbs/index.php?board=17;action=display;threadid=8743
September 25, 2004, 5:22 PM
NetNX
alright i executed
[code]MsgBox htons(6112)[/code]
and i got the message box that says -8169
September 25, 2004, 5:26 PM
shadypalm88
[quote author=NetNX link=board=17;threadid=8835;start=0#msg81975 date=1096133197]
alright i executed
[code]MsgBox htons(6112)[/code]
and i got the message box that says -8169
[/quote]Your point is... what?
September 25, 2004, 5:28 PM

Search