Add -i Command Line Arg

This commit is contained in:
Florian Märkl 2018-08-18 18:09:49 +02:00
parent 23e2d5fa9f
commit bab57dea4d
2 changed files with 10 additions and 4 deletions

View File

@ -42,6 +42,11 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
QObject::tr("level")); QObject::tr("level"));
cmd_parser.addOption(analOption); cmd_parser.addOption(analOption);
QCommandLineOption scriptOption("i",
QObject::tr("Run script file"),
QObject::tr("file"));
cmd_parser.addOption(scriptOption);
#ifdef CUTTER_ENABLE_JUPYTER #ifdef CUTTER_ENABLE_JUPYTER
QCommandLineOption pythonHomeOption("pythonhome", QObject::tr("PYTHONHOME to use for Jupyter"), QCommandLineOption pythonHomeOption("pythonhome", QObject::tr("PYTHONHOME to use for Jupyter"),
"PYTHONHOME"); "PYTHONHOME");
@ -117,6 +122,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
break; break;
} }
} }
options.script = cmd_parser.value(scriptOption);
mainWindow->openNewFile(options, analLevelSpecified); mainWindow->openNewFile(options, analLevelSpecified);
} }

View File

@ -106,12 +106,12 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
} }
if (!options.script.isEmpty()) { if (!options.script.isEmpty()) {
ui->scriptCheckBox->setChecked(false);
ui->scriptLineEdit->setText("");
ui->analSlider->setValue(0);
} else {
ui->scriptCheckBox->setChecked(true); ui->scriptCheckBox->setChecked(true);
ui->scriptLineEdit->setText(options.script); ui->scriptLineEdit->setText(options.script);
ui->analSlider->setValue(0);
} else {
ui->scriptCheckBox->setChecked(false);
ui->scriptLineEdit->setText("");
} }
shellcode = options.shellcode; shellcode = options.shellcode;