TLS-Attacker icon indicating copy to clipboard operation
TLS-Attacker copied to clipboard

how can i resend a same app message packet in one session.

Open ghost opened this issue 3 years ago • 1 comments

this is my code, i try to use the firse message's message and records to replay the second one, but before execution, it is null.

ghost avatar Dec 06 '21 02:12 ghost

	Config config = Config.createConfig();
    config.setDefaultRunningMode(RunningModeType.CLIENT);
    OutboundConnection outboundConnection = config.getDefaultClientConnection();
    outboundConnection.setPort(Integer.parseInt(args[0]));
    config.setDefaultClientConnection(outboundConnection);
    config.setDefaultSelectedCipherSuite(CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256);
    config.setAddSessionTicketTLSExtension(true);

    WorkflowTrace trace = new WorkflowTrace();
    trace.addTlsAction(MessageActionFactory.createAction(
            config, outboundConnection, ConnectionEndType.CLIENT, new ClientHelloMessage(config)));
    trace.addTlsAction(
            MessageActionFactory.createAction(
                    config,
                    outboundConnection,
                    ConnectionEndType.SERVER,
                    new ServerHelloMessage(config),
                    new CertificateMessage(config),
                    new ECDHEServerKeyExchangeMessage(config),
                    new ServerHelloDoneMessage(config)));
    trace.addTlsAction(
            MessageActionFactory.createAction(
                    config,
                    outboundConnection,
                    ConnectionEndType.CLIENT,
                    new ECDHClientKeyExchangeMessage(config),
                    new ChangeCipherSpecMessage(config),
                    new FinishedMessage(config)));
    trace.addTlsAction(
            MessageActionFactory.createAction(
                    config,
                    outboundConnection,
                    ConnectionEndType.SERVER,
                    new ChangeCipherSpecMessage(config),
                    new FinishedMessage(config)));
    config.setUseFreshRandom(false);
    config.setUseAllProvidedRecords(true);
    ApplicationMessage app1 = new ApplicationMessage(config);
    MessageAction messageAction = MessageActionFactory.createAction(
            config,
            outboundConnection,
            ConnectionEndType.CLIENT,
            app1);
    trace.addTlsAction(messageAction);
    MessageAction messageAction2 = MessageActionFactory.createAction(
            config,
            outboundConnection,
            ConnectionEndType.CLIENT,
            app1);
    messageAction2.setMessages(messageAction.getMessages());
    messageAction2.setRecords(messageAction.getRecords());
    System.out.println(messageAction.getReadableString());
    trace.addTlsAction(messageAction2);
    State state = new State(config, trace);
    WorkflowExecutor workflowExecutor =
            WorkflowExecutorFactory.createWorkflowExecutor(config.getWorkflowExecutorType(), state);
    workflowExecutor.executeWorkflow();

dennisokko avatar Dec 06 '21 02:12 dennisokko