Commit latest changes

parent 08729ae7
#!/bin/bash
# WebSocket SSH Tools Clean Script
# Clean script for removing build artifacts from WebSocket SSH tools
#
# Copyright (C) 2024 Stefy Lanza <stefy@nexlab.net> and SexHack.me
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Use build.sh --clean for consistent cleaning
./build.sh --clean --novenv
...@@ -738,10 +738,7 @@ void handle_tunnel_data(SSL *ssl __attribute__((unused)), const char *request_id ...@@ -738,10 +738,7 @@ void handle_tunnel_data(SSL *ssl __attribute__((unused)), const char *request_id
} }
} else { } else {
// No connection established yet - buffer the data // No connection established yet - buffer the data
if (debug) { // Suppress tunnel_data debug messages in debug mode
printf("[DEBUG] No connection established yet, buffering %zu bytes of tunnel_data\n", data_len);
fflush(stdout);
}
// Ensure we have an incoming buffer for wsssh // Ensure we have an incoming buffer for wsssh
if (!tunnel->incoming_buffer) { if (!tunnel->incoming_buffer) {
tunnel->incoming_buffer = frame_buffer_init(); tunnel->incoming_buffer = frame_buffer_init();
...@@ -769,10 +766,7 @@ void handle_tunnel_data(SSL *ssl __attribute__((unused)), const char *request_id ...@@ -769,10 +766,7 @@ void handle_tunnel_data(SSL *ssl __attribute__((unused)), const char *request_id
// Check if target socket is valid // Check if target socket is valid
if (target_sock < 0) { if (target_sock < 0) {
if (debug) { // Suppress tunnel_data debug messages in debug mode
printf("[DEBUG] Target socket not ready yet (sock=%d), ignoring tunnel_data\n", target_sock);
fflush(stdout);
}
pthread_mutex_unlock(&tunnel_mutex); pthread_mutex_unlock(&tunnel_mutex);
return; return;
} }
......
No preview for this file type
...@@ -1871,8 +1871,8 @@ int run_daemon_mode(wsssh_config_t *config, const char *client_id, const char *w ...@@ -1871,8 +1871,8 @@ int run_daemon_mode(wsssh_config_t *config, const char *client_id, const char *w
} }
// Check if this is a data message to suppress verbose logging // Check if this is a data message to suppress verbose logging
int is_data_message = (strstr(buffer, "\"type\":\"tunnel_data\"") != NULL || int is_data_message = (strstr(buffer, "\"type\": \"tunnel_data\"") != NULL ||
strstr(buffer, "\"type\":\"tunnel_response\"") != NULL); strstr(buffer, "\"type\": \"tunnel_response\"") != NULL);
if (config->debug && !is_data_message) { if (config->debug && !is_data_message) {
printf("[DEBUG - WebSockets] Received message: %.*s\n", payload_len, payload); printf("[DEBUG - WebSockets] Received message: %.*s\n", payload_len, payload);
...@@ -1888,13 +1888,12 @@ int run_daemon_mode(wsssh_config_t *config, const char *client_id, const char *w ...@@ -1888,13 +1888,12 @@ int run_daemon_mode(wsssh_config_t *config, const char *client_id, const char *w
// Handle tunnel messages // Handle tunnel messages
if (strstr(buffer, "tunnel_data") || strstr(buffer, "tunnel_response")) { if (strstr(buffer, "tunnel_data") || strstr(buffer, "tunnel_response")) {
if (config->debug) { if (config->debug) {
if (strstr(buffer, "tunnel_data")) { // Suppress tunnel_data debug messages in debug mode
printf("[DEBUG - Tunnel] Received tunnel_data message\n"); if (!strstr(buffer, "tunnel_data")) {
} else {
printf("[DEBUG - Tunnel] Received tunnel_response message\n"); printf("[DEBUG - Tunnel] Received tunnel_response message\n");
}
fflush(stdout); fflush(stdout);
} }
}
// Extract request_id and data // Extract request_id and data
char *id_start = strstr(buffer, "\"request_id\""); char *id_start = strstr(buffer, "\"request_id\"");
char *data_start = strstr(buffer, "\"data\""); char *data_start = strstr(buffer, "\"data\"");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment