From f529ab5d0a27173ed68aa017a638b36b3dcf585f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 2 Mar 2018 11:24:31 -0800 Subject: [PATCH] Remove the endpoint "Map" feature. Remove the endpoint map and its button from the Qt and GTK+ UIs. It depends on GeoIP Legacy for coordinate information and those databases are being deprecated in favor of MaxMind DB. We *could* upgrade the code to use mmdbresolve, but according to https://dev.maxmind.com/geoip/geoip2/geolite2/ they're also going to remove coordinate information from GeoLite2: "In addition, in 2019, latitude and longitude coordinates in the GeoLite2 databases will be removed.* Latitude and longitude coordinates will continue to be provided in GeoIP2 databases. Please check back for updates." Change-Id: I43e1593d282a0f1aae897b1f4724117d1496b21e Reviewed-on: https://code.wireshark.org/review/26229 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- CMakeLists.txt | 10 - Makefile.am | 3 +- debian/control | 2 +- .../02_use_packaged_openlayers_js.patch | 17 -- debian/patches/series | 1 - docbook/release-notes.asciidoc | 1 + .../wsug_src/WSUG_chapter_statistics.asciidoc | 3 +- ipmap.html | 106 -------- .../macosx/Scripts/wireshark-postinstall.sh | 7 - packaging/nsis/uninstall.nsi | 1 - packaging/nsis/wireshark.nsi | 1 - packaging/wix/ComponentGroups.wxi | 3 - ui/gtk/hostlist_table.c | 101 -------- ui/qt/endpoint_dialog.cpp | 41 --- ui/qt/endpoint_dialog.h | 7 - ui/traffic_table_ui.c | 233 ------------------ ui/traffic_table_ui.h | 13 - 17 files changed, 4 insertions(+), 546 deletions(-) delete mode 100644 debian/patches/02_use_packaged_openlayers_js.patch delete mode 100644 ipmap.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 406b34e388..00f3efdbb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1629,7 +1629,6 @@ set(INSTALL_FILES colorfilters dfilters enterprises.tsv - ipmap.html manuf pdml2html.xsl services @@ -2376,15 +2375,6 @@ if(BUILD_wireshark_gtk AND GTK_FOUND) target_link_libraries(wireshark-gtk ${wireshark_gtk_LIBS}) install(TARGETS wireshark-gtk RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - # Map for endpoints dialog - ADD_CUSTOM_COMMAND( - TARGET wireshark-gtk - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/ipmap.html" - $ - ) - if(WIN32) add_custom_target(copy_gtk_dlls) set_target_properties(copy_gtk_dlls PROPERTIES FOLDER "Copy Tasks") diff --git a/Makefile.am b/Makefile.am index 7d9ca8de47..3f381f8a0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,7 +58,7 @@ EXTRA_PROGRAMS = wireshark-gtk wireshark tshark tfshark capinfos captype \ # Wireshark configuration files are put in $(pkgdatadir). # dist_pkgdata_DATA = COPYING manuf services cfilters colorfilters dfilters \ - smi_modules ipmap.html pdml2html.xsl enterprises.tsv wka + smi_modules pdml2html.xsl enterprises.tsv wka pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = wireshark.pc @@ -785,7 +785,6 @@ EXTRA_DIST = \ fix \ idl \ image \ - ipmap.html \ m4 \ macosx-support-lib-patches \ make-version.pl \ diff --git a/debian/control b/debian/control index 735ed583de..2f1c62fd29 100644 --- a/debian/control +++ b/debian/control @@ -195,7 +195,7 @@ Package: libwireshark-data Section: libs Architecture: all Multi-Arch: foreign -Depends: ${misc:Depends}, libjs-openlayers +Depends: ${misc:Depends} Conflicts: wireshark-common (<< 1.4.0~rc2-1) Replaces: wireshark-common (<< 1.4.0~rc2-1) Recommends: geoip-database, geoip-database-extra diff --git a/debian/patches/02_use_packaged_openlayers_js.patch b/debian/patches/02_use_packaged_openlayers_js.patch deleted file mode 100644 index 593efa9a9d..0000000000 --- a/debian/patches/02_use_packaged_openlayers_js.patch +++ /dev/null @@ -1,17 +0,0 @@ -Description: Use system's OpenLayers.js to avoid privacy breach -Forwarded: not-needed -Author: Balint Reczey - -diff --git a/ipmap.html b/ipmap.html -index c1e83d0..94f4535 100644 ---- a/ipmap.html -+++ b/ipmap.html -@@ -8,7 +8,7 @@ - line-height: 17px; - } - -- -+ - - - - - - - - -
-
- - diff --git a/packaging/macosx/Scripts/wireshark-postinstall.sh b/packaging/macosx/Scripts/wireshark-postinstall.sh index 3ab2576de8..e570fc8f57 100755 --- a/packaging/macosx/Scripts/wireshark-postinstall.sh +++ b/packaging/macosx/Scripts/wireshark-postinstall.sh @@ -19,13 +19,6 @@ do rm -f "$PLUGINS_PATH"/$plugin.so "$PLUGINS_PATH"/$plugin.la done -# -# Get rid of any ipmap.html file that was dropped into Contents/MacOS; -# it belongs in, and is installed in, Contents/Resources/share/wireshark, -# and we don't need the extra copy. -# -rm -f "$2/Wireshark.app/Contents/MacOS/ipmap.html" - # Setting PATH # if /etc/paths.d/Wireshark already exists we overwrite it. # diff --git a/packaging/nsis/uninstall.nsi b/packaging/nsis/uninstall.nsi index 1a8565c846..f552ffed74 100644 --- a/packaging/nsis/uninstall.nsi +++ b/packaging/nsis/uninstall.nsi @@ -228,7 +228,6 @@ Delete "$INSTDIR\pdml2html.xsl" Delete "$INSTDIR\pcrepattern.3.txt" Delete "$INSTDIR\user-guide.chm" Delete "$INSTDIR\example_snmp_users_file" -Delete "$INSTDIR\ipmap.html" Delete "$INSTDIR\radius\*.*" Delete "$INSTDIR\dtds\*.*" Delete "$SMPROGRAMS\${PROGRAM_NAME}\*.*" diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index 184a4755a3..91f4d68b7b 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -451,7 +451,6 @@ File "${STAGING_DIR}\wireshark-filter.html" File "${STAGING_DIR}\dumpcap.exe" File "${STAGING_DIR}\dumpcap.html" File "${STAGING_DIR}\extcap.html" -File "${STAGING_DIR}\ipmap.html" ; C-runtime redistributable !ifdef VCREDIST_EXE diff --git a/packaging/wix/ComponentGroups.wxi b/packaging/wix/ComponentGroups.wxi index 9415ea3cbd..d2d5a0fbf8 100644 --- a/packaging/wix/ComponentGroups.wxi +++ b/packaging/wix/ComponentGroups.wxi @@ -75,9 +75,6 @@ - - - diff --git a/ui/gtk/hostlist_table.c b/ui/gtk/hostlist_table.c index 7e593cdc21..7c86b15e5c 100644 --- a/ui/gtk/hostlist_table.c +++ b/ui/gtk/hostlist_table.c @@ -49,10 +49,6 @@ #include "ui/gtk/dlg_utils.h" #include "ui/gtk/help_dlg.h" #include "ui/gtk/main.h" -#ifdef HAVE_GEOIP -#include "ui/gtk/webbrowser.h" -#include "ui/gtk/stock_icons.h" -#endif #include "ui/gtk/old-gtk-compat.h" @@ -776,45 +772,6 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) g_string_free(csv.CSV_str, TRUE); /* Free the memory */ } -#ifdef HAVE_GEOIP - -static void -open_as_map_cb(GtkWindow *copy_bt, gpointer data _U_) -{ - gchar *err_str; - gchar *file_uri; - gboolean uri_open; - hostlist_table *talkers; - gchar *map_filename; - - - talkers = (hostlist_table *)g_object_get_data(G_OBJECT(copy_bt), HOST_PTR_KEY); - if (!talkers) { - return; - } - - map_filename = create_endpoint_geoip_map(talkers->hash.conv_array, &err_str); - - if (!map_filename) { - simple_error_message_box("%s", err_str); - g_free(err_str); - return; - } - - /* open the webbrowser */ - file_uri = g_filename_to_uri(map_filename, NULL, NULL); - g_free(map_filename); - uri_open = browser_open_url (file_uri); - if(!uri_open) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Couldn't open the file: \"%s\" in your web browser", file_uri); - g_free(file_uri); - return; - } - - g_free(file_uri); -} -#endif /* HAVE_GEOIP */ - static gint default_col_size[ENDP_NUM_COLUMNS+ENDP_NUM_GEOIP_COLUMNS]; static void @@ -1026,9 +983,6 @@ init_hostlist_table(struct register_ct* ct, const char *filter) GtkWidget *close_bt, *help_bt; gboolean ret; GtkWidget *copy_bt; -#ifdef HAVE_GEOIP - GtkWidget *map_bt; -#endif window_geometry_t tl_geom; hosttable=g_new0(hostlist_table,1); @@ -1059,15 +1013,7 @@ init_hostlist_table(struct register_ct* ct, const char *filter) /* Button row. */ /* XXX - maybe we want to have a "Copy as CSV" stock button here? */ /*copy_bt = gtk_button_new_with_label ("Copy content to clipboard as CSV");*/ -#ifdef HAVE_GEOIP - if( strstr(hosttable->name, "IPv4") || strstr(hosttable->name, "IPv6") ) { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, WIRESHARK_STOCK_MAP, GTK_STOCK_HELP, NULL); - } else { - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); - } -#else bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); -#endif gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); @@ -1079,15 +1025,6 @@ init_hostlist_table(struct register_ct* ct, const char *filter) g_object_set_data(G_OBJECT(copy_bt), HOST_PTR_KEY, hosttable); g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), NULL); -#ifdef HAVE_GEOIP - map_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_MAP); - if(map_bt != NULL) { - gtk_widget_set_tooltip_text(map_bt, "Show a map of the IP addresses (internet connection required)."); - g_object_set_data(G_OBJECT(map_bt), HOST_PTR_KEY, hosttable); - g_signal_connect(map_bt, "clicked", G_CALLBACK(open_as_map_cb), NULL); - } -#endif /* HAVE_GEOIP */ - help_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP); g_signal_connect(help_bt, "clicked", G_CALLBACK(topic_cb), (gpointer)HELP_STATS_ENDPOINTS_DIALOG); @@ -1115,28 +1052,6 @@ ct_nb_switch_page_cb(GtkNotebook *nb, gpointer *pg _U_, guint page, gpointer dat } } -#ifdef HAVE_GEOIP -static void -ct_nb_map_switch_page_cb(GtkNotebook *nb, gpointer *pg _U_, guint page, gpointer data) -{ - GtkWidget *map_bt = (GtkWidget *) data; - void ** pages = (void **)g_object_get_data(G_OBJECT(nb), NB_PAGES_KEY); - - page++; - - if (pages && page > 0 && (int) page <= GPOINTER_TO_INT(pages[0]) && map_bt) { - g_object_set_data(G_OBJECT(map_bt), HOST_PTR_KEY, pages[page]); - if( strstr(((hostlist_table *)pages[page])->name, "IPv4") || - strstr(((hostlist_table *)pages[page])->name, "IPv6") ) { - gtk_widget_set_sensitive(map_bt, TRUE); - } else { - gtk_widget_set_sensitive(map_bt, FALSE); - } - } -} -#endif /* HAVE_GEOIP */ - - static void hostlist_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) { @@ -1264,9 +1179,6 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) void ** pages; GtkWidget *nb; GtkWidget *copy_bt; -#ifdef HAVE_GEOIP - GtkWidget *map_bt; -#endif window_geometry_t tl_geom; init_host_page_data host_page_iter_data; @@ -1318,11 +1230,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) g_signal_connect(filter_cb, "toggled", G_CALLBACK(hostlist_filter_toggle_dest), pages); /* Button row. */ -#ifdef HAVE_GEOIP - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, WIRESHARK_STOCK_MAP, GTK_STOCK_HELP, NULL); -#else bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY, GTK_STOCK_HELP, NULL); -#endif gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); /* Close */ @@ -1335,15 +1243,6 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), NULL); g_object_set_data(G_OBJECT(copy_bt), HOST_PTR_KEY, pages[host_page_iter_data.page]); -#ifdef HAVE_GEOIP - map_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_MAP); - gtk_widget_set_tooltip_text(map_bt, "Show a map of the IP addresses (internet connection required)."); - g_object_set_data(G_OBJECT(map_bt), HOST_PTR_KEY, pages[host_page_iter_data.page]); - g_signal_connect(map_bt, "clicked", G_CALLBACK(open_as_map_cb), NULL); - g_signal_connect(nb, "switch-page", G_CALLBACK(ct_nb_map_switch_page_cb), map_bt); - gtk_widget_set_sensitive(map_bt, FALSE); -#endif /* HAVE_GEOIP */ - g_signal_connect(nb, "switch-page", G_CALLBACK(ct_nb_switch_page_cb), copy_bt); help_bt = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_HELP); diff --git a/ui/qt/endpoint_dialog.cpp b/ui/qt/endpoint_dialog.cpp index 20b79e8881..37e5ccdb86 100644 --- a/ui/qt/endpoint_dialog.cpp +++ b/ui/qt/endpoint_dialog.cpp @@ -35,14 +35,6 @@ static const QString table_name_ = QObject::tr("Endpoint"); EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_id, const char *filter) : TrafficTableDialog(parent, cf, filter, table_name_) { -#ifdef HAVE_GEOIP - map_bt_ = buttonBox()->addButton(tr("Map"), QDialogButtonBox::ActionRole); - map_bt_->setToolTip(tr("Draw IPv4 or IPv6 endpoints on a map.")); - connect(map_bt_, SIGNAL(clicked()), this, SLOT(createMap())); - - connect(trafficTableTabWidget(), SIGNAL(currentChanged(int)), this, SLOT(tabChanged())); -#endif - addProgressFrame(&parent); QList endp_protos; @@ -70,10 +62,6 @@ EndpointDialog::EndpointDialog(QWidget &parent, CaptureFile &cf, int cli_proto_i fillTypeMenu(endp_protos); -#ifdef HAVE_GEOIP - tabChanged(); -#endif - QPushButton *close_bt = buttonBox()->button(QDialogButtonBox::Close); if (close_bt) { close_bt->setDefault(true); @@ -156,38 +144,9 @@ bool EndpointDialog::addTrafficTable(register_ct_t *table) EndpointTreeWidget::tapReset, get_hostlist_packet_func(table), EndpointTreeWidget::tapDraw); - -#ifdef HAVE_GEOIP - connect(endp_tree, SIGNAL(geoIPStatusChanged()), this, SLOT(tabChanged())); -#endif return true; } -#ifdef HAVE_GEOIP -void EndpointDialog::tabChanged() -{ - EndpointTreeWidget *cur_tree = qobject_cast(trafficTableTabWidget()->currentWidget()); - map_bt_->setEnabled(cur_tree && cur_tree->hasGeoIPData()); -} - -void EndpointDialog::createMap() -{ - EndpointTreeWidget *cur_tree = qobject_cast(trafficTableTabWidget()->currentWidget()); - if (!cur_tree) { - return; - } - - gchar *err_str; - gchar *map_path = create_endpoint_geoip_map(cur_tree->trafficTreeHash()->conv_array, &err_str); - if (!map_path) { - QMessageBox::warning(this, tr("Map file error"), err_str); - g_free(err_str); - return; - } - QDesktopServices::openUrl(QUrl::fromLocalFile(gchar_free_to_qstring(map_path))); -} -#endif - void EndpointDialog::on_buttonBox_helpRequested() { wsApp->helpTopicAction(HELP_STATS_ENDPOINTS_DIALOG); diff --git a/ui/qt/endpoint_dialog.h b/ui/qt/endpoint_dialog.h index 5ca6084e54..b1186f4858 100644 --- a/ui/qt/endpoint_dialog.h +++ b/ui/qt/endpoint_dialog.h @@ -64,17 +64,10 @@ public slots: void captureFileClosing(); private: -#ifdef HAVE_GEOIP - QPushButton *map_bt_; -#endif bool addTrafficTable(register_ct_t* table); private slots: -#ifdef HAVE_GEOIP - void tabChanged(); - void createMap(); -#endif void on_buttonBox_helpRequested(); }; diff --git a/ui/traffic_table_ui.c b/ui/traffic_table_ui.c index 106f30dd85..02c6d16a5c 100644 --- a/ui/traffic_table_ui.c +++ b/ui/traffic_table_ui.c @@ -14,25 +14,6 @@ #include "traffic_table_ui.h" #include -#ifdef HAVE_GEOIP -#include -#include "epan/address.h" -#include "epan/addr_resolv.h" -#include "epan/geoip_db.h" -#include "epan/strutil.h" -#include "wsutil/pint.h" -#include "wsutil/str_util.h" - -#include "epan/packet_info.h" -#include "epan/conversation_table.h" - -#include -#include -#include "wsutil/filesystem.h" -#include "wsutil/file_util.h" -#include "wsutil/tempfile.h" -#endif - const char *conv_column_titles[CONV_NUM_COLUMNS] = { "Address A", "Port A", @@ -67,220 +48,6 @@ const char *endp_column_titles[ENDP_NUM_COLUMNS] = { const char *endp_conn_title = "Connection"; -#ifdef HAVE_GEOIP -#define MAX_TPL_LINE_LEN 4096 -gchar * -create_endpoint_geoip_map(const GArray *endp_array, gchar **err_str) { - char *tpl_filename, *tpl_line; - FILE *tpl_file, *out_file; - char *map_path; - gchar *map_filename = NULL; - guint i; - GString *tpl_entry; - gchar *esc_entry; - int db_lon, db_lat, db_country4, db_country6, db_city4, db_city6, db_asn4, db_asn6; - guint cur_db; - const char *map_endpoint_opener = "{\n"; - - db_lon = db_lat = db_country4 = db_country6 = db_city4 = db_city6 = db_asn4 = db_asn6 = -1; - - /* Create a location map HTML file from a template */ - /* XXX - add error handling */ - tpl_filename = get_datafile_path("ipmap.html"); - tpl_file = ws_fopen(tpl_filename, "r"); - if(tpl_file == NULL) { - if (err_str) { - GString *err_descr = g_string_new(""); - g_string_printf(err_descr, file_open_error_message(errno, FALSE), tpl_filename); - *err_str = g_string_free(err_descr, FALSE); - } - g_free(tpl_filename); - return NULL; - } - g_free(tpl_filename); - -#if 1 - /* We should probably create a file with a temporary name and a .html extension instead */ - if (! create_tempdir(&map_path, "Wireshark IP Map ")) { - if (err_str) { - GString *err_descr = g_string_new(""); - g_string_printf(err_descr, "Could not create temporary directory\n%s", - map_path); - *err_str = g_string_free(err_descr, FALSE); - } - fclose(tpl_file); - return NULL; - } -#else - /* Debugging only */ - map_path = "/tmp"; -#endif - - map_filename = g_strdup_printf("%s%cipmap.html", map_path, G_DIR_SEPARATOR); - out_file = ws_fopen(map_filename, "w"); - if(out_file == NULL) { - if (err_str) { - GString *err_descr = g_string_new(""); - g_string_printf(err_descr, file_open_error_message(errno, FALSE), map_filename); - *err_str = g_string_free(err_descr, FALSE); - } - g_free(map_filename); - fclose(tpl_file); - return NULL; - } - - tpl_line = (char *)g_malloc(MAX_TPL_LINE_LEN); - - while (fgets(tpl_line, MAX_TPL_LINE_LEN, tpl_file) != NULL) { - fputs(tpl_line, out_file); - /* MUST match ipmap.html */ - if (strstr(tpl_line, "// Start endpoint list")) { - break; - } - } - - for (cur_db = 0; cur_db < geoip_db_num_dbs(); cur_db++) { - switch (geoip_db_type(cur_db)) { - case WS_LON_FAKE_EDITION: - db_lon = cur_db; - break; - case WS_LAT_FAKE_EDITION: - db_lat = cur_db; - break; - case GEOIP_COUNTRY_EDITION: - db_country4 = cur_db; - break; - case GEOIP_COUNTRY_EDITION_V6: - db_country6 = cur_db; - break; - case GEOIP_CITY_EDITION_REV0: - case GEOIP_CITY_EDITION_REV1: - db_city4 = cur_db; - break; - case GEOIP_CITY_EDITION_REV0_V6: - case GEOIP_CITY_EDITION_REV1_V6: - db_city6 = cur_db; - break; - } - } - - if(db_lon < 0 || db_lat < 0) { - if (err_str) { - *err_str = g_strdup("Unable to open GeoIP database"); - } - /* We can't write the map file, so close it and get rid of it */ - fclose(out_file); - ws_unlink(map_filename); - g_free(map_filename); - fclose(tpl_file); - g_free(tpl_line); - return NULL; - } - - /* Fill in our map data */ - tpl_entry = g_string_new(""); - - for (i = 0; i < endp_array->len; i++) { - char *lat = NULL, *lon = NULL, *country = NULL, *city = NULL, *asn = NULL; - hostlist_talker_t *endp_item = &g_array_index(endp_array, hostlist_talker_t, i); - - if (endp_item->myaddress.type == AT_IPv4) { - lon = geoip_db_lookup_ipv4(db_lon, pntoh32(endp_item->myaddress.data), NULL); - lat = geoip_db_lookup_ipv4(db_lat, pntoh32(endp_item->myaddress.data), NULL); - country = geoip_db_lookup_ipv4(db_country4, pntoh32(endp_item->myaddress.data), "-"); - city = geoip_db_lookup_ipv4(db_city4, pntoh32(endp_item->myaddress.data), "-"); - asn = geoip_db_lookup_ipv4(db_asn4, pntoh32(endp_item->myaddress.data), "-"); - } else if (endp_item->myaddress.type == AT_IPv6) { - const ws_in6_addr *addr = (const ws_in6_addr *) endp_item->myaddress.data; - lon = geoip_db_lookup_ipv6(db_lon, *addr, NULL); - lat = geoip_db_lookup_ipv6(db_lat, *addr, NULL); - country = geoip_db_lookup_ipv6(db_country6, *addr, "-"); - city = geoip_db_lookup_ipv6(db_city6, *addr, "-"); - asn = geoip_db_lookup_ipv6(db_asn6, *addr, "-"); - } else { - continue; - } - - /* - { - 'type': 'Feature', 'geometry': { 'type': 'Point', 'coordinates': [-122.583889, 37.898889] }, - 'properties': { 'title': 'host.example.com', 'description': 'AS: AS12345 Ewok Holdings, Inc.
Country: US
City: Muir Woods, CA
Packets: 6
Bytes: 980' } - }, - */ - - if (lon && lat) { - char* addr_str; - - g_string_printf(tpl_entry, "%s", map_endpoint_opener); - - /* Longitude + latitude */ - g_string_append_printf(tpl_entry, " 'type': 'Feature', 'geometry': { 'type': 'Point', 'coordinates': [%s, %s] },\n", lon, lat); - - /* Address */ - addr_str = address_to_display(NULL, &endp_item->myaddress); - g_string_append_printf(tpl_entry, " 'properties': { 'title': '%s', ", addr_str); - wmem_free(NULL, addr_str); - - /* Description */ - - /* City */ - esc_entry = string_replace(city, "'", "'"); - g_string_append_printf(tpl_entry, "'description': '
City: %s
", esc_entry); - g_free(esc_entry); - - /* Country */ - esc_entry = string_replace(country, "'", "'"); - g_string_append_printf(tpl_entry, "
Country: %s
", esc_entry); - g_free(esc_entry); - - /* Packets */ - esc_entry = format_size(endp_item->tx_frames + endp_item->rx_frames, - (format_size_flags_e)(format_size_unit_none|format_size_prefix_si)); - g_string_append_printf(tpl_entry, "
Packets: %s
", esc_entry); - g_free(esc_entry); - - /* Bytes */ - esc_entry = format_size(endp_item->tx_bytes + endp_item->rx_bytes, - (format_size_flags_e)(format_size_unit_none|format_size_prefix_si)); - g_string_append_printf(tpl_entry, "
Bytes: %s
", esc_entry); - g_free(esc_entry); - - /* ASN */ - esc_entry = string_replace(asn, "'", "'"); - g_string_append_printf(tpl_entry, "
AS Number: %s
", esc_entry); - g_free(esc_entry); - - /* XXX - We could add specific icons, e.g. depending on the amount of packets or bytes */ - g_string_append(tpl_entry, "' }\n"); - g_string_append(tpl_entry, "}"); - - fputs(tpl_entry->str, out_file); - map_endpoint_opener = ",\n{\n"; - } - - wmem_free(NULL, lat); - wmem_free(NULL, lon); - wmem_free(NULL, country); - wmem_free(NULL, city); - wmem_free(NULL, asn); - - /* XXX Display an error if we we have no entries */ - } - - while (fgets(tpl_line, MAX_TPL_LINE_LEN, tpl_file) != NULL) { - fputs(tpl_line, out_file); - } - g_free(tpl_line); - - fclose(tpl_file); - fclose(out_file); - - return map_filename; - - -} -#endif - /* * Editor modelines * diff --git a/ui/traffic_table_ui.h b/ui/traffic_table_ui.h index 4baab403bb..c89564d24e 100644 --- a/ui/traffic_table_ui.h +++ b/ui/traffic_table_ui.h @@ -60,19 +60,6 @@ extern const char *endp_column_titles[ENDP_NUM_COLUMNS]; extern const char *endp_conn_title; -#ifdef HAVE_GEOIP -/** Create an HTML file containing a map showing the geograpical - * locations of IPv4 and IPv6 addresses. The map is named "ipmap.html". - * - * @param [in] endp_array GArray of hostlist_talker_t structs. - * @param [in,out] err_str Set to error string on failure. Error string must - * be g_freed. May be NULL. - * @return Path of the map file if it was successfully written or NULL - * on failure. The path must be g_freed. - */ -gchar *create_endpoint_geoip_map(const GArray *endp_array, gchar **err_str); -#endif - #ifdef __cplusplus } #endif /* __cplusplus */