Misplaced Pages

Direct Client-to-Client: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 06:17, 20 January 2014 edit182.19.66.156 (talk) History← Previous edit Latest revision as of 05:56, 6 June 2024 edit undoJJMC89 bot III (talk | contribs)Bots, Administrators3,687,180 editsm Moving Category:Protocols related to Internet Relay Chat to Category:Protocols related to IRC per Misplaced Pages:Categories for discussion/Speedy 
(42 intermediate revisions by 34 users not shown)
Line 1: Line 1:
{{Short description|Protocol for file transfer and direct chat on Internet Relay Chat}}
{{overly detailed|date=August 2012}}
{{ref improve|date=August 2012}} {{Multiple issues|{{overly detailed|date=August 2012}}
{{more citations needed|date=August 2012}}}}
'''Direct Client-to-Client''' ('''DCC''') is an ]-related sub-protocol enabling ] to interconnect using an IRC server for ] in order to exchange files or perform non-relayed chats. Once established, a typical DCC session runs independently from the IRC server. Originally designed to be used with ] it is now supported by many ]. Some peer-to-peer clients on napster-protocol servers also have DCC send/get capability, including TekNap, SunshineUN and Lopster. A variation of the DCC protocol called SDCC (Secure Direct Client-to-Client), also known as DCC SCHAT supports ] connections. An ] on the use of DCC does not exist.

'''Direct Client-to-Client''' ('''DCC''') (originally '''Direct Client Connection'''<ref>{{Cite web |title=Open Source and Free Software |url=https://www.troy.rollo.name/opensource.html |url-status=dead |archive-url=https://web.archive.org/web/20181116085439/https://www.troy.rollo.name/opensource.html |archive-date=2018-11-16 |access-date=2018-11-15 |website=troy.rollo.name}}</ref><ref>{{Cite web |title=DCC negotiation and connection |url=http://www.kvirc.net/doc/doc_dcc_connection.html |website=kvric.net}}</ref><ref>{{Cite web|url=https://www.irchelp.org/protocol/ctcpspec.html|title=IRCHelp.org — The Client-To-Client Protocol (CTCP)|website=www.irchelp.org}}</ref>) is an ]-related sub-protocol enabling ] to interconnect using an IRC server for ] in order to exchange files or perform non-relayed chats. Once established, a typical DCC session runs independently from the IRC server. Originally designed to be used with ] it is now supported by many ]. Some peer-to-peer clients on napster-protocol servers also have DCC send/get capability, including TekNap, SunshineUN and Lopster. A variation of the DCC protocol called SDCC (Secure Direct Client-to-Client), also known as DCC SCHAT supports ] connections. An ] on the use of DCC does not exist.


DCC connections can be initiated in two different ways: DCC connections can be initiated in two different ways:
Line 11: Line 13:
| last = Piccard | last = Piccard
| first = Paul | first = Paul
| coauthors = Brian Baskin, George Spillman, Marcus Sachs |author2=Brian Baskin|author3=George Spillman|author4=Marcus Sachs
| title = Securing IM and P2P Applications for the Enterprise | title = Securing IM and P2P Applications for the Enterprise
| edition = 1st | edition = 1st
Line 20: Line 22:
| chapter = IRC Networks and Security | chapter = IRC Networks and Security
| quote = The authors of the ircII software package originally pioneered file transfers over IRC. | quote = The authors of the ircII software package originally pioneered file transfers over IRC.
}}</ref> The CTCP protocol was implemented by Michael Sandrof in 1990 for ircII version 2.1.<ref>See the 'NOTES' and 'source/ctcp.c' files included with </ref> The DCC protocol was implemented by Troy Rollo in 1991 for version 2.1.2,<ref>See the 'UPDATES' and 'source/dcc.c' files included with </ref> but was never intended to be portable to other IRC clients.<ref>{{cite newsgroup }}</ref> The CTCP protocol was implemented by Michael Sandrof in 1990 for ircII version 2.1.<ref>See the 'NOTES' and 'source/ctcp.c' files included with {{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}</ref> The DCC protocol was implemented by Troy Rollo in 1991 for version 2.1.2,<ref>See the 'UPDATES' and 'source/dcc.c' files included with {{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}</ref> but was never intended to be portable to other IRC clients.<ref>{{cite newsgroup
| title = /dcc | title = /dcc
| author osama bin laden | author = Troy Rollo
| date = January 20, 1993 | date = January 20, 1993
| newsgroup = indian mujahiddin | newsgroup = alt.irc
|message-id= 1993Jan20.222051.1484@usage.csd.unsw.OZ.AU

| url = https://groups.google.com/group/alt.irc/msg/fc5de46e023d5ffe
| id = 1993Jan20.222051.1484@usage.csd.unsw.OZ.AU
| access-date = November 10, 2010
| url = http://groups.google.com/group/alt.irc/msg/fc5de46e023d5ffe
| accessdate = November 10, 2010
}}</ref><ref>{{cite web }}</ref><ref>{{cite web
| url = http://www.irchelp.org/irchelp/rfc/dccspec.html | url = http://www.irchelp.org/irchelp/rfc/dccspec.html
| title = A description of the DCC protocol | title = A description of the DCC protocol
| accessdate = November 10, 2010 | access-date = November 10, 2010
| last = Rollo | last = Rollo
| first = Troy | first = Troy
| publisher = alkayda training camp | publisher = irchelp.org

| quote = The first comment I should make is that the DCC protocol was never designed to be portable to clients other than IRCII. As such I take no responsibility for it being difficult to implement for other clients. | quote = The first comment I should make is that the DCC protocol was never designed to be portable to clients other than IRCII. As such I take no responsibility for it being difficult to implement for other clients.
}}</ref> }}</ref>


==Common DCC applications== ==Common DCC applications==

===DCC CHAT=== ===DCC CHAT===
The CHAT service enables users to chat with each other over a DCC connection. The traffic will go directly between the users, and not over the IRC network. When compared to sending messages normally, this reduces IRC network load, allows sending of larger amounts of text at once, due to the lack of flood control, and makes the communication more secure by not exposing the message to the IRC servers (however, the message is still in ]). The CHAT service enables users to chat with each other over a DCC connection.<ref>{{Cite web |title=mIRC Help |url=https://www.mirc.com/help/html/index.html?dcc.html |access-date=2023-07-24 |website=www.mirc.com}}</ref> The traffic will go directly between the users, and not over the IRC network. When compared to sending messages normally, this reduces IRC network load, allows sending of larger amounts of text at once, due to the lack of flood control, and makes the communication more secure by not exposing the message to the IRC servers (however, the message is still in ]).


DCC CHAT is normally initiated using a ] handshake. The user wishing to establish the connection sends the following CTCP to the target: DCC CHAT is normally initiated using a ] handshake. The user wishing to establish the connection sends the following CTCP to the target, <code>DCC CHAT {{var|protocol}} {{var|ip}} {{var|port}}</code>, where {{var|ip}} and {{var|port}} are the IP address and port number of the sender, and are expressed as integers. {{var|protocol}} is {{mono|chat}} for standard DCC CHAT. The receiving party can then connect to the given port and IP address.
:<code><nowiki>DCC CHAT <protocol> <ip> <port></nowiki></code>
<ip> and <port> are those of the sender, and are expressed as integers. <protocol> is "chat" for standard DCC CHAT. The receiving party can then connect to the given port and address.


Once a connection is established, the protocol used for DCC CHAT is very simple: users exchange ]-terminated messages. Messages that begin with an ] 001 (control-A, represented below by '''^A''') and the word "ACTION", and are terminated by another ASCII 001, are interpreted as emotes: Once a connection is established, the protocol used for DCC CHAT is very simple: users exchange ]-terminated messages. Messages that begin with an ] 001 (control-A, represented below by {{mono|}}) and the word {{mono|ACTION}}, and are terminated by another ASCII {{mono|001}}, are interpreted as emotes: <code>ACTION waves goodbye</code>.
:<code>'''^A'''ACTION waves goodbye'''^A'''</code>


====DCC Whiteboard==== ====DCC Whiteboard====
This is an extension to DCC CHAT, allowing simple drawing commands to be sent as well as lines of text. DCC Whiteboard is initiated with a handshake similar to DCC CHAT, with the protocol "chat" replaced by "wboard": This is an extension to DCC CHAT, allowing simple drawing commands to be sent as well as lines of text. DCC Whiteboard is initiated with a handshake similar to DCC CHAT, with the protocol {{mono|chat}} replaced by {{mono|wboard}}:
:<code><nowiki>DCC CHAT wboard <ip> <port></nowiki></code> <code>DCC CHAT wboard {{var|ip}} {{var|port}}</code>.


Once the connection is established, the two clients exchange ]-terminated messages. Messages that begin (and optionally end) with ASCII 001 are interpreted as special commands; the command ACTION represents an emote, while others cause lines to be drawn on the user's whiteboard surface, or allow the two clients to negotiate a set of features. Once the connection is established, the two clients exchange ]-terminated messages. Messages that begin (and optionally end) with ASCII {{mono|001}} are interpreted as special commands; the command {{mono|ACTION}} represents an emote, while others cause lines to be drawn on the user's whiteboard surface, or allow the two clients to negotiate a set of features.


===DCC SEND {{anchor|DCC RESUME|DCC TSEND|DCC SEND T}} === ===DCC SEND {{anchor|DCC RESUME|DCC TSEND|DCC SEND T}} ===
The SEND service allows users to send files to one another. The original specification for the handshake did not allow the receiver to know the total file size nor to resume a transfer. This has made clients introduce their own extensions to the handshake, many of which have become widely supported. The SEND service allows users to send files to one another. The original specification for the handshake did not allow the receiver to know the total file size nor to resume a transfer. This has made clients introduce their own extensions to the handshake, many of which have become widely supported.


The original handshake consisted of the sender sending the following CTCP to the receiver: The original handshake consisted of the sender sending the following CTCP to the receiver: <code>DCC SEND {{var|filename}} {{var|ip}} {{var|port}}</code>.
:<code><nowiki>DCC SEND <filename> <ip> <port></nowiki></code>


As with DCC CHAT, <ip> and <port> are the ip address and port where the sending machine will be listening for an incoming connection. Some clients enclose filenames with spaces in double quotes. It is common practice to add the file size as a last argument: As with DCC CHAT, {{var|ip}} and {{var|port}} are the IP address and port where the sending machine will be listening for an incoming connection. Some clients enclose filenames with spaces in double quotes. It is common practice to add the file size as a last argument: <code>DCC SEND {{var|filename}} {{var|ip}} {{var|port}} {{var|filesize}}</code>.
:<code><nowiki>DCC SEND <filename> <ip> <port> <file size></nowiki></code>


At this point, the original specification had the receiver either connect to the given address and port and wait for data, or ignore the request, but for clients supporting the DCC RESUME extension, a third alternative is to ask the sender to skip part of the file by sending the CTCP reply: At this point, the original specification had the receiver either connect to the given address and port and wait for data, or ignore the request, but for clients supporting the DCC RESUME extension, a third alternative is to ask the sender to skip part of the file by sending the CTCP reply: <code>DCC RESUME {{var|filename}} {{var|port}} {{var|position}}</code>.
:<code><nowiki>DCC RESUME <filename> <port> <position></nowiki></code>


If the sending client supports DCC RESUME, it will reply with: If the sending client supports DCC RESUME, it will reply with, <code>DCC ACCEPT {{var|filename}} {{var|port}} {{var|position}}</code>, and the receiver can connect to the given address and port and listen for data to append to an already existing file.
:<code><nowiki>DCC ACCEPT <filename> <port> <position></nowiki></code>

and the receiver can connect to the given address and port and listen for data to append to an already existing file.


Data is sent to the client in blocks, each of which the client must acknowledge by sending the total number of bytes received in the form of a ] ] integer. This slows down connections and is redundant because of ]. The send-ahead extension relieves this problem somewhat by not waiting for the acknowledgements, but since the receiver still has to send them for every block it receives, in case the sender expects them, it is not solved completely. Data is sent to the client in blocks, each of which the client must acknowledge by sending the total number of bytes received in the form of a ] ] integer. This slows down connections and is redundant because of ]. The send-ahead extension relieves this problem somewhat by not waiting for the acknowledgements, but since the receiver still has to send them for every block it receives, in case the sender expects them, it is not solved completely.


Another extension, TDCC, or turbo DCC, removes the acknowledgements, but requires a slightly modified handshake and is not widely supported. Older versions of TDCC replaced the word SEND in the handshake with TSEND; later versions use the word SEND but append a "T" after the handshake, making this version of TSEND compatible with other clients (as long as they can parse the modified handshake). Another extension, TDCC, or turbo DCC, removes the acknowledgements, but requires a slightly modified handshake and is not widely supported. Older versions of TDCC replaced the word SEND in the handshake with TSEND; later versions use the word SEND but append a {{mono|T}} after the handshake, making this version of TSEND compatible with other clients (as long as they can parse the modified handshake).


====DCC SEND exploit==== ====DCC SEND exploit====
The DCC send exploit can refer to two bugs, a variant ] error in ] triggered by filenames longer than 14 characters<ref>{{cite web|url=http://www.securityfocus.com/bid/8880|title=SecurityFocus exploit information}}</ref> and an ] in some routers manufactured by ], ] and ], triggered by the use of port <tt>0</tt>.<ref>{{cite web|url=http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1068|title='DCC Send' vulnerability on Netgear routers}}</ref><ref>{{cite web|url=http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1067|title='DCC Send' vulnerability on Linksys routers}}</ref> The router exploit, in particular, may be triggered when the phrase '<tt>DCC SEND </tt>' followed by at least 6 characters without spaces or newlines appears anywhere in a ] stream on port 6667, not just when an actual DCC SEND request has been made. The "DCC send exploit" can refer to two bugs: a variant ] error in ] triggered by filenames longer than 14 characters,<ref>{{cite web|url=http://www.securityfocus.com/bid/8880|title=SecurityFocus exploit information}}</ref> and an ] in some routers manufactured by ], ] and ], triggered by the use of port {{Mono|0}}.<ref>{{Cite web|url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1068|title=CVE - CVE-2006-1068|website=cve.mitre.org}}</ref><ref>{{Cite web|url=https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1067|title=CVE - CVE-2006-1067|website=cve.mitre.org}}</ref> The router exploit, in particular, may be triggered when the phrase '{{Mono|DCC SEND}}' followed by at least 6 characters without spaces or newlines appears anywhere in a ] stream on port 6667, not just when an actual DCC SEND request has been made. In the 2000s it was possible to combine multiple exploits into a single string, {{Mono|DCC SEND startkeylogger 0 0 0}}, which if posted in a public channel could cause multiple users to disconnect (either by crashing IRC clients, crashing routers, or triggering overly strict default settings in antivirus software).{{cn|date=January 2024}}


===DCC XMIT=== ===DCC XMIT===
The XMIT service is a modified version of DCC SEND that allows for resuming files and cuts down on wasteful traffic from the ACK longs. XMIT is not widely supported. The XMIT service is a modified version of DCC SEND that allows for resuming files and cuts down on wasteful traffic from the ACK longs. XMIT is not widely supported.


The XMIT handshake differs somewhat from the SEND handshake. The sender sends a ] offering a file to the receiver: The XMIT handshake differs somewhat from the SEND handshake. The sender sends a ] offering a file to the receiver: <code>DCC XMIT {{var|protocol}} {{var|ip}} {{var|port}}]]</code>
:<code><nowiki>DCC XMIT <protocol> <ip> <port>]]</nowiki></code>


Square brackets here enclose optional parts. <protocol> is the ] to use for the transfer; only "clear" is defined presently. Unlike standard DCC SEND, <ip> can be in the additional forms of standard dotted notation for IPv4, or either hexadecimal or mixed notation for IPv6. To leave an early parameter empty, but still supply a later one, the earlier one can be specified as "-". If the receiver does not implement the protocol used, it will send back a CTCP reply of the format: Square brackets here enclose optional parts. {{var|protocol}} is the ] to use for the transfer; only {{mono|clear}} is defined presently. Unlike standard DCC SEND, {{var|ip}} can be in the additional forms of standard dotted notation for IPv4, or either hexadecimal or mixed notation for IPv6. To leave an early parameter empty, but still supply a later one, the earlier one can be specified as {{mono|-}}. If the receiver does not implement the protocol used, it will send back a CTCP reply of the format: <code>ERRMSG DCC CHAT {{var|protocol}} unavailable</code>.
:<code><nowiki>ERRMSG DCC CHAT <protocol> unavailable</nowiki></code>


CHAT is used here to maintain compatibility with the error messages sent by the extended DCC CHAT. If the receiver declines the transfer, it sends the following CTCP reply: CHAT is used here to maintain compatibility with the error messages sent by the extended DCC CHAT. If the receiver declines the transfer, it sends the following CTCP reply: <code>ERRMSG DCC CHAT {{var|protocol}} declined</code>.
:<code><nowiki>ERRMSG DCC CHAT <protocol> declined</nowiki></code>


Other errors are reported in the same fashion. If the receiver is willing and capable of receiving the file, it will connect to the given address and port. What happens then depends on the protocol used. Other errors are reported in the same fashion. If the receiver is willing and capable of receiving the file, it will connect to the given address and port. What happens then depends on the protocol used.


In the case of the "clear" protocol, the XMIT server will, upon receiving a connection, send a 32-bit ] in ], representing the file's modification time. Presumably based on the modification time of the local file, the client will then send another network byte order ], an offset which the server should seek to when sending the file. This should be set to zero if the whole file is wanted, or the size of the local file if the client wishes to resume a previous download. In the case of the {{mono|clear}} protocol, the XMIT server will, upon receiving a connection, send a 32-bit <code>]</code> in ], representing the file's modification time. Presumably based on the modification time of the local file, the client will then send another network byte order <code>]</code>, an offset which the server should seek to when sending the file. This should be set to zero if the whole file is wanted, or the size of the local file if the client wishes to resume a previous download.


While faster than SEND, XMIT carries one of the same limitations in that it is impossible to tell how big the file is, unless its size is specified in the ] negotiation or known beforehand. Furthermore, you can not resume a file past the two gigabyte mark due to the 32-bit offset. While faster than SEND, XMIT carries one of the same limitations in that it is impossible to tell how big the file is, unless its size is specified in the ] negotiation or known beforehand. Furthermore, it is not possible to resume a file past the two gigabyte mark due to the 32-bit offset.


===Passive DCC=== ===Passive DCC===
In a normal DCC connection the initiator acts as the ], and the target is the ]. Because lawda ilove you chut mut ] and reduction of end-to-end transparency because of ], the initiator might not be able to act as a server. Various ways of asking the target to act as the server have been devised: In a normal DCC connection the initiator acts as the ], and the target is the ]. Because of widespread ] and reduction of end-to-end transparency because of ], the initiator might not be able to act as a server. Various ways of asking the target to act as the server have been devised:


====DCC Server==== ====DCC Server====
This extension to normal DCC SEND and CHAT was introduced by the IRC client ]. DCC Server has moderate support, but is not standard on all clients (see ]). This extension to normal DCC SEND and CHAT was introduced by the IRC client ]. DCC Server has moderate support, but is not standard on all clients (see ]).


It allows the initiation of a DCC connection by IP address, without the need of an IRC server. This is accomplished by the receiving client acting as a server (hence the name) listening (usually on port 59) for a handshake from the sender. It allows the initiation of a DCC connection by IP address, without the need of an IRC server. This is accomplished by the receiving client acting as a server (hence the name) listening (usually on port 59) for a handshake from the sender.


For a CHAT, the initiator sends <code>1000 {{var|initiator nick}}</code>. The target then replies with, <code>1000 {{var|target nick}}</code>, and the rest proceeds according to standard DCC CHAT protocol.
For a CHAT, the initiator sends:
:<code><nowiki>100 <initiator nick></nowiki></code>


For a SEND, the initiator sends <code>1200 {{var|initiator nick}} {{var|filesize}} {{var|filename}}</code>. The target replies with, <code>1210 {{var|target nick}} {{var|resume position}}</code>, where {{var|resume position}} is the offset in the file from which to start. From here the transfer proceeds as a normal DCC SEND.
The target then replies with:
:<code><nowiki>101 <target nick></nowiki></code>
and the rest proceeds according to standard DCC CHAT protocol.

For a SEND, the initiator sends:
:<code><nowiki>120 <initiator nick> <filesize> <filename></nowiki></code>

The target replies with:
:<code><nowiki>121 <target nick> <resume position></nowiki></code>
where <resume position> is the offset in the file from which to start. From here the transfer proceeds as a normal DCC SEND.


DCC Server also supports mIRC-style file servers and DCC GET. DCC Server also supports mIRC-style file servers and DCC GET.
Line 126: Line 105:
DCC Server provides no way specifying the port to use, so this has to be negotiated manually, which is not always possible, as one of the sides may not be a human. RDCC is a handshake mechanism for DCC Server, which in addition to the port also provides the IP address of the server, which the client might not be able to find otherwise because of host masking. It is not widely supported. DCC Server provides no way specifying the port to use, so this has to be negotiated manually, which is not always possible, as one of the sides may not be a human. RDCC is a handshake mechanism for DCC Server, which in addition to the port also provides the IP address of the server, which the client might not be able to find otherwise because of host masking. It is not widely supported.


The initiator requests the port the target is listening on by sending the CTCP query: The initiator requests the port the target is listening on by sending the CTCP query, <code>RDCC {{var|function}} {{var|comment}}</code>, where {{var|function}} is {{mono|c}} for chat, {{mono|s}} for send, or {{mono|f}} for file server.
:<code><nowiki>RDCC <function> <comment></nowiki></code>
where <function> is 'c' for chat, 's' for send and 'f' for file server.


The target may then CTCP reply with, <code>RDCC 0 {{var|ip}} {{var|port}}</code>, where {{var|ip}} and {{var|port}} have the same meanings as for normal DCC SEND and CHAT. After this the initiator connects to the {{var|ip}} and {{var|port}}, and a DCC Server handshake follows.
The target may then CTCP reply with:
:<code><nowiki>RDCC 0 <ip> <port></nowiki></code>
where <ip> and <port> have the same meanings as for normal DCC SEND and CHAT. After this the initiator connects to the ip and port, and a DCC Server handshake follows.


====DCC REVERSE==== ====DCC REVERSE====
Unlike DCC Server, where the handshake is handled over a direct IP connection, DCC REVERSE has a normal CTCP handshake, similar to the one used by DCC SEND. This is not widely implemented. The sender offers a file to the receiver by sending the CTCP message: Unlike DCC Server, where the handshake is handled over a direct IP connection, DCC REVERSE has a normal CTCP handshake, similar to the one used by DCC SEND. This is not widely implemented. The sender offers a file to the receiver by sending the CTCP message: <code>DCC REVERSE {{var|filename}} {{var|filesize}} {{var|key}}</code>. {{var|key}} is a 1–50 characters-long string of ] characters in the range 33–126, and acts as an identifier for the transfer.
:<code><nowiki>DCC REVERSE <filename> <filesize> <key></nowiki></code>
<key> is a 1 to 50 characters long string of ] characters in the range 33 to 126, and acts as an identifier for the transfer.


If the receiver accepts, it sends the CTCP reply: If the receiver accepts, it sends the CTCP reply, <code>DCC REVERSE {{var|key}} {{var|start}} {{var|ip}} {{var|port}}</code>
:<code><nowiki>DCC REVERSE <key> <start> <ip> <port></nowiki></code>


Here <start> is the position in the file from which to start sending, <ip> is the ] of the receiver in standard ] for ], or ] notation for ]. The sender then connects to the ip address and port indicated by the receiver, and a normal DCC SEND follows. Both the sender and receiver can cancel the handshake by sending the CTCP reply: Here, {{var|start}} is the position in the file from which to start sending, {{var|ip}} is the IP address of the receiver in standard ] for ], or ] notation for ]. The sender then connects to the ip address and port indicated by the receiver, and a normal DCC SEND follows. Both the sender and receiver can cancel the handshake by sending the CTCP reply, <code>DCC REJECT REVERSE {{var|key}}</code>.
:<code><nowiki>DCC REJECT REVERSE <key></nowiki></code>


====DCC RSEND==== ====DCC RSEND====
This is the KVIrc client's alternative to DCC REVERSE. The sender offers a file by sending the CTCP: This is the KVIrc client's alternative to DCC REVERSE. The sender offers a file by sending the CTCP: <code>DCC RSEND {{var|filename}} {{var|filesize}}</code>. The receiver can then accept by CTCP replying with, <code>DCC RECV {{var|filename}} {{var|ip}} {{var|port}} {{var|start}}</code>, and the sender connects to the receiver and sends as during a normal DCC SEND.
:<code><nowiki>DCC RSEND <filename> <filesize></nowiki></code>

The receiver can then accept by CTCP replying with:
:<code><nowiki>DCC RECV <filename> <ip> <port> <start></nowiki></code>
and the sender connects to the receiver and sends as during a normal DCC SEND.


====Reverse / Firewall DCC==== ====Reverse / Firewall DCC====
This passive DCC mechanism is supported by at least ], ], ], KVIrc, ], ], ], and ]. The sender offers a file by sending the CTCP message: This passive DCC mechanism is supported by at least ], ], ], KVIrc, ], ], ], and ]. The sender offers a file by sending the CTCP message, <code>DCC SEND {{var|filename}} {{var|ip}} 0 {{var|filesize}} {{var|token}}</code>. {{var|ip}} is the ] of the sender in network byte order, expressed as a single integer (as in standard DCC). The number 0 is sent instead of a valid port, signaling that this is a Reverse DCC request. {{var|token}} is a unique integer; if TSEND is being used (by a client that supports it), the letter {{mono|T}} is appended to the token, letting the receiver know it doesn't need to send acknowledgements.
:<code><nowiki>DCC SEND <filename> <ip> 0 <filesize> <token></nowiki></code>
<ip> is the ] of the sender in network byte order, expressed as a single integer (as in standard DCC). The number 0 is sent instead of a valid port, signaling that this is a Reverse DCC request. <token> is a unique integer; if TSEND is being used (by a client that supports it), the letter "T" is appended to the token, letting the receiver know it doesn't need to send acknowledgements.


The receiver can accept the file by opening a listening socket and responding with the CTCP message, <code>DCC SEND {{var|filename}} {{var|ip}} {{var|port}} {{var|filesize}} {{var|token}}</code>. This is identical to the original Reverse DCC message, except the {{var|ip}} and {{var|port}} identify the socket where the receiver is listening. {{var|token}} is the same as in the original request, letting the sender know which request is being accepted. (Because this message follows the same format as a regular DCC send request, some servers which filter DCC requests may require the sender to add the receiver to their "DCC allow" list.)
The receiver can accept the file by opening a listening socket and responding with the CTCP message:
:<code><nowiki>DCC SEND <filename> <ip> <port> <filesize> <token></nowiki></code>
This is identical to the original Reverse DCC message, except the <ip> and <port> identify the socket where the receiver is listening. <token> is the same as in the original request, letting the sender know which request is being accepted. (Since this message follows the same format as a regular DCC send request, some servers which filter DCC requests may require the sender to add the receiver to his or her "DCC allow" list.)


The sender then connects to the receiver's socket, sends the content of the file, and waits for the receiver to close the socket when the file is finished. The sender then connects to the receiver's socket, sends the content of the file, and waits for the receiver to close the socket when the file is finished.


When the RESUME extension to the SEND protocol is used, the sequence of commands becomes (with '>>' indicating an outgoing message on the initiating side and '<<' response by its peer): When the RESUME extension to the SEND protocol is used, the sequence of commands becomes (with {{mono|>>}} indicating an outgoing message on the initiating side, and {{mono|<<}} response by its peer):

:<code><nowiki>>> DCC SEND <filename> <ip> 0 <filesize> <token></nowiki></code>
:<code><nowiki><< DCC RESUME <filename> 0 <position> <token></nowiki></code> <code>>> DCC SEND {{var|filename}} {{var|ip}} 0 {{var|filesize}} {{var|token}}<br />
:<code><nowiki>>> DCC ACCEPT <filename> 0 <position> <token></nowiki></code> << DCC RESUME {{var|filename}} 0 {{var|position}} {{var|token}}<br />
>> DCC ACCEPT {{var|filename}} 0 {{var|position}} {{var|token}}<br />
:<code><nowiki><< DCC SEND <filename> <peer-ip> <port> <filesize> <token></nowiki></code>
<< DCC SEND {{var|filename}} {{var|peer-ip}} {{var|port}} {{var|filesize}} {{var|token}}</code>


After which the protocol proceeds as normal (i.e. the sender connects to the receiver's socket). After which the protocol proceeds as normal (i.e. the sender connects to the receiver's socket).
Line 185: Line 148:


==External links== ==External links==
* ''(note: Most IRC-clients and networks have implemented extensions to the DCC protocol. The DCC commonly used today has evolved quite a bit from what this document describes. A successor to DCC (DCC2) is currently being formalized by )'' * ''(note: Most IRC-clients and networks have implemented extensions to the DCC protocol. The DCC commonly used today has evolved quite a bit from what this document describes.)''
* * {{Webarchive|url=https://web.archive.org/web/20051215235335/http://www.kvirc.de/docu/doc_dcc_connection.html |date=2005-12-15 }}
* *
* *
Line 193: Line 156:


{{DEFAULTSORT:Direct Client-To-Client}} {{DEFAULTSORT:Direct Client-To-Client}}
] ]
] ]
] ]
] ]

Latest revision as of 05:56, 6 June 2024

Protocol for file transfer and direct chat on Internet Relay Chat
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
This article may contain an excessive amount of intricate detail that may interest only a particular audience. Please help by spinning off or relocating any relevant information, and removing excessive detail that may be against Misplaced Pages's inclusion policy. (August 2012) (Learn how and when to remove this message)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Direct Client-to-Client" – news · newspapers · books · scholar · JSTOR (August 2012) (Learn how and when to remove this message)
(Learn how and when to remove this message)

Direct Client-to-Client (DCC) (originally Direct Client Connection) is an IRC-related sub-protocol enabling peers to interconnect using an IRC server for handshaking in order to exchange files or perform non-relayed chats. Once established, a typical DCC session runs independently from the IRC server. Originally designed to be used with ircII it is now supported by many IRC clients. Some peer-to-peer clients on napster-protocol servers also have DCC send/get capability, including TekNap, SunshineUN and Lopster. A variation of the DCC protocol called SDCC (Secure Direct Client-to-Client), also known as DCC SCHAT supports encrypted connections. An RFC specification on the use of DCC does not exist.

DCC connections can be initiated in two different ways:

  • The most common way is to use CTCP to initiate a DCC session. The CTCP is sent from one user, over the IRC network, to another user.
  • Another way to initiate a DCC session is for the client to connect directly to the DCC server. Using this method, no traffic will go across the IRC network (the parties involved do not need to be connected to an IRC network in order to initiate the DCC connection).

History

ircII was the first IRC client to implement the CTCP and DCC protocols. The CTCP protocol was implemented by Michael Sandrof in 1990 for ircII version 2.1. The DCC protocol was implemented by Troy Rollo in 1991 for version 2.1.2, but was never intended to be portable to other IRC clients.

Common DCC applications

DCC CHAT

The CHAT service enables users to chat with each other over a DCC connection. The traffic will go directly between the users, and not over the IRC network. When compared to sending messages normally, this reduces IRC network load, allows sending of larger amounts of text at once, due to the lack of flood control, and makes the communication more secure by not exposing the message to the IRC servers (however, the message is still in plaintext).

DCC CHAT is normally initiated using a CTCP handshake. The user wishing to establish the connection sends the following CTCP to the target, DCC CHAT protocol ip port, where ip and port are the IP address and port number of the sender, and are expressed as integers. protocol is chat for standard DCC CHAT. The receiving party can then connect to the given port and IP address.

Once a connection is established, the protocol used for DCC CHAT is very simple: users exchange CRLF-terminated messages. Messages that begin with an ASCII 001 (control-A, represented below by ) and the word ACTION, and are terminated by another ASCII 001, are interpreted as emotes: ACTION waves goodbye.

DCC Whiteboard

This is an extension to DCC CHAT, allowing simple drawing commands to be sent as well as lines of text. DCC Whiteboard is initiated with a handshake similar to DCC CHAT, with the protocol chat replaced by wboard: DCC CHAT wboard ip port.

Once the connection is established, the two clients exchange CRLF-terminated messages. Messages that begin (and optionally end) with ASCII 001 are interpreted as special commands; the command ACTION represents an emote, while others cause lines to be drawn on the user's whiteboard surface, or allow the two clients to negotiate a set of features.

DCC SEND

The SEND service allows users to send files to one another. The original specification for the handshake did not allow the receiver to know the total file size nor to resume a transfer. This has made clients introduce their own extensions to the handshake, many of which have become widely supported.

The original handshake consisted of the sender sending the following CTCP to the receiver: DCC SEND filename ip port.

As with DCC CHAT, ip and port are the IP address and port where the sending machine will be listening for an incoming connection. Some clients enclose filenames with spaces in double quotes. It is common practice to add the file size as a last argument: DCC SEND filename ip port filesize.

At this point, the original specification had the receiver either connect to the given address and port and wait for data, or ignore the request, but for clients supporting the DCC RESUME extension, a third alternative is to ask the sender to skip part of the file by sending the CTCP reply: DCC RESUME filename port position.

If the sending client supports DCC RESUME, it will reply with, DCC ACCEPT filename port position, and the receiver can connect to the given address and port and listen for data to append to an already existing file.

Data is sent to the client in blocks, each of which the client must acknowledge by sending the total number of bytes received in the form of a 32-bit network byte order integer. This slows down connections and is redundant because of TCP. The send-ahead extension relieves this problem somewhat by not waiting for the acknowledgements, but since the receiver still has to send them for every block it receives, in case the sender expects them, it is not solved completely.

Another extension, TDCC, or turbo DCC, removes the acknowledgements, but requires a slightly modified handshake and is not widely supported. Older versions of TDCC replaced the word SEND in the handshake with TSEND; later versions use the word SEND but append a T after the handshake, making this version of TSEND compatible with other clients (as long as they can parse the modified handshake).

DCC SEND exploit

The "DCC send exploit" can refer to two bugs: a variant buffer overflow error in mIRC triggered by filenames longer than 14 characters, and an input validation error in some routers manufactured by Netgear, D-Link and Linksys, triggered by the use of port 0. The router exploit, in particular, may be triggered when the phrase 'DCC SEND' followed by at least 6 characters without spaces or newlines appears anywhere in a TCP stream on port 6667, not just when an actual DCC SEND request has been made. In the 2000s it was possible to combine multiple exploits into a single string, DCC SEND startkeylogger 0 0 0, which if posted in a public channel could cause multiple users to disconnect (either by crashing IRC clients, crashing routers, or triggering overly strict default settings in antivirus software).

DCC XMIT

The XMIT service is a modified version of DCC SEND that allows for resuming files and cuts down on wasteful traffic from the ACK longs. XMIT is not widely supported.

The XMIT handshake differs somewhat from the SEND handshake. The sender sends a CTCP offering a file to the receiver: DCC XMIT protocol ip port]]

Square brackets here enclose optional parts. protocol is the protocol to use for the transfer; only clear is defined presently. Unlike standard DCC SEND, ip can be in the additional forms of standard dotted notation for IPv4, or either hexadecimal or mixed notation for IPv6. To leave an early parameter empty, but still supply a later one, the earlier one can be specified as -. If the receiver does not implement the protocol used, it will send back a CTCP reply of the format: ERRMSG DCC CHAT protocol unavailable.

CHAT is used here to maintain compatibility with the error messages sent by the extended DCC CHAT. If the receiver declines the transfer, it sends the following CTCP reply: ERRMSG DCC CHAT protocol declined.

Other errors are reported in the same fashion. If the receiver is willing and capable of receiving the file, it will connect to the given address and port. What happens then depends on the protocol used.

In the case of the clear protocol, the XMIT server will, upon receiving a connection, send a 32-bit time t in network byte order, representing the file's modification time. Presumably based on the modification time of the local file, the client will then send another network byte order long, an offset which the server should seek to when sending the file. This should be set to zero if the whole file is wanted, or the size of the local file if the client wishes to resume a previous download.

While faster than SEND, XMIT carries one of the same limitations in that it is impossible to tell how big the file is, unless its size is specified in the CTCP negotiation or known beforehand. Furthermore, it is not possible to resume a file past the two gigabyte mark due to the 32-bit offset.

Passive DCC

In a normal DCC connection the initiator acts as the server, and the target is the client. Because of widespread firewalling and reduction of end-to-end transparency because of NAT, the initiator might not be able to act as a server. Various ways of asking the target to act as the server have been devised:

DCC Server

This extension to normal DCC SEND and CHAT was introduced by the IRC client mIRC. DCC Server has moderate support, but is not standard on all clients (see Comparison of Internet Relay Chat clients).

It allows the initiation of a DCC connection by IP address, without the need of an IRC server. This is accomplished by the receiving client acting as a server (hence the name) listening (usually on port 59) for a handshake from the sender.

For a CHAT, the initiator sends 1000 initiator nick. The target then replies with, 1000 target nick, and the rest proceeds according to standard DCC CHAT protocol.

For a SEND, the initiator sends 1200 initiator nick filesize filename. The target replies with, 1210 target nick resume position, where resume position is the offset in the file from which to start. From here the transfer proceeds as a normal DCC SEND.

DCC Server also supports mIRC-style file servers and DCC GET.

RDCC

DCC Server provides no way specifying the port to use, so this has to be negotiated manually, which is not always possible, as one of the sides may not be a human. RDCC is a handshake mechanism for DCC Server, which in addition to the port also provides the IP address of the server, which the client might not be able to find otherwise because of host masking. It is not widely supported.

The initiator requests the port the target is listening on by sending the CTCP query, RDCC function comment, where function is c for chat, s for send, or f for file server.

The target may then CTCP reply with, RDCC 0 ip port, where ip and port have the same meanings as for normal DCC SEND and CHAT. After this the initiator connects to the ip and port, and a DCC Server handshake follows.

DCC REVERSE

Unlike DCC Server, where the handshake is handled over a direct IP connection, DCC REVERSE has a normal CTCP handshake, similar to the one used by DCC SEND. This is not widely implemented. The sender offers a file to the receiver by sending the CTCP message: DCC REVERSE filename filesize key. key is a 1–50 characters-long string of ASCII characters in the range 33–126, and acts as an identifier for the transfer.

If the receiver accepts, it sends the CTCP reply, DCC REVERSE key start ip port

Here, start is the position in the file from which to start sending, ip is the IP address of the receiver in standard dotted notation for IPv4, or hexadecimal notation for IPv6. The sender then connects to the ip address and port indicated by the receiver, and a normal DCC SEND follows. Both the sender and receiver can cancel the handshake by sending the CTCP reply, DCC REJECT REVERSE key.

DCC RSEND

This is the KVIrc client's alternative to DCC REVERSE. The sender offers a file by sending the CTCP: DCC RSEND filename filesize. The receiver can then accept by CTCP replying with, DCC RECV filename ip port start, and the sender connects to the receiver and sends as during a normal DCC SEND.

Reverse / Firewall DCC

This passive DCC mechanism is supported by at least mIRC, Visual IRC, HexChat, KVIrc, DMDirc, Klient, Konversation, and PhibianIRC. The sender offers a file by sending the CTCP message, DCC SEND filename ip 0 filesize token. ip is the IP address of the sender in network byte order, expressed as a single integer (as in standard DCC). The number 0 is sent instead of a valid port, signaling that this is a Reverse DCC request. token is a unique integer; if TSEND is being used (by a client that supports it), the letter T is appended to the token, letting the receiver know it doesn't need to send acknowledgements.

The receiver can accept the file by opening a listening socket and responding with the CTCP message, DCC SEND filename ip port filesize token. This is identical to the original Reverse DCC message, except the ip and port identify the socket where the receiver is listening. token is the same as in the original request, letting the sender know which request is being accepted. (Because this message follows the same format as a regular DCC send request, some servers which filter DCC requests may require the sender to add the receiver to their "DCC allow" list.)

The sender then connects to the receiver's socket, sends the content of the file, and waits for the receiver to close the socket when the file is finished.

When the RESUME extension to the SEND protocol is used, the sequence of commands becomes (with >> indicating an outgoing message on the initiating side, and << response by its peer):

>> DCC SEND filename ip 0 filesize token
<< DCC RESUME filename 0 position token
>> DCC ACCEPT filename 0 position token
<< DCC SEND filename peer-ip port filesize token

After which the protocol proceeds as normal (i.e. the sender connects to the receiver's socket).

File servers (FSERVs)

A DCC fserve, or file server, lets a user browse, read and download files located on a DCC server.

Typically, this is implemented with a DCC CHAT session (which presents the user with a command prompt) or special CTCP commands to request a file. The files are sent over DCC SEND or DCC XMIT. There are many implementations of DCC file servers, among them is the FSERV command in the popular mIRC client.

See also

  • CTCP (Client-to-client protocol)
  • XDCC (eXtended DCC)

References

  1. "Open Source and Free Software". troy.rollo.name. Archived from the original on 2018-11-16. Retrieved 2018-11-15.
  2. "DCC negotiation and connection". kvric.net.
  3. "IRCHelp.org — The Client-To-Client Protocol (CTCP)". www.irchelp.org.
  4. Piccard, Paul; Brian Baskin; George Spillman; Marcus Sachs (May 1, 2005). "IRC Networks and Security". Securing IM and P2P Applications for the Enterprise (1st ed.). Syngress. p. 386. ISBN 1-59749-017-2. The authors of the ircII software package originally pioneered file transfers over IRC.
  5. See the 'NOTES' and 'source/ctcp.c' files included with ircii-2.1.4e.tar.gz
  6. See the 'UPDATES' and 'source/dcc.c' files included with ircii-2.1.4e.tar.gz
  7. Troy Rollo (January 20, 1993). "/dcc". Newsgroupalt.irc. Usenet: 1993Jan20.222051.1484@usage.csd.unsw.OZ.AU. Retrieved November 10, 2010.
  8. Rollo, Troy. "A description of the DCC protocol". irchelp.org. Retrieved November 10, 2010. The first comment I should make is that the DCC protocol was never designed to be portable to clients other than IRCII. As such I take no responsibility for it being difficult to implement for other clients.
  9. "mIRC Help". www.mirc.com. Retrieved 2023-07-24.
  10. "SecurityFocus exploit information".
  11. "CVE - CVE-2006-1068". cve.mitre.org.
  12. "CVE - CVE-2006-1067". cve.mitre.org.

External links

Internet Relay Chat (IRC)
Common terms
Related protocols
Networks
Technology
See also
Clients
macOS
Microsoft Windows
Unix-like
Cross-platform
Multi-IM
Web-based
Web browser components
Library and plug-ins
Category
Categories: