Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions learner/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -81,7 +81,7 @@ function install_protocolstatefuzzer() {
(
cd "${PROTOCOLSTATEFUZZER_FOLDER}" || exit
echo "Installing ProtocolState-Fuzzer"
./install.sh
mvn install
)
fi
}
Expand Down
9 changes: 5 additions & 4 deletions learner/pom.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TCP-Learner</groupId>
<artifactId>TCP-Learner</artifactId>
<version>1.0.1-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>


<dependencies>
<dependency>
<groupId>com.github.protocolfuzzing</groupId>
<artifactId>protocolstatefuzzer</artifactId>
<version>1.0.0</version>
<version>0.1.0</version>
</dependency>
</dependencies>
<build>
Expand Down
18 changes: 9 additions & 9 deletions learner/src/Learner/MultiBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -42,27 +42,27 @@ public class MultiBuilder
);

// ExecutionContextImpl, SulBuilderImpl need to be implemented
protected SulBuilder<
protected SULBuilder<
TCPInput,
TCPOutput,
ExecutionContext<TCPInput, TCPOutput, String>
> sulBuilder = new TCPSulBuilder();
protected SulWrapper<
> sulBuilder = new TCPSULBuilder();
protected SULWrapper<
TCPInput,
TCPOutput,
ExecutionContext<TCPInput, TCPOutput, String>
> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TCPInput, TCPOutput, String>
> {

private SocketMapperSul socketSul;
private SocketMapperSUL socketSul;

/** Stores the constructor parameter. */
protected SulConfig sulConfig;
protected SULConfig sulConfig;

/** Stores the constructor parameter. */
protected CleanupTasks cleanupTasks;
Expand All @@ -43,9 +43,9 @@ public class TCPMapperSul
protected TCPMapper mapper;

/** Stores the SulAdapter instance. */
protected SulAdapter sulAdapter;
protected SULAdapter sulAdapter;

public <T extends SulConfig & TCPMapperConfigProvider> TCPMapperSul(
public <T extends SULConfig & TCPMapperConfigProvider> TCPMapperSUL(
T sulConfig,
CleanupTasks cleanupTasks
) throws UnknownHostException, IOException {
Expand All @@ -55,7 +55,7 @@ public <T extends SulConfig & TCPMapperConfigProvider> 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
Expand Down Expand Up @@ -93,7 +93,7 @@ public void run() {
}
);

socketSul = new SocketMapperSul(sock);
socketSul = new SocketMapperSUL(sock);
}

// Before each query we create a blank context
Expand Down Expand Up @@ -186,7 +186,7 @@ public TCPOutput step(TCPInput in) {
}

@Override
public SulConfig getSulConfig() {
public SULConfig getSULConfig() {
return sulConfig;
}

Expand Down Expand Up @@ -217,7 +217,7 @@ > getMapper() {
}

@Override
public SulAdapter getSulAdapter() {
public SULAdapter getSULAdapter() {
return sulAdapter;
}
}
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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'"
Expand Down
Original file line number Diff line number Diff line change
@@ -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<TCPInput, TCPOutput, String>
> {

@Override
public AbstractSul<TCPInput, TCPOutput, ExecutionContext<TCPInput, TCPOutput, String>> buildSul(SulConfig sulConfig,
public AbstractSUL<TCPInput, TCPOutput, ExecutionContext<TCPInput, TCPOutput, String>> buildSUL(SULConfig sulConfig,
CleanupTasks cleanupTasks) {
try {
AbstractSul<
AbstractSUL<
TCPInput,
TCPOutput,
ExecutionContext<TCPInput, TCPOutput, String>
> 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;
Expand All @@ -46,7 +47,14 @@ public AbstractSul<TCPInput, TCPOutput, ExecutionContext<TCPInput, TCPOutput, St
}

@Override
public SulWrapper<TCPInput, TCPOutput, ExecutionContext<TCPInput, TCPOutput, String>> buildWrapper() {
return new SulWrapperStandard<>();
public SULWrapper<TCPInput, TCPOutput, ExecutionContext<TCPInput, TCPOutput, String>> buildWrapper() {
return new SULWrapperStandard<>();
}

// @Override
// public AbstractSUL<TCPInput, TCPOutput, ExecutionContext<TCPInput, TCPOutput, String>> build(SULConfig sulConfig,
// CleanupTasks cleanupTasks) {
// // TODO Auto-generated method stub
// return null;
// }
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 2 additions & 2 deletions learner/src/Learner/TCPStateFuzzerClientConfig.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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;

public class TCPStateFuzzerClientConfig
extends StateFuzzerClientConfigStandard {

public TCPStateFuzzerClientConfig(SulClientConfig sulClientConfig) {
public TCPStateFuzzerClientConfig(SULClientConfig sulClientConfig) {
super(
new LearnerConfigStandard(),
sulClientConfig,
Expand Down
4 changes: 2 additions & 2 deletions learner/src/Learner/TCPStateFuzzerServerConfig.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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;

public class TCPStateFuzzerServerConfig
extends StateFuzzerServerConfigStandard {

public TCPStateFuzzerServerConfig(SulServerConfig sulServerConfig) {
public TCPStateFuzzerServerConfig(SULServerConfig sulServerConfig) {
super(
new LearnerConfigStandard(),
sulServerConfig,
Expand Down