-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #660 from CROSSINGTUD/develop
Merge for Version 3.2.0
- Loading branch information
Showing
289 changed files
with
9,106 additions
and
9,660 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
138 changes: 138 additions & 0 deletions
138
CryptoAnalysis-Android/src/main/java/de/fraunhofer/iem/crypto/AndroidSettings.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,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; | ||
} | ||
} |
182 changes: 0 additions & 182 deletions
182
CryptoAnalysis-Android/src/main/java/de/fraunhofer/iem/crypto/CogniCryptAndroidAnalysis.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.