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:
@@ -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
|
||||
|
||||
151
nmapfe/nmapfe.c
151
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,8 +608,10 @@ GtkAdjustment *adjust;
|
||||
gtk_widget_show(frame);
|
||||
|
||||
|
||||
/* Scanned ports frame */
|
||||
{
|
||||
gint i;
|
||||
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);
|
||||
|
||||
table = gtk_table_new(2, 2, FALSE);
|
||||
@@ -623,13 +620,16 @@ GtkAdjustment *adjust;
|
||||
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, "<protportMenu>",
|
||||
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);*/
|
||||
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]);
|
||||
}
|
||||
|
||||
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);
|
||||
gtk_widget_show(opt.protportType);
|
||||
|
||||
opt.protportLabel = gtk_label_new("Range:");
|
||||
gtk_label_set_justify(GTK_LABEL(opt.protportLabel), GTK_JUSTIFY_LEFT);
|
||||
@@ -646,10 +646,9 @@ GtkAdjustment *adjust;
|
||||
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);
|
||||
|
||||
gtk_widget_show(table);
|
||||
gtk_widget_show(opt.protportFrame);
|
||||
gtk_widget_show_all(opt.protportFrame);
|
||||
}
|
||||
|
||||
|
||||
frame = gtk_frame_new("Scan Extensions");
|
||||
@@ -832,6 +831,10 @@ GtkAdjustment *adjust;
|
||||
gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5);
|
||||
|
||||
|
||||
/* Throttling & Timeouts combobox */
|
||||
{
|
||||
gint i;
|
||||
|
||||
frame = gtk_frame_new("Throttling & Timeouts");
|
||||
gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0);
|
||||
|
||||
@@ -840,14 +843,18 @@ GtkAdjustment *adjust;
|
||||
gtk_table_set_col_spacing(GTK_TABLE(table), 1, 15);
|
||||
gtk_container_add(GTK_CONTAINER(frame), table);
|
||||
|
||||
opt.throttleType = gtk_combo_box_new_text ();
|
||||
|
||||
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);
|
||||
|
||||
opt.throttleType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "<throttleMenu>",
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
opt.ipv4Ttl = gtk_check_button_new_with_label("IPv4 TTL");
|
||||
@@ -1164,6 +1171,9 @@ 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);
|
||||
@@ -1172,17 +1182,22 @@ GtkAdjustment *adjust;
|
||||
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, "<resolveMenu>",
|
||||
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);*/
|
||||
opt.resolveType = gtk_combo_box_new_text();
|
||||
|
||||
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);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), opt.resolveType, TRUE, FALSE, 0);
|
||||
gtk_widget_show(opt.resolveType);
|
||||
|
||||
gtk_widget_show(vbox);
|
||||
gtk_widget_show(frame);
|
||||
gtk_widget_show_all(frame);
|
||||
}
|
||||
|
||||
/* Verbosity frame */
|
||||
{
|
||||
gint i;
|
||||
|
||||
frame = gtk_frame_new("Verbosity");
|
||||
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2);
|
||||
@@ -1191,16 +1206,18 @@ GtkAdjustment *adjust;
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox);
|
||||
|
||||
opt.verboseType = new_factory_menu(NULL, GTK_TYPE_OPTION_MENU, "<verboseMenu>",
|
||||
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);
|
||||
opt.verboseType = gtk_combo_box_new_text();
|
||||
|
||||
gtk_widget_show(vbox);
|
||||
gtk_widget_show(frame);
|
||||
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();
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user