From dd742ed655c1d6344c8ca88f86f246200da32b04 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 18 Feb 2019 22:32:25 +0300 Subject: Add function connect_client into socket interface --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 ++ .../HPMHooking/HPMHooking_char.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_char.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 27 ++++++++++++++++++++++ .../HPMHooking/HPMHooking_login.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_login.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 27 ++++++++++++++++++++++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 ++++++++++++++++++++++ 10 files changed, 98 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 7cc5ef2b1..c764d0290 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7538,6 +7538,8 @@ typedef void (*HPMHOOK_pre_sockt_flush) (int *fd); typedef void (*HPMHOOK_post_sockt_flush) (int fd); typedef void (*HPMHOOK_pre_sockt_flush_fifos) (void); typedef void (*HPMHOOK_post_sockt_flush_fifos) (void); +typedef int (*HPMHOOK_pre_sockt_connect_client) (int *listen_fd); +typedef int (*HPMHOOK_post_sockt_connect_client) (int retVal___, int listen_fd); typedef void (*HPMHOOK_pre_sockt_set_nonblocking) (int *fd, unsigned long *yes); typedef void (*HPMHOOK_post_sockt_set_nonblocking) (int fd, unsigned long yes); typedef void (*HPMHOOK_pre_sockt_set_defaultparse) (ParseFunc *defaultparse); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index a8b4860f3..dbabf8ed4 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1422,6 +1422,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -3059,6 +3061,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 56c5bcfb7..f666ad1fd 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -758,6 +758,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 0bd61ba15..edffe7c11 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -18686,6 +18686,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 7293e8fc4..ba0fe05c2 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -584,6 +584,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -1383,6 +1385,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 825e049b1..1e3548621 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -326,6 +326,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 044ee2df2..080fb75ff 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -7495,6 +7495,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b323d77e6..70604ff9e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -6042,6 +6042,8 @@ struct { struct HPMHookPoint *HP_sockt_flush_post; struct HPMHookPoint *HP_sockt_flush_fifos_pre; struct HPMHookPoint *HP_sockt_flush_fifos_post; + struct HPMHookPoint *HP_sockt_connect_client_pre; + struct HPMHookPoint *HP_sockt_connect_client_post; struct HPMHookPoint *HP_sockt_set_nonblocking_pre; struct HPMHookPoint *HP_sockt_set_nonblocking_post; struct HPMHookPoint *HP_sockt_set_defaultparse_pre; @@ -12711,6 +12713,8 @@ struct { int HP_sockt_flush_post; int HP_sockt_flush_fifos_pre; int HP_sockt_flush_fifos_post; + int HP_sockt_connect_client_pre; + int HP_sockt_connect_client_post; int HP_sockt_set_nonblocking_pre; int HP_sockt_set_nonblocking_post; int HP_sockt_set_defaultparse_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3c09aba59..f081fd520 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -3089,6 +3089,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, { HP_POP(sockt->flush_fifos, HP_sockt_flush_fifos) }, + { HP_POP(sockt->connect_client, HP_sockt_connect_client) }, { HP_POP(sockt->set_nonblocking, HP_sockt_set_nonblocking) }, { HP_POP(sockt->set_defaultparse, HP_sockt_set_defaultparse) }, { HP_POP(sockt->host2ip, HP_sockt_host2ip) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 8242b9797..d18b4f360 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -80816,6 +80816,33 @@ void HP_sockt_flush_fifos(void) { } return; } +int HP_sockt_connect_client(int listen_fd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_sockt_connect_client_pre > 0) { + int (*preHookFunc) (int *listen_fd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_connect_client_pre[hIndex].func; + retVal___ = preHookFunc(&listen_fd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.sockt.connect_client(listen_fd); + } + if (HPMHooks.count.HP_sockt_connect_client_post > 0) { + int (*postHookFunc) (int retVal___, int listen_fd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_connect_client_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_connect_client_post[hIndex].func; + retVal___ = postHookFunc(retVal___, listen_fd); + } + } + return retVal___; +} void HP_sockt_set_nonblocking(int fd, unsigned long yes) { int hIndex = 0; if (HPMHooks.count.HP_sockt_set_nonblocking_pre > 0) { -- cgit v1.2.3-60-g2f50