All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.rub.nds.tlsbreaker.breakercommons.util.pcap.ClientSelection Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
/**
 * TLS-Breaker - A tool collection of various attacks on TLS based on TLS-Attacker
 *
 * Copyright 2021-2022 Ruhr University Bochum, Paderborn University, Hackmanit GmbH
 *
 * Licensed under Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0.txt
 */

package de.rub.nds.tlsbreaker.breakercommons.util.pcap;

import java.util.*;

public abstract class ClientSelection {
    private Map> clientSessionsMap = new HashMap<>();

    public ClientSelection(List sessions) {
        initializeClientSessionsMap(sessions);
    }

    private void initializeClientSessionsMap(List sessions) {
        List filteredclient = filterClient(sessions);
        filteredclient.forEach(pcapSession -> {
            String sourceClient = pcapSession.getSourceHost();
            if (clientSessionsMap.containsKey(sourceClient)) {
                clientSessionsMap.get(sourceClient).add(pcapSession);
            } else {
                clientSessionsMap.put(sourceClient, new ArrayList<>(Arrays.asList(pcapSession)));
            }
        });
    }

    public Map> getClientSessionsMap() {
        return this.clientSessionsMap;
    }

    protected abstract List filterClient(List sessions);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy