Skip to content

Commit 473da55

Browse files
Better logging for simple TLS workflows
1 parent a0e97ff commit 473da55

File tree

1 file changed

+13
-1
lines changed
  • Runnable/src/main/java/de/rub/nds/tlsattacker

1 file changed

+13
-1
lines changed

Runnable/src/main/java/de/rub/nds/tlsattacker/Main.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import de.rub.nds.tlsattacker.tls.config.GeneralConfig;
4747
import de.rub.nds.tlsattacker.tls.config.WorkflowTraceSerializer;
4848
import de.rub.nds.tlsattacker.tls.exceptions.ConfigurationException;
49+
import de.rub.nds.tlsattacker.tls.exceptions.WorkflowExecutionException;
50+
import de.rub.nds.tlsattacker.tls.util.LogLevel;
4951
import de.rub.nds.tlsattacker.tls.workflow.TlsContext;
5052
import de.rub.nds.tlsattacker.tls.workflow.WorkflowExecutor;
5153
import de.rub.nds.tlsattacker.transport.TransportHandler;
@@ -54,13 +56,17 @@
5456
import java.io.IOException;
5557
import java.util.List;
5658
import javax.xml.bind.JAXBException;
59+
import org.apache.logging.log4j.LogManager;
60+
import org.apache.logging.log4j.Logger;
5761

5862
/**
5963
*
6064
* @author Juraj Somorovsky <juraj.somorovsky@rub.de>
6165
*/
6266
public class Main {
6367

68+
private static final Logger LOGGER = LogManager.getLogger(Main.class);
69+
6470
public static void main(String[] args) throws Exception {
6571

6672
GeneralConfig generalConfig = new GeneralConfig();
@@ -172,7 +178,13 @@ private static void startSimpleTls(GeneralConfig generalConfig, CommandConfig co
172178
TlsContext tlsContext = configHandler.initializeTlsContext(config);
173179
WorkflowExecutor workflowExecutor = configHandler.initializeWorkflowExecutor(transportHandler, tlsContext);
174180

175-
workflowExecutor.executeWorkflow();
181+
try {
182+
workflowExecutor.executeWorkflow();
183+
} catch (WorkflowExecutionException ex) {
184+
LOGGER.info(ex.getLocalizedMessage(), ex);
185+
LOGGER.log(LogLevel.CONSOLE_OUTPUT,
186+
"The TLS protocol flow was not executed completely, follow the debug messages for more information.");
187+
}
176188

177189
transportHandler.closeConnection();
178190

0 commit comments

Comments
 (0)