Skip to content

Commit

Permalink
Merge pull request #660 from CROSSINGTUD/develop
Browse files Browse the repository at this point in the history
Merge for Version 3.2.0
  • Loading branch information
schlichtig authored Jul 3, 2024
2 parents e66170b + 5acb393 commit af852d3
Show file tree
Hide file tree
Showing 289 changed files with 9,106 additions and 9,660 deletions.
6 changes: 3 additions & 3 deletions CryptoAnalysis-Android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -66,7 +66,7 @@
<archive>
<manifest>
<mainClass>
de.fraunhofer.iem.crypto.CogniCryptAndroidAnalysis
de.fraunhofer.iem.crypto.HeadlessAndroidScanner
</mainClass>
</manifest>
</archive>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
package de.fraunhofer.iem.crypto;

import crypto.exceptions.CryptoAnalysisParserException;
import crypto.reporting.Reporter;
import picocli.CommandLine;

import java.util.Collection;
import java.util.HashSet;
import java.util.concurrent.Callable;

@CommandLine.Command(mixinStandardHelpOptions = true)
public class AndroidSettings implements Callable<Integer> {

@CommandLine.Option(
names = {"--apkFile"},
description = {"The absolute path to the .apk file"},
required = true)
private String apkFile = null;

@CommandLine.Option(
names = {"--platformDirectory"},
description = "The absolute path to the android SDK platforms",
required = true)
private String platformDirectory = null;

@CommandLine.Option(
names = {"--rulesDir"},
description = {"The path to ruleset directory. Can be a simple directory or a ZIP archive"},
required = true)
private String rulesetDirectory = null;

@CommandLine.Option(
names = {"--reportPath"},
description = "Path to a directory where the reports are stored")
private String reportPath = null;

@CommandLine.Option(
names = {"--reportFormat"},
split = ",",
description = "The format of the report. Possible values are CMD, TXT, SARIF, CSV and CSV_SUMMARY (default: CMD)."
+ " Multiple formats should be split with a comma (e.g. CMD,TXT,CSV)")
private String[] reportFormat = null;

private Collection<Reporter.ReportFormat> reportFormats;

public AndroidSettings() {
reportFormats = new HashSet<>();
}

public void parseSettingsFromCLI(String[] settings) throws CryptoAnalysisParserException {
CommandLine parser = new CommandLine(this);
parser.setOptionsCaseInsensitive(true);
int exitCode = parser.execute(settings);

if (reportFormat != null) {
parseReportFormatValues(reportFormat);
}

if (exitCode != CommandLine.ExitCode.OK) {
throw new CryptoAnalysisParserException("Error while parsing the CLI arguments");
}
}

private void parseReportFormatValues(String[] settings) throws CryptoAnalysisParserException {
for (String format : settings) {
String reportFormatValue = format.toLowerCase();

switch (reportFormatValue) {
case "cmd":
reportFormats.add(Reporter.ReportFormat.CMD);
break;
case "txt":
reportFormats.add(Reporter.ReportFormat.TXT);
break;
case "sarif":
reportFormats.add(Reporter.ReportFormat.SARIF);
break;
case "csv":
reportFormats.add(Reporter.ReportFormat.CSV);
break;
case "csv_summary":
reportFormats.add(Reporter.ReportFormat.CSV_SUMMARY);
break;
case "github_annotation":
reportFormats.add(Reporter.ReportFormat.GITHUB_ANNOTATION);
break;
default:
throw new CryptoAnalysisParserException("Incorrect value " + reportFormatValue + " for --reportFormat option. "
+ "Available options are: CMD, TXT, SARIF, CSV and CSV_SUMMARY.\n");
}
}
}

public String getApkFile() {
return apkFile;
}

public void setApkFile(String apkFile) {
this.apkFile = apkFile;
}

public String getPlatformDirectory() {
return platformDirectory;
}

public void setPlatformDirectory(String platformDirectory) {
this.platformDirectory = platformDirectory;
}

public String getRulesetDirectory() {
return rulesetDirectory;
}

public void setRulesetDirectory(String rulesetDirectory) {
this.rulesetDirectory = rulesetDirectory;
}

public Collection<Reporter.ReportFormat> getReportFormats() {
return reportFormats;
}

public void setReportFormats(Collection<Reporter.ReportFormat> reportFormats) {
this.reportFormats = reportFormats;
}

public String getReportPath() {
return reportPath;
}

public void setReportPath(String reportPath) {
this.reportPath = reportPath;
}

@Override
public Integer call() throws Exception {
return 0;
}
}

This file was deleted.

Loading

0 comments on commit af852d3

Please sign in to comment.