Made "load bin" checkbox more understandble

It is also now doing as the -n option of radare
This commit is contained in:
xarkes 2018-02-10 23:31:15 +01:00
parent a869009909
commit 28ff13729f
6 changed files with 16 additions and 26 deletions

View File

@ -47,7 +47,7 @@ void AnalThread::run()
core->setCPU(optionsDialog->getSelectedArch(), optionsDialog->getSelectedCPU(), optionsDialog->getSelectedBits()); core->setCPU(optionsDialog->getSelectedArch(), optionsDialog->getSelectedCPU(), optionsDialog->getSelectedBits());
bool rw = false; bool rw = false;
bool loadBinInfo = ui->binCheckBox->isChecked(); bool loadBinInfo = !ui->binCheckBox->isChecked();
if (loadBinInfo) if (loadBinInfo)
{ {
@ -61,6 +61,7 @@ void AnalThread::run()
} }
else else
{ {
Core()->setConfig("file.info", "false");
va = false; va = false;
loadaddr = mapaddr = 0; loadaddr = mapaddr = 0;
} }

View File

@ -715,10 +715,9 @@ QString CutterCore::getDecompiledCode(QString addr)
return cmd("pdc @ " + addr); return cmd("pdc @ " + addr);
} }
QString CutterCore::getFileInfo() QJsonDocument CutterCore::getFileInfo()
{ {
QString info = cmd("ij"); return cmdj("ij");
return info;
} }
QStringList CutterCore::getStats() QStringList CutterCore::getStats()
@ -1055,6 +1054,7 @@ QList<StringDescription> CutterCore::getAllStrings()
{ {
CORE_LOCK(); CORE_LOCK();
QList<StringDescription> ret; QList<StringDescription> ret;
return ret;
QJsonDocument stringsDoc = cmdj("izzj"); QJsonDocument stringsDoc = cmdj("izzj");
QJsonObject stringsObj = stringsDoc.object(); QJsonObject stringsObj = stringsDoc.object();
QJsonArray stringsArray = stringsObj["strings"].toArray(); QJsonArray stringsArray = stringsObj["strings"].toArray();

View File

@ -316,7 +316,7 @@ public:
RVA getOffsetJump(RVA addr); RVA getOffsetJump(RVA addr);
QString getDecompiledCode(RVA addr); QString getDecompiledCode(RVA addr);
QString getDecompiledCode(QString addr); QString getDecompiledCode(QString addr);
QString getFileInfo(); QJsonDocument getFileInfo();
QStringList getStats(); QStringList getStats();
QString getSimpleGraph(QString function); QString getSimpleGraph(QString function);

View File

@ -225,9 +225,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-611</y> <y>-379</y>
<width>565</width> <width>564</width>
<height>856</height> <height>786</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
@ -438,10 +438,10 @@
<item> <item>
<widget class="QCheckBox" name="binCheckBox"> <widget class="QCheckBox" name="binCheckBox">
<property name="text"> <property name="text">
<string>Load bin information</string> <string>Do not load bin information (-n)</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -26,6 +26,8 @@ namespace qhelpers
QString formatBytecount(const long bytecount) QString formatBytecount(const long bytecount)
{ {
if (bytecount == 0)
return "0";
const int exp = log(bytecount) / log(1000); const int exp = log(bytecount) / log(1000);
constexpr char suffixes[] = {' ', 'k', 'M', 'G', 'T', 'P', 'E'}; constexpr char suffixes[] = {' ', 'k', 'M', 'G', 'T', 'P', 'E'};

View File

@ -27,19 +27,9 @@ Dashboard::~Dashboard() {}
void Dashboard::updateContents() void Dashboard::updateContents()
{ {
// Parse and add JSON file info QJsonDocument docu = Core()->getFileInfo();
QString info = CutterCore::getInstance()->getFileInfo(); QJsonObject item = docu.object()["core"].toObject();
QJsonObject item2 = docu.object()["bin"].toObject();
QJsonDocument docu = QJsonDocument::fromJson(info.toUtf8());
QJsonObject object = docu.object();
QJsonValue value_core = object.value(QString("core"));
QJsonObject item = value_core.toObject();
//qDebug() << tr("QJsonObject of description: ") << item;
QJsonValue value_bin = object.value(QString("bin"));
//qDebug() << value;
QJsonObject item2 = value_bin.toObject();
//qDebug() << tr("QJsonObject of description: ") << item;
this->ui->fileEdit->setText(item["file"].toString()); this->ui->fileEdit->setText(item["file"].toString());
this->ui->formatEdit->setText(item["format"].toString()); this->ui->formatEdit->setText(item["format"].toString());
@ -82,7 +72,6 @@ void Dashboard::updateContents()
else else
{ {
this->ui->canaryEdit->setText("False"); this->ui->canaryEdit->setText("False");
//this->ui->canaryEdit->setStyleSheet("color: rgb(255, 0, 0);");
} }
if (item2["crypto"].toBool() == true) if (item2["crypto"].toBool() == true)
{ {
@ -99,7 +88,6 @@ void Dashboard::updateContents()
else else
{ {
this->ui->nxEdit->setText("False"); this->ui->nxEdit->setText("False");
//this->ui->nxEdit->setStyleSheet("color: rgb(255, 0, 0);");
} }
if (item2["pic"].toBool() == true) if (item2["pic"].toBool() == true)
{ {
@ -108,7 +96,6 @@ void Dashboard::updateContents()
else else
{ {
this->ui->picEdit->setText("False"); this->ui->picEdit->setText("False");
//this->ui->picEdit->setStyleSheet("color: rgb(255, 0, 0);");
} }
if (item2["static"].toBool() == true) if (item2["static"].toBool() == true)
{ {