Skip to content

Fix RuntimeException: Unable to initialize transport handler #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,25 @@ public final void executeState(State... states) {
}

public final void executeState(Iterable<State> states) {
parallelExecutor.bulkExecuteStateTasks(states);
extractStats(states);
try {
parallelExecutor.bulkExecuteStateTasks(states);
extractStats(states);
} catch (de.rub.nds.tlsattacker.core.exceptions.TransportHandlerConnectException e) {
LOGGER.warn("Connection failed during probe execution: {}", e.getMessage());
// Don't propagate the exception, allowing the scan to continue with other probes
} catch (RuntimeException e) {
if (e.getMessage() != null
&& e.getMessage().contains("Cannot add Tasks to already shutdown executor")) {
LOGGER.warn(
"ParallelExecutor was shutdown during execution, skipping remaining tasks");
} else {
LOGGER.error("Exception during probe execution: {}", e.getMessage(), e);
}
// Log the exception but don't crash the scanner
} catch (Exception e) {
LOGGER.error("Exception during probe execution: {}", e.getMessage(), e);
// Log the full exception but don't crash the scanner
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ public static void main(String[] args) throws IOException {
.getFullReport());
} catch (ConfigurationException e) {
LOGGER.error("Encountered a ConfigurationException aborting.", e);
} catch (RuntimeException e) {
if (e.getCause()
instanceof
de.rub.nds.tlsattacker.core.exceptions.TransportHandlerConnectException) {
LOGGER.error(
"Scanner terminated due to connection failure: {}",
e.getCause().getMessage());
} else {
LOGGER.error("Scanner terminated unexpectedly", e);
}
}
} catch (ParameterException e) {
LOGGER.error("Could not parse provided parameters", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ private PublicKeyContainer getServerPublicKey() {
try {
publicKey = CertificateFetcher.fetchServerPublicKey(tlsConfig);
} catch (CertificateParsingException ignored) {
} catch (de.rub.nds.tlsattacker.core.exceptions.TransportHandlerConnectException e) {
LOGGER.warn("Unable to connect to server for public key retrieval: {}", e.getMessage());
return null;
} catch (Exception e) {
LOGGER.warn("Failed to retrieve server public key: {}", e.getMessage());
return null;
}
if (publicKey == null) {
LOGGER.debug("Could not retrieve PublicKey from Server - is the Server running?");
Expand Down