2020import de .rub .nds .tlsattacker .core .workflow .action .TlsAction ;
2121import de .rub .nds .tlsattacker .core .workflow .factory .WorkflowConfigurationFactory ;
2222import java .io .IOException ;
23+ import java .net .SocketException ;
2324import java .util .LinkedList ;
2425import java .util .List ;
26+ import org .apache .logging .log4j .LogManager ;
27+ import org .apache .logging .log4j .Logger ;
2528
2629/**
2730 * This Action is used by the EarlyCcs Attack. It sends a ClientKeyExchange
3033 */
3134public class EarlyCcsAction extends TlsAction {
3235
36+ private static final Logger LOGGER = LogManager .getLogger ();
37+
3338 private final Boolean targetOpenssl1_0_0 ;
3439
40+ private boolean executedAsPlanned = false ;
41+
3542 /**
3643 * Constructor for the Action. If the target is Openssl 1.0.0 the boolean
3744 * value should be set to true
@@ -76,8 +83,15 @@ public void execute(State state) throws IOException {
7683 recordList .add (new Record ());
7784 byte [] prepareRecords = state .getTlsContext ().getRecordLayer ()
7885 .prepareRecords (protocolMessageBytes , ProtocolMessageType .HANDSHAKE , recordList );
79- state .getTlsContext ().getTransportHandler ().sendData (prepareRecords );
86+ try {
87+ state .getTlsContext ().getTransportHandler ().sendData (prepareRecords );
88+ executedAsPlanned = true ;
89+ } catch (SocketException E ) {
90+ LOGGER .debug ("Could not write Data to stream" , E );
91+ executedAsPlanned = false ;
92+ }
8093 setExecuted (true );
94+
8195 }
8296
8397 /**
@@ -86,11 +100,12 @@ public void execute(State state) throws IOException {
86100 @ Override
87101 public void reset () {
88102 setExecuted (false );
103+ executedAsPlanned = false ;
89104 }
90105
91106 @ Override
92107 public boolean executedAsPlanned () {
93- return isExecuted () ;
108+ return executedAsPlanned ;
94109 }
95110
96111}
0 commit comments