Merge branch 'master' of github.com:hteso/iaito

This commit is contained in:
Florian Märkl 2017-03-30 18:59:04 +02:00
commit f17248bbac
11 changed files with 82 additions and 68 deletions

View File

@ -9,7 +9,7 @@ createNewDialog::createNewDialog(QWidget *parent) :
ui(new Ui::createNewDialog)
{
ui->setupUi(this);
w = new MainWindow(this);
w = new MainWindow(nullptr);
w->core = new QRCore ();
}
@ -22,7 +22,7 @@ void createNewDialog::on_pushButton_2_clicked()
{
// Close dialog and open OptionsDialog
close();
NewFileDialog* n = new NewFileDialog(this);
NewFileDialog* n = new NewFileDialog(nullptr);
n->show();
}

View File

@ -11,7 +11,7 @@ MdHighlighter::MdHighlighter(QTextDocument *parent)
keywordFormat.setFontWeight(QFont::Bold);
QStringList keywordPatterns;
keywordPatterns << "^\#{1,6}[ A-Za-z]+\\b" << "\\*\\*([^\\\\]+)\\*\\*"
keywordPatterns << "^\\#{1,6}[ A-Za-z]+\\b" << "\\*\\*([^\\\\]+)\\*\\*"
<< "\\*([^\\\\]+)\\*" << "\\_([^\\\\]+)\\_"
<< "\\_\\_([^\\\\]+)\\_\\_";

View File

@ -100,7 +100,7 @@ void NewFileDialog::on_loadFileButton_clicked()
} else {
// Close dialog and open OptionsDialog
close();
OptionsDialog* o = new OptionsDialog(this);
OptionsDialog* o = new OptionsDialog(nullptr);
o->setFilename (fname, this->strippedName(fname));
o->exec();
}
@ -145,7 +145,7 @@ void NewFileDialog::on_recentsList_itemDoubleClicked(QListWidgetItem *item)
QString sitem = data.toString();
// Close dialog and open OptionsDialog
close();
OptionsDialog* o = new OptionsDialog(this);
OptionsDialog* o = new OptionsDialog(nullptr);
o->setFilename (sitem, this->strippedName(sitem));
o->exec();
}
@ -177,7 +177,7 @@ void NewFileDialog::on_createButton_clicked()
{
// Close dialog and open create new file dialog
close();
createNewDialog* n = new createNewDialog(this);
createNewDialog* n = new createNewDialog(nullptr);
n->exec();
}

View File

@ -73,7 +73,7 @@ void OptionsDialog::on_okButton_clicked()
//ui->progressBar->setValue(5);
// Close dialog and open OptionsDialog
this->w = new MainWindow(this);
this->w = new MainWindow(nullptr);
this->w->core = this->core;
// Fill asm plugins in hexdump combo
@ -190,6 +190,8 @@ void OptionsDialog::anal_finished()
//fprintf(stderr, "anal done");
//ui->progressBar->setValue(70);
this->w->core->cmd("Po " + this->shortfn);
// Set settings to override any incorrect saved in the project
this->core->setSettings();
ui->statusLabel->setText("Loading interface");
this->w->add_output(" > Analysis finished");
QString initial_seek = ui->entry_initialSeek->text();
@ -232,10 +234,10 @@ void OptionsDialog::anal_finished()
void OptionsDialog::on_cancelButton_clicked()
{
delete this->core;
this->core = NULL; // implicit by delete?
this->core = NULL;
// Close dialog and open OptionsDialog
close();
NewFileDialog* n = new NewFileDialog(this);
NewFileDialog* n = new NewFileDialog(nullptr);
n->show();
}

View File

@ -11,59 +11,9 @@ QRCore::QRCore(QObject *parent) :
this->core = r_core_new ();
r_core_loadlibs (this->core, R_CORE_LOADLIBS_ALL, NULL);
// IMPLICIT r_bin_iobind (core->bin, core->io);
config("scr.color", "false");
// Otherwise r2 may ask the user for input and Iaito would freeze
config("scr.interactive","false");
config("asm.lines","false");
// Intredazting...
//config("asm.linesright", "true");
//config("asm.lineswidth", "15");
//config("asm.functions", "false");
config("hex.pairs", "false");
config("asm.bytespace", "true");
config("asm.cmtflgrefs", "false");
config("asm.cmtright", "true");
config("asm.cmtcol", "70");
config("asm.xrefs", "false");
config("asm.fcnlines", "false");
config("asm.tabs", "10");
config("asm.tabsonce", "true");
config("asm.tabsoff", "5");
config("asm.nbytes", "10");
config("anal.hasnext", "true");
config("asm.fcncalls", "false");
config("asm.calls", "false");
config("asm.lines.call","false");
config("asm.flgoff", "true");
config("anal.autoname", "true");
// Highlight current node in graphviz
config("graph.gv.current", "true");
// Fucking pancake xD
config("cfg.fortunes.tts", "false");
// Experimenting with asm options
//config("asm.spacy", "true"); // We need to handle blank lines on scroll
//config("asm.section", "true"); // Breaks the disasm and navigation
//config("asm.invhex", "true"); // Needs further testing
//config("asm.flags", "false"); // Add with default true in future
// Used by the HTML5 graph
config("http.cors","true");
config("http.sandbox", "false");
config("http.port", "14170");
// Temporary fixes
//config("http.root","/usr/local/share/radare2/last/www");
//config("http.root","/usr/local/radare2/osx/share/radare2/1.1.0-git/www");
//config("bin.rawstr", "true");
// Graph colors and design
cmd("ec graph.true rgb:88FF88");
cmd("ec graph.false rgb:FF6666");
cmd("ec graph.trufae rgb:4183D7");
this->db = sdb_new (NULL, NULL, 0); // WTF NOES
}
@ -684,3 +634,59 @@ void QRCore::getOpcodes() {
this->regs = registers.split("\n");
this->regs.removeLast();
}
void QRCore::setSettings() {
config("scr.color", "false");
config("scr.interactive","false");
config("asm.lines","false");
// Intredazting...
//config("asm.linesright", "true");
//config("asm.lineswidth", "15");
//config("asm.functions", "false");
config("hex.pairs", "false");
config("asm.bytespace", "true");
config("asm.cmtflgrefs", "false");
config("asm.cmtright", "true");
config("asm.cmtcol", "70");
config("asm.xrefs", "false");
config("asm.fcnlines", "false");
config("asm.tabs", "10");
config("asm.tabsonce", "true");
config("asm.tabsoff", "5");
config("asm.nbytes", "10");
config("anal.hasnext", "true");
config("asm.fcncalls", "false");
config("asm.calls", "false");
config("asm.lines.call","false");
config("asm.flgoff", "true");
config("anal.autoname", "true");
// Highlight current node in graphviz
config("graph.gv.current", "true");
// Fucking pancake xD
config("cfg.fortunes.tts", "false");
// Experimenting with asm options
//config("asm.spacy", "true"); // We need to handle blank lines on scroll
//config("asm.section", "true"); // Breaks the disasm and navigation
//config("asm.invhex", "true"); // Needs further testing
//config("asm.flags", "false"); // Add with default true in future
// Used by the HTML5 graph
config("http.cors","true");
config("http.sandbox", "false");
config("http.port", "14170");
// Temporary fixes
//config("http.root","/usr/local/share/radare2/last/www");
//config("http.root","/usr/local/radare2/osx/share/radare2/1.1.0-git/www");
//config("bin.rawstr", "true");
// Graph colors and design
cmd("ec graph.true rgb:88FF88");
cmd("ec graph.false rgb:FF6666");
cmd("ec graph.trufae rgb:4183D7");
}

View File

@ -73,6 +73,7 @@ public:
void getOpcodes();
QList<QString> opcodes;
QList<QString> regs;
void setSettings();
/* fields */
RCore *core;

View File

@ -10,4 +10,5 @@ QRDisasm::QRDisasm(QRCore *core)
bool QRDisasm::disassembleAt (ut64 addr, QRDisasmOption opt, QRDisasmRow &dr) {
printf ("FUCK\n");
return false;
}

View File

@ -134,4 +134,5 @@ bool CommentsWidget::eventFilter(QObject *obj, QEvent *event) {
}
}
}
return false; //allow the event to be handled further
}

View File

@ -377,4 +377,5 @@ bool FunctionsWidget::eventFilter(QObject *obj, QEvent *event) {
}
}
}
return false; //allow the event to be handled further
}

View File

@ -1345,7 +1345,9 @@ void MemoryWidget::fillOffsetInfo( QString off) {
// Add opcode description
QStringList description = this->main->core->cmd("?d. @ " + off).split(": ");
ui->opcodeDescText->setPlainText("# " + description[0] + ":\n" + description[1]);
if(description.length() >= 2) {
ui->opcodeDescText->setPlainText("# " + description[0] + ":\n" + description[1]);
}
}
void MemoryWidget::create_graph(QString off) {
@ -1379,14 +1381,13 @@ void MemoryWidget::setFcnName(QString addr) {
// TDOD: FIX ME, ugly
if (addr.contains("0x")) {
fcn = this->main->core->functionAt(addr.toLong(&ok, 16));
if (fcn->name != "") {
fcn = this->main->core->functionAt(addr.toULongLong(&ok, 16));
if (ok && fcn && fcn->name != "") {
QString segment = this->main->core->cmd("S. @ " + addr).split(" ").last();
ui->fcnNameEdit->setText(segment.trimmed() + ":"+ fcn->name);
addr = segment.trimmed() + ":"+ fcn->name;
}
} else {
ui->fcnNameEdit->setText(addr);
}
ui->fcnNameEdit->setText(addr);
}
void MemoryWidget::on_disasTextEdit_2_cursorPositionChanged()
@ -1398,7 +1399,6 @@ void MemoryWidget::on_disasTextEdit_2_cursorPositionChanged()
QString ele = lastline.split(" ", QString::SkipEmptyParts)[0];
if (ele.contains("0x")) {
this->fillOffsetInfo(ele);
QString at = this->main->core->cmdFunctionAt(ele);
QString deco = this->main->core->getDecompiledCode(at);
@ -1579,6 +1579,7 @@ bool MemoryWidget::eventFilter(QObject *obj, QEvent *event) {
}
}
}
return false; //allow the event to be handled further
}
void MemoryWidget::on_actionXRefs_triggered()

View File

@ -113,4 +113,5 @@ bool SectionsWidget::eventFilter(QObject *obj, QEvent *event) {
}
}
}
return false; //allow the event to be handled further
}