diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..17b2e72 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,19 @@ +name: CI +on: [push, pull_request] + +jobs: + install: + if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} + runs-on: ubuntu-latest + strategy: + fail-fast: true + steps: + - name: Checkout code + uses: actions/checkout@v6 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + - name: Install + run: cd learner; ./install.sh diff --git a/learner/install.sh b/learner/install.sh index d96b2f9..3dbe1ba 100755 --- a/learner/install.sh +++ b/learner/install.sh @@ -8,7 +8,7 @@ readonly LEARNER_SCRIPT_DIR readonly PATCHES_DIR="${LEARNER_SCRIPT_DIR}/experiments/patches" -readonly PROTOCOLSTATEFUZZER_COMMIT="b737a5d" +readonly PROTOCOLSTATEFUZZER_COMMIT="e8cddcc" readonly PROTOCOLSTATEFUZZER_REP_URL="https://github.com/protocol-fuzzing/protocol-state-fuzzer.git" readonly PROTOCOLSTATEFUZZER_FOLDER="ProtocolState-Fuzzer" @@ -81,7 +81,7 @@ function install_protocolstatefuzzer() { ( cd "${PROTOCOLSTATEFUZZER_FOLDER}" || exit echo "Installing ProtocolState-Fuzzer" - ./install.sh + mvn install ) fi } diff --git a/learner/pom.xml b/learner/pom.xml index 8459bbd..305dba9 100644 --- a/learner/pom.xml +++ b/learner/pom.xml @@ -1,4 +1,5 @@ - + + 4.0.0 TCP-Learner TCP-Learner @@ -6,8 +7,8 @@ UTF-8 - 17 - 17 + 21 + 21 @@ -15,7 +16,7 @@ com.github.protocolfuzzing protocolstatefuzzer - 1.0.0 + 0.1.0 diff --git a/learner/src/Learner/MultiBuilder.java b/learner/src/Learner/MultiBuilder.java index 7272589..d4a5e5b 100644 --- a/learner/src/Learner/MultiBuilder.java +++ b/learner/src/Learner/MultiBuilder.java @@ -4,9 +4,9 @@ import com.github.protocolfuzzing.protocolstatefuzzer.components.learner.alphabet.AlphabetBuilderStandard; import com.github.protocolfuzzing.protocolstatefuzzer.components.learner.alphabet.xml.AlphabetSerializerXml; import com.github.protocolfuzzing.protocolstatefuzzer.components.learner.statistics.MealyMachineWrapper; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulBuilder; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulWrapper; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulWrapperStandard; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULBuilder; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULWrapper; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULWrapperStandard; import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.mapper.context.ExecutionContext; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.core.StateFuzzer; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.core.StateFuzzerBuilder; @@ -42,27 +42,27 @@ public class MultiBuilder ); // ExecutionContextImpl, SulBuilderImpl need to be implemented - protected SulBuilder< + protected SULBuilder< TCPInput, TCPOutput, ExecutionContext - > sulBuilder = new TCPSulBuilder(); - protected SulWrapper< + > sulBuilder = new TCPSULBuilder(); + protected SULWrapper< TCPInput, TCPOutput, ExecutionContext - > sulWrapper = new SulWrapperStandard<>(); + > sulWrapper = new SULWrapperStandard<>(); // SulClientConfigImpl and MapperConfigImpl need to be implemented @Override public StateFuzzerClientConfig buildClientConfig() { - return new TCPStateFuzzerClientConfig(new TCPSulClientConfig()); + return new TCPStateFuzzerClientConfig(new TCPSULClientConfig()); } // SulServerConfigImpl (and MapperConfigImpl) need to be implemented @Override public StateFuzzerServerConfig buildServerConfig() { - return new TCPStateFuzzerServerConfig(new TCPSulServerConfig()); + return new TCPStateFuzzerServerConfig(new TCPSULServerConfig()); } @Override diff --git a/learner/src/Learner/SocketMapperSul.java b/learner/src/Learner/SocketMapperSUL.java similarity index 97% rename from learner/src/Learner/SocketMapperSul.java rename to learner/src/Learner/SocketMapperSUL.java index 4d685f9..4d37777 100644 --- a/learner/src/Learner/SocketMapperSul.java +++ b/learner/src/Learner/SocketMapperSUL.java @@ -9,12 +9,12 @@ /** * Socket interface with the external SSH mapper (test harness). */ -public class SocketMapperSul { +public class SocketMapperSUL { private PrintWriter sockout; private BufferedReader sockin; - public SocketMapperSul(Socket sock) { + public SocketMapperSUL(Socket sock) { try { // Create socket out (no buffering) and in sockout = new PrintWriter(sock.getOutputStream(), true); diff --git a/learner/src/Learner/TCPMapperSul.java b/learner/src/Learner/TCPMapperSUL.java similarity index 94% rename from learner/src/Learner/TCPMapperSul.java rename to learner/src/Learner/TCPMapperSUL.java index 272df6b..93dfb91 100644 --- a/learner/src/Learner/TCPMapperSul.java +++ b/learner/src/Learner/TCPMapperSUL.java @@ -5,27 +5,27 @@ import java.net.UnknownHostException; import java.util.concurrent.ThreadLocalRandom; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.AbstractSul; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulAdapter; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SulConfig; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.AbstractSUL; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULAdapter; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SULConfig; import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.sulwrappers.DynamicPortProvider; import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.sulwrappers.ProcessHandler; import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.mapper.Mapper; import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.mapper.context.ExecutionContext; import com.github.protocolfuzzing.protocolstatefuzzer.utils.CleanupTasks; -public class TCPMapperSul +public class TCPMapperSUL implements - AbstractSul< + AbstractSUL< TCPInput, TCPOutput, ExecutionContext > { - private SocketMapperSul socketSul; + private SocketMapperSUL socketSul; /** Stores the constructor parameter. */ - protected SulConfig sulConfig; + protected SULConfig sulConfig; /** Stores the constructor parameter. */ protected CleanupTasks cleanupTasks; @@ -43,9 +43,9 @@ public class TCPMapperSul protected TCPMapper mapper; /** Stores the SulAdapter instance. */ - protected SulAdapter sulAdapter; + protected SULAdapter sulAdapter; - public TCPMapperSul( + public TCPMapperSUL( T sulConfig, CleanupTasks cleanupTasks ) throws UnknownHostException, IOException { @@ -55,7 +55,7 @@ public TCPMapperSul( this.cleanupTasks = cleanupTasks; // mapper and sulAdapter will be provided in subclasses this.mapper = new TCPMapper(); - this.sulAdapter = new TCPSulAdapter(); + this.sulAdapter = new TCPSULAdapter(); // ------------------------------------------------------------------- String mapperAddress = sulConfig @@ -93,7 +93,7 @@ public void run() { } ); - socketSul = new SocketMapperSul(sock); + socketSul = new SocketMapperSUL(sock); } // Before each query we create a blank context @@ -186,7 +186,7 @@ public TCPOutput step(TCPInput in) { } @Override - public SulConfig getSulConfig() { + public SULConfig getSULConfig() { return sulConfig; } @@ -217,7 +217,7 @@ > getMapper() { } @Override - public SulAdapter getSulAdapter() { + public SULAdapter getSULAdapter() { return sulAdapter; } } diff --git a/learner/src/Learner/TCPSulAdapter.java b/learner/src/Learner/TCPSULAdapter.java similarity index 91% rename from learner/src/Learner/TCPSulAdapter.java rename to learner/src/Learner/TCPSULAdapter.java index c770015..1dfa2b8 100644 --- a/learner/src/Learner/TCPSulAdapter.java +++ b/learner/src/Learner/TCPSULAdapter.java @@ -1,8 +1,8 @@ package Learner; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulAdapter; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULAdapter; -public class TCPSulAdapter implements SulAdapter { +public class TCPSULAdapter implements SULAdapter { @Override public void connect() { @@ -33,7 +33,7 @@ public boolean checkStopped() { } @Override - public Integer getSulPort() { + public Integer getSULPort() { // TODO Auto-generated method stub throw new UnsupportedOperationException( "Unimplemented method 'getSulPort'" diff --git a/learner/src/Learner/TCPSulBuilder.java b/learner/src/Learner/TCPSULBuilder.java similarity index 60% rename from learner/src/Learner/TCPSulBuilder.java rename to learner/src/Learner/TCPSULBuilder.java index 6a8489f..3888649 100644 --- a/learner/src/Learner/TCPSulBuilder.java +++ b/learner/src/Learner/TCPSULBuilder.java @@ -1,40 +1,41 @@ package Learner; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.AbstractSul; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulBuilder; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulWrapper; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SulWrapperStandard; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SulConfig; +import java.io.IOException; + +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.AbstractSUL; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULBuilder; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULWrapper; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.SULWrapperStandard; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SULConfig; import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.mapper.context.ExecutionContext; import com.github.protocolfuzzing.protocolstatefuzzer.utils.CleanupTasks; -import java.io.IOException; -public class TCPSulBuilder +public class TCPSULBuilder implements - SulBuilder< + SULBuilder< TCPInput, TCPOutput, ExecutionContext > { @Override - public AbstractSul> buildSul(SulConfig sulConfig, + public AbstractSUL> buildSUL(SULConfig sulConfig, CleanupTasks cleanupTasks) { try { - AbstractSul< + AbstractSUL< TCPInput, TCPOutput, ExecutionContext > tcpSulConfig = null; if (sulConfig.isFuzzingClient()) { - tcpSulConfig = new TCPMapperSul( - (TCPSulClientConfig) sulConfig, + tcpSulConfig = new TCPMapperSUL( + (TCPSULClientConfig) sulConfig, cleanupTasks ); return tcpSulConfig; } else { - tcpSulConfig = new TCPMapperSul( - (TCPSulServerConfig) sulConfig, + tcpSulConfig = new TCPMapperSUL( + (TCPSULServerConfig) sulConfig, cleanupTasks ); return tcpSulConfig; @@ -46,7 +47,14 @@ public AbstractSul> buildWrapper() { - return new SulWrapperStandard<>(); + public SULWrapper> buildWrapper() { + return new SULWrapperStandard<>(); } + +// @Override +// public AbstractSUL> build(SULConfig sulConfig, +// CleanupTasks cleanupTasks) { +// // TODO Auto-generated method stub +// return null; +// } } diff --git a/learner/src/Learner/TCPSulClientConfig.java b/learner/src/Learner/TCPSULClientConfig.java similarity index 50% rename from learner/src/Learner/TCPSulClientConfig.java rename to learner/src/Learner/TCPSULClientConfig.java index 056256a..300395e 100644 --- a/learner/src/Learner/TCPSulClientConfig.java +++ b/learner/src/Learner/TCPSULClientConfig.java @@ -1,21 +1,21 @@ package Learner; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SULClientConfigStandard; import com.beust.jcommander.ParametersDelegate; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SulClientConfigStandard; -public class TCPSulClientConfig - extends SulClientConfigStandard +public class TCPSULClientConfig + extends SULClientConfigStandard implements TCPMapperConfigProvider { @ParametersDelegate - private TCPMapperConfig sshMapperConfig; + private TCPMapperConfig tcpMapperConfig; - public TCPSulClientConfig() { - sshMapperConfig = new TCPMapperConfig(); + public TCPSULClientConfig() { + tcpMapperConfig = new TCPMapperConfig(); } @Override public TCPMapperConfig getTCPMapperConfig() { - return sshMapperConfig; + return tcpMapperConfig; } } diff --git a/learner/src/Learner/TCPSulServerConfig.java b/learner/src/Learner/TCPSULServerConfig.java similarity index 50% rename from learner/src/Learner/TCPSulServerConfig.java rename to learner/src/Learner/TCPSULServerConfig.java index 0ff1492..5539dc7 100644 --- a/learner/src/Learner/TCPSulServerConfig.java +++ b/learner/src/Learner/TCPSULServerConfig.java @@ -1,21 +1,21 @@ package Learner; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SULServerConfigStandard; import com.beust.jcommander.ParametersDelegate; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SulServerConfigStandard; -public class TCPSulServerConfig - extends SulServerConfigStandard +public class TCPSULServerConfig + extends SULServerConfigStandard implements TCPMapperConfigProvider { @ParametersDelegate - private TCPMapperConfig sshMapperConfig; + private TCPMapperConfig tcpMapperConfig; - public TCPSulServerConfig() { - sshMapperConfig = new TCPMapperConfig(); + public TCPSULServerConfig() { + tcpMapperConfig = new TCPMapperConfig(); } @Override public TCPMapperConfig getTCPMapperConfig() { - return sshMapperConfig; + return tcpMapperConfig; } } diff --git a/learner/src/Learner/TCPStateFuzzerClientConfig.java b/learner/src/Learner/TCPStateFuzzerClientConfig.java index ba773a1..7b0c678 100644 --- a/learner/src/Learner/TCPStateFuzzerClientConfig.java +++ b/learner/src/Learner/TCPStateFuzzerClientConfig.java @@ -1,7 +1,7 @@ package Learner; import com.github.protocolfuzzing.protocolstatefuzzer.components.learner.config.LearnerConfigStandard; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SulClientConfig; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SULClientConfig; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.core.config.StateFuzzerClientConfigStandard; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.testrunner.core.config.TestRunnerConfigStandard; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.testrunner.timingprobe.config.TimingProbeConfigStandard; @@ -9,7 +9,7 @@ public class TCPStateFuzzerClientConfig extends StateFuzzerClientConfigStandard { - public TCPStateFuzzerClientConfig(SulClientConfig sulClientConfig) { + public TCPStateFuzzerClientConfig(SULClientConfig sulClientConfig) { super( new LearnerConfigStandard(), sulClientConfig, diff --git a/learner/src/Learner/TCPStateFuzzerServerConfig.java b/learner/src/Learner/TCPStateFuzzerServerConfig.java index 5f4b690..b77f350 100644 --- a/learner/src/Learner/TCPStateFuzzerServerConfig.java +++ b/learner/src/Learner/TCPStateFuzzerServerConfig.java @@ -1,7 +1,7 @@ package Learner; import com.github.protocolfuzzing.protocolstatefuzzer.components.learner.config.LearnerConfigStandard; -import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SulServerConfig; +import com.github.protocolfuzzing.protocolstatefuzzer.components.sul.core.config.SULServerConfig; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.core.config.StateFuzzerServerConfigStandard; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.testrunner.core.config.TestRunnerConfigStandard; import com.github.protocolfuzzing.protocolstatefuzzer.statefuzzer.testrunner.timingprobe.config.TimingProbeConfigStandard; @@ -9,7 +9,7 @@ public class TCPStateFuzzerServerConfig extends StateFuzzerServerConfigStandard { - public TCPStateFuzzerServerConfig(SulServerConfig sulServerConfig) { + public TCPStateFuzzerServerConfig(SULServerConfig sulServerConfig) { super( new LearnerConfigStandard(), sulServerConfig,