Add -F command line option to specify Format (#1946)

This commit is contained in:
Florian Märkl 2019-12-19 13:59:15 +01:00 committed by GitHub
parent 7dbdd65740
commit 58b44893f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -80,6 +80,11 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
QObject::tr("level"));
cmd_parser.addOption(analOption);
QCommandLineOption formatOption({"F", "format"},
QObject::tr("Force using a specific file format (bin plugin)"),
QObject::tr("name"));
cmd_parser.addOption(formatOption);
QCommandLineOption scriptOption("i",
QObject::tr("Run script file"),
QObject::tr("file"));
@ -178,6 +183,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
} else { // filename specified as positional argument
InitialOptions options;
options.filename = args[0];
options.forceBinPlugin = cmd_parser.value(formatOption);
if (analLevelSpecified) {
switch (analLevel) {
case 0:

View File

@ -153,6 +153,12 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
shellcode = options.shellcode;
if (!options.forceBinPlugin.isEmpty()) {
ui->formatComboBox->setCurrentText(options.forceBinPlugin);
} else {
ui->formatComboBox->setCurrentIndex(0);
}
// TODO: all other options should also be applied to the ui
}