Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Development in to master #63

Merged
merged 36 commits into from
Feb 18, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fc28ffa
added basic ssl support to command line
dannagle Jan 18, 2017
549dcdd
better ssl icons
dannagle Jan 18, 2017
0e59411
added menu icons
dannagle Jan 18, 2017
5d05c2f
progress on ssl
dannagle Jan 18, 2017
3f33938
successful ssl persistent window
dannagle Jan 18, 2017
65c5f48
fixed ssl logging
dannagle Jan 18, 2017
10c5f2f
DNS is now post-send
dannagle Jan 18, 2017
98ee1d3
added run-time debug mode
dannagle Jan 20, 2017
29c3993
added dns resolve settings, restore session setting, ssl ignore error…
dannagle Jan 20, 2017
482443f
now displaying encryption method
dannagle Jan 20, 2017
457c97b
added menu icon
dannagle Jan 20, 2017
757622d
added run-time debug mac support
dannagle Jan 22, 2017
15f559e
dont restore name in session
dannagle Jan 22, 2017
4b42aac
fix session restore of combo box
dannagle Jan 22, 2017
2c1944f
fix a race condition
dannagle Jan 22, 2017
712d8e9
show IP resolve on dns
dannagle Jan 22, 2017
d0b3281
packet sender default bind port is now random
dannagle Jan 22, 2017
b4e0c3a
default copy format is now raw
dannagle Jan 22, 2017
56056b0
started on ssl documentation
dannagle Jan 22, 2017
5013b84
added ssl documenation
dannagle Jan 22, 2017
71e8d24
minor typo
dannagle Jan 22, 2017
2ad1b20
minor typo
dannagle Jan 22, 2017
8860e58
fix tilde ascii
dannagle Jan 22, 2017
7fcd08f
cli options for ssl connections
dannagle Jan 22, 2017
bfca5de
improved CLI documentation for SSL
dannagle Jan 22, 2017
38eb496
improve ssl documentation
dannagle Jan 22, 2017
33256b9
added documentation link
dannagle Jan 23, 2017
0fc17d9
fix contact link
dannagle Jan 29, 2017
cb3da03
fix contact link
dannagle Jan 29, 2017
ad6b519
Use PS contact form.
dannagle Feb 11, 2017
05f1296
make settings file later... fix delyed load mac problem
dannagle Feb 12, 2017
b5f3e12
catch the gatekeeper command line argument
dannagle Feb 12, 2017
84b576e
added shortcut keys to sending options
dannagle Feb 15, 2017
d43f3bd
added hotkey mention
dannagle Feb 17, 2017
1cd80a5
added ssl checks
dannagle Feb 18, 2017
0c7a589
added openssl license clause
dannagle Feb 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added basic ssl support to command line
  • Loading branch information
dannagle committed Jan 18, 2017
commit fc28ffae50e65dba6c0256c6245869f7495fec1f
71 changes: 60 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ int main(int argc, char *argv[])
QCommandLineOption tcpOption(QStringList() << "t" << "tcp", "Send TCP (default).");
parser.addOption(tcpOption);

QCommandLineOption sslOption(QStringList() << "s" << "ssl", "Send SSL (secure).");
parser.addOption(sslOption);

// A boolean option with multiple names (-f, --force)
QCommandLineOption udpOption(QStringList() << "u" << "udp", "Send UDP.");
parser.addOption(udpOption);
Expand Down Expand Up @@ -142,6 +145,7 @@ int main(int argc, char *argv[])
unsigned int bind = parser.value(bindPortOption).toUInt();
bool tcp = parser.isSet(tcpOption);
bool udp = parser.isSet(udpOption);
bool ssl = parser.isSet(sslOption);
bool ipv6 = false;

QString name = parser.value(nameOption);
Expand Down Expand Up @@ -191,6 +195,10 @@ int main(int argc, char *argv[])
OUTIF() << "Warning: both TCP and UDP set. Defaulting to TCP.";
udp = false;
}
if(tcp && ssl) {
OUTIF() << "Warning: both TCP and SSL set. Defaulting to SSL.";
tcp = false;
}

if(!filePath.isEmpty() && !QFile::exists(filePath)) {
OUTIF() << "Error: specified path "<< filePath <<" does not exist.";
Expand All @@ -215,7 +223,7 @@ int main(int argc, char *argv[])
hex = true;
}

if(!tcp && !udp) {
if(!tcp && !udp && !ssl) {
tcp = true;
}

Expand All @@ -239,14 +247,21 @@ int main(int argc, char *argv[])
if(address.isEmpty()) {
address = sendPacket.toIP;
}
if(!parser.isSet(tcpOption) && !parser.isSet(udpOption)) {
if(!parser.isSet(tcpOption) && !parser.isSet(udpOption) && !parser.isSet(sslOption)) {

tcp=false;
udp = false;
ssl = true;
if(sendPacket.tcpOrUdp.toUpper() == "TCP") {
tcp=true;
udp = false;
} else {
tcp=false;
udp = true;
}

if(sendPacket.tcpOrUdp.toUpper() == "UDP") {
udp=true;
}

if(sendPacket.tcpOrUdp.toUpper() == "SSL") {
ssl=true;
}

}
Expand All @@ -263,7 +278,7 @@ int main(int argc, char *argv[])
QFile dataFile(filePath);
if(dataFile.open(QFile::ReadOnly)) {

if(tcp) {
if(tcp || ssl) {
QByteArray dataArray = dataFile.read(1024*1024*10);;
dataString = Packet::byteArrayToHex(dataArray);
} else {
Expand Down Expand Up @@ -293,12 +308,20 @@ int main(int argc, char *argv[])
QDEBUGVAR(bind);
QDEBUGVAR(tcp);
QDEBUGVAR(udp);
QDEBUGVAR(ssl);
QDEBUGVAR(name);
QDEBUGVAR(data);
QDEBUGVAR(filePath);

//NOW LETS DO THIS!

if(ssl && !QSslSocket::supportsSsl()) {
OUTIF() << "Error: This computer does not have a native SSL library.";
OUTPUT();
return -1;
}


if(ascii) { //pure ascii
dataString = Packet::byteArrayToHex(data.toLatin1());
}
Expand Down Expand Up @@ -344,20 +367,46 @@ int main(int argc, char *argv[])
QTime now = QTime::currentTime();
now.start();

if(tcp) {
QTcpSocket sock;

if(tcp || ssl) {
QSslSocket sock;

if(ipv6) {
sock.bind(QHostAddress::AnyIPv6, bind);
} else {
sock.bind(QHostAddress::AnyIPv4, bind);
}
sock.connectToHost(addy, port);

if(tcp) {
sock.connectToHost(addy, port);
}

if(ssl) {
sock.connectToHostEncrypted(address, port);
sock.ignoreSslErrors();
}
sock.waitForConnected(1000);

if(ssl) {
sock.waitForEncrypted(5000);
}

if(sock.state() == QAbstractSocket::ConnectedState)
{
OUTIF() << "TCP (" <<sock.localPort() <<")://" << address << ":" << port << " " << dataString;
QString connectionType = "TCP";
if(sock.isEncrypted()) {
connectionType = "Encrypted SSL";
} else {
if(ssl) {
OUTIF() << "Warning: This connection is not encrypted.";
}
}

if(ssl) {
QDEBUGVAR(sock.isEncrypted());
}

OUTIF() << connectionType << " (" <<sock.localPort() <<")://" << address << ":" << port << " " << dataString;
bytesWriten = sock.write(sendData);
sock.waitForBytesWritten(1000);
//OUTIF() << "Sent:" << Packet::byteArrayToHex(sendData);
Expand Down
11 changes: 10 additions & 1 deletion src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@
<normaloff>:/icons/tx_udp.png</normaloff>:/icons/tx_udp.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>SSL</string>
</property>
<property name="icon">
<iconset resource="packetsender.qrc">
<normaloff>:/icons/tx_ssl.png</normaloff>:/icons/tx_ssl.png</iconset>
</property>
</item>
</widget>
</item>
<item>
Expand Down Expand Up @@ -396,7 +405,7 @@
<x>0</x>
<y>0</y>
<width>909</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down