summaryrefslogtreecommitdiff
path: root/src/monitor-gui.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/monitor-gui.cc')
-rw-r--r--src/monitor-gui.cc73
1 files changed, 47 insertions, 26 deletions
diff --git a/src/monitor-gui.cc b/src/monitor-gui.cc
index c28227b..b02f028 100644
--- a/src/monitor-gui.cc
+++ b/src/monitor-gui.cc
@@ -156,7 +156,7 @@ public:
case 2:
return "To";
case 3:
- return "Data";
+ return "Size";
case 4:
return "Duration";
}
@@ -254,7 +254,8 @@ private:
static void format_size(std::string* out, size_t size, bool done) {
char tmp[50];
- auto len = snprintf(tmp, sizeof(tmp), "%llu bytes", static_cast<unsigned long long>(size));
+ auto len = snprintf(tmp, sizeof(tmp), "%llu bytes",
+ static_cast<unsigned long long>(size));
out->assign(tmp, len);
if (!done) out->append(" ...", 4);
}
@@ -278,7 +279,8 @@ private:
n += 1000000000ull;
}
char tmp[50];
- auto len = snprintf(tmp, sizeof(tmp), "%ld.%09lu", static_cast<long>(s), static_cast<unsigned long>(n));
+ auto len = snprintf(tmp, sizeof(tmp), "%ld.%09lu",
+ static_cast<long>(s), static_cast<unsigned long>(n));
out->assign(tmp, len);
}
@@ -840,19 +842,16 @@ public:
edit->add_item(ACTION_CLEAR, "Clear");
auto proxy = menu_->add_menu("Proxy");
- proxy->add_item(ACTION_SETUP, "Setup...");
- proxy->add_item(ACTION_CONNECT, "Connect...",
- GuiMenu::Shortcut(GuiMenu::CTRL, 'C'));
- proxy->add_item(ACTION_DISCONNECT, "Disconnect",
- GuiMenu::Shortcut(GuiMenu::CTRL, 'D'));
+ proxy->add_item(ACTION_SETUP, "Setup...", GuiMenu::Shortcut(0, 5));
+ proxy->add_item(ACTION_CONNECT, "Connect...", GuiMenu::Shortcut(0, 6));
+ proxy->add_item(ACTION_DISCONNECT, "Disconnect", GuiMenu::Shortcut(0, 7));
#if HAVE_SSL
auto tools = menu_->add_menu("Tools");
tools->add_item(ACTION_GENERATE_CA, "Generate CA...");
#endif // HAVE_SSL
auto help = menu_->add_menu("Help");
- help->add_item(ACTION_ABOUT, "About...",
- GuiMenu::Shortcut(0, 1));
+ help->add_item(ACTION_ABOUT, "About...", GuiMenu::Shortcut(0, 1));
help->add_item(ACTION_PROXY_LOG, "Proxy log...");
main_->set_menu(menu_.get());
main_->set_statusbar(statusbar_.get());
@@ -860,7 +859,7 @@ public:
main_->set_listmodel(packages_.get());
- statusbar_->set_status("Not connected");
+ statusbar_->set_status("Not monitoring traffic");
menu_->enable_item(ACTION_DISCONNECT, false);
lost_selection(main_.get());
@@ -890,29 +889,39 @@ public:
setup_proxy();
proxy_logger_->clear();
auto dlg = std::unique_ptr<GuiFormApply::Delegate>(
- new SetupFormDelegate(proxy_, proxy_config_.get(), proxy_logger_.get(),
+ new SetupFormDelegate(proxy_, proxy_config_.get(),
+ proxy_logger_.get(),
monitor_.get(), main_->config(),
looper_.get(), resolver_.get()));
auto lst = std::unique_ptr<GuiFormApply::Listener>(
new SetupFormListener());
connect_.reset(
GuiFormApply::create("Setup...",
- "Setup a proxy to start monitoring traffic.",
+ "Setup a proxy to start monitoring traffic."
+ " Will catch all traffic sent to the proxy"
+ " address and port setup below."
+#if HAVE_SSL
+ "\nIf you wish to intercept SSL traffic you need"
+ " to make the client program or device trust"
+ " the CA used. To generate a CA go to the Tools"
+ " menu."
+#endif
+ ,
"Setup",
dlg.get()));
connect_->add_string("bind", "Address",
main_->config()->get("bind", ""),
"Address to listen for proxy connections on."
- " Leave empty to listen on all interfaces.");
+ " Leave empty to listen on all interfaces");
connect_->add_string("port", "Port",
main_->config()->get("port", "8080"),
- "Port to listen for proxy connections on.");
+ "Port to listen for proxy connections on");
#if HAVE_SSL
bool mitm = main_->config()->get("mitm", false);
connect_->add_bool("mitm", "Intercept SSL traffic",
mitm,
"If enabled SSL connections will be intercepted"
- " by the proxy to log unencrypted traffic.");
+ " by the proxy to log unencrypted traffic");
connect_->add_file("ssl-ca", "Certificate Authority",
main_->config()->get("ssl-ca",
main_->config()->get("genca-output", "")),
@@ -949,7 +958,8 @@ public:
new ConnectFormListener());
connect_.reset(
GuiFormApply::create("Connect...",
- "Enter address for monitor to connect to",
+ "Enter address and monitor port for a running"
+ " proxy daemon to connect to.",
"Connect",
dlg.get()));
connect_->add_string("address", "Address",
@@ -1052,9 +1062,9 @@ public:
del.get()));
dlg->add_string("issuer", "Issuer name",
main_->config()->get("issuer", ""),
- "Issuer name to use instead of the default.");
+ "Issuer name to use instead of the default");
dlg->add_file("output", "File", "",
- "File to save certificate and key pair to.",
+ "File to save certificate and key pair to",
GuiFile::FILE_SAVE, pem_filter_);
dlg->add_listener(lst.get());
dlg->show(main_.get());
@@ -1175,22 +1185,33 @@ public:
bool allow_connect, allow_disconnect;
switch (state) {
case Monitor::DISCONNECTED:
- statusbar_->set_status("Not connected");
+ statusbar_->set_status("Not monitoring traffic");
allow_connect = true;
allow_disconnect = false;
break;
case Monitor::CONNECTED:
- statusbar_->set_status("Connected");
+ statusbar_->set_status("Connected to proxy, waiting to attach...");
allow_connect = false;
allow_disconnect = true;
break;
case Monitor::CONNECTING:
- statusbar_->set_status("Connecting...");
+ statusbar_->set_status("Connecting to proxy...");
allow_connect = false;
allow_disconnect = false;
break;
case Monitor::ATTACHED:
- statusbar_->set_status("Connected and attached");
+ if (proxy_) {
+ std::string tmp = "Listening on ";
+ auto bind = proxy_config_->get("proxy_bind", nullptr);
+ if (bind && *bind) {
+ tmp += bind;
+ tmp += ":";
+ }
+ tmp += proxy_config_->get("proxy_port", "?");
+ statusbar_->set_status(tmp);
+ } else {
+ statusbar_->set_status("Connected and attached to proxy");
+ }
allow_connect = false;
allow_disconnect = true;
break;
@@ -1300,7 +1321,7 @@ private:
if (!modified_) return false;
std::unique_ptr<GuiForm> form(
GuiForm::create("Confirm?",
- "If you continue you will lose unsaved packages"));
+ "If you continue you will lose any unsaved packages"));
return !form->show(main_.get());
}
@@ -1653,7 +1674,7 @@ private:
if (is_pcap(file)) return load_pcap(file, packages);
std::ifstream in(file);
if (!in.good()) {
- show_error("Unable to open " + file + " for reading");
+ show_error("Unable to open " + file + " for reading.");
return false;
}
auto delegate = std::unique_ptr<PackagesReaderDelegate>(
@@ -1676,7 +1697,7 @@ private:
if (is_pcap(file)) return save_pcap(packages, file);
std::ofstream out(file);
if (!out.good()) {
- show_error("Unable to open " + file + " for writing");
+ show_error("Unable to open " + file + " for writing.");
return false;
}
auto writer = std::unique_ptr<PackagesWriter>(PackagesWriter::create(&out));