Jump to content
Sign in to follow this  
Andreik

Connect to hub

Recommended Posts

Andreik

I want to connect to one hub, and write something in main chat but not using oDC, DC++ or other clients, I want to use my client written in AutoIt. But I need a little help with the protocol used by hub servers and clients. Just after I am connect to hub I get this:

$Lock EXTENDEDPROTOCOL_verlihub Pk=version0.9.8d|<Chelneritza> This Hub Is Running Version 0.9.8de min. 50° alcool  (Mon Mar 05 18:30 GMT 2007) of VerliHub [RunTime: 1weeks 1days ]. [Current User Count: 5131 ].|
<Chelneritza> This hub is enhanced by plugman for Verlihub.|

and after some time

<Chelneritza> Operation timeout (Key)|

Know anyone this protocol? I need a little help.

EDIT: I found this but I don't understand the conversion from $Lock to $Key

http://www.teamfair.info/DC-Protocol.htm#C...ClientHandShake

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
martin

I want to connect to one hub, and write something in main chat but not using oDC, DC++ or other clients, I want to use my client written in AutoIt. But I need a little help with the protocol used by hub servers and clients. Just after I am connect to hub I get this:

$Lock EXTENDEDPROTOCOL_verlihub Pk=version0.9.8d|<Chelneritza> This Hub Is Running Version 0.9.8de min. 50° alcool  (Mon Mar 05 18:30 GMT 2007) of VerliHub [RunTime: 1weeks 1days ]. [Current User Count: 5131 ].|
  <Chelneritza> This hub is enhanced by plugman for Verlihub.|

and after some time

<Chelneritza> Operation timeout (Key)|

Know anyone this protocol? I need a little help.

EDIT: I found this but I don't understand the conversion from $Lock to $Key

http://www.teamfair.info/DC-Protocol.htm#C...ClientHandShake

This is an attempt at the conversion but I've no idea if it's correct.

#cs
     Appendix A: Converting a Lock into a Key
 
     As part of the initial negotiation between the client and hub, the hub sends a $Lock <lock> Pk=<pk> command and the client must respond with a $Key <key> command. Until the DCN encoding, which we'll discuss last, the <key> has exactly as many characters as the <lock>.
 
     Except for the first, each key character is computed from the corresponding lock character and the one before it. If the first character has index 0 and the lock has a length of len then:
 #ce
;the lock you are given is $Givenlock
 $givenlock = "abc457t"
 $lock = StringSplit($GivenLock,"")
 Dim $key[$lock[0]]
 
;convert charcaters to ascii codes
 For $i = 1 to $lock[0]
     $lock[$i] = Asc($lock[$i])
   ;ConsoleWrite(hex($lock[$i],2) & @CRLF)
 Next
 
 For $i = 2 To $lock[0]
     $key[$i-1] = BitXor($lock[$i], $lock[$i - 1]);
   ;ConsoleWrite("" & $i - 1 & ">" & hex($key[$i-1],2) & @CRLF)
 Next
;The first key character is calculated from the first lock character and the last two lock characters:
 
 
 $key[0] = BitXor($lock[1], $lock[$lock[0] ], $lock[$lock[0] - 1], 5);CORRECTED HERE
;ConsoleWrite(hex($key[0],2) & @CRLF)
 
;Next, every character in the key must be nibble-swapped:
 For $i = 0 To $lock[0]-1
     $key[$i] = BitOR(BitAND(BitShift($key[$i], -4), 0xf0), BitAND(BitShift($key[$i], 4), 0x0f))
   ;ConsoleWrite("" & $i & "-->" & hex($key[$i],2) & @CRLF)
 Next
 
 
;Finally, the characters with the decimal ASCII values of 0, 5, 36, 96, 124, and 126 cannot be sent to the server. Each character with this value must be substituted with the string /%DCN000%/, /%DCN005%/, /%DCN036%/, /%DCN096%/, /%DCN124%/, or /%DCN126%/, respectively. The resulting string is the key to be sent to the server.
 $realKey = ""
 For $i = 0 To $lock[0]-1
 
     Switch $key[$i]
         Case 0, 5, 36, 96, 124, 126
             $realKey &= StringFormat("%%DCN%03d%%", $key[$i])
         Case Else
             $realKey &= Chr($key[$i])
     EndSwitch
 
 Next
 
 ConsoleWrite($realKey & @CRLF)

EDIT:CORRECTED $key[0] calculation.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Andreik

Thanks martin. I`ll try it.


When the words fail... music speaks

Share this post


Link to post
Share on other sites
Andreik

@martin

Work fine your example, this is a part of communication:

>Welcome to NetCom
>>Connecting to hub.bodega.ro on port 411
>>Connection...OK
<<$Lock EXTENDEDPROTOCOL_verlihub Pk=version0.9.8d|<Chelneritza> This Hub Is Running Version 0.9.8de min. 50° alcool  (Mon Mar 05 18:30 GMT 2007) of VerliHub [RunTime: 1weeks 1days ]. [Current User Count: 6469 ].|
<<<Chelneritza> This hub is enhanced by plugman for Verlihub.|
>>$Key uÑÀ° A ѱ±ÀÀ011qáPÑq|$ValidateNick Andreik|
<<$HubName   La Bodega cu Gratar - Nu e de competenta mea sa fac lumea asta mai buna, ia vorba asta de cacat asa cum suna |
<<$Hello Andreik|

The server answer me with $Hello Andreik, from documentation this mean that I`m logged in, but after some seconds(maybe 30s) server send me:

<<<Chelneritza> Operation timeout (Login)|
<<$ForceMove hub.bodega.ro|

When the words fail... music speaks

Share this post


Link to post
Share on other sites
martin

@martin

Work fine your example, this is a part of communication:

>Welcome to NetCom
 >>Connecting to hub.bodega.ro on port 411
 >>Connection...OK
 <<$Lock EXTENDEDPROTOCOL_verlihub Pk=version0.9.8d|<Chelneritza> This Hub Is Running Version 0.9.8de min. 50° alcool  (Mon Mar 05 18:30 GMT 2007) of VerliHub [RunTime: 1weeks 1days ]. [Current User Count: 6469 ].|
 <<<Chelneritza> This hub is enhanced by plugman for Verlihub.|
 >>$Key uÑÀ° A ѱ±ÀÀ01'1qáPÑq|$ValidateNick Andreik|
 <<$HubName   La Bodega cu Gratar - Nu e de competenta mea sa fac lumea asta mai buna, ia vorba asta de cacat asa cum suna |
 <<$Hello Andreik|

The server answer me with $Hello Andreik, from documentation this mean that I`m logged in, but after some seconds(maybe 30s) server send me:

<<<Chelneritza> Operation timeout (Login)|
 <<$ForceMove hub.bodega.ro|
I'm glad it worked Andreik. I can't help with the timeout problem though.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×