-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'phg/numberStringQueryParam' of github.com:EMResearch/Ev…
…oMaster into phg/numberStringQueryParam
- Loading branch information
Showing
25 changed files
with
448 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM amazoncorretto:21-alpine-jdk | ||
|
||
COPY core/target/evomaster.jar . | ||
|
||
ENTRYPOINT [ \ | ||
"java", \ | ||
"-Xmx4G", \ | ||
"-jar", "evomaster.jar", \ | ||
"--runningInDocker", "true" \ | ||
] | ||
|
||
|
||
################### | ||
###### NOTES ###### | ||
################### | ||
# Build | ||
# docker build -t webfuzzing/evomaster . | ||
# | ||
# Run | ||
# docker run webfuzzing/evomaster <options> | ||
# | ||
# Publish (latest, otherwise tag with :TAG) | ||
# docker login | ||
# docker push webfuzzing/evomaster | ||
# | ||
# Example remote BB | ||
# docker run -v "/$(pwd)/generated_tests":/generated_tests webfuzzing/evomaster --blackBox true --bbSwaggerUrl https://api.apis.guru/v2/openapi.yaml --outputFormat JAVA_JUNIT_4 --maxTime 10s --ratePerMinute 60 | ||
# | ||
# Example local BB | ||
# docker run -v "/$(pwd)/generated_tests":/generated_tests webfuzzing/evomaster --blackBox true --bbSwaggerUrl http://host.docker.internal:8080/v3/api-docs --maxTime 5s | ||
# | ||
# Example WB (NOT IMPLEMENTED YET) | ||
# docker run -v "/$(pwd)/generated_tests":/generated_tests webfuzzing/evomaster --dockerLocalhost true | ||
# | ||
# Setting for existing em.yaml | ||
# -v "/$(pwd)/em.yaml":/em.yaml | ||
# | ||
# Debugging | ||
# docker run -it --entrypoint sh webfuzzing/evomaster | ||
# | ||
# | ||
# | ||
# | ||
# | ||
# | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ava/sql/src/main/java/org/evomaster/client/java/sql/internal/SqlHeuristicsCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.evomaster.client.java.sql.internal; | ||
|
||
import net.sf.jsqlparser.expression.Expression; | ||
import net.sf.jsqlparser.statement.Statement; | ||
import net.sf.jsqlparser.statement.select.FromItem; | ||
import org.evomaster.client.java.controller.api.dto.database.schema.DbInfoDto; | ||
import org.evomaster.client.java.sql.QueryResult; | ||
|
||
import static org.evomaster.client.java.sql.internal.SqlParserUtils.getFrom; | ||
import static org.evomaster.client.java.sql.internal.SqlParserUtils.getWhere; | ||
|
||
public class SqlHeuristicsCalculator { | ||
|
||
public static SqlDistanceWithMetrics computeDistance(String sqlCommand, | ||
DbInfoDto schema, | ||
TaintHandler taintHandler, | ||
QueryResult... data) { | ||
|
||
Statement parsedSqlCommand = SqlParserUtils.parseSqlCommand(sqlCommand); | ||
Expression whereClause= getWhere(parsedSqlCommand); | ||
FromItem fromItem = getFrom(parsedSqlCommand); | ||
|
||
if (fromItem == null && whereClause == null) { | ||
return new SqlDistanceWithMetrics(0.0,0,false); | ||
} | ||
|
||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...sql/src/test/java/org/evomaster/client/java/sql/internal/SqlHeuristicsCalculatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.evomaster.client.java.sql.internal; | ||
|
||
import org.evomaster.client.java.sql.DataRow; | ||
import org.evomaster.client.java.sql.QueryResult; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class SqlHeuristicsCalculatorTest { | ||
|
||
@Test | ||
public void testNoWhereNoFromClause() { | ||
String sqlCommand = "SELECT 1 AS example_column"; | ||
QueryResult data = new QueryResult(Arrays.asList("example_column"), null); | ||
data.addRow(new DataRow("example_column",1, null)); | ||
SqlDistanceWithMetrics distanceWithMetrics = SqlHeuristicsCalculator.computeDistance(sqlCommand, null, null, data); | ||
assertEquals(0, distanceWithMetrics.sqlDistance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.