00001 <html> 00002 00003 <head> 00004 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 00005 <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> 00006 <meta name="ProgId" content="FrontPage.Editor.Document"> 00007 <title>Using WinPcap Remote Capture</title> 00008 </head> 00009 00010 <body> 00011 00012 <hr> 00013 <ul> 00014 <li><a href="#RunningModes">Remote Capture Running Modes</a></li> 00015 <li><a href="#Config">Configuring the Remote Daemon (rpcapd)</a></li> 00016 <li><a href="#StartCap">Starting a capture on a remote machine</a></li> 00017 <li><a href="#UNIX">Installing the Remote Capture Daemon in UNIX</a></li> 00018 </ul> 00019 <hr> 00020 <p>WinPcap comes with Remote Capture capabilities. This is an highly 00021 experimental feature that allows to interact to a remote machine and capture 00022 packets that are being transmitted on the remote network.</p> 00023 <p>This requires a <b>remote daemon </b>(called <code>rpcapd</code>) which 00024 performs the capture and sends data back and a <b>local client </b>that sends 00025 the appropriate commands and receives the captured data.</p> 00026 <p>WinPcap extends the standard WinPcap code in such a way that all 00027 WinPcap-based tools can expoit remote capture capabilities. For instance, the 00028 capabillity to interact with a remote daemon are added to the client software 00029 without any explicit modification to it. Vice versa, the remote daemon must be 00030 explicitely installed (and configured) on the remote machine.</p> 00031 <h2><a name="RunningModes"></a>Remote Capture Running Modes</h2> 00032 <p>The Remote Capture Protocol (RPCAP) can work in two modes:</p> 00033 <ul> 00034 <li><b>Passive Mode</b> (default): the client (e.g. a network sniffer) 00035 connects to the remote daemon, it sends them the appropriate commands, and 00036 it starts the capture.</li> 00037 <li><b>Active Mode</b>: the remote daemon try to establish a connection toward 00038 the client (e.g. the network sniffer); then, the client sends the 00039 appropriate commands to the daemon and it starts the capture. This name is 00040 due to the fact thet the daemon becomes <i>active</i> instead of <i>waiting</i> 00041 for new connections.</li> 00042 </ul> 00043 <p>The Active Mode is useful in case the remote daemon is behind a firewall and 00044 it cannot receive connections from the external world. In this case, the daemon 00045 can be configured to establish the connection to a given host, which will have 00046 been configured in order to <i>wait</i> for that connection. After establishing 00047 the connection, the protocol continues its job in almost the same way in both 00048 Active and Passive Mode.</p> 00049 <p>Analyzer (<a href="http://analyzer.polito.it/30alpha/">http://analyzer.polito.it/30alpha/</a>) 00050 has a set of commands (in the <b>Capture</b> menu) that allows you to accept a 00051 remote connection and then start the capture on the remote device. Currently, 00052 Analyzer is the only tool that is able to work in active mode, since it requires 00053 some modifications to the application code.</p> 00054 <h2><a name="Config"></a>Configuring the Remote Daemon (rpcapd)</h2> 00055 <p>The Remote Daemon is a standard Win32 executable running either in console 00056 mode or as a service. The executable can be found in the <code>WinPcap</code> 00057 folder and it has the following syntax:</p> 00058 <pre> rpcapd [-b <address>] [-p <port>] [-6] [-l <host_list>] [-a <host,port>] 00059 [-n] [-v] [-d] [-s <file>] [-f <file>]</pre> 00060 <p>The daemon can be compiled and it is actually working on Linux as well.</p> 00061 <p>Here there is a brief description of the allowed commands:</p> 00062 <div align="left"> 00063 <table border="1"> 00064 <tr> 00065 <th>Switch</th> 00066 <th>Description</th> 00067 </tr> 00068 <tr> 00069 <td> 00070 <pre>-b <address></pre> 00071 </td> 00072 <td>It sets the address the daemon has to bind to (either numeric or 00073 literal). Default: it binds to all local IPv4 and IPv6 addresses.</td> 00074 </tr> 00075 <tr> 00076 <td> 00077 <pre>-p <port></pre> 00078 </td> 00079 <td>It sets the port the daemon has to bind to. Default: it binds to port 00080 2002.</td> 00081 </tr> 00082 <tr> 00083 <td> 00084 <pre>-4</pre> 00085 </td> 00086 <td>It binds only to IPv4 addresses. Default: both IPv4 and IPv6 waiting 00087 sockets are used.</td> 00088 </tr> 00089 <tr> 00090 <td> 00091 <pre>-l <host_list_file></pre> 00092 </td> 00093 <td>It specifies a file that keeps the list of the hosts which are allowed 00094 to connect to this daemon (if more than one, the file keeps them one per 00095 line). We suggest to use literal names (instead of numeric ones) in 00096 order to avoid problems with different address families (IPv4 and IPv6).</td> 00097 </tr> 00098 <tr> 00099 <td> 00100 <pre>-n</pre> 00101 </td> 00102 <td>It permits NULL authentication (usually used with '-l', that 00103 guarantees that only the allowed hosts can connect to the daemon). 00104 Default: the username/password authentication mechanism is required.</td> 00105 </tr> 00106 <tr> 00107 <td> 00108 <pre>-a <host, port></pre> 00109 </td> 00110 <td>It forces the daemon to run in active mode and to connect to 'host' on 00111 port 'port'. This does not exclude that the daemon is still able to 00112 accept passive connections.</td> 00113 </tr> 00114 <tr> 00115 <td> 00116 <pre>-v</pre> 00117 </td> 00118 <td>It forces the daemon to run in active mode only (default: the daemon 00119 always accepts active connections, even if the '-a' switch is 00120 specified).</td> 00121 </tr> 00122 <tr> 00123 <td> 00124 <pre>-d</pre> 00125 </td> 00126 <td>Forces the daemon to run in background, i.e. as a daemon (UNIX only) 00127 or as a service (Win32 only). <b>Warning</b> (Win32): this switch is 00128 provided automatically when WinPcap installs this daemon into the Win32 00129 services (control panel - administrative tools - services).</td> 00130 </tr> 00131 <tr> 00132 <td> 00133 <pre>-s <file></pre> 00134 </td> 00135 <td>It saves the current configuration to file.</td> 00136 </tr> 00137 <tr> 00138 <td> 00139 <pre>-f <file></pre> 00140 </td> 00141 <td>It loads the current configuration from file; all the switches 00142 specified from the command line are ignored and the file settings are 00143 used instead.</td> 00144 </tr> 00145 <tr> 00146 <td> 00147 <pre>-h</pre> 00148 </td> 00149 <td>It prints an help screen.</td> 00150 </tr> 00151 </table> 00152 </div> 00153 <h3>Installing the remote daemon</h3> 00154 <p>The remote daemon is installed automatically when installing WinPcap. The 00155 installation process places the <code>rpcapd</code> file into the <code>WinPcap</code> 00156 folder. This file can be executed either from the command line, or as a service. 00157 For instance, the installation process updates the list of available services 00158 list and it creates a new item (<b>Remote Packet Capture Protocol v.0 00159 (experimental)</b> ). To avoid security problems, the service is inactive and it 00160 has to be started manually (control panel - administrative tools - services - 00161 start).</p> 00162 <p>The service has a set of "standard" parameters, i.e. it it launched 00163 with the "<code>-d</code>" flag (in orde to make it running as a 00164 service) and the "<code>-f rpcapd.ini</code>" flag. The user can 00165 create a file called <code>rpcapd.ini</code> in the same folder of the 00166 executable, and put the configuration commands in there. In order for the 00167 service to execute the commands, you have to stop and restart it again (i.e. the 00168 initialization file is parsed only at the beginning). Viceversa, the UNIX 00169 version of <code>rpcapd</code> is able to read the configuration file when 00170 sending a kill -HUP signal to it. In that case, all the existing connections 00171 remain in place, while the new connections will be created according to the new 00172 parameters.</p> 00173 <p>In case the user does not want to create the configuration file manually, it 00174 can launch <code>rpcapd</code> with the requested parameters plus the "<code>-s 00175 filename</code>" one. The daemon will parse all the parameters and save 00176 them into the specified configuration file.</p> 00177 <h3>Starting the remote daemon as a standard executable</h3> 00178 <p>The <code>rpcapd</code> executable can be launched directly, i.e. it can run 00179 in the foreground as well (not as a daemon/service). The procedure is quite 00180 simple: you have to invoke the executable from the command line with all the 00181 requested parameters but the "<code>-d</code>" flag. The capture 00182 server will start in the foreground.</p> 00183 <h2><a name="StartCap"></a>Starting a capture on a remote machine</h2> 00184 <p>If you are using a tool that is already aware of the remote capture (like 00185 Analyzer), everything is simple. The capture wizard will help you to locate the 00186 appropriate interface on the remote machine.</p> 00187 <p>If your preferred tool is not aware of the remote capture, you can still use 00188 the remote capture. In this case you have to read the next Section.</p> 00189 <p><b>Be carefully</b>: the capture server (<code>rpcapd</code>) must be up and 00190 running on the remote machine.</p> 00191 <h3>New string specifiers for interface selection</h3> 00192 <p>If your preferred tool is not aware of the remote capture, the only thing you 00193 must do is to insert, as interface specifier, the indication of the remote 00194 machine you want to contact. The following forms are allowed:</p> 00195 <div align="left"> 00196 <table border="1"> 00197 <tr> 00198 <th>Adapter String</th> 00199 <th>Description</th> 00200 </tr> 00201 <tr> 00202 <td> 00203 <pre>file://filename</pre> 00204 </td> 00205 <td>It opens a local file.</td> 00206 </tr> 00207 <tr> 00208 <td> 00209 <pre>rpcap://host.foo.bar/adaptername</pre> 00210 </td> 00211 <td>It opens a remote adapter; the host is specified by means of the 00212 literal name, without port number (i.e. it uses the RPCAP default port).</td> 00213 </tr> 00214 <tr> 00215 <td> 00216 <pre>rpcap://host.foo.bar:1234/adaptername</pre> 00217 </td> 00218 <td>It is the same as before, but it uses a different port number.</td> 00219 </tr> 00220 <tr> 00221 <td> 00222 <pre>rpcap://10.11.12.13/adaptername</pre> 00223 </td> 00224 <td>It opens a remote adapter, but the host is specified by means of an 00225 IPv4 numeric address, without port number (i.e. it uses the RPCAP 00226 default port).</td> 00227 </tr> 00228 <tr> 00229 <td> 00230 <pre>rpcap://10.11.12.13:1234/adaptername</pre> 00231 </td> 00232 <td>It is the same as before, but it uses a different port number.</td> 00233 </tr> 00234 <tr> 00235 <td> 00236 <pre>rpcap://[10.11.12.13]:1234/adaptername</pre> 00237 </td> 00238 <td>It is the same as before, but the numeric address is specified within 00239 square brackets (like IPv6 addresses).</td> 00240 </tr> 00241 <tr> 00242 <td> 00243 <pre>rpcap://[1:2:3::4]/adaptername</pre> 00244 </td> 00245 <td>It opens a remote adapter, but the host is specified by means of an 00246 IPv6 numeric address, without port number (i.e. it uses the RPCAP 00247 default port). In case of IPv6 addresses you MUST use the square 00248 brackets.</td> 00249 </tr> 00250 <tr> 00251 <td> 00252 <pre>rpcap://[1:2:3::4]:1234/adaptername</pre> 00253 </td> 00254 <td>It is the same as before, but it uses a different port number.</td> 00255 </tr> 00256 <tr> 00257 <td> 00258 <pre>rpcap://adaptername</pre> 00259 </td> 00260 <td>It opens a local adapter, without using the RPCAP protocol.</td> 00261 </tr> 00262 <tr> 00263 <td> 00264 <pre>adaptername</pre> 00265 </td> 00266 <td>It opens a local adapter; it is kept for compability, but it is 00267 strongly discouraged.</td> 00268 </tr> 00269 <tr> 00270 <td> 00271 <pre>(NULL)</pre> 00272 </td> 00273 <td>It opens the first local adapter; it is kept for compability, but it 00274 is strongly discouraged.</td> 00275 </tr> 00276 </table> 00277 </div> 00278 <p>The following formats are not allowed:</p> 00279 <table border="1"> 00280 <tr> 00281 <th>Adapter String</th> 00282 <th>Description</th> 00283 </tr> 00284 <tr> 00285 <td> 00286 <pre>rpcap://</pre> 00287 </td> 00288 <td>It cannot be used to open the first local adapter.</td> 00289 </tr> 00290 <tr> 00291 <td> 00292 <pre>rpcap://hostname/</pre> 00293 </td> 00294 <td>It cannot be used to open the first remote adapter.</td> 00295 </tr> 00296 </table> 00297 <h2><a name="UNIX"></a>Installing the Remote Capture Daemon in UNIX</h2> 00298 <p>The WinPcap source archive can be compiled in UNIX as well. Currently, remote 00299 capture has been tested on Linux and BSD. What you have to do is:</p> 00300 <ul> 00301 <li>download the WinPcap sources</li> 00302 <li>unpack the sources 00303 <ul> 00304 <li>we suggest to use the <code>unzip -a</code> command in order to 00305 convert DOS files to UNIX ones</li> 00306 </ul> 00307 </li> 00308 <li>move to the <code>libpcap</code> folder</li> 00309 <li>type: 00310 <ul> 00311 <li><code>./configure</code></li> 00312 <li><b>Warning</b>: in case the previous step reports an error, please 00313 regenerate the <code>configure</code> file using <code>automake</code> 00314 (version 2.50 or higher required)</li> 00315 <li><code>make</code></li> 00316 </ul> 00317 </li> 00318 <li>move to the <code>rpcapd</code> folder</li> 00319 <li>type <code>make</code></li> 00320 </ul> 00321 <p>The remote capture capabilities are turned on by default on Linux and 00322 FreeBSD. In case you do not want remote capture capabilities in libpcap, you can 00323 type</p> 00324 <pre> ./configure --disable-remote</pre> 00325 <p>at the "<code>configure</code>" step. All the possible flags are 00326 listed when typing <code>./configure --help</code>.</p> 00327 <p>What you obtained right now, is:</p> 00328 <ul> 00329 <li>a library file (<code>libpcap.a</code>), which can be linked to other 00330 applications (like <code>tcpdump</code>) in order to enable the remote 00331 capture for them.</li> 00332 <li>an executable (<code>rpcapd</code>) that is the remote daemon</li> 00333 </ul> 00334 <p><b>Warning</b>: in order to run the <code>rpcapd</code> daemon, the program 00335 must either</p> 00336 <ul> 00337 <li>run as root (or)</li> 00338 <li>run as user, but it must be owned by root and must be SUID root (<code>chmod 00339 u+s rpcapd</code>)</li> 00340 </ul> 00341 <h3>Known bugs</h3> 00342 <p><b>FreeBSD</b>: the first time you call the <code>pcap_stat()</code>, the 00343 function takes several seconds to return. Therefore, programs like Analyzer seem 00344 to hang up for 20-30 seconds at the beginning of the capture (if this is done 00345 with BSD as a remote probe). We're investigating to solve this issue.</p> 00346 <p><i>For any question, please refer to the WinPcap help page.</i></p> 00347 00348 </body> 00349 00350 </html>
documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2007 CACE Technologies. All rights reserved.