From b184de7c448d6d57c2d2c3e67bb2791d83dcf1a0 Mon Sep 17 00:00:00 2001 From: cora48 Date: Mon, 23 Mar 2015 12:57:09 +0300 Subject: [PATCH] Corrupted port-restore-string bug fixed --- nesca_3.cpp | 70 ++++++++--------------------------------------------- nesca_3.h | 5 ++-- nesca_3.ui | 46 +++++++---------------------------- 3 files changed, 21 insertions(+), 100 deletions(-) diff --git a/nesca_3.cpp b/nesca_3.cpp index d1e5f76..8cc906c 100644 --- a/nesca_3.cpp +++ b/nesca_3.cpp @@ -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}; @@ -2846,9 +2845,7 @@ void nesca_3::ConnectEvrthng() connect ( ui->startScanButton_3, SIGNAL( clicked() ), this, SLOT( startScanButtonClicked() ) ); 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->trackerOnOff, SIGNAL(toggled(bool)), this, SLOT(ChangeTrackerOK(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) @@ -3624,8 +3579,7 @@ void nesca_3::appendGreenBAData(QString str) void nesca_3::appendDefaultText(QString str) { - ui->dataText->append("

[" + QTime::currentTime().toString() + "] " + str + "

"); - if(debugFileOK) writeDebugFile(str + "\n"); + ui->dataText->append("

[" + QTime::currentTime().toString() + "] " + str + "

"); } void nesca_3::appendErrText(QString str) @@ -3639,26 +3593,22 @@ void nesca_3::appendErrText(QString str) stt->doEmitionIPS("0"); ui->startScanButton_3->setText("Start"); stt->terminate(); - }; - if(debugFileOK) writeDebugFile(str + "\n"); + }; } void nesca_3::appendOKText(QString str) { - ui->dataText->append("[" + QTime::currentTime().toString() + "][OK] " + str + ""); - if(debugFileOK) writeDebugFile(str + "\n"); + ui->dataText->append("[" + QTime::currentTime().toString() + "][OK] " + str + ""); } void nesca_3::appendNotifyText(QString str) { - ui->dataText->append("[" + QTime::currentTime().toString() + "][*] " + str + ""); - if(debugFileOK) writeDebugFile(str + "\n"); + ui->dataText->append("[" + QTime::currentTime().toString() + "][*] " + str + ""); } void nesca_3::appendDebugText(QString str) { - ui->dataText->append("[DEBUG] " + str + ""); - if(debugFileOK) writeDebugFile(str + "\n"); + ui->dataText->append("[DEBUG] " + str + ""); } diff --git a/nesca_3.h b/nesca_3.h index 9715826..59c8d5c 100644 --- a/nesca_3.h +++ b/nesca_3.h @@ -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; @@ -69,8 +69,7 @@ protected: void DNSLine_ValueChanged(); void slotChangeCPModeToUTF(); void slotChangeCPModeTo1251(); - void slotShowRedVersion(); - void ChangeDebugFileState(bool val); + void slotShowRedVersion(); void ChangeTopic(); void slotIRCGetTopic(QString str); void slotIRCOfflined(); diff --git a/nesca_3.ui b/nesca_3.ui index 01b2eac..3e11c34 100644 --- a/nesca_3.ui +++ b/nesca_3.ui @@ -176,7 +176,7 @@ Eurostile - 9 + 8 @@ -486,7 +486,7 @@ Eurostile - 9 + 8 @@ -793,7 +793,7 @@ color: rgb(214, 214, 0); Eurostile - 9 + 8 @@ -973,8 +973,8 @@ border-radius: 3px; 30 - 100 - 241 + 120 + 281 17 @@ -990,7 +990,7 @@ border-radius: 3px; color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0); - Send results to NescaDatabase + Send results to public NescaDatabase true @@ -1142,34 +1142,6 @@ border-radius: 3px; Check key - - - - 30 - 116 - 276 - 17 - - - - - Eurostile - 8 - - - - - - - color: rgb(216, 216, 216); background-color: rgba(2, 2, 2, 0); - - - [DEBUG] Write main output to file "./logs/output.txt" - - - false - - @@ -2546,7 +2518,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-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;"><br /></p></body></html> @@ -3530,7 +3502,7 @@ background-color: #000000; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-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;"><br /></p></body></html> @@ -3666,7 +3638,7 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Eurostile'; font-size:8.25pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Eurostile'; font-size:11pt; font-weight:400; font-style:normal;"> <p style="-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;"><br /></p></body></html>