1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 10:59:02 +00:00

update verbosity/debugging - patch by Kris Katterjohn

This commit is contained in:
fyodor
2006-09-26 07:49:08 +00:00
parent c0d910d08b
commit 1515343a7d
4 changed files with 63 additions and 59 deletions

View File

@@ -234,15 +234,6 @@ static gchar *protportEntries[] = {
NULL
};
static gchar *verboseEntries[] = {
"Quiet",
"Verbose",
"Very Verbose",
"Debug",
"Verbose Debug",
NULL
};
static gchar *outputFormatEntries[] = {
"Normal",
"grep-able",
@@ -432,7 +423,6 @@ GtkAdjustment *adjust;
opt.throttleValue = NORMAL_THROTTLE;
opt.resolveValue = DEFAULT_RESOLVE;
opt.protportValue = DEFAULT_PROTPORT;
opt.verboseValue = QUIET_VERBOSE;
opt.outputFormatValue = NORMAL_OUTPUT;
#ifdef WIN32
@@ -1212,29 +1202,48 @@ GtkAdjustment *adjust;
gtk_widget_show_all(frame);
}
/* Verbosity frame */
{
gint i;
/* Verbosity & Debugging frame */
frame = gtk_frame_new("Verbosity & Debugging Levels");
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2);
frame = gtk_frame_new("Verbosity");
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 1, 1, 2);
table = gtk_table_new(2, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 5);
gtk_container_add(GTK_CONTAINER(frame), table);
vbox = gtk_vbox_new(FALSE, 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(frame), vbox);
opt.verbose = gtk_check_button_new_with_label("Verbosity");
gtk_table_attach_defaults(GTK_TABLE(table), opt.verbose, 0, 1, 0, 1);
gtk_widget_show(opt.verbose);
opt.verboseType = gtk_combo_box_new_text();
adjust = (GtkAdjustment *) gtk_adjustment_new(1.0, 1.0, 2.0, 1.0, 10.0, 10.0);
opt.verboseValue = gtk_spin_button_new(adjust, 1.0, 0);
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(opt.verboseValue), TRUE);
g_signal_connect(GTK_OBJECT(opt.verbose), "released",
GTK_SIGNAL_FUNC(toggle_button_set_sensitive_cb), opt.verboseValue);
g_signal_connect(GTK_OBJECT(opt.verboseValue), "changed",
GTK_SIGNAL_FUNC(display_nmap_command_cb), NULL);
if (!GTK_TOGGLE_BUTTON(opt.verbose)->active)
gtk_widget_set_sensitive(GTK_WIDGET(opt.verboseValue), FALSE);
gtk_table_attach_defaults(GTK_TABLE(table), opt.verboseValue, 1, 2, 0, 1);
gtk_widget_show(opt.verboseValue);
for (i = 0; verboseEntries[i]; i++) {
gtk_combo_box_append_text(GTK_COMBO_BOX(opt.verboseType), verboseEntries[i]);
}
opt.debug = gtk_check_button_new_with_label("Debugging");
gtk_table_attach_defaults(GTK_TABLE(table), opt.debug, 0, 1, 1, 2);
gtk_widget_show(opt.debug);
g_signal_connect(G_OBJECT(opt.verboseType), "changed",
G_CALLBACK (verboseType_cb), NULL);
adjust = (GtkAdjustment *) gtk_adjustment_new(1.0, 1.0, 9.0, 1.0, 10.0, 10.0);
opt.debugValue = gtk_spin_button_new(adjust, 1.0, 0);
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(opt.debugValue), TRUE);
g_signal_connect(GTK_OBJECT(opt.debug), "released",
GTK_SIGNAL_FUNC(toggle_button_set_sensitive_cb), opt.debugValue);
g_signal_connect(GTK_OBJECT(opt.debugValue), "changed",
GTK_SIGNAL_FUNC(display_nmap_command_cb), NULL);
if (!GTK_TOGGLE_BUTTON(opt.debug)->active)
gtk_widget_set_sensitive(GTK_WIDGET(opt.debugValue), FALSE);
gtk_table_attach_defaults(GTK_TABLE(table), opt.debugValue, 1, 2, 1, 2);
gtk_widget_show(opt.debugValue);
gtk_box_pack_start(GTK_BOX(vbox), opt.verboseType, TRUE, FALSE, 0);
gtk_widget_show_all (frame);
}
gtk_widget_show(table);
gtk_widget_show(frame);
frame = gtk_frame_new("Source");
@@ -1460,7 +1469,6 @@ GtkAdjustment *adjust;
gtk_combo_box_set_active(GTK_COMBO_BOX (opt.outputFormatType), opt.outputFormatValue);
/* 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();

View File

@@ -198,16 +198,6 @@ enum {
NO_PROTPORT
};
/* verbosity options */
enum {
QUIET_VERBOSE,
V1_VERBOSE,
V2_VERBOSE,
D1_VERBOSE,
D2_VERBOSE,
NO_VERBOSE
};
/* output format options */
enum {
NORMAL_OUTPUT,
@@ -291,9 +281,11 @@ struct NmapFEoptions {
/* DNS options */
GtkWidget *resolveType;
guint resolveValue;
/* verbosity options */
GtkWidget *verboseType;
guint verboseValue;
/* verbosity/debugging options */
GtkWidget *verbose;
GtkWidget *verboseValue;
GtkWidget *debug;
GtkWidget *debugValue;
/* source options */
GtkWidget *useSourceDevice;
GtkWidget *SourceDevice;

View File

@@ -417,6 +417,28 @@ static int command_size = 0;
else if (opt.resolveValue == NEVER_RESOLVE)
strcat(command, "-n ");
if (GTK_TOGGLE_BUTTON(opt.verbose)->active) {
int val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(opt.verboseValue));
if (val == 1)
strcat(command, "-v ");
else if (val == 2)
strcat(command, "-vv ");
}
if (GTK_TOGGLE_BUTTON(opt.debug)->active) {
int val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(opt.debugValue));
if (val > 0) {
strcat(command, "-d");
if (val > 1)
sprintf(command+strlen(command), "%d", val);
strcat(command, " ");
}
}
if (GTK_WIDGET_SENSITIVE(opt.useDecoy) &&
GTK_TOGGLE_BUTTON(opt.useDecoy)->active) {
const char *val = gtk_entry_get_text(GTK_ENTRY(opt.Decoy));
@@ -511,15 +533,6 @@ static int command_size = 0;
}
}
if (opt.verboseValue == V1_VERBOSE)
strcat(command, "-v ");
else if (opt.verboseValue == V2_VERBOSE)
strcat(command, "-vv ");
else if (opt.verboseValue == D1_VERBOSE)
strcat(command, "-d ");
else if (opt.verboseValue == D2_VERBOSE)
strcat(command, "-d2 ");
strcat(command, gtk_entry_get_text(GTK_ENTRY(opt.targetHost)));
return(command);
@@ -1134,14 +1147,6 @@ void protportType_cb(GtkComboBox *w, gpointer d)
}
/* callback for factory generated menu items: set variable to action */
void verboseType_cb(GtkComboBox *w, gpointer d)
{
opt.verboseValue = gtk_combo_box_get_active(w);
display_nmap_command();
}
/* callback for factory generated menu items: set variable to action */
void outputFormatType_cb(GtkComboBox *w, gpointer d)
{

View File

@@ -126,7 +126,6 @@ gboolean stop_scan();
void throttleType_cb (GtkComboBox *, gpointer);
void resolveType_cb (GtkComboBox *, gpointer);
void protportType_cb (GtkComboBox *, gpointer);
void verboseType_cb (GtkComboBox *, gpointer);
void outputFormatType_cb (GtkComboBox *, gpointer);
void pingButton_toggled_cb(GtkWidget *ping_button, void *ignored);