diff --git a/CHANGELOG b/CHANGELOG index b6ce85380..5c03ea125 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -39,6 +39,10 @@ o Added the --badsum option, which causes Nmap to use invalid TCP or author of that paper, Ed3f (ed3f(a)antifork.org), is also the author of this patch. +o More excellent NmapFE patches from Priit Laes (amd(a)store20.com) + were applied to remove deprecated GTK API calls which could cause + compilation failures and also "Gtk-CRITICAL" warning messages. + 3.96BETA1 o Added --max_retries option for capping the maximum number of diff --git a/nmapfe/nmapfe.c b/nmapfe/nmapfe.c index 864b533e2..17cdc5cdb 100644 --- a/nmapfe/nmapfe.c +++ b/nmapfe/nmapfe.c @@ -209,45 +209,40 @@ static Entry scanentries[] = { }; - -static GtkItemFactoryEntry throttleEntries[] = { - { "/Paranoid Throttling", NULL, throttleType_changed_fcb, PARANOID_THROTTLE, NULL }, - { "/Sneaky Throttling", NULL, throttleType_changed_fcb, SNEAKY_THROTTLE, NULL }, - { "/Polite Throttling", NULL, throttleType_changed_fcb, POLITE_THROTTLE, NULL }, - { "/Normal Throttling", NULL, throttleType_changed_fcb, NORMAL_THROTTLE, NULL }, - { "/Agressive Throttling", NULL, throttleType_changed_fcb, AGRESSIVE_THROTTLE, NULL }, - { "/Insane Throttling", NULL, throttleType_changed_fcb, INSANE_THROTTLE, NULL }, - { NULL, NULL, NULL, NO_THROTTLE, NULL } +static gchar *throttleEntries[] = { + "Paranoid Throttling", + "Sneaky Throttling", + "Polite Throttling", + "Normal Throttling", + "Aggressive Throttling", + "Insane Throttling", + NULL }; - -static GtkItemFactoryEntry resolveEntries[] = { - { "/Always", NULL, resolveType_changed_fcb, ALWAYS_RESOLVE, NULL }, - { "/When Required", NULL, resolveType_changed_fcb, DEFAULT_RESOLVE, NULL }, - { "/Never", NULL, resolveType_changed_fcb, NEVER_RESOLVE, NULL }, - { NULL, NULL, NULL, NO_RESOLVE, NULL } +static gchar *resolveEntries[] = { + "Always", + "When Required", + "Never", + NULL }; - -static GtkItemFactoryEntry protportEntries[] = { - { "/Default", NULL, protportType_changed_fcb, DEFAULT_PROTPORT, NULL }, - { "/All", NULL, protportType_changed_fcb, ALL_PROTPORT, NULL }, - { "/Most Important [fast]", NULL, protportType_changed_fcb, FAST_PROTPORT, NULL }, - { "/Range Given Below", NULL, protportType_changed_fcb, GIVEN_PROTPORT, NULL }, - { NULL, NULL, NULL, NO_PROTPORT, NULL } +static gchar *protportEntries[] = { + "Default", + "All", + "Most Important [fast]", + "Range Given Below", + NULL }; - -static GtkItemFactoryEntry verboseEntries[] = { - { "/Quiet", NULL, verboseType_changed_fcb, QUIET_VERBOSE, NULL }, - { "/Verbose", NULL, verboseType_changed_fcb, V1_VERBOSE, NULL }, - { "/Very Verbose", NULL, verboseType_changed_fcb, V2_VERBOSE, NULL }, - { "/Debug", NULL, verboseType_changed_fcb, D1_VERBOSE, NULL }, - { "/Verbose Debug", NULL, verboseType_changed_fcb, D2_VERBOSE, NULL }, - { NULL, NULL, NULL, NO_VERBOSE, NULL } +static gchar *verboseEntries[] = { + "Quiet", + "Verbose", + "Very Verbose", + "Debug", + "Verbose Debug", + NULL }; - static GtkItemFactoryEntry outputFormatEntries[] = { { "/Normal", NULL, outputFormatType_changed_fcb, NORMAL_OUTPUT, NULL }, { "/grep-able", NULL, outputFormatType_changed_fcb, GREP_OUTPUT, NULL }, @@ -613,43 +608,47 @@ GtkAdjustment *adjust; gtk_widget_show(frame); - opt.protportFrame = gtk_frame_new("Scanned Ports"); - // gtk_box_pack_start(GTK_BOX(nbpage), opt.protportFrame, FALSE, FALSE, 0); - gtk_table_attach_defaults(GTK_TABLE(nbpage), opt.protportFrame, 2, 3, 0, 3); + /* Scanned ports frame */ + { + gint i; + opt.protportFrame = gtk_frame_new("Scanned Ports"); + gtk_table_attach_defaults(GTK_TABLE(nbpage), opt.protportFrame, 2, 3, 0, 3); - table = gtk_table_new(2, 2, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_table_set_row_spacings(GTK_TABLE(table), 5); - gtk_container_add(GTK_CONTAINER(opt.protportFrame), table); + table = gtk_table_new(2, 2, FALSE); + gtk_container_set_border_width(GTK_CONTAINER(table), 5); + gtk_table_set_col_spacings(GTK_TABLE(table), 5); + gtk_table_set_row_spacings(GTK_TABLE(table), 5); + gtk_container_add(GTK_CONTAINER(opt.protportFrame), table); - opt.protportType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "", - protportEntries, &opt.protportValue); - gtk_option_menu_set_history(GTK_OPTION_MENU(opt.protportType), - opt.protportValue - PROTPORT_OFFSET); - /* gtk_object_set(GTK_OBJECT(opt.protportType), "height", 26, NULL);*/ - gtk_table_attach_defaults(GTK_TABLE(table), opt.protportType, 0, 2, 0, 1); - gtk_widget_show(opt.protportType); + opt.protportType = gtk_combo_box_new_text(); + + for(i = 0; protportEntries[i]; i++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(opt.protportType), protportEntries[i]); + } - opt.protportLabel = gtk_label_new("Range:"); - gtk_label_set_justify(GTK_LABEL(opt.protportLabel), GTK_JUSTIFY_LEFT); - if (opt.protportValue != GIVEN_PROTPORT) - gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), FALSE); - gtk_table_attach_defaults(GTK_TABLE(table), opt.protportLabel, 0, 1, 1, 2); - gtk_widget_show(opt.protportLabel); + g_signal_connect(G_OBJECT(opt.protportType), "changed", + G_CALLBACK (protportType_cb), NULL); + + gtk_table_attach_defaults(GTK_TABLE(table), opt.protportType, 0, 2, 0, 1); - opt.protportRange = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(opt.protportRange), 256); - /*gtk_object_set(GTK_OBJECT(opt.protportRange), "width", 100, NULL);*/ - gtk_signal_connect(GTK_OBJECT(opt.protportRange), "changed", - GTK_SIGNAL_FUNC(display_nmap_command_cb), NULL); - if (opt.protportValue != GIVEN_PROTPORT) - gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), FALSE); - gtk_table_attach_defaults(GTK_TABLE(table), opt.protportRange, 1, 2, 1, 2); - gtk_widget_show(opt.protportRange); + opt.protportLabel = gtk_label_new("Range:"); + gtk_label_set_justify(GTK_LABEL(opt.protportLabel), GTK_JUSTIFY_LEFT); + if (opt.protportValue != GIVEN_PROTPORT) + gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), FALSE); + gtk_table_attach_defaults(GTK_TABLE(table), opt.protportLabel, 0, 1, 1, 2); + gtk_widget_show(opt.protportLabel); + + opt.protportRange = gtk_entry_new(); + gtk_entry_set_max_length(GTK_ENTRY(opt.protportRange), 256); + /*gtk_object_set(GTK_OBJECT(opt.protportRange), "width", 100, NULL);*/ + gtk_signal_connect(GTK_OBJECT(opt.protportRange), "changed", + GTK_SIGNAL_FUNC(display_nmap_command_cb), NULL); + if (opt.protportValue != GIVEN_PROTPORT) + gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), FALSE); + gtk_table_attach_defaults(GTK_TABLE(table), opt.protportRange, 1, 2, 1, 2); - gtk_widget_show(table); - gtk_widget_show(opt.protportFrame); + gtk_widget_show_all(opt.protportFrame); + } frame = gtk_frame_new("Scan Extensions"); @@ -832,22 +831,30 @@ GtkAdjustment *adjust; gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5); - frame = gtk_frame_new("Throttling & Timeouts"); - gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0); + /* Throttling & Timeouts combobox */ + { + gint i; + + frame = gtk_frame_new("Throttling & Timeouts"); + gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0); - table = gtk_table_new(5, 6, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_table_set_col_spacing(GTK_TABLE(table), 1, 15); - gtk_container_add(GTK_CONTAINER(frame), table); + table = gtk_table_new(5, 6, FALSE); + gtk_container_set_border_width(GTK_CONTAINER(table), 5); + gtk_table_set_col_spacing(GTK_TABLE(table), 1, 15); + gtk_container_add(GTK_CONTAINER(frame), table); + opt.throttleType = gtk_combo_box_new_text (); - opt.throttleType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "", - throttleEntries, &opt.throttleValue); - gtk_option_menu_set_history(GTK_OPTION_MENU(opt.throttleType), - opt.throttleValue - THROTTLE_OFFSET); - /*gtk_object_set(GTK_OBJECT(opt.throttleType), "height", 24, NULL);*/ - gtk_table_attach_defaults(GTK_TABLE(table), opt.throttleType, 0, 2, 0, 1); - gtk_widget_show(opt.throttleType); + for (i = 0; throttleEntries[i]; i++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(opt.throttleType), throttleEntries[i]); + } + + g_signal_connect(G_OBJECT(opt.throttleType), "changed", + G_CALLBACK (throttleType_cb), NULL); + + gtk_table_attach_defaults(GTK_TABLE(table), opt.throttleType, 0, 2, 0, 1); + gtk_widget_show(opt.throttleType); + } opt.ipv4Ttl = gtk_check_button_new_with_label("IPv4 TTL"); @@ -1164,43 +1171,53 @@ GtkAdjustment *adjust; gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5); gtk_table_set_col_spacings(GTK_TABLE(nbpage), 5); + /* Reverse DNS Resolution frame */ + { + gint i; - frame = gtk_frame_new("Reverse DNS Resolution"); - gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 0, 1); + frame = gtk_frame_new("Reverse DNS Resolution"); + gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 0, 1); - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_add(GTK_CONTAINER(frame), vbox); - opt.resolveType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "", - resolveEntries, &opt.resolveValue); - gtk_option_menu_set_history(GTK_OPTION_MENU(opt.resolveType), - opt.resolveValue - RESOLVE_OFFSET); - /*gtk_object_set(GTK_OBJECT(opt.resolveType), "height", 24, NULL);*/ - gtk_box_pack_start(GTK_BOX(vbox), opt.resolveType, TRUE, FALSE, 0); - gtk_widget_show(opt.resolveType); + opt.resolveType = gtk_combo_box_new_text(); - gtk_widget_show(vbox); - gtk_widget_show(frame); + for (i = 0; resolveEntries[i]; i++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(opt.resolveType), resolveEntries[i]); + } + g_signal_connect(G_OBJECT(opt.resolveType), "changed", + G_CALLBACK (resolveType_cb), NULL); - frame = gtk_frame_new("Verbosity"); - gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2); + gtk_box_pack_start(GTK_BOX(vbox), opt.resolveType, TRUE, FALSE, 0); + gtk_widget_show_all(frame); + } - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); + /* Verbosity frame */ + { + gint i; - opt.verboseType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "", - verboseEntries, &opt.verboseValue); - gtk_option_menu_set_history(GTK_OPTION_MENU(opt.verboseType), - opt.verboseValue - VERBOSE_OFFSET); - /* gtk_object_set(GTK_OBJECT(opt.verboseType), "height", 24, NULL);*/ - gtk_box_pack_start(GTK_BOX(vbox), opt.verboseType, TRUE, FALSE, 0); - gtk_widget_show(opt.verboseType); + frame = gtk_frame_new("Verbosity"); + gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2); - gtk_widget_show(vbox); - gtk_widget_show(frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_add(GTK_CONTAINER(frame), vbox); + + opt.verboseType = gtk_combo_box_new_text(); + + for (i = 0; verboseEntries[i]; i++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(opt.verboseType), verboseEntries[i]); + } + + g_signal_connect(G_OBJECT(opt.verboseType), "changed", + G_CALLBACK (verboseType_cb), NULL); + + gtk_box_pack_start(GTK_BOX(vbox), opt.verboseType, TRUE, FALSE, 0); + gtk_widget_show_all (frame); + } frame = gtk_frame_new("Source"); @@ -1411,7 +1428,13 @@ GtkAdjustment *adjust; /* Set default values here because now we can be sure that all the * widgets have been created. */ + /* First Notebook - Scan */ gtk_combo_box_set_active(GTK_COMBO_BOX (opt.scanType), 0); + /* Third Notebook - Timing */ + gtk_combo_box_set_active(GTK_COMBO_BOX (opt.throttleType), opt.throttleValue); + /* Fifth Notebook - Options */ + gtk_combo_box_set_active(GTK_COMBO_BOX (opt.resolveType), opt.resolveValue); + gtk_combo_box_set_active(GTK_COMBO_BOX (opt.verboseType), opt.verboseValue); display_nmap_command(); diff --git a/nmapfe/nmapfe.h b/nmapfe/nmapfe.h index 42b0d4327..c7c51bca5 100644 --- a/nmapfe/nmapfe.h +++ b/nmapfe/nmapfe.h @@ -170,57 +170,42 @@ enum { }; -/* define this > 0 to be able to use the comfortable callback */ -#define THROTTLE_OFFSET 1 - -/* throttle types: used as actions in a factory-generated menu */ +/* Throttle types */ enum { - NO_THROTTLE, - PARANOID_THROTTLE = THROTTLE_OFFSET, + PARANOID_THROTTLE, SNEAKY_THROTTLE, POLITE_THROTTLE, NORMAL_THROTTLE, AGRESSIVE_THROTTLE, - INSANE_THROTTLE + INSANE_THROTTLE, + NO_THROTTLE }; - -/* define this > 0 to be able to use the comfortable callback */ -#define RESOLVE_OFFSET 1 - -/* reverse resolving options */ +/* Reverse resolving options */ enum { - NO_RESOLVE, - ALWAYS_RESOLVE = RESOLVE_OFFSET, + ALWAYS_RESOLVE, DEFAULT_RESOLVE, - NEVER_RESOLVE + NEVER_RESOLVE, + NO_RESOLVE }; - -/* define this > 0 to be able to use the comfortable callback */ -#define PROTPORT_OFFSET 1 - /* scanning mode (which ports/protocols) options */ enum { - NO_PROTPORT, - DEFAULT_PROTPORT = PROTPORT_OFFSET, + DEFAULT_PROTPORT, ALL_PROTPORT, FAST_PROTPORT, - GIVEN_PROTPORT + GIVEN_PROTPORT, + NO_PROTPORT }; - -/* define this > 0 to be able to use the comfortable callback */ -#define VERBOSE_OFFSET 1 - /* verbosity options */ enum { - NO_VERBOSE, - QUIET_VERBOSE = VERBOSE_OFFSET, + QUIET_VERBOSE, V1_VERBOSE, V2_VERBOSE, D1_VERBOSE, - D2_VERBOSE + D2_VERBOSE, + NO_VERBOSE }; diff --git a/nmapfe/nmapfe_sig.c b/nmapfe/nmapfe_sig.c index 02c01a6cb..d2870d466 100644 --- a/nmapfe/nmapfe_sig.c +++ b/nmapfe/nmapfe_sig.c @@ -522,7 +522,7 @@ static int command_size = 0; if ((opt.throttleValue != NO_THROTTLE) && (opt.throttleValue != NORMAL_THROTTLE)) - sprintf(command+strlen(command), "-T%u ", opt.throttleValue-THROTTLE_OFFSET); + sprintf(command+strlen(command), "-T%u ", opt.throttleValue); if (GTK_TOGGLE_BUTTON(opt.startRtt)->active) { int val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(opt.startRttTime)); @@ -834,53 +834,41 @@ gboolean status = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ping_button)); } -/* callback for factory generated menu items: set variable to action */ -void throttleType_changed_fcb(int *variable, guint action, GtkWidget *w) +void throttleType_cb (GtkComboBox *w, gpointer data) { - if ((variable != NULL) && (w != NULL)) { - *variable = action; - + opt.throttleValue = gtk_combo_box_get_active(w); display_nmap_command(); - } } -/* callback for factory generated menu items: set variable to action */ -void resolveType_changed_fcb(int *variable, guint action, GtkWidget *w) +void resolveType_cb (GtkComboBox *w, gpointer data) { - if ((variable != NULL) && (w != NULL)) { - *variable = action; - + opt.resolveValue = gtk_combo_box_get_active(w); display_nmap_command(); - } } -/* callback for factory generated menu items: set variable to action */ -void protportType_changed_fcb(int *variable, guint action, GtkWidget *w) +void protportType_cb(GtkComboBox *w, gpointer d) { - if ((variable != NULL) && (w != NULL)) { - *variable = action; + opt.protportValue = gtk_combo_box_get_active(w); - gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), (action == GIVEN_PROTPORT)); - gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), (action == GIVEN_PROTPORT)); - if (action == GIVEN_PROTPORT) + gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), + (opt.protportValue == GIVEN_PROTPORT)); + gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), + (opt.protportValue == GIVEN_PROTPORT)); + if (opt.protportValue == GIVEN_PROTPORT) gtk_widget_grab_focus(GTK_WIDGET(opt.protportRange)); display_nmap_command(); - } } /* callback for factory generated menu items: set variable to action */ -void verboseType_changed_fcb(int *variable, guint action, GtkWidget *w) +void verboseType_cb(GtkComboBox *w, gpointer d) { - if ((variable != NULL) && (w != NULL)) { - *variable = action; - + opt.verboseValue = gtk_combo_box_get_active(w); display_nmap_command(); } -} /* callback for factory generated menu items: set variable to action */ diff --git a/nmapfe/nmapfe_sig.h b/nmapfe/nmapfe_sig.h index 290306997..c8d8b5824 100644 --- a/nmapfe/nmapfe_sig.h +++ b/nmapfe/nmapfe_sig.h @@ -129,11 +129,10 @@ void entry_toggle_checkbox (GtkWidget *entry, GtkWidget *checkbox); void entry_toggle_ping_checkbox(GtkWidget *entry, GtkWidget *checkbox); void mainMenu_fcb(int *variable, guint action, GtkWidget *w); -void scanType_changed_fcb(int *variable, guint action, GtkWidget *w); -void throttleType_changed_fcb(int *variable, guint action, GtkWidget *w); -void resolveType_changed_fcb(int *variable, guint action, GtkWidget *w); -void protportType_changed_fcb(int *variable, guint action, GtkWidget *w); -void verboseType_changed_fcb(int *variable, guint action, GtkWidget *w); +void throttleType_cb (GtkComboBox *, gpointer); +void resolveType_cb (GtkComboBox *, gpointer); +void protportType_cb (GtkComboBox *, gpointer); +void verboseType_cb (GtkComboBox *, gpointer); void outputFormatType_changed_fcb(int *variable, guint action, GtkWidget *w); void pingButton_toggled_cb(GtkWidget *ping_button, void *ignored);