suricata
app-layer-ssh.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2014 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Pablo Rincon <pablo.rincon.crespo@gmail.com>
22  * \author Victor Julien <victor@inliniac.net>
23  */
24 
25 #ifndef __APP_LAYER_SSH_H__
26 #define __APP_LAYER_SSH_H__
27 
28 /* header flag */
29 #define SSH_FLAG_VERSION_PARSED 0x01
30 
31 /* This flags indicate that the rest of the communication
32  * must be ciphered, so the parsing finish here */
33 #define SSH_FLAG_PARSER_DONE 0x02
34 
35 /* MSG_CODE */
36 #define SSH_MSG_NEWKEYS 21
37 
38 /** From SSH-TRANSP rfc
39 
40  SSH Bunary packet structure:
41  uint32 packet_length
42  byte padding_length
43  byte[n1] payload; n1 = packet_length - padding_length - 1
44  byte[n2] random padding; n2 = padding_length
45  byte[m] mac (Message Authentication Code - MAC); m = mac_length
46 
47  So we are going to do a header struct to store
48  the lenghts and msg_code (inside payload, if any)
49 */
50 
51 typedef struct SshHeader_ {
52  uint32_t pkt_len;
53  uint8_t padding_len;
54  uint8_t msg_code;
55  uint16_t banner_len;
56  uint8_t buf[6];
57  uint8_t buf_offset;
58  uint8_t flags;
59  uint32_t record_left;
60  uint8_t *proto_version;
61  uint8_t *software_version;
62  uint8_t *banner_buffer;
63 } SshHeader;
64 
65 enum {
69 };
70 
71 /** structure to store the SSH state values */
72 typedef struct SshState_ {
75 
76  /* specifies which loggers are done logging */
77  uint32_t logged;
78 
79  uint64_t detect_flags_ts;
80  uint64_t detect_flags_tc;
81 
83 } SshState;
84 
85 void RegisterSSHParsers(void);
86 void SSHParserRegisterTests(void);
87 
88 #endif /* __APP_LAYER_SSH_H__ */
89 
uint32_t logged
Definition: app-layer-ssh.h:77
SshHeader cli_hdr
Definition: app-layer-ssh.h:74
uint8_t * proto_version
Definition: app-layer-ssh.h:60
uint8_t msg_code
Definition: app-layer-ssh.h:54
uint32_t record_left
Definition: app-layer-ssh.h:59
struct SshHeader_ SshHeader
void RegisterSSHParsers(void)
Function to register the SSH protocol parsers and other functions.
SshHeader srv_hdr
Definition: app-layer-ssh.h:73
uint8_t * software_version
Definition: app-layer-ssh.h:61
uint16_t banner_len
Definition: app-layer-ssh.h:55
uint64_t detect_flags_ts
Definition: app-layer-ssh.h:79
uint8_t * banner_buffer
Definition: app-layer-ssh.h:62
uint8_t flags
Definition: app-layer-ssh.h:58
DetectEngineState * de_state
Definition: app-layer-ssh.h:82
uint8_t buf[6]
Definition: app-layer-ssh.h:56
struct SshState_ SshState
uint8_t buf_offset
Definition: app-layer-ssh.h:57
uint8_t padding_len
Definition: app-layer-ssh.h:53
void SSHParserRegisterTests(void)
uint32_t pkt_len
Definition: app-layer-ssh.h:52
uint64_t detect_flags_tc
Definition: app-layer-ssh.h:80