Skip to content

Commit

Permalink
Merge pull request #2 from dannagle/development
Browse files Browse the repository at this point in the history
Merge Development With Master
  • Loading branch information
dannagle committed May 10, 2015
2 parents c250d61 + 63d1ba9 commit dacc7a3
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 46 deletions.
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -38,15 +30,15 @@ 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.
* During packet resending, there will be a button to cancel all resends.
* 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.
Expand All @@ -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).

Expand Down Expand Up @@ -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.

Expand Down
Binary file added screenshots/packetsender_direct_tcp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/packetsender_mac_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {


Expand Down Expand Up @@ -351,7 +364,6 @@ void MainWindow::loadTrafficLogTable()
ui->trafficLogTable->setRowCount(displayPackets.count());
}
unsigned int rowCounter = 0;
unsigned int colCount = 0;

QDEBUGVAR(packetTableHeaders);

Expand All @@ -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")
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -1072,14 +1082,12 @@ void MainWindow::packetTable_checkMultiSelected() {

//how many are selected?
QTableWidgetItem * checkItem;
SendPacketButton *sendButton;
QList<Packet> packetList;
Packet clickedPacket;
QList<QTableWidgetItem *> totalSelected = ui->packetsTable->selectedItems();
packetList.clear();
QStringList buttonsList;
buttonsList.clear();
int i = 0;


foreach(checkItem, totalSelected) {
Expand Down
2 changes: 2 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public slots:
void applyNetworkSettings();


void toggleUDPServer();
void toggleTCPServer();
private slots:
void on_packetHexEdit_lostFocus();
void on_packetASCIIEdit_lostFocus();
Expand Down
87 changes: 72 additions & 15 deletions src/persistentconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Packet> packetsSaved = Packet::fetchAllfromDB("");
ui->packetComboBox->clear();
ui->packetComboBox->addItem("<Load..>");
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();
Expand All @@ -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;
}

Expand Down Expand Up @@ -112,7 +125,8 @@ void PersistentConnection::init() {

void PersistentConnection::packetToSend(Packet sendpacket)
{
QDEBUG();

Q_UNUSED(sendpacket);

}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -249,8 +310,4 @@ void PersistentConnection::on_packetComboBox_currentIndexChanged(const QString &
}

}

ui->packetComboBox->setCurrentIndex(0);


}
12 changes: 12 additions & 0 deletions src/persistentconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -52,6 +62,8 @@ private slots:
bool stopTimer;
bool useraw;

void loadComboBox();
void loadTrafficView();
};

#endif // PERSISTENTCONNECTION_H
Loading

0 comments on commit dacc7a3

Please sign in to comment.