Corrupted port-restore-string bug fixed

This commit is contained in:
cora48 2015-03-23 12:57:09 +03:00
parent 2d0b97bbba
commit b184de7c44
3 changed files with 21 additions and 100 deletions

View File

@ -47,7 +47,6 @@ bool smBit_5 = false;
bool smBit_6 = false;
bool smBit_7 = false;
bool smBit_8 = false;
bool debugFileOK = false;
bool privateMsgFlag = false;
char inputStr[256] = {0};
@ -2847,8 +2846,6 @@ void nesca_3::ConnectEvrthng()
connect ( ui->startScanButton_4, SIGNAL( clicked() ), this, SLOT( startScanButtonClickedDNS() ) );
connect ( ui->shuffle_onoff, SIGNAL(toggled(bool)), this, SLOT(ChangeShuffle(bool)));
connect ( ui->trackerOnOff, SIGNAL(toggled(bool)), this, SLOT(ChangeTrackerOK(bool)));
// connect ( ui->pingingOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangePingerOK(bool) ) );
connect ( ui->debugFileOnOff, SIGNAL( toggled(bool) ), this, SLOT( ChangeDebugFileState(bool) ) );
connect ( ui->importThreads, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) );
connect ( ui->threadLine, SIGNAL( textChanged(QString) ), this, SLOT( ChangeLabelThreads_ValueChanged(QString) ) );
connect ( ui->PingTO, SIGNAL( textChanged(QString) ), this, SLOT( PingTO_ChangeValue(QString) ) );
@ -2969,7 +2966,7 @@ void _LoadPersInfoToLocalVars(int savedTabIndex) {
};
strncpy(gPorts, ("-p" + ui->portLine->text()).toLocal8Bit().data(), 65536);
gPorts[ui->lineEditPort->text().size()] = '\0';
gPorts[ui->lineEditPort->text().length() + 2] = '\0';
}
else if(savedTabIndex == 1)
{
@ -2979,7 +2976,7 @@ void _LoadPersInfoToLocalVars(int savedTabIndex) {
strcpy(currentIP, ui->lineEditStartIPDNS->text().toLocal8Bit().data());
strcpy(top_level_domain, ui->lineILVL->text().toLocal8Bit().data());
strncpy(gPorts, ("-p" + ui->lineEditPort->text()).toLocal8Bit().data(), 65536);
gPorts[ui->lineEditPort->text().size()] = '\0';
gPorts[ui->lineEditPort->text().length() + 2] = '\0';
};
strcpy(trcSrv, ui->lineTrackerSrv->text().toLocal8Bit().data());
@ -3398,19 +3395,9 @@ void nesca_3::ChangePingerOK(bool val)
{
ui->PingTO->setEnabled(val);
gPingNScan = val;
if(val == false)
{
ui->PingTO->setStyleSheet("color: rgb(116, 116, 116);background-color: rgb(56, 56, 56);border:none;");
}
else
{
ui->PingTO->setStyleSheet("color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none;");
};
}
void nesca_3::ChangeDebugFileState(bool val)
{
debugFileOK = val;
if(val == false) ui->PingTO->setStyleSheet("color: rgb(116, 116, 116);background-color: rgb(56, 56, 56);border:none;");
else ui->PingTO->setStyleSheet("color: rgb(216, 216, 216);background-color: rgb(56, 56, 56);border:none;");
}
void nesca_3::STTTerminate()
@ -3439,38 +3426,6 @@ void nesca_3::STTTerminate()
stt->terminate();
}
bool dfLocked = false;
void writeDebugFile(QString str)
{
while(dfLocked) Sleep(10);
QDate qd;
char b[8] = {0};
char fn[64] = {0};
strcpy(fn, "./output_");
sprintf(b, "%d", qd.currentDate().day());
strcat(fn, b);
strcat(fn, "_");
sprintf(b, "%d", qd.currentDate().month());
strcat(fn, b);
strcat(fn, "_");
sprintf(b, "%d", qd.currentDate().year());
strcat(fn, b);
strcat(fn, ".txt");
FILE *df = fopen(fn, "a");
if(df != NULL)
{
dfLocked = true;
fputs(str.toLocal8Bit().data(), df);
fclose(df);
dfLocked = false;
}
else
{
stt->doEmitionRedFoundData("[DEBUG: Cannot open " + QString(fn) + "]");
};
}
void nesca_3::startScanButtonClicked()
{
if(startFlag == false)
@ -3625,7 +3580,6 @@ void nesca_3::appendGreenBAData(QString str)
void nesca_3::appendDefaultText(QString str)
{
ui->dataText->append("<p style=\"color: #a1a1a1;\">[" + QTime::currentTime().toString() + "] " + str + "</p>");
if(debugFileOK) writeDebugFile(str + "\n");
}
void nesca_3::appendErrText(QString str)
@ -3640,25 +3594,21 @@ void nesca_3::appendErrText(QString str)
ui->startScanButton_3->setText("Start");
stt->terminate();
};
if(debugFileOK) writeDebugFile(str + "\n");
}
void nesca_3::appendOKText(QString str)
{
ui->dataText->append("<span style=\"color:#06ff00;\">[" + QTime::currentTime().toString() + "][OK] " + str + "</span>");
if(debugFileOK) writeDebugFile(str + "\n");
}
void nesca_3::appendNotifyText(QString str)
{
ui->dataText->append("<span style=\"color:#efe100;\">[" + QTime::currentTime().toString() + "][*] " + str + "</span>");
if(debugFileOK) writeDebugFile(str + "\n");
}
void nesca_3::appendDebugText(QString str)
{
ui->dataText->append("<span style=\"color:#0084ff;\">[DEBUG] " + str + "</span>");
if(debugFileOK) writeDebugFile(str + "\n");
}

View File

@ -24,7 +24,7 @@
#include "mainResources.h"
extern Ui::nesca_3Class *ui;
extern bool widgetIsHidden, IRCLogToggled, blinkFlag, disableBlink, debugFileOK, QOSWait,
extern bool widgetIsHidden, IRCLogToggled, blinkFlag, disableBlink, QOSWait,
connectedToIRC, ME2ScanFlag, QoSScanFlag, VoiceScanFlag, PieStatFlag, proxyEnabledFlag,
smBit_8, smBit_7, smBit_6, smBit_5, smBit_4, smBit_3, smBit_2, smBit_1, printDelimiter;
extern float QoSStep;
@ -70,7 +70,6 @@ protected:
void slotChangeCPModeToUTF();
void slotChangeCPModeTo1251();
void slotShowRedVersion();
void ChangeDebugFileState(bool val);
void ChangeTopic();
void slotIRCGetTopic(QString str);
void slotIRCOfflined();

View File

@ -176,7 +176,7 @@
<property name="font">
<font>
<family>Eurostile</family>
<pointsize>9</pointsize>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
@ -486,7 +486,7 @@
<property name="font">
<font>
<family>Eurostile</family>
<pointsize>9</pointsize>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
@ -793,7 +793,7 @@ color: rgb(214, 214, 0);</string>
<property name="font">
<font>
<family>Eurostile</family>
<pointsize>9</pointsize>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
@ -973,8 +973,8 @@ border-radius: 3px;</string>
<property name="geometry">
<rect>
<x>30</x>
<y>100</y>
<width>241</width>
<y>120</y>
<width>281</width>
<height>17</height>
</rect>
</property>
@ -990,7 +990,7 @@ border-radius: 3px;</string>
<string notr="true">color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0);</string>
</property>
<property name="text">
<string>Send results to NescaDatabase</string>
<string>Send results to public NescaDatabase</string>
</property>
<property name="checked">
<bool>true</bool>
@ -1142,34 +1142,6 @@ border-radius: 3px;</string>
<string>Check key</string>
</property>
</widget>
<widget class="QCheckBox" name="debugFileOnOff">
<property name="geometry">
<rect>
<x>30</x>
<y>116</y>
<width>276</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<family>Eurostile</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0);</string>
</property>
<property name="text">
<string>[DEBUG] Write main output to file &quot;./logs/output.txt&quot;</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QCheckBox" name="pingingOnOff">
<property name="geometry">
<rect>
@ -2546,7 +2518,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="cursorWidth">
@ -3530,7 +3502,7 @@ background-color: #000000;</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="acceptRichText">
@ -3666,7 +3638,7 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:2px; margin-bottom:2px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="acceptRichText">