]>
The Tcpdump Group git mirrors - tcpdump/blob - print-ssh.c
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
14 /* \summary: Secure Shell (SSH) printer */
20 #include "netdissect-stdinc.h"
25 #include "netdissect.h"
29 ssh_print_version(netdissect_options
*ndo
, const u_char
*pptr
, u_int len
)
33 if ( GET_U_1(pptr
+idx
) != 'S' )
36 if ( GET_U_1(pptr
+idx
) != 'S' )
39 if ( GET_U_1(pptr
+idx
) != 'H' )
42 if ( GET_U_1(pptr
+idx
) != '-' )
47 if (GET_U_1(pptr
+ idx
) == '\n') {
49 * LF without CR; end of line.
50 * Skip the LF and print the line, with the
51 * exception of the LF.
54 } else if (GET_U_1(pptr
+ idx
) == '\r') {
57 /* not in this packet */
60 if (GET_U_1(pptr
+ idx
+ 1) == '\n') {
63 * Skip the CR-LF and print the line, with
64 * the exception of the CR-LF.
70 * CR followed by something else; treat this as
71 * if it were binary data and don't print it.
74 } else if (!isascii(GET_U_1(pptr
+ idx
)) ||
75 !isprint(GET_U_1(pptr
+ idx
)) ) {
77 * Not a printable ASCII character; treat this
78 * as if it were binary data and don't print it.
88 nd_print_protocol_caps(ndo
);
89 ND_PRINT(": %.*s", (int)idx
, pptr
);
94 ssh_print(netdissect_options
*ndo
, const u_char
*pptr
, u_int len
)
96 ndo
->ndo_protocol
= "ssh";
98 ssh_print_version(ndo
, pptr
, len
);