1
/* Copyright (C) 2007-2010 Open Information Security Foundation
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
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.
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
21
* \author Pablo Rincon <pablo.rincon.crespo@gmail.com>
24
#ifndef __APP_LAYER_SSH_H__
25
#define __APP_LAYER_SSH_H__
27
#define SSH_FLAG_SERVER_CHANGE_CIPHER_SPEC 0x01 /**< Flag to indicate that
28
server will now on sends
30
#define SSH_FLAG_CLIENT_CHANGE_CIPHER_SPEC 0x02 /**< Flag to indicate that
31
client will now on sends
34
#define SSH_FLAG_CLIENT_VERSION_PARSED 0x01
35
#define SSH_FLAG_SERVER_VERSION_PARSED 0x02
37
/* This flags indicate that the rest of the communication
38
* must be ciphered, so the parsing finish here */
39
#define SSH_FLAG_PARSER_DONE 0x04
42
#define SSH_MSG_NEWKEYS 21
46
SSH_FIELD_SERVER_VER_STATE_LINE,
47
SSH_FIELD_CLIENT_VER_STATE_LINE,
48
SSH_FIELD_SERVER_PKT_LENGTH,
49
SSH_FIELD_CLIENT_PKT_LENGTH,
50
SSH_FIELD_SERVER_PADDING_LENGTH,
51
SSH_FIELD_CLIENT_PADDING_LENGTH,
52
SSH_FIELD_SERVER_PAYLOAD,
53
SSH_FIELD_CLIENT_PAYLOAD,
59
/** From SSH-TRANSP rfc
61
SSH Bunary packet structure:
64
byte[n1] payload; n1 = packet_length - padding_length - 1
65
byte[n2] random padding; n2 = padding_length
66
byte[m] mac (Message Authentication Code - MAC); m = mac_length
68
So we are going to do a header struct to store
69
the lenghts and msg_code (inside payload, if any)
72
typedef struct SSHHeader_ {
78
/** structure to store the SSH state values */
79
typedef struct SshState_ {
80
uint8_t client_msg_code; /**< Client content type storage field */
81
uint8_t *client_proto_version; /**< Client SSH version storage field */
82
uint8_t *client_software_version; /**< Client SSH version storage field */
84
uint8_t server_msg_code; /**< Server content type storage field */
85
uint8_t *server_proto_version; /**< Server SSH version storage field */
86
uint8_t *server_software_version; /**< Server SSH version storage field */
88
uint8_t flags; /**< Flags to indicate the current SSH
94
void RegisterSSHParsers(void);
95
void SSHParserRegisterTests(void);
97
#endif /* __APP_LAYER_SSH_H__ */