summaryrefslogtreecommitdiffstats
path: root/doc/ciscodump.adoc
blob: b721b284365a3e8f6b2f8ff9f72993fb7f7f5d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
include::../docbook/attributes.adoc[]
= ciscodump(1)
:doctype: manpage
:stylesheet: ws.css
:linkcss:
:copycss: ../docbook/{stylesheet}

== NAME

ciscodump - Provide interfaces to capture from a remote Cisco device through SSH.

== SYNOPSIS

[manarg]
*ciscodump*
[ *--help* ]
[ *--version* ]
[ *--extcap-interfaces* ]
[ *--extcap-dlts* ]
[ *--extcap-interface*=<interface> ]
[ *--extcap-config* ]
[ *--extcap-capture-filter*=<capture filter> ]
[ *--capture* ]
[ *--fifo*=<path to file or pipe> ]
[ *--remote-host*=<IP address> ]
[ *--remote-port*=<TCP port> ]
[ *--remote-username*=<username> ]
[ *--remote-password*=<password> ]
[ *--remote-filter*=<filter> ]
[ *--sshkey*=<public key path> ]
[ *--remote-interface*=<interface> ]
[ *--remote-count*=<count> ]

[manarg]
*ciscodump*
*--extcap-interfaces*

[manarg]
*ciscodump*
*--extcap-interface*=ciscodump
*--extcap-dlts*

[manarg]
*ciscodump*
*--extcap-interface*=ciscodump
*--extcap-config*

[manarg]
*ciscodump*
*--extcap-interface*=ciscodump
*--fifo*=<path to file or pipe>
*--capture*
*--remote-host*=remotedevice
*--remote-port*=22
*--remote-username*=user
*--remote-interface*=<the device interface>
*--remote-count*=<count>

== DESCRIPTION

*Ciscodump* is an extcap tool that relies on Cisco EPC to allow a user to run a remote capture
on a Cisco device in a SSH connection. It supports IOS, IOS-XE based device and ASA devices.

The tool configures capture on the device, reads data and removes configuration from the device. Provided credentials must allow the tool to configure the device.

When capture is started, packets are provided as they are received from the device. Capture stops when:

* requested count of packets is reached (*--remote-count* is mandatory)
* when capture finishes on the device (e.g. capture buffer is full)
* the capture is stopped by the user

Capture performance depends on a device type. The tool tries to read packets as soon as they received, but is usually slower than capturing device captures packets. Therefore packets are read in batches.

IOS/IOS-XE provides only access to all captured packets from the top. Therefore reading of second batch means to read all packets from first batch, but ignore them and then read new packets in second batch.

ASA provides access to specific packet so tool reads every packet just once.


=== SUPPORTED CISCO SOFTWARE

The application supports IOS version is 12.4 and higher. The IOS version supporting capture feature is 12.4(20)T and higher. More details can be
found here: https://www.cisco.com/c/en/us/products/collateral/ios-nx-os-software/ios-embedded-packet-capture/datasheet_c78-502727.html

The application supports IOS-XE version 16.1 and higher. Search for "Embedded Packet Capture Configuration Guide, Cisco IOS XE" to get more details.

The application supports ASA version 8.4 and higher. More details can be found here: https://community.cisco.com/t5/security-documents/asa-using-packet-capture-to-troubleshoot-asa-firewall/ta-p/3129889


== OPTIONS

--help::
Print program arguments.

--version::
Print program version.

--extcap-interfaces::
List available interfaces.

--extcap-interface=<interface>::
Use specified interfaces.

--extcap-dlts::
List DLTs of specified interface.

--extcap-config::
List configuration options of specified interface.

--capture::
Start capturing from specified interface and save it in place specified by --fifo.

--fifo=<path to file or pipe>::
Save captured packet to file or send it through pipe.

--remote-host=<remote host>::
The address of the remote host for capture.

--remote-port=<remote port>::
The SSH port of the remote host.

--remote-username=<username>::
The username for ssh authentication.

--remote-password=<password>::
The password to use (if not ssh-agent and pubkey are used). WARNING: the
passwords are stored in plaintext and visible to all users on this system. It is
recommended to use keyfiles with a SSH agent.

--remote-filter=<filter>::
+
--
The remote filter on the device. This is a capture filter that follows the Cisco
standards.

For IOS/IOS-XE see https://www.cisco.com/c/en/us/support/docs/ip/access-lists/26448-ACLsamples.html.

For ASA see https://www.cisco.com/c/en/us/td/docs/security/asa/asa96/configuration/firewall/asa-96-firewall-config/access-acls.html.

Multiple filters can be specified using a comma between them. BEWARE: when using
a filter, the default behavior is to drop all the packets except the ones that
fall into the filter.

Examples for IOS/IOS-XE:

    permit ip host MYHOST any, permit ip any host MYHOST (capture the traffic for MYHOST)

    deny ip host MYHOST any, deny ip any host MYHOST, permit ip any any (capture all the traffic except MYHOST)

Examples for ASA:

    permit any4 host MYHOST, permit host MYHOST any4 (capture IPv4 traffic for MYHOST)

NOTE: Different capture types support or do not support specific ACL keywords. The tool is not able to check it, just tries to configure it. If error occurs, the tool just reports it and terminates. Debris are left in configuration in this case.
--

--sshkey=<SSH private key path>::
The path to a private key for authentication.

--remote-interface=<remote interface>::
+
--
The remote network interface to capture from. One interface or list of interface names can be used. Interfaces are separated by comma.  Interface names must be supported by the device.

There are interface names causing different capture types. They are specific to used Cisco software.

*IOS special names*

* `process-switched` - capture process switched packets in both directions
* `from-us` - capture process switched packets originating at the device

*IOS-XE special names*

* `control-plane` - captures in/out packets touching control plane

*ASA special names*

* `asp-drop` - capture packets dropped by all asp categories
* `TYPE---ifname` - syntax to refer ASA capture types, see https://www.cisco.com/c/en/us/td/docs/security/asa/asa-cli-reference/A-H/asa-command-ref-A-H/ca-cld-commands.html#wp2435483314
** `isakmp---ifname` - capture isakmp packets
** `lacp---ifname` - capture lacp packets (just physical interfaces are supported)
** `tls-proxy---ifname` - capture tls-proxy packets
** `inline-tag---ifname` - capture all SGT tagged packets
** `raw-data---ifname` - same as `ifname`
* syntax to capture decrypted traffic for some of capture types:
** `isakmp/decrypted---ifname` - capture isakmp packets including decrypted payload
** `tls-proxy/decrypted---ifname` - capture tls-proxy packets including decrypted payload
** `inline-tag/decrypted---ifname` - capture inline-tag packets including decrypted payload
** `raw-data/decrypted---ifname` - capture raw-data packets including decrypted payload

Use e. g. `isakmp/decrypted---outside` to capture encrypted and decrypted isakmp traffic on `outside` interface.
--

--remote-count=<count>::
Count of packets to capture. Capture is stopped when count is reached.

--extcap-capture-filter=<capture filter>::
Unused (compatibility only).

== EXAMPLES

To see program arguments:

    ciscodump --help

To see program version:

    ciscodump --version

To see interfaces:

    ciscodump --extcap-interfaces

Only one interface (ciscodump) is supported.

.Example output
    interface {value=ciscodump}{display=SSH remote capture}

To see interface DLTs:

    ciscodump --extcap-interface=ciscodump --extcap-dlts

.Example output
    dlt {number=147}{name=ciscodump}{display=Remote capture dependent DLT}

To see interface configuration options:

    ciscodump --extcap-interface=ciscodump --extcap-config

.Example output
    ciscodump --extcap-interface=ciscodump --extcap-config
    arg {number=0}{call=--remote-host}{display=Remote SSH server address}
        {type=string}{tooltip=The remote SSH host. It can be both an IP address or a hostname}
        {required=true}{group=Server}
    arg {number=1}{call=--remote-port}{display=Remote SSH server port}
        {type=unsigned}{default=22}{tooltip=The remote SSH host port (1-65535)}
        {range=1,65535}{group=Server}
    arg {number=2}{call=--remote-username}{display=Remote SSH server username}
        {type=string}{default=<current user>}{tooltip=The remote SSH username. If not provided, the current user will be used}
        {group=Authentication}
    arg {number=3}{call=--remote-password}{display=Remote SSH server password}
        {type=password}{tooltip=The SSH password, used when other methods (SSH agent or key files) are unavailable.}
        {group=Authentication}
    arg {number=4}{call=--sshkey}{display=Path to SSH private key}
        {type=fileselect}{tooltip=The path on the local filesystem of the private ssh key}
        {group=Authentication}
    arg {number=5}{call=--proxycommand}{display=ProxyCommand}
        {type=string}{tooltip=The command to use as proxy for the SSH connection}{group=Authentication}
    arg {number=6}{call--sshkey-passphrase}{display=SSH key passphrase}
        {type=password}{tooltip=Passphrase to unlock the SSH private key}{group=Authentication
    arg {number=7}{call=--remote-interface}{display=Remote interface}
        {type=string}{tooltip=The remote network interface used for capture}
        {required=true}{group=Capture}
    arg {number=8}{call=--remote-filter}{display=Remote capture filter}
        {type=string}{tooltip=The remote capture filter}{default=<filter to exclude current host>}
        {group=Capture}
    arg {number=9}{call=--remote-count}{display=Packets to capture}
        {type=unsigned}{tooltip=The number of remote packets to capture.}
        {required=true}{group=Capture}
    arg {number=10}{call=--debug}{display=Run in debug mode}
        {type=boolflag}{default=false}{tooltip=Print debug messages}
        {required=false}{group=Debug}
    arg {number=11}{call=--debug-file}{display=Use a file for debug}
        {type=string}{tooltip=Set a file where the debug messages are written}
        {required=false}{group=Debug}

To capture on IOS/IOS-XE:

    ciscodump --extcap-interface ciscodump --fifo=/tmp/cisco.pcap --capture --remote-host 192.168.1.10
        --remote-username user --remote-interface gigabit0/0,gigiabit0/1
        --remote-filter "permit ip host 192.168.1.1 any, permit ip any host 192.168.1.1"
        --remote-count=10

To capture on IOS/IOS-XE:

    ciscodump --extcap-interface ciscodump --fifo=/tmp/cisco.pcap --capture --remote-host 192.168.1.10
        --remote-username user --remote-interface outside,dmz
        --remote-filter "permit host 192.168.1.1 any4, permit any4 host 192.168.1.1"
        --remote-count=10

    ciscodump --extcap-interface ciscodump --fifo=/tmp/cisco.pcap --capture --remote-host 192.168.1.10
        --remote-username user --remote-interface raw-data/decrypted---outside
        --remote-filter "permit host 192.168.1.1 any4, permit any4 host 192.168.1.1"

== KNOWN ISSUES

When capture stopped by the user before it finishes on Windows platform, configuration is not cleared on the device. Next run will probably fails because parts of configuration already exists on the device.

Reading performance on IOS/IOS-XE is poor because re-reading of capture buffer over and over.

The configuration of the capture on the device is a multi-step process. If the SSH connection is interrupted during
it, the configuration can be in an inconsistent state. That can happen also if the capture is stopped and ciscodump
can't clean the configuration up. In this case it is necessary to log into the device and manually clean the
configuration, removing configuration elements:

* IOS
** capture points WSC_P_<number> (depends on count of capture interfaces)
** the capture buffer WSC_B
** the capture capture acl WSC_ACL (if filter was used)
* IOS-XE
** the capture WSC
** the capture capture acl WSC_ACL (if filter was used)
* ASA
** the capture WSC
** the capture capture acl WSC_ACL (if filter was used)

On IOS platforms, only IPv4 commands issued and only IPv4 packets are captured.

== SEE ALSO

xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.html[dumpcap](1), xref:extcap.html[extcap](4), xref:sshdump.html[sshdump](1)

== NOTES

*ciscodump* is part of the *Wireshark* distribution.  The latest version
of *Wireshark* can be found at https://www.wireshark.org.

HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.

== AUTHORS

.Original Author
[%hardbreaks]
Dario Lombardo <lomato[AT]gmail.com>