1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-18 13:39:02 +00:00

more nmapfe gtk remove-deprecated-api changes from Priit Laes

This commit is contained in:
fyodor
2006-01-20 21:47:00 +00:00
parent 0c8b43f776
commit 37e163505a
5 changed files with 163 additions and 164 deletions

View File

@@ -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 author of that paper, Ed3f (ed3f(a)antifork.org), is also the author
of this patch. 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 3.96BETA1
o Added --max_retries option for capping the maximum number of o Added --max_retries option for capping the maximum number of

View File

@@ -209,45 +209,40 @@ static Entry scanentries[] = {
}; };
static gchar *throttleEntries[] = {
static GtkItemFactoryEntry throttleEntries[] = { "Paranoid Throttling",
{ "/Paranoid Throttling", NULL, throttleType_changed_fcb, PARANOID_THROTTLE, NULL }, "Sneaky Throttling",
{ "/Sneaky Throttling", NULL, throttleType_changed_fcb, SNEAKY_THROTTLE, NULL }, "Polite Throttling",
{ "/Polite Throttling", NULL, throttleType_changed_fcb, POLITE_THROTTLE, NULL }, "Normal Throttling",
{ "/Normal Throttling", NULL, throttleType_changed_fcb, NORMAL_THROTTLE, NULL }, "Aggressive Throttling",
{ "/Agressive Throttling", NULL, throttleType_changed_fcb, AGRESSIVE_THROTTLE, NULL }, "Insane Throttling",
{ "/Insane Throttling", NULL, throttleType_changed_fcb, INSANE_THROTTLE, NULL }, NULL
{ NULL, NULL, NULL, NO_THROTTLE, NULL }
}; };
static gchar *resolveEntries[] = {
static GtkItemFactoryEntry resolveEntries[] = { "Always",
{ "/Always", NULL, resolveType_changed_fcb, ALWAYS_RESOLVE, NULL }, "When Required",
{ "/When Required", NULL, resolveType_changed_fcb, DEFAULT_RESOLVE, NULL }, "Never",
{ "/Never", NULL, resolveType_changed_fcb, NEVER_RESOLVE, NULL }, NULL
{ NULL, NULL, NULL, NO_RESOLVE, NULL }
}; };
static gchar *protportEntries[] = {
static GtkItemFactoryEntry protportEntries[] = { "Default",
{ "/Default", NULL, protportType_changed_fcb, DEFAULT_PROTPORT, NULL }, "All",
{ "/All", NULL, protportType_changed_fcb, ALL_PROTPORT, NULL }, "Most Important [fast]",
{ "/Most Important [fast]", NULL, protportType_changed_fcb, FAST_PROTPORT, NULL }, "Range Given Below",
{ "/Range Given Below", NULL, protportType_changed_fcb, GIVEN_PROTPORT, NULL }, NULL
{ NULL, NULL, NULL, NO_PROTPORT, NULL }
}; };
static gchar *verboseEntries[] = {
static GtkItemFactoryEntry verboseEntries[] = { "Quiet",
{ "/Quiet", NULL, verboseType_changed_fcb, QUIET_VERBOSE, NULL }, "Verbose",
{ "/Verbose", NULL, verboseType_changed_fcb, V1_VERBOSE, NULL }, "Very Verbose",
{ "/Very Verbose", NULL, verboseType_changed_fcb, V2_VERBOSE, NULL }, "Debug",
{ "/Debug", NULL, verboseType_changed_fcb, D1_VERBOSE, NULL }, "Verbose Debug",
{ "/Verbose Debug", NULL, verboseType_changed_fcb, D2_VERBOSE, NULL }, NULL
{ NULL, NULL, NULL, NO_VERBOSE, NULL }
}; };
static GtkItemFactoryEntry outputFormatEntries[] = { static GtkItemFactoryEntry outputFormatEntries[] = {
{ "/Normal", NULL, outputFormatType_changed_fcb, NORMAL_OUTPUT, NULL }, { "/Normal", NULL, outputFormatType_changed_fcb, NORMAL_OUTPUT, NULL },
{ "/grep-able", NULL, outputFormatType_changed_fcb, GREP_OUTPUT, NULL }, { "/grep-able", NULL, outputFormatType_changed_fcb, GREP_OUTPUT, NULL },
@@ -613,43 +608,47 @@ GtkAdjustment *adjust;
gtk_widget_show(frame); gtk_widget_show(frame);
opt.protportFrame = gtk_frame_new("Scanned Ports"); /* Scanned ports frame */
// 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); 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); table = gtk_table_new(2, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 5); gtk_container_set_border_width(GTK_CONTAINER(table), 5);
gtk_table_set_col_spacings(GTK_TABLE(table), 5); gtk_table_set_col_spacings(GTK_TABLE(table), 5);
gtk_table_set_row_spacings(GTK_TABLE(table), 5); gtk_table_set_row_spacings(GTK_TABLE(table), 5);
gtk_container_add(GTK_CONTAINER(opt.protportFrame), table); gtk_container_add(GTK_CONTAINER(opt.protportFrame), table);
opt.protportType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "<protportMenu>", opt.protportType = gtk_combo_box_new_text();
protportEntries, &opt.protportValue);
gtk_option_menu_set_history(GTK_OPTION_MENU(opt.protportType), for(i = 0; protportEntries[i]; i++) {
opt.protportValue - PROTPORT_OFFSET); gtk_combo_box_append_text(GTK_COMBO_BOX(opt.protportType), protportEntries[i]);
/* 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.protportLabel = gtk_label_new("Range:"); g_signal_connect(G_OBJECT(opt.protportType), "changed",
gtk_label_set_justify(GTK_LABEL(opt.protportLabel), GTK_JUSTIFY_LEFT); G_CALLBACK (protportType_cb), NULL);
if (opt.protportValue != GIVEN_PROTPORT)
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), FALSE); gtk_table_attach_defaults(GTK_TABLE(table), opt.protportType, 0, 2, 0, 1);
gtk_table_attach_defaults(GTK_TABLE(table), opt.protportLabel, 0, 1, 1, 2);
gtk_widget_show(opt.protportLabel);
opt.protportRange = gtk_entry_new(); opt.protportLabel = gtk_label_new("Range:");
gtk_entry_set_max_length(GTK_ENTRY(opt.protportRange), 256); gtk_label_set_justify(GTK_LABEL(opt.protportLabel), GTK_JUSTIFY_LEFT);
/*gtk_object_set(GTK_OBJECT(opt.protportRange), "width", 100, NULL);*/ if (opt.protportValue != GIVEN_PROTPORT)
gtk_signal_connect(GTK_OBJECT(opt.protportRange), "changed", gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), FALSE);
GTK_SIGNAL_FUNC(display_nmap_command_cb), NULL); gtk_table_attach_defaults(GTK_TABLE(table), opt.protportLabel, 0, 1, 1, 2);
if (opt.protportValue != GIVEN_PROTPORT) gtk_widget_show(opt.protportLabel);
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), FALSE);
gtk_table_attach_defaults(GTK_TABLE(table), opt.protportRange, 1, 2, 1, 2); opt.protportRange = gtk_entry_new();
gtk_widget_show(opt.protportRange); 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_all(opt.protportFrame);
gtk_widget_show(opt.protportFrame); }
frame = gtk_frame_new("Scan Extensions"); frame = gtk_frame_new("Scan Extensions");
@@ -832,22 +831,30 @@ GtkAdjustment *adjust;
gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5); gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5);
frame = gtk_frame_new("Throttling & Timeouts"); /* Throttling & Timeouts combobox */
gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0); {
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); table = gtk_table_new(5, 6, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 5); gtk_container_set_border_width(GTK_CONTAINER(table), 5);
gtk_table_set_col_spacing(GTK_TABLE(table), 1, 15); gtk_table_set_col_spacing(GTK_TABLE(table), 1, 15);
gtk_container_add(GTK_CONTAINER(frame), table); gtk_container_add(GTK_CONTAINER(frame), table);
opt.throttleType = gtk_combo_box_new_text ();
opt.throttleType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "<throttleMenu>", for (i = 0; throttleEntries[i]; i++) {
throttleEntries, &opt.throttleValue); gtk_combo_box_append_text(GTK_COMBO_BOX(opt.throttleType), throttleEntries[i]);
gtk_option_menu_set_history(GTK_OPTION_MENU(opt.throttleType), }
opt.throttleValue - THROTTLE_OFFSET);
/*gtk_object_set(GTK_OBJECT(opt.throttleType), "height", 24, NULL);*/ g_signal_connect(G_OBJECT(opt.throttleType), "changed",
gtk_table_attach_defaults(GTK_TABLE(table), opt.throttleType, 0, 2, 0, 1); G_CALLBACK (throttleType_cb), NULL);
gtk_widget_show(opt.throttleType);
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"); 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_container_set_border_width(GTK_CONTAINER(nbpage), 5);
gtk_table_set_col_spacings(GTK_TABLE(nbpage), 5); gtk_table_set_col_spacings(GTK_TABLE(nbpage), 5);
/* Reverse DNS Resolution frame */
{
gint i;
frame = gtk_frame_new("Reverse DNS Resolution"); frame = gtk_frame_new("Reverse DNS Resolution");
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 0, 1);
vbox = gtk_vbox_new(FALSE, 5); vbox = gtk_vbox_new(FALSE, 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_container_add(GTK_CONTAINER(frame), vbox);
opt.resolveType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "<resolveMenu>", opt.resolveType = gtk_combo_box_new_text();
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);
gtk_widget_show(vbox); for (i = 0; resolveEntries[i]; i++) {
gtk_widget_show(frame); 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_box_pack_start(GTK_BOX(vbox), opt.resolveType, TRUE, FALSE, 0);
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2); gtk_widget_show_all(frame);
}
vbox = gtk_vbox_new(FALSE, 5); /* Verbosity frame */
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); {
gtk_container_add(GTK_CONTAINER(frame), vbox); gint i;
opt.verboseType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "<verboseMenu>", frame = gtk_frame_new("Verbosity");
verboseEntries, &opt.verboseValue); gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2);
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);
gtk_widget_show(vbox); vbox = gtk_vbox_new(FALSE, 5);
gtk_widget_show(frame); 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"); frame = gtk_frame_new("Source");
@@ -1411,7 +1428,13 @@ GtkAdjustment *adjust;
/* Set default values here because now we can be sure that all the /* Set default values here because now we can be sure that all the
* widgets have been created. * widgets have been created.
*/ */
/* First Notebook - Scan */
gtk_combo_box_set_active(GTK_COMBO_BOX (opt.scanType), 0); 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(); display_nmap_command();

View File

@@ -170,57 +170,42 @@ enum {
}; };
/* define this > 0 to be able to use the comfortable callback */ /* Throttle types */
#define THROTTLE_OFFSET 1
/* throttle types: used as actions in a factory-generated menu */
enum { enum {
NO_THROTTLE, PARANOID_THROTTLE,
PARANOID_THROTTLE = THROTTLE_OFFSET,
SNEAKY_THROTTLE, SNEAKY_THROTTLE,
POLITE_THROTTLE, POLITE_THROTTLE,
NORMAL_THROTTLE, NORMAL_THROTTLE,
AGRESSIVE_THROTTLE, AGRESSIVE_THROTTLE,
INSANE_THROTTLE INSANE_THROTTLE,
NO_THROTTLE
}; };
/* Reverse resolving options */
/* define this > 0 to be able to use the comfortable callback */
#define RESOLVE_OFFSET 1
/* reverse resolving options */
enum { enum {
NO_RESOLVE, ALWAYS_RESOLVE,
ALWAYS_RESOLVE = RESOLVE_OFFSET,
DEFAULT_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 */ /* scanning mode (which ports/protocols) options */
enum { enum {
NO_PROTPORT, DEFAULT_PROTPORT,
DEFAULT_PROTPORT = PROTPORT_OFFSET,
ALL_PROTPORT, ALL_PROTPORT,
FAST_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 */ /* verbosity options */
enum { enum {
NO_VERBOSE, QUIET_VERBOSE,
QUIET_VERBOSE = VERBOSE_OFFSET,
V1_VERBOSE, V1_VERBOSE,
V2_VERBOSE, V2_VERBOSE,
D1_VERBOSE, D1_VERBOSE,
D2_VERBOSE D2_VERBOSE,
NO_VERBOSE
}; };

View File

@@ -522,7 +522,7 @@ static int command_size = 0;
if ((opt.throttleValue != NO_THROTTLE) && (opt.throttleValue != NORMAL_THROTTLE)) 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) { if (GTK_TOGGLE_BUTTON(opt.startRtt)->active) {
int val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(opt.startRttTime)); 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_cb (GtkComboBox *w, gpointer data)
void throttleType_changed_fcb(int *variable, guint action, GtkWidget *w)
{ {
if ((variable != NULL) && (w != NULL)) { opt.throttleValue = gtk_combo_box_get_active(w);
*variable = action;
display_nmap_command(); display_nmap_command();
}
} }
/* callback for factory generated menu items: set variable to action */ void resolveType_cb (GtkComboBox *w, gpointer data)
void resolveType_changed_fcb(int *variable, guint action, GtkWidget *w)
{ {
if ((variable != NULL) && (w != NULL)) { opt.resolveValue = gtk_combo_box_get_active(w);
*variable = action;
display_nmap_command(); display_nmap_command();
}
} }
/* callback for factory generated menu items: set variable to action */ void protportType_cb(GtkComboBox *w, gpointer d)
void protportType_changed_fcb(int *variable, guint action, GtkWidget *w)
{ {
if ((variable != NULL) && (w != NULL)) { opt.protportValue = gtk_combo_box_get_active(w);
*variable = action;
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), (action == GIVEN_PROTPORT)); gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel),
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), (action == GIVEN_PROTPORT)); (opt.protportValue == GIVEN_PROTPORT));
if (action == 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)); gtk_widget_grab_focus(GTK_WIDGET(opt.protportRange));
display_nmap_command(); display_nmap_command();
}
} }
/* callback for factory generated menu items: set variable to action */ /* 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)) { opt.verboseValue = gtk_combo_box_get_active(w);
*variable = action;
display_nmap_command(); display_nmap_command();
} }
}
/* callback for factory generated menu items: set variable to action */ /* callback for factory generated menu items: set variable to action */

View File

@@ -129,11 +129,10 @@ void entry_toggle_checkbox (GtkWidget *entry, GtkWidget *checkbox);
void entry_toggle_ping_checkbox(GtkWidget *entry, GtkWidget *checkbox); void entry_toggle_ping_checkbox(GtkWidget *entry, GtkWidget *checkbox);
void mainMenu_fcb(int *variable, guint action, GtkWidget *w); void mainMenu_fcb(int *variable, guint action, GtkWidget *w);
void scanType_changed_fcb(int *variable, guint action, GtkWidget *w); void throttleType_cb (GtkComboBox *, gpointer);
void throttleType_changed_fcb(int *variable, guint action, GtkWidget *w); void resolveType_cb (GtkComboBox *, gpointer);
void resolveType_changed_fcb(int *variable, guint action, GtkWidget *w); void protportType_cb (GtkComboBox *, gpointer);
void protportType_changed_fcb(int *variable, guint action, GtkWidget *w); void verboseType_cb (GtkComboBox *, gpointer);
void verboseType_changed_fcb(int *variable, guint action, GtkWidget *w);
void outputFormatType_changed_fcb(int *variable, guint action, GtkWidget *w); void outputFormatType_changed_fcb(int *variable, guint action, GtkWidget *w);
void pingButton_toggled_cb(GtkWidget *ping_button, void *ignored); void pingButton_toggled_cb(GtkWidget *ping_button, void *ignored);