RDP录像不再记录安全协议规格。

pull/175/head^2
Apex Liu 2019-09-02 03:44:08 +08:00
parent db0990d8c2
commit f5b00ca02a
1 changed files with 42 additions and 46 deletions

View File

@ -20,45 +20,43 @@
*/ */
// 录像文件头(随着录像数据写入,会改变的部分) // 录像文件头(随着录像数据写入,会改变的部分)
typedef struct TS_RECORD_HEADER_INFO typedef struct TS_RECORD_HEADER_INFO {
{ ex_u32 magic; // "TPPR" 标志 TelePort Protocol Record
ex_u32 magic; // "TPPR" 标志 TelePort Protocol Record ex_u16 ver; // 录像文件版本目前为3
ex_u16 ver; // 录像文件版本目前为3 ex_u32 packages; // 总包数
ex_u32 packages; // 总包数 ex_u32 time_ms; // 总耗时(毫秒)
ex_u32 time_ms; // 总耗时(毫秒) //ex_u32 file_size; // 数据文件大小
//ex_u32 file_size; // 数据文件大小
}TS_RECORD_HEADER_INFO; }TS_RECORD_HEADER_INFO;
#define ts_record_header_info_size sizeof(TS_RECORD_HEADER_INFO) #define ts_record_header_info_size sizeof(TS_RECORD_HEADER_INFO)
// 录像文件头(固定不变部分) // 录像文件头(固定不变部分)
typedef struct TS_RECORD_HEADER_BASIC typedef struct TS_RECORD_HEADER_BASIC {
{ ex_u16 protocol_type; // 协议1=RDP, 2=SSH, 3=Telnet
ex_u16 protocol_type; // 协议1=RDP, 2=SSH, 3=Telnet ex_u16 protocol_sub_type; // 子协议100=RDP-DESKTOP, 200=SSH-SHELL, 201=SSH-SFTP, 300=Telnet
ex_u16 protocol_sub_type; // 子协议100=RDP-DESKTOP, 200=SSH-SHELL, 201=SSH-SFTP, 300=Telnet ex_u64 timestamp; // 本次录像的起始时间UTC时间戳
ex_u64 timestamp; // 本次录像的起始时间UTC时间戳 ex_u16 width; // 初始屏幕尺寸:宽
ex_u16 width; // 初始屏幕尺寸:宽 ex_u16 height; // 初始屏幕尺寸:高
ex_u16 height; // 初始屏幕尺寸:高 char user_username[64]; // teleport账号
char user_username[64]; // teleport账号 char acc_username[64]; // 远程主机用户名
char acc_username[64]; // 远程主机用户名
char host_ip[40]; // 远程主机IP char host_ip[40]; // 远程主机IP
char conn_ip[40]; // 远程主机IP char conn_ip[40]; // 远程主机IP
ex_u16 conn_port; // 远程主机端口 ex_u16 conn_port; // 远程主机端口
char client_ip[40]; // 客户端IP char client_ip[40]; // 客户端IP
// RDP专有 // // RDP专有
ex_u8 rdp_security; // 0 = RDP, 1 = TLS // ex_u8 rdp_security; // 0 = RDP, 1 = TLS
ex_u8 _reserve[512 - 2 - 2 - 8 - 2 - 2 - 64 - 64 - 40 - 40 - 2 - 40 - 1 - ts_record_header_info_size]; // ex_u8 _reserve[512 - 2 - 2 - 8 - 2 - 2 - 64 - 64 - 40 - 40 - 2 - 40 - 1 - ts_record_header_info_size];
ex_u8 _reserve[512 - 2 - 2 - 8 - 2 - 2 - 64 - 64 - 40 - 40 - 2 - 40 - ts_record_header_info_size];
}TS_RECORD_HEADER_BASIC; }TS_RECORD_HEADER_BASIC;
#define ts_record_header_basic_size sizeof(TS_RECORD_HEADER_BASIC) #define ts_record_header_basic_size sizeof(TS_RECORD_HEADER_BASIC)
typedef struct TS_RECORD_HEADER typedef struct TS_RECORD_HEADER {
{ TS_RECORD_HEADER_INFO info;
TS_RECORD_HEADER_INFO info; TS_RECORD_HEADER_BASIC basic;
TS_RECORD_HEADER_BASIC basic;
}TS_RECORD_HEADER; }TS_RECORD_HEADER;
// header部分header-info + header-basic = 512B // header部分header-info + header-basic = 512B
@ -66,36 +64,34 @@ typedef struct TS_RECORD_HEADER
// 一个数据包的头 // 一个数据包的头
typedef struct TS_RECORD_PKG typedef struct TS_RECORD_PKG {
{ ex_u8 type; // 包的数据类型
ex_u8 type; // 包的数据类型 ex_u32 size; // 这个包的总大小(不含包头)
ex_u32 size; // 这个包的总大小(不含包头) ex_u32 time_ms; // 这个包距起始时间的时间差毫秒意味着一个连接不能持续超过49天
ex_u32 time_ms; // 这个包距起始时间的时间差毫秒意味着一个连接不能持续超过49天 ex_u8 _reserve[3]; // 保留
ex_u8 _reserve[3]; // 保留
}TS_RECORD_PKG; }TS_RECORD_PKG;
#pragma pack(pop) #pragma pack(pop)
class TppRecBase class TppRecBase {
{
public: public:
TppRecBase(); TppRecBase();
virtual ~TppRecBase(); virtual ~TppRecBase();
bool begin(const wchar_t* base_path, const wchar_t* base_fname, int record_id, const TPP_CONNECT_INFO* info); bool begin(const wchar_t* base_path, const wchar_t* base_fname, int record_id, const TPP_CONNECT_INFO* info);
bool end(); bool end();
protected: protected:
virtual bool _on_begin(const TPP_CONNECT_INFO* info) = 0; virtual bool _on_begin(const TPP_CONNECT_INFO* info) = 0;
virtual bool _on_end() = 0; virtual bool _on_end() = 0;
protected: protected:
ex_wstr m_base_path; // 录像文件基础路径,例如 /usr/local/teleport/data/replay/ssh/123数字编号是内部附加的作为本次会话录像文件的目录名称 ex_wstr m_base_path; // 录像文件基础路径,例如 /usr/local/teleport/data/replay/ssh/123数字编号是内部附加的作为本次会话录像文件的目录名称
ex_wstr m_base_fname; // 录像文件的文件名,不含扩展名部分,内部会以此为基础合成文件全名,并将录像文件存放在 m_base_path 指向的目录中 ex_wstr m_base_fname; // 录像文件的文件名,不含扩展名部分,内部会以此为基础合成文件全名,并将录像文件存放在 m_base_path 指向的目录中
ex_u64 m_start_time; ex_u64 m_start_time;
MemBuffer m_cache; MemBuffer m_cache;
}; };
#endif // __TS_BASE_RECORD_H__ #endif // __TS_BASE_RECORD_H__