Skip to content

Commit

Permalink
Merge pull request #49 from tls-attacker/lucky13internals
Browse files Browse the repository at this point in the history
Allow access to Lucky13 attacker internals
  • Loading branch information
mmaehren authored Mar 6, 2024
2 parents ab03ab1 + e1d06e6 commit a497c1d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,12 @@ private int parsePort(String portStr) {
}
return port;
}

public void setProxyData(String proxyData) {
this.proxyData = proxyData;
}

public void setProxyControl(String proxyControl) {
this.proxyControl = proxyControl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,7 @@ public void executeAttackRound(Record record) {
.getDefaultClientConnection()
.setTransportHandlerType(TransportHandlerType.TCP_PROXY_TIMING);
tlsConfig.setWorkflowExecutorShouldClose(true);

WorkflowTrace trace =
new WorkflowConfigurationFactory(tlsConfig)
.createWorkflowTrace(WorkflowTraceType.FULL, RunningModeType.CLIENT);

SendAction sendAction = (SendAction) trace.getLastSendingAction();
LinkedList<AbstractRecord> records = new LinkedList<>();
records.add(record);
sendAction.setRecords(records);

ReceiveAction action = new ReceiveAction();

AlertMessage alertMessage = new AlertMessage(tlsConfig);
List<ProtocolMessage> messages = new LinkedList<>();
messages.add(alertMessage);
action.setExpectedMessages(messages);
trace.addTlsAction(action);

State state = new State(tlsConfig, trace);
State state = buildAttackState(record);
WorkflowExecutor workflowExecutor =
WorkflowExecutorFactory.createWorkflowExecutor(
tlsConfig.getWorkflowExecutorType(), state);
Expand All @@ -131,7 +113,25 @@ public void executeAttackRound(Record record) {
}
}

private Record createRecordWithPadding(int p, CipherSuite suite) {
public State buildAttackState(Record record) {
WorkflowTrace trace =
new WorkflowConfigurationFactory(tlsConfig)
.createWorkflowTrace(WorkflowTraceType.FULL, RunningModeType.CLIENT);
SendAction sendAction = (SendAction) trace.getLastSendingAction();
LinkedList<AbstractRecord> records = new LinkedList<>();
records.add(record);
sendAction.setRecords(records);
ReceiveAction action = new ReceiveAction();
AlertMessage alertMessage = new AlertMessage(tlsConfig);
List<ProtocolMessage> messages = new LinkedList<>();
messages.add(alertMessage);
action.setExpectedMessages(messages);
trace.addTlsAction(action);
State state = new State(tlsConfig, trace);
return state;
}

public Record createRecordWithPadding(int p, CipherSuite suite) {
byte[] padding = createPaddingBytes(p);
int recordLength = AlgorithmResolver.getCipher(suite).getBlocksize() * config.getBlocks();
if (recordLength < padding.length) {
Expand Down

0 comments on commit a497c1d

Please sign in to comment.