diff --git a/README.md b/README.md index 5a190adb..f78f9bd6 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,6 @@ Official releases of Packet Sender can be downloaded at [PacketSender.com](http ![Packet Sender logo](screenshots/WindowsLogo_Transparent_670x600-150x150.png)![Packet Sender logo](screenshots/mac_logo.png)![Packet Sender logo](screenshots/ubuntu-logo-transparent.png) -## Mobile Versions -The abandoned mobile versions are written in Java and Swift and are MIT Licensed. -* [Source for Packet Sender for Android](https://github.com/dannagle/PacketSender-Android). -* [Source for Packet Sender for for iOS](https://github.com/dannagle/PacketSender-iOS). - -The desktop version is by far more capable and more popular and is now the sole focus of the project. - - ## Packet Sender Documentation Some knowledge of a basic network protocols is a prerequisite to using Packet Sender. Beyond that, Packet Sender was designed to be very easy to use. Simply start using it. @@ -38,7 +30,7 @@ Packet Sender has a "portable" mode. At launch, it will look for `packets.ini` a Packet Sender is identical for all the desktop versions. The only difference is its theme to match the operating system. -![Packet Sender screenshot](screenshots/packetsender_windows_screenshot_crop.png) +![Packet Sender screenshot](screenshots/packetsender_mac_screenshot.png) * In the bottom right, there are UDP server and TCP server status and port. You can click to activate or deactivate these. @@ -46,7 +38,7 @@ Packet Sender is identical for all the desktop versions. The only difference is * Please check your firewall. Windows aggressively blocks TCP-based servers. Packet Sender will still work if the firewall blocks it, but it can't receive unsolicited TCP-based packets. * In the table, there is a list of saved packets. You can double-click to directly edit fields in this table. * Select multiple packets to enable "Multi-Send". Selected packets are shown in a quick-send area above the traffic log. -* Fields can be rearranged by drag-and-drop in the settings tab. +* Fields can be rearranged by drag-and-drop in the settings menu. * A resend value of "0" means it is a single-shot packet. * A packet has a name, destination address (domains will trigger an IP lookup), port, and data associated with it. * Click "Send" to immediately send. Click "Save" to send later. @@ -59,12 +51,24 @@ Packet Sender is identical for all the desktop versions. The only difference is * You may save a packet directly from the traffic log. You will be prompted for a name, and the source address and port will be switched for your convenience. * An optional response can be sent. The same response is used for TCP and UDP. +### Persistent TCP +Packet Sender supports persistent connections via a separate UI dialog. It is enabled by checkbox on the main window. +* ![Packet Sender Direct TCP](screenshots/packetsender_direct_tcp.png) +* Any number of persistent connections can be created. +* Previously saved packets can be loaded in the drop-down. +* There is a "raw" view and "ASCII" view. The ASCII view is useful to troubleshoot data that is not printed by the raw view. +* Traffic is also saved in the main window traffic log. +* The timer in the bottom lefts starts as soon as a valid data packet is sent. It stops when the server closes the connection. +* You may optionally append a carriage return when you quick-send by hitting the return key. This is useful for command-prompt menus over TCP connections. + +Persistent connections is not supported via the command line. + ### Additional Configuration Options -* The quick-send area in traffic log can be hidden. +* The traffic log and packet table is divided by a draggable splitter. This splitter can also be collapsed on either side. * Copy to the clipboard the raw packet data (instead of a translation -- my personal preference) * Traffic log can be set to roll at 100 entries. -* Import/Export of packets. +* Import/Export of packets is available via menus. * Attempt receive before send (some servers expect this behavior). * 500 ms delay before sending data (some servers are slow). @@ -110,6 +114,17 @@ The command line system in Packet Sender follows the same pattern as other Linux Response ASCII:SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu3.1.IS.10.04\r\n + +## Mobile Versions + +The abandoned mobile versions are written in Java and Swift and are MIT Licensed. +* [Source for Packet Sender for Android](https://github.com/dannagle/PacketSender-Android). +* [Source for Packet Sender for for iOS](https://github.com/dannagle/PacketSender-iOS). + +The desktop version is by far more capable and more popular and is now the sole focus of the project. + + + ## License GPL v2 or Later. [Contact me](http://dannagle.com/contact) if you require a different license. diff --git a/screenshots/packetsender_direct_tcp.png b/screenshots/packetsender_direct_tcp.png new file mode 100644 index 00000000..1acdd454 Binary files /dev/null and b/screenshots/packetsender_direct_tcp.png differ diff --git a/screenshots/packetsender_mac_screenshot.png b/screenshots/packetsender_mac_screenshot.png index 1293f0d9..dfc9e338 100644 Binary files a/screenshots/packetsender_mac_screenshot.png and b/screenshots/packetsender_mac_screenshot.png differ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cfa57943..24980418 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -215,6 +215,19 @@ MainWindow::MainWindow(QWidget *parent) : } +void MainWindow::toggleUDPServer() +{ + QSettings settings(SETTINGSFILE, QSettings::IniFormat); + settings.setValue("udpServerEnable", !settings.value("udpServerEnable", true).toBool()); + applyNetworkSettings(); +} +void MainWindow::toggleTCPServer() +{ + QSettings settings(SETTINGSFILE, QSettings::IniFormat); + settings.setValue("tcpServerEnable", !settings.value("tcpServerEnable", true).toBool()); + applyNetworkSettings(); +} + void MainWindow::generateConnectionMenu() { @@ -351,7 +364,6 @@ void MainWindow::loadTrafficLogTable() ui->trafficLogTable->setRowCount(displayPackets.count()); } unsigned int rowCounter = 0; - unsigned int colCount = 0; QDEBUGVAR(packetTableHeaders); @@ -360,7 +372,6 @@ void MainWindow::loadTrafficLogTable() foreach(tempPacket, displayPackets) { - colCount = 0; /* lwStringList ("Time", "From IP", "From Port", "To IP", "To Port", "Method", "Error", "ASCII", "Hex") @@ -980,7 +991,6 @@ int MainWindow::findColumnIndex(QListWidget * lw, QString search) void MainWindow::populateTableRow(int rowCounter, Packet tempPacket) { QTableWidgetItem * tItem; - QListWidget *lw; SendPacketButton * sendButton = tempPacket.getSendButton(ui->packetsTable); @@ -1072,14 +1082,12 @@ void MainWindow::packetTable_checkMultiSelected() { //how many are selected? QTableWidgetItem * checkItem; - SendPacketButton *sendButton; QList packetList; Packet clickedPacket; QList totalSelected = ui->packetsTable->selectedItems(); packetList.clear(); QStringList buttonsList; buttonsList.clear(); - int i = 0; foreach(checkItem, totalSelected) { diff --git a/src/mainwindow.h b/src/mainwindow.h index 35718992..0e8676eb 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -68,6 +68,8 @@ public slots: void applyNetworkSettings(); + void toggleUDPServer(); + void toggleTCPServer(); private slots: void on_packetHexEdit_lostFocus(); void on_packetASCIIEdit_lostFocus(); diff --git a/src/persistentconnection.cpp b/src/persistentconnection.cpp index 4bcfb0d9..5c0fd258 100644 --- a/src/persistentconnection.cpp +++ b/src/persistentconnection.cpp @@ -32,24 +32,33 @@ PersistentConnection::PersistentConnection(QWidget *parent) : wasConnected = false; stopTimer = false; + ui->searchEdit->setText(""); + + loadComboBox(); + + useraw = true; + + ui->asciiLineEdit->setFocus(); + + +} + +void PersistentConnection::loadComboBox() { QList packetsSaved = Packet::fetchAllfromDB(""); ui->packetComboBox->clear(); - ui->packetComboBox->addItem(""); Packet tempPacket; + QString search = ui->searchEdit->text().trimmed().toLower(); foreach(tempPacket, packetsSaved) { - ui->packetComboBox->addItem(tempPacket.name); + if(tempPacket.name.trimmed().toLower().contains(search)) { + ui->packetComboBox->addItem(tempPacket.name); + } } - QSettings settings(SETTINGSFILE, QSettings::IniFormat); - - useraw = settings.value("persistentTCPrawCheck", true).toBool(); - } - void PersistentConnection::aboutToClose() { QDEBUG() << "Stopping timer"; refreshTimer.stop(); @@ -73,6 +82,10 @@ void PersistentConnection::statusReceiver(QString message) ui->asciiLineEdit->setEnabled(false); ui->packetComboBox->setEnabled(false); ui->appendCRcheck->setEnabled(false); + ui->searchEdit->setEnabled(false); + ui->packetComboBox->setEnabled(false); + ui->LoadButton->setEnabled(false); + ui->clearButton->setEnabled(false); stopTimer = true; } @@ -112,7 +125,8 @@ void PersistentConnection::init() { void PersistentConnection::packetToSend(Packet sendpacket) { - QDEBUG(); + + Q_UNUSED(sendpacket); } @@ -150,12 +164,11 @@ void PersistentConnection::on_buttonBox_rejected() } +void PersistentConnection::loadTrafficView() { -void PersistentConnection::packetSentSlot(Packet pkt) { + Packet loopPkt; - Packet loopPkt = pkt; - trafficList.append(loopPkt); QString html; html.clear(); QTextStream out(&html); @@ -204,6 +217,13 @@ void PersistentConnection::packetSentSlot(Packet pkt) { } +void PersistentConnection::packetSentSlot(Packet pkt) { + + trafficList.append(pkt); + loadTrafficView(); + +} + void PersistentConnection::on_asciiSendButton_clicked() { QString ascii = ui->asciiLineEdit->text(); @@ -233,6 +253,47 @@ void PersistentConnection::on_asciiSendButton_clicked() } void PersistentConnection::on_packetComboBox_currentIndexChanged(const QString &arg1) +{ + Q_UNUSED(arg1); + + +} + +void PersistentConnection::on_searchEdit_textEdited(const QString &arg1) +{ + Q_UNUSED(arg1); + loadComboBox(); + +} + +void PersistentConnection::on_clearButton_clicked() +{ + + ui->searchEdit->setText(""); + on_searchEdit_textEdited(""); +} + +void PersistentConnection::on_asciiCheck_clicked(bool checked) +{ + if(checked) { + useraw = false; + } + loadTrafficView(); + + +} + +void PersistentConnection::on_rawCheck_clicked(bool checked) +{ + if(checked) { + useraw = true; + } + loadTrafficView(); + + +} + +void PersistentConnection::on_LoadButton_clicked() { Packet tempPacket; QString selectedName = ui->packetComboBox->currentText(); @@ -249,8 +310,4 @@ void PersistentConnection::on_packetComboBox_currentIndexChanged(const QString & } } - - ui->packetComboBox->setCurrentIndex(0); - - } diff --git a/src/persistentconnection.h b/src/persistentconnection.h index e9da6a25..4b17915b 100644 --- a/src/persistentconnection.h +++ b/src/persistentconnection.h @@ -43,6 +43,16 @@ private slots: void on_packetComboBox_currentIndexChanged(const QString &arg1); + void on_searchEdit_textEdited(const QString &arg1); + + void on_clearButton_clicked(); + + void on_asciiCheck_clicked(bool checked); + + void on_rawCheck_clicked(bool checked); + + void on_LoadButton_clicked(); + private: Ui::PersistentConnection *ui; QTimer refreshTimer; @@ -52,6 +62,8 @@ private slots: bool stopTimer; bool useraw; + void loadComboBox(); + void loadTrafficView(); }; #endif // PERSISTENTCONNECTION_H diff --git a/src/persistentconnection.ui b/src/persistentconnection.ui index eaa926ba..454b297f 100644 --- a/src/persistentconnection.ui +++ b/src/persistentconnection.ui @@ -6,8 +6,8 @@ 0 0 - 619 - 383 + 696 + 476 @@ -28,10 +28,60 @@ - + + + + + + + + + + Load + + + + + + + Search Packets... + + + + + + + Clear + + + + + - + + + + + Raw + + + true + + + + + + + ASCII + + + + + + + + @@ -44,6 +94,9 @@ Send + + true + @@ -60,6 +113,12 @@ + + + 1500 + 1000 + + true diff --git a/src/settings.cpp b/src/settings.cpp index ecd9dc05..25d0bc69 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -39,7 +39,6 @@ Settings::Settings(QWidget *parent) : ui->sendResponseSettingsCheck->setChecked(settings.value("sendReponse", false).toBool()); - ui->persistentTCPrawCheck->setChecked(settings.value("persistentTCPrawCheck", true).toBool()); ui->hexResponseEdit->setText(settings.value("responseHex","").toString()); @@ -75,6 +74,7 @@ Settings::~Settings() void Settings::statusBarMessage(QString msg) { + Q_UNUSED(msg); } @@ -93,7 +93,6 @@ void Settings::on_buttonBox_accepted() settings.setValue("attemptReceiveCheck", ui->attemptReceiveCheck->isChecked()); settings.setValue("delayAfterConnectCheck", ui->delayAfterConnectCheck->isChecked()); - settings.setValue("persistentTCPrawCheck", ui->persistentTCPrawCheck->isChecked()); //save traffic order @@ -120,6 +119,7 @@ void Settings::on_buttonBox_accepted() void Settings::on_asciiResponseEdit_textEdited(const QString &arg1) { + Q_UNUSED(arg1); QString quicktestASCII = ui->asciiResponseEdit->text(); ui->hexResponseEdit->setText( Packet::ASCIITohex(quicktestASCII)); @@ -128,6 +128,7 @@ void Settings::on_asciiResponseEdit_textEdited(const QString &arg1) void Settings::on_hexResponseEdit_textEdited(const QString &arg1) { + Q_UNUSED(arg1); QString quicktestHex = ui->hexResponseEdit->text(); diff --git a/src/settings.ui b/src/settings.ui index 80ef333d..557d6cc4 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -124,13 +124,6 @@ - - - - Persistent TCP displays raw data - - - diff --git a/src/tcpthread.cpp b/src/tcpthread.cpp index 051c28e9..6dd01566 100755 --- a/src/tcpthread.cpp +++ b/src/tcpthread.cpp @@ -204,7 +204,7 @@ void TCPThread::run() clientConnection->waitForReadyRead(500); emit connectStatus("Waiting to receive"); tcpPacket.hexString.clear(); - int hexcounter = 0; + while(clientConnection->bytesAvailable()) { tcpPacket.hexString.append(" "); tcpPacket.hexString.append(Packet::byteArrayToHex(clientConnection->readAll()));