@ -0,0 +1,36 @@
|
||||
2.1
|
||||
===
|
||||
|
||||
* If root-only options are selected by a 'normal' user,
|
||||
the 'kdesu' facility is envoked to run nmap as root
|
||||
|
||||
* Previously all nmap output was "wrapped", this is now
|
||||
an option. The default is to wrap long lines.
|
||||
|
||||
2.0
|
||||
===
|
||||
|
||||
* Minor syntax corrections
|
||||
* No major changes since 2.0-beta-1
|
||||
|
||||
2.0-beta-1
|
||||
==========
|
||||
|
||||
* Added support for multiple concurrent scans
|
||||
|
||||
1.0
|
||||
===
|
||||
|
||||
* Added support for the "-6" and "-A' nmap options
|
||||
|
||||
* Changes to the docbook documentation for the "-6"
|
||||
and "-A" option support and other small changes.
|
||||
|
||||
1.0-beta-1
|
||||
==========
|
||||
|
||||
* This is a completely new program!
|
||||
|
||||
There was a prior Knmap - the last version was 0.9
|
||||
but that version does not compile under the current
|
||||
Qt / KDE environments.
|
@ -0,0 +1,178 @@
|
||||
For the impatient
|
||||
=================
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
Dont blame me if your impatience f**ks up your machine. But
|
||||
please email me with your tale of woe. I always enjoy a good belly
|
||||
laugh! ;)
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes a while. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
4. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
@ -0,0 +1,22 @@
|
||||
SUBDIRS = $(TOPSUBDIRS)
|
||||
|
||||
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
|
||||
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
|
||||
|
||||
$(top_srcdir)/subdirs:
|
||||
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
|
||||
|
||||
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
|
||||
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4
|
||||
|
||||
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
|
||||
|
||||
package-messages:
|
||||
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
|
||||
$(MAKE) -C po merge
|
||||
|
||||
EXTRA_DIST = admin COPYING configure.in.in
|
||||
|
||||
dist-hook:
|
||||
cd $(top_distdir) && perl admin/am_edit -padmin
|
||||
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
|
@ -0,0 +1,10 @@
|
||||
all:
|
||||
@echo "This Makefile is only for the CVS repository"
|
||||
@echo "This will be deleted before making the distribution"
|
||||
@echo ""
|
||||
$(MAKE) -f admin/Makefile.common cvs
|
||||
|
||||
dist:
|
||||
$(MAKE) -f admin/Makefile.common dist
|
||||
|
||||
.SILENT:
|
@ -0,0 +1,4 @@
|
||||
If you've got time to read this file you've got
|
||||
too much time on your hands.
|
||||
|
||||
Go get a life!
|
@ -0,0 +1,219 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have the CoreAudio API */
|
||||
#undef HAVE_COREAUDIO
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
#undef HAVE_CRT_EXTERNS_H
|
||||
|
||||
/* Defines if your system has the crypt function */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have libjpeg */
|
||||
#undef HAVE_LIBJPEG
|
||||
|
||||
/* Define if you have libpng */
|
||||
#undef HAVE_LIBPNG
|
||||
|
||||
/* Define if you have a working libpthread (will enable threaded code) */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define if you have libz */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if your system needs _NSGetEnviron to set up the environment */
|
||||
#undef HAVE_NSGETENVIRON
|
||||
|
||||
/* Define if you have the res_init function */
|
||||
#undef HAVE_RES_INIT
|
||||
|
||||
/* Define if you have a STL implementation by SGI */
|
||||
#undef HAVE_SGI_STL
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have strlcat */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcat prototype */
|
||||
#undef HAVE_STRLCAT_PROTO
|
||||
|
||||
/* Define if you have strlcpy */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strlcpy prototype */
|
||||
#undef HAVE_STRLCPY_PROTO
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Suffix for lib directories */
|
||||
#undef KDELIBSUFF
|
||||
|
||||
/* Define a safe value for MAXPATHLEN */
|
||||
#undef KDEMAXPATHLEN
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of a `char *', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR_P
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of a `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* The size of a `unsigned long', as computed by sizeof. */
|
||||
#undef SIZEOF_UNSIGNED_LONG
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/*
|
||||
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
|
||||
* headers and I'm too lazy to write a configure test as long as only
|
||||
* unixware is related
|
||||
*/
|
||||
#ifdef _UNIXWARE
|
||||
#define HAVE_BOOLEAN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
|
||||
* that defines bzero.
|
||||
*/
|
||||
|
||||
#if defined(_AIX)
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
|
||||
# include <sys/time.h>
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCAT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcat(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCPY_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcpy(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* On HP-UX, the declaration of vsnprintf() is needed every time !
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int snprintf(char *str, size_t n, char const *fmt, ...);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(__SVR4) && !defined(__svr4__)
|
||||
#define __svr4__ 1
|
||||
#endif
|
||||
|
||||
|
||||
/* Compatibility define */
|
||||
#undef ksize_t
|
||||
|
||||
/* Define the real type of socklen_t */
|
||||
#undef socklen_t
|
@ -0,0 +1,2 @@
|
||||
./admin/configure.in.min
|
||||
configure.in.in
|
@ -0,0 +1,82 @@
|
||||
dnl This file is part of the KDE libraries/packages
|
||||
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
|
||||
|
||||
dnl This file is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Library General Public License
|
||||
dnl along with this library; see the file COPYING.LIB. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
|
||||
# Original Author was Kalle@kde.org
|
||||
# I lifted it in some mater. (Stephan Kulow)
|
||||
# I used much code from Janos Farkas
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(acinclude.m4) dnl a source file from your sub dir
|
||||
|
||||
dnl This is so we can use kde-common
|
||||
AC_CONFIG_AUX_DIR(admin)
|
||||
|
||||
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
|
||||
unset CDPATH
|
||||
|
||||
dnl Checking host/target/build systems, for make, install etc.
|
||||
AC_CANONICAL_SYSTEM
|
||||
dnl Perform program name transformation
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
dnl Automake doc recommends to do this only here. (Janos)
|
||||
AM_INIT_AUTOMAKE(knmap, 0.1) dnl searches for some needed programs
|
||||
|
||||
KDE_SET_PREFIX
|
||||
|
||||
dnl generate the config header
|
||||
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_CHECK_COMPILERS
|
||||
AC_ENABLE_SHARED(yes)
|
||||
AC_ENABLE_STATIC(no)
|
||||
KDE_PROG_LIBTOOL
|
||||
|
||||
dnl for NLS support. Call them in this order!
|
||||
dnl WITH_NLS is for the po files
|
||||
AM_KDE_WITH_NLS
|
||||
|
||||
KDE_USE_QT(3.2.0)
|
||||
AC_PATH_KDE
|
||||
#MIN_CONFIG(3.2.0)
|
||||
|
||||
dnl PACKAGE set before
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_KDEMAXPATHLEN
|
||||
|
||||
KDE_CREATE_SUBDIRSLIST
|
||||
AC_CONFIG_FILES([ Makefile ])
|
||||
AC_CONFIG_FILES([ doc/Makefile ])
|
||||
AC_CONFIG_FILES([ doc/en/Makefile ])
|
||||
AC_CONFIG_FILES([ po/Makefile ])
|
||||
AC_CONFIG_FILES([ src/Makefile ])
|
||||
AC_OUTPUT
|
||||
if test "$all_tests" = "bad"; then
|
||||
if test ! "$cache_file" = "/dev/null"; then
|
||||
echo ""
|
||||
echo "Please remove the file $cache_file after changing your setup"
|
||||
echo "so that configure will find the changes next time."
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "Good - your configure finished. Start make now"
|
||||
echo ""
|
||||
fi
|
@ -0,0 +1,6 @@
|
||||
#MIN_CONFIG(3.2.0)
|
||||
|
||||
AM_INIT_AUTOMAKE(knmap, 0.1)
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_KDEMAXPATHLEN
|
||||
|
@ -0,0 +1,6 @@
|
||||
# the SUBDIRS is filled automatically by am_edit. If files are
|
||||
# in this directory they are installed into the english dir
|
||||
|
||||
KDE_LANG = en
|
||||
KDE_DOCS = knmap
|
||||
SUBDIRS = $(AUTODIRS)
|
@ -0,0 +1,3 @@
|
||||
KDE_DOCS = knmap
|
||||
KDE_LANG = en
|
||||
kde_docs_KDEDOCS = new_scan.png
|
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 160 KiB |
@ -0,0 +1,784 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
|
||||
<!ENTITY knmap "<application>Knmap</application>">
|
||||
<!ENTITY kappname "&knmap;">
|
||||
<!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc -->
|
||||
<!ENTITY % addindex "IGNORE">
|
||||
<!ENTITY % English "INCLUDE">
|
||||
]>
|
||||
|
||||
<book lang="&language;">
|
||||
<bookinfo>
|
||||
<title>The &knmap; Handbook</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Kevin</firstname>
|
||||
<othername></othername>
|
||||
<surname>Gilbert</surname>
|
||||
<affiliation>
|
||||
<address><email>kev.gilbert@cdu.edu.au</email></address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2005</year>
|
||||
<year>2006</year>
|
||||
<holder>Kevin Gilbert</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>&FDLNotice;</legalnotice>
|
||||
<date>2006-01-17</date>
|
||||
<releaseinfo>2.1</releaseinfo>
|
||||
|
||||
<abstract>
|
||||
<para>
|
||||
&knmap; is a graphical front end to the <computeroutput>nmap</computeroutput> "Network exploration tool and security scanner".
|
||||
</para>
|
||||
</abstract>
|
||||
|
||||
<keywordset>
|
||||
<keyword>KDE</keyword>
|
||||
<keyword>Knmap</keyword>
|
||||
<keyword>nmap</keyword>
|
||||
</keywordset>
|
||||
</bookinfo>
|
||||
|
||||
<chapter id="introduction">
|
||||
<title>Introduction</title>
|
||||
|
||||
<para>
|
||||
This program is a complete re-write of one by the same name written by Alexandre Sagala. The last version of that program was 0.9 which was released on 2003-03-09 and targeted the KDE 2.2 and QT 2.3 environments. Unfortunately it does not compile on today's KDE / QT environments.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Not to mention that it did not cater for the full set of <computeroutput>nmap</computeroutput> options. Or, perhaps, <computeroutput>nmap</computeroutput> progressed whilst that version of Knmap languished.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The icons used in this application are from the Open Clip Art Library. I am indebted to those damn fine folk as my artistic ability is zero - which is marginally above my programming ability. :-(
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Version 1.0 of &knmap; was merely a re-write of the original. Version 2.0 adds the extra functionality of multiple concurrent <computeroutput>nmap</computeroutput> scans from within the one instance of &knmap;. Version 2.1 allows a normal (non-root) user to use the privileged nmap functions via to 'kdesu' utility. (Previously, the privileged options were only available if &knmap; was run by root.)
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<chapter id="using-knmap">
|
||||
<title>Using &knmap;</title>
|
||||
<para>
|
||||
It is assumed that you are familiar with the operation of <computeroutput>nmap</computeroutput>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If your aren't, then please refer to <computeroutput>nmap(1)</computeroutput> or any other resource you can lay your hands on. This document is all about how to use &knmap; as a front end to <computeroutput>nmap</computeroutput>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This following screenshot shows an actual run of <computeroutput>nmap</computeroutput> under the control of &knmap;. The main &knmap; window is divided into two partitions - the Index Window on the left and (a stack of) Scan Windows on the right. Each Scan Window is composed of three partitions - from top to bottom: the Options Window, the Button Bar, and the Output Window.
|
||||
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="demo.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following sections contain screenshots that describe the contents of the various components of &knmap;'s main window. In the main, the contents of the Scan Window should be self-explanatory for readers familiar with <computeroutput>nmap</computeroutput>
|
||||
</para>
|
||||
|
||||
<sect1 id="index_window">
|
||||
<title>Index Window</title>
|
||||
<para>
|
||||
This window contains the names of all Scan Windows - with the current entry highlighted (in the KDE "Alternate Background in Lists" colour). When a scan is active, the entry for that scan will flash. When the scan has completed, if that scan is not the current entry, then the entry will be highlighted in the KDE "Selected Background" colour.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Left clicking on an entry will display the Scan Window for that scan. The caption of the &knmap; main window will be updated to show the name of the scan and its associated profile.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Entries can be manipulated via options in the "File" menu and via a RMB Context Menu. The order of the entries can be changed by dragging individual entries (multiple entries cannot be dragged concurrently).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Scans for which the "Use target host name" property is active will have an asterisk displayed before their name.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="output_window">
|
||||
<title>Output Window</title>
|
||||
<para>
|
||||
As its name implies, this window displays the output of an <computeroutput>nmap</computeroutput> scan. As can be seen from the previous screenshot, the text appearance varies. The following list explains how each type of output is displayed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Standard Input</term>
|
||||
<listitem>
|
||||
<para>
|
||||
No font modifiers.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Standard Output</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Text is displayed in bold-face font.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Standard Error</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Text is displayed in bold-face, italic font.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="button_bar">
|
||||
<title>Button Bar</title>
|
||||
<para>
|
||||
This row of buttons control the operation of &knmap;. The following screenshot shows the button row in its normal state.
|
||||
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="button_bar.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <computeroutput>Start nmap</computeroutput> and <computeroutput>Stop nmap</computeroutput> buttons should require no explanation. (No - I wont now launch into a multi-thousand word explanation of the bloody obvious.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <computeroutput>Clear output</computeroutput> button does just that - deletes all the text in the Output Window.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <computeroutput>Hide options</computeroutput> button can be used to enlarge the Output Window so as to reduce scrolling as shown in the following screenshot. The text of the button reflects the state of the Options Window.
|
||||
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="output_full.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="common_options">
|
||||
<title>Common Options</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="common_options.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
This screenshot shows the <computeroutput>nmap</computeroutput> options that are common to most network scans.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>New data range</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The range of ports are entered here in the format specified in the <computeroutput>nmap</computeroutput> man page for the <computeroutput>-p</computeroutput> parametere, BUT without the protocol specifier.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Protocol</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Select the protocol(s) for the port list shown in the input area. Note that the list of ports can contain a combination of protocols. &knmap; will ensure that the port ranges do not overlap.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Add</term>
|
||||
<listitem>
|
||||
<para>
|
||||
As soon as data has been entered in the input area, the <computeroutput>Add</computeroutput> button will be activated. Pressing this button will cause &knmap; to read the input and, if, valid, add it to the list of existing port ranges.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Delete</term>
|
||||
<listitem>
|
||||
<para>
|
||||
To delete a port range, double click on the entry in the list. That entry will be copied to the input area, the <computeroutput>Protocol</computeroutput> combo box updated to reflect the selected entry and the <computeroutput>Delete</computeroutput> button will be activated.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If the button is then pressed, the input area will NOT be cleared and the <computeroutput>Add</computeroutput> button will be activated. The allows for the port range to be added back into the list if the deletion was performed in error.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="compound_options">
|
||||
<title>Compound Options</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="compound_options.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
This screenshot shows those <computeroutput>nmap</computeroutput> options that require a value. The associated input area is activated when the option is activated. Options preceded by a hash (#) require root privileges. When the "Start nmap" button is pressed, the 'kdesu' facility will be invoked to run nmap as the super user.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="logging_options">
|
||||
<title>Logging Options</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="logging_options.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
This screenshot shows the <computeroutput>nmap</computeroutput> options that relate to logging.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
&knmap; considers the <computeroutput>--resume</computeroutput> option to be a logging option as its use requires that logging was enabled in the interrupted scan.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="man_page">
|
||||
<title><computeroutput>man</computeroutput> Page</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="man_page.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
&knmap; comes packaged with the <computeroutput>man</computeroutput> page for <computeroutput>nmap</computeroutput> version 3.93 in HTML format. See the Settings -> <computeroutput>man</computeroutput> page stylesheet... menu option for how to control the appearance of this documentation and the Settings -> Zoom in / out / custom options for controlling the size..
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="ping_and_scan_options">
|
||||
<title>Ping and Scan Options</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="ping_and_scan_options.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
This screenshot shows the <computeroutput>nmap</computeroutput> options that control the types of ping and scans that will be performed. Options preceded by a hash (#) require root privileges. When the "Start nmap" button is pressed, the 'kdesu' facility will be invoked to run nmap as the super user.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="simple_options">
|
||||
<title>Simple Options</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="simple_options.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
This screenshot shows the boolean <computeroutput>nmap</computeroutput> options, i.e., those options that do not require a value. Options preceded by a hash (#) require root privileges. When the "Start nmap" button is pressed, the 'kdesu' facility will be invoked to run nmap as the super user.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="timing_options">
|
||||
<title>Timing Options</title>
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="timing_options.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
|
||||
This screenshot shows the <computeroutput>nmap</computeroutput> options that control the timing of network activity. Note that the <computeroutput>Default</computeroutput> does nothing. It is provided as a means to disable the other timing options.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<chapter id="commands">
|
||||
<title>Command Reference</title>
|
||||
<sect1 id="knmap_menu_options">
|
||||
<title>The &knmap; Menu Options</title>
|
||||
<sect2>
|
||||
<title>The File Menu</title>
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Save</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Saves the current content of the Output Window. Note, however, that all text formatting is lost. If you don't like this - tough. Go tell someone that gives a shit!
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Save As...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Given the above explanation of what "File -> Save" does, this option should need no further explanation.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>New scan...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Creates a new Scan Window. The dialog box shown below will be displayed to allow the name of the scan to be entered. The "Use target host name" option allows the name of the scan to automatically track the target of the nmap scan. If that option is not selected, the name of the scan can be entered in the edit window - which is activated when the "Use target host name" option is unchecked.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul">&Ctrl;<keycap>C</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Duplicate scan</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
As the name imples, the current scan is duplicated. Unusual / unfortunate and / or strange behaviour may / will result if the name of the scan is not changed but a different profile is associated with the duplicated scan (name).
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul"><keycap>F2</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Rename scan...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Obvious - but it is also possible to select the "Use target host name" property via this menu item.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul"><keycap>F2</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Use target host name</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
This is a toggle item that causes the name of the scan to automatically track the target of the nmap scan.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul">&Ctrl;<keycap>W</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Close scan</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Obvious - but if the profile has been updated you will be asked whether it should be saved.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<shortcut>
|
||||
<keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo>
|
||||
</shortcut>
|
||||
<guimenu>File</guimenu>
|
||||
<guimenuitem>Quit</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem><para><action>Quits</action> &knmap;</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="new_scan.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>The Profiles Menu</title>
|
||||
<para>
|
||||
Before launching into the explanation of the items under this menu, it is necessary to define what a "Profile" is.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Quite simply, a Profile is the set of values of all the <computeroutput>nmap</computeroutput> options supported by &knmap; and some &knmap;-specific data (e.g., the order of the tabs in the Options Window and the current options tab).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The status of the Hide / Show buttons is not saved. All windows are shown on &knmap; startup regrardless of their status at the time a Profile saved.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Having the same profile associated with multiple scans is not recommended - unusual / unfortunate and / or strange behaviour may / will result.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following screenshot shows the dialog window that controls all options in this menu.
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="profile_dlg.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
The top window is used for the entry of new names for the copy and rename functions. The lower window lists all known profiles. (For the technically minded, the profiles are stored in the standard KDE <computeroutput>knmaprc</computeroutput> configuration file - but with the name "Knmap_<profile name>".)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The copy, delete and rename functions available in this menu are also available when a profile name is right-clicked in the list window.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Profiles</guimenu>
|
||||
<guimenuitem>Load profile...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Equivalent to a "File -> Open" in your favourite editor. If the current profile has been modified you will be asked if you want to save it prior to loading the new profile.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Profiles</guimenu>
|
||||
<guimenuitem>Save profile...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Equivalent to a "File -> Save" in your favourite editor.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Profiles</guimenu>
|
||||
<guimenuitem>Save profile as...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Equivilent to a "File -> Save" as in your favourite editor.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Profiles</guimenu>
|
||||
<guimenuitem>Copy profile...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
The selected profile is copied, the name of the new profile is entered in the upper input window.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Profiles</guimenu>
|
||||
<guimenuitem>Delete profile...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Bloody obvious.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Profiles</guimenu>
|
||||
<guimenuitem>Rename profile...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
The name of the selected profile is changed to the name entered in the upper input window.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>The Settings Menu</title>
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Settings</guimenu>
|
||||
<guimenuitem>Wrap text</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Selects whether the nmap output should be word-wrapped at the windows right-border.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Settings</guimenu>
|
||||
<guimenuitem>'man' page stylesheet...</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Allows for the selection of the stylesheet to be used when the nmap man page is displayed.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Settings</guimenu>
|
||||
<guimenuitem>Use local 'man' page</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
This is a toggle action, the text changes depending upon its state. If the &knmap; nmap man page is being displayed, this option allows for the >man page stored on the local machine to be displayed. This is useful when the local version of the nmap man page differs from the version distrubuted with &knmap;.
|
||||
</action>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<action>
|
||||
When the local man page is being displayed, this option allows for the &knmap; version to be displayed.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Settings</guimenu>
|
||||
<guimenuitem>Zoom in</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Increases the font size in the man page window by 25% - limits are 20% - 300%.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Settings</guimenu>
|
||||
<guimenuitem>Zoom out</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Decreases the font size in the man page window by 25% - limits are 20% - 300%.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><menuchoice>
|
||||
<guimenu>Settings</guimenu>
|
||||
<guimenuitem>Zoom custom</guimenuitem>
|
||||
</menuchoice></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<action>
|
||||
Allows manual control of the font size - limits are 20% - 300%.
|
||||
</action>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The remaining options in this menu are standard KDE options.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2>
|
||||
<title>The Help Menu</title>
|
||||
<para>
|
||||
&help.menu.documentation;
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<chapter id="developers">
|
||||
<title>Developer's Guide to &knmap;</title>
|
||||
<para>
|
||||
The only item worthy of mention here is the file <computeroutput>nmap_manpage.html.diff</computeroutput>. This file contains a <computeroutput>diff</computeroutput> of the <computeroutput>nmap</computeroutput> version 3.93 HTML formatted <computeroutput>man</computeroutput> page and that distributed with &knmap;. You can use this to update your version of that <computeroutput>man</computeroutput> page.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<chapter id="credits">
|
||||
<title>Credits and License</title>
|
||||
<para>
|
||||
&knmap;
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Program copyright 2005, 2006 Kevin Gilbert <email>kev.gilbert@cdu.edu.au</email>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Documentation copyright 2005, 2006 Kevin Gilbert <email>kev.gilbert@cdu.edu.au</email>
|
||||
</para>
|
||||
|
||||
&underFDL;
|
||||
&underGPL;
|
||||
</chapter>
|
||||
|
||||
<appendix id="installation">
|
||||
<title>Installation</title>
|
||||
|
||||
<sect1 id="getting-knmap">
|
||||
<title>How to obtain &knmap;</title>
|
||||
|
||||
<para>
|
||||
Now let me see... You're reading this documentation - which come packaged with &knmap;, which means that you have &knmap; installed, which means that you have somehow obtained &knmap;, and now you want to know how to obtain &knmap;?
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You have _way_ too much time on your hands! ;-)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Okay, Okay. Go to <ulink url="http://sourceforge.net/projects/knmap">http://sourceforge.net/projects/knmap</ulink> and follow the download links.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
&knmap; was developed and tested under Qt 3.3.4 / KDE 3.4 & 3.5. YMMV vary if your configuration differs from this.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
And, of course, you will need <computeroutput>nmap</computeroutput>. Go to <ulink url="http://www.insecure.org/nmap">http://www.insecure.org/nmap</ulink> for details on how to download <computeroutput>nmap</computeroutput>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="compilation">
|
||||
<title>Compilation and Installation</title>
|
||||
&install.compile.documentation;
|
||||
</sect1>
|
||||
</appendix>
|
||||
|
||||
&documentation.index;
|
||||
</book>
|
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 192 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 97 KiB |
@ -0,0 +1 @@
|
||||
POFILES = AUTO
|
@ -0,0 +1,46 @@
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = $(all_includes)
|
||||
|
||||
# these are the headers for your project
|
||||
noinst_HEADERS = knmap.h global.h mainwidget.h outputwidget.h commonwidget.h \
|
||||
timingwidget.h compoundwidget.h htmlwidget.h stylesheetdialog.h profiledialog.h \
|
||||
loggingoptions.h simpleoptions.h pandsoptions.h whatsthis.h tabwidgetptrlist.h \
|
||||
tabwidgetdata.h scanwidget.h indexwidget.h scannamedialog.h scanstack.h scanmonitor.h \
|
||||
scanmonitorevent.h nmapoutputbuffer.h
|
||||
|
||||
# let automoc handle all of the meta source files (moc)
|
||||
METASOURCES = AUTO
|
||||
|
||||
messages: rc.cpp
|
||||
$(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp
|
||||
$(XGETTEXT) *.cpp -o $(podir)/knmap.pot
|
||||
|
||||
KDE_ICON = AUTO
|
||||
|
||||
#########################################################################
|
||||
# APPLICATION SECTION
|
||||
#########################################################################
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
bin_PROGRAMS = knmap
|
||||
|
||||
# the application source, library search path, and link libraries
|
||||
knmap_SOURCES = main.cpp knmap.cpp mainwidget.cpp outputwidget.cpp \
|
||||
commonwidget.cpp timingwidget.cpp compoundwidget.cpp htmlwidget.cpp stylesheetdialog.cpp \
|
||||
profiledialog.cpp loggingoptions.cpp simpleoptions.cpp pandsoptions.cpp whatsthis.cpp \
|
||||
tabwidgetptrlist.cpp tabwidgetdata.cpp scanwidget.cpp indexwidget.cpp scannamedialog.cpp \
|
||||
scanstack.cpp scanmonitor.cpp scanmonitorevent.cpp nmapoutputbuffer.cpp
|
||||
knmap_LDFLAGS = $(KDE_RPATH) $(all_libraries)
|
||||
knmap_LDADD = $(LIB_KIO) $(LIB_KHTML)
|
||||
|
||||
# this is where the desktop file will go
|
||||
shelldesktopdir = $(kde_appsdir)/Utilities
|
||||
shelldesktop_DATA = knmap.desktop
|
||||
|
||||
# this is where the shell's XML-GUI resource file goes
|
||||
shellrcdir = $(kde_datadir)/knmap
|
||||
shellrc_DATA = knmapui.rc nmap_manpage.html nmap_manpage.html.diff
|
||||
|
||||
kde_icon_KDEICON = hi16-app-scanclose.png hi32-app-scanclose.png \
|
||||
hi16-app-scannew.png hi32-app-scannew.png hi16-app-scanrename.png hi32-app-scanrename.png \
|
||||
hi16-app-scanduplicate.png hi32-app-scanduplicate.png hi16-app-manpage.png hi32-app-manpage.png
|
@ -0,0 +1,655 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qbuttongroup.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qvalidator.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "commonwidget.h"
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
CommonWidget::CommonWidget( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name ),
|
||||
m_hosts( NULL ),
|
||||
m_portRangeIgnoreChange( false ),
|
||||
m_portRanges( NULL )
|
||||
{ createLayout( );
|
||||
m_portRangeAddButton->setEnabled( false );
|
||||
m_portRangeDeleteButton->setEnabled( false );
|
||||
}
|
||||
|
||||
// destructor
|
||||
// ==========
|
||||
|
||||
CommonWidget::~CommonWidget( )
|
||||
{ if( m_hosts != NULL )
|
||||
delete m_hosts;
|
||||
|
||||
if( m_portRanges != NULL )
|
||||
delete m_portRanges;
|
||||
}
|
||||
|
||||
// buildPortRangesTables
|
||||
// =====================
|
||||
|
||||
bool CommonWidget::buildPortRangesTables( const boolPtr tcpPorts, const boolPtr udpPorts )
|
||||
{ memset( tcpPorts, 0, 64 * 1024 );
|
||||
memset( udpPorts, 0, 64 * 1024 );
|
||||
|
||||
QStringList portRanges;
|
||||
getPortRanges( &portRanges );
|
||||
|
||||
for( QStringList::Iterator it = portRanges.begin( ); it != portRanges.end( ); ++it )
|
||||
{ QString portRange = *it;
|
||||
bool tcp = false;
|
||||
bool udp = false;
|
||||
|
||||
if( portRange[ 0 ].isDigit( ))
|
||||
{ tcp = true;
|
||||
udp = true;
|
||||
}
|
||||
else
|
||||
if( portRange[ 0 ].lower( ) == 't' )
|
||||
{ tcp = true;
|
||||
portRange = portRange.right( portRange.length( ) - 2 );
|
||||
}
|
||||
else
|
||||
if( portRange[ 0 ].lower( ) == 'u' )
|
||||
{ udp = true;
|
||||
portRange = portRange.right( portRange.length( ) - 2 );
|
||||
}
|
||||
else
|
||||
{ KMessageBox::error( this, i18n( QString( "Internal error - Unknown Port Range protocol '%1'" ).arg( portRange[ 0 ])), i18n( "Internal error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList ports = QStringList::split( "-", portRange );
|
||||
|
||||
if( ports.count( ) > 2 )
|
||||
{ KMessageBox::error( this, i18n( "Internal error - Illegal Port Range encountered" ), i18n( "Internal error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
ushort portFirst = ports.front( ).toUShort( );
|
||||
ushort portLast = portFirst;
|
||||
|
||||
if( ports.count( ) > 1 )
|
||||
portLast = ports.back( ).toUShort( );
|
||||
|
||||
for( uint port = portFirst; port <= portLast; port++ )
|
||||
{ if( tcp )
|
||||
tcpPorts[ port ] = true;
|
||||
|
||||
if( udp )
|
||||
udpPorts[ port ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// createLayout
|
||||
// ============
|
||||
|
||||
void CommonWidget::createLayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( this );
|
||||
KIconLoader* iconLoader = KGlobal::iconLoader( );
|
||||
QIconSet clearRightIconSet = iconLoader->loadIconSet( "locationbar_erase", KIcon::Small );
|
||||
|
||||
byte row = 1;
|
||||
m_hostButton = new QPushButton( clearRightIconSet, NULL, this, "host button" );
|
||||
m_hostComboBox = new QComboBox( true, this, "target hosts combobox" );
|
||||
QHBoxLayout* hostLayout = new QHBoxLayout( );
|
||||
|
||||
byte col = 0;
|
||||
hostLayout->insertStretch( col++, 0 );
|
||||
hostLayout->insertWidget( col++, new QLabel( i18n( "Target host(s)" ), this, "target hosts label" ), 0 );
|
||||
hostLayout->insertStretch( col++, 1 );
|
||||
hostLayout->insertWidget( col++, m_hostButton, 0 );
|
||||
hostLayout->insertStretch( col++, 1 );
|
||||
hostLayout->insertWidget( col++, m_hostComboBox, 100 );
|
||||
hostLayout->insertStretch( col++, 0 );
|
||||
gridLayout->addMultiCellLayout( hostLayout, row, row, 1, 5 );
|
||||
|
||||
QButtonGroup* resloveGroup = new QButtonGroup( 3, Qt::Vertical, i18n( "Resolve names" ), this, "resolve names group" );
|
||||
m_resovleDefaultRadio = new QRadioButton( i18n( "Default" ), resloveGroup, "default resolve radio" );
|
||||
m_resovleAlwaysRadio = new QRadioButton( i18n( "Always (-R)" ), resloveGroup, "always resolve radio" );
|
||||
m_resovleNeverRadio = new QRadioButton( i18n( "Never (-n)" ), resloveGroup, "never resolve radio" );
|
||||
|
||||
row = 4;
|
||||
gridLayout->addMultiCellWidget( resloveGroup, row, row + 3, 1, 1 );
|
||||
byte rowBlock1 = ++row;
|
||||
|
||||
m_portRangeAddButton = new QPushButton( i18n( "Add" ), this, "add port range button" );
|
||||
m_portRangeDeleteButton = new QPushButton( i18n( "Delete" ), this, "delete port range button" );
|
||||
m_portRangeComboBox = new QComboBox( this, "port range combobox" );
|
||||
m_portRangeLineEdit = new QLineEdit( this, "port range line edit" );
|
||||
m_portRangeListBox = new QListBox( this, "port range listbox" );
|
||||
m_portRangesCheckBox = new QCheckBox( i18n( "Port ranges (-p <port ranges>)" ), this, "port ranges checkbox" );
|
||||
|
||||
m_portRangeComboBox->insertItem( i18n( "Both" ), BothProtocol );
|
||||
m_portRangeComboBox->insertItem( i18n( "TCP" ), TCPProtocol );
|
||||
m_portRangeComboBox->insertItem( i18n( "UDP" ), UDPProtocol );
|
||||
|
||||
m_portRangeLineEdit->setValidator( new QRegExpValidator( QRegExp( "^\\d{1,5}-{1}\\d{1,5}$" ), this, "port range regx" ));
|
||||
|
||||
row = 3;
|
||||
gridLayout->addMultiCellWidget( m_portRangesCheckBox, row, row, 3, 5, Qt::AlignCenter );
|
||||
row++;
|
||||
|
||||
m_portRangeButton = new QPushButton( clearRightIconSet, NULL, this, "host button" );
|
||||
QHBoxLayout* portRangeLayout = new QHBoxLayout( );
|
||||
|
||||
col = 0;
|
||||
portRangeLayout->insertStretch( col++, 0 );
|
||||
portRangeLayout->insertWidget( col++, new QLabel( i18n( "New range data: " ), this, "new range data label" ), 0 );
|
||||
portRangeLayout->insertStretch( col++, 1 );
|
||||
portRangeLayout->insertWidget( col++, m_portRangeButton, 0 );
|
||||
portRangeLayout->insertStretch( col++, 1 );
|
||||
portRangeLayout->insertWidget( col++, m_portRangeLineEdit, 100 );
|
||||
portRangeLayout->insertStretch( col++, 0 );
|
||||
gridLayout->addMultiCellLayout( portRangeLayout, row, row, 3, 5 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( i18n( "Protocol" ), this, "protocol label" ), row + 1, 3 );
|
||||
gridLayout->addWidget( m_portRangeComboBox, row + 2, 3 );
|
||||
gridLayout->addWidget( m_portRangeAddButton, row + 4, 3 );
|
||||
gridLayout->addWidget( m_portRangeDeleteButton, row + 5, 3 );
|
||||
byte rowBlock2 = _max_( row + 5, rowBlock1 );
|
||||
gridLayout->addMultiCellWidget( m_portRangeListBox, row + 1, rowBlock2, 5, 5 );
|
||||
|
||||
gridLayout->setColStretch( 0, 4 );
|
||||
gridLayout->setColStretch( 2, 2 );
|
||||
gridLayout->setColStretch( 5, 10 );
|
||||
gridLayout->setColStretch( 6, 4 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 10 );
|
||||
gridLayout->setRowStretch( 2, 10 );
|
||||
gridLayout->setRowStretch( rowBlock2 + 1, 10 );
|
||||
}
|
||||
|
||||
// enablePortRangeWidgets
|
||||
// ======================
|
||||
|
||||
void CommonWidget::enablePortRangeWidgets( )
|
||||
{ bool portRangesState = m_portRangesCheckBox->isChecked( );
|
||||
|
||||
m_portRangeAddButton->setEnabled( false );
|
||||
m_portRangeDeleteButton->setEnabled( false );
|
||||
m_portRangeButton->setEnabled( portRangesState );
|
||||
m_portRangeLineEdit->setEnabled( portRangesState );
|
||||
m_portRangeLineEdit->clear( );
|
||||
m_portRangeComboBox->setEnabled( portRangesState );
|
||||
m_portRangeListBox->setEnabled( portRangesState );
|
||||
|
||||
if( portRangesState )
|
||||
emit( disableFastScan( ));
|
||||
}
|
||||
|
||||
// finaliseInitialisation
|
||||
// ======================
|
||||
|
||||
void CommonWidget::finaliseInitialisation( )
|
||||
{ WhatsThis* whatsThis = new WhatsThis( this );
|
||||
|
||||
connect( m_hostButton, SIGNAL( clicked( )), SLOT( slotHostButtonClicked( )));
|
||||
connect( m_hostComboBox, SIGNAL( activated( int )), SLOT( slotHostActivated( int )));
|
||||
connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SLOT( slotHostTextChanged( const QString& )));
|
||||
connect( m_portRangeAddButton, SIGNAL( clicked( )), SLOT( slotPortRangeAddClicked( )));
|
||||
connect( m_portRangeButton, SIGNAL( clicked( )), SLOT( slotPortRangeButtonClicked( )));
|
||||
connect( m_portRangeDeleteButton, SIGNAL( clicked( )), SLOT( slotPortRangeDeleteClicked( )));
|
||||
connect( m_portRangeComboBox, SIGNAL( activated( int )), SLOT( slotPortRangeActivated( int )));
|
||||
connect( m_portRangeLineEdit, SIGNAL( textChanged( const QString& )), SLOT( slotPortRangeTextChanged( const QString& )));
|
||||
connect( m_portRangeListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotPortRangeDoubleClicked( QListBoxItem* )));
|
||||
connect( m_portRangeListBox, SIGNAL( highlighted( int )), SLOT( slotPortRangeHighlighted( )));
|
||||
connect( m_portRangesCheckBox, SIGNAL( clicked( )), SLOT( slotPortRangesClicked( )));
|
||||
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
|
||||
|
||||
connect( m_hostButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_hostComboBox, SIGNAL( activated ( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeAddButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeComboBox, SIGNAL( activated( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeDeleteButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeListBox, SIGNAL( doubleClicked( QListBoxItem* )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangeListBox, SIGNAL( highlighted ( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_portRangesCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_resovleAlwaysRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_resovleDefaultRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_resovleNeverRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
|
||||
emit( targetChanged( m_hostComboBox->currentText( )));
|
||||
}
|
||||
QString CommonWidget::getHostName( ) const
|
||||
{ return m_hostComboBox->currentText( );
|
||||
}
|
||||
|
||||
// getHosts
|
||||
// ========
|
||||
|
||||
void CommonWidget::getHosts( QStringList* hosts )
|
||||
{ hosts->clear( );
|
||||
|
||||
for( ushort i = 0; i < m_hostComboBox->count( ); i++ )
|
||||
hosts->append( m_hostComboBox->text( i ));
|
||||
}
|
||||
|
||||
// getOptions
|
||||
// ==========
|
||||
|
||||
bool CommonWidget::getOptions( )
|
||||
{ QStringList portRanges;
|
||||
getPortRanges( &portRanges );
|
||||
|
||||
bool portRangesState = m_portRangesCheckBox->isChecked( );
|
||||
|
||||
if( portRangesState && portRanges.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Port ranges not specified" )), i18n( "Port ranges error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_host = m_hostComboBox->currentText( );
|
||||
m_hostCurrentItem = m_hostComboBox->currentItem( );
|
||||
m_portRangeCurrentItem = m_portRangeComboBox->currentItem( );
|
||||
m_portRangesState = portRangesState;
|
||||
m_resovleAlwaysState = m_resovleAlwaysRadio->isChecked( );
|
||||
m_resovleDefaultState = m_resovleDefaultRadio->isChecked( );
|
||||
m_resovleNeverState = m_resovleNeverRadio->isChecked( );
|
||||
|
||||
if( m_portRanges != NULL )
|
||||
delete m_portRanges;
|
||||
|
||||
m_portRanges = new QStringList( portRanges );
|
||||
getHosts( m_hosts );
|
||||
|
||||
disconnect( m_hostComboBox, SIGNAL( activated( int )), this, SLOT( slotHostActivated( int )));
|
||||
disconnect( m_hostComboBox, SIGNAL( textChanged( const QString& )), this, SLOT( slotHostTextChanged( const QString& )));
|
||||
|
||||
disconnect( m_hostComboBox, SIGNAL( activated ( int )), this, SIGNAL( optionsDirty( )));
|
||||
disconnect( m_hostComboBox, SIGNAL( textChanged( const QString& )), this, SIGNAL( optionsDirty( )));
|
||||
|
||||
byte i;
|
||||
QStringList::Iterator it;
|
||||
|
||||
for( i = 0, it = m_hosts->begin( ); it != m_hosts->end( ); i++, ++it )
|
||||
if( *it == m_host )
|
||||
break;
|
||||
|
||||
if( it != m_hosts->end( ))
|
||||
{ m_hostComboBox->removeItem( i );
|
||||
m_hosts->remove( it );
|
||||
}
|
||||
else
|
||||
while( m_hostComboBox->count( ) > MAX_HOST_HISTORY - 1 )
|
||||
{ m_hostComboBox->removeItem( MAX_HOST_HISTORY - 1 );
|
||||
m_hosts->pop_back( );
|
||||
}
|
||||
|
||||
m_hostComboBox->insertItem( m_host, 0 );
|
||||
m_hostComboBox->setCurrentItem( 0 );
|
||||
m_hosts->prepend( m_host );
|
||||
|
||||
connect( m_hostComboBox, SIGNAL( activated( int )), SLOT( slotHostActivated( int )));
|
||||
connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SLOT( slotHostTextChanged( const QString& )));
|
||||
|
||||
connect( m_hostComboBox, SIGNAL( activated ( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// getPortRanges
|
||||
// =============
|
||||
|
||||
void CommonWidget::getPortRanges( QStringList* portRanges )
|
||||
{ portRanges->clear( );
|
||||
|
||||
for( ushort i = 0; i < m_portRangeListBox->count( ); i++ )
|
||||
portRanges->append( m_portRangeListBox->text( i ));
|
||||
}
|
||||
|
||||
// portRangesOverlapping
|
||||
// =====================
|
||||
|
||||
bool CommonWidget::portRangesOverlapping( const ushort portFirst, const ushort portLast )
|
||||
{ boolPtr tcpPorts = new bool[ 64 * 1024 ];
|
||||
boolPtr udpPorts = new bool[ 64 * 1024 ];
|
||||
|
||||
if( !buildPortRangesTables( tcpPorts, udpPorts ))
|
||||
{ delete [] tcpPorts;
|
||||
delete [] udpPorts;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool tcp = false;
|
||||
bool udp = false;
|
||||
|
||||
switch( m_portRangeComboBox->currentItem( ))
|
||||
{ case 0: tcp = udp = true; break;
|
||||
case 1: tcp = true; break;
|
||||
case 2: udp = true; break;
|
||||
|
||||
default:
|
||||
kdDebug( ) << i18n( "unknown value in Port Range Protocol combo box" ) << endl;
|
||||
ASSERT( false );
|
||||
delete [] tcpPorts;
|
||||
delete [] udpPorts;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint port;
|
||||
QString protocol;
|
||||
|
||||
for( port = portFirst; port <= portLast; port++ )
|
||||
{ if( tcp && tcpPorts[ port ])
|
||||
{ protocol = "TCP";
|
||||
break;
|
||||
}
|
||||
|
||||
if( udp && udpPorts[ port ])
|
||||
{ protocol = "UDP";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( port <= portLast )
|
||||
{ KMessageBox::sorry( this, i18n( "Overlapping Port Range - %1 port %2" ).arg( protocol ).arg( QString::number( port )), i18n( "Overlapping Port Range" ));
|
||||
delete [] tcpPorts;
|
||||
delete [] udpPorts;
|
||||
return false;
|
||||
}
|
||||
|
||||
delete [] tcpPorts;
|
||||
delete [] udpPorts;
|
||||
return true;
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void CommonWidget::readProfile( KConfig* config )
|
||||
{ m_hostCurrentItem = config->readNumEntry( "hostCurrentItem" );
|
||||
m_portRangeCurrentItem = config->readNumEntry( "portRangeCurrentItem" );
|
||||
m_portRangesState = config->readBoolEntry( "portRangesState" );
|
||||
m_resovleAlwaysState = config->readBoolEntry( "resovleAlwaysState" );
|
||||
m_resovleDefaultState = config->readBoolEntry( "resovleDefaultState" );
|
||||
m_resovleNeverState = config->readBoolEntry( "resovleNeverState" );
|
||||
|
||||
m_hosts = new QStringList( config->readListEntry( "hosts" ));
|
||||
m_portRanges = new QStringList( config->readListEntry( "portRanges" ));
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void CommonWidget::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "hostCurrentItem", m_hostCurrentItem );
|
||||
config->writeEntry( "hosts", *m_hosts );
|
||||
config->writeEntry( "portRanges", *m_portRanges );
|
||||
config->writeEntry( "portRangeCurrentItem", m_portRangeCurrentItem );
|
||||
config->writeEntry( "portRangesState", m_portRangesState );
|
||||
config->writeEntry( "resovleAlwaysState", m_resovleAlwaysState );
|
||||
config->writeEntry( "resovleDefaultState", m_resovleDefaultState );
|
||||
config->writeEntry( "resovleNeverState", m_resovleNeverState );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void CommonWidget::setInitialValues( )
|
||||
{ m_hostComboBox->clear( );
|
||||
m_hostComboBox->insertStringList( *m_hosts );
|
||||
m_portRangeListBox->insertStringList( *m_portRanges );
|
||||
m_portRangeComboBox->setCurrentItem( m_portRangeCurrentItem );
|
||||
m_portRangesCheckBox->setChecked( m_portRangesState );
|
||||
m_resovleAlwaysRadio->setChecked( m_resovleAlwaysState );
|
||||
m_resovleDefaultRadio->setChecked( m_resovleDefaultState );
|
||||
m_resovleNeverRadio->setChecked( m_resovleNeverState );
|
||||
|
||||
if( m_hostComboBox->count( ))
|
||||
m_hostComboBox->setCurrentItem( m_hostCurrentItem );
|
||||
|
||||
enablePortRangeWidgets( );
|
||||
}
|
||||
|
||||
// slotDisablePortRanges
|
||||
// =====================
|
||||
|
||||
void CommonWidget::slotDisablePortRanges( )
|
||||
{ m_portRangesCheckBox->setChecked( false );
|
||||
slotPortRangesClicked( );
|
||||
}
|
||||
|
||||
// slotHostActivated
|
||||
// =================
|
||||
|
||||
void CommonWidget::slotHostActivated( int /* index */)
|
||||
{ emit( targetChanged( m_hostComboBox->currentText( )));
|
||||
}
|
||||
|
||||
// slotHostButtonClicked
|
||||
// =====================
|
||||
|
||||
void CommonWidget::slotHostButtonClicked( )
|
||||
{ m_hostComboBox->clearEdit( );
|
||||
}
|
||||
|
||||
// slotHostTextChanged
|
||||
// ===================
|
||||
|
||||
void CommonWidget::slotHostTextChanged( const QString& text )
|
||||
{ emit( targetChanged( text ));
|
||||
}
|
||||
|
||||
// slotPortRangeAddClicked
|
||||
// =======================
|
||||
|
||||
void CommonWidget::slotPortRangeAddClicked( )
|
||||
{ QString text;
|
||||
|
||||
if( !validatePortRange( text ))
|
||||
return;
|
||||
|
||||
switch( m_portRangeComboBox->currentItem( ))
|
||||
{ case BothProtocol: break;
|
||||
case TCPProtocol: text = "T:" + text; break;
|
||||
case UDPProtocol: text = "U:" + text; break;
|
||||
|
||||
default:
|
||||
kdDebug( ) << i18n( "unknown value in Port Range Protocol combo box" ) << endl;
|
||||
ASSERT( false );
|
||||
}
|
||||
|
||||
m_portRangeAddButton->setEnabled( false );
|
||||
emit( optionsDirty( ));
|
||||
m_portRangeLineEdit->clear( );
|
||||
m_portRangeListBox->insertItem( text );
|
||||
}
|
||||
|
||||
// slotPortRangeDeleteClicked
|
||||
// ==========================
|
||||
|
||||
void CommonWidget::slotPortRangeDeleteClicked( )
|
||||
{ m_portRangeIgnoreChange = true;
|
||||
m_portRangeListBox->removeItem( m_portRangeListBox->currentItem( ));
|
||||
m_portRangeAddButton->setEnabled( true );
|
||||
m_portRangeDeleteButton->setEnabled( false );
|
||||
emit( optionsDirty( ));
|
||||
}
|
||||
|
||||
// slotPortRangeActivated
|
||||
// ======================
|
||||
|
||||
void CommonWidget::slotPortRangeActivated( int /* index */)
|
||||
{ m_portRangeAddButton->setEnabled( true );
|
||||
}
|
||||
|
||||
// slotPortRangeActivated
|
||||
// ======================
|
||||
|
||||
void CommonWidget::slotPortRangeButtonClicked( )
|
||||
{ m_portRangeAddButton->setEnabled( false );
|
||||
m_portRangeDeleteButton->setEnabled( false );
|
||||
m_portRangeLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotPortRangeDoubleClicked
|
||||
// ==========================
|
||||
|
||||
void CommonWidget::slotPortRangeDoubleClicked( QListBoxItem* item )
|
||||
{ if( item == NULL )
|
||||
return;
|
||||
|
||||
QString text = item->text( );
|
||||
|
||||
if( text[ 0 ].isDigit( ))
|
||||
m_portRangeComboBox->setCurrentItem( BothProtocol );
|
||||
else
|
||||
{ switch( text[ 0 ].latin1( ))
|
||||
{ case 'T': m_portRangeComboBox->setCurrentItem( TCPProtocol ); break;
|
||||
case 'U': m_portRangeComboBox->setCurrentItem( UDPProtocol ); break;
|
||||
|
||||
default:
|
||||
kdDebug( ) << i18n( "unknown value in Port Range Protocol" ) << endl;
|
||||
ASSERT( false );
|
||||
m_portRangeComboBox->setCurrentItem( BothProtocol );
|
||||
}
|
||||
|
||||
text = text.right( text.length( ) - 2 );
|
||||
}
|
||||
|
||||
m_portRangeIgnoreChange = true;
|
||||
m_portRangeLineEdit->setText( text );
|
||||
m_portRangeDeleteButton->setEnabled( true );
|
||||
}
|
||||
|
||||
// slotPortRangeHighlighted
|
||||
// ========================
|
||||
|
||||
void CommonWidget::slotPortRangeHighlighted( )
|
||||
{ if( m_portRangeIgnoreChange )
|
||||
m_portRangeIgnoreChange = false;
|
||||
else
|
||||
{ m_portRangeAddButton->setEnabled( false );
|
||||
m_portRangeDeleteButton->setEnabled( false );
|
||||
m_portRangeLineEdit->clear( );
|
||||
}
|
||||
}
|
||||
|
||||
// slotPortRangesClicked
|
||||
// =====================
|
||||
|
||||
void CommonWidget::slotPortRangesClicked( )
|
||||
{ enablePortRangeWidgets( );
|
||||
}
|
||||
|
||||
// slotPortRangeTextChanged
|
||||
// ========================
|
||||
|
||||
void CommonWidget::slotPortRangeTextChanged( const QString& /* text */)
|
||||
{ if( m_portRangeIgnoreChange )
|
||||
m_portRangeIgnoreChange = false;
|
||||
else
|
||||
m_portRangeAddButton->setEnabled( m_portRangeLineEdit->text( ).length( ));
|
||||
}
|
||||
|
||||
// slotWhatsThisClicked
|
||||
// ====================
|
||||
|
||||
void CommonWidget::slotWhatsThisClicked( )
|
||||
{ if( m_hostButton->hasMouse( )) emit( displayHelp( "target" ));
|
||||
else if( m_hostComboBox->hasMouse( )) emit( displayHelp( "target" ));
|
||||
else if( m_portRangeAddButton->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_portRangeButton->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_portRangeComboBox->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_portRangeDeleteButton->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_portRangeLineEdit->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_portRangeListBox->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_portRangesCheckBox->hasMouse( )) emit( displayHelp( "-p" ));
|
||||
else if( m_resovleAlwaysRadio->hasMouse( )) emit( displayHelp( "-R" ));
|
||||
else if( m_resovleDefaultRadio->hasMouse( )) emit( displayDocBook( "common_options" ));
|
||||
else if( m_resovleNeverRadio->hasMouse( )) emit( displayHelp( "-n" ));
|
||||
else emit( displayUnknown( ));
|
||||
}
|
||||
|
||||
// validatePortRange
|
||||
// =================
|
||||
|
||||
bool CommonWidget::validatePortRange( QString& text )
|
||||
{ uint portFirst;
|
||||
uint portLast;
|
||||
|
||||
if( !validatePortRangeText( text, portFirst, portLast ))
|
||||
return false;
|
||||
|
||||
if( !portRangesOverlapping( portFirst, portLast ))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// validatePortRangeText
|
||||
// =====================
|
||||
|
||||
bool CommonWidget::validatePortRangeText( QString& text, uint& portFirst, uint& portLast )
|
||||
{ text = m_portRangeLineEdit->text( );
|
||||
QStringList ports = QStringList::split( "-", text );
|
||||
|
||||
if( ports.count( ) > 2 )
|
||||
{ KMessageBox::error( this, i18n( "Internal error - you seem to have been allowed to entered an illegal Port Range" ), i18n( "Internal error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
portFirst = ports.front( ).toUInt( );
|
||||
portLast = portFirst;
|
||||
|
||||
if( ports.count( ) > 1 )
|
||||
portLast = ports.back( ).toUInt( );
|
||||
|
||||
if( !portFirst || portFirst > 65535 || !portLast || portLast > 65535 || portFirst > portLast )
|
||||
{ KMessageBox::sorry( this,
|
||||
i18n( "Ports must be in the range 1 to 65,535 and ranges must be in ascending order" ),
|
||||
i18n( "Invalid Port Range" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _COMMONWIDGET_H_
|
||||
#define _COMMONWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KConfig;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QListBox;
|
||||
class QListBoxItem;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QStringList;
|
||||
|
||||
// CommonWidget class definition
|
||||
// =============================
|
||||
|
||||
class CommonWidget : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
CommonWidget( QWidget* parent, const char* name = NULL );
|
||||
virtual ~CommonWidget( );
|
||||
|
||||
void finaliseInitialisation( );
|
||||
bool getOptions( );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
void setInitialValues( );
|
||||
|
||||
QString getHostName( ) const;
|
||||
int hostCurrentItem( ) const { return m_hostCurrentItem; }
|
||||
QString host( ) const { return m_host; }
|
||||
int portRangeCurrentItem( ) const { return m_portRangeCurrentItem; }
|
||||
QStringList* portRanges( ) const { return m_portRanges; }
|
||||
bool portRangesState( ) const { return m_portRangesState; }
|
||||
bool resovleAlwaysState( ) const { return m_resovleAlwaysState; }
|
||||
bool resovleDefaultState( ) const { return m_resovleDefaultState; }
|
||||
bool resovleNeverState( ) const { return m_resovleNeverState; }
|
||||
|
||||
signals:
|
||||
void disableFastScan( );
|
||||
void displayDocBook( const QString& );
|
||||
void displayHelp( const QString& );
|
||||
void displayUnknown( );
|
||||
void optionsDirty( );
|
||||
void targetChanged( const QString& );
|
||||
|
||||
public slots:
|
||||
void slotDisablePortRanges( );
|
||||
|
||||
private slots:
|
||||
void slotHostActivated( int index );
|
||||
void slotHostButtonClicked( );
|
||||
void slotHostTextChanged( const QString& text );
|
||||
void slotPortRangeActivated( int index );
|
||||
void slotPortRangeAddClicked( );
|
||||
void slotPortRangeDeleteClicked( );
|
||||
void slotPortRangeButtonClicked( );
|
||||
void slotPortRangeDoubleClicked( QListBoxItem* item );
|
||||
void slotPortRangeHighlighted( );
|
||||
void slotPortRangesClicked( );
|
||||
void slotPortRangeTextChanged( const QString& text );
|
||||
void slotWhatsThisClicked( );
|
||||
|
||||
private:
|
||||
bool buildPortRangesTables( const boolPtr tcpPorts, const boolPtr udpPorts );
|
||||
void createLayout( );
|
||||
void enablePortRangeWidgets( );
|
||||
void getHosts( QStringList* hosts );
|
||||
void getPortRanges( QStringList* portRanges );
|
||||
bool portRangesOverlapping( const ushort portFirst, const ushort portLast );
|
||||
bool validatePortRange( QString& text );
|
||||
bool validatePortRangeText( QString& text, uint& portFirst, uint& portLast );
|
||||
|
||||
// protocol indices
|
||||
// ================
|
||||
|
||||
enum Protocol
|
||||
{ BothProtocol,
|
||||
TCPProtocol,
|
||||
UDPProtocol
|
||||
};
|
||||
|
||||
QString m_host;
|
||||
QPushButton* m_hostButton;
|
||||
QComboBox* m_hostComboBox;
|
||||
int m_hostCurrentItem;
|
||||
QStringList* m_hosts;
|
||||
QPushButton* m_portRangeAddButton;
|
||||
QPushButton* m_portRangeButton;
|
||||
QComboBox* m_portRangeComboBox;
|
||||
int m_portRangeCurrentItem;
|
||||
QPushButton* m_portRangeDeleteButton;
|
||||
bool m_portRangeIgnoreChange;
|
||||
QLineEdit* m_portRangeLineEdit;
|
||||
QListBox* m_portRangeListBox;
|
||||
QStringList* m_portRanges;
|
||||
QCheckBox* m_portRangesCheckBox;
|
||||
bool m_portRangesState;
|
||||
QRadioButton* m_resovleAlwaysRadio;
|
||||
bool m_resovleAlwaysState;
|
||||
QRadioButton* m_resovleDefaultRadio;
|
||||
bool m_resovleDefaultState;
|
||||
QRadioButton* m_resovleNeverRadio;
|
||||
bool m_resovleNeverState;
|
||||
};
|
||||
|
||||
#endif // _COMMONWIDGET_H_
|
@ -0,0 +1,682 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qiconset.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qspinbox.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "compoundwidget.h"
|
||||
#include "knmap.h"
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
CompoundWidget::CompoundWidget( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name )
|
||||
{ createLayout( );
|
||||
}
|
||||
|
||||
// createLayout
|
||||
// ============
|
||||
|
||||
void CompoundWidget::createLayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( this );
|
||||
KIconLoader* iconLoader = KGlobal::iconLoader( );
|
||||
QIconSet clearLeftIconSet = iconLoader->loadIconSet( "clear_left", KIcon::Small );
|
||||
QIconSet fileOpenIconSet = iconLoader->loadIconSet( "fileopen", KIcon::Small );
|
||||
|
||||
m_decoyButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" );
|
||||
m_excludeButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" );
|
||||
m_interfaceButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" );
|
||||
m_sourceIPButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" );
|
||||
m_spoofMacButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" );
|
||||
|
||||
m_dataDirButton = new QPushButton( fileOpenIconSet, NULL, this, "datadir button" );
|
||||
m_excludeFileButton = new QPushButton( fileOpenIconSet, NULL, this, "exclude file button" );
|
||||
m_targetFileButton = new QPushButton( fileOpenIconSet, NULL, this, "target file button" );
|
||||
|
||||
m_dataDirCheckBox = new QCheckBox( i18n( "Data directory (--datadir <name>) " ), this, "datadir checkbox" );
|
||||
m_dataLengthCheckBox = new QCheckBox( i18n( "Data length (--data_length <value>" ), this, "data length checkbox" );
|
||||
m_debugLevelCheckBox = new QCheckBox( i18n( "Debug level (-d)" ), this, "debug checkbox" );
|
||||
m_decoyCheckBox = new QCheckBox( i18n( "Decoy hosts (-D <host list>)" ), this, "decoy checkbox" );
|
||||
m_excludeCheckBox = new QCheckBox( i18n( "Exclude hosts (--exclude <hosts>) " ), this, "exclude checkbox" );
|
||||
m_excludeFileCheckBox = new QCheckBox( i18n( "Exclude file (--excludefile <path>) " ), this, "exclude checkbox" );
|
||||
m_fragmentLevelCheckBox = new QCheckBox( i18n( "Fragment level (-f)" ), this, "fragment checkbox" );
|
||||
m_interfaceCheckBox = new QCheckBox( i18n( "Interface (-e)" ), this, "interface checkbox" );
|
||||
m_maxSocketsCheckBox = new QCheckBox( i18n( "Max sockets (-M <value>)" ), this, "max sockets checkbox" );
|
||||
m_randomIPCheckBox = new QCheckBox( i18n( "Random IP scan (-iR <value>)" ), this, "random ip checkbox" );
|
||||
m_sourceIPCheckBox = new QCheckBox( i18n( "Source IP addr (-S <value>)" ), this, "source ip checkbox" );
|
||||
m_sourcePortCheckBox = new QCheckBox( i18n( "Source port (-g <value>)" ), this, "source port checkbox" );
|
||||
m_spoofMacCheckBox = new QCheckBox( i18n( "Spoof MAC addr (--spoof_mac <value>)" ), this, "spoof mac checkbox" );
|
||||
m_targetFileCheckBox = new QCheckBox( i18n( "Target hosts file (-iL <path>) " ), this, "target checkbox" );
|
||||
m_ttlCheckBox = new QCheckBox( i18n( "TTL (--ttl <value>)" ), this, "ttl checkbox" );
|
||||
|
||||
m_dataDirLineEdit = new QLineEdit( this, "datadir line edit" );
|
||||
m_decoyLineEdit = new QLineEdit( this, "decoy edit" );
|
||||
m_excludeLineEdit = new QLineEdit( this, "exclude line edit" );
|
||||
m_excludeFileLineEdit = new QLineEdit( this, "exclude file line edit" );
|
||||
m_interfaceLineEdit = new QLineEdit( this, "interface edit" );
|
||||
m_sourceIPLineEdit = new QLineEdit( this, "source ip edit" );
|
||||
m_spoofMacLineEdit = new QLineEdit( this, "spoof mac edit" );
|
||||
m_targetFileLineEdit = new QLineEdit( this, "target file line edit" );
|
||||
|
||||
m_dataLengthSpinBox = new QSpinBox( 1, 1460, 128, this, "data length spin box" );
|
||||
m_debugLevelSpinBox = new QSpinBox( 1, 5, 1, this, "debug spin box" );
|
||||
m_fragmentLevelSpinBox = new QSpinBox( 1, 2, 1, this, "fragment spin box" );
|
||||
m_maxSocketsSpinBox = new QSpinBox( 1, 999, 10, this, "max sockets spin box" );
|
||||
m_randomIPSpinBox = new QSpinBox( 1, 999, 10, this, "random ip spin box" );
|
||||
m_sourcePortSpinBox = new QSpinBox( 1, 65535, 64, this, "source port spin box" );
|
||||
m_ttlSpinBox = new QSpinBox( 1, 255, 32, this, "ttl spin box" );
|
||||
|
||||
byte row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_dataLengthCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_dataLengthSpinBox, row++, 4 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_debugLevelCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_debugLevelSpinBox, row++, 4 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 1 );
|
||||
gridLayout->addWidget( m_fragmentLevelCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_fragmentLevelSpinBox, row++, 4 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_maxSocketsCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_maxSocketsSpinBox, row++, 4 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_randomIPCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_randomIPSpinBox, row++, 4 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_sourcePortCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_sourcePortSpinBox, row++, 4 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_ttlCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_ttlSpinBox, row++, 4 );
|
||||
byte rowBlock1 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 6 );
|
||||
gridLayout->addWidget( m_decoyCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_decoyLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_decoyButton, row++, 10 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_excludeCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_excludeLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_excludeButton, row++, 10 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_interfaceCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_interfaceLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_interfaceButton, row++, 10 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_sourceIPCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_sourceIPLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_sourceIPButton, row++, 10 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_spoofMacCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_spoofMacLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_spoofMacButton, row++, 10 );
|
||||
|
||||
row++;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_excludeFileCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_excludeFileLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_excludeFileButton, row++, 10 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_dataDirCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_dataDirLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_dataDirButton, row++, 10 );
|
||||
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 6 );
|
||||
gridLayout->addWidget( m_targetFileCheckBox, row, 8 );
|
||||
gridLayout->addWidget( m_targetFileLineEdit, row, 9 );
|
||||
gridLayout->addWidget( m_targetFileButton, row++, 10 );
|
||||
byte rowBlock2 = row;
|
||||
|
||||
gridLayout->setColStretch( 0, 4 );
|
||||
gridLayout->setColStretch( 2, 1 );
|
||||
gridLayout->setColStretch( 4, 20 );
|
||||
gridLayout->setColStretch( 5, 4 );
|
||||
gridLayout->setColStretch( 7, 1 );
|
||||
gridLayout->setColStretch( 9, 20 );
|
||||
gridLayout->setColStretch( 11, 4 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 1 );
|
||||
gridLayout->setRowStretch( _max_( rowBlock1, rowBlock2 ), 1 );
|
||||
}
|
||||
|
||||
// finaliseInitialisation
|
||||
// ======================
|
||||
|
||||
void CompoundWidget::finaliseInitialisation( )
|
||||
{ WhatsThis* whatsThis = new WhatsThis( this );
|
||||
|
||||
connect( m_dataDirButton, SIGNAL( clicked( )), SLOT( slotDataDirButtonClicked( )));
|
||||
connect( m_dataDirCheckBox, SIGNAL( clicked( )), SLOT( slotDataDirCheckBoxClicked( )));
|
||||
connect( m_dataLengthCheckBox, SIGNAL( clicked( )), SLOT( slotDataLengthCheckBoxClicked( )));
|
||||
connect( m_debugLevelCheckBox, SIGNAL( clicked( )), SLOT( slotDebugLevelCheckBoxClicked( )));
|
||||
connect( m_decoyButton, SIGNAL( clicked( )), SLOT( slotDecoyButtonClicked( )));
|
||||
connect( m_decoyCheckBox, SIGNAL( clicked( )), SLOT( slotDecoyCheckBoxClicked( )));
|
||||
connect( m_excludeButton, SIGNAL( clicked( )), SLOT( slotExcludeButtonClicked( )));
|
||||
connect( m_excludeCheckBox, SIGNAL( clicked( )), SLOT( slotExcludeCheckBoxClicked( )));
|
||||
connect( m_excludeFileButton, SIGNAL( clicked( )), SLOT( slotExcludeFileButtonClicked( )));
|
||||
connect( m_excludeFileCheckBox, SIGNAL( clicked( )), SLOT( slotExcludeFileCheckBoxClicked( )));
|
||||
connect( m_fragmentLevelCheckBox, SIGNAL( clicked( )), SLOT( slotFragmentLevelCheckBoxClicked( )));
|
||||
connect( m_interfaceButton, SIGNAL( clicked( )), SLOT( slotInterfaceButtonClicked( )));
|
||||
connect( m_interfaceCheckBox, SIGNAL( clicked( )), SLOT( slotInterfaceCheckBoxClicked( )));
|
||||
connect( m_maxSocketsCheckBox, SIGNAL( clicked( )), SLOT( slotMaxSocketsCheckBoxClicked( )));
|
||||
connect( m_randomIPCheckBox, SIGNAL( clicked( )), SLOT( slotRandomIPCheckBoxClicked( )));
|
||||
connect( m_sourceIPButton, SIGNAL( clicked( )), SLOT( slotSourceIPButtonClicked( )));
|
||||
connect( m_sourceIPCheckBox, SIGNAL( clicked( )), SLOT( slotSourceIPCheckBoxClicked( )));
|
||||
connect( m_sourcePortCheckBox, SIGNAL( clicked( )), SLOT( slotSourcePortCheckBoxClicked( )));
|
||||
connect( m_spoofMacButton, SIGNAL( clicked( )), SLOT( slotSpoofMACButtonClicked( )));
|
||||
connect( m_spoofMacCheckBox, SIGNAL( clicked( )), SLOT( slotSpoofMacCheckBoxClicked( )));
|
||||
connect( m_targetFileButton, SIGNAL( clicked( )), SLOT( slotTargetFileButtonClicked( )));
|
||||
connect( m_targetFileCheckBox, SIGNAL( clicked( )), SLOT( slotTargetFileCheckBoxClicked( )));
|
||||
connect( m_ttlCheckBox, SIGNAL( clicked( )), SLOT( slotTTLCheckBoxClicked( )));
|
||||
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
|
||||
|
||||
connect( m_dataDirCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_dataDirLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_dataLengthCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_dataLengthSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_debugLevelCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_debugLevelSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_decoyCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_decoyLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_excludeCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_excludeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_excludeFileCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_excludeFileLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_fragmentLevelCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_fragmentLevelSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_interfaceCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_interfaceLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxSocketsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxSocketsSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_randomIPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_randomIPSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sourceIPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sourceIPLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sourcePortCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sourcePortSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
connect( m_spoofMacCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_spoofMacLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_targetFileCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_targetFileLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_ttlCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_ttlSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( )));
|
||||
}
|
||||
|
||||
// getOptions
|
||||
// ==========
|
||||
|
||||
bool CompoundWidget::getOptions( bool& needRoot )
|
||||
{ bool dataDirState = m_dataDirCheckBox->isChecked( );
|
||||
QString dataDirValue = m_dataDirLineEdit->text( );
|
||||
bool decoyState = m_decoyCheckBox->isChecked( );
|
||||
QString decoyValue = m_decoyLineEdit->text( );
|
||||
bool excludeState = m_excludeCheckBox->isChecked( );
|
||||
QString excludeValue = m_excludeLineEdit->text( );
|
||||
bool excludeFileState = m_excludeFileCheckBox->isChecked( );
|
||||
QString excludeFileValue = m_excludeFileLineEdit->text( );
|
||||
bool interfaceState = m_interfaceCheckBox->isChecked( );
|
||||
QString interfaceValue = m_interfaceLineEdit->text( );
|
||||
bool sourceIPState = m_sourceIPCheckBox->isChecked( );
|
||||
QString sourceIPValue = m_sourceIPLineEdit->text( );
|
||||
bool spoofMacState = m_spoofMacCheckBox->isChecked( );
|
||||
QString spoofMacValue = m_spoofMacLineEdit->text( );
|
||||
bool targetFileState = m_targetFileCheckBox->isChecked( );
|
||||
QString targetFileValue = m_targetFileLineEdit->text( );
|
||||
|
||||
if( dataDirState && dataDirValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Data directory name not specified" )), i18n( "Data directory name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( decoyState && decoyValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Decoy host list not specified" )), i18n( "Decoy hosts error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( excludeState && excludeValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Exclude hosts not specified" )), i18n( "Exclude hosts error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( excludeFileState && excludeFileValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Exclude hosts file name not specified" )), i18n( "Exclude hosts file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( interfaceState && interfaceValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Interface name not specified" )), i18n( "Interface name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( sourceIPState && sourceIPValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Source IP address not specified" )), i18n( "Source IP address error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( spoofMacState && spoofMacValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Spoof MAC address not specified" )), i18n( "Spoof MAC address error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( targetFileState && targetFileValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Target hosts file name not specified" )), i18n( "Target hosts file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dataDirState = dataDirState;
|
||||
m_dataDirValue = dataDirValue;
|
||||
m_dataLengthState = m_dataLengthCheckBox->isChecked( );
|
||||
m_dataLengthValue = m_dataLengthSpinBox->value( );
|
||||
m_debugLevelState = m_debugLevelCheckBox->isChecked( );
|
||||
m_debugLevelValue = m_debugLevelSpinBox->value( );
|
||||
m_decoyState = decoyState;
|
||||
m_decoyValue = decoyValue;
|
||||
m_excludeState = excludeState;
|
||||
m_excludeValue = excludeValue;
|
||||
m_excludeFileState = excludeFileState;
|
||||
m_excludeFileValue = excludeFileValue;
|
||||
m_fragmentLevelState = m_fragmentLevelCheckBox->isChecked( );
|
||||
m_fragmentLevelValue = m_fragmentLevelSpinBox->value( );
|
||||
m_interfaceState = interfaceState;
|
||||
m_interfaceValue = interfaceValue;
|
||||
m_maxSocketsState = m_maxSocketsCheckBox->isChecked( );
|
||||
m_maxSocketsValue = m_maxSocketsSpinBox->value( );
|
||||
m_randomIPState = m_randomIPCheckBox->isChecked( );
|
||||
m_randomIPValue = m_randomIPSpinBox->value( );
|
||||
m_sourceIPState = sourceIPState;
|
||||
m_sourceIPValue = sourceIPValue;
|
||||
m_sourcePortState = m_sourcePortCheckBox->isChecked( );
|
||||
m_sourcePortValue = m_sourcePortSpinBox->value( );
|
||||
m_spoofMacState = spoofMacState;
|
||||
m_spoofMacValue = spoofMacValue;
|
||||
m_targetFileState = targetFileState;
|
||||
m_targetFileValue = targetFileValue;
|
||||
m_ttlState = m_ttlCheckBox->isChecked( );
|
||||
m_ttlValue = m_ttlSpinBox->value( );
|
||||
|
||||
needRoot = needRoot || m_decoyState || m_fragmentLevelState;
|
||||
return true;
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void CompoundWidget::readProfile( KConfig* config )
|
||||
{ m_dataDirState = config->readBoolEntry( "dataDirState" );
|
||||
m_dataDirValue = config->readEntry( "dataDirValue" );
|
||||
m_dataLengthState = config->readBoolEntry( "dataLengthState" );
|
||||
m_dataLengthValue = config->readNumEntry( "dataLengthValue", 40 );
|
||||
m_debugLevelState = config->readBoolEntry( "debugLevelState" );
|
||||
m_debugLevelValue = config->readNumEntry( "debugLevelValue" );
|
||||
m_decoyState = config->readBoolEntry( "decoyState" );
|
||||
m_decoyValue = config->readEntry( "decoyValue" );
|
||||
m_excludeState = config->readBoolEntry( "excludeState" );
|
||||
m_excludeValue = config->readEntry( "excludeValue" );
|
||||
m_excludeFileState = config->readBoolEntry( "excludeFileState" );
|
||||
m_excludeFileValue = config->readEntry( "excludeFileValue" );
|
||||
m_fragmentLevelState = config->readBoolEntry( "fragmentLevelState" );
|
||||
m_fragmentLevelValue = config->readNumEntry( "fragmentLevelValue" );
|
||||
m_interfaceState = config->readBoolEntry( "interfaceState" );
|
||||
m_interfaceValue = config->readEntry( "interfaceValue" );
|
||||
m_maxSocketsState = config->readBoolEntry( "maxSocketsState" );
|
||||
m_maxSocketsValue = config->readNumEntry( "maxSocketsValue" );
|
||||
m_randomIPState = config->readBoolEntry( "randomIPState" );
|
||||
m_randomIPValue = config->readNumEntry( "randomIPValue" );
|
||||
m_sourceIPState = config->readBoolEntry( "sourceIPState" );
|
||||
m_sourceIPValue = config->readEntry( "sourceIPValue" );
|
||||
m_sourcePortState = config->readBoolEntry( "sourcePortState" );
|
||||
m_sourcePortValue = config->readNumEntry( "sourcePortValue" );
|
||||
m_spoofMacState = config->readBoolEntry( "spoofMacState" );
|
||||
m_spoofMacValue = config->readEntry( "spoofMacValue" );
|
||||
m_targetFileState = config->readBoolEntry( "targetFileState" );
|
||||
m_targetFileValue = config->readEntry( "targetFileValue" );
|
||||
m_ttlState = config->readBoolEntry( "ttlState" );
|
||||
m_ttlValue = config->readNumEntry( "ttlValue" );
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void CompoundWidget::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "dataDirState", m_dataDirState );
|
||||
config->writeEntry( "dataDirValue", m_dataDirValue );
|
||||
config->writeEntry( "dataLengthState", m_dataLengthState );
|
||||
config->writeEntry( "dataLengthValue", m_dataLengthValue );
|
||||
config->writeEntry( "debugLevelState", m_debugLevelState );
|
||||
config->writeEntry( "debugLevelValue", m_debugLevelValue );
|
||||
config->writeEntry( "decoyState", m_decoyState );
|
||||
config->writeEntry( "decoyValue", m_decoyValue );
|
||||
config->writeEntry( "excludeState", m_excludeState );
|
||||
config->writeEntry( "excludeValue", m_excludeValue );
|
||||
config->writeEntry( "excludeFileState", m_excludeFileState );
|
||||
config->writeEntry( "excludeFileValue", m_excludeFileValue );
|
||||
config->writeEntry( "fragmentLevelState", m_fragmentLevelState );
|
||||
config->writeEntry( "fragmentLevelValue", m_fragmentLevelValue );
|
||||
config->writeEntry( "interfaceState", m_interfaceState );
|
||||
config->writeEntry( "interfaceValue", m_interfaceValue );
|
||||
config->writeEntry( "maxSocketsState", m_maxSocketsState );
|
||||
config->writeEntry( "maxSocketsValue", m_maxSocketsValue );
|
||||
config->writeEntry( "randomIPState", m_randomIPState );
|
||||
config->writeEntry( "randomIPValue", m_randomIPValue );
|
||||
config->writeEntry( "sourceIPState", m_sourceIPState );
|
||||
config->writeEntry( "sourceIPValue", m_sourceIPValue );
|
||||
config->writeEntry( "sourcePortState", m_sourcePortState );
|
||||
config->writeEntry( "sourcePortValue", m_sourcePortValue );
|
||||
config->writeEntry( "spoofMacState", m_spoofMacState );
|
||||
config->writeEntry( "spoofMacValue", m_spoofMacValue );
|
||||
config->writeEntry( "targetFileState", m_targetFileState );
|
||||
config->writeEntry( "targetFileValue", m_targetFileValue );
|
||||
config->writeEntry( "ttlState", m_ttlState );
|
||||
config->writeEntry( "ttlValue", m_ttlValue );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void CompoundWidget::setInitialValues( )
|
||||
{ m_dataDirCheckBox->setChecked( m_dataDirState );
|
||||
m_dataDirLineEdit->setText( m_dataDirValue );
|
||||
m_dataLengthCheckBox->setChecked( m_dataLengthState );
|
||||
m_dataLengthSpinBox->setValue( m_dataLengthValue );
|
||||
m_debugLevelCheckBox->setChecked( m_debugLevelState );
|
||||
m_debugLevelSpinBox->setValue( m_debugLevelValue );
|
||||
m_decoyCheckBox->setChecked( m_decoyState );
|
||||
m_decoyLineEdit->setText( m_decoyValue );
|
||||
m_excludeCheckBox->setChecked( m_excludeState );
|
||||
m_excludeLineEdit->setText( m_excludeValue );
|
||||
m_excludeFileCheckBox->setChecked( m_excludeFileState );
|
||||
m_excludeFileLineEdit->setText( m_excludeFileValue );
|
||||
m_fragmentLevelCheckBox->setChecked( m_fragmentLevelState );
|
||||
m_fragmentLevelSpinBox->setValue( m_fragmentLevelValue );
|
||||
m_interfaceCheckBox->setChecked( m_interfaceState );
|
||||
m_interfaceLineEdit->setText( m_interfaceValue );
|
||||
m_maxSocketsCheckBox->setChecked( m_maxSocketsState );
|
||||
m_maxSocketsSpinBox->setValue( m_maxSocketsValue );
|
||||
m_randomIPCheckBox->setChecked( m_randomIPState );
|
||||
m_randomIPSpinBox->setValue( m_randomIPValue );
|
||||
m_sourceIPCheckBox->setChecked( m_sourceIPState );
|
||||
m_sourceIPLineEdit->setText( m_sourceIPValue );
|
||||
m_sourcePortCheckBox->setChecked( m_sourcePortState );
|
||||
m_sourcePortSpinBox->setValue( m_sourcePortValue );
|
||||
m_spoofMacCheckBox->setChecked( m_spoofMacState );
|
||||
m_spoofMacLineEdit->setText( m_spoofMacValue );
|
||||
m_targetFileCheckBox->setChecked( m_targetFileState );
|
||||
m_targetFileLineEdit->setText( m_targetFileValue );
|
||||
m_ttlCheckBox->setChecked( m_ttlState );
|
||||
m_ttlSpinBox->setValue( m_ttlValue );
|
||||
|
||||
slotDataDirCheckBoxClicked( );
|
||||
slotDataLengthCheckBoxClicked( );
|
||||
slotDebugLevelCheckBoxClicked( );
|
||||
slotDecoyCheckBoxClicked( );
|
||||
slotExcludeCheckBoxClicked( );
|
||||
slotExcludeFileCheckBoxClicked( );
|
||||
slotFragmentLevelCheckBoxClicked( );
|
||||
slotInterfaceCheckBoxClicked( );
|
||||
slotMaxSocketsCheckBoxClicked( );
|
||||
slotRandomIPCheckBoxClicked( );
|
||||
slotSourceIPCheckBoxClicked( );
|
||||
slotSourcePortCheckBoxClicked( );
|
||||
slotSpoofMacCheckBoxClicked( );
|
||||
slotTargetFileCheckBoxClicked( );
|
||||
slotTTLCheckBoxClicked( );
|
||||
}
|
||||
|
||||
// slotDataDirButtonClicked
|
||||
// ========================
|
||||
|
||||
void CompoundWidget::slotDataDirButtonClicked( )
|
||||
{ Knmap::getDirPath( "Data directory", m_dataDirValue, m_dataDirLineEdit );
|
||||
}
|
||||
|
||||
// slotDataDirCheckBoxClicked
|
||||
// ==========================
|
||||
|
||||
void CompoundWidget::slotDataDirCheckBoxClicked( )
|
||||
{ m_dataDirButton->setEnabled( m_dataDirCheckBox->isChecked( ));
|
||||
m_dataDirLineEdit->setEnabled( m_dataDirCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotDataLengthCheckBoxClicked
|
||||
// =============================
|
||||
|
||||
void CompoundWidget::slotDataLengthCheckBoxClicked( )
|
||||
{ m_dataLengthSpinBox->setEnabled( m_dataLengthCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotDebugLevelCheckBoxClicked
|
||||
// =============================
|
||||
|
||||
void CompoundWidget::slotDebugLevelCheckBoxClicked( )
|
||||
{ m_debugLevelSpinBox->setEnabled( m_debugLevelCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotDecoyButtonClicked
|
||||
// ======================
|
||||
|
||||
void CompoundWidget::slotDecoyButtonClicked( )
|
||||
{ m_decoyLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotDecoyCheckBoxClicked
|
||||
// ========================
|
||||
|
||||
void CompoundWidget::slotDecoyCheckBoxClicked( )
|
||||
{ m_decoyButton->setEnabled( m_decoyCheckBox->isChecked( ));
|
||||
m_decoyLineEdit->setEnabled( m_decoyCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotExcludeButtonClicked
|
||||
// ========================
|
||||
|
||||
void CompoundWidget::slotExcludeButtonClicked( )
|
||||
{ m_excludeLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotExcludeCheckBoxClicked
|
||||
// ==========================
|
||||
|
||||
void CompoundWidget::slotExcludeCheckBoxClicked( )
|
||||
{ m_excludeButton->setEnabled( m_excludeCheckBox->isChecked( ));
|
||||
m_excludeLineEdit->setEnabled( m_excludeCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotExcludeFileButtonClicked
|
||||
// ============================
|
||||
|
||||
void CompoundWidget::slotExcludeFileButtonClicked( )
|
||||
{ Knmap::getFilePath( "Exclude hosts file", m_excludeFileValue, m_excludeFileLineEdit, false );
|
||||
}
|
||||
|
||||
// slotExcludeFileCheckBoxClicked
|
||||
// ==============================
|
||||
|
||||
void CompoundWidget::slotExcludeFileCheckBoxClicked( )
|
||||
{ m_excludeFileButton->setEnabled( m_excludeFileCheckBox->isChecked( ));
|
||||
m_excludeFileLineEdit->setEnabled( m_excludeFileCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotFragmentLevelCheckBoxClicked
|
||||
// ================================
|
||||
|
||||
void CompoundWidget::slotFragmentLevelCheckBoxClicked( )
|
||||
{ m_fragmentLevelSpinBox->setEnabled( m_fragmentLevelCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotInterfaceButtonClicked
|
||||
// ==========================
|
||||
|
||||
void CompoundWidget::slotInterfaceButtonClicked( )
|
||||
{ m_interfaceLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotInterfaceCheckBoxClicked
|
||||
// ============================
|
||||
|
||||
void CompoundWidget::slotInterfaceCheckBoxClicked( )
|
||||
{ m_interfaceButton->setEnabled( m_interfaceCheckBox->isChecked( ));
|
||||
m_interfaceLineEdit->setEnabled( m_interfaceCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMaxSocketsCheckBoxClicked
|
||||
// =============================
|
||||
|
||||
void CompoundWidget::slotMaxSocketsCheckBoxClicked( )
|
||||
{ m_maxSocketsSpinBox->setEnabled( m_maxSocketsCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotRandomIPCheckBoxClicked
|
||||
// ===========================
|
||||
|
||||
void CompoundWidget::slotRandomIPCheckBoxClicked( )
|
||||
{ m_randomIPSpinBox->setEnabled( m_randomIPCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotSourceIPButtonClicked
|
||||
// =========================
|
||||
|
||||
void CompoundWidget::slotSourceIPButtonClicked( )
|
||||
{ m_sourceIPLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotSourceIPCheckBoxClicked
|
||||
// ===========================
|
||||
|
||||
void CompoundWidget::slotSourceIPCheckBoxClicked( )
|
||||
{ m_sourceIPButton->setEnabled( m_sourceIPCheckBox->isChecked( ));
|
||||
m_sourceIPLineEdit->setEnabled( m_sourceIPCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotSourcePortCheckBoxClicked
|
||||
// =============================
|
||||
|
||||
void CompoundWidget::slotSourcePortCheckBoxClicked( )
|
||||
{ m_sourcePortSpinBox->setEnabled( m_sourcePortCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotSpoofMACButtonClicked
|
||||
// =========================
|
||||
|
||||
void CompoundWidget::slotSpoofMACButtonClicked( )
|
||||
{ m_spoofMacLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotSpoofMacCheckBoxClicked
|
||||
// ===========================
|
||||
|
||||
void CompoundWidget::slotSpoofMacCheckBoxClicked( )
|
||||
{ m_spoofMacButton->setEnabled( m_spoofMacCheckBox->isChecked( ));
|
||||
m_spoofMacLineEdit->setEnabled( m_spoofMacCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotTargetFileButtonClicked
|
||||
// ===========================
|
||||
|
||||
void CompoundWidget::slotTargetFileButtonClicked( )
|
||||
{ Knmap::getFilePath( "Target hosts file", m_targetFileValue, m_targetFileLineEdit, false );
|
||||
}
|
||||
|
||||
// slotTargetFileCheckBoxClicked
|
||||
// =============================
|
||||
|
||||
void CompoundWidget::slotTargetFileCheckBoxClicked( )
|
||||
{ m_targetFileButton->setEnabled( m_targetFileCheckBox->isChecked( ));
|
||||
m_targetFileLineEdit->setEnabled( m_targetFileCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotTTLCheckBoxClicked
|
||||
// ======================
|
||||
|
||||
void CompoundWidget::slotTTLCheckBoxClicked( )
|
||||
{ m_ttlSpinBox->setEnabled( m_ttlCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotWhatsThisClicked
|
||||
// ====================
|
||||
|
||||
void CompoundWidget::slotWhatsThisClicked( )
|
||||
{ if( m_dataDirButton->hasMouse( )) emit( displayHelp( "--datadir" ));
|
||||
else if( m_dataDirCheckBox->hasMouse( )) emit( displayHelp( "--datadir" ));
|
||||
else if( m_dataDirLineEdit->hasMouse( )) emit( displayHelp( "--datadir" ));
|
||||
else if( m_dataLengthCheckBox->hasMouse( )) emit( displayHelp( "--data_length" ));
|
||||
else if( m_dataLengthSpinBox->hasMouse( )) emit( displayHelp( "--data_length" ));
|
||||
else if( m_decoyButton->hasMouse( )) emit( displayHelp( "-D" ));
|
||||
else if( m_decoyCheckBox->hasMouse( )) emit( displayHelp( "-D" ));
|
||||
else if( m_decoyLineEdit->hasMouse( )) emit( displayHelp( "-D" ));
|
||||
else if( m_debugLevelCheckBox->hasMouse( )) emit( displayHelp( "-d" ));
|
||||
else if( m_debugLevelSpinBox->hasMouse( )) emit( displayHelp( "-d" ));
|
||||
else if( m_excludeButton->hasMouse( )) emit( displayHelp( "--exclude" ));
|
||||
else if( m_excludeCheckBox->hasMouse( )) emit( displayHelp( "--exclude" ));
|
||||
else if( m_excludeLineEdit->hasMouse( )) emit( displayHelp( "--exclude" ));
|
||||
else if( m_excludeFileButton->hasMouse( )) emit( displayHelp( "--exclude" ));
|
||||
else if( m_excludeFileCheckBox->hasMouse( )) emit( displayHelp( "--exclude" ));
|
||||
else if( m_excludeFileLineEdit->hasMouse( )) emit( displayHelp( "--exclude" ));
|
||||
else if( m_fragmentLevelCheckBox->hasMouse( )) emit( displayHelp( "-f" ));
|
||||
else if( m_fragmentLevelSpinBox->hasMouse( )) emit( displayHelp( "-f" ));
|
||||
else if( m_interfaceButton->hasMouse( )) emit( displayHelp( "-e" ));
|
||||
else if( m_interfaceCheckBox->hasMouse( )) emit( displayHelp( "-e" ));
|
||||
else if( m_interfaceLineEdit->hasMouse( )) emit( displayHelp( "-e" ));
|
||||
else if( m_maxSocketsCheckBox->hasMouse( )) emit( displayHelp( "-M" ));
|
||||
else if( m_maxSocketsSpinBox->hasMouse( )) emit( displayHelp( "-M" ));
|
||||
else if( m_randomIPCheckBox->hasMouse( )) emit( displayHelp( "-iR" ));
|
||||
else if( m_randomIPSpinBox->hasMouse( )) emit( displayHelp( "-iR" ));
|
||||
else if( m_sourceIPButton->hasMouse( )) emit( displayHelp( "-S" ));
|
||||
else if( m_sourceIPCheckBox->hasMouse( )) emit( displayHelp( "-S" ));
|
||||
else if( m_sourceIPLineEdit->hasMouse( )) emit( displayHelp( "-S" ));
|
||||
else if( m_sourcePortCheckBox->hasMouse( )) emit( displayHelp( "--source_port" ));
|
||||
else if( m_sourcePortSpinBox->hasMouse( )) emit( displayHelp( "--source_port" ));
|
||||
else if( m_spoofMacButton->hasMouse( )) emit( displayHelp( "--spoof_mac" ));
|
||||
else if( m_spoofMacCheckBox->hasMouse( )) emit( displayHelp( "--spoof_mac" ));
|
||||
else if( m_spoofMacLineEdit->hasMouse( )) emit( displayHelp( "--spoof_mac" ));
|
||||
else if( m_targetFileButton->hasMouse( )) emit( displayHelp( "-iL" ));
|
||||
else if( m_targetFileCheckBox->hasMouse( )) emit( displayHelp( "-iL" ));
|
||||
else if( m_targetFileLineEdit->hasMouse( )) emit( displayHelp( "-iL" ));
|
||||
else if( m_ttlCheckBox->hasMouse( )) emit( displayHelp( "--ttl" ));
|
||||
else if( m_ttlSpinBox->hasMouse( )) emit( displayHelp( "--ttl" ));
|
||||
else emit( displayUnknown( ));
|
||||
}
|
@ -0,0 +1,192 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef _COMPOUNDWIDGET_H_
|
||||
#define _COMPOUNDWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KConfig;
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QSpinBox;
|
||||
|
||||
// CompountWidget class definition
|
||||
// ===============================
|
||||
|
||||
class CompoundWidget : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
CompoundWidget( QWidget* parent, const char* name = NULL );
|
||||
|
||||
void finaliseInitialisation( );
|
||||
bool getOptions( bool& needRoot );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
void setInitialValues( );
|
||||
|
||||
bool dataDirState( ) const { return m_dataDirState; }
|
||||
QString dataDirValue( ) const { return m_dataDirValue; }
|
||||
bool dataLengthState( ) const { return m_dataLengthState; }
|
||||
int dataLengthValue( ) const { return m_dataLengthValue; }
|
||||
bool decoyState( ) const { return m_decoyState; }
|
||||
QString decoyValue( ) const { return m_decoyValue; }
|
||||
bool debugLevelState( ) const { return m_debugLevelState; }
|
||||
int debugLevelValue( ) const { return m_debugLevelValue; }
|
||||
bool excludeState( ) const { return m_excludeState; }
|
||||
QString excludeValue( ) const { return m_excludeValue; }
|
||||
bool excludeFileState( ) const { return m_excludeFileState; }
|
||||
QString excludeFileValue( ) const { return m_excludeFileValue; }
|
||||
bool fragmentLevelState( ) const { return m_fragmentLevelState; }
|
||||
int fragmentLevelValue( ) const { return m_fragmentLevelValue; }
|
||||
bool interfaceState( ) const { return m_interfaceState; }
|
||||
QString interfaceValue( ) const { return m_interfaceValue; }
|
||||
bool maxSocketsState( ) const { return m_maxSocketsState; }
|
||||
int maxSocketsValue( ) const { return m_maxSocketsValue; }
|
||||
bool randomIPState( ) const { return m_randomIPState; }
|
||||
int randomIPValue( ) const { return m_randomIPValue; }
|
||||
bool sourceIPState( ) const { return m_sourceIPState; }
|
||||
QString sourceIPValue( ) const { return m_sourceIPValue; }
|
||||
bool sourcePortState( ) const { return m_sourcePortState; }
|
||||
int sourcePortValue( ) const { return m_sourcePortValue; }
|
||||
bool spoofMacState( ) const { return m_spoofMacState; }
|
||||
QString spoofMacValue( ) const { return m_spoofMacValue; }
|
||||
bool targetFileState( ) const { return m_targetFileState; }
|
||||
QString targetFileValue( ) const { return m_targetFileValue; }
|
||||
bool ttlState( ) const { return m_ttlState; }
|
||||
int ttlValue( ) const { return m_ttlValue; }
|
||||
|
||||
signals:
|
||||
void displayDocBook( const QString& );
|
||||
void displayHelp( const QString& );
|
||||
void displayUnknown( );
|
||||
void optionsDirty( );
|
||||
|
||||
private slots:
|
||||
void slotDataDirButtonClicked( );
|
||||
void slotDataDirCheckBoxClicked( );
|
||||
void slotDataLengthCheckBoxClicked( );
|
||||
void slotDebugLevelCheckBoxClicked( );
|
||||
void slotDecoyButtonClicked( );
|
||||
void slotDecoyCheckBoxClicked( );
|
||||
void slotExcludeButtonClicked( );
|
||||
void slotExcludeCheckBoxClicked( );
|
||||
void slotExcludeFileButtonClicked( );
|
||||
void slotExcludeFileCheckBoxClicked( );
|
||||
void slotFragmentLevelCheckBoxClicked( );
|
||||
void slotInterfaceButtonClicked( );
|
||||
void slotInterfaceCheckBoxClicked( );
|
||||
void slotMaxSocketsCheckBoxClicked( );
|
||||
void slotRandomIPCheckBoxClicked( );
|
||||
void slotSourceIPButtonClicked( );
|
||||
void slotSourceIPCheckBoxClicked( );
|
||||
void slotSourcePortCheckBoxClicked( );
|
||||
void slotSpoofMACButtonClicked( );
|
||||
void slotSpoofMacCheckBoxClicked( );
|
||||
void slotTargetFileButtonClicked( );
|
||||
void slotTargetFileCheckBoxClicked( );
|
||||
void slotTTLCheckBoxClicked( );
|
||||
void slotWhatsThisClicked( );
|
||||
|
||||
private:
|
||||
void createLayout( );
|
||||
|
||||
QPushButton* m_dataDirButton;
|
||||
QCheckBox* m_dataDirCheckBox;
|
||||
QLineEdit* m_dataDirLineEdit;
|
||||
bool m_dataDirState;
|
||||
QString m_dataDirValue;
|
||||
QCheckBox* m_dataLengthCheckBox;
|
||||
QSpinBox* m_dataLengthSpinBox;
|
||||
bool m_dataLengthState;
|
||||
int m_dataLengthValue;
|
||||
QPushButton* m_decoyButton;
|
||||
QCheckBox* m_decoyCheckBox;
|
||||
QLineEdit* m_decoyLineEdit;
|
||||
bool m_decoyState;
|
||||
QString m_decoyValue;
|
||||
QCheckBox* m_debugLevelCheckBox;
|
||||
QSpinBox* m_debugLevelSpinBox;
|
||||
bool m_debugLevelState;
|
||||
int m_debugLevelValue;
|
||||
QPushButton* m_excludeButton;
|
||||
QCheckBox* m_excludeCheckBox;
|
||||
QLineEdit* m_excludeLineEdit;
|
||||
bool m_excludeState;
|
||||
QString m_excludeValue;
|
||||
QPushButton* m_excludeFileButton;
|
||||
QCheckBox* m_excludeFileCheckBox;
|
||||
QLineEdit* m_excludeFileLineEdit;
|
||||
bool m_excludeFileState;
|
||||
QString m_excludeFileValue;
|
||||
QCheckBox* m_fragmentLevelCheckBox;
|
||||
QSpinBox* m_fragmentLevelSpinBox;
|
||||
bool m_fragmentLevelState;
|
||||
int m_fragmentLevelValue;
|
||||
QPushButton* m_interfaceButton;
|
||||
QCheckBox* m_interfaceCheckBox;
|
||||
QLineEdit* m_interfaceLineEdit;
|
||||
bool m_interfaceState;
|
||||
QString m_interfaceValue;
|
||||
QCheckBox* m_maxSocketsCheckBox;
|
||||
QSpinBox* m_maxSocketsSpinBox;
|
||||
bool m_maxSocketsState;
|
||||
int m_maxSocketsValue;
|
||||
QCheckBox* m_randomIPCheckBox;
|
||||
QSpinBox* m_randomIPSpinBox;
|
||||
bool m_randomIPState;
|
||||
int m_randomIPValue;
|
||||
QPushButton* m_sourceIPButton;
|
||||
QCheckBox* m_sourceIPCheckBox;
|
||||
QLineEdit* m_sourceIPLineEdit;
|
||||
bool m_sourceIPState;
|
||||
QString m_sourceIPValue;
|
||||
QCheckBox* m_sourcePortCheckBox;
|
||||
QSpinBox* m_sourcePortSpinBox;
|
||||
bool m_sourcePortState;
|
||||
int m_sourcePortValue;
|
||||
QPushButton* m_spoofMacButton;
|
||||
QCheckBox* m_spoofMacCheckBox;
|
||||
QLineEdit* m_spoofMacLineEdit;
|
||||
bool m_spoofMacState;
|
||||
QString m_spoofMacValue;
|
||||
QPushButton* m_targetFileButton;
|
||||
QCheckBox* m_targetFileCheckBox;
|
||||
QLineEdit* m_targetFileLineEdit;
|
||||
bool m_targetFileState;
|
||||
QString m_targetFileValue;
|
||||
QCheckBox* m_ttlCheckBox;
|
||||
QSpinBox* m_ttlSpinBox;
|
||||
bool m_ttlState;
|
||||
int m_ttlValue;
|
||||
};
|
||||
|
||||
#endif // _COMPOUNDWIDGET_H_
|
@ -0,0 +1,60 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _GLOBAL_H_
|
||||
#define _GLOBAL_H_
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class NmapOutputBuffer;
|
||||
class ScanMonitorEvent;
|
||||
|
||||
// typedef's
|
||||
// =========
|
||||
|
||||
typedef bool* boolPtr;
|
||||
typedef unsigned char byte;
|
||||
typedef NmapOutputBuffer* nobPtr;
|
||||
typedef ScanMonitorEvent* smePtr;
|
||||
typedef char* string;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
|
||||
// macros
|
||||
// ======
|
||||
|
||||
#define _max_( a, b ) (a > b ? a : b)
|
||||
#define _min_( a, b ) (a < b ? a : b)
|
||||
|
||||
// general shit
|
||||
// ============
|
||||
|
||||
const char DEFAULT_PROFILE[] = "Knmap_Default"; // bloody obvious
|
||||
const char DEFAULT_SCAN_NAME[] = "Target host"; // used to auto-name scan widgets
|
||||
const char DOCBOOK[] = "docbook"; // used to determine if documentation exists in the nmap html widget
|
||||
const byte MAX_HOST_HISTORY = 10; // the maximum number of hosts that we will remember
|
||||
const char PROFILE_PREFIX[] = "Knmap_"; // wot's in the from of all our profile names
|
||||
const uint ZOOM_MAX_FACTOR = 300; // for the HTML page
|
||||
const uint ZOOM_MIN_FACTOR = 20; // for the HTML page
|
||||
|
||||
#endif // _GLOBAL_H_
|
After Width: | Height: | Size: 750 B |
After Width: | Height: | Size: 641 B |
After Width: | Height: | Size: 640 B |
After Width: | Height: | Size: 649 B |
After Width: | Height: | Size: 539 B |
After Width: | Height: | Size: 537 B |
After Width: | Height: | Size: 541 B |
After Width: | Height: | Size: 705 B |
After Width: | Height: | Size: 755 B |
After Width: | Height: | Size: 617 B |
After Width: | Height: | Size: 664 B |
After Width: | Height: | Size: 577 B |
After Width: | Height: | Size: 532 B |
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 647 B |
After Width: | Height: | Size: 705 B |
After Width: | Height: | Size: 794 B |
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 881 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 820 B |
After Width: | Height: | Size: 620 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,366 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qfile.h>
|
||||
#include <qtextstream.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <khtml_part.h>
|
||||
#include <khtmlview.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kprocess.h>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
#include "htmlwidget.h"
|
||||
#include "knmap.h"
|
||||
#include "stylesheetdialog.h"
|
||||
|
||||
const float HTMLWidget::m_zoomIncrement = 25;
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
HTMLWidget::HTMLWidget( QStringList* stylesheetURLs, QWidget* parent, const char* name )
|
||||
: QWidget( parent, name ),
|
||||
m_dlg( NULL ),
|
||||
m_process( NULL ),
|
||||
m_stylesheetURLs( stylesheetURLs ),
|
||||
m_zoomFactor( 100 )
|
||||
{ m_htmlPart = new KHTMLPart( this, "html part" );
|
||||
m_htmlPart->setOnlyLocalReferences( true );
|
||||
}
|
||||
|
||||
// destructor
|
||||
// ==========
|
||||
|
||||
HTMLWidget::~HTMLWidget( )
|
||||
{ if( m_dlg != NULL )
|
||||
delete m_dlg;
|
||||
|
||||
if( m_process != NULL )
|
||||
delete m_process;
|
||||
}
|
||||
|
||||
// gotoAnchor
|
||||
// ==========
|
||||
|
||||
void HTMLWidget::gotoAnchor( const QString& anchor )
|
||||
{ if( !m_htmlPart->gotoAnchor( anchor ))
|
||||
KMessageBox::sorry( this, i18n( "There does not appear to be ANY help available for the item you requested.\nSorry! Now piss off and stop bothering me.\nYou stink.\nYou've got bad breath.\nYour ugly.\nNobody loves you.\nNow for your bad points..." ), i18n( "No help available in Knmap page" ));
|
||||
}
|
||||
|
||||
// loadKnmapManPage
|
||||
// ================
|
||||
|
||||
void HTMLWidget::loadKnmapManPage( )
|
||||
{ if( !tryKnmapFile( ))
|
||||
{ m_htmlPart->begin( );
|
||||
m_htmlPart->write( i18n( "<h1 align=center>Missing File</h1>" ));
|
||||
m_htmlPart->write( i18n( "<p align=center>The file <b>knmap/nmap_manpage.html</b>, which is part of the <i>Knmap</i> package, could not be found." ));
|
||||
m_htmlPart->write(i18n( "<p align=center>As a result, the prepackaged <code>man</code> page for <i>Knmap</i> is not available." ));
|
||||
m_htmlPart->write( i18n( "<p align=center>You may be able to view your local <code>man</code> page for <i>nmap</i> by selecting <b>Settings / Use local man page</b>" ));
|
||||
m_htmlPart->end( );
|
||||
}
|
||||
|
||||
m_htmlPart->setUserStyleSheet( m_stylesheetURL );
|
||||
m_htmlPart->setZoomFactor( int( m_zoomFactor ));
|
||||
}
|
||||
|
||||
// loadLocalManPage
|
||||
// ================
|
||||
|
||||
void HTMLWidget::loadLocalManPage( )
|
||||
{ m_process = new KProcess( );
|
||||
*m_process << "man";
|
||||
*m_process << "-w";
|
||||
*m_process << "nmap";
|
||||
|
||||
connect( m_process, SIGNAL( processExited( KProcess* )), SLOT( slotManProcessExited( )));
|
||||
connect( m_process, SIGNAL( receivedStdout( KProcess*, char*, int )), SLOT( slotManReceivedStdout( KProcess*, char*, int )));
|
||||
|
||||
m_manPagePath = QString::null;
|
||||
m_process->start( KProcess::NotifyOnExit, KProcess::Stdout );
|
||||
}
|
||||
|
||||
// loadManPage
|
||||
// ===========
|
||||
|
||||
void HTMLWidget::loadManPage( const bool localManPage )
|
||||
{ if( localManPage )
|
||||
loadLocalManPage( );
|
||||
else
|
||||
loadKnmapManPage( );
|
||||
}
|
||||
|
||||
// readSettings
|
||||
// ============
|
||||
|
||||
void HTMLWidget::readSettings( )
|
||||
{ KConfig* config = kapp->config( );
|
||||
config->setGroup( "General" );
|
||||
m_zoomFactor = config->readDoubleNumEntry( "zoomFactor", 100.0 );
|
||||
m_stylesheetURL.setPath( config->readPathEntry( "stylesheetURL" ));
|
||||
}
|
||||
|
||||
// resizeEvent
|
||||
// ===========
|
||||
|
||||
void HTMLWidget::resizeEvent( QResizeEvent* event )
|
||||
{ QWidget::resizeEvent( event );
|
||||
m_htmlPart->view( )->resize( width( ), height( ));
|
||||
}
|
||||
|
||||
// saveSettings
|
||||
// ============
|
||||
|
||||
void HTMLWidget::saveSettings( )
|
||||
{ KConfig* config = kapp->config( );
|
||||
config->setGroup( "General" );
|
||||
config->writeEntry( "stylesheetURL", m_stylesheetURL.path( ));
|
||||
config->writeEntry( "zoomFactor", m_zoomFactor );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void HTMLWidget::setInitialValues( )
|
||||
{ m_htmlPart->setUserStyleSheet( m_stylesheetURL );
|
||||
m_htmlPart->setZoomFactor( int( m_zoomFactor ));
|
||||
}
|
||||
|
||||
// setStylesheet
|
||||
// =============
|
||||
|
||||
void HTMLWidget::setStylesheet( )
|
||||
{ m_dlg = new StylesheetDialog( m_stylesheetURL.path( ), *m_stylesheetURLs, this, "man stylesheet dlg" );
|
||||
connect( m_dlg, SIGNAL( stylesheetRemoved( )), SLOT( slotStylesheetRemoved( )));
|
||||
|
||||
if( m_dlg->exec( ) != QDialog::Accepted )
|
||||
{ delete m_dlg;
|
||||
m_dlg = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
*m_stylesheetURLs = m_dlg->stylesheetURLs( );
|
||||
m_stylesheetURL.setPath( m_stylesheetURLs->front( ));
|
||||
m_htmlPart->setUserStyleSheet( m_stylesheetURL );
|
||||
|
||||
emit( optionsDirty( ));
|
||||
delete m_dlg;
|
||||
m_dlg = NULL;
|
||||
}
|
||||
|
||||
// slotGunzipProcessExited
|
||||
// =======================
|
||||
|
||||
void HTMLWidget::slotGunzipProcessExited( )
|
||||
{ if( !m_process->normalExit( ))
|
||||
{ delete m_process;
|
||||
m_process = NULL;
|
||||
emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - the 'gunzip' process failed." )));
|
||||
return;
|
||||
}
|
||||
|
||||
delete m_process;
|
||||
|
||||
m_process = new KProcess( );
|
||||
*m_process << "man2html";
|
||||
*m_process << "-";
|
||||
|
||||
connect( m_process, SIGNAL( processExited( KProcess* )), SLOT( slotMan2HTMLProcessExited( )));
|
||||
connect( m_process, SIGNAL( receivedStdout( KProcess*, char*, int )), SLOT( slotMan2HTMLReceivedStdout( KProcess*, char*, int )));
|
||||
|
||||
m_htmlData = QString::null;
|
||||
m_process->start( KProcess::NotifyOnExit, KProcess::Communication( KProcess::Stdin | KProcess::Stdout ));
|
||||
m_process->writeStdin( m_manPageData, m_manPageData.length( ));
|
||||
m_process->closeStdin( );
|
||||
}
|
||||
|
||||
// slotGunzipReceivedStdout
|
||||
// ========================
|
||||
|
||||
void HTMLWidget::slotGunzipReceivedStdout( KProcess* /* process */, char* buffer, int buflen )
|
||||
{ m_manPageData += QString::fromLatin1( buffer, buflen );
|
||||
}
|
||||
|
||||
// slotMan2HTMLReceivedStdout
|
||||
// ==========================
|
||||
|
||||
void HTMLWidget::slotMan2HTMLReceivedStdout( KProcess* /* process */, char* buffer, int buflen )
|
||||
{ m_htmlData += QString::fromLatin1( buffer, buflen );
|
||||
}
|
||||
|
||||
// slotMan2HTMLProcessExited
|
||||
// =========================
|
||||
|
||||
void HTMLWidget::slotMan2HTMLProcessExited( )
|
||||
{ if( !m_process->normalExit( ))
|
||||
emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - the 'man2html' process failed." )));
|
||||
|
||||
delete m_process;
|
||||
m_process = NULL;
|
||||
|
||||
m_htmlPart->begin( );
|
||||
QTextStream textStream( &m_htmlData, IO_ReadOnly );
|
||||
|
||||
while( !textStream.atEnd( ))
|
||||
{ QString htmlLine = textStream.readLine( );
|
||||
|
||||
if( htmlLine.startsWith( "<H2>TARGET SPECIFICATION</H2>" ))
|
||||
m_htmlPart->write( "<a id='target'>" );
|
||||
else
|
||||
if( htmlLine.startsWith( "<DT><B>-" ))
|
||||
{ QStringList nmapOptions = QStringList::split( " ", htmlLine.right( htmlLine.length( ) - 7 ));
|
||||
QString anchors;
|
||||
|
||||
for( QStringList::Iterator it = nmapOptions.begin( ); it != nmapOptions.end( ); ++it )
|
||||
{ if( (*it)[ 0 ] != '-' )
|
||||
break;
|
||||
|
||||
QStringList nmapOption = QStringList::split( "<", *it );
|
||||
anchors += QString( "<a id='%1'>" ).arg( nmapOption.front( ));
|
||||
}
|
||||
|
||||
m_htmlPart->write( anchors );
|
||||
}
|
||||
|
||||
m_htmlPart->write( htmlLine + "\n" );
|
||||
}
|
||||
|
||||
m_htmlPart->end( );
|
||||
|
||||
m_htmlPart->setUserStyleSheet( m_stylesheetURL );
|
||||
m_htmlPart->setZoomFactor( int( m_zoomFactor ));
|
||||
}
|
||||
|
||||
// slotManProcessExited
|
||||
// ====================
|
||||
|
||||
void HTMLWidget::slotManProcessExited( )
|
||||
{
|
||||
if( !m_process->normalExit( ))
|
||||
{ delete m_process;
|
||||
m_process = NULL;
|
||||
emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - the 'man -w' process failed." )));
|
||||
return;
|
||||
}
|
||||
|
||||
delete m_process;
|
||||
ushort length = m_manPagePath.length( );
|
||||
|
||||
if( m_manPagePath[ length - 1 ] == '\n' )
|
||||
m_manPagePath = m_manPagePath.left( length - 1 );
|
||||
|
||||
if( !m_manPagePath.endsWith( ".gz" ))
|
||||
{ m_process = NULL;
|
||||
emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - it either was not found or it not a 'gz' file." )));
|
||||
return;
|
||||
}
|
||||
|
||||
m_process = new KProcess( );
|
||||
*m_process << "gunzip";
|
||||
*m_process << "-c";
|
||||
*m_process << m_manPagePath;
|
||||
|
||||
connect( m_process, SIGNAL( processExited( KProcess* )), SLOT( slotGunzipProcessExited( )));
|
||||
connect( m_process, SIGNAL( receivedStdout( KProcess*, char*, int )), SLOT( slotGunzipReceivedStdout( KProcess*, char*, int )));
|
||||
|
||||
m_manPageData = QString::null;
|
||||
m_process->start( KProcess::NotifyOnExit, KProcess::Stdout );
|
||||
}
|
||||
|
||||
// slotManReceivedStdout
|
||||
// =====================
|
||||
|
||||
void HTMLWidget::slotManReceivedStdout( KProcess* /* process */, char* buffer, int buflen )
|
||||
{ m_manPagePath += QString::fromLatin1( buffer, buflen );
|
||||
}
|
||||
|
||||
// slotStylesheetRemoved
|
||||
// =====================
|
||||
|
||||
void HTMLWidget::slotStylesheetRemoved( )
|
||||
{ *m_stylesheetURLs = m_dlg->stylesheetURLs( );
|
||||
emit( optionsDirty( ));
|
||||
}
|
||||
|
||||
// tryKnmapFile
|
||||
// ============
|
||||
|
||||
bool HTMLWidget::tryKnmapFile( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
QString path = "/home/c/knmap/src/nmap_manpage.html";
|
||||
#else
|
||||
QString path = locate( "data", "knmap/nmap_manpage.html" );
|
||||
#endif
|
||||
|
||||
if( !QFile::exists( path ))
|
||||
return false;
|
||||
|
||||
QFile manPageFile( path );
|
||||
|
||||
if( !manPageFile.open( IO_ReadOnly ))
|
||||
return false;
|
||||
|
||||
QTextStream manPageStream( &manPageFile );
|
||||
m_htmlPart->begin( );
|
||||
|
||||
while ( !manPageStream.atEnd( ))
|
||||
{ QString line = manPageStream.read( );
|
||||
m_htmlPart->write( line );
|
||||
}
|
||||
|
||||
m_htmlPart->end( );
|
||||
manPageFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// zoomFactor
|
||||
// ==========
|
||||
|
||||
void HTMLWidget::zoomFactor( const float factor )
|
||||
{ m_zoomFactor = factor;
|
||||
m_htmlPart->setZoomFactor( int( m_zoomFactor ));
|
||||
emit( optionsDirty( ));
|
||||
}
|
||||
// zoomIn
|
||||
// ======
|
||||
|
||||
void HTMLWidget::zoomIn( )
|
||||
{ m_zoomFactor = _min_( ZOOM_MAX_FACTOR, m_zoomFactor + m_zoomIncrement );
|
||||
m_htmlPart->setZoomFactor( int( m_zoomFactor ));
|
||||
emit( optionsDirty( ));
|
||||
}
|
||||
|
||||
// zoomOut
|
||||
// =======
|
||||
|
||||
void HTMLWidget::zoomOut( )
|
||||
{ m_zoomFactor = _max_( ZOOM_MIN_FACTOR, m_zoomFactor - m_zoomIncrement );
|
||||
m_htmlPart->setZoomFactor( int( m_zoomFactor ));
|
||||
emit( optionsDirty( ));
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _HTMLWIDGET_H_
|
||||
#define _HTMLWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qstringlist.h>
|
||||
#include <qwidget.h>
|
||||
#include <kurl.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KHTMLPart;
|
||||
class KProcess;
|
||||
class StylesheetDialog;
|
||||
|
||||
// HTMLWidget class definition
|
||||
// ===========================
|
||||
|
||||
|
||||
class HTMLWidget : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
HTMLWidget( QStringList* stylesheetURLs, QWidget* parent = NULL, const char* name = NULL );
|
||||
virtual ~HTMLWidget( );
|
||||
|
||||
void gotoAnchor( const QString& anchor );
|
||||
void loadManPage( const bool localManPage );
|
||||
void readSettings( );
|
||||
void saveSettings( );
|
||||
void setInitialValues( );
|
||||
void setStylesheet( );
|
||||
float zoomFactor( ) const { return m_zoomFactor; }
|
||||
void zoomFactor( const float factor );
|
||||
void zoomIn( );
|
||||
void zoomOut( );
|
||||
|
||||
signals:
|
||||
void errorLoadingLocalManPage( const QString& );
|
||||
void optionsDirty( );
|
||||
|
||||
private slots:
|
||||
void slotGunzipProcessExited( );
|
||||
void slotGunzipReceivedStdout( KProcess* process, char* buffer, int buflen );
|
||||
void slotMan2HTMLProcessExited( );
|
||||
void slotMan2HTMLReceivedStdout( KProcess* process, char* buffer, int buflen );
|
||||
void slotManProcessExited( );
|
||||
void slotManReceivedStdout( KProcess* process, char* buffer, int buflen );
|
||||
void slotStylesheetRemoved( );
|
||||
|
||||
private:
|
||||
void loadKnmapManPage( );
|
||||
void loadLocalManPage( );
|
||||
void resizeEvent( QResizeEvent* event );
|
||||
bool tryKnmapFile( );
|
||||
|
||||
StylesheetDialog* m_dlg;
|
||||
QString m_htmlData;
|
||||
KHTMLPart* m_htmlPart;
|
||||
QString m_manPageData;
|
||||
QString m_manPagePath;
|
||||
KProcess* m_process;
|
||||
KURL m_stylesheetURL;
|
||||
QStringList* m_stylesheetURLs;
|
||||
float m_zoomFactor;
|
||||
static const float m_zoomIncrement;
|
||||
};
|
||||
|
||||
#endif // _HTMLWIDGET_H_
|
@ -0,0 +1,273 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qdragobject.h>
|
||||
#include <qfontmetrics.h>
|
||||
#include <qpainter.h>
|
||||
#include <qpopupmenu.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "indexwidget.h"
|
||||
#include "mainwidget.h"
|
||||
#include "scanstack.h"
|
||||
#include "scanwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
IndexWidget::IndexWidget( ScanStack* scanStack, MainWidget* parent, const char* name )
|
||||
: QScrollView( parent, name ),
|
||||
m_blinkTimer( NULL ),
|
||||
m_scanCount( 0 ),
|
||||
m_scanStack( scanStack )
|
||||
{ setDragAutoScroll( true );
|
||||
viewport( )->setAcceptDrops( true );
|
||||
}
|
||||
|
||||
// calculateIndex
|
||||
// ==============
|
||||
|
||||
short IndexWidget::calculateIndex( const ushort y )
|
||||
{ QFontMetrics metrics = fontMetrics( );
|
||||
byte height = metrics.height( );
|
||||
ushort index = y / height;
|
||||
|
||||
return index > m_scanStack->count( ) - 1 ? -1 : index;
|
||||
}
|
||||
|
||||
// contentsContextMenuEvent
|
||||
// ========================
|
||||
|
||||
void IndexWidget::contentsContextMenuEvent( QContextMenuEvent* event )
|
||||
{ short index = calculateIndex( event->y( ));
|
||||
|
||||
if( index < 0 )
|
||||
return;
|
||||
|
||||
ScanWidget* scanWidget = m_scanStack->makeScanWidgetVisible( index );
|
||||
emit( visibleScanWidgetChanged( scanWidget ));
|
||||
|
||||
QPopupMenu* contextMenu = new QPopupMenu( this, "context menu" );
|
||||
KIconLoader* iconLoader = KGlobal::iconLoader( );
|
||||
QIconSet profileLoad = iconLoader->loadIconSet( "profileload", KIcon::Small );
|
||||
QIconSet profileSave = iconLoader->loadIconSet( "profilesave", KIcon::Small );
|
||||
QIconSet profileSaveAs = iconLoader->loadIconSet( "profilesaveas", KIcon::Small );
|
||||
QIconSet scanClose = iconLoader->loadIconSet( "scanclose", KIcon::Small );
|
||||
QIconSet scanDuplicate = iconLoader->loadIconSet( "scanduplicate", KIcon::Small );
|
||||
QIconSet scanNew = iconLoader->loadIconSet( "scannew", KIcon::Small );
|
||||
QIconSet scanRename = iconLoader->loadIconSet( "scanrename", KIcon::Small );
|
||||
|
||||
contextMenu->insertItem( scanClose, i18n( "&Close scan" ), parent( ), SLOT( slotScanClose( )), CTRL+Key_W );
|
||||
contextMenu->insertItem( scanDuplicate, i18n( "&Duplicate scan" ), parent( ), SLOT( slotScanDuplicate( )), CTRL+Key_C );
|
||||
contextMenu->insertItem( scanNew, i18n( "&New scan..." ), parent( ), SLOT( slotScanNew( )), CTRL+Key_N );
|
||||
contextMenu->insertItem( scanRename, i18n( "&Rename scan..." ), parent( ), SLOT( slotScanRename( )), Key_F2 );
|
||||
contextMenu->insertItem( i18n( "&Use target host name" ), parent( ), SLOT( slotUseTargetHost( )));
|
||||
contextMenu->insertSeparator( );
|
||||
contextMenu->insertItem( profileLoad, i18n( "&Load profile..." ), parent( ), SLOT( slotProfileLoad( )));
|
||||
contextMenu->insertItem( profileSave, i18n( "&Save profile..." ), parent( ), SLOT( slotProfileSave( )));
|
||||
contextMenu->insertItem( profileSaveAs, i18n( "&Save profile as..." ), parent( ), SLOT( slotProfileSaveAs( )));
|
||||
|
||||
contextMenu->exec( event->globalPos( ));
|
||||
}
|
||||
|
||||
// contentsDragMoveEvent
|
||||
// =====================
|
||||
|
||||
void IndexWidget::contentsDragMoveEvent( QDragMoveEvent* event )
|
||||
{ short index = calculateIndex( event->pos( ).y( ));
|
||||
index = index < 0 ? m_scanStack->count( ) - 1 : index;
|
||||
|
||||
ScanWidget* scanWidget = m_scanStack->makeScanWidgetVisible( index );
|
||||
emit( visibleScanWidgetChanged( scanWidget ));
|
||||
}
|
||||
|
||||
// contentsMouseMoveEvent
|
||||
// ======================
|
||||
|
||||
void IndexWidget::contentsMouseMoveEvent( QMouseEvent* event )
|
||||
{ if( event->stateAfter( ) != Qt::LeftButton )
|
||||
return;
|
||||
|
||||
short index = calculateIndex( event->y( ));
|
||||
|
||||
if( index < 0 )
|
||||
return;
|
||||
|
||||
QStoredDrag* drag = new QStoredDrag( "application/octet-stream", this );
|
||||
drag->dragMove( );
|
||||
ScanWidget* scanWidget = m_scanStack->moveScanWidget( index );
|
||||
|
||||
scanWidget->ignoreTabChanges( true );
|
||||
m_scanStack->raiseWidget( scanWidget );
|
||||
scanWidget->ignoreTabChanges( false );
|
||||
|
||||
emit( visibleScanWidgetChanged( scanWidget ));
|
||||
}
|
||||
|
||||
// contentsMousePressEvent
|
||||
// =======================
|
||||
|
||||
void IndexWidget::contentsMousePressEvent( QMouseEvent* event )
|
||||
{ if( event->stateAfter( ) != Qt::LeftButton )
|
||||
return;
|
||||
|
||||
short index = calculateIndex( event->y( ));
|
||||
|
||||
if( index < 0 )
|
||||
return;
|
||||
|
||||
ScanWidget* scanWidget = m_scanStack->makeScanWidgetVisible( index );
|
||||
emit( visibleScanWidgetChanged( scanWidget ));
|
||||
|
||||
if( scanWidget->state( ) == ScanWidget::finished )
|
||||
scanWidget->state( ScanWidget::dormant );
|
||||
}
|
||||
|
||||
// drawContents
|
||||
// ============
|
||||
|
||||
void IndexWidget::drawContents( QPainter* painter, int clipx, int clipy, int clipw, int cliph )
|
||||
{ painter->fillRect( clipx, clipy, clipw, cliph, KGlobalSettings::baseColor( ));
|
||||
painter->setBackgroundMode( Qt::OpaqueMode );
|
||||
|
||||
QFontMetrics metrics = fontMetrics( );
|
||||
byte height = metrics.height( );
|
||||
byte aWidth2 = 2 * metrics.width( "*" );
|
||||
ushort x = height / 2;
|
||||
ushort xMax = 0;
|
||||
ushort y = 0;
|
||||
ushort i;
|
||||
|
||||
for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); y += height, m_scanStack->nextScanWidget( i ))
|
||||
{ ScanWidget* scanWidget = m_scanStack->currentScanWidget( i );
|
||||
|
||||
switch( scanWidget->state( ))
|
||||
{ case ScanWidget::dormant:
|
||||
if( m_scanStack->isVisibleWidget( scanWidget ))
|
||||
{ painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::alternateBackgroundColor( ));
|
||||
painter->setBackgroundColor( KGlobalSettings::alternateBackgroundColor( ));
|
||||
painter->setPen( KGlobalSettings::buttonTextColor( ));
|
||||
break;
|
||||
}
|
||||
|
||||
painter->setBackgroundColor( KGlobalSettings::baseColor( ));
|
||||
painter->setPen( KGlobalSettings::buttonTextColor( ));
|
||||
break;
|
||||
|
||||
case ScanWidget::finished:
|
||||
painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::highlightColor( ));
|
||||
painter->setBackgroundColor( KGlobalSettings::highlightColor( ));
|
||||
painter->setPen( KGlobalSettings::activeTextColor( ));
|
||||
break;
|
||||
|
||||
case ScanWidget::running:
|
||||
if( m_highlight )
|
||||
{ painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::highlightColor( ));
|
||||
painter->setBackgroundColor( KGlobalSettings::highlightColor( ));
|
||||
painter->setPen( KGlobalSettings::activeTextColor( ));
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_scanStack->isVisibleWidget( scanWidget ))
|
||||
{ painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::alternateBackgroundColor( ));
|
||||
painter->setBackgroundColor( KGlobalSettings::alternateBackgroundColor( ));
|
||||
painter->setPen( KGlobalSettings::buttonTextColor( ));
|
||||
break;
|
||||
}
|
||||
|
||||
painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::baseColor( ));
|
||||
painter->setBackgroundColor( KGlobalSettings::baseColor( ));
|
||||
painter->setPen( KGlobalSettings::buttonTextColor( ));
|
||||
break;
|
||||
}
|
||||
|
||||
if( scanWidget->useTargetHost( ))
|
||||
painter->drawText( x, y + metrics.ascent( ), "*" );
|
||||
|
||||
painter->drawText( x + aWidth2, y + metrics.ascent( ), scanWidget->scanName( ));
|
||||
xMax = _max_( xMax, x + aWidth2 + metrics.width( scanWidget->scanName( )));
|
||||
}
|
||||
|
||||
if( m_scanCount )
|
||||
m_highlight = !m_highlight;
|
||||
|
||||
resizeContents( xMax + height / 2, y );
|
||||
}
|
||||
|
||||
// ensureCurrentVisible
|
||||
// ====================
|
||||
|
||||
void IndexWidget::ensureCurrentVisible( )
|
||||
{ short index = m_scanStack->indexOfVisibleScanWidget( );
|
||||
|
||||
if( index < 0 )
|
||||
return;
|
||||
|
||||
QFontMetrics metrics = fontMetrics( );
|
||||
short y = index * metrics.height( ) - height( ) / 2;
|
||||
setContentsPos( 0, y );
|
||||
updateContents( );
|
||||
}
|
||||
|
||||
// ensureCurrentVisible
|
||||
// ====================
|
||||
|
||||
void IndexWidget::slotRepaint( )
|
||||
{ repaintContents( false );
|
||||
}
|
||||
|
||||
// slotScanStarted
|
||||
// ===============
|
||||
|
||||
void IndexWidget::slotScanStarted( )
|
||||
{ if( m_scanCount++ )
|
||||
return;
|
||||
|
||||
ASSERT( m_blinkTimer == NULL );
|
||||
m_blinkTimer = new QTimer( this );
|
||||
connect( m_blinkTimer, SIGNAL( timeout( )), SLOT( slotRepaint( )));
|
||||
m_blinkTimer->start( 500 );
|
||||
m_highlight = true;
|
||||
}
|
||||
|
||||
// slotScanStopped
|
||||
// ===============
|
||||
|
||||
void IndexWidget::slotScanStopped( ScanWidget* scanWidget )
|
||||
{ scanWidget->state( scanWidget == m_scanStack->visibleWidget( ) ? ScanWidget::dormant : ScanWidget::finished );
|
||||
updateContents( );
|
||||
|
||||
if( --m_scanCount )
|
||||
return;
|
||||
|
||||
delete m_blinkTimer;
|
||||
m_blinkTimer = NULL;
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _INDEXWIDGET_H_
|
||||
#define _INDEXWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qscrollview.h>
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KConfig;
|
||||
class MainWidget;
|
||||
class QPainter;
|
||||
class QTimer;
|
||||
class ScanStack;
|
||||
class ScanWidget;
|
||||
|
||||
// IndexWidget class definition
|
||||
// ============================
|
||||
|
||||
class IndexWidget : public QScrollView
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
IndexWidget( ScanStack* scanStack, MainWidget* parent, const char* name = NULL );
|
||||
|
||||
void ensureCurrentVisible( );
|
||||
|
||||
signals:
|
||||
void visibleScanWidgetChanged( ScanWidget* );
|
||||
|
||||
public slots:
|
||||
void slotRepaint( );
|
||||
void slotScanStarted( );
|
||||
void slotScanStopped( ScanWidget* scanWidget );
|
||||
|
||||
private:
|
||||
short calculateIndex( const ushort y );
|
||||
void contentsContextMenuEvent( QContextMenuEvent* event );
|
||||
void contentsDragMoveEvent( QDragMoveEvent* event );
|
||||
void contentsMouseMoveEvent( QMouseEvent* event );
|
||||
void contentsMousePressEvent( QMouseEvent* event );
|
||||
void drawContents( QPainter* painter, int clipx, int clipy, int clipw, int cliph );
|
||||
|
||||
QTimer* m_blinkTimer;
|
||||
bool m_highlight;
|
||||
ushort m_scanCount;
|
||||
ScanStack* m_scanStack;
|
||||
};
|
||||
|
||||
#endif // _INDEXWIDGET_H_
|
@ -0,0 +1,405 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qdir.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
#include <kaction.h>
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kedittoolbar.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <kkeydialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kmainwindow.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kstatusbar.h>
|
||||
#include <kstdaction.h>
|
||||
|
||||
#include "htmlwidget.h"
|
||||
#include "knmap.h"
|
||||
#include "mainwidget.h"
|
||||
#include "scanwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
Knmap::Knmap( )
|
||||
: KMainWindow( NULL, "knmap" ),
|
||||
m_mainWidget( new MainWidget( this, "main widget" ))
|
||||
{ findNmap( );
|
||||
setCentralWidget( m_mainWidget );
|
||||
readSettings( );
|
||||
createMenu( );
|
||||
setAutoSaveSettings( );
|
||||
|
||||
connect( m_mainWidget,
|
||||
SIGNAL( outputAvailable( const bool, const bool )),
|
||||
SLOT( slotOutputAvailable( const bool, const bool)));
|
||||
|
||||
connect( m_mainWidget,
|
||||
SIGNAL( setManPageActionStuff( const bool )),
|
||||
SLOT( slotSetManPageActionStuff( const bool )));
|
||||
|
||||
connect( m_mainWidget,
|
||||
SIGNAL( setCaption( const QString& )),
|
||||
SLOT( slotSetCaption( const QString& )));
|
||||
|
||||
connect( m_mainWidget,
|
||||
SIGNAL( statusBarText( const QString& )), statusBar( ),
|
||||
SLOT( message( const QString& )));
|
||||
|
||||
connect( m_mainWidget,
|
||||
SIGNAL( visibleScanWidgetChanged( ScanWidget* )),
|
||||
SLOT( slotVisibleScanWidgetChanged( ScanWidget* )));
|
||||
}
|
||||
|
||||
// createMenu
|
||||
// ==========
|
||||
|
||||
void Knmap::createMenu( )
|
||||
{ KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( )), actionCollection( ));
|
||||
KStdAction::keyBindings( this, SLOT( slotConfigureShortcuts( )), actionCollection( ));
|
||||
KStdAction::quit( kapp, SLOT( quit( )), actionCollection( ));
|
||||
|
||||
m_fileSaveAction = KStdAction::save( m_mainWidget,
|
||||
SLOT( slotFileSave( )),
|
||||
actionCollection( ));
|
||||
|
||||
m_fileSaveAsAction = KStdAction::saveAs( m_mainWidget,
|
||||
SLOT( slotFileSaveAs( )),
|
||||
actionCollection( ));
|
||||
|
||||
m_settingsManAction = new KAction( i18n( "&Use local man page" ),
|
||||
"localman.png",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotSwitchManPages( )),
|
||||
actionCollection( ),
|
||||
"settings_local" );
|
||||
|
||||
m_useTargetHostAction = new KToggleAction( i18n( "Use target host name" ),
|
||||
NULL,
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotUseTargetHost( )),
|
||||
actionCollection( ),
|
||||
"scan_use" );
|
||||
|
||||
m_wrapTextAction = new KToggleAction( i18n( "Wrap text" ),
|
||||
NULL,
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotWrapText( )),
|
||||
actionCollection( ),
|
||||
"settings_wrap_text" );
|
||||
|
||||
new KAction( i18n( "Close scan" ),
|
||||
"scanclose",
|
||||
CTRL+Key_W,
|
||||
m_mainWidget,
|
||||
SLOT( slotScanClose( )),
|
||||
actionCollection( ),
|
||||
"scan_close" );
|
||||
|
||||
new KAction( i18n( "Copy profile..." ),
|
||||
"profilecopy",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotProfileCopy( )),
|
||||
actionCollection( ),
|
||||
"profile_copy" );
|
||||
|
||||
new KAction( i18n( "Delete profile..." ),
|
||||
"profiledelete",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotProfileDelete( )),
|
||||
actionCollection( ),
|
||||
"profile_delete" );
|
||||
|
||||
new KAction( i18n( "Display nmap man page" ),
|
||||
"manpage",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotShowManPage( )),
|
||||
actionCollection( ),
|
||||
"help_man_page" );
|
||||
|
||||
new KAction( i18n( "Duplicate scan" ),
|
||||
"scanduplicate",
|
||||
CTRL+Key_C,
|
||||
m_mainWidget,
|
||||
SLOT( slotScanDuplicate( )),
|
||||
actionCollection( ),
|
||||
"scan_duplicate" );
|
||||
|
||||
new KAction( i18n( "Load profile..." ),
|
||||
"profileload",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotProfileLoad( )),
|
||||
actionCollection( ),
|
||||
"profile_load" );
|
||||
|
||||
new KAction( i18n( "man page stylesheet..." ),
|
||||
"manstylesheet",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotSetStylesheet( )),
|
||||
actionCollection( ),
|
||||
"settings_stylesheet" );
|
||||
|
||||
new KAction( i18n( "New scan..." ),
|
||||
"scannew",
|
||||
CTRL+Key_N,
|
||||
m_mainWidget,
|
||||
SLOT( slotScanNew( )),
|
||||
actionCollection( ),
|
||||
"scan_new" );
|
||||
|
||||
new KAction( i18n( "Rename profile..." ),
|
||||
"profilerename",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotProfileRename( )),
|
||||
actionCollection( ),
|
||||
"profile_rename" );
|
||||
|
||||
new KAction( i18n( "Rename scan..." ),
|
||||
"scanrename",
|
||||
Key_F2,
|
||||
m_mainWidget,
|
||||
SLOT( slotScanRename( )),
|
||||
actionCollection( ),
|
||||
"scan_rename" );
|
||||
|
||||
new KAction( i18n( "Save profile..." ),
|
||||
"profilesave",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotProfileSave( )),
|
||||
actionCollection( ),
|
||||
"profile_save" );
|
||||
|
||||
new KAction( i18n( "Save profile as..." ),
|
||||
"profilesaveas",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotProfileSaveAs( )),
|
||||
actionCollection( ),
|
||||
"profile_save_as" );
|
||||
|
||||
new KAction( i18n( "Zoom custom" ),
|
||||
"zoomcustom",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotZoomCustom( )),
|
||||
actionCollection( ),
|
||||
"settings_zoom_custom" );
|
||||
|
||||
new KAction( i18n( "Zoom in" ),
|
||||
"zoomin",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotZoomIn( )),
|
||||
actionCollection( ),
|
||||
"settings_zoom_in" );
|
||||
|
||||
new KAction( i18n( "Zoom out" ),
|
||||
"zoomout",
|
||||
0,
|
||||
m_mainWidget,
|
||||
SLOT( slotZoomOut( )),
|
||||
actionCollection( ),
|
||||
"settings_zoom_out" );
|
||||
|
||||
m_fileSaveAction->setEnabled( false );
|
||||
m_fileSaveAsAction->setEnabled( false );
|
||||
m_wrapTextAction->setChecked( m_mainWidget->wrapText( ));
|
||||
|
||||
createStandardStatusBarAction( );
|
||||
setStandardToolBarMenuEnabled( true );
|
||||
|
||||
#ifdef _DEBUG
|
||||
createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" );
|
||||
#else
|
||||
createGUI( );
|
||||
#endif
|
||||
}
|
||||
|
||||
// findNmap
|
||||
// ========
|
||||
|
||||
void Knmap::findNmap( )
|
||||
{ QString nmapPath = KStandardDirs::findExe( "nmap" );
|
||||
|
||||
if( nmapPath.isEmpty( ))
|
||||
{ KMessageBox::error( this,
|
||||
i18n( "nmap is not installed on the computer - we cannot proceed without it. To download nmap go to \"http://www.insecure.org/nmap\"" ),
|
||||
i18n( "nmap not found" ));
|
||||
kapp->quit( );
|
||||
}
|
||||
}
|
||||
|
||||
// getDirPath
|
||||
// ==========
|
||||
|
||||
bool Knmap::getDirPath( const QString& caption, QString& path )
|
||||
{ QString startDir = (path.isEmpty( )) ? KGlobalSettings::documentPath( ) : path;
|
||||
QString tempPath = KFileDialog::getExistingDirectory( startDir, NULL, caption );
|
||||
|
||||
if( tempPath.isEmpty( ))
|
||||
return false;
|
||||
|
||||
path = tempPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
// getDirPath
|
||||
// ==========
|
||||
|
||||
void Knmap::getDirPath( const QString& caption, QString& path, QLineEdit* lineEdit )
|
||||
{ if( getDirPath( caption, path ))
|
||||
lineEdit->setText( path );
|
||||
}
|
||||
|
||||
// getFilePath
|
||||
// ===========
|
||||
|
||||
bool Knmap::getFilePath( const QString& caption, QString& path, const bool save )
|
||||
{ QString filter = "*.txt|Text files\n*.*|All files";
|
||||
QString startDir = (path.isEmpty( )) ? KGlobalSettings::documentPath( ) : path;
|
||||
QString tempPath = KFileDialog::getSaveFileName( startDir, filter, NULL, caption );
|
||||
|
||||
if( tempPath.isEmpty( ))
|
||||
return false;
|
||||
|
||||
if( save && QFile::exists( tempPath ))
|
||||
{ if( KMessageBox::Yes != KMessageBox::questionYesNo( NULL, QString( i18n( "File \"%1\" exists.\nOverwrite?" )).arg( tempPath ), i18n( "File exists" )))
|
||||
return false;
|
||||
}
|
||||
|
||||
path = tempPath;
|
||||
return true;
|
||||
}
|
||||
|
||||
// getFilePath
|
||||
// ===========
|
||||
|
||||
void Knmap::getFilePath( const QString& caption, QString& path, QLineEdit* lineEdit, const bool save )
|
||||
{ if( getFilePath( caption, path, save ))
|
||||
lineEdit->setText( path );
|
||||
}
|
||||
|
||||
// queryExit
|
||||
// =========
|
||||
|
||||
bool Knmap::queryExit( )
|
||||
{ if( m_mainWidget->isDirty( ) && KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n( "Some profiles has been updated - save them now?" ), i18n( "Profile data updated" )))
|
||||
m_mainWidget->saveAllDirtyProfiles( );
|
||||
|
||||
saveSettings( );
|
||||
return true;
|
||||
}
|
||||
|
||||
// readSettings
|
||||
// ============
|
||||
|
||||
void Knmap::readSettings( )
|
||||
{ m_mainWidget->readSettings( );
|
||||
}
|
||||
|
||||
// saveSettings
|
||||
// ============
|
||||
|
||||
void Knmap::saveSettings( )
|
||||
{ m_mainWidget->saveSettings( );
|
||||
}
|
||||
|
||||
// slotConfigureShortcuts
|
||||
// ======================
|
||||
|
||||
void Knmap::slotConfigureShortcuts( )
|
||||
{ KKeyDialog::configure( actionCollection( ), this);
|
||||
}
|
||||
|
||||
// slotConfigureToolbars
|
||||
// =====================
|
||||
|
||||
void Knmap::slotConfigureToolbars( )
|
||||
{ saveMainWindowSettings( KGlobal::config( ), autoSaveGroup( ));
|
||||
|
||||
KEditToolbar dlg( actionCollection( ));
|
||||
connect( &dlg, SIGNAL( newToolbarConfig( )),this, SLOT( slotNewToolbarConfig( )));
|
||||
dlg.exec( );
|
||||
}
|
||||
|
||||
// slotNewToolbarConfig
|
||||
// ====================
|
||||
|
||||
void Knmap::slotNewToolbarConfig( )
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" );
|
||||
#else
|
||||
createGUI( );
|
||||
#endif
|
||||
|
||||
applyMainWindowSettings( KGlobal::config( ), autoSaveGroup( ));
|
||||
}
|
||||
|
||||
// slotOutputAvailable
|
||||
// ===================
|
||||
|
||||
void Knmap::slotOutputAvailable( const bool saveState, const bool saveAsState )
|
||||
{ m_fileSaveAction->setEnabled( saveState );
|
||||
m_fileSaveAsAction->setEnabled( saveAsState );
|
||||
}
|
||||
|
||||
// slotSetCaption
|
||||
// ==============
|
||||
|
||||
void Knmap::slotSetCaption( const QString& caption )
|
||||
{ setCaption( caption );
|
||||
}
|
||||
|
||||
// slotSetManPageActionStuff
|
||||
// =========================
|
||||
|
||||
void Knmap::slotSetManPageActionStuff( const bool useLocalManPage )
|
||||
{ m_settingsManAction->setIcon( useLocalManPage ? "knmapman.png" : "localman.png" );
|
||||
m_settingsManAction->setText( useLocalManPage ? i18n( "&Use Knmap man page" ) : i18n( "&Use local man page" ));
|
||||
}
|
||||
|
||||
// slotVisibleScanWidgetChanged
|
||||
// ============================
|
||||
|
||||
void Knmap::slotVisibleScanWidgetChanged( ScanWidget* scanWidget )
|
||||
{ m_useTargetHostAction->setChecked( scanWidget->useTargetHost( ));
|
||||
}
|
||||
|
||||
#include "knmap.moc"
|
@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _KNMAP_H_
|
||||
#define _KNMAP_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qstringlist.h>
|
||||
#include <kmainwindow.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KAction;
|
||||
class KToggleAction;
|
||||
class MainWidget;
|
||||
class ScanWidget;
|
||||
|
||||
// Knmap class definition
|
||||
// ======================
|
||||
|
||||
class Knmap : public KMainWindow
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
Knmap( );
|
||||
|
||||
static bool getDirPath( const QString& caption, QString& path );
|
||||
static void getDirPath( const QString& caption, QString& path, QLineEdit* lineEdit );
|
||||
static bool getFilePath( const QString& caption, QString& path, const bool save );
|
||||
static void getFilePath( const QString& caption, QString& path, QLineEdit* lineEdit, const bool save );
|
||||
|
||||
private slots:
|
||||
void slotConfigureShortcuts( );
|
||||
void slotConfigureToolbars( );
|
||||
void slotSetCaption( const QString& caption );
|
||||
void slotNewToolbarConfig( );
|
||||
void slotOutputAvailable( const bool saveState, const bool saveAsState );
|
||||
void slotSetManPageActionStuff( const bool useLocalManPage );
|
||||
void slotVisibleScanWidgetChanged( ScanWidget* scanWidget );
|
||||
|
||||
private:
|
||||
void createMenu( );
|
||||
void findNmap( );
|
||||
bool queryExit( );
|
||||
void readSettings( );
|
||||
void saveSettings( );
|
||||
void switchManPages( );
|
||||
|
||||
KAction* m_fileSaveAction;
|
||||
KAction* m_fileSaveAsAction;
|
||||
MainWidget* m_mainWidget;
|
||||
KAction* m_settingsManAction;
|
||||
KToggleAction* m_useTargetHostAction;
|
||||
KToggleAction* m_wrapTextAction;
|
||||
};
|
||||
|
||||
#endif // _KNMAP_H_
|
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||
<kpartgui name="knmap" version="1">
|
||||
<MenuBar>
|
||||
<Menu name="file" >
|
||||
<Action name="scan_new" />
|
||||
<Action name="scan_duplicate" />
|
||||
<Action name="scan_rename" />
|
||||
<Action name="scan_use" />
|
||||
<Action name="scan_close" />
|
||||
<Separator/>
|
||||
</Menu>
|
||||
<Menu name="help" >
|
||||
<Action name="help_man_page" />
|
||||
<Separator/>
|
||||
</Menu>
|
||||
<Menu name="profile" >
|
||||
<text>&Profiles</text>
|
||||
<Action name="profile_load" />
|
||||
<Action name="profile_save" />
|
||||
<Action name="profile_save_as" />
|
||||
<Separator/>
|
||||
<Action name="profile_copy" />
|
||||
<Action name="profile_delete" />
|
||||
<Action name="profile_rename" />
|
||||
</Menu>
|
||||
<Menu name="settings" >
|
||||
<text>&Settings</text>
|
||||
<Action name="settings_wrap_text" />
|
||||
<Separator/>
|
||||
<Action name="settings_stylesheet" />
|
||||
<Action name="settings_local" />
|
||||
<Separator/>
|
||||
<Action name="settings_zoom_in" />
|
||||
<Action name="settings_zoom_out" />
|
||||
<Action name="settings_zoom_custom" />
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</kpartgui>
|
@ -0,0 +1,460 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qbuttongroup.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "knmap.h"
|
||||
#include "loggingoptions.h"
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
LoggingOptions::LoggingOptions( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name )
|
||||
{ createLayout( );
|
||||
}
|
||||
|
||||
// createLayout
|
||||
// ============
|
||||
|
||||
void LoggingOptions::createLayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( this );
|
||||
KIconLoader* iconLoader = KGlobal::iconLoader( );
|
||||
QIconSet fileOpenIconSet = iconLoader->loadIconSet( "fileopen", KIcon::Small );
|
||||
|
||||
m_baseFileNameButton = new QPushButton( fileOpenIconSet, NULL, this, "base file name button" );
|
||||
m_grepableLogButton = new QPushButton( fileOpenIconSet, NULL, this, "grepable log button" );
|
||||
m_normalLogButton = new QPushButton( fileOpenIconSet, NULL, this, "normal log button" );
|
||||
m_resumeButton = new QPushButton( fileOpenIconSet, NULL, this, "resume button" );
|
||||
m_scriptKiddieButton = new QPushButton( fileOpenIconSet, NULL, this, "script kiddie button" );
|
||||
m_stylesheetButton = new QPushButton( fileOpenIconSet, NULL, this, "stylesheet button" );
|
||||
m_xmlLogButton = new QPushButton( fileOpenIconSet, NULL, this, "xml log button" );
|
||||
|
||||
m_appendOutputCheckBox = new QCheckBox( i18n( "Append output (--append_output)" ), this, "append output checkbox" );
|
||||
m_baseFileNameCheckBox = new QCheckBox( i18n( "Base file name (-oA <name>) " ), this, "base name checkbox" );
|
||||
m_grepableLogCheckBox = new QCheckBox( i18n( "grep'able log file (-oG <file>) " ), this, "grepable log checkbox" );
|
||||
m_normalLogCheckBox = new QCheckBox( i18n( "Normal log file (-oN <file>) " ), this, "normal log checkbox" );
|
||||
m_noStylesheetCheckBox = new QCheckBox( i18n( "No XSL stylesheet (--no_stylesheet)" ), this, "no stylesheet checkbox" );
|
||||
m_resumeCheckBox = new QCheckBox( i18n( "Resume file (--resume <file>) " ), this, "resume checkbox" );
|
||||
m_scriptKiddieCheckBox = new QCheckBox( i18n( "Script kiddie log file (-oS <file>) " ), this, "script kiddie checkbox" );
|
||||
m_stylesheetCheckBox = new QCheckBox( i18n( "XSL stylesheet (--stylesheet <file>) " ), this, "stylesheet checkbox" );
|
||||
m_xmlLogCheckBox = new QCheckBox( i18n( "XML log file (-oX <file>) " ), this, "xml log checkbox" );
|
||||
|
||||
m_baseFileNameLineEdit = new QLineEdit( this, "base file name line edit" );
|
||||
m_grepableLogLineEdit = new QLineEdit( this, "grepable log line edit" );
|
||||
m_normalLogLineEdit = new QLineEdit( this, "normal log line edit" );
|
||||
m_resumeLineEdit = new QLineEdit( this, "resume line edit" );
|
||||
m_scriptKiddieLineEdit = new QLineEdit( this, "script kiddie line edit" );
|
||||
m_stylesheetLineEdit = new QLineEdit( this, "stylesheet line edit" );
|
||||
m_xmlLogLineEdit = new QLineEdit( this, "xml log line edit" );
|
||||
|
||||
byte row = 1;
|
||||
gridLayout->addWidget( m_appendOutputCheckBox, row++, 1 );
|
||||
gridLayout->addWidget( m_noStylesheetCheckBox, row++, 1 );
|
||||
byte rowBlock1 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( m_baseFileNameCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_baseFileNameLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_baseFileNameButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_grepableLogCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_grepableLogLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_grepableLogButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_normalLogCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_normalLogLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_normalLogButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_resumeCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_resumeLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_resumeButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_scriptKiddieCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_scriptKiddieLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_scriptKiddieButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_xmlLogCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_xmlLogLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_xmlLogButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_stylesheetCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_stylesheetLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_stylesheetButton, row++, 5 );
|
||||
byte rowBlock2 = row;
|
||||
|
||||
gridLayout->setColStretch( 0, 5 );
|
||||
gridLayout->setColStretch( 2, 5 );
|
||||
gridLayout->setColStretch( 4, 10 );
|
||||
gridLayout->setColStretch( 6, 5 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 10 );
|
||||
gridLayout->setRowStretch( _max_( rowBlock1, rowBlock2 ), 10 );
|
||||
}
|
||||
|
||||
// finaliseInitialisation
|
||||
// ======================
|
||||
|
||||
void LoggingOptions::finaliseInitialisation( )
|
||||
{ WhatsThis* whatsThis = new WhatsThis( this );
|
||||
|
||||
connect( m_baseFileNameButton, SIGNAL( clicked( )), SLOT( slotBaseFileNameButtonClicked( )));
|
||||
connect( m_baseFileNameCheckBox, SIGNAL( clicked( )), SLOT( slotBaseFileNameCheckBoxClicked( )));
|
||||
connect( m_grepableLogButton, SIGNAL( clicked( )), SLOT( slotGrepableLogButtonClicked( )));
|
||||
connect( m_grepableLogCheckBox, SIGNAL( clicked( )), SLOT( slotGrepableLogCheckBoxClicked( )));
|
||||
connect( m_normalLogButton, SIGNAL( clicked( )), SLOT( slotNormalLogButtonClicked( )));
|
||||
connect( m_normalLogCheckBox, SIGNAL( clicked( )), SLOT( slotNormalLogCheckBoxClicked( )));
|
||||
connect( m_noStylesheetCheckBox, SIGNAL( clicked( )), SLOT( slotNoStylesheetCheckBoxClicked( )));
|
||||
connect( m_resumeButton, SIGNAL( clicked( )), SLOT( slotResumeButtonClicked( )));
|
||||
connect( m_resumeCheckBox, SIGNAL( clicked( )), SLOT( slotResumeCheckBoxClicked( )));
|
||||
connect( m_scriptKiddieButton, SIGNAL( clicked( )), SLOT( slotScriptKiddieButtonClicked( )));
|
||||
connect( m_scriptKiddieCheckBox, SIGNAL( clicked( )), SLOT( slotScriptKiddieCheckBoxClicked( )));
|
||||
connect( m_stylesheetButton, SIGNAL( clicked( )), SLOT( slotStylesheetButtonClicked( )));
|
||||
connect( m_stylesheetCheckBox, SIGNAL( clicked( )), SLOT( slotStylesheetCheckBoxClicked( )));
|
||||
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
|
||||
connect( m_xmlLogButton, SIGNAL( clicked( )), SLOT( slotXMLLogButtonClicked( )));
|
||||
connect( m_xmlLogCheckBox, SIGNAL( clicked( )), SLOT( slotXMLLogCheckBoxClicked( )));
|
||||
|
||||
connect( m_appendOutputCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_baseFileNameCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_baseFileNameLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_grepableLogCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_grepableLogLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_normalLogCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_normalLogLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_resumeCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_resumeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scriptKiddieCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scriptKiddieLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_stylesheetCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_stylesheetLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_xmlLogCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_xmlLogLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
}
|
||||
|
||||
// getOptions
|
||||
// ==========
|
||||
|
||||
bool LoggingOptions::getOptions( )
|
||||
{ bool baseFileNameState = m_baseFileNameCheckBox->isChecked( );
|
||||
QString baseFileNameValue = m_baseFileNameLineEdit->text( );
|
||||
bool grepableLogState = m_grepableLogCheckBox->isChecked( );
|
||||
QString grepableLogValue = m_grepableLogLineEdit->text( );
|
||||
bool normalLogState = m_normalLogCheckBox->isChecked( );
|
||||
QString normalLogValue = m_normalLogLineEdit->text( );
|
||||
bool resumeState = m_resumeCheckBox->isChecked( );
|
||||
QString resumeValue = m_resumeLineEdit->text( );
|
||||
bool scriptKiddieState = m_scriptKiddieCheckBox->isChecked( );
|
||||
QString scriptKiddieValue = m_scriptKiddieLineEdit->text( );
|
||||
bool stylesheetState = m_stylesheetCheckBox->isChecked( );
|
||||
QString stylesheetValue = m_stylesheetLineEdit->text( );
|
||||
bool xmlLogState = m_xmlLogCheckBox->isChecked( );
|
||||
QString xmlLogValue = m_xmlLogLineEdit->text( );
|
||||
|
||||
if( baseFileNameState && baseFileNameValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Base file name not specified" )), i18n( "Base file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( grepableLogState && grepableLogValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "grep'able log file name not specified" )), i18n( "grep'able log file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( normalLogState && normalLogValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Normal log file name not specified" )), i18n( "Normal log file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( resumeState && scriptKiddieValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Resume file name not specified" )), i18n( "Resume file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( scriptKiddieState && scriptKiddieValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "Script kiddie log file name not specified" )), i18n( "Script kiddie log file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( stylesheetState && stylesheetValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "XSL stylesheet file name not specified" )), i18n( "XSL stylesheet file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( xmlLogState && xmlLogValue.isEmpty( ))
|
||||
{ KMessageBox::error( this, i18n( QString( "XML log file name not specified" )), i18n( "XML log file name error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_appendOutputState = m_appendOutputCheckBox->isChecked( );
|
||||
m_baseFileNameState = baseFileNameState;
|
||||
m_baseFileNameValue = baseFileNameValue;
|
||||
m_grepableLogState = grepableLogState;
|
||||
m_grepableLogValue = grepableLogValue;
|
||||
m_normalLogState = normalLogState;
|
||||
m_normalLogValue = normalLogValue;
|
||||
m_noStylesheetState = m_noStylesheetCheckBox->isChecked( );
|
||||
m_resumeValue = resumeValue;
|
||||
m_scriptKiddieState = scriptKiddieState;
|
||||
m_scriptKiddieValue = scriptKiddieValue;
|
||||
m_stylesheetState = stylesheetState;
|
||||
m_stylesheetValue = stylesheetValue;
|
||||
m_xmlLogState = xmlLogState;
|
||||
m_xmlLogValue = xmlLogValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void LoggingOptions::readProfile( KConfig* config )
|
||||
{ m_appendOutputState = config->readBoolEntry( "appendOutputState" );
|
||||
m_baseFileNameState = config->readBoolEntry( "baseFileNameState" );
|
||||
m_baseFileNameValue = config->readEntry( "baseFileNameValue" );
|
||||
m_grepableLogState = config->readBoolEntry( "grepableLogState" );
|
||||
m_grepableLogValue = config->readEntry( "grepableLogValue" );
|
||||
m_normalLogState = config->readBoolEntry( "normalLogState" );
|
||||
m_normalLogValue = config->readEntry( "normalLogValue" );
|
||||
m_noStylesheetState = config->readBoolEntry( "noStylesheetState" );
|
||||
m_resumeState = config->readBoolEntry( "resumeState" );
|
||||
m_resumeValue = config->readEntry( "resumeValue" );
|
||||
m_scriptKiddieState = config->readBoolEntry( "scriptKiddieState" );
|
||||
m_scriptKiddieValue = config->readEntry( "scriptKiddieValue" );
|
||||
m_stylesheetState = config->readBoolEntry( "stylesheetState" );
|
||||
m_stylesheetValue = config->readEntry( "stylesheetValue" );
|
||||
m_xmlLogState = config->readBoolEntry( "xmlLogState" );
|
||||
m_xmlLogValue = config->readEntry( "xmlLogValue" );
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void LoggingOptions::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "appendOutputState", m_appendOutputState );
|
||||
config->writeEntry( "baseFileNameState", m_baseFileNameState );
|
||||
config->writeEntry( "baseFileNameValue", m_baseFileNameValue );
|
||||
config->writeEntry( "grepableLogState", m_grepableLogState );
|
||||
config->writeEntry( "grepableLogValue", m_grepableLogValue );
|
||||
config->writeEntry( "normalLogState", m_normalLogState );
|
||||
config->writeEntry( "normalLogValue", m_normalLogValue );
|
||||
config->writeEntry( "noStylesheetState", m_noStylesheetState );
|
||||
config->writeEntry( "resumeState", m_resumeState );
|
||||
config->writeEntry( "resumeValue", m_resumeValue );
|
||||
config->writeEntry( "scriptKiddieState", m_scriptKiddieState );
|
||||
config->writeEntry( "scriptKiddieValue", m_scriptKiddieValue );
|
||||
config->writeEntry( "stylesheetState", m_stylesheetState );
|
||||
config->writeEntry( "stylesheetValue", m_stylesheetValue );
|
||||
config->writeEntry( "xmlLogState", m_xmlLogState );
|
||||
config->writeEntry( "xmlLogValue", m_xmlLogValue );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void LoggingOptions::setInitialValues( )
|
||||
{ m_appendOutputCheckBox->setChecked( m_appendOutputState );
|
||||
m_baseFileNameCheckBox->setChecked( m_baseFileNameState );
|
||||
m_baseFileNameLineEdit->setText( m_baseFileNameValue );
|
||||
m_grepableLogCheckBox->setChecked( m_grepableLogState );
|
||||
m_grepableLogLineEdit->setText( m_grepableLogValue );
|
||||
m_normalLogCheckBox->setChecked( m_normalLogState );
|
||||
m_normalLogLineEdit->setText( m_normalLogValue );
|
||||
m_noStylesheetCheckBox->setChecked( m_noStylesheetState );
|
||||
m_resumeCheckBox->setChecked( m_resumeState );
|
||||
m_resumeLineEdit->setText( m_resumeValue );
|
||||
m_scriptKiddieCheckBox->setChecked( m_scriptKiddieState );
|
||||
m_scriptKiddieLineEdit->setText( m_scriptKiddieValue );
|
||||
m_stylesheetCheckBox->setChecked( m_stylesheetState );
|
||||
m_stylesheetLineEdit->setText( m_stylesheetValue );
|
||||
m_xmlLogCheckBox->setChecked( m_xmlLogState );
|
||||
m_xmlLogLineEdit->setText( m_xmlLogValue );
|
||||
|
||||
slotBaseFileNameCheckBoxClicked( );
|
||||
slotGrepableLogCheckBoxClicked( );
|
||||
slotNormalLogCheckBoxClicked( );
|
||||
slotResumeCheckBoxClicked( );
|
||||
slotScriptKiddieCheckBoxClicked( );
|
||||
slotStylesheetCheckBoxClicked( );
|
||||
slotXMLLogCheckBoxClicked( );
|
||||
}
|
||||
|
||||
// slotBaseFileNameButtonClicked
|
||||
// =============================
|
||||
|
||||
void LoggingOptions::slotBaseFileNameButtonClicked( )
|
||||
{ Knmap::getFilePath( "Base file name", m_baseFileNameValue, m_baseFileNameLineEdit, false );
|
||||
}
|
||||
|
||||
// slotBaseFileNameCheckBoxClicked
|
||||
// ===============================
|
||||
|
||||
void LoggingOptions::slotBaseFileNameCheckBoxClicked( )
|
||||
{ m_baseFileNameButton->setEnabled( m_baseFileNameCheckBox->isChecked( ));
|
||||
m_baseFileNameLineEdit->setEnabled( m_baseFileNameCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotGrepableLogButtonClicked
|
||||
// ============================
|
||||
|
||||
void LoggingOptions::slotGrepableLogButtonClicked( )
|
||||
{ Knmap::getFilePath( "grep'able log file", m_grepableLogValue, m_grepableLogLineEdit, true );
|
||||
}
|
||||
|
||||
// slotGrepableLogCheckBoxClicked
|
||||
// ==============================
|
||||
|
||||
void LoggingOptions::slotGrepableLogCheckBoxClicked( )
|
||||
{ m_grepableLogButton->setEnabled( m_grepableLogCheckBox->isChecked( ));
|
||||
m_grepableLogLineEdit->setEnabled( m_grepableLogCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotNormalLogButtonClicked
|
||||
// ==========================
|
||||
|
||||
void LoggingOptions::slotNormalLogButtonClicked( )
|
||||
{ Knmap::getFilePath( "Normal log file", m_normalLogValue, m_normalLogLineEdit, true );
|
||||
}
|
||||
|
||||
// slotNormalLogCheckBoxClicked
|
||||
// ============================
|
||||
|
||||
void LoggingOptions::slotNormalLogCheckBoxClicked( )
|
||||
{ m_normalLogButton->setEnabled( m_normalLogCheckBox->isChecked( ));
|
||||
m_normalLogLineEdit->setEnabled( m_normalLogCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotNoStylesheetCheckBoxClicked
|
||||
// ===============================
|
||||
|
||||
void LoggingOptions::slotNoStylesheetCheckBoxClicked( )
|
||||
{ if( m_noStylesheetCheckBox->isChecked( ))
|
||||
{ m_stylesheetCheckBox->setChecked( false );
|
||||
slotStylesheetCheckBoxClicked( );
|
||||
}
|
||||
}
|
||||
|
||||
// slotResumeButtonClicked
|
||||
// =======================
|
||||
|
||||
void LoggingOptions::slotResumeButtonClicked( )
|
||||
{ Knmap::getFilePath( "Resume file", m_resumeValue, m_resumeLineEdit, false );
|
||||
}
|
||||
|
||||
// slotResumeCheckBoxClicked
|
||||
// =========================
|
||||
|
||||
void LoggingOptions::slotResumeCheckBoxClicked( )
|
||||
{ m_resumeButton->setEnabled( m_resumeCheckBox->isChecked( ));
|
||||
m_resumeLineEdit->setEnabled( m_resumeCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotScriptKiddieButtonClicked
|
||||
// =============================
|
||||
|
||||
void LoggingOptions::slotScriptKiddieButtonClicked( )
|
||||
{ Knmap::getFilePath( "Script kiddie log file", m_scriptKiddieValue, m_scriptKiddieLineEdit, true );
|
||||
}
|
||||
|
||||
// slotScriptKiddieCheckBoxClicked
|
||||
// ===============================
|
||||
|
||||
void LoggingOptions::slotScriptKiddieCheckBoxClicked( )
|
||||
{ m_scriptKiddieButton->setEnabled( m_scriptKiddieCheckBox->isChecked( ));
|
||||
m_scriptKiddieLineEdit->setEnabled( m_scriptKiddieCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotStylesheetButtonClicked
|
||||
// ===========================
|
||||
|
||||
void LoggingOptions::slotStylesheetButtonClicked( )
|
||||
{ Knmap::getFilePath( "Stylesheet file", m_stylesheetValue, m_stylesheetLineEdit, false );
|
||||
}
|
||||
|
||||
// slotStylesheetCheckBoxClicked
|
||||
// =============================
|
||||
|
||||
void LoggingOptions::slotStylesheetCheckBoxClicked( )
|
||||
{ m_stylesheetButton->setEnabled( m_stylesheetCheckBox->isChecked( ));
|
||||
m_stylesheetLineEdit->setEnabled( m_stylesheetCheckBox->isChecked( ));
|
||||
|
||||
if( m_stylesheetCheckBox->isChecked( ))
|
||||
m_noStylesheetCheckBox->setChecked( false );
|
||||
}
|
||||
|
||||
// slotWhatsThisClicked
|
||||
// ====================
|
||||
|
||||
void LoggingOptions::slotWhatsThisClicked( )
|
||||
{ if( m_appendOutputCheckBox->hasMouse( )) emit( displayHelp( "--append_output" ));
|
||||
else if( m_baseFileNameButton->hasMouse( )) emit( displayHelp( "-oA" ));
|
||||
else if( m_baseFileNameCheckBox->hasMouse( )) emit( displayHelp( "-oA" ));
|
||||
else if( m_baseFileNameLineEdit->hasMouse( )) emit( displayHelp( "-oA" ));
|
||||
else if( m_grepableLogButton->hasMouse( )) emit( displayHelp( "-oG" ));
|
||||
else if( m_grepableLogCheckBox->hasMouse( )) emit( displayHelp( "-oG" ));
|
||||
else if( m_grepableLogLineEdit->hasMouse( )) emit( displayHelp( "-oG" ));
|
||||
else if( m_normalLogButton->hasMouse( )) emit( displayHelp( "-oN" ));
|
||||
else if( m_normalLogCheckBox->hasMouse( )) emit( displayHelp( "-oN" ));
|
||||
else if( m_normalLogLineEdit->hasMouse( )) emit( displayHelp( "-oN" ));
|
||||
else if( m_noStylesheetCheckBox->hasMouse( )) emit( displayHelp( "--no_stylesheet" ));
|
||||
else if( m_resumeButton->hasMouse( )) emit( displayHelp( "--resume" ));
|
||||
else if( m_resumeCheckBox->hasMouse( )) emit( displayHelp( "--resume" ));
|
||||
else if( m_resumeLineEdit->hasMouse( )) emit( displayHelp( "--resume" ));
|
||||
else if( m_scriptKiddieButton->hasMouse( )) emit( displayHelp( "-oS" ));
|
||||
else if( m_scriptKiddieCheckBox->hasMouse( )) emit( displayHelp( "-oS" ));
|
||||
else if( m_scriptKiddieLineEdit->hasMouse( )) emit( displayHelp( "-oS" ));
|
||||
else if( m_stylesheetButton->hasMouse( )) emit( displayHelp( "--stylesheet" ));
|
||||
else if( m_stylesheetCheckBox->hasMouse( )) emit( displayHelp( "--stylesheet" ));
|
||||
else if( m_stylesheetLineEdit->hasMouse( )) emit( displayHelp( "--stylesheet" ));
|
||||
else if( m_xmlLogButton->hasMouse( )) emit( displayHelp( "-oX" ));
|
||||
else if( m_xmlLogCheckBox->hasMouse( )) emit( displayHelp( "-oX" ));
|
||||
else if( m_xmlLogLineEdit->hasMouse( )) emit( displayHelp( "-oX" ));
|
||||
else emit( displayUnknown( ));
|
||||
}
|
||||
|
||||
// slotXMLLogButtonClicked
|
||||
// =======================
|
||||
|
||||
void LoggingOptions::slotXMLLogButtonClicked( )
|
||||
{ Knmap::getFilePath( "XML log file", m_xmlLogValue, m_xmlLogLineEdit, true );
|
||||
}
|
||||
|
||||
// slotXMLLogCheckBoxClicked
|
||||
// =========================
|
||||
|
||||
void LoggingOptions::slotXMLLogCheckBoxClicked( )
|
||||
{ m_xmlLogButton->setEnabled( m_xmlLogCheckBox->isChecked( ));
|
||||
m_xmlLogLineEdit->setEnabled( m_xmlLogCheckBox->isChecked( ));
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _LOGGINGOPTIONS_
|
||||
#define _LOGGINGOPTIONS_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class KConfig;
|
||||
|
||||
// LoggingOptions class definition
|
||||
// ===============================
|
||||
|
||||
class LoggingOptions : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
LoggingOptions( QWidget* parent, const char* name = NULL );
|
||||
|
||||
void finaliseInitialisation( );
|
||||
bool getOptions( );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
void setInitialValues( );
|
||||
|
||||
bool appendOutputState( ) const { return m_appendOutputState; }
|
||||
bool baseFileNameState( ) const { return m_baseFileNameState; }
|
||||
QString baseFileNameValue( ) const { return m_baseFileNameValue; }
|
||||
bool grepableLogState( ) const { return m_grepableLogState; }
|
||||
QString grepableLogValue( ) const { return m_grepableLogValue; }
|
||||
bool normalLogState( ) const { return m_normalLogState; }
|
||||
QString normalLogValue( ) const { return m_normalLogValue; }
|
||||
bool noStylesheetState( ) const { return m_noStylesheetState; }
|
||||
bool resumeState( ) const { return m_resumeState; }
|
||||
QString resumeValue( ) const { return m_resumeValue; }
|
||||
bool scriptKiddieState( ) const { return m_scriptKiddieState; }
|
||||
QString scriptKiddieValue( ) const { return m_scriptKiddieValue; }
|
||||
bool stylesheetState( ) const { return m_stylesheetState; }
|
||||
QString stylesheetValue( ) const { return m_stylesheetValue; }
|
||||
bool xmlLogState( ) const { return m_xmlLogState; }
|
||||
QString xmlLogValue( ) const { return m_xmlLogValue; }
|
||||
|
||||
signals:
|
||||
void displayDocBook( const QString& );
|
||||
void displayHelp( const QString& );
|
||||
void displayUnknown( );
|
||||
void optionsDirty( );
|
||||
|
||||
private slots:
|
||||
void slotBaseFileNameButtonClicked( );
|
||||
void slotBaseFileNameCheckBoxClicked( );
|
||||
void slotGrepableLogButtonClicked( );
|
||||
void slotGrepableLogCheckBoxClicked( );
|
||||
void slotNormalLogButtonClicked( );
|
||||
void slotNormalLogCheckBoxClicked( );
|
||||
void slotNoStylesheetCheckBoxClicked( );
|
||||
void slotResumeButtonClicked( );
|
||||
void slotResumeCheckBoxClicked( );
|
||||
void slotScriptKiddieButtonClicked( );
|
||||
void slotScriptKiddieCheckBoxClicked( );
|
||||
void slotStylesheetButtonClicked( );
|
||||
void slotStylesheetCheckBoxClicked( );
|
||||
void slotWhatsThisClicked( );
|
||||
void slotXMLLogButtonClicked( );
|
||||
void slotXMLLogCheckBoxClicked( );
|
||||
|
||||
private:
|
||||
void createLayout( );
|
||||
|
||||
QCheckBox* m_appendOutputCheckBox;
|
||||
bool m_appendOutputState;
|
||||
QPushButton* m_baseFileNameButton;
|
||||
QCheckBox* m_baseFileNameCheckBox;
|
||||
QLineEdit* m_baseFileNameLineEdit;
|
||||
bool m_baseFileNameState;
|
||||
QString m_baseFileNameValue;
|
||||
QPushButton* m_grepableLogButton;
|
||||
QCheckBox* m_grepableLogCheckBox;
|
||||
QLineEdit* m_grepableLogLineEdit;
|
||||
bool m_grepableLogState;
|
||||
QString m_grepableLogValue;
|
||||
QPushButton* m_normalLogButton;
|
||||
QCheckBox* m_normalLogCheckBox;
|
||||
QLineEdit* m_normalLogLineEdit;
|
||||
bool m_normalLogState;
|
||||
QString m_normalLogValue;
|
||||
QCheckBox* m_noStylesheetCheckBox;
|
||||
bool m_noStylesheetState;
|
||||
QPushButton* m_resumeButton;
|
||||
QCheckBox* m_resumeCheckBox;
|
||||
QLineEdit* m_resumeLineEdit;
|
||||
bool m_resumeState;
|
||||
QString m_resumeValue;
|
||||
QPushButton* m_scriptKiddieButton;
|
||||
QCheckBox* m_scriptKiddieCheckBox;
|
||||
QLineEdit* m_scriptKiddieLineEdit;
|
||||
bool m_scriptKiddieState;
|
||||
QString m_scriptKiddieValue;
|
||||
QPushButton* m_stylesheetButton;
|
||||
QCheckBox* m_stylesheetCheckBox;
|
||||
QLineEdit* m_stylesheetLineEdit;
|
||||
bool m_stylesheetState;
|
||||
QString m_stylesheetValue;
|
||||
QPushButton* m_xmlLogButton;
|
||||
QCheckBox* m_xmlLogCheckBox;
|
||||
QLineEdit* m_xmlLogLineEdit;
|
||||
bool m_xmlLogState;
|
||||
QString m_xmlLogValue;
|
||||
};
|
||||
|
||||
#endif // _LOGGINGOPTIONS_
|
@ -0,0 +1,78 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kapplication.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "global.h"
|
||||
#include "knmap.h"
|
||||
|
||||
static const char description[] = I18N_NOOP( "A KDE frontend for nmap" );
|
||||
static KCmdLineOptions options[] = { KCmdLineLastOption };
|
||||
|
||||
// main
|
||||
// ====
|
||||
|
||||
int main( int argc, string argv[])
|
||||
{ QString version = QString( "Version 2.1, %1 %2" ).arg( __TIME__ ).arg( __DATE__ );
|
||||
KAboutData about( "knmap",
|
||||
I18N_NOOP( "Knmap" ),
|
||||
version,
|
||||
description,
|
||||
KAboutData::License_GPL,
|
||||
"(C) 2005, 2006 Kevin Gilbert",
|
||||
I18N_NOOP( "This program is a complete re-write of one by the same name written by Alexandre\n"
|
||||
"Sagala. The last version of that program was 0.9 which was released on 2003-03-09\n"
|
||||
"and targeted the KDE 2.2 and QT 2.3 environments. Unfortunately it does not compile\n"
|
||||
"on today's KDE / QT environments.\n"
|
||||
"\n"
|
||||
"Not to mention that it did not cater for the full set of 'nmap' options. Or, perhaps,\n"
|
||||
"'nmap' progressed whilst that version of Knmap languished.\n"
|
||||
"\n"
|
||||
"The icons used for this application are from the Open Clip Art Library. I am indebted\n"
|
||||
"to those damn fine folk as my artistic ability is zero - which is marginally above\n"
|
||||
"my programming ability. :-(" ),
|
||||
"http://informatics.cdu.edu.au/staff/kgilbert" );
|
||||
about.addAuthor( "Kevin Gilbert",
|
||||
"Initial rewrite released as version 1.0\nVersions 2.0, 2.1",
|
||||
"kev.gilbert@cdu.edu.au",
|
||||
"http://informatics.cdu.edu.au/staff/kgilbert" );
|
||||
KCmdLineArgs::init( argc, argv, &about );
|
||||
KCmdLineArgs::addCmdLineOptions( options );
|
||||
KApplication app;
|
||||
|
||||
if( app.isRestored( ))
|
||||
{ RESTORE( Knmap );
|
||||
}
|
||||
else
|
||||
{ KCmdLineArgs* args = KCmdLineArgs::parsedArgs( );
|
||||
Knmap* mainWin = new Knmap;
|
||||
app.setMainWidget( mainWin );
|
||||
mainWin->show( );
|
||||
args->clear( );
|
||||
}
|
||||
|
||||
return app.exec( );
|
||||
}
|
@ -0,0 +1,463 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "htmlwidget.h"
|
||||
#include "indexwidget.h"
|
||||
#include "knmap.h"
|
||||
#include "mainwidget.h"
|
||||
#include "scannamedialog.h"
|
||||
#include "scanstack.h"
|
||||
#include "scanwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
MainWidget::MainWidget( QWidget* parent, const char* name )
|
||||
: QSplitter( parent, name ),
|
||||
m_dirty( false ),
|
||||
m_wrapText( false )
|
||||
{ m_scanStack = new ScanStack( this, "scan stack" );
|
||||
m_htmlWidget = new HTMLWidget( &m_stylesheetURLs, this, "html widget" );
|
||||
m_indexWidget = new IndexWidget( m_scanStack, this, "index widget" );
|
||||
|
||||
moveToFirst( m_indexWidget );
|
||||
m_scanStack->appendHTMLWidget( m_htmlWidget );
|
||||
setOpaqueResize( true );
|
||||
QTimer::singleShot( 0, this, SLOT( slotFinaliseInitialisation( )));
|
||||
|
||||
connect( m_htmlWidget,
|
||||
SIGNAL( errorLoadingLocalManPage( const QString& )),
|
||||
SLOT( slotErrorLoadingLocalManPage( const QString& )));
|
||||
|
||||
connect( m_indexWidget,
|
||||
SIGNAL( visibleScanWidgetChanged( ScanWidget* )),
|
||||
SLOT( slotVisibleScanWidgetChanged( ScanWidget* )));
|
||||
}
|
||||
|
||||
// createScan
|
||||
// ==========
|
||||
|
||||
ScanWidget* MainWidget::createScan( const QString& scanName, const bool useTargetHost, const QString& profileName )
|
||||
{ ScanWidget* scanWidget = new ScanWidget( scanName, useTargetHost, this, "scan widget" );
|
||||
|
||||
m_scanStack->appendAndRaiseWidget( scanWidget );
|
||||
m_scanStack->wrapText( m_wrapText );
|
||||
|
||||
if( profileName == QString::null )
|
||||
scanWidget->readSettings( );
|
||||
else
|
||||
scanWidget->setProfileName( profileName );
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( displayHelp( const QString& )),
|
||||
SLOT( slotDisplayHelp( const QString& )));
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( optionsDirty( )),
|
||||
SLOT( slotOptionsDirty( )));
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( outputAvailable( const bool, const bool )),
|
||||
SIGNAL( outputAvailable( const bool, const bool )));
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( scanRename( const QString& )),
|
||||
SLOT( slotScanRename( const QString& )));
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( scanStarted( )),
|
||||
m_indexWidget,
|
||||
SLOT( slotScanStarted( )));
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( scanStopped( ScanWidget* )),
|
||||
m_indexWidget,
|
||||
SLOT( slotScanStopped( ScanWidget* )));
|
||||
|
||||
connect( scanWidget,
|
||||
SIGNAL( statusBarText( const QString& )),
|
||||
SIGNAL( statusBarText( const QString& )));
|
||||
|
||||
return scanWidget;
|
||||
}
|
||||
|
||||
// loadManPage
|
||||
// ===========
|
||||
|
||||
void MainWidget::loadManPage( )
|
||||
{ m_htmlWidget->loadManPage( m_useLocalManPage );
|
||||
}
|
||||
|
||||
// readSettings
|
||||
// ============
|
||||
|
||||
void MainWidget::readSettings( )
|
||||
{ m_htmlWidget->readSettings( );
|
||||
|
||||
KConfig* config = kapp->config( );
|
||||
config->setGroup( "General" );
|
||||
|
||||
m_stylesheetURLs = config->readListEntry( "stylesheetURLs" );
|
||||
m_useLocalManPage = config->readBoolEntry( "useLocalManPage", false );
|
||||
m_wrapText = config->readBoolEntry( "wrapText", false );
|
||||
|
||||
QValueList<int> splitterSizes = config->readIntListEntry( "splitterSizes" );
|
||||
setSizes( splitterSizes );
|
||||
QStringList scanNames = config->readListEntry( "scanNames" );
|
||||
|
||||
if( !scanNames.count( ))
|
||||
scanNames.append( "default" );
|
||||
|
||||
QString visibleScanName = config->readEntry( "visibleScan", QString::null );
|
||||
ScanWidget* visibleScanWidget = NULL;
|
||||
|
||||
for( QStringList::Iterator it = scanNames.begin( ); it != scanNames.end(); ++it )
|
||||
{ ScanWidget* scanWidget = createScan( *it, false, QString::null );
|
||||
|
||||
if( visibleScanName == scanWidget->scanName( ))
|
||||
visibleScanWidget = scanWidget;
|
||||
}
|
||||
|
||||
if( visibleScanWidget == NULL )
|
||||
{ visibleScanWidget = m_scanStack->firstScanWidget( );
|
||||
|
||||
if( visibleScanWidget == NULL )
|
||||
{ KMessageBox::error( this, i18n( "Internal error - no ScanWidget to display!" ), i18n( "Internal error" ));
|
||||
kapp->quit( );
|
||||
}
|
||||
}
|
||||
|
||||
m_scanStack->raiseWidget( visibleScanWidget );
|
||||
}
|
||||
|
||||
// saveAllDirtyProfiles
|
||||
// ====================
|
||||
|
||||
void MainWidget::saveAllDirtyProfiles( )
|
||||
{ ushort i;
|
||||
|
||||
for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); m_scanStack->nextScanWidget( i ))
|
||||
{ ScanWidget* scanWidget = m_scanStack->currentScanWidget( i );
|
||||
|
||||
if( scanWidget->isDirty( ))
|
||||
scanWidget->profileSave( );
|
||||
}
|
||||
}
|
||||
|
||||
// saveSettings
|
||||
// ============
|
||||
|
||||
void MainWidget::saveSettings( )
|
||||
{ m_htmlWidget->saveSettings( );
|
||||
|
||||
ushort i;
|
||||
QStringList scanNames;
|
||||
|
||||
for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); m_scanStack->nextScanWidget( i ))
|
||||
{ ScanWidget* scanWidget = m_scanStack->currentScanWidget( i );
|
||||
scanNames.append( scanWidget->scanName( ));
|
||||
scanWidget->saveSettings( );
|
||||
}
|
||||
|
||||
QValueList<int> splitterSizes = sizes( );
|
||||
KConfig* config = kapp->config( );
|
||||
|
||||
config->setGroup( "General" );
|
||||
config->writeEntry( "scanNames", scanNames );
|
||||
config->writeEntry( "splitterSizes", splitterSizes );
|
||||
config->writeEntry( "stylesheetURLs", m_stylesheetURLs );
|
||||
config->writeEntry( "useLocalManPage", m_useLocalManPage );
|
||||
config->writeEntry( "visibleScan", m_scanStack->visibleWidget( )->scanName( ));
|
||||
config->writeEntry( "wrapText", m_wrapText );
|
||||
}
|
||||
|
||||
// setCaption
|
||||
// ==========
|
||||
|
||||
void MainWidget::setCaption( ScanWidget* scanWidget )
|
||||
{ QString profileName = scanWidget->profileName( );
|
||||
profileName = profileName.right( profileName.length( ) - strlen( PROFILE_PREFIX ));
|
||||
emit( setCaption( scanWidget->scanName( ) + " : " + profileName ));
|
||||
}
|
||||
|
||||
// slotDisplayHelp
|
||||
// ===============
|
||||
|
||||
void MainWidget::slotDisplayHelp( const QString& anchor )
|
||||
{ slotShowManPage( );
|
||||
m_htmlWidget->gotoAnchor( anchor );
|
||||
}
|
||||
|
||||
// slotErrorLoadingLocalManPage
|
||||
// ============================
|
||||
|
||||
void MainWidget::slotErrorLoadingLocalManPage( const QString& errorText )
|
||||
{ KMessageBox::sorry( this, errorText + "\nLoading the Knmap version.", "Couldn't load local nmap 'man' page" );
|
||||
slotSwitchManPages( );
|
||||
}
|
||||
|
||||
// slotFileSave
|
||||
// ============
|
||||
|
||||
void MainWidget::slotFileSave( )
|
||||
{ m_scanStack->visibleWidget( )->fileSave( );
|
||||
}
|
||||
|
||||
// slotFileSaveAs
|
||||
// ==============
|
||||
|
||||
void MainWidget::slotFileSaveAs( )
|
||||
{ m_scanStack->visibleWidget( )->fileSaveAs( );
|
||||
}
|
||||
|
||||
// slotFinaliseInitialisation
|
||||
// ==========================
|
||||
|
||||
void MainWidget::slotFinaliseInitialisation( )
|
||||
{ m_indexWidget->ensureCurrentVisible( );
|
||||
slotVisibleScanWidgetChanged( m_scanStack->visibleWidget( ));
|
||||
loadManPage( );
|
||||
emit( setManPageActionStuff( m_useLocalManPage ));
|
||||
}
|
||||
|
||||
// slotOptionsDirty
|
||||
// ================
|
||||
|
||||
void MainWidget::slotOptionsDirty( )
|
||||
{ m_dirty = false;
|
||||
ushort i;
|
||||
|
||||
for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); m_scanStack->nextScanWidget( i ))
|
||||
m_dirty |= m_scanStack->currentScanWidget( i )->isDirty( );
|
||||
}
|
||||
|
||||
// slotProfileCopy
|
||||
// ===============
|
||||
|
||||
void MainWidget::slotProfileCopy( )
|
||||
{ m_scanStack->visibleWidget( )->profileCopy( );
|
||||
}
|
||||
|
||||
// slotProfileDelete
|
||||
// =================
|
||||
|
||||
void MainWidget::slotProfileDelete( )
|
||||
{ m_scanStack->visibleWidget( )->profileDelete( );
|
||||
}
|
||||
|
||||
// slotProfileLoad
|
||||
// ===============
|
||||
|
||||
void MainWidget::slotProfileLoad( )
|
||||
{ ScanWidget* scanWidget = m_scanStack->visibleWidget( );
|
||||
scanWidget->profileLoad( );
|
||||
setCaption( scanWidget );
|
||||
}
|
||||
|
||||
// slotProfileRename
|
||||
// =================
|
||||
|
||||
void MainWidget::slotProfileRename( )
|
||||
{ m_scanStack->visibleWidget( )->profileRename( );
|
||||
}
|
||||
|
||||
// slotProfileSave
|
||||
// ===============
|
||||
|
||||
void MainWidget::slotProfileSave( )
|
||||
{ m_scanStack->visibleWidget( )->profileSave( );
|
||||
}
|
||||
|
||||
// slotProfileSaveAs
|
||||
// =================
|
||||
|
||||
void MainWidget::slotProfileSaveAs( )
|
||||
{ ScanWidget* scanWidget = m_scanStack->visibleWidget( );
|
||||
scanWidget->profileSaveAs( );
|
||||
setCaption( scanWidget );
|
||||
}
|
||||
|
||||
// slotScanClose
|
||||
// =============
|
||||
|
||||
void MainWidget::slotScanClose( )
|
||||
{ ScanWidget* scanWidget = m_scanStack->visibleWidget( );
|
||||
scanWidget->profileAskAndSave( );
|
||||
m_scanStack->removeScanWidget( scanWidget );
|
||||
m_indexWidget->updateContents( );
|
||||
slotOptionsDirty( );
|
||||
}
|
||||
|
||||
// slotScanDuplicate
|
||||
// =================
|
||||
|
||||
void MainWidget::slotScanDuplicate( )
|
||||
{ ScanWidget* scanWidget = m_scanStack->visibleWidget( );
|
||||
scanWidget = createScan( scanWidget->scanName( ), scanWidget->useTargetHost( ), scanWidget->profileName( ));
|
||||
slotVisibleScanWidgetChanged( scanWidget );
|
||||
}
|
||||
|
||||
// slotScanNew
|
||||
// ===========
|
||||
|
||||
void MainWidget::slotScanNew( )
|
||||
{ ScanNameDialog dlg( NULL, this, "scan name dlg" );
|
||||
|
||||
if( dlg.exec( ) != QDialog::Accepted )
|
||||
return;
|
||||
|
||||
QString scanName;
|
||||
bool useTargetHost;
|
||||
|
||||
if( dlg.useHostName( ))
|
||||
{ scanName = DEFAULT_SCAN_NAME;
|
||||
useTargetHost = true;
|
||||
}
|
||||
else
|
||||
{ scanName = dlg.scanName( );
|
||||
useTargetHost = false;
|
||||
}
|
||||
|
||||
ScanWidget* scanWidget = createScan( scanName, useTargetHost, DEFAULT_PROFILE );
|
||||
slotVisibleScanWidgetChanged( scanWidget );
|
||||
}
|
||||
|
||||
// slotScanRename
|
||||
// ==============
|
||||
|
||||
void MainWidget::slotScanRename( )
|
||||
{ ScanWidget* scanWidget = m_scanStack->visibleWidget( );
|
||||
ScanNameDialog dlg( scanWidget, this, "scan name dlg" );
|
||||
|
||||
if( dlg.exec( ) != QDialog::Accepted )
|
||||
return;
|
||||
|
||||
if( dlg.useHostName( ))
|
||||
{ slotScanRename( DEFAULT_SCAN_NAME );
|
||||
scanWidget->useTargetHost( true );
|
||||
}
|
||||
else
|
||||
{ slotScanRename( dlg.scanName( ));
|
||||
scanWidget->useTargetHost( false );
|
||||
}
|
||||
}
|
||||
|
||||
// slotScanRename
|
||||
// ==============
|
||||
|
||||
void MainWidget::slotScanRename( const QString& scanName )
|
||||
{ ScanWidget* scanWidget = m_scanStack->visibleWidget( );
|
||||
|
||||
scanWidget->renameScan( scanName );
|
||||
m_indexWidget->updateContents( );
|
||||
setCaption( scanWidget );
|
||||
}
|
||||
|
||||
// slotShowManPage
|
||||
// ===============
|
||||
|
||||
void MainWidget::slotShowManPage( )
|
||||
{ m_scanStack->raiseWidget( m_htmlWidget );
|
||||
}
|
||||
|
||||
// slotSetStylesheet
|
||||
// =================
|
||||
|
||||
void MainWidget::slotSetStylesheet( )
|
||||
{ m_htmlWidget->setStylesheet( );
|
||||
}
|
||||
|
||||
// slotSwitchManPages
|
||||
// ==================
|
||||
|
||||
void MainWidget::slotSwitchManPages( )
|
||||
{ m_useLocalManPage = !m_useLocalManPage;
|
||||
loadManPage( );
|
||||
emit( setManPageActionStuff( m_useLocalManPage ));
|
||||
}
|
||||
|
||||
// slotUseTargetHost
|
||||
// =================
|
||||
|
||||
void MainWidget::slotUseTargetHost( )
|
||||
{ m_scanStack->visibleWidget( )->useTargetHost( true );
|
||||
}
|
||||
|
||||
// slotVisibleScanWidgetChanged
|
||||
// ============================
|
||||
|
||||
void MainWidget::slotVisibleScanWidgetChanged( ScanWidget* scanWidget )
|
||||
{ scanWidget->updateStatusBarText( );
|
||||
setCaption( scanWidget );
|
||||
m_indexWidget->updateContents( );
|
||||
emit( visibleScanWidgetChanged( scanWidget ));
|
||||
}
|
||||
|
||||
// slotWrapText
|
||||
// ============
|
||||
|
||||
void MainWidget::slotWrapText( )
|
||||
{ m_wrapText = !m_wrapText;
|
||||
m_scanStack->wrapText( m_wrapText );
|
||||
}
|
||||
|
||||
// slotZoomCustom
|
||||
// ==============
|
||||
|
||||
void MainWidget::slotZoomCustom( )
|
||||
{ bool ok;
|
||||
int zoom = KInputDialog::getInteger( i18n( "Zoom percentage" ),
|
||||
i18n( QString( "Enter zoom %'age (%1% - %2%)").arg( ZOOM_MIN_FACTOR ).arg( ZOOM_MAX_FACTOR)),
|
||||
int( m_htmlWidget->zoomFactor( )),
|
||||
ZOOM_MIN_FACTOR,
|
||||
ZOOM_MAX_FACTOR,
|
||||
10,
|
||||
&ok,
|
||||
NULL,
|
||||
"zoom" );
|
||||
|
||||
if( ok )
|
||||
m_htmlWidget->zoomFactor( zoom );
|
||||
}
|
||||
|
||||
// slotZoomIn
|
||||
// ==========
|
||||
|
||||
void MainWidget::slotZoomIn( )
|
||||
{ m_htmlWidget->zoomIn( );
|
||||
}
|
||||
|
||||
// slotZoomOut
|
||||
// ===========
|
||||
|
||||
void MainWidget::slotZoomOut( )
|
||||
{ m_htmlWidget->zoomOut( );
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _MAINWIDGET_H_
|
||||
#define _MAINWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qsplitter.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class HTMLWidget;
|
||||
class IndexWidget;
|
||||
class KConfig;
|
||||
class ScanStack;
|
||||
class ScanWidget;
|
||||
|
||||
// MainWidget class definition
|
||||
// ===========================
|
||||
|
||||
class MainWidget : public QSplitter
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWidget( QWidget* parent = NULL, const char* name = NULL );
|
||||
|
||||
bool isDirty( ) const { return m_dirty; }
|
||||
void readSettings( );
|
||||
void saveAllDirtyProfiles( );
|
||||
void saveSettings( );
|
||||
bool wrapText( ) const { return m_wrapText; }
|
||||
|
||||
signals:
|
||||
void displayHelp( const QString& );
|
||||
void outputAvailable( const bool, const bool );
|
||||
void setManPageActionStuff( const bool );
|
||||
void setCaption( const QString& );
|
||||
void statusBarText( const QString& );
|
||||
void visibleScanWidgetChanged( ScanWidget* );
|
||||
|
||||
public slots:
|
||||
void slotFileSave( );
|
||||
void slotFileSaveAs( );
|
||||
void slotProfileCopy( );
|
||||
void slotProfileDelete( );
|
||||
void slotProfileLoad( );
|
||||
void slotProfileRename( );
|
||||
void slotProfileSave( );
|
||||
void slotProfileSaveAs( );
|
||||
void slotScanClose( );
|
||||
void slotScanDuplicate( );
|
||||
void slotScanNew( );
|
||||
void slotScanRename( );
|
||||
void slotScanRename( const QString& scanName );
|
||||
void slotShowManPage( );
|
||||
void slotSwitchManPages( );
|
||||
void slotSetStylesheet( );
|
||||
void slotUseTargetHost( );
|
||||
void slotWrapText( );
|
||||
void slotZoomCustom( );
|
||||
void slotZoomIn( );
|
||||
void slotZoomOut( );
|
||||
|
||||
private slots:
|
||||
void slotDisplayHelp( const QString& anchor );
|
||||
void slotErrorLoadingLocalManPage( const QString& errorText );
|
||||
void slotFinaliseInitialisation( );
|
||||
void slotOptionsDirty( );
|
||||
void slotVisibleScanWidgetChanged( ScanWidget* scanWidget );
|
||||
|
||||
private:
|
||||
ScanWidget* createScan( const QString& scanName, const bool useTargetHost, const QString& profileName );
|
||||
void loadManPage( );
|
||||
void setCaption( ScanWidget* scanWidget );
|
||||
|
||||
bool m_dirty;
|
||||
HTMLWidget* m_htmlWidget;
|
||||
IndexWidget* m_indexWidget;
|
||||
ScanStack* m_scanStack;
|
||||
QStringList m_stylesheetURLs;
|
||||
bool m_useLocalManPage;
|
||||
bool m_wrapText;
|
||||
};
|
||||
|
||||
#endif // _MAINWIDGET_H_
|
@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "nmapoutputbuffer.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
NmapOutputBuffer::NmapOutputBuffer( const uint bufferSize )
|
||||
: m_buffer( new char[ bufferSize]),
|
||||
m_free( false )
|
||||
{
|
||||
}
|
||||
|
||||
// destructor
|
||||
// ==========
|
||||
|
||||
NmapOutputBuffer::~NmapOutputBuffer( )
|
||||
{ delete [] m_buffer;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _NMAPOUTPUTBUFFER_H_
|
||||
#define _NMAPOUTPUTBUFFER_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "global.h"
|
||||
|
||||
class NmapOutputBuffer
|
||||
{ public:
|
||||
NmapOutputBuffer( const uint bufferSize );
|
||||
virtual ~NmapOutputBuffer( );
|
||||
|
||||
string buffer( ) const { return m_buffer; }
|
||||
bool isFree( ) const { return m_free; }
|
||||
uint length( ) const { return m_length; }
|
||||
void length( const uint l ) { m_length = l; }
|
||||
void setBusy( ) { m_free = false; }
|
||||
void setFree( ) { m_free = true; }
|
||||
|
||||
private:
|
||||
string m_buffer;
|
||||
bool m_free;
|
||||
uint m_length;
|
||||
};
|
||||
|
||||
#endif // _NMAPOUTPUTBUFFER_H_
|
@ -0,0 +1,174 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qfile.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "knmap.h"
|
||||
#include "outputwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
OutputWidget::OutputWidget( QWidget* parent, const char* name )
|
||||
: QTextEdit( parent, name ),
|
||||
m_append( false ),
|
||||
m_dataBytes( 0 ),
|
||||
m_firstSave( true ),
|
||||
m_priorType( OutputType( -1 ))
|
||||
{ setFamily( "monospace" );
|
||||
setReadOnly( true );
|
||||
QTimer::singleShot( 0, this, SLOT( slotUpdateStatusBarText( )));
|
||||
}
|
||||
|
||||
// addOutput
|
||||
// =========
|
||||
|
||||
void OutputWidget::addOutput( const OutputType type, const char* buffer, const int buflen )
|
||||
{ m_dataBytes += buflen;
|
||||
QString outputText = QString::fromLatin1( buffer, buflen );
|
||||
QString prependText;
|
||||
|
||||
if( m_append && type == m_priorType && m_priorType != OutputType( -1 ))
|
||||
{ uint paraNo = paragraphs( ) - 1;
|
||||
prependText = text( paraNo );;
|
||||
prependText = prependText.left( prependText.length( ) - 1 );
|
||||
removeParagraph( paraNo );
|
||||
}
|
||||
|
||||
m_append = buffer[ buflen - 1 ] != '\n';
|
||||
m_priorType = type;
|
||||
|
||||
switch( type )
|
||||
{ case Stderr:
|
||||
m_dataBytes += 14;
|
||||
append( "<b><i>" + prependText + outputText + "</i></b>" );
|
||||
break;
|
||||
|
||||
case Stdin:
|
||||
m_dataBytes +=7;
|
||||
append( "<b>" + prependText + outputText + "</b>" );
|
||||
break;
|
||||
|
||||
case Stdout:
|
||||
append( prependText + outputText );
|
||||
break;
|
||||
}
|
||||
|
||||
slotUpdateStatusBarText();
|
||||
}
|
||||
|
||||
// clearOutput
|
||||
// ===========
|
||||
|
||||
void OutputWidget::clearOutput( )
|
||||
{ m_dataBytes = 0;
|
||||
clear( );
|
||||
slotUpdateStatusBarText();
|
||||
}
|
||||
|
||||
// fileSave
|
||||
// ========
|
||||
|
||||
bool OutputWidget::fileSave( const bool saveAs )
|
||||
{ if( (saveAs || m_firstSave) && !Knmap::getFilePath( "Output save file", m_path, true ))
|
||||
return false;
|
||||
|
||||
m_firstSave = false;
|
||||
QFile file( m_path );
|
||||
|
||||
if( !file.open( IO_WriteOnly ))
|
||||
{ KMessageBox::error( this, QString( i18n( "Could not open \"%1\"\n%2" )).arg( m_path ).arg( file.errorString( )));
|
||||
return false;
|
||||
}
|
||||
|
||||
QTextStream stream( &file );
|
||||
uint noOfParagraphs = paragraphs( );
|
||||
uint paragraphNo;
|
||||
|
||||
for( paragraphNo = 0; paragraphNo < noOfParagraphs; paragraphNo++ )
|
||||
stream << text( paragraphNo ) << endl;
|
||||
|
||||
file.close( );
|
||||
return true;
|
||||
}
|
||||
|
||||
// fileSaveAs
|
||||
// ==========
|
||||
|
||||
bool OutputWidget::fileSaveAs( )
|
||||
{ return fileSave( true );
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void OutputWidget::readProfile( KConfig* config )
|
||||
{ m_path = config->readPathEntry( "path" );
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void OutputWidget::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "path", m_path );
|
||||
}
|
||||
|
||||
// slotUpdateStatusBarText
|
||||
// =======================
|
||||
|
||||
void OutputWidget::slotUpdateStatusBarText( )
|
||||
{ QString dataBytes;
|
||||
|
||||
if( m_dataBytes < 1024 )
|
||||
dataBytes = QString::number( m_dataBytes ) + " bytes";
|
||||
else
|
||||
if( m_dataBytes < 1024 * 1024 )
|
||||
{ float kiloBytes = m_dataBytes / float( 1024 );
|
||||
|
||||
if( kiloBytes < 10 )
|
||||
dataBytes.sprintf( "%.3f KBytes", kiloBytes );
|
||||
else
|
||||
if( kiloBytes < 100 )
|
||||
dataBytes.sprintf( "%.2f KBytes", kiloBytes );
|
||||
else
|
||||
dataBytes.sprintf( "%.1f KBytes", kiloBytes );
|
||||
}
|
||||
else
|
||||
{ float megaBytes = m_dataBytes / float( 1024 * 1024 );
|
||||
|
||||
if( megaBytes < 10 )
|
||||
dataBytes.sprintf( "%.3f MBytes", megaBytes );
|
||||
else
|
||||
if( megaBytes < 100 )
|
||||
dataBytes.sprintf( "%.2f MBytes", megaBytes );
|
||||
else
|
||||
dataBytes.sprintf( "%.1f MBytes", megaBytes );
|
||||
}
|
||||
|
||||
emit( statusBarText( QString( "Output: %1 lines (%2)" ).arg( QString::number( paragraphs( ) - 1 )).arg( dataBytes )));
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _OUTPUTWIDGET_H_
|
||||
#define _OUTPUTWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qtextedit.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KConfig;
|
||||
|
||||
// OutputWidget class definition
|
||||
// =============================
|
||||
|
||||
class OutputWidget : public QTextEdit
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
OutputWidget( QWidget* parent = NULL, const char* name = NULL );
|
||||
|
||||
// output type definitions
|
||||
// =======================
|
||||
|
||||
enum OutputType
|
||||
{ Stderr,
|
||||
Stdin,
|
||||
Stdout
|
||||
};
|
||||
|
||||
void addOutput( const OutputType type, const char* buffer, const int buflen );
|
||||
void clearOutput( );
|
||||
bool fileSave( const bool saveAs = false );
|
||||
bool fileSaveAs( );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
|
||||
signals:
|
||||
void statusBarText( const QString& );
|
||||
|
||||
public slots:
|
||||
void slotUpdateStatusBarText( );
|
||||
|
||||
private:
|
||||
void appendLine( const OutputType type, const QString& text );
|
||||
|
||||
bool m_append;
|
||||
uint m_dataBytes;
|
||||
bool m_firstSave;
|
||||
QString m_path;
|
||||
OutputType m_priorType;
|
||||
};
|
||||
|
||||
#endif // _OUTPUTWIDGET_H_
|
@ -0,0 +1,415 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "pandsoptions.h"
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
PAndSOptions::PAndSOptions( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name )
|
||||
{ createLayout( );
|
||||
}
|
||||
|
||||
// createLayout
|
||||
// ============
|
||||
|
||||
void PAndSOptions::createLayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( this );
|
||||
|
||||
m_ackCheckBox = new QCheckBox( i18n( "TCP ACK (-PA)" ), this, "ack check" );
|
||||
m_ackLineEdit = new QLineEdit( this, "ack edit" );
|
||||
m_arpCheckBox = new QCheckBox( i18n( "ARP (-PR)" ), this, "arp check" );
|
||||
m_dontPingCheckBox = new QCheckBox( i18n( "Don't ping (-P0)" ), this, "dont ping check" );
|
||||
m_echoCheckBox = new QCheckBox( i18n( "ICMP echo (-PE)" ), this, "icmp echo check" );
|
||||
m_netmaskCheckBox = new QCheckBox( i18n( "ICMP netmask (-PM)" ), this, "icmp netmask check" );
|
||||
m_synCheckBox = new QCheckBox( i18n( "TCP SYN (-PS)" ), this, "syn check" );
|
||||
m_synLineEdit = new QLineEdit( this, "syn edit" );
|
||||
m_timestampCheckBox = new QCheckBox( i18n( "ICMP timestamp (-PP)" ), this, "icmp timestamp check" );
|
||||
|
||||
byte row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_ackCheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_ackLineEdit, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 1 );
|
||||
gridLayout->addWidget( m_arpCheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_dontPingCheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 1 );
|
||||
gridLayout->addWidget( m_echoCheckBox, row++, 3 );
|
||||
byte rowBlock1 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 5 );
|
||||
gridLayout->addWidget( m_netmaskCheckBox, row++, 7 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 5 );
|
||||
gridLayout->addWidget( m_synCheckBox, row++, 7 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 5 );
|
||||
gridLayout->addWidget( m_synLineEdit, row++, 7 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 5 );
|
||||
gridLayout->addWidget( m_timestampCheckBox, row++, 7 );
|
||||
byte rowBlock2 = row;
|
||||
|
||||
m_scanFTPBounceCheckBox = new QCheckBox( i18n( "FTP Bounce (-b)" ), this, "ftp bounce scan check" );
|
||||
m_scanFTPRelayLineEdit = new QLineEdit( this, "ftp relay edit" );
|
||||
m_scanIdleCheckBox = new QCheckBox( i18n( "Idle (-sI)" ), this, "idle scan check" );
|
||||
m_scanListCheckBox = new QCheckBox( i18n( "List Scan (-sL)" ), this, "list scan check" );
|
||||
m_scanNullCheckBox = new QCheckBox( i18n( "Null Scan (-sN)" ), this, "null scan check" );
|
||||
m_scanPingCheckBox = new QCheckBox( i18n( "Ping Scan (-sP)" ), this, "ping scan check" );
|
||||
m_scanProtocolCheckBox = new QCheckBox( i18n( "Protocol Scan (-sO)" ), this, "protocol scan check" );
|
||||
m_scanRPCCheckBox = new QCheckBox( i18n( "RPC (-sR)" ), this, "rpc scan check" );
|
||||
m_scanFINCheckBox = new QCheckBox( i18n( "Stealth FIN (-sF)" ), this, "fin scan check" );
|
||||
m_scanAckCheckBox = new QCheckBox( i18n( "TCP Ack Scan (-sA)" ), this, "ack scan check" );
|
||||
m_scanSYNCheckBox = new QCheckBox( i18n( "TCP SYN (-sS)" ), this, "syn scan check" );
|
||||
m_scanTCPConnectCheckBox = new QCheckBox( i18n( "TCP Connect (-sT)" ), this, "connect scan check" );
|
||||
m_scanUDPCheckBox = new QCheckBox( i18n( "UDP Scan (-sU)" ), this, "udp scan check" );
|
||||
m_scanVersionCheckBox = new QCheckBox( i18n( "Version Detection (-sV)" ), this, "version scan check" );
|
||||
m_scanWindowCheckBox = new QCheckBox( i18n( "Window Scan (-sW)" ), this, "window scan check" );
|
||||
m_scanXmasCheckBox = new QCheckBox( i18n( "Xmas Tree (-sX)" ), this, "xmas scan check" );
|
||||
m_zombieLineEdit = new QLineEdit( this, "zombie edit" );
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_scanFTPBounceCheckBox, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_scanFTPRelayLineEdit, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 9 );
|
||||
gridLayout->addWidget( m_scanIdleCheckBox, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_zombieLineEdit, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_scanListCheckBox, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 9 );
|
||||
gridLayout->addWidget( m_scanNullCheckBox, row++, 11 );
|
||||
byte rowBlock3 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 13 );
|
||||
gridLayout->addWidget( m_scanPingCheckBox, row++, 15 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 13 );
|
||||
gridLayout->addWidget( m_scanProtocolCheckBox, row++, 15 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 13 );
|
||||
gridLayout->addWidget( m_scanRPCCheckBox, row++, 15 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 13 );
|
||||
gridLayout->addWidget( m_scanFINCheckBox, row++, 15 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 13 );
|
||||
gridLayout->addWidget( m_scanAckCheckBox, row++, 15 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 13 );
|
||||
gridLayout->addWidget( m_scanSYNCheckBox, row++, 15 );
|
||||
byte rowBlock4 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 17 );
|
||||
gridLayout->addWidget( m_scanTCPConnectCheckBox, row++, 19 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 17 );
|
||||
gridLayout->addWidget( m_scanUDPCheckBox, row++, 19 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 17 );
|
||||
gridLayout->addWidget( m_scanVersionCheckBox, row++, 19 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 17 );
|
||||
gridLayout->addWidget( m_scanWindowCheckBox, row++, 19 );
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 17 );
|
||||
gridLayout->addWidget( m_scanXmasCheckBox, row++, 19 );
|
||||
byte rowBlock5 = row;
|
||||
|
||||
gridLayout->setColStretch( 0, 5 );
|
||||
gridLayout->setColStretch( 2, 1 );
|
||||
gridLayout->setColStretch( 3, 20 );
|
||||
gridLayout->setColStretch( 4, 5 );
|
||||
gridLayout->setColStretch( 6, 1 );
|
||||
gridLayout->setColStretch( 7, 20 );
|
||||
gridLayout->setColStretch( 8, 5 );
|
||||
gridLayout->setColStretch( 10, 1 );
|
||||
gridLayout->setColStretch( 11, 20 );
|
||||
gridLayout->setColStretch( 12, 5 );
|
||||
gridLayout->setColStretch( 14, 1 );
|
||||
gridLayout->setColStretch( 15, 20 );
|
||||
gridLayout->setColStretch( 16, 5 );
|
||||
gridLayout->setColStretch( 18, 1 );
|
||||
gridLayout->setColStretch( 19, 20 );
|
||||
gridLayout->setColStretch( 20, 5 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 10 );
|
||||
gridLayout->setRowStretch( _max_( rowBlock1, _max_( rowBlock2, _max_( rowBlock3, _max_( rowBlock4, rowBlock5 )))), 10 );
|
||||
}
|
||||
|
||||
// finaliseInitialisation
|
||||
// ======================
|
||||
|
||||
void PAndSOptions::finaliseInitialisation( )
|
||||
{ WhatsThis* whatsThis = new WhatsThis( this );
|
||||
|
||||
connect( m_ackCheckBox, SIGNAL( clicked( )), SLOT( slotAckClicked( )));
|
||||
connect( m_scanFTPBounceCheckBox, SIGNAL( clicked( )), SLOT( slotScanFTPBounceCheckBoxClicked( )));
|
||||
connect( m_scanIdleCheckBox, SIGNAL( clicked( )), SLOT( slotScanIdleCheckBoxClicked( )));
|
||||
connect( m_synCheckBox, SIGNAL( clicked( )), SLOT( slotSynClicked( )));
|
||||
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
|
||||
|
||||
connect( m_ackCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_ackLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_arpCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_dontPingCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_echoCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_netmaskCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanAckCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanFINCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanFTPBounceCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanFTPRelayLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanIdleCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanListCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanNullCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanPingCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanProtocolCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanRPCCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanSYNCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanTCPConnectCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanUDPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanVersionCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanWindowCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanXmasCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_synCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_synLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_timestampCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_zombieLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( )));
|
||||
}
|
||||
|
||||
// getOptions
|
||||
// ==========
|
||||
|
||||
bool PAndSOptions::getOptions( bool& needRoot )
|
||||
{ m_ackState = m_ackCheckBox->isChecked( );
|
||||
m_ackValue = m_ackLineEdit->text( );
|
||||
m_arpState = m_arpCheckBox->isChecked( );
|
||||
m_dontPingState = m_dontPingCheckBox->isChecked( );
|
||||
m_echoState = m_echoCheckBox->isChecked( );
|
||||
m_netmaskState = m_netmaskCheckBox->isChecked( );
|
||||
m_scanAckState = m_scanAckCheckBox->isChecked( );
|
||||
m_scanFINState = m_scanFINCheckBox->isChecked( );
|
||||
m_scanFTPBounceState = m_scanFTPBounceCheckBox->isChecked( );
|
||||
m_scanFTPRelayHost = m_scanFTPRelayLineEdit->text( );
|
||||
m_scanIdleState = m_scanIdleCheckBox->isChecked( );
|
||||
m_scanListState = m_scanListCheckBox->isChecked( );
|
||||
m_scanNullState = m_scanNullCheckBox->isChecked( );
|
||||
m_scanPingState = m_scanPingCheckBox->isChecked( );
|
||||
m_scanProtocolState = m_scanProtocolCheckBox->isChecked( );
|
||||
m_scanRPCState = m_scanRPCCheckBox->isChecked( );
|
||||
m_scanSYNState = m_scanSYNCheckBox->isChecked( );
|
||||
m_scanTCPConnectState = m_scanTCPConnectCheckBox->isChecked( );
|
||||
m_scanUDPState = m_scanUDPCheckBox->isChecked( );
|
||||
m_scanVersionState = m_scanVersionCheckBox->isChecked( );
|
||||
m_scanWindowState = m_scanWindowCheckBox->isChecked( );
|
||||
m_scanXmasState = m_scanXmasCheckBox->isChecked( );
|
||||
m_synState = m_synCheckBox->isChecked( );
|
||||
m_synValue = m_synLineEdit->text( );
|
||||
m_timestampState = m_timestampCheckBox->isChecked( );
|
||||
m_zombieDetails = m_zombieLineEdit->text( );
|
||||
|
||||
needRoot = needRoot ||
|
||||
m_arpState ||
|
||||
m_echoState ||
|
||||
m_scanAckState ||
|
||||
m_scanFINState ||
|
||||
m_scanIdleState ||
|
||||
m_scanNullState ||
|
||||
m_scanProtocolState ||
|
||||
m_scanSYNState ||
|
||||
m_scanUDPState ||
|
||||
m_scanWindowState ||
|
||||
m_scanXmasState ||
|
||||
m_timestampState;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void PAndSOptions::readProfile( KConfig* config )
|
||||
{ m_ackState = config->readBoolEntry( "ackState" );
|
||||
m_ackValue = config->readEntry( "ackValue" );
|
||||
m_arpState = config->readBoolEntry( "arpState" );
|
||||
m_dontPingState = config->readBoolEntry( "dontPingState" );
|
||||
m_echoState = config->readBoolEntry( "echoState" );
|
||||
m_netmaskState = config->readBoolEntry( "netmaskState" );
|
||||
m_scanAckState = config->readBoolEntry( "scanAckState" );
|
||||
m_scanFINState = config->readBoolEntry( "scanFINState" );
|
||||
m_scanFTPBounceState = config->readBoolEntry( "scanFTPBounceState" );
|
||||
m_scanFTPRelayHost = config->readEntry( "scanFTPRelayHost" );
|
||||
m_scanIdleState = config->readBoolEntry( "scanIdleState" );
|
||||
m_scanListState = config->readBoolEntry( "scanListState" );
|
||||
m_scanNullState = config->readBoolEntry( "scanNullState" );
|
||||
m_scanPingState = config->readBoolEntry( "scanPingState" );
|
||||
m_scanProtocolState = config->readBoolEntry( "scanProtocolState" );
|
||||
m_scanRPCState = config->readBoolEntry( "scanRPCState" );
|
||||
m_scanSYNState = config->readBoolEntry( "scanSYNState" );
|
||||
m_scanTCPConnectState = config->readBoolEntry( "scanTCPConnectState" );
|
||||
m_scanUDPState = config->readBoolEntry( "scanUDPState" );
|
||||
m_scanVersionState = config->readBoolEntry( "scanVersionState" );
|
||||
m_scanWindowState = config->readBoolEntry( "scanWindowState" );
|
||||
m_scanXmasState = config->readBoolEntry( "scanXmasState" );
|
||||
m_synState = config->readBoolEntry( "synState" );
|
||||
m_synValue = config->readEntry( "synValue" );
|
||||
m_timestampState = config->readBoolEntry( "timestampState" );
|
||||
m_zombieDetails = config->readEntry( "zombieDetails" );
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void PAndSOptions::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "ackState", m_ackState );
|
||||
config->writeEntry( "ackValue", m_ackValue );
|
||||
config->writeEntry( "arpState", m_arpState );
|
||||
config->writeEntry( "dontPingState", m_dontPingState );
|
||||
config->writeEntry( "echoState", m_echoState );
|
||||
config->writeEntry( "netmaskState", m_netmaskState );
|
||||
config->writeEntry( "scanAckState", m_scanAckState );
|
||||
config->writeEntry( "scanFINState", m_scanFINState );
|
||||
config->writeEntry( "scanFTPBounceState", m_scanFTPBounceState );
|
||||
config->writeEntry( "scanFTPRelayHost", m_scanFTPRelayHost );
|
||||
config->writeEntry( "scanIdleState", m_scanIdleState );
|
||||
config->writeEntry( "scanListState", m_scanListState );
|
||||
config->writeEntry( "scanNullState", m_scanNullState );
|
||||
config->writeEntry( "scanPingState", m_scanPingState );
|
||||
config->writeEntry( "scanProtocolState", m_scanProtocolState );
|
||||
config->writeEntry( "scanRPCState", m_scanRPCState );
|
||||
config->writeEntry( "scanSYNState", m_scanSYNState );
|
||||
config->writeEntry( "scanTCPConnectState", m_scanTCPConnectState );
|
||||
config->writeEntry( "scanUDPState", m_scanUDPState );
|
||||
config->writeEntry( "scanVersionState", m_scanVersionState );
|
||||
config->writeEntry( "scanWindowState", m_scanWindowState );
|
||||
config->writeEntry( "scanXmasState", m_scanXmasState );
|
||||
config->writeEntry( "synState", m_synState );
|
||||
config->writeEntry( "synValue", m_synValue );
|
||||
config->writeEntry( "timestampState", m_timestampState );
|
||||
config->writeEntry( "zombieDetails", m_zombieDetails );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void PAndSOptions::setInitialValues( )
|
||||
{ m_ackCheckBox->setChecked( m_ackState );
|
||||
m_ackLineEdit->setText( m_ackValue );
|
||||
m_arpCheckBox->setChecked( m_arpState );
|
||||
m_dontPingCheckBox->setChecked( m_dontPingState );
|
||||
m_echoCheckBox->setChecked( m_echoState );
|
||||
m_netmaskCheckBox->setChecked( m_netmaskState );
|
||||
m_scanAckCheckBox->setChecked( m_scanAckState );
|
||||
m_scanFINCheckBox->setChecked( m_scanFINState );
|
||||
m_scanFTPBounceCheckBox->setChecked( m_scanFTPBounceState );
|
||||
m_scanFTPRelayLineEdit->setText( m_scanFTPRelayHost );
|
||||
m_scanIdleCheckBox->setChecked( m_scanIdleState );
|
||||
m_scanListCheckBox->setChecked( m_scanListState );
|
||||
m_scanNullCheckBox->setChecked( m_scanNullState );
|
||||
m_scanPingCheckBox->setChecked( m_scanPingState );
|
||||
m_scanProtocolCheckBox->setChecked( m_scanProtocolState );
|
||||
m_scanRPCCheckBox->setChecked( m_scanRPCState );
|
||||
m_scanSYNCheckBox->setChecked( m_scanSYNState );
|
||||
m_scanTCPConnectCheckBox->setChecked( m_scanTCPConnectState );
|
||||
m_scanUDPCheckBox->setChecked( m_scanUDPState );
|
||||
m_scanVersionCheckBox->setChecked( m_scanVersionState );
|
||||
m_scanWindowCheckBox->setChecked( m_scanWindowState );
|
||||
m_scanXmasCheckBox->setChecked( m_scanXmasState );
|
||||
m_synCheckBox->setChecked( m_synState );
|
||||
m_synLineEdit->setText( m_synValue );
|
||||
m_timestampCheckBox->setChecked( m_timestampState );
|
||||
m_zombieLineEdit->setText( m_zombieDetails );
|
||||
|
||||
slotAckClicked( );
|
||||
slotScanFTPBounceCheckBoxClicked( );
|
||||
slotScanIdleCheckBoxClicked( );
|
||||
slotSynClicked( );
|
||||
}
|
||||
|
||||
// slotAckClicked
|
||||
// ==============
|
||||
|
||||
void PAndSOptions::slotAckClicked( )
|
||||
{ m_ackLineEdit->setEnabled( m_ackCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotScanFTPBounceCheckBoxClicked
|
||||
// ================================
|
||||
|
||||
void PAndSOptions::slotScanFTPBounceCheckBoxClicked( )
|
||||
{ m_scanFTPRelayLineEdit->setEnabled( m_scanFTPBounceCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotScanIdleCheckBoxClicked
|
||||
// ===========================
|
||||
|
||||
void PAndSOptions::slotScanIdleCheckBoxClicked( )
|
||||
{ m_zombieLineEdit->setEnabled( m_scanIdleCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotSynClicked
|
||||
// ==============
|
||||
|
||||
void PAndSOptions::slotSynClicked( )
|
||||
{ m_synLineEdit->setEnabled( m_synCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotWhatsThisClicked
|
||||
// ====================
|
||||
|
||||
void PAndSOptions::slotWhatsThisClicked( )
|
||||
{ if( m_ackCheckBox->hasMouse( )) emit( displayHelp( "-PA" ));
|
||||
else if( m_ackLineEdit->hasMouse( )) emit( displayHelp( "-PA" ));
|
||||
else if( m_arpCheckBox->hasMouse( )) emit( displayHelp( "-PR" ));
|
||||
else if( m_dontPingCheckBox->hasMouse( )) emit( displayHelp( "-P0" ));
|
||||
else if( m_echoCheckBox->hasMouse( )) emit( displayHelp( "-PE" ));
|
||||
else if( m_netmaskCheckBox->hasMouse( )) emit( displayHelp( "-PM" ));
|
||||
else if( m_scanAckCheckBox->hasMouse( )) emit( displayHelp( "-sA" ));
|
||||
else if( m_scanFINCheckBox->hasMouse( )) emit( displayHelp( "-sF" ));
|
||||
else if( m_scanFTPBounceCheckBox->hasMouse( )) emit( displayHelp( "-b" ));
|
||||
else if( m_scanFTPRelayLineEdit->hasMouse( )) emit( displayHelp( "-b" ));
|
||||
else if( m_scanIdleCheckBox->hasMouse( )) emit( displayHelp( "-sI" ));
|
||||
else if( m_zombieLineEdit->hasMouse( )) emit( displayHelp( "-sI" ));
|
||||
else if( m_scanListCheckBox->hasMouse( )) emit( displayHelp( "-sL" ));
|
||||
else if( m_scanNullCheckBox->hasMouse( )) emit( displayHelp( "-sN" ));
|
||||
else if( m_scanPingCheckBox->hasMouse( )) emit( displayHelp( "-sP" ));
|
||||
else if( m_scanProtocolCheckBox->hasMouse( )) emit( displayHelp( "-sO" ));
|
||||
else if( m_scanRPCCheckBox->hasMouse( )) emit( displayHelp( "-sR" ));
|
||||
else if( m_scanTCPConnectCheckBox->hasMouse( )) emit( displayHelp( "-sT" ));
|
||||
else if( m_scanUDPCheckBox->hasMouse( )) emit( displayHelp( "-sU" ));
|
||||
else if( m_scanVersionCheckBox->hasMouse( )) emit( displayHelp( "-sV" ));
|
||||
else if( m_scanWindowCheckBox->hasMouse( )) emit( displayHelp( "-sW" ));
|
||||
else if( m_scanSYNCheckBox->hasMouse( )) emit( displayHelp( "-sS" ));
|
||||
else if( m_scanXmasCheckBox->hasMouse( )) emit( displayHelp( "-sX" ));
|
||||
else if( m_synCheckBox->hasMouse( )) emit( displayHelp( "-PS" ));
|
||||
else if( m_synLineEdit->hasMouse( )) emit( displayHelp( "-PS" ));
|
||||
else if( m_timestampCheckBox->hasMouse( )) emit( displayHelp( "-PP" ));
|
||||
else emit( displayUnknown( ));
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _PANDSOPTIONS_H_
|
||||
#define _PANDSOPTIONS_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class KConfig;
|
||||
|
||||
// SimpleOptions class definition
|
||||
// ==============================
|
||||
|
||||
class PAndSOptions : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
PAndSOptions( QWidget* parent, const char* name = NULL );
|
||||
|
||||
void finaliseInitialisation( );
|
||||
bool getOptions( bool& needRoot );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
void setInitialValues( );
|
||||
|
||||
bool ackState( ) const { return m_ackState; }
|
||||
QString ackValue( ) const { return m_ackValue; }
|
||||
bool arpState( ) const { return m_arpState; }
|
||||
bool dontPingState( ) const { return m_dontPingState; }
|
||||
bool echoState( ) const { return m_echoState; }
|
||||
bool netmaskState( ) const { return m_netmaskState; }
|
||||
bool scanAckState( ) const { return m_scanAckState; }
|
||||
bool scanFINState( ) const { return m_scanFINState; }
|
||||
bool scanFTPBounceState( ) const { return m_scanFTPBounceState; }
|
||||
QString scanFTPRelayHost( ) const { return m_scanFTPRelayHost; }
|
||||
bool scanIdleState( ) const { return m_scanIdleState; }
|
||||
bool scanListState( ) const { return m_scanListState; }
|
||||
bool scanNullState( ) const { return m_scanNullState; }
|
||||
bool scanPingState( ) const { return m_scanPingState; }
|
||||
bool scanProtocolState( ) const { return m_scanProtocolState; }
|
||||
bool scanRPCState( ) const { return m_scanRPCState; }
|
||||
bool scanSYNState( ) const { return m_scanSYNState; }
|
||||
bool scanTCPConnectState( ) const { return m_scanTCPConnectState; }
|
||||
bool scanUDPState( ) const { return m_scanUDPState; }
|
||||
bool scanVersionState( ) const { return m_scanVersionState; }
|
||||
bool scanWindowState( ) const { return m_scanWindowState; }
|
||||
bool scanXmasState( ) const { return m_scanXmasState; }
|
||||
bool synState( ) const { return m_synState; }
|
||||
QString synValue( ) const { return m_synValue; }
|
||||
bool timestampState( ) const { return m_timestampState; }
|
||||
QString zombieDetails( ) const { return m_zombieDetails; }
|
||||
|
||||
signals:
|
||||
void disableFastScan( );
|
||||
void displayDocBook( const QString& );
|
||||
void displayHelp( const QString& );
|
||||
void displayUnknown( );
|
||||
void optionsDirty( );
|
||||
|
||||
private slots:
|
||||
void slotAckClicked( );
|
||||
void slotScanFTPBounceCheckBoxClicked( );
|
||||
void slotScanIdleCheckBoxClicked( );
|
||||
void slotSynClicked( );
|
||||
void slotWhatsThisClicked( );
|
||||
|
||||
private:
|
||||
void createLayout( );
|
||||
|
||||
QCheckBox* m_ackCheckBox;
|
||||
QLineEdit* m_ackLineEdit;
|
||||
bool m_ackState;
|
||||
QString m_ackValue;
|
||||
QCheckBox* m_arpCheckBox;
|
||||
bool m_arpState;
|
||||
QCheckBox* m_dontPingCheckBox;
|
||||
bool m_dontPingState;
|
||||
QCheckBox* m_echoCheckBox;
|
||||
bool m_echoState;
|
||||
QCheckBox* m_netmaskCheckBox;
|
||||
bool m_netmaskState;
|
||||
QCheckBox* m_scanAckCheckBox;
|
||||
bool m_scanAckState;
|
||||
QCheckBox* m_scanFINCheckBox;
|
||||
bool m_scanFINState;
|
||||
QCheckBox* m_scanFTPBounceCheckBox;
|
||||
bool m_scanFTPBounceState;
|
||||
QString m_scanFTPRelayHost;
|
||||
QLineEdit* m_scanFTPRelayLineEdit;
|
||||
QCheckBox* m_scanIdleCheckBox;
|
||||
bool m_scanIdleState;
|
||||
QCheckBox* m_scanListCheckBox;
|
||||
bool m_scanListState;
|
||||
QCheckBox* m_scanNullCheckBox;
|
||||
bool m_scanNullState;
|
||||
QCheckBox* m_scanPingCheckBox;
|
||||
bool m_scanPingState;
|
||||
QCheckBox* m_scanProtocolCheckBox;
|
||||
bool m_scanProtocolState;
|
||||
QCheckBox* m_scanRPCCheckBox;
|
||||
bool m_scanRPCState;
|
||||
QCheckBox* m_scanTCPConnectCheckBox;
|
||||
bool m_scanTCPConnectState;
|
||||
QCheckBox* m_scanUDPCheckBox;
|
||||
bool m_scanUDPState;
|
||||
QCheckBox* m_scanVersionCheckBox;
|
||||
bool m_scanVersionState;
|
||||
QCheckBox* m_scanWindowCheckBox;
|
||||
bool m_scanWindowState;
|
||||
QCheckBox* m_scanSYNCheckBox;
|
||||
bool m_scanSYNState;
|
||||
QCheckBox* m_scanXmasCheckBox;
|
||||
bool m_scanXmasState;
|
||||
QCheckBox* m_synCheckBox;
|
||||
QLineEdit* m_synLineEdit;
|
||||
bool m_synState;
|
||||
QString m_synValue;
|
||||
QCheckBox* m_timestampCheckBox;
|
||||
bool m_timestampState;
|
||||
QString m_zombieDetails;
|
||||
QLineEdit* m_zombieLineEdit;
|
||||
};
|
||||
|
||||
#endif // _PANDSOPTIONS_H_
|
@ -0,0 +1,325 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qmap.h>
|
||||
#include <qpopupmenu.h>
|
||||
|
||||
#include <kapplication.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "profiledialog.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
ProfileDialog::ProfileDialog( Action action,
|
||||
const QString& currentProfile,
|
||||
QWidget* parent,
|
||||
const char* name )
|
||||
: KDialogBase( Plain, "", Ok | Cancel, Ok, parent, name ),
|
||||
m_action( action )
|
||||
{ switch( m_action )
|
||||
{ case Copy: setCaption( "Copy profile" ); break;
|
||||
case Delete: setCaption( "Delete profile" ); break;
|
||||
case Load: setCaption( "Load profile" ); break;
|
||||
case Rename: setCaption( "Rename profile" ); break;
|
||||
case SaveAs: setCaption( "Save profile as" ); break;
|
||||
}
|
||||
|
||||
createlayout( );
|
||||
setInitialValues( currentProfile );
|
||||
|
||||
connect( m_profileListBox, SIGNAL( contextMenuRequested( QListBoxItem*, const QPoint& )), SLOT( slotProfileListContextMenu( QListBoxItem*, const QPoint& )));
|
||||
connect( m_profileListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotOk( )));
|
||||
connect( m_profileListBox, SIGNAL( selectionChanged( )), SLOT( slotProfileListBoxChanged( )));
|
||||
}
|
||||
|
||||
// checkForDuplicateName
|
||||
// =====================
|
||||
|
||||
bool ProfileDialog::checkForDuplicateName( const QString& profileName )
|
||||
{ if( !kapp->config( )->hasGroup( PROFILE_PREFIX + profileName ))
|
||||
return true;
|
||||
|
||||
KMessageBox::sorry( this, QString( i18n( "Profile \"%1\" already exists, please choose another name or press 'Cancel'" )).arg( profileName ), i18n( "Duplicate profile name" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
// constructNewProfileName
|
||||
// =======================
|
||||
|
||||
QString ProfileDialog::constructNewProfileName( const QString& initialProfileName ) const
|
||||
{ QString profileName = PROFILE_PREFIX + initialProfileName + "_copy";
|
||||
|
||||
while( kapp->config( )->hasGroup( profileName ))
|
||||
profileName += "_copy";
|
||||
|
||||
return stripPrefix( profileName );
|
||||
}
|
||||
|
||||
// copy
|
||||
// ====
|
||||
|
||||
void ProfileDialog::copy( const QString& fromProfileName, const QString& toProfileName )
|
||||
{ QMap<QString, QString> map = kapp->config( )->entryMap( PROFILE_PREFIX + fromProfileName );
|
||||
kapp->config( )->setGroup( PROFILE_PREFIX + toProfileName );
|
||||
|
||||
for( QMap<QString, QString>::Iterator it = map.begin( ); it != map.end( ); ++it )
|
||||
kapp->config( )->writeEntry( it.key( ), it.data( ));
|
||||
|
||||
m_profileListBox->insertItem( toProfileName );
|
||||
m_profileListBox->sort( );
|
||||
}
|
||||
|
||||
// createlayout
|
||||
// ============
|
||||
|
||||
void ProfileDialog::createlayout( )
|
||||
{ QGridLayout* layout = new QGridLayout( plainPage( ));
|
||||
m_profileListBox = new QListBox( plainPage( ), "profiles list box" );
|
||||
m_profileLineEdit = new QLineEdit( plainPage( ), "profiles line edit" );
|
||||
|
||||
layout->addWidget( new QLabel( "Profile name: ", plainPage( ), "name label" ), 1, 1, Qt::AlignRight );
|
||||
layout->addWidget( m_profileLineEdit, 1, 2 );
|
||||
layout->addWidget( new QLabel( "Known profiles: ", plainPage( ), "name label" ), 3, 1, Qt::AlignRight | Qt::AlignTop );
|
||||
layout->addWidget( m_profileListBox, 3, 2 );
|
||||
|
||||
layout->setColStretch( 0, 1 );
|
||||
layout->setColStretch( 2, 20 );
|
||||
layout->setColStretch( 3, 1 );
|
||||
|
||||
layout->setRowStretch( 0, 2 );
|
||||
layout->setRowStretch( 2, 1 );
|
||||
layout->setRowStretch( 3, 10 );
|
||||
layout->setRowStretch( 4, 2 );
|
||||
|
||||
switch( m_action )
|
||||
{ case Delete:
|
||||
case Load:
|
||||
m_profileLineEdit->setReadOnly( true );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// deelete
|
||||
// =======
|
||||
|
||||
void ProfileDialog::deelete( const QString& profileName, const bool ask )
|
||||
{ if( !kapp->config( )->hasGroup( PROFILE_PREFIX + profileName ))
|
||||
{ ASSERT( false );
|
||||
return ;
|
||||
}
|
||||
|
||||
QListBoxItem* item = m_profileListBox->findItem( profileName, Qt::ExactMatch );
|
||||
ASSERT( item != NULL );
|
||||
|
||||
if( item != NULL )
|
||||
deelete( item, ask );
|
||||
}
|
||||
|
||||
// deelete
|
||||
// =======
|
||||
|
||||
void ProfileDialog::deelete( QListBoxItem* item, const bool ask )
|
||||
{ if( ask && KMessageBox::Yes != KMessageBox::questionYesNo( this,
|
||||
QString( i18n( "Delete profile \"%1\"?" )).arg( item->text( )),
|
||||
i18n( "Confirm profile deletion" )))
|
||||
return;
|
||||
|
||||
kapp->config( )->deleteGroup( PROFILE_PREFIX + item->text( ));
|
||||
m_profileListBox->takeItem( item );
|
||||
delete item;
|
||||
}
|
||||
|
||||
// getNewProfileName
|
||||
// =================
|
||||
|
||||
bool ProfileDialog::getNewProfileName( QString& profileName )
|
||||
{ while( true )
|
||||
{ bool ok;
|
||||
profileName = KInputDialog::getText( i18n( "Profile name" ), i18n( "New profile name" ), profileName, &ok, this, "profile name" );
|
||||
|
||||
if( !ok )
|
||||
return false;
|
||||
|
||||
if( checkForDuplicateName( profileName ))
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void ProfileDialog::setInitialValues( const QString& currentProfile )
|
||||
{ ushort currentItem = ushort( -1 );
|
||||
QStringList profileList = kapp->config( )->groupList( );
|
||||
ushort i;
|
||||
QStringList::Iterator it;
|
||||
|
||||
for( i = 0, it = profileList.begin( ); it != profileList.end( ); ++it )
|
||||
if( (*it).startsWith( PROFILE_PREFIX ))
|
||||
{ m_profileListBox->insertItem( stripPrefix( *it ), i );
|
||||
|
||||
if( *it == currentProfile )
|
||||
currentItem = i;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if( currentItem != ushort( -1 ))
|
||||
{ m_profileListBox->setSelected( currentItem, true );
|
||||
|
||||
if( m_action == Copy )
|
||||
m_profileLineEdit->setText( constructNewProfileName( m_profileListBox->currentText( )));
|
||||
else
|
||||
m_profileLineEdit->setText( m_profileListBox->currentText( ));
|
||||
}
|
||||
|
||||
m_profileListBox->sort( );
|
||||
}
|
||||
|
||||
// slotCopy
|
||||
// ========
|
||||
|
||||
void ProfileDialog::slotCopy( )
|
||||
{ QString fromProfileName = m_contextItem->text( );
|
||||
QString toProfileName = constructNewProfileName( fromProfileName );
|
||||
|
||||
if( getNewProfileName( toProfileName ))
|
||||
copy( fromProfileName, toProfileName );
|
||||
}
|
||||
|
||||
// slotDelete
|
||||
// ==========
|
||||
|
||||
void ProfileDialog::slotDelete( )
|
||||
{ deelete( m_contextItem, true );
|
||||
}
|
||||
|
||||
// slotOk
|
||||
// ======
|
||||
|
||||
void ProfileDialog::slotOk( )
|
||||
{ QString fromProfileName;
|
||||
QListBoxItem* item;
|
||||
QString toProfileName;
|
||||
|
||||
switch( m_action )
|
||||
{ case Copy:
|
||||
fromProfileName = m_profileListBox->currentText( );
|
||||
toProfileName = m_profileLineEdit->text( );
|
||||
|
||||
if( !checkForDuplicateName( toProfileName ))
|
||||
return;
|
||||
|
||||
copy( fromProfileName, toProfileName );
|
||||
break;
|
||||
|
||||
case Delete:
|
||||
deelete( m_profileLineEdit->text( ), true );
|
||||
break;
|
||||
|
||||
case Load:
|
||||
m_profileName = PROFILE_PREFIX + m_profileLineEdit->text( );
|
||||
break;
|
||||
|
||||
case Rename:
|
||||
fromProfileName = m_profileListBox->currentText( );
|
||||
toProfileName = m_profileLineEdit->text( );
|
||||
|
||||
if( !checkForDuplicateName( toProfileName ))
|
||||
return;
|
||||
|
||||
copy( fromProfileName, toProfileName );
|
||||
deelete( fromProfileName, false );
|
||||
break;
|
||||
|
||||
case SaveAs:
|
||||
m_profileName = m_profileLineEdit->text( );
|
||||
item = m_profileListBox->findItem( m_profileName, Qt::ExactMatch );
|
||||
|
||||
if( item != NULL )
|
||||
if( KMessageBox::Yes != KMessageBox::questionYesNo( this, QString( i18n( "Profile \"%1\" already exists - overwrite it?" )).arg( m_profileName ), i18n( "Profile exists" )))
|
||||
return;
|
||||
|
||||
m_profileName = PROFILE_PREFIX + m_profileName;
|
||||
break;
|
||||
}
|
||||
|
||||
KDialogBase::slotOk( );
|
||||
}
|
||||
|
||||
// slotProfileListBoxChanged
|
||||
// =========================
|
||||
|
||||
void ProfileDialog::slotProfileListBoxChanged( )
|
||||
{ if( m_action == Copy )
|
||||
m_profileLineEdit->setText( constructNewProfileName( m_profileListBox->currentText( )));
|
||||
else
|
||||
m_profileLineEdit->setText( m_profileListBox->currentText( ));
|
||||
}
|
||||
|
||||
// slotProfileListContextMenu
|
||||
// ==========================
|
||||
|
||||
void ProfileDialog::slotProfileListContextMenu( QListBoxItem* item, const QPoint& pos )
|
||||
{ m_contextItem = item;
|
||||
QPopupMenu* contextMenu = new QPopupMenu( this, "context menu" );
|
||||
|
||||
contextMenu->insertItem( i18n( "&Copy" ), this, SLOT( slotCopy( )));
|
||||
contextMenu->insertItem( i18n( "&Delete" ), this, SLOT( slotDelete( )));
|
||||
contextMenu->insertItem( i18n( "&Rename" ), this, SLOT( slotRename( )));
|
||||
|
||||
contextMenu->exec( pos );
|
||||
}
|
||||
|
||||
// slotRename
|
||||
// ==========
|
||||
|
||||
void ProfileDialog::slotRename( )
|
||||
{ QString profileName = m_contextItem->text( );
|
||||
|
||||
if( getNewProfileName( profileName ))
|
||||
{ copy( m_contextItem->text( ), profileName );
|
||||
deelete( m_contextItem, false );
|
||||
}
|
||||
}
|
||||
|
||||
// stripPrefix
|
||||
// ===========
|
||||
|
||||
QString ProfileDialog::stripPrefix( const QString& profileName ) const
|
||||
{ return profileName.right( profileName.length( ) - strlen( PROFILE_PREFIX ));
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _GETPROFILEDIALOG_H_
|
||||
#define _GETPROFILEDIALOG_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <kdialogbase.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KConfig;
|
||||
class QLineEdit;
|
||||
class QListBox;
|
||||
class QListBoxItem;
|
||||
class QString;
|
||||
|
||||
// ProfileDialog class definition
|
||||
// ==============================
|
||||
|
||||
class ProfileDialog : public KDialogBase
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Action
|
||||
{ Copy,
|
||||
Delete,
|
||||
Load,
|
||||
Rename,
|
||||
SaveAs
|
||||
};
|
||||
|
||||
ProfileDialog( Action action,
|
||||
const QString& currentProfile,
|
||||
QWidget* parent = NULL,
|
||||
const char* name = NULL );
|
||||
|
||||
QString profileName( ) const { return m_profileName; }
|
||||
|
||||
private slots:
|
||||
void slotOk( );
|
||||
void slotCopy( );
|
||||
void slotDelete( );
|
||||
void slotProfileListBoxChanged( );
|
||||
void slotProfileListContextMenu( QListBoxItem* item, const QPoint& pos );
|
||||
void slotRename( );
|
||||
|
||||
private:
|
||||
bool checkForDuplicateName( const QString& profileName );
|
||||
QString constructNewProfileName( const QString& initialProfileName ) const;
|
||||
void copy( const QString& fromProfileName, const QString& toProfileName );
|
||||
void createlayout( );
|
||||
void deelete( const QString& profileName, const bool ask );
|
||||
void deelete( QListBoxItem* item, const bool ask );
|
||||
bool getNewProfileName( QString& profileName );
|
||||
void setInitialValues( const QString& currentProfile );
|
||||
QString stripPrefix( const QString& profileName ) const;
|
||||
|
||||
Action m_action;
|
||||
QListBoxItem* m_contextItem;
|
||||
QString m_profileName;
|
||||
QLineEdit* m_profileLineEdit;
|
||||
QListBox* m_profileListBox;
|
||||
};
|
||||
|
||||
#endif // _GETPROFILEDIALOG_H_
|
@ -0,0 +1,139 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
#include "nmapoutputbuffer.h"
|
||||
#include "scanmonitor.h"
|
||||
#include "scanmonitorevent.h"
|
||||
#include "scanwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
ScanMonitor::ScanMonitor( ScanWidget* parent )
|
||||
: QThread( ),
|
||||
m_buffer( NULL ),
|
||||
m_nmapBufferSize( 16384 ),
|
||||
m_parent( parent )
|
||||
{ m_buffers.setAutoDelete( true );
|
||||
}
|
||||
|
||||
// getBuffer
|
||||
// =========
|
||||
|
||||
void ScanMonitor::getBuffer( )
|
||||
{ for( m_buffer = m_buffers.first( ); m_buffer != NULL; m_buffer = m_buffers.next( ))
|
||||
if( m_buffer->isFree( ))
|
||||
{ m_buffer->setBusy( );
|
||||
m_buffers.take( );
|
||||
m_buffers.append( m_buffer );
|
||||
return;
|
||||
}
|
||||
|
||||
m_buffer = new NmapOutputBuffer( m_nmapBufferSize );
|
||||
m_buffers.append( m_buffer );
|
||||
}
|
||||
|
||||
// readNmapOutput
|
||||
// ==============
|
||||
|
||||
void ScanMonitor::readNmapOutput( const int pipeFD, const ScanMonitorEventType type )
|
||||
{ while( true )
|
||||
{ if( m_buffer == NULL )
|
||||
getBuffer( );
|
||||
else
|
||||
m_buffer->setBusy( );
|
||||
|
||||
int bytesRead = ::read( pipeFD, m_buffer->buffer( ), m_nmapBufferSize );
|
||||
|
||||
if( bytesRead > 0 )
|
||||
{ m_buffer->length( bytesRead );
|
||||
QApplication::postEvent( m_parent, new ScanMonitorEvent( type, m_buffer ));
|
||||
m_buffer = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !bytesRead || errno == EAGAIN || errno == EBADF )
|
||||
{ m_buffer->setFree( );
|
||||
break;
|
||||
}
|
||||
|
||||
QString text = QString( i18n( "error reading nmap output from pipe: %2\n" )).arg( strerror( errno ));
|
||||
strcpy( m_buffer->buffer( ), text.ascii( ));
|
||||
m_buffer->length( text.length( ));
|
||||
QApplication::postEvent( m_parent, new ScanMonitorEvent( StderrType, m_buffer ));
|
||||
m_buffer = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// run
|
||||
// ===
|
||||
|
||||
void ScanMonitor::run( )
|
||||
{ fd_set efds;
|
||||
fd_set rfds;
|
||||
struct timeval timeout;
|
||||
|
||||
while( true )
|
||||
{ FD_ZERO( &efds );
|
||||
FD_ZERO( &rfds );
|
||||
|
||||
FD_SET( m_pipeStderrFD, &efds);
|
||||
FD_SET( m_pipeStdoutFD, &efds);
|
||||
|
||||
FD_SET( m_pipeStderrFD, &rfds);
|
||||
FD_SET( m_pipeStdoutFD, &rfds);
|
||||
|
||||
timeout.tv_sec = 2;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
if( !select( _max_( m_pipeStderrFD, m_pipeStdoutFD ) + 1, &rfds, NULL, &efds, &timeout ))
|
||||
continue;
|
||||
|
||||
if( FD_ISSET( m_pipeStderrFD, &efds ) || FD_ISSET( m_pipeStdoutFD, &efds ))
|
||||
break;
|
||||
|
||||
if( FD_ISSET( m_pipeStderrFD, &rfds ))
|
||||
readNmapOutput( m_pipeStderrFD, StderrType );
|
||||
|
||||
if( FD_ISSET( m_pipeStdoutFD, &rfds ))
|
||||
readNmapOutput( m_pipeStdoutFD, StdoutType );
|
||||
}
|
||||
}
|
||||
|
||||
// setPipeFDs
|
||||
// ==========
|
||||
|
||||
void ScanMonitor::setPipeFDs( const int pipeStderrFD, const int pipeStdoutFD )
|
||||
{ m_pipeStderrFD = pipeStderrFD;
|
||||
m_pipeStdoutFD = pipeStdoutFD;
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SCANMONITOR_H_
|
||||
#define _SCANMONITOR_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qptrlist.h>
|
||||
#include <qthread.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class NmapOutputBuffer;
|
||||
class ScanWidget;
|
||||
|
||||
// ScanMonitor class definition
|
||||
// ============================
|
||||
|
||||
class ScanMonitor : public QThread
|
||||
{ public:
|
||||
enum ScanMonitorEventType
|
||||
{ StderrType = QEvent::User,
|
||||
StdoutType
|
||||
};
|
||||
|
||||
ScanMonitor( ScanWidget* parent );
|
||||
void setPipeFDs( const int pipeStderrFD, const int pipeStdoutFD );
|
||||
|
||||
private:
|
||||
void getBuffer( );
|
||||
void readNmapOutput( const int pipeFD, const ScanMonitorEventType type );
|
||||
void run( );
|
||||
|
||||
nobPtr m_buffer;
|
||||
const uint m_nmapBufferSize;
|
||||
ScanWidget* m_parent;
|
||||
int m_pipeStderrFD;
|
||||
int m_pipeStdoutFD;
|
||||
|
||||
QPtrList<NmapOutputBuffer> m_buffers;
|
||||
};
|
||||
|
||||
#endif // _SCANMONITOR_H_
|
@ -0,0 +1,32 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "scanmonitorevent.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
ScanMonitorEvent::ScanMonitorEvent( const int type, const nobPtr buffer )
|
||||
: QCustomEvent( type ),
|
||||
m_buffer( buffer )
|
||||
{
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SCANMONITOREVENT_H_
|
||||
#define _SCANMONITOREVENT_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qevent.h>
|
||||
#include "global.h"
|
||||
|
||||
class ScanMonitorEvent : public QCustomEvent
|
||||
{ public:
|
||||
ScanMonitorEvent( const int type, const nobPtr buffer );
|
||||
nobPtr buffer( ) const { return m_buffer; }
|
||||
|
||||
private:
|
||||
nobPtr m_buffer;
|
||||
};
|
||||
|
||||
#endif // _SCANMONITOREVENT_H_
|
@ -0,0 +1,102 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "scannamedialog.h"
|
||||
#include "scanwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
ScanNameDialog::ScanNameDialog( ScanWidget* scanWidget, QWidget* parent, const char* name )
|
||||
: KDialogBase( Plain, "Scan name", Ok | Cancel, Ok, parent, name )
|
||||
{ createlayout( );
|
||||
|
||||
if( scanWidget != NULL )
|
||||
{ m_scanNameEdit->setText( scanWidget->scanName( ));
|
||||
m_useHostNameCheckbox->setChecked( scanWidget->useTargetHost( ));
|
||||
}
|
||||
|
||||
if( !m_useHostNameCheckbox->isChecked( ))
|
||||
m_scanNameEdit->setFocus( );
|
||||
}
|
||||
|
||||
// createlayout
|
||||
// ============
|
||||
|
||||
void ScanNameDialog::createlayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( plainPage( ));
|
||||
byte row = 1;
|
||||
|
||||
m_useHostNameCheckbox = new QCheckBox( "Use Target Host name", plainPage( ), "use target checkbox" );
|
||||
gridLayout->addWidget( m_useHostNameCheckbox, row++, 1 );
|
||||
|
||||
byte editRowTop = row++;
|
||||
m_scanNameEdit = new QLineEdit( plainPage( ), "name edit" );
|
||||
gridLayout->addWidget( new QLabel( "Scan name", plainPage( ), "name label" ), row++, 1 );
|
||||
gridLayout->addWidget( m_scanNameEdit, row++, 1 );
|
||||
|
||||
gridLayout->setColStretch( 0, 1 );
|
||||
gridLayout->setColStretch( 1, 5 );
|
||||
gridLayout->setColStretch( 2, 1 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 1 );
|
||||
gridLayout->setRowStretch( editRowTop, 1 );
|
||||
gridLayout->setRowStretch( row, 1 );
|
||||
|
||||
m_useHostNameCheckbox->setChecked( true );
|
||||
slotUseHostNameToggled( true );
|
||||
connect( m_useHostNameCheckbox, SIGNAL( toggled( bool )), SLOT( slotUseHostNameToggled( bool )));
|
||||
}
|
||||
|
||||
// slotOk
|
||||
// ======
|
||||
|
||||
void ScanNameDialog::slotOk( )
|
||||
{ m_scanName = m_scanNameEdit->text( );
|
||||
m_useHostName = m_useHostNameCheckbox->isChecked( );
|
||||
|
||||
if( !m_useHostName && m_scanName.isEmpty( ))
|
||||
{ KMessageBox::sorry( this, "Please enter a name or select \"Use Target Host name\"", "No scan name" );
|
||||
return;
|
||||
}
|
||||
|
||||
KDialogBase::slotOk( );
|
||||
}
|
||||
|
||||
// slotUseHostNameToggled
|
||||
// ======================
|
||||
|
||||
void ScanNameDialog::slotUseHostNameToggled( bool on )
|
||||
{ m_scanNameEdit->setEnabled( !on );
|
||||
|
||||
if( !on )
|
||||
m_scanNameEdit->setFocus( );
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SCANNAMEDIALOG_H_
|
||||
#define _SCANNAMEDIALOG_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <kdialogbase.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class ScanWidget;
|
||||
|
||||
// ScanNameDialog class definition
|
||||
// ===============================
|
||||
|
||||
class ScanNameDialog : public KDialogBase
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
ScanNameDialog( ScanWidget* scanWidget, QWidget* parent = NULL, const char* name = NULL );
|
||||
|
||||
QString scanName( ) const { return m_scanName; }
|
||||
bool useHostName( ) const { return m_useHostName; }
|
||||
|
||||
private slots:
|
||||
void slotOk( );
|
||||
void slotUseHostNameToggled( bool on );
|
||||
|
||||
private:
|
||||
void createlayout( );
|
||||
|
||||
QString m_scanName;
|
||||
QLineEdit* m_scanNameEdit;
|
||||
bool m_useHostName;
|
||||
QCheckBox* m_useHostNameCheckbox;
|
||||
};
|
||||
|
||||
#endif // _SCANNAMEDIALOG_H_
|
@ -0,0 +1,194 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qdict.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "htmlwidget.h"
|
||||
#include "scanstack.h"
|
||||
#include "scanwidget.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
ScanStack::ScanStack( QWidget* parent, const char* name )
|
||||
: QWidgetStack( parent, name ),
|
||||
m_dictSize( 29 ),
|
||||
m_firstScanWidget( NULL ),
|
||||
m_widgetId( 1 )
|
||||
{ m_scanWidgetDict = new QDict<ScanWidget>( m_dictSize );
|
||||
m_scanWidgetDict->setAutoDelete( true );
|
||||
}
|
||||
|
||||
// appendAndRaiseWidget
|
||||
// ====================
|
||||
|
||||
void ScanStack::appendAndRaiseWidget( ScanWidget* scanWidget )
|
||||
{ addWidget( scanWidget, m_widgetId );
|
||||
raiseWidget( m_widgetId );
|
||||
m_widgetId++;
|
||||
|
||||
if( m_firstScanWidget == NULL )
|
||||
m_firstScanWidget = scanWidget;
|
||||
|
||||
ushort index = m_scanWidgetDict->count( );
|
||||
|
||||
if( index == m_dictSize )
|
||||
{ m_dictSize *= 2; // yes - i know it's supposed to be prime!
|
||||
m_scanWidgetDict->resize( m_dictSize );
|
||||
}
|
||||
|
||||
m_scanWidgetDict->insert( QString::number( index ), scanWidget );
|
||||
}
|
||||
|
||||
// appendHTMLWidget
|
||||
// ================
|
||||
|
||||
void ScanStack::appendHTMLWidget( HTMLWidget* htmlWidget )
|
||||
{ ASSERT( m_widgetId == 1 );
|
||||
addWidget( (QWidget*) htmlWidget, m_widgetId++ );
|
||||
}
|
||||
|
||||
// findScanWidget
|
||||
// ==============
|
||||
|
||||
short ScanStack::findScanWidget( const ScanWidget* scanWidget )
|
||||
{ ushort i;
|
||||
|
||||
for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i ))
|
||||
if( scanWidget == currentScanWidget( i ))
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// indexOfVisibleScanWidget
|
||||
// ========================
|
||||
|
||||
short ScanStack::indexOfVisibleScanWidget( )
|
||||
{ ushort i;
|
||||
|
||||
for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i ))
|
||||
if( isVisibleWidget( currentScanWidget( i )))
|
||||
break;
|
||||
|
||||
if( !moreScanWidgets( i ))
|
||||
{ ASSERT( false );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
// makeScanWidgetVisible
|
||||
// =====================
|
||||
|
||||
ScanWidget* ScanStack::makeScanWidgetVisible( const ushort index )
|
||||
{ ScanWidget* current = scanWidget( index );
|
||||
|
||||
if( current == NULL )
|
||||
ASSERT( false );
|
||||
else
|
||||
{ current->ignoreTabChanges( true );
|
||||
raiseWidget( current );
|
||||
current->ignoreTabChanges( false );
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
// moveScanWidget
|
||||
// ==============
|
||||
|
||||
ScanWidget* ScanStack::moveScanWidget( const ushort fromIndex )
|
||||
{ short toIndex = indexOfVisibleScanWidget( );
|
||||
|
||||
if( toIndex < 0 )
|
||||
return NULL;
|
||||
|
||||
ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( fromIndex ));
|
||||
|
||||
if( fromIndex < toIndex )
|
||||
for( ushort index = fromIndex + 1; index <= toIndex; index++ )
|
||||
{ ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( index ));
|
||||
m_scanWidgetDict->insert( QString::number( index - 1 ), scanWidget );
|
||||
}
|
||||
else
|
||||
for( short index = fromIndex - 1; index >= toIndex; index-- )
|
||||
{ ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( index ));
|
||||
m_scanWidgetDict->insert( QString::number( index + 1 ), scanWidget );
|
||||
}
|
||||
|
||||
m_scanWidgetDict->insert( QString::number( toIndex ), scanWidget );
|
||||
return scanWidget;
|
||||
}
|
||||
|
||||
// removeScanWidget
|
||||
// ================
|
||||
|
||||
void ScanStack::removeScanWidget( ScanWidget* scanWidgetToRemove )
|
||||
{ ushort n = m_scanWidgetDict->count( );
|
||||
|
||||
if( n == 1 )
|
||||
return;
|
||||
|
||||
short index = findScanWidget( scanWidgetToRemove );
|
||||
|
||||
if( index < 0 )
|
||||
{ ASSERT( false );
|
||||
return;
|
||||
}
|
||||
|
||||
m_scanWidgetDict->remove( QString::number( index ));
|
||||
|
||||
for( ushort i = index + 1; i < n; i++ )
|
||||
{ ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( i ));
|
||||
m_scanWidgetDict->insert( QString::number( i - 1 ), scanWidget );
|
||||
}
|
||||
|
||||
if( index >=short( m_scanWidgetDict->count( )))
|
||||
index = m_scanWidgetDict->count( ) - 1;
|
||||
|
||||
ScanWidget* newVisibleWidget = scanWidget( index );
|
||||
newVisibleWidget->ignoreTabChanges( true );
|
||||
raiseWidget( newVisibleWidget );
|
||||
newVisibleWidget->ignoreTabChanges( false );
|
||||
}
|
||||
|
||||
// visibleWidget
|
||||
// =============
|
||||
|
||||
ScanWidget* ScanStack::visibleWidget( )
|
||||
{ return (ScanWidget*) QWidgetStack::visibleWidget( );
|
||||
}
|
||||
|
||||
// wrapText
|
||||
// ========
|
||||
|
||||
void ScanStack::wrapText( const bool wrap )
|
||||
{ ushort i;
|
||||
|
||||
for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i ))
|
||||
currentScanWidget( i )->wrapText( wrap );
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SCANSTACK_H_
|
||||
#define _SCANSTACK_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qdict.h>
|
||||
#include <qwidgetstack.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class HTMLWidget;
|
||||
class ScanWidget;
|
||||
|
||||
// ScanStack class definition
|
||||
// ==========================
|
||||
|
||||
class ScanStack : public QWidgetStack
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
ScanStack( QWidget* parent, const char* name = NULL );
|
||||
|
||||
void appendAndRaiseWidget( ScanWidget* scanWidget );
|
||||
void appendHTMLWidget( HTMLWidget* htmlWidget );
|
||||
ushort count( ) const { return m_scanWidgetDict->count( ); }
|
||||
ScanWidget* currentScanWidget( const ushort index ) { return scanWidget( index ); }
|
||||
short findScanWidget( const ScanWidget* scanWidget );
|
||||
ScanWidget* firstScanWidget( ) const { return m_firstScanWidget; }
|
||||
short indexOfVisibleScanWidget( );
|
||||
bool isVisibleWidget( const ScanWidget* scanWidget ) { return scanWidget == visibleWidget( ); }
|
||||
ScanWidget* makeScanWidgetVisible( const ushort index );
|
||||
bool moreScanWidgets( const ushort index ) const { return index < m_scanWidgetDict->count( ); }
|
||||
ScanWidget* moveScanWidget( const ushort fromIndex );
|
||||
void nextScanWidget( ushort& index ) { index++; }
|
||||
void removeScanWidget( ScanWidget* scanWidget );
|
||||
void resetScanWidgets( ushort& index ) { index = 0; }
|
||||
ScanWidget* visibleWidget( );
|
||||
void wrapText( const bool wrap );
|
||||
|
||||
private:
|
||||
ScanWidget* scanWidget( const ushort index ) { return (*m_scanWidgetDict)[ QString::number( index )]; }
|
||||
|
||||
ushort m_dictSize;
|
||||
ScanWidget* m_firstScanWidget;
|
||||
ushort m_widgetId;
|
||||
|
||||
QDict<ScanWidget>* m_scanWidgetDict;
|
||||
};
|
||||
|
||||
#endif // _SCANSTACK_H_
|
@ -0,0 +1,172 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SCANWIDGET_H_
|
||||
#define _SCANWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qframe.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class CommonWidget;
|
||||
class CompoundWidget;
|
||||
class HTMLWidget;
|
||||
class KConfig;
|
||||
class KProcess;
|
||||
class KTabWidget;
|
||||
class LoggingOptions;
|
||||
class OutputWidget;
|
||||
class PAndSOptions;
|
||||
class QFile;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QStringList;
|
||||
class ScanMonitor;
|
||||
class SimpleOptions;
|
||||
class TimingWidget;
|
||||
|
||||
// ScanWidget class definition
|
||||
// ===========================
|
||||
|
||||
class ScanWidget : public QFrame
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
ScanWidget( const QString& scanName,
|
||||
const bool useTargetHost,
|
||||
QWidget* parent = NULL,
|
||||
const char* name = NULL );
|
||||
virtual ~ScanWidget( );
|
||||
|
||||
enum State
|
||||
{ dormant,
|
||||
finished,
|
||||
running
|
||||
};
|
||||
|
||||
void fileSave( );
|
||||
void fileSaveAs( );
|
||||
void ignoreTabChanges( const bool b ) { m_ignoreTabChanges = b; }
|
||||
bool isDirty( ) const { return m_dirty; }
|
||||
void profileAskAndSave( );
|
||||
void profileCopy( );
|
||||
void profileDelete( );
|
||||
void profileLoad( );
|
||||
QString profileName( ) const { return m_profileName; }
|
||||
void profileRename( );
|
||||
void profileSave( );
|
||||
void profileSaveAs( );
|
||||
void readSettings( );
|
||||
void renameScan( const QString& newScanName );
|
||||
void saveSettings( );
|
||||
QString scanName( ) const { return m_scanName; }
|
||||
void setProfileName( const QString& profileName );
|
||||
State state( ) const { return m_state; }
|
||||
void state( const State s ) { m_state = s; }
|
||||
void updateStatusBarText( );
|
||||
bool useTargetHost( ) const { return m_useTargetHost; }
|
||||
void useTargetHost( const bool b );
|
||||
void wrapText( const bool wrap );
|
||||
|
||||
signals:
|
||||
void displayHelp( const QString& );
|
||||
void errorLoadingLocalManPage( const QString& );
|
||||
void optionsDirty( );
|
||||
void outputAvailable( const bool, const bool );
|
||||
void scanRename( const QString& );
|
||||
void scanStarted( );
|
||||
void scanStopped( ScanWidget* );
|
||||
void setManPageActionStuff( const bool );
|
||||
void statusBarText( const QString& );
|
||||
|
||||
private slots:
|
||||
void slotClearOutput( );
|
||||
void slotDisplayDocBook( const QString& anchor );
|
||||
void slotDisplayUnknown( );
|
||||
void slotFinaliseInitialisation( );
|
||||
void slotHideOptions( );
|
||||
void slotOptionsDirty( const bool dirty = true );
|
||||
void slotProcessExited( );
|
||||
void slotReceivedStderr( KProcess* process, char* buffer, int buflen );
|
||||
void slotReceivedStdout( KProcess* process, char* buffer, int buflen );
|
||||
void slotStartClicked( );
|
||||
void slotStopClicked( );
|
||||
void slotTabChanged( QWidget* toWidget );
|
||||
void slotTargetChanged( const QString& target );
|
||||
|
||||
private:
|
||||
QStringList buildNmapOptionsList( );
|
||||
void closePipe( QFile*& pipe, int& pipeFD );
|
||||
void createLayout( );
|
||||
bool createPipe( const QString type, const QString& tempDir, QFile*& pipe, int& pipeFD );
|
||||
bool createPipes( );
|
||||
void customEvent( QCustomEvent* event );
|
||||
bool getOptions( );
|
||||
void getPortRanges( QStringList* portRanges );
|
||||
void initialiseManPage( );
|
||||
void profileRead( );
|
||||
void saveProfileName( );
|
||||
void setInitialValues( );
|
||||
|
||||
QPushButton* m_clearOutputButton;
|
||||
int m_commonIndex;
|
||||
CommonWidget* m_commonWidget;
|
||||
int m_compoundIndex;
|
||||
CompoundWidget* m_compoundWidget;
|
||||
int m_currentTab;
|
||||
bool m_dirty;
|
||||
bool m_hideOptions;
|
||||
QPushButton* m_hideOptionsButton;
|
||||
int m_htmlIndex;
|
||||
bool m_ignoreTabChanges;
|
||||
int m_loggingIndex;
|
||||
LoggingOptions* m_loggingWidget;
|
||||
KProcess* m_nmapProcess;
|
||||
OutputWidget* m_outputWidget;
|
||||
int m_pAndSIndex;
|
||||
PAndSOptions* m_pAndSWidget;
|
||||
QFile* m_pipeStderr;
|
||||
QFile* m_pipeStdout;
|
||||
int m_pipeStderrFD;
|
||||
int m_pipeStdoutFD;
|
||||
bool m_piping;
|
||||
QString m_profileName;
|
||||
ScanMonitor* m_scanMonitor;
|
||||
QString m_scanName;
|
||||
int m_simpleIndex;
|
||||
SimpleOptions* m_simpleWidget;
|
||||
QPushButton* m_startButton;
|
||||
State m_state;
|
||||
QPushButton* m_stopButton;
|
||||
KTabWidget* m_tabWidget;
|
||||
int m_timingIndex;
|
||||
TimingWidget* m_timingWidget;
|
||||
bool m_useTargetHost;
|
||||
};
|
||||
|
||||
#endif // _SCANWIDGET_H_
|
@ -0,0 +1,247 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "simpleoptions.h"
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
SimpleOptions::SimpleOptions( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name )
|
||||
{ createLayout( );
|
||||
}
|
||||
|
||||
// createLayout
|
||||
// ============
|
||||
|
||||
void SimpleOptions::createLayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( this );
|
||||
|
||||
byte row = 1;
|
||||
m_allPortsCheckBox = new QCheckBox( i18n( "All ports (--allports)" ), this, "all ports check" );
|
||||
m_fastScanCheckBox = new QCheckBox( i18n( "Fast Scan (-F)" ), this, "fast scan check" );
|
||||
m_ipV6CheckBox = new QCheckBox( i18n( "IPV6 support (-6)" ), this, "ipv6 check" );
|
||||
m_privilegedCheckBox = new QCheckBox( i18n( "Assume privileged (--privileged)" ), this, "privileged check" );
|
||||
m_noRandomPortsCheckBox = new QCheckBox( i18n( "No Random Ports (-r)" ), this, "no random ports check" );
|
||||
m_osDetectionCheckBox = new QCheckBox( i18n( "OS Detection (-O)" ), this, "os detection check" );
|
||||
m_osScanLimitCheckBox = new QCheckBox( i18n( "OS scan limit (--osscan_limit)" ), this, "os scan limit check" );
|
||||
m_packetTraceCheckBox = new QCheckBox( i18n( "Packet trace (--packet_trace)" ), this, "packet trace check" );
|
||||
m_prepackagedCheckBox = new QCheckBox( i18n( "Prepackaged options (-A)" ), this, "prepackaged check" );
|
||||
m_randomizeHostsCheckBox = new QCheckBox( i18n( "Randomize hosts (--randomize_hosts)" ), this, "randomize check" );
|
||||
m_sendEthCheckBox = new QCheckBox( i18n( "Send raw eth. packets (--send_eth)" ), this, "send eth check" );
|
||||
m_sendIPCheckBox = new QCheckBox( i18n( "Send raw IP packets (--send_ip)" ), this, "send ip check" );
|
||||
m_verboseCheckBox = new QCheckBox( i18n( "Verbose (-v)" ), this, "verbose check" );
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_allPortsCheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_privilegedCheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_fastScanCheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_ipV6CheckBox, row++, 3 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 1 );
|
||||
gridLayout->addWidget( m_noRandomPortsCheckBox, row++, 3 );
|
||||
byte rowBlock1 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( "#", this ), row, 5 );
|
||||
gridLayout->addWidget( m_osDetectionCheckBox, row++, 7 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 5 );
|
||||
gridLayout->addWidget( m_osScanLimitCheckBox, row++, 7 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 5 );
|
||||
gridLayout->addWidget( m_packetTraceCheckBox, row++, 7 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 5 );
|
||||
gridLayout->addWidget( m_prepackagedCheckBox, row++, 7 );
|
||||
byte rowBlock2 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_randomizeHostsCheckBox, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_sendEthCheckBox, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_sendIPCheckBox, row++, 11 );
|
||||
gridLayout->addWidget( new QLabel( " ", this ), row, 9 );
|
||||
gridLayout->addWidget( m_verboseCheckBox, row++, 11 );
|
||||
byte rowBlock3 = row;
|
||||
|
||||
gridLayout->setColStretch( 0, 8 );
|
||||
gridLayout->setColStretch( 2, 1 );
|
||||
gridLayout->setColStretch( 4, 8 );
|
||||
gridLayout->setColStretch( 6, 1 );
|
||||
gridLayout->setColStretch( 8, 8 );
|
||||
gridLayout->setColStretch( 10, 1 );
|
||||
gridLayout->setColStretch( 12, 8 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 10 );
|
||||
gridLayout->setRowStretch( _max_( rowBlock1, _max_( rowBlock2, rowBlock3 )) + 1, 10 );
|
||||
}
|
||||
|
||||
// finaliseInitialisation
|
||||
// ======================
|
||||
|
||||
void SimpleOptions::finaliseInitialisation( )
|
||||
{ WhatsThis* whatsThis = new WhatsThis( this );
|
||||
|
||||
connect( m_fastScanCheckBox, SIGNAL( clicked( )), SLOT( slotFastScanCheckBoxClicked( )));
|
||||
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
|
||||
|
||||
connect( m_allPortsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_fastScanCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_ipV6CheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_noRandomPortsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_osDetectionCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_osScanLimitCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_packetTraceCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_prepackagedCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_privilegedCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_randomizeHostsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sendEthCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sendIPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_verboseCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
}
|
||||
|
||||
// getOptions
|
||||
// ==========
|
||||
|
||||
bool SimpleOptions::getOptions( bool& needRoot )
|
||||
{ m_allPortsState = m_allPortsCheckBox->isChecked( );
|
||||
m_fastScanState = m_fastScanCheckBox->isChecked( );
|
||||
m_ipV6State = m_ipV6CheckBox->isChecked( );
|
||||
m_noRandomPortsState = m_noRandomPortsCheckBox->isChecked( );
|
||||
m_osDetectionState = m_osDetectionCheckBox->isChecked( );
|
||||
m_osScanLimitState = m_osScanLimitCheckBox->isChecked( );
|
||||
m_packetTraceState = m_packetTraceCheckBox->isChecked( );
|
||||
m_prepackagedState = m_prepackagedCheckBox->isChecked( );
|
||||
m_privilegedState = m_privilegedCheckBox->isChecked( );
|
||||
m_randomizeHostsState = m_randomizeHostsCheckBox->isChecked( );
|
||||
m_sendEthState = m_sendEthCheckBox->isChecked( );
|
||||
m_sendIPState = m_sendIPCheckBox->isChecked( );
|
||||
m_verboseState = m_verboseCheckBox->isChecked( );
|
||||
|
||||
needRoot = needRoot || m_osDetectionState;
|
||||
return true;
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void SimpleOptions::readProfile( KConfig* config )
|
||||
{ m_allPortsState = config->readBoolEntry( "allPortsState" );
|
||||
m_fastScanState = config->readBoolEntry( "fastScanState" );
|
||||
m_ipV6State = config->readBoolEntry( "ipV6State" );
|
||||
m_noRandomPortsState = config->readBoolEntry( "noRandomPortsState" );
|
||||
m_osDetectionState = config->readBoolEntry( "osDetectionState" );
|
||||
m_osScanLimitState = config->readBoolEntry( "osScanLimitState" );
|
||||
m_packetTraceState = config->readBoolEntry( "packetTraceState" );
|
||||
m_prepackagedState = config->readBoolEntry( "prepackagedState" );
|
||||
m_privilegedState = config->readBoolEntry( "privilegedState" );
|
||||
m_randomizeHostsState = config->readBoolEntry( "randomizeHostsState" );
|
||||
m_sendEthState = config->readBoolEntry( "sendEthState" );
|
||||
m_sendIPState = config->readBoolEntry( "sendIPState" );
|
||||
m_verboseState = config->readBoolEntry( "verboseState" );
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void SimpleOptions::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "allPortsState", m_allPortsState );
|
||||
config->writeEntry( "fastScanState", m_fastScanState );
|
||||
config->writeEntry( "ipV6State", m_ipV6State );
|
||||
config->writeEntry( "noRandomPortsState", m_noRandomPortsState );
|
||||
config->writeEntry( "osDetectionState", m_osDetectionState );
|
||||
config->writeEntry( "osScanLimitState", m_osScanLimitState );
|
||||
config->writeEntry( "packetTraceState", m_packetTraceState );
|
||||
config->writeEntry( "prepackagedState", m_prepackagedState );
|
||||
config->writeEntry( "privilegedState", m_privilegedState );
|
||||
config->writeEntry( "randomizeHostsState", m_randomizeHostsState );
|
||||
config->writeEntry( "sendEthState", m_sendEthState );
|
||||
config->writeEntry( "sendIPState", m_sendIPState );
|
||||
config->writeEntry( "verboseState", m_verboseState );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void SimpleOptions::setInitialValues( )
|
||||
{ m_allPortsCheckBox->setChecked( m_allPortsState );
|
||||
m_fastScanCheckBox->setChecked( m_fastScanState );
|
||||
m_ipV6CheckBox->setChecked( m_ipV6State );
|
||||
m_noRandomPortsCheckBox->setChecked( m_noRandomPortsState );
|
||||
m_osDetectionCheckBox->setChecked(m_osDetectionState );
|
||||
m_osScanLimitCheckBox->setChecked(m_osScanLimitState );
|
||||
m_packetTraceCheckBox->setChecked( m_packetTraceState );
|
||||
m_prepackagedCheckBox->setChecked( m_prepackagedState );
|
||||
m_privilegedCheckBox->setChecked( m_privilegedState );
|
||||
m_randomizeHostsCheckBox->setChecked( m_randomizeHostsState );
|
||||
m_sendEthCheckBox->setChecked( m_sendEthState );
|
||||
m_sendIPCheckBox->setChecked( m_sendIPState );
|
||||
m_verboseCheckBox->setChecked( m_verboseState );
|
||||
}
|
||||
|
||||
// slotDisableFastScan
|
||||
// ===================
|
||||
|
||||
void SimpleOptions::slotDisableFastScan( )
|
||||
{ m_fastScanCheckBox->setChecked( false );
|
||||
}
|
||||
|
||||
// slotFastScanCheckBoxClicked
|
||||
// ===========================
|
||||
|
||||
void SimpleOptions::slotFastScanCheckBoxClicked( )
|
||||
{ if( m_fastScanCheckBox->isChecked( ))
|
||||
emit( disablePortRanges( ));
|
||||
}
|
||||
|
||||
// slotWhatsThisClicked
|
||||
// ====================
|
||||
|
||||
void SimpleOptions::slotWhatsThisClicked( )
|
||||
{ if( m_allPortsCheckBox->hasMouse( )) emit( displayHelp( "--allports" ));
|
||||
else if( m_fastScanCheckBox->hasMouse( )) emit( displayHelp( "-F" ));
|
||||
else if( m_ipV6CheckBox->hasMouse( )) emit( displayHelp( "-6" ));
|
||||
else if( m_noRandomPortsCheckBox->hasMouse( )) emit( displayHelp( "-r" ));
|
||||
else if( m_osDetectionCheckBox->hasMouse( )) emit( displayHelp( "-O" ));
|
||||
else if( m_osScanLimitCheckBox->hasMouse( )) emit( displayHelp( "--osscan_limit" ));
|
||||
else if( m_packetTraceCheckBox->hasMouse( )) emit( displayHelp( "--packet_trace" ));
|
||||
else if( m_prepackagedCheckBox->hasMouse( )) emit( displayHelp( "-A" ));
|
||||
else if( m_privilegedCheckBox->hasMouse( )) emit( displayHelp( "--privileged" ));
|
||||
else if( m_randomizeHostsCheckBox->hasMouse( )) emit( displayHelp( "--randomize_hosts" ));
|
||||
else if( m_sendEthCheckBox->hasMouse( )) emit( displayHelp( "--send_eth" ));
|
||||
else if( m_sendIPCheckBox->hasMouse( )) emit( displayHelp( "--send_ip" ));
|
||||
else if( m_verboseCheckBox->hasMouse( )) emit( displayHelp( "-v" ));
|
||||
else emit( displayUnknown( ));
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SIMPLEOPTIONS_H_
|
||||
#define _SIMPLEOPTIONS_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QCheckBox;
|
||||
class KConfig;
|
||||
|
||||
// SimpleOptions class definition
|
||||
// ==============================
|
||||
|
||||
class SimpleOptions : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
SimpleOptions( QWidget* parent, const char* name = NULL );
|
||||
|
||||
void finaliseInitialisation( );
|
||||
bool getOptions( bool& needRoot );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
void setInitialValues( );
|
||||
|
||||
bool allPortsState( ) const { return m_allPortsState; }
|
||||
bool fastScanState( ) const { return m_fastScanState; }
|
||||
bool ipV6State( ) const { return m_ipV6State; }
|
||||
bool noRandomPortsState( ) const { return m_noRandomPortsState; }
|
||||
bool osDetectionState( ) const { return m_osDetectionState; }
|
||||
bool osScanLimitState( ) const { return m_osScanLimitState; }
|
||||
bool packetTraceState( ) const { return m_packetTraceState; }
|
||||
bool prepackagedState( ) const { return m_prepackagedState; }
|
||||
bool privilegedState( ) const { return m_privilegedState; }
|
||||
bool randomizeHostsState( ) const { return m_randomizeHostsState; }
|
||||
bool sendEthState( ) const { return m_sendEthState; }
|
||||
bool sendIPState( ) const { return m_sendIPState; }
|
||||
bool verboseState( ) const { return m_verboseState; }
|
||||
|
||||
signals:
|
||||
void disablePortRanges( );
|
||||
void displayDocBook( const QString& );
|
||||
void displayHelp( const QString& );
|
||||
void displayUnknown( );
|
||||
void optionsDirty( );
|
||||
|
||||
public slots:
|
||||
void slotDisableFastScan( );
|
||||
|
||||
private slots:
|
||||
void slotFastScanCheckBoxClicked( );
|
||||
void slotWhatsThisClicked( );
|
||||
|
||||
private:
|
||||
void createLayout( );
|
||||
|
||||
QCheckBox* m_allPortsCheckBox;
|
||||
bool m_allPortsState;
|
||||
QCheckBox* m_fastScanCheckBox;
|
||||
bool m_fastScanState;
|
||||
QCheckBox* m_ipV6CheckBox;
|
||||
bool m_ipV6State;
|
||||
QCheckBox* m_noRandomPortsCheckBox;
|
||||
bool m_noRandomPortsState;
|
||||
QCheckBox* m_osDetectionCheckBox;
|
||||
bool m_osDetectionState;
|
||||
QCheckBox* m_osScanLimitCheckBox;
|
||||
bool m_osScanLimitState;
|
||||
QCheckBox* m_packetTraceCheckBox;
|
||||
bool m_packetTraceState;
|
||||
QCheckBox* m_prepackagedCheckBox;
|
||||
bool m_prepackagedState;
|
||||
QCheckBox* m_privilegedCheckBox;
|
||||
bool m_privilegedState;
|
||||
QCheckBox* m_randomizeHostsCheckBox;
|
||||
bool m_randomizeHostsState;
|
||||
QCheckBox* m_sendEthCheckBox;
|
||||
bool m_sendEthState;
|
||||
QCheckBox* m_sendIPCheckBox;
|
||||
bool m_sendIPState;
|
||||
QCheckBox* m_verboseCheckBox;
|
||||
bool m_verboseState;
|
||||
};
|
||||
|
||||
#endif // _SIMPLEOPTIONS_H_
|
@ -0,0 +1,128 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qiconset.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kfiledialog.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "stylesheetdialog.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
StylesheetDialog::StylesheetDialog( const QString& currentStylesheetURL,
|
||||
const QStringList& stylesheetURLs,
|
||||
QWidget* parent,
|
||||
const char* name )
|
||||
: KDialogBase( Plain, "'man' stylesheet location", Ok | Cancel, Ok, parent, name ),
|
||||
m_currentStylesheetURL( currentStylesheetURL ),
|
||||
m_stylesheetURLs( stylesheetURLs )
|
||||
{ QGridLayout* layout = new QGridLayout( plainPage( ));
|
||||
KIconLoader* iconLoader = KGlobal::iconLoader( );
|
||||
QIconSet fileOpenIconSet = iconLoader->loadIconSet( "fileopen", KIcon::Small );
|
||||
QPushButton* urlButton = new QPushButton( fileOpenIconSet, NULL, plainPage( ), "stylesheet url button" );
|
||||
m_urlLineEdit = new QLineEdit( plainPage( ), "stylesheet url line edit" );
|
||||
m_urlListBox = new QListBox( plainPage( ), "stylesheet url list box" );
|
||||
|
||||
m_urlListBox->insertStringList( stylesheetURLs );
|
||||
m_urlLineEdit->setMinimumWidth( int( 1.1 * m_urlListBox->maxItemWidth( )));
|
||||
m_urlLineEdit->setText( currentStylesheetURL );
|
||||
|
||||
layout->addWidget( new QLabel( "Stylesheet URL: ", plainPage( ), "url label" ), 1, 1, Qt::AlignRight );
|
||||
layout->addWidget( m_urlLineEdit, 1, 2 );
|
||||
layout->addWidget( urlButton, 1, 3 );
|
||||
layout->addWidget( new QLabel( "Known URLs: ", plainPage( ), "url label" ), 3, 1, Qt::AlignRight | Qt::AlignTop );
|
||||
layout->addWidget( m_urlListBox, 3, 2 );
|
||||
|
||||
layout->setColStretch( 0, 1 );
|
||||
layout->setColStretch( 2, 20 );
|
||||
layout->setColStretch( 4, 1 );
|
||||
|
||||
layout->setRowStretch( 0, 2 );
|
||||
layout->setRowStretch( 2, 1 );
|
||||
layout->setRowStretch( 3, 10 );
|
||||
layout->setRowStretch( 4, 2 );
|
||||
|
||||
connect( urlButton, SIGNAL( clicked( )), SLOT( slotURLButtonClicked( )));
|
||||
connect( m_urlListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotURLListBoxDoubleClicked( QListBoxItem* )));
|
||||
}
|
||||
|
||||
// slotOk
|
||||
// ======
|
||||
|
||||
void StylesheetDialog::slotOk( )
|
||||
{ QString currentStylesheetURL = m_urlLineEdit->text( );
|
||||
QStringList::Iterator it = m_stylesheetURLs.find( currentStylesheetURL );
|
||||
|
||||
if( it != m_stylesheetURLs.end( ))
|
||||
m_stylesheetURLs.remove( it );
|
||||
|
||||
if( !QFile::exists( currentStylesheetURL ))
|
||||
{ KMessageBox::sorry( this, QString( i18n( "The stylesheet \"%1\" does not exist" )).arg( currentStylesheetURL ), i18n( "Nonexistant stylesheet" ));
|
||||
QListBoxItem* item = m_urlListBox->findItem( currentStylesheetURL, Qt::ExactMatch );
|
||||
|
||||
if( item != NULL )
|
||||
{ m_urlListBox->removeItem( m_urlListBox->index( item ));
|
||||
emit( stylesheetRemoved( ));
|
||||
}
|
||||
|
||||
m_urlLineEdit->clear( );
|
||||
return;
|
||||
}
|
||||
|
||||
m_stylesheetURLs.push_front( currentStylesheetURL );
|
||||
KDialogBase::slotOk( );
|
||||
}
|
||||
|
||||
// slotURLButtonClicked
|
||||
// ====================
|
||||
|
||||
void StylesheetDialog::slotURLButtonClicked( )
|
||||
{ QString filter = "*.css|CSS files\n*.*|All files";
|
||||
QString startDir = (m_currentStylesheetURL.isEmpty( )) ? KGlobalSettings::documentPath( ) : m_currentStylesheetURL;
|
||||
QString stylesheetURL = KFileDialog::getOpenFileName( startDir, filter, this, "url path dlg" );
|
||||
|
||||
if( stylesheetURL.isEmpty( ))
|
||||
return;
|
||||
|
||||
m_urlLineEdit->setText( stylesheetURL );
|
||||
}
|
||||
|
||||
// slotURLListBoxDoubleClicked
|
||||
// ===========================
|
||||
|
||||
void StylesheetDialog::slotURLListBoxDoubleClicked( QListBoxItem* item )
|
||||
{ m_urlLineEdit->setText( item->text( ));
|
||||
slotOk( );
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _STYLESHEETDIALOG_H_
|
||||
#define _STYLESHEETDIALOG_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <kdialogbase.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QListBox;
|
||||
class QLineEdit;
|
||||
class QString;
|
||||
class QStringList;
|
||||
|
||||
// StylesheetDialog class definition
|
||||
// =================================
|
||||
|
||||
class StylesheetDialog : public KDialogBase
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
StylesheetDialog( const QString& currentStylesheetURL,
|
||||
const QStringList& stylesheetURLs,
|
||||
QWidget* parent = NULL,
|
||||
const char* name = NULL );
|
||||
|
||||
QStringList stylesheetURLs( ) const { return m_stylesheetURLs; }
|
||||
|
||||
signals:
|
||||
void stylesheetRemoved( );
|
||||
|
||||
private slots:
|
||||
void slotOk( );
|
||||
void slotURLButtonClicked( );
|
||||
void slotURLListBoxDoubleClicked( QListBoxItem* item );
|
||||
|
||||
private:
|
||||
QString m_currentStylesheetURL;
|
||||
QStringList m_stylesheetURLs;
|
||||
QListBox* m_urlListBox;
|
||||
QLineEdit* m_urlLineEdit;
|
||||
};
|
||||
|
||||
#endif // _STYLESHEETDIALOG_H_
|
@ -0,0 +1,39 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "tabwidgetdata.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
TabWidgetData::TabWidgetData( const int index, const QString& title, QWidget* widget )
|
||||
: m_index( index ),
|
||||
m_title( title ),
|
||||
m_widget( widget )
|
||||
{
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _TABWIDGETDATA_H_
|
||||
#define _TABWIDGETDATA_H_
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QString;
|
||||
class QWidget;
|
||||
|
||||
// TabWidgetData class definition
|
||||
// ==============================
|
||||
|
||||
class TabWidgetData
|
||||
{ public:
|
||||
TabWidgetData( const int index, const QString& title, QWidget* widget );
|
||||
|
||||
int index( ) const { return m_index; }
|
||||
QString title( ) const { return m_title; }
|
||||
QWidget* widget( ) const { return m_widget; }
|
||||
|
||||
private:
|
||||
int m_index;
|
||||
QString m_title;
|
||||
QWidget* m_widget;
|
||||
};
|
||||
|
||||
#endif // _TABWIDGETDATA_H_
|
@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qptrcollection.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "tabwidgetptrlist.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
TabWidgetPtrList::TabWidgetPtrList( )
|
||||
{ setAutoDelete( true );
|
||||
}
|
||||
|
||||
// compareItems
|
||||
// ============
|
||||
|
||||
int TabWidgetPtrList::compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 )
|
||||
{ typedef TabWidgetData* DataPtr;
|
||||
|
||||
if( DataPtr( item1 )->index( ) < DataPtr( item2 )->index( ))
|
||||
return -1;
|
||||
|
||||
return DataPtr( item1 )->index( ) != DataPtr( item2 )->index( );
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _TABWIDGETPTRLIST_H_
|
||||
#define _TABWIDGETPTRLIST_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qptrlist.h>
|
||||
#include "global.h"
|
||||
#include "tabwidgetdata.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QPtrCollection;
|
||||
|
||||
// TabWidgetPtrList class definition
|
||||
// =================================
|
||||
|
||||
class TabWidgetPtrList : public QPtrList<TabWidgetData>
|
||||
{ public:
|
||||
TabWidgetPtrList( );
|
||||
|
||||
int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 );
|
||||
};
|
||||
|
||||
#endif // _TABWIDGETPTRLIST_H_
|
@ -0,0 +1,664 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <qbuttongroup.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qiconset.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
|
||||
#include "timingwidget.h"
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
TimingWidget::TimingWidget( QWidget* parent, const char* name )
|
||||
: QWidget( parent, name )
|
||||
{ createLayout( );
|
||||
}
|
||||
|
||||
// createLayout
|
||||
// ============
|
||||
|
||||
void TimingWidget::createLayout( )
|
||||
{ QGridLayout* gridLayout = new QGridLayout( this );
|
||||
KIconLoader* iconLoader = KGlobal::iconLoader( );
|
||||
QIconSet clearLeftIconSet = iconLoader->loadIconSet( "clear_left", KIcon::Small );
|
||||
|
||||
byte row = 1;
|
||||
QButtonGroup* timingGroupBox = new QButtonGroup( 7, Qt::Vertical, "Simple Timing", this, "timing group box" );
|
||||
m_defaultRadio = new QRadioButton( i18n( "Default" ), timingGroupBox, "default radio button" );
|
||||
m_aggressiveRadio = new QRadioButton( i18n( "Aggressive (-T4)" ), timingGroupBox, "aggressive radio button" );
|
||||
m_insaneRadio = new QRadioButton( i18n( "Insane (-T5)" ), timingGroupBox, "insane radio button" );
|
||||
m_normalRadio = new QRadioButton( i18n( "Normal (-T3)" ), timingGroupBox, "normal radio button" );
|
||||
m_paranoidRadio = new QRadioButton( i18n( "Paranoid (-T0)" ), timingGroupBox, "paranoid radio button" );
|
||||
m_politeRadio = new QRadioButton( i18n( "Polite (-T2)" ), timingGroupBox, "polite radio button" );
|
||||
m_sneakyRadio = new QRadioButton( i18n( "Sneaky (-T1)" ), timingGroupBox, "sneaky radio button" );
|
||||
gridLayout->addMultiCellWidget( timingGroupBox, row, row + 7, 1, 1 );
|
||||
row += 7;
|
||||
byte rowBlock1 = row;
|
||||
|
||||
m_hostTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "host timeout button" );
|
||||
m_initialRTTTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "initial rtt timeout button" );
|
||||
m_maxHostGroupButton = new QPushButton( clearLeftIconSet, NULL, this, "max host group button" );
|
||||
m_maxParallelismButton = new QPushButton( clearLeftIconSet, NULL, this, "max parallelism button" );
|
||||
m_maxRTTTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "max rtt timeout button" );
|
||||
m_maxScanDelayButton = new QPushButton( clearLeftIconSet, NULL, this, "max scan delay button" );
|
||||
m_minHostGroupButton = new QPushButton( clearLeftIconSet, NULL, this, "min host group button" );
|
||||
m_minParallelismButton = new QPushButton( clearLeftIconSet, NULL, this, "min parallelism button" );
|
||||
m_minRTTTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "min rtt timeout button" );
|
||||
m_scanDelayButton = new QPushButton( clearLeftIconSet, NULL, this, "min scan delay button" );
|
||||
|
||||
m_hostTimeoutCheckBox = new QCheckBox( i18n( "Host timeout (--host_timeout)" ), this, "host timeout checkbox" );
|
||||
m_initialRTTTimeoutCheckBox = new QCheckBox( i18n( "Initial RTT timeout (--initial_rtt_timeout)" ), this, "initial rtt timeout checkbox" );
|
||||
m_maxHostGroupCheckBox = new QCheckBox( i18n( "Max Host group (--max_hostgroup)" ), this, "max host group checkbox" );
|
||||
m_maxParallelismCheckBox = new QCheckBox( i18n( "Max Parallelism (--max_parallelism)" ), this, "max parallelism checkbox" );
|
||||
m_maxRTTTimeoutCheckBox = new QCheckBox( i18n( "Max RTT timeout (--max_rtt_timeout)" ), this, "max rtt timeout checkbox" );
|
||||
m_maxScanDelayCheckBox = new QCheckBox( i18n( "Max Scan delay (--max_scan_delay)" ), this, "max scan delay checkbox" );
|
||||
m_minHostGroupCheckBox = new QCheckBox( i18n( "Min Host group (--min_hostgroup)" ), this, "min host group checkbox" );
|
||||
m_minParallelismCheckBox = new QCheckBox( i18n( "Min Parallelism (--min_parallelism)" ), this, "min parallelism checkbox" );
|
||||
m_minRTTTimeoutCheckBox = new QCheckBox( i18n( "Min RTT timeout (--min_rtt_timeout)" ), this, "min rtt timeout checkbox" );
|
||||
m_scanDelayCheckBox = new QCheckBox( i18n( "Min Scan delay (--scan_delay)" ), this, "min scan delay checkbox" );
|
||||
|
||||
m_hostTimeoutLineEdit = new QLineEdit( this, "host timeout line edit" );
|
||||
m_initialRTTTimeoutLineEdit = new QLineEdit( this, "initial rtt timeout line edit" );
|
||||
m_maxHostGroupLineEdit = new QLineEdit( this, "max host group line edit" );
|
||||
m_maxParallelismLineEdit = new QLineEdit( this, "max parallelism line edit" );
|
||||
m_maxRTTTimeoutLineEdit = new QLineEdit( this, "max rtt timeout line edit" );
|
||||
m_maxScanDelayLineEdit = new QLineEdit( this, "max scan delay line edit" );
|
||||
m_minHostGroupLineEdit = new QLineEdit( this, "min host group line edit" );
|
||||
m_minParallelismLineEdit = new QLineEdit( this, "min parallelism line edit" );
|
||||
m_minRTTTimeoutLineEdit = new QLineEdit( this, "min rtt timeout line edit" );
|
||||
m_scanDelayLineEdit = new QLineEdit( this, "min scan delay line edit" );
|
||||
|
||||
m_hostTimeoutLineEdit->setInputMask( "999999" );
|
||||
m_initialRTTTimeoutLineEdit->setInputMask( "999999" );
|
||||
m_maxHostGroupLineEdit->setInputMask( "999999" );
|
||||
m_maxParallelismLineEdit->setInputMask( "999999" );
|
||||
m_maxRTTTimeoutLineEdit->setInputMask( "999999" );
|
||||
m_maxScanDelayLineEdit->setInputMask( "999999" );
|
||||
m_minHostGroupLineEdit->setInputMask( "999999" );
|
||||
m_minParallelismLineEdit->setInputMask( "999999" );
|
||||
m_minRTTTimeoutLineEdit->setInputMask( "999999" );
|
||||
m_scanDelayLineEdit->setInputMask( "999999" );
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( m_hostTimeoutCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_hostTimeoutLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_hostTimeoutButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_maxHostGroupCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_maxHostGroupLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_maxHostGroupButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_minHostGroupCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_minHostGroupLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_minHostGroupButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_maxParallelismCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_maxParallelismLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_maxParallelismButton, row++, 5 );
|
||||
|
||||
gridLayout->addWidget( m_minParallelismCheckBox, row, 3 );
|
||||
gridLayout->addWidget( m_minParallelismLineEdit, row, 4 );
|
||||
gridLayout->addWidget( m_minParallelismButton, row++, 5 );
|
||||
byte rowBlock2 = row;
|
||||
|
||||
row = 1;
|
||||
gridLayout->addWidget( m_initialRTTTimeoutCheckBox, row, 7 );
|
||||
gridLayout->addWidget( m_initialRTTTimeoutLineEdit, row, 8 );
|
||||
gridLayout->addWidget( m_initialRTTTimeoutButton, row++, 9 );
|
||||
|
||||
gridLayout->addWidget( m_maxRTTTimeoutCheckBox, row, 7 );
|
||||
gridLayout->addWidget( m_maxRTTTimeoutLineEdit, row, 8 );
|
||||
gridLayout->addWidget( m_maxRTTTimeoutButton, row++, 9 );
|
||||
|
||||
gridLayout->addWidget( m_minRTTTimeoutCheckBox, row, 7 );
|
||||
gridLayout->addWidget( m_minRTTTimeoutLineEdit, row, 8 );
|
||||
gridLayout->addWidget( m_minRTTTimeoutButton, row++, 9 );
|
||||
|
||||
gridLayout->addWidget( m_maxScanDelayCheckBox, row, 7 );
|
||||
gridLayout->addWidget( m_maxScanDelayLineEdit, row, 8 );
|
||||
gridLayout->addWidget( m_maxScanDelayButton, row++, 9 );
|
||||
|
||||
gridLayout->addWidget( m_scanDelayCheckBox, row, 7 );
|
||||
gridLayout->addWidget( m_scanDelayLineEdit, row, 8 );
|
||||
gridLayout->addWidget( m_scanDelayButton, row++, 9 );
|
||||
byte rowBlock3 = row;
|
||||
|
||||
gridLayout->setColStretch( 0, 3 );
|
||||
gridLayout->setColStretch( 2, 3 );
|
||||
gridLayout->setColStretch( 4, 10 );
|
||||
gridLayout->setColStretch( 6, 3 );
|
||||
gridLayout->setColStretch( 8, 10 );
|
||||
gridLayout->setColStretch( 10, 3 );
|
||||
|
||||
gridLayout->setRowStretch( 0, 10 );
|
||||
gridLayout->setRowStretch( _max_( rowBlock1, _max_( rowBlock2, rowBlock3 )) + 1, 10 );
|
||||
}
|
||||
|
||||
// finaliseInitialisation
|
||||
// ======================
|
||||
|
||||
void TimingWidget::finaliseInitialisation( )
|
||||
{ WhatsThis* whatsThis = new WhatsThis( this );
|
||||
|
||||
connect( m_aggressiveRadio, SIGNAL( clicked( )), SLOT( slotAggressiveRadioClicked( )));
|
||||
connect( m_defaultRadio, SIGNAL( clicked( )), SLOT( slotDefaultRadioClicked( )));
|
||||
connect( m_hostTimeoutButton, SIGNAL( clicked( )), SLOT( slotHostTimeoutButtonClicked( )));
|
||||
connect( m_hostTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotHostTimeoutCheckBoxClicked( )));
|
||||
connect( m_initialRTTTimeoutButton, SIGNAL( clicked( )), SLOT( slotInitialRTTTimeoutButtonClicked( )));
|
||||
connect( m_initialRTTTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotInitialRTTTimeoutCheckBoxClicked( )));
|
||||
connect( m_insaneRadio, SIGNAL( clicked( )), SLOT( slotInsaneRadioClicked( )));
|
||||
connect( m_maxHostGroupButton, SIGNAL( clicked( )), SLOT( slotMaxHostGroupButtonClicked( )));
|
||||
connect( m_maxHostGroupCheckBox, SIGNAL( clicked( )), SLOT( slotMaxHostGroupCheckBoxClicked( )));
|
||||
connect( m_maxParallelismButton, SIGNAL( clicked( )), SLOT( slotMaxParallelismButtonClicked( )));
|
||||
connect( m_maxParallelismCheckBox, SIGNAL( clicked( )), SLOT( slotMaxParallelismCheckBoxClicked( )));
|
||||
connect( m_maxRTTTimeoutButton, SIGNAL( clicked( )), SLOT( slotMaxRTTTimeoutButtonClicked( )));
|
||||
connect( m_maxRTTTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotMaxRTTTimeoutCheckBoxClicked( )));
|
||||
connect( m_maxScanDelayButton, SIGNAL( clicked( )), SLOT( slotMaxScanDelayButtonClicked( )));
|
||||
connect( m_maxScanDelayCheckBox, SIGNAL( clicked( )), SLOT( slotMaxScanDelayCheckBoxClicked( )));
|
||||
connect( m_minHostGroupButton, SIGNAL( clicked( )), SLOT( slotMinHostGroupButtonClicked( )));
|
||||
connect( m_minHostGroupCheckBox, SIGNAL( clicked( )), SLOT( slotMinHostGroupCheckBoxClicked( )));
|
||||
connect( m_minParallelismButton, SIGNAL( clicked( )), SLOT( slotMinParallelismButtonClicked( )));
|
||||
connect( m_minParallelismCheckBox, SIGNAL( clicked( )), SLOT( slotMinParallelismCheckBoxClicked( )));
|
||||
connect( m_minRTTTimeoutButton, SIGNAL( clicked( )), SLOT( slotMinRTTTimeoutButtonClicked( )));
|
||||
connect( m_minRTTTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotMinRTTTimeoutCheckBoxClicked( )));
|
||||
connect( m_normalRadio, SIGNAL( clicked( )), SLOT( slotNormalRadioClicked( )));
|
||||
connect( m_paranoidRadio, SIGNAL( clicked( )), SLOT( slotParanoidRadioClicked( )));
|
||||
connect( m_politeRadio, SIGNAL( clicked( )), SLOT( slotPoliteRadioClicked( )));
|
||||
connect( m_scanDelayButton, SIGNAL( clicked( )), SLOT( slotScanDelayButtonClicked( )));
|
||||
connect( m_scanDelayCheckBox, SIGNAL( clicked( )), SLOT( slotScanDelayCheckBoxClicked( )));
|
||||
connect( m_sneakyRadio, SIGNAL( clicked( )), SLOT( slotSneakyRadioClicked( )));
|
||||
connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( )));
|
||||
|
||||
connect( m_aggressiveRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_defaultRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_hostTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_hostTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_initialRTTTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_initialRTTTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_insaneRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxHostGroupCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxHostGroupLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxParallelismCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxParallelismLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxRTTTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxRTTTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxScanDelayCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_maxScanDelayLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_minHostGroupCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_minHostGroupLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_minParallelismCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_minParallelismLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_minRTTTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_minRTTTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_normalRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_paranoidRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_politeRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanDelayCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
connect( m_scanDelayLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( )));
|
||||
connect( m_sneakyRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( )));
|
||||
}
|
||||
|
||||
// getOptions
|
||||
// ==========
|
||||
|
||||
bool TimingWidget::getOptions( )
|
||||
{ bool maxHostGroupState = m_maxHostGroupCheckBox->isChecked( );
|
||||
uint maxHostGroupValue = m_maxHostGroupLineEdit->text( ).toUInt( );
|
||||
bool maxParallelismState = m_maxParallelismCheckBox->isChecked( );
|
||||
uint maxParallelismValue = m_maxParallelismLineEdit->text( ).toUInt( );
|
||||
bool maxRTTTimeoutState = m_maxRTTTimeoutCheckBox->isChecked( );
|
||||
uint maxRTTTimeoutValue = m_maxRTTTimeoutLineEdit->text( ).toUInt( );
|
||||
bool maxScanDelayState = m_maxScanDelayCheckBox->isChecked( );
|
||||
uint maxScanDelayValue = m_maxScanDelayLineEdit->text( ).toUInt( );
|
||||
bool minHostGroupState = m_minHostGroupCheckBox->isChecked( );
|
||||
uint minHostGroupValue = m_minHostGroupLineEdit->text( ).toUInt( );
|
||||
bool minParallelismState = m_minParallelismCheckBox->isChecked( );
|
||||
uint minParallelismValue = m_minParallelismLineEdit->text( ).toUInt( );
|
||||
bool minRTTTimeoutState = m_minRTTTimeoutCheckBox->isChecked( );
|
||||
uint minRTTTimeoutValue = m_minRTTTimeoutLineEdit->text( ).toUInt( );
|
||||
bool scanDelayState = m_scanDelayCheckBox->isChecked( );
|
||||
uint scanDelayValue = m_scanDelayLineEdit->text( ).toUInt( );
|
||||
|
||||
if( minHostGroupValue > maxHostGroupValue )
|
||||
{ KMessageBox::error( this, i18n( QString( "Min host group not < Max host group" )), i18n( "Host group error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( minParallelismValue > maxParallelismValue )
|
||||
{ KMessageBox::error( this, i18n( QString( "Min parallelism not < Max parallelism" )), i18n( "Parallelism error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( minRTTTimeoutValue > maxRTTTimeoutValue )
|
||||
{ KMessageBox::error( this, i18n( QString( "Min RTT timeout not < Max RTT timeout" )), i18n( "RTT timeout error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if( scanDelayValue > maxScanDelayValue )
|
||||
{ KMessageBox::error( this, i18n( QString( "Min scan delay not < Max scan delay" )), i18n( "Scan delay error" ));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hostTimeoutState = m_hostTimeoutCheckBox->isChecked( );
|
||||
m_hostTimeoutValue = m_hostTimeoutLineEdit->text( ).toUInt( );
|
||||
m_initialRTTTimeoutState = m_initialRTTTimeoutCheckBox->isChecked( );
|
||||
m_initialRTTTimeoutValue = m_initialRTTTimeoutLineEdit->text( ).toUInt( );
|
||||
m_maxHostGroupState = maxHostGroupState;
|
||||
m_maxHostGroupValue = maxHostGroupValue;
|
||||
m_maxParallelismState = maxParallelismState;
|
||||
m_maxParallelismValue = maxParallelismValue;
|
||||
m_maxRTTTimeoutState = maxRTTTimeoutState;
|
||||
m_maxRTTTimeoutValue = maxRTTTimeoutValue;
|
||||
m_maxScanDelayState = maxScanDelayState;
|
||||
m_maxScanDelayValue = maxScanDelayValue;
|
||||
m_minHostGroupState = minHostGroupState;
|
||||
m_minHostGroupValue = minHostGroupValue;
|
||||
m_minParallelismState = minParallelismState;
|
||||
m_minParallelismValue = minParallelismValue;
|
||||
m_minRTTTimeoutState = minRTTTimeoutState;
|
||||
m_minRTTTimeoutValue = minRTTTimeoutValue;
|
||||
m_scanDelayState = scanDelayState;
|
||||
m_scanDelayValue = scanDelayValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// readProfile
|
||||
// ===========
|
||||
|
||||
void TimingWidget::readProfile( KConfig* config )
|
||||
{ m_hostTimeoutState = config->readBoolEntry( "hostTimeoutState" );
|
||||
m_hostTimeoutValue = config->readNumEntry( "hostTimeoutValue" );
|
||||
m_initialRTTTimeoutState = config->readBoolEntry( "initialRTTTimeoutState" );
|
||||
m_initialRTTTimeoutValue = config->readNumEntry( "initialRTTTimeoutValue" );
|
||||
m_maxHostGroupState = config->readBoolEntry( "maxHostGroupState" );
|
||||
m_maxHostGroupValue = config->readNumEntry( "maxHostGroupValue" );
|
||||
m_maxParallelismState = config->readBoolEntry( "maxParallelismState" );
|
||||
m_maxParallelismValue = config->readNumEntry( "maxParallelismValue" );
|
||||
m_maxRTTTimeoutState = config->readBoolEntry( "maxRTTTimeoutState" );
|
||||
m_maxRTTTimeoutValue = config->readNumEntry( "maxRTTTimeoutValue" );
|
||||
m_maxScanDelayState = config->readBoolEntry( "maxScanDelayState" );
|
||||
m_maxScanDelayValue = config->readNumEntry( "maxScanDelayValue" );
|
||||
m_minHostGroupState = config->readBoolEntry( "minHostGroupState" );
|
||||
m_minHostGroupValue = config->readNumEntry( "minHostGroupValue" );
|
||||
m_minParallelismState = config->readBoolEntry( "minParallelismState" );
|
||||
m_minParallelismValue = config->readNumEntry( "minParallelismValue" );
|
||||
m_minRTTTimeoutState = config->readBoolEntry( "minRTTTimeoutState" );
|
||||
m_minRTTTimeoutValue = config->readNumEntry( "minRTTTimeoutValue" );
|
||||
m_scanDelayState = config->readBoolEntry( "scanDelayState" );
|
||||
m_scanDelayValue = config->readNumEntry( "scanDelayValue" );
|
||||
|
||||
m_simpleTimingValue = Timing( config->readNumEntry( "simpleTimingValue", Normal_T3_Timing ));
|
||||
}
|
||||
|
||||
// saveProfile
|
||||
// ===========
|
||||
|
||||
void TimingWidget::saveProfile( KConfig* config )
|
||||
{ config->writeEntry( "hostTimeoutState", m_hostTimeoutState );
|
||||
config->writeEntry( "hostTimeoutValue", m_hostTimeoutValue );
|
||||
config->writeEntry( "initialRTTTimeoutState", m_initialRTTTimeoutState );
|
||||
config->writeEntry( "initialRTTTimeoutValue", m_initialRTTTimeoutValue );
|
||||
config->writeEntry( "maxHostGroupState", m_maxHostGroupState );
|
||||
config->writeEntry( "maxHostGroupValue", m_maxHostGroupValue );
|
||||
config->writeEntry( "maxParallelismState", m_maxParallelismState );
|
||||
config->writeEntry( "maxParallelismValue", m_maxParallelismValue );
|
||||
config->writeEntry( "maxRTTTimeoutState", m_maxRTTTimeoutState );
|
||||
config->writeEntry( "maxRTTTimeoutValue", m_maxRTTTimeoutValue );
|
||||
config->writeEntry( "maxScanDelayState", m_maxScanDelayState );
|
||||
config->writeEntry( "maxScanDelayValue", m_maxScanDelayValue );
|
||||
config->writeEntry( "minHostGroupState", m_minHostGroupState );
|
||||
config->writeEntry( "minHostGroupValue", m_minHostGroupValue );
|
||||
config->writeEntry( "minParallelismState", m_minParallelismState );
|
||||
config->writeEntry( "minParallelismValue", m_minParallelismValue );
|
||||
config->writeEntry( "minRTTTimeoutState", m_minRTTTimeoutState );
|
||||
config->writeEntry( "minRTTTimeoutValue", m_minRTTTimeoutValue );
|
||||
config->writeEntry( "scanDelayState", m_scanDelayState );
|
||||
config->writeEntry( "scanDelayValue", m_scanDelayValue );
|
||||
config->writeEntry( "simpleTimingValue", m_simpleTimingValue );
|
||||
}
|
||||
|
||||
// setInitialValues
|
||||
// ================
|
||||
|
||||
void TimingWidget::setInitialValues( )
|
||||
{ m_hostTimeoutCheckBox->setChecked( m_hostTimeoutState );
|
||||
m_hostTimeoutLineEdit->setEnabled( m_hostTimeoutState );
|
||||
m_hostTimeoutLineEdit->setText( QString::number( m_hostTimeoutValue ));
|
||||
m_initialRTTTimeoutCheckBox->setChecked( m_initialRTTTimeoutState );
|
||||
m_initialRTTTimeoutLineEdit->setEnabled( m_initialRTTTimeoutState );
|
||||
m_initialRTTTimeoutLineEdit->setText( QString::number( m_initialRTTTimeoutValue ));
|
||||
m_maxHostGroupCheckBox->setChecked( m_maxHostGroupState );
|
||||
m_maxHostGroupLineEdit->setEnabled( m_maxHostGroupState );
|
||||
m_maxHostGroupLineEdit->setText( QString::number( m_maxHostGroupValue ));
|
||||
m_maxParallelismCheckBox->setChecked( m_maxParallelismState );
|
||||
m_maxParallelismLineEdit->setEnabled( m_maxParallelismState );
|
||||
m_maxParallelismLineEdit->setText( QString::number( m_maxParallelismValue ));
|
||||
m_maxRTTTimeoutCheckBox->setChecked( m_maxRTTTimeoutState );
|
||||
m_maxRTTTimeoutLineEdit->setEnabled( m_maxRTTTimeoutState );
|
||||
m_maxRTTTimeoutLineEdit->setText( QString::number( m_maxRTTTimeoutValue ));
|
||||
m_maxScanDelayCheckBox->setChecked( m_maxScanDelayState );
|
||||
m_maxScanDelayLineEdit->setEnabled( m_maxScanDelayState );
|
||||
m_maxScanDelayLineEdit->setText( QString::number( m_maxScanDelayValue ));
|
||||
m_minHostGroupCheckBox->setChecked( m_minHostGroupState );
|
||||
m_minHostGroupLineEdit->setEnabled( m_minHostGroupState );
|
||||
m_minHostGroupLineEdit->setText( QString::number( m_minHostGroupValue ));
|
||||
m_minParallelismCheckBox->setChecked( m_minParallelismState );
|
||||
m_minParallelismLineEdit->setEnabled( m_minParallelismState );
|
||||
m_minParallelismLineEdit->setText( QString::number( m_minParallelismValue ));
|
||||
m_minRTTTimeoutCheckBox->setChecked( m_minRTTTimeoutState );
|
||||
m_minRTTTimeoutLineEdit->setEnabled( m_minRTTTimeoutState );
|
||||
m_minRTTTimeoutLineEdit->setText( QString::number( m_minRTTTimeoutValue ));
|
||||
m_scanDelayCheckBox->setChecked( m_scanDelayState );
|
||||
m_scanDelayLineEdit->setEnabled( m_scanDelayState );
|
||||
m_scanDelayLineEdit->setText( QString::number( m_scanDelayValue ));
|
||||
|
||||
switch( m_simpleTimingValue )
|
||||
{ case Aggressive_T4_Timing: m_aggressiveRadio->setChecked( true ); break;
|
||||
case Default_Timing: m_defaultRadio->setChecked( true ); break;
|
||||
case Insane_T5_Timing: m_insaneRadio->setChecked( true ); break;
|
||||
case Normal_T3_Timing: m_normalRadio->setChecked( true ); break;
|
||||
case Paranoid_T0_Timing: m_paranoidRadio->setChecked( true ); break;
|
||||
case Polite_T2_Timing: m_politeRadio->setChecked( true ); break;
|
||||
case Sneaky_T1_Timing: m_sneakyRadio->setChecked( true ); break;
|
||||
|
||||
default:
|
||||
kdDebug( ) << "internal error - unknown simple timing value " << m_simpleTimingValue << endl;
|
||||
ASSERT( false );
|
||||
}
|
||||
}
|
||||
|
||||
// simpleTiming
|
||||
// ============
|
||||
|
||||
QString TimingWidget::simpleTiming( ) const
|
||||
{ switch( m_simpleTimingValue )
|
||||
{ case Aggressive_T4_Timing: return "Aggressive";
|
||||
case Default_Timing: return "";
|
||||
case Insane_T5_Timing: return "Insane";
|
||||
case Normal_T3_Timing: return "Normal";
|
||||
case Paranoid_T0_Timing: return "Paranoid";
|
||||
case Polite_T2_Timing: return "Polite";
|
||||
case Sneaky_T1_Timing: return "Sneaky";
|
||||
}
|
||||
|
||||
kdDebug( ) << "internal error - unknown simple timing value " << m_simpleTimingValue << endl;
|
||||
ASSERT( false );
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
// slotAggressiveRadioClicked
|
||||
// ==========================
|
||||
|
||||
void TimingWidget::slotAggressiveRadioClicked( )
|
||||
{ m_simpleTimingValue = Aggressive_T4_Timing;
|
||||
}
|
||||
|
||||
// slotDefaultRadioClicked
|
||||
// =======================
|
||||
|
||||
void TimingWidget::slotDefaultRadioClicked( )
|
||||
{ m_simpleTimingValue = Default_Timing;
|
||||
}
|
||||
|
||||
// slotHostTimeoutButtonClicked
|
||||
// ============================
|
||||
|
||||
void TimingWidget::slotHostTimeoutButtonClicked( )
|
||||
{ m_hostTimeoutLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotHostTimeoutCheckBoxClicked
|
||||
// ==============================
|
||||
|
||||
void TimingWidget::slotHostTimeoutCheckBoxClicked( )
|
||||
{ m_hostTimeoutButton->setEnabled( m_hostTimeoutCheckBox->isChecked( ));
|
||||
m_hostTimeoutLineEdit->setEnabled( m_hostTimeoutCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotInitialRTTTimeoutButtonClicked
|
||||
// ==================================
|
||||
|
||||
void TimingWidget::slotInitialRTTTimeoutButtonClicked( )
|
||||
{ m_initialRTTTimeoutLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotInitialRTTTimeoutCheckBoxClicked
|
||||
// ====================================
|
||||
|
||||
void TimingWidget::slotInitialRTTTimeoutCheckBoxClicked( )
|
||||
{ m_initialRTTTimeoutButton->setEnabled( m_initialRTTTimeoutCheckBox->isChecked( ));
|
||||
m_initialRTTTimeoutLineEdit->setEnabled( m_initialRTTTimeoutCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotInsaneRadioClicked
|
||||
// ======================
|
||||
|
||||
void TimingWidget::slotInsaneRadioClicked( )
|
||||
{ m_simpleTimingValue = Insane_T5_Timing;
|
||||
}
|
||||
|
||||
// slotMaxHostGroupButtonClicked
|
||||
// =============================
|
||||
|
||||
void TimingWidget::slotMaxHostGroupButtonClicked( )
|
||||
{ m_maxHostGroupLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMaxHostGroupCheckBoxClicked
|
||||
// ===============================
|
||||
|
||||
void TimingWidget::slotMaxHostGroupCheckBoxClicked( )
|
||||
{ m_maxHostGroupButton->setEnabled( m_maxHostGroupCheckBox->isChecked( ));
|
||||
m_maxHostGroupLineEdit->setEnabled( m_maxHostGroupCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMaxParallelismButtonClicked
|
||||
// ===============================
|
||||
|
||||
void TimingWidget::slotMaxParallelismButtonClicked( )
|
||||
{ m_maxParallelismLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMaxParallelismCheckBoxClicked
|
||||
// =================================
|
||||
|
||||
void TimingWidget::slotMaxParallelismCheckBoxClicked( )
|
||||
{ m_maxParallelismButton->setEnabled( m_maxParallelismCheckBox->isChecked( ));
|
||||
m_maxParallelismLineEdit->setEnabled( m_maxParallelismCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMaxRTTTimeoutButtonClicked
|
||||
// ==============================
|
||||
|
||||
void TimingWidget::slotMaxRTTTimeoutButtonClicked( )
|
||||
{ m_maxRTTTimeoutLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMaxRTTTimeoutCheckBoxClicked
|
||||
// ================================
|
||||
|
||||
void TimingWidget::slotMaxRTTTimeoutCheckBoxClicked( )
|
||||
{ m_maxRTTTimeoutButton->setEnabled( m_maxRTTTimeoutCheckBox->isChecked( ));
|
||||
m_maxRTTTimeoutLineEdit->setEnabled( m_maxRTTTimeoutCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMaxScanDelayButtonClicked
|
||||
// =============================
|
||||
|
||||
void TimingWidget::slotMaxScanDelayButtonClicked( )
|
||||
{ m_maxScanDelayLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMaxScanDelayCheckBoxClicked
|
||||
// ===============================
|
||||
|
||||
void TimingWidget::slotMaxScanDelayCheckBoxClicked( )
|
||||
{ m_maxScanDelayButton->setEnabled( m_maxScanDelayCheckBox->isChecked( ));
|
||||
m_maxScanDelayLineEdit->setEnabled( m_maxScanDelayCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMinHostGroupButtonClicked
|
||||
// =============================
|
||||
|
||||
void TimingWidget::slotMinHostGroupButtonClicked( )
|
||||
{ m_minHostGroupLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMinHostGroupCheckBoxClicked
|
||||
// ===============================
|
||||
|
||||
void TimingWidget::slotMinHostGroupCheckBoxClicked( )
|
||||
{ m_minHostGroupButton->setEnabled( m_minHostGroupCheckBox->isChecked( ));
|
||||
m_minHostGroupLineEdit->setEnabled( m_minHostGroupCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMinParallelismButtonClicked
|
||||
// ===============================
|
||||
|
||||
void TimingWidget::slotMinParallelismButtonClicked( )
|
||||
{ m_minParallelismLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMinParallelismCheckBoxClicked
|
||||
// =================================
|
||||
|
||||
void TimingWidget::slotMinParallelismCheckBoxClicked( )
|
||||
{ m_minParallelismButton->setEnabled( m_minParallelismCheckBox->isChecked( ));
|
||||
m_minParallelismLineEdit->setEnabled( m_minParallelismCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotMinRTTTimeoutButtonClicked
|
||||
// ==============================
|
||||
|
||||
void TimingWidget::slotMinRTTTimeoutButtonClicked( )
|
||||
{ m_minRTTTimeoutLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotMinRTTTimeoutCheckBoxClicked
|
||||
// ================================
|
||||
|
||||
void TimingWidget::slotMinRTTTimeoutCheckBoxClicked( )
|
||||
{ m_minRTTTimeoutButton->setEnabled( m_minRTTTimeoutCheckBox->isChecked( ));
|
||||
m_minRTTTimeoutLineEdit->setEnabled( m_minRTTTimeoutCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotNormalRadioClicked
|
||||
// ======================
|
||||
|
||||
void TimingWidget::slotNormalRadioClicked( )
|
||||
{ m_simpleTimingValue = Normal_T3_Timing;
|
||||
}
|
||||
|
||||
// slotParanoidRadioClicked
|
||||
// ========================
|
||||
|
||||
void TimingWidget::slotParanoidRadioClicked( )
|
||||
{ m_simpleTimingValue = Paranoid_T0_Timing;
|
||||
}
|
||||
|
||||
// slotPoliteRadioClicked
|
||||
// ======================
|
||||
|
||||
void TimingWidget::slotPoliteRadioClicked( )
|
||||
{ m_simpleTimingValue = Polite_T2_Timing;
|
||||
}
|
||||
|
||||
// slotScanDelayButtonClicked
|
||||
// ==========================
|
||||
|
||||
void TimingWidget::slotScanDelayButtonClicked( )
|
||||
{ m_scanDelayLineEdit->clear( );
|
||||
}
|
||||
|
||||
// slotScanDelayCheckBoxClicked
|
||||
// ============================
|
||||
|
||||
void TimingWidget::slotScanDelayCheckBoxClicked( )
|
||||
{ m_scanDelayButton->setEnabled( m_scanDelayCheckBox->isChecked( ));
|
||||
m_scanDelayLineEdit->setEnabled( m_scanDelayCheckBox->isChecked( ));
|
||||
}
|
||||
|
||||
// slotSneakyRadioClicked
|
||||
// ======================
|
||||
|
||||
void TimingWidget::slotSneakyRadioClicked( )
|
||||
{ m_simpleTimingValue = Sneaky_T1_Timing;
|
||||
}
|
||||
|
||||
// slotWhatsThisClicked
|
||||
// ====================
|
||||
|
||||
void TimingWidget::slotWhatsThisClicked( )
|
||||
{ if( m_aggressiveRadio->hasMouse( )) emit( displayHelp( "-T" ));
|
||||
else if( m_defaultRadio->hasMouse( )) emit( displayDocBook( "timing_options" ));
|
||||
else if( m_hostTimeoutButton->hasMouse( )) emit( displayHelp( "--host_timeout" ));
|
||||
else if( m_hostTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--host_timeout" ));
|
||||
else if( m_hostTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--host_timeout" ));
|
||||
else if( m_initialRTTTimeoutButton->hasMouse( )) emit( displayHelp( "--initial_rtt_timeout" ));
|
||||
else if( m_initialRTTTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--initial_rtt_timeout" ));
|
||||
else if( m_initialRTTTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--initial_rtt_timeout" ));
|
||||
else if( m_insaneRadio->hasMouse( )) emit( displayHelp( "-T" ));
|
||||
else if( m_maxHostGroupButton->hasMouse( )) emit( displayHelp( "--max_hostgroup" ));
|
||||
else if( m_maxHostGroupCheckBox->hasMouse( )) emit( displayHelp( "--max_hostgroup" ));
|
||||
else if( m_maxHostGroupLineEdit->hasMouse( )) emit( displayHelp( "--max_hostgroup" ));
|
||||
else if( m_maxParallelismButton->hasMouse( )) emit( displayHelp( "--max_parallelism" ));
|
||||
else if( m_maxParallelismCheckBox->hasMouse( )) emit( displayHelp( "--max_parallelism" ));
|
||||
else if( m_maxParallelismLineEdit->hasMouse( )) emit( displayHelp( "--max_parallelism" ));
|
||||
else if( m_maxRTTTimeoutButton->hasMouse( )) emit( displayHelp( "--max_rtt_timeout" ));
|
||||
else if( m_maxRTTTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--max_rtt_timeout" ));
|
||||
else if( m_maxRTTTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--max_rtt_timeout" ));
|
||||
else if( m_maxScanDelayButton->hasMouse( )) emit( displayHelp( "--max_scan_delay" ));
|
||||
else if( m_maxScanDelayCheckBox->hasMouse( )) emit( displayHelp( "--max_scan_delay" ));
|
||||
else if( m_maxScanDelayLineEdit->hasMouse( )) emit( displayHelp( "--max_scan_delay" ));
|
||||
else if( m_minHostGroupButton->hasMouse( )) emit( displayHelp( "--min_hostgroup" ));
|
||||
else if( m_minHostGroupCheckBox->hasMouse( )) emit( displayHelp( "--min_hostgroup" ));
|
||||
else if( m_minHostGroupLineEdit->hasMouse( )) emit( displayHelp( "--min_hostgroup" ));
|
||||
else if( m_minParallelismButton->hasMouse( )) emit( displayHelp( "--min_parallelism" ));
|
||||
else if( m_minParallelismCheckBox->hasMouse( )) emit( displayHelp( "--min_parallelism" ));
|
||||
else if( m_minParallelismLineEdit->hasMouse( )) emit( displayHelp( "--min_parallelism" ));
|
||||
else if( m_minRTTTimeoutButton->hasMouse( )) emit( displayHelp( "--min_rtt_timeout" ));
|
||||
else if( m_minRTTTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--min_rtt_timeout" ));
|
||||
else if( m_minRTTTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--min_rtt_timeout" ));
|
||||
else if( m_normalRadio->hasMouse( )) emit( displayHelp( "-T" ));
|
||||
else if( m_paranoidRadio->hasMouse( )) emit( displayHelp( "-T" ));
|
||||
else if( m_politeRadio->hasMouse( )) emit( displayHelp( "-T" ));
|
||||
else if( m_scanDelayButton->hasMouse( )) emit( displayHelp( "--scan_delay" ));
|
||||
else if( m_scanDelayCheckBox->hasMouse( )) emit( displayHelp( "--scan_delay" ));
|
||||
else if( m_scanDelayLineEdit->hasMouse( )) emit( displayHelp( "--scan_delay" ));
|
||||
else if( m_sneakyRadio->hasMouse( )) emit( displayHelp( "-T" ));
|
||||
else emit( displayUnknown( ));
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef _TIMINGWIDGET_H_
|
||||
#define _TIMINGWIDGET_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class KConfig;
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
|
||||
// TimingWidget class definition
|
||||
// =============================
|
||||
|
||||
class TimingWidget : public QWidget
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
TimingWidget( QWidget* parent, const char* name = NULL );
|
||||
|
||||
void finaliseInitialisation( );
|
||||
bool getOptions( );
|
||||
void readProfile( KConfig* config );
|
||||
void saveProfile( KConfig* config );
|
||||
void setInitialValues( );
|
||||
QString simpleTiming( ) const;
|
||||
|
||||
bool hostTimeoutState( ) const { return m_hostTimeoutState; }
|
||||
uint hostTimeoutValue( ) const { return m_hostTimeoutValue; }
|
||||
bool initialRTTTimeoutState( ) const { return m_initialRTTTimeoutState; }
|
||||
uint initialRTTTimeoutValue( ) const { return m_initialRTTTimeoutValue; }
|
||||
bool maxHostGroupState( ) const { return m_maxHostGroupState; }
|
||||
uint maxHostGroupValue( ) const { return m_maxHostGroupValue; }
|
||||
bool maxParallelismState( ) const { return m_maxParallelismState; }
|
||||
uint maxParallelismValue( ) const { return m_maxParallelismValue; }
|
||||
bool maxRTTTimeoutState( ) const { return m_maxRTTTimeoutState; }
|
||||
uint maxRTTTimeoutValue( ) const { return m_maxRTTTimeoutValue; }
|
||||
bool maxScanDelayState( ) const { return m_maxScanDelayState; }
|
||||
uint maxScanDelayValue( ) const { return m_maxScanDelayValue; }
|
||||
bool minHostGroupState( ) const { return m_minHostGroupState; }
|
||||
uint minHostGroupValue( ) const { return m_minHostGroupValue; }
|
||||
bool minParallelismState( ) const { return m_minParallelismState; }
|
||||
uint minParallelismValue( ) const { return m_minParallelismValue; }
|
||||
bool minRTTTimeoutState( ) const { return m_minRTTTimeoutState; }
|
||||
uint minRTTTimeoutValue( ) const { return m_minRTTTimeoutValue; }
|
||||
bool scanDelayState( ) const { return m_scanDelayState; }
|
||||
uint scanDelayValue( ) const { return m_scanDelayValue; }
|
||||
|
||||
signals:
|
||||
void displayDocBook( const QString& );
|
||||
void displayHelp( const QString& );
|
||||
void displayUnknown( );
|
||||
void optionsDirty( );
|
||||
|
||||
private slots:
|
||||
void slotAggressiveRadioClicked( );
|
||||
void slotDefaultRadioClicked( );
|
||||
void slotHostTimeoutButtonClicked( );
|
||||
void slotHostTimeoutCheckBoxClicked( );
|
||||
void slotInitialRTTTimeoutButtonClicked( );
|
||||
void slotInitialRTTTimeoutCheckBoxClicked( );
|
||||
void slotInsaneRadioClicked( );
|
||||
void slotMaxHostGroupButtonClicked( );
|
||||
void slotMaxHostGroupCheckBoxClicked( );
|
||||
void slotMaxParallelismButtonClicked( );
|
||||
void slotMaxParallelismCheckBoxClicked( );
|
||||
void slotMaxRTTTimeoutButtonClicked( );
|
||||
void slotMaxRTTTimeoutCheckBoxClicked( );
|
||||
void slotMaxScanDelayButtonClicked( );
|
||||
void slotMaxScanDelayCheckBoxClicked( );
|
||||
void slotMinHostGroupButtonClicked( );
|
||||
void slotMinHostGroupCheckBoxClicked( );
|
||||
void slotMinParallelismButtonClicked( );
|
||||
void slotMinParallelismCheckBoxClicked( );
|
||||
void slotMinRTTTimeoutButtonClicked( );
|
||||
void slotMinRTTTimeoutCheckBoxClicked( );
|
||||
void slotNormalRadioClicked( );
|
||||
void slotParanoidRadioClicked( );
|
||||
void slotPoliteRadioClicked( );
|
||||
void slotScanDelayButtonClicked( );
|
||||
void slotScanDelayCheckBoxClicked( );
|
||||
void slotSneakyRadioClicked( );
|
||||
void slotWhatsThisClicked( );
|
||||
|
||||
private:
|
||||
void createLayout( );
|
||||
|
||||
// simple timing indices
|
||||
// =====================
|
||||
|
||||
enum Timing
|
||||
{ Default_Timing,
|
||||
Aggressive_T4_Timing,
|
||||
Insane_T5_Timing,
|
||||
Normal_T3_Timing,
|
||||
Paranoid_T0_Timing,
|
||||
Polite_T2_Timing,
|
||||
Sneaky_T1_Timing
|
||||
};
|
||||
|
||||
QRadioButton* m_aggressiveRadio;
|
||||
QRadioButton* m_defaultRadio;
|
||||
QPushButton* m_hostTimeoutButton;
|
||||
QCheckBox* m_hostTimeoutCheckBox;
|
||||
QLineEdit* m_hostTimeoutLineEdit;
|
||||
bool m_hostTimeoutState;
|
||||
uint m_hostTimeoutValue;
|
||||
QPushButton* m_initialRTTTimeoutButton;
|
||||
QCheckBox* m_initialRTTTimeoutCheckBox;
|
||||
QLineEdit* m_initialRTTTimeoutLineEdit;
|
||||
bool m_initialRTTTimeoutState;
|
||||
uint m_initialRTTTimeoutValue;
|
||||
QRadioButton* m_insaneRadio;
|
||||
QPushButton* m_maxHostGroupButton;
|
||||
QCheckBox* m_maxHostGroupCheckBox;
|
||||
QLineEdit* m_maxHostGroupLineEdit;
|
||||
bool m_maxHostGroupState;
|
||||
uint m_maxHostGroupValue;
|
||||
QPushButton* m_maxParallelismButton;
|
||||
QCheckBox* m_maxParallelismCheckBox;
|
||||
QLineEdit* m_maxParallelismLineEdit;
|
||||
bool m_maxParallelismState;
|
||||
uint m_maxParallelismValue;
|
||||
QPushButton* m_maxRTTTimeoutButton;
|
||||
QCheckBox* m_maxRTTTimeoutCheckBox;
|
||||
QLineEdit* m_maxRTTTimeoutLineEdit;
|
||||
bool m_maxRTTTimeoutState;
|
||||
uint m_maxRTTTimeoutValue;
|
||||
QPushButton* m_maxScanDelayButton;
|
||||
QCheckBox* m_maxScanDelayCheckBox;
|
||||
QLineEdit* m_maxScanDelayLineEdit;
|
||||
bool m_maxScanDelayState;
|
||||
uint m_maxScanDelayValue;
|
||||
QPushButton* m_minHostGroupButton;
|
||||
QCheckBox* m_minHostGroupCheckBox;
|
||||
QLineEdit* m_minHostGroupLineEdit;
|
||||
bool m_minHostGroupState;
|
||||
uint m_minHostGroupValue;
|
||||
QPushButton* m_minParallelismButton;
|
||||
QCheckBox* m_minParallelismCheckBox;
|
||||
QLineEdit* m_minParallelismLineEdit;
|
||||
bool m_minParallelismState;
|
||||
uint m_minParallelismValue;
|
||||
QPushButton* m_minRTTTimeoutButton;
|
||||
QCheckBox* m_minRTTTimeoutCheckBox;
|
||||
QLineEdit* m_minRTTTimeoutLineEdit;
|
||||
bool m_minRTTTimeoutState;
|
||||
uint m_minRTTTimeoutValue;
|
||||
QRadioButton* m_normalRadio;
|
||||
QRadioButton* m_paranoidRadio;
|
||||
QRadioButton* m_politeRadio;
|
||||
QPushButton* m_scanDelayButton;
|
||||
QCheckBox* m_scanDelayCheckBox;
|
||||
QLineEdit* m_scanDelayLineEdit;
|
||||
bool m_scanDelayState;
|
||||
uint m_scanDelayValue;
|
||||
Timing m_simpleTimingValue;
|
||||
QRadioButton* m_sneakyRadio;
|
||||
};
|
||||
|
||||
#endif // _TIMINGWIDGET_H_
|
@ -0,0 +1,42 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "whatsthis.h"
|
||||
|
||||
// constructor
|
||||
// ===========
|
||||
|
||||
WhatsThis::WhatsThis( QWidget* widget )
|
||||
: QWhatsThis( widget )
|
||||
{
|
||||
}
|
||||
|
||||
// text
|
||||
// ====
|
||||
|
||||
QString WhatsThis::text( const QPoint& /*pos */)
|
||||
{ emit( clicked( ));
|
||||
return "";
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2005, 2006 by Kevin Gilbert *
|
||||
* kev.gilbert@cdu.edu.au *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _WHATSTHIS_H_
|
||||
#define _WHATSTHIS_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include "global.h"
|
||||
|
||||
// forward class definitions
|
||||
// =========================
|
||||
|
||||
class QPoint;
|
||||
|
||||
// WhatsThis class definition
|
||||
// ==========================
|
||||
|
||||
class WhatsThis : public QObject, public QWhatsThis
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
WhatsThis( QWidget* widget );
|
||||
QString text( const QPoint& pos );
|
||||
|
||||
signals:
|
||||
void clicked( );
|
||||
};
|
||||
|
||||
#endif // _WHATSTHIS_H_
|