--- knocker-0.7.1.orig/tclean +++ knocker-0.7.1/tclean @@ -0,0 +1,358 @@ +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Makefile.am file for knocker +# Edited by Gabriele Giorgetti + +# This file is processed by automake + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SUBDIRS = src docs + +DIST_SUBDIRS = $(SUBDIRS) docs + +# All the rest of the distributed files +EXTRA_DIST = AUTHORS BUGS COPYING INSTALL README TO-DO autogen.sh ChangeLog + +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS aclocal.m4 config.h.in configure \ +configure.in install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(DIST_SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile config.h +all-redirect: all-recursive-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- knocker-0.7.1.orig/debian/watch +++ knocker-0.7.1/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sf.net/knocker/knocker-(.*).tar.gz --- knocker-0.7.1.orig/debian/rules +++ knocker-0.7.1/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk --- knocker-0.7.1.orig/debian/control +++ knocker-0.7.1/debian/control @@ -0,0 +1,18 @@ +Source: knocker +Build-Depends: cdbs, debhelper (>= 9.0.0) +Section: net +Priority: optional +Maintainer: Khalid El Fathi +Standards-Version: 3.9.3 +Homepage: http://knocker.sourceforge.net/ +Vcs-Git: git://git.debian.org/git/collab-maint/knocker.git +Vcs-Browser: http://git.debian.org/?p=collab-maint/knocker.git;a=summary + +Package: knocker +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Simple and easy to use TCP security port scanner + Knocker is a new, simple, and easy to use TCP security port + scanner written in C, using threads. It is able to analyze hosts + and the network services which are running on them. + --- knocker-0.7.1.orig/debian/docs +++ knocker-0.7.1/debian/docs @@ -0,0 +1,5 @@ +BUGS +NEWS +README +TO-DO +AUTHORS --- knocker-0.7.1.orig/debian/changelog +++ knocker-0.7.1/debian/changelog @@ -0,0 +1,126 @@ +knocker (0.7.1-4) unstable; urgency=low + + * New maintainer (Closes: #654324). + * Update copyright file. + * Add Vcs-{Browser,Git} pointing to collab-maint/knocker.git + * Apply patch by Mats Erik Andersson to + implement support for IPv6 probing (Closes: #616311). + * Fixed lintian warnings: + - W: knocker source: debhelper-but-no-misc-depends knocker + - W: knocker source: package-uses-deprecated-debhelper-compat-version 4 + - W: knocker source: changelog-should-mention-nmu + - W: knocker source: ancient-standards-version 3.8.0 (current is 3.9.3) + - W: knocker: description-synopsis-starts-with-article + + -- Khalid El Fathi Thu, 23 Feb 2012 18:55:00 +0100 + +knocker (0.7.1-3.1) unstable; urgency=low + + * NMU, to make package fit for Lenny. + * Apply patch by UlisesVitulli to fix segfault, + closes: #194869, #333214 + * Fix watch file, patch by Raphael Geissert , + closes: #450036 + * Upgraded to standards version 3.8.0, only change needed was to move + homepage information to its own control field. + + -- Michael Meskes Sun, 05 Oct 2008 12:19:47 +0200 + +knocker (0.7.1-3) unstable; urgency=low + + * Upgraded Standard-Version + * Fixes typo in manpage (Closes: #323531) + * Added debian/watch file + * Switched to CDBS + * Moved knocker out of /bin to /usr/bin (Closes: #323995) + * Changed the options parsing order: now parses the config-file and + then the line arguments, so it can get the override config-file with + the line options. (Closes: #264548) + + -- Pablo Lorenzzoni Fri, 2 Sep 2005 01:54:10 -0300 + +knocker (0.7.1-2) unstable; urgency=low + + * Upgraded Standard-Version + * Add URL to the description + + -- Pablo Lorenzzoni Mon, 23 Feb 2004 13:38:39 -0300 + +knocker (0.7.1-1) unstable; urgency=low + + * New upstream release + * Option --configure added. It creates a knocker.conf under ~/.knocker. + * Option --no-fency added. It shows the output in a "polite" way. + * Unit knocker_led added to blink the keyboard leds while scanning + * Option --quiet-mode is now known as just --quiet. + + -- Pablo Lorenzzoni Fri, 14 Jun 2002 12:06:21 -0300 + +knocker (0.6.0-1) unstable; urgency=low + + * New upstream release + * Console output changed and big portions of code were rewritten. + * All the fprintf(...) stuffs now under knocker_output for sake of cleaner + code. + * Code to output debug messages added. + * TCP connect port scan code should be faster. + * knocker_core totally redesigned (and rewritten) to be more flexible + and versatile. Plans are to make it available as a library/DLL. + * Added header file definitions to prevent multiple file inclusion. + * Option --port or -P added to perform a portscan on a single port. + * Threads code removed. It will be redesigned i the future. + * Fixed total scanned ports result counting bug (Closes: #107680). + * Fixed segfault when logfile couldn't be opened. + * Compiling with -Wall -ansi -pedantic now. + * Module terminal.c renamed to knocker_term.c + + -- Pablo Lorenzzoni Wed, 20 Feb 2002 17:18:10 -0300 + +knocker (0.5.0-2) unstable; urgency=low + + * Fixes buildd installation permission problems (Closes: #132414). + + -- Pablo Lorenzzoni Tue, 5 Feb 2002 15:55:45 -0200 + +knocker (0.5.0-1) unstable; urgency=low + + * New upstream release. + * Added the following options: --quiet-mode (write to knocker_scan.log + instead of writing to stdout); --enable-logfile (same as before, but + stdout is enabled); --no-threads (for the ones that are facing + problems with threads). + * Added modules knocker_log.c, knocker_log.h to support the new + file logging functions. + + -- Pablo Lorenzzoni Sun, 3 Jan 2002 22:00:14 +0000 + +knocker (0.4.0-1) unstable; urgency=low + + * New upstream release. + * Added colored output (and a --no-colors option). + + -- Pablo Lorenzzoni Mon, 30 Jul 2001 23:03:23 +0000 + +knocker (0.3.0-1) unstable; urgency=low + + * New upstream release. Now knocker use pthreads. + + -- Pablo Lorenzzoni Mon, 23 Jul 2001 09:23:43 +0000 + +knocker (0.2.0-1) unstable; urgency=low + + * New upstream release. The upstream author has added a function to + resolve hosts IP addresses. + + -- Pablo Lorenzzoni Mon, 16 Jul 2001 00:26:13 +0000 + +knocker (0.1.0-1) unstable; urgency=low + + * Initial Release. (Closes: #104380) + * Adjusted directories (from /usr/local/bin to /usr/bin). + + -- Pablo Lorenzzoni Wed, 11 Jul 2001 13:45:49 -0300 + +Local variables: +mode: debian-changelog +End: --- knocker-0.7.1.orig/debian/copyright +++ knocker-0.7.1/debian/copyright @@ -0,0 +1,41 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: knocker +Source: http://knocker.sourceforge.net/ + +Files: * +Copyright: © 2001-2012 Gabriele Giorgetti +License: GPL-2 + 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, see . + . + On Debian systems, the complete text of the GNU General Public License + can be found in /usr/share/common-licenses/GPL-2 file. + +Files: debian/* +Copyright: © 2012 Khalid El Fathi +License: GPL-2+ + This package 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 package 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, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". --- knocker-0.7.1.orig/debian/knocker.1 +++ knocker-0.7.1/debian/knocker.1 @@ -0,0 +1,100 @@ +.\" knocker man page +.\" Process this file with: groff -man -Tascii +.\" man page originally written by Gabriele Giorgetti +.TH KNOCKER 1 "MAY 24, 2002" +.SH NAME +knocker \- An easy to use network security port scanner +.SH SYNOPSIS +.B \fBknocker\fR --host +[\fIOPTION\fR] +.SH DESCRIPTION +.B knocker +is a simple and easy to use TCP security port scanner written in C using pthreads +which is able to analyze hosts and all of the different services started on +them. +.SH OPTIONS +.TP +\fB\-H\fr, \fB\-\-host\fR +host name or numeric Internet address to scan +.TP +\fB\-P\fr, \fB\-\-port\fR +port number to scan (single port scan only) +.TP +\fB\-SP\fr, \fB\-\-start-port\fR +port number to begin the scan from +.TP +\fB\-EP\fr, \fB\-\-end-port\fR +port number to end the scan at +.TP +\fB\-4\fr, \fB\-\-ipv4\fR +only IPv4 addressing (default is first address available) +.TP +\fB\-6\fr, \fB\-\-ipv6\fR +use only IPv6 addressing +.TP +\fB\-\-last-host\fR +uses the last scanned host as target +.TP +\fB\-\-last-scan\fR +performs again the last port scan +.TP +\fB\-q\fr, \fB\-\-quiet\fR +disable console output and logs to file. +.TP +\fB\-lf\fr, \fB\-\-logfile \fR +log the results to a specified file. +.TP +\fB\-nf\fr, \fB\-\-no-fency\fR +disable fency output +.TP +\fB\-nc\fr, \fB\-\-no-colors\fR +disable colored output +.TP +\fB\-\-configure\fR +let the user configure knocker +.TP +\fB\-h\fR, \fB\-\-help\fR +display this help and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +output version information and exit +.SH EXAMPLES +.LP +To run this program the standard way type: +.LP +knocker --host 192.168.0.1 +.LP +If you want to specify a port range to scan: +.LP +knocker --host thehost --start-port 1 --end-port 2600 +.LP +or +.LP +knocker -H thehost -SP 1 -EP 2600 +.LP +To scan a single port: +.LP +knocker -H thehost --port 21 +.LP +To run this program not using colors (if your terminal does not support colors): +.LP +knocker --host 192.168.0.1 --no-colors +.LP +To run this program run in background and have the results written in a log file: +.LP +knocker --host 192.168.0.1 --quiet & +.LP +.LP +.SH AVAILABILITY +The latest version of this program can be found at +http://knocker.sourceforge.net +.SH BUGS +See the BUGS file in the knocker source package for a list of known bugs. +Report bugs to +.SH AUTHOR +knocker is written by Gabriele Giorgetti +.SH COPYRIGHT +Copyright \(co 2001,2002 Gabriele Giorgetti +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --- knocker-0.7.1.orig/debian/compat +++ knocker-0.7.1/debian/compat @@ -0,0 +1 @@ +9 --- knocker-0.7.1.orig/src/knocker_user.c +++ knocker-0.7.1/src/knocker_user.c @@ -82,7 +82,7 @@ _dir_create (user->dir); } - if (knocker_user_is_root) + if (knocker_user_is_root()) user->super = 1; else user->super = 0; --- knocker-0.7.1.orig/src/knocker_args.h +++ knocker-0.7.1/src/knocker_args.h @@ -33,6 +33,12 @@ /* host to scan, got with lasthost */ #define LAST_HOST_LONG_OPT "--last-host" + /* preferred address family for hosts */ +#define HOST_IPV4_SHORT_OPT "-4" +#define HOST_IPV4_LONG_OPT "--ipv4" +#define HOST_IPV6_SHORT_OPT "-6" +#define HOST_IPV6_LONG_OPT "--ipv6" + /* single port number */ #define SINGLE_PORT_SHORT_OPT "-P" #define SINGLE_PORT_LONG_OPT "--port" @@ -82,6 +88,7 @@ char *hname; /* hostname string */ char *hip; /* host IP string */ char *lfname; /* logfile name */ + int hfamily; /* desired address domain */ unsigned int port; /* Single port number, -P */ unsigned int sport; /* Start port number, -SP */ unsigned int eport; /* End port number, -EP */ --- knocker-0.7.1.orig/src/knocker_core.c +++ knocker-0.7.1/src/knocker_core.c @@ -33,13 +33,13 @@ static int knocker_core_init_socket_data (knocker_core_socket_t * sock); static void knocker_core_free_socket_data (knocker_core_socket_t * sock); -static int knocker_core_open_socket (knocker_core_socket_t * sock, int protocol); +static int knocker_core_open_socket (knocker_core_socket_t * sock, int family, int protocol); static void knocker_core_close_socket (knocker_core_socket_t * sock); static int knocker_core_init_host_data (knocker_core_host_t * host); static void knocker_core_free_host_data (knocker_core_host_t * host); -static int knocker_core_gethostbyname (knocker_core_host_t * hinfo, const char *hostname); +static int knocker_core_gethostbyname (knocker_core_host_t * hinfo, const char *hostname, int family); static int knocker_core_getservbyport (char *service, unsigned int port, int protocol); static char *knocker_core_get_host_name_string (knocker_core_host_t * hinfo); @@ -364,7 +364,7 @@ fprintf (stderr, "debug: connecting to port: %d\n", port); #endif - if (knocker_core_open_socket (&data->socket, PROTO_TCP) == KNOCKER_SOCKET_ERROR) + if (knocker_core_open_socket (&data->socket, data->host.hostaddr.ss_family, PROTO_TCP) == KNOCKER_SOCKET_ERROR) { #ifdef DEBUG fprintf (stderr, "debug: socket error, couldn't connect.\n"); @@ -372,12 +372,16 @@ return -1; } - data->host.sockaddr_in.sin_family = AF_INET; - data->host.sockaddr_in.sin_port = htons (port); - data->host.sockaddr_in.sin_addr = *((struct in_addr *) data->host.info->h_addr); - memset (&(data->host.sockaddr_in.sin_zero), 0, 8); + memcpy (&(data->host.sockaddr_st), &(data->host.hostaddr), data->host.addrlen); + switch (data->host.hostaddr.ss_family) { + case AF_INET6: + ((struct sockaddr_in6 *) &(data->host.sockaddr_st))->sin6_port = htons (port); + case AF_INET: + default: + ((struct sockaddr_in *) &(data->host.sockaddr_st))->sin_port = htons (port); + } - if (!connect (data->socket.fd, (struct sockaddr *) &data->host.sockaddr_in, sizeof (struct sockaddr))) + if (!connect (data->socket.fd, (struct sockaddr *) &data->host.sockaddr_st, data->host.addrlen)) /* here the port is open */ { knocker_core_close_socket (&data->socket); @@ -401,9 +405,9 @@ ============================================================================ ============================================================================ */ -char *knocker_core_resolve_host (knocker_core_portscan_data_t * data, const char *hostname) +char *knocker_core_resolve_host (knocker_core_portscan_data_t * data, const char *hostname, int family) { - if (knocker_core_gethostbyname (&data->host, hostname) == -1) + if (knocker_core_gethostbyname (&data->host, hostname, family) == -1) return NULL; else return (data->host.ip); @@ -506,14 +510,14 @@ ============================================================================ ============================================================================ */ -static int knocker_core_open_socket (knocker_core_socket_t * sock, int protocol) +static int knocker_core_open_socket (knocker_core_socket_t * sock, int family, int protocol) { #ifdef DEBUG fprintf (stderr, "debug: function knocker_core_open_socket (...) called.\n"); #endif if (protocol == PROTO_TCP) { - if ((sock->fd = socket (AF_INET, SOCK_STREAM, 0)) == KNOCKER_SOCKET_ERROR) + if ((sock->fd = socket (family, SOCK_STREAM, 0)) == KNOCKER_SOCKET_ERROR) { #ifdef DEBUG fprintf (stderr, "debug: couldn't open the socket: "); @@ -524,7 +528,7 @@ } else if (protocol == PROTO_UDP) { - if ((sock->fd = socket (AF_INET, SOCK_DGRAM, 0)) == KNOCKER_SOCKET_ERROR) + if ((sock->fd = socket (family, SOCK_DGRAM, 0)) == KNOCKER_SOCKET_ERROR) { #ifdef DEBUG fprintf (stderr, "debug: couldn't open the socket: "); @@ -579,13 +583,47 @@ ============================================================================ ============================================================================ */ -static int knocker_core_gethostbyname (knocker_core_host_t * hinfo, const char *hostname) +static int knocker_core_gethostbyname (knocker_core_host_t * hinfo, const char *hostname, int family) { - if ((hinfo->info = gethostbyname (hostname)) == NULL) + struct addrinfo hints, *res, *ai; + char hostip[INET6_ADDRSTRLEN]; + int err, fd; + + memset (&hints, 0, sizeof (hints)); + hints.ai_family = family; + hints.ai_flags = AI_ADDRCONFIG; + + if ( (err = getaddrinfo (hostname, NULL, &hints, &res)) ) { +#ifdef DEBUG + fprintf (stderr, "debug: knocker_core_gethostbyname(): %s", gai_strerror(err)); +#endif + return -1; + } + + for (ai = res; ai; ai = ai->ai_next) { + if ( (ai->ai_family != AF_INET) && (ai->ai_family != AF_INET6) ) + continue; + + fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + if (fd < 0) + continue; + /* Valid socket indicates a functional address; accept it. */ + close (fd); + hinfo->addrlen = ai->ai_addrlen; + memcpy(&(hinfo->hostaddr), ai->ai_addr, ai->ai_addrlen); + break; + } + + if (res) + freeaddrinfo(res); + + if (ai == NULL) return -1; knocker_core_set_host_name_string (hinfo, hostname); - knocker_core_set_host_ip_string (hinfo, inet_ntoa (*(struct in_addr *) *hinfo->info->h_addr_list)); + getnameinfo ((struct sockaddr *) &(hinfo->hostaddr), hinfo->addrlen, + hostip, sizeof (hostip), NULL, 0, NI_NUMERICHOST); + knocker_core_set_host_ip_string (hinfo, hostip); return 0; } --- knocker-0.7.1.orig/src/knocker_conf.c +++ knocker-0.7.1/src/knocker_conf.c @@ -223,6 +223,8 @@ { char *tmpp = malloc (strlen (line)); char *p = malloc (strlen (line)); + char *tmpp_orig = tmpp; + char *p_orig = p; /* Check if the option is present in the line */ tmpp = strstr (line, opt); @@ -234,7 +236,7 @@ if (!_isblank (*tmpp) || *tmpp != KNOCKER_OPTION_TOKEN) { - free (tmpp); + free (tmpp_orig); return 0; } @@ -247,8 +249,7 @@ strcpy (value, p); - /* free(p); this cause knocker to segfault */ - /* well I have to know why... */ + free(p_orig); return 1; } --- knocker-0.7.1.orig/src/knocker_core.h +++ knocker-0.7.1/src/knocker_core.h @@ -135,8 +135,9 @@ */ typedef struct { - struct hostent *info; /* hostent structure */ - struct sockaddr_in sockaddr_in; /* sockaddr_in structure */ + struct sockaddr_storage hostaddr; /* template address */ + socklen_t addrlen; /* active length */ + struct sockaddr_storage sockaddr_st; /* working address */ char *name; /* hostname string */ char *ip; /* host IP address string */ } knocker_core_host_t; @@ -185,7 +186,7 @@ int knocker_core_validate_port_number (unsigned int port); /* returns host ip address on success, NULL on failure */ -char *knocker_core_resolve_host (knocker_core_portscan_data_t *data, const char *hostname); +char *knocker_core_resolve_host (knocker_core_portscan_data_t *data, const char *hostname, int family); /* return the hostname string from the structure */ char *knocker_core_get_hostname (knocker_core_portscan_data_t *data); @@ -203,13 +204,13 @@ static int knocker_core_init_socket_data (knocker_core_socket_t *sock); static void knocker_core_free_socket_data (knocker_core_socket_t *sock); -static int knocker_core_open_socket (knocker_core_socket_t *sock, int protocol); +static int knocker_core_open_socket (knocker_core_socket_t *sock, int family, int protocol); static void knocker_core_close_socket (knocker_core_socket_t *sock); static int knocker_core_init_host_data (knocker_core_host_t *host); static void knocker_core_free_host_data (knocker_core_host_t *host); -static int knocker_core_gethostbyname (knocker_core_host_t *hinfo, const char *hostname); +static int knocker_core_gethostbyname (knocker_core_host_t *hinfo, const char *hostname, int family); static int knocker_core_getservbyport (char *service, unsigned int port, int protocol); static char *knocker_core_get_host_name_string (knocker_core_host_t *hinfo); --- knocker-0.7.1.orig/src/knocker_args.c +++ knocker-0.7.1/src/knocker_args.c @@ -80,9 +80,11 @@ fprintf (stdout, " %s performs again the last port scan\n", LAST_SCAN_LONG_OPT); fprintf (stdout, "\n"); fprintf (stdout, "Extra options:\n"); + fprintf (stdout, " %s, %s only IPv4 host addressing\n", HOST_IPV4_SHORT_OPT, HOST_IPV4_LONG_OPT); + fprintf (stdout, " %s, %s only IPv6 host addressing\n", HOST_IPV6_SHORT_OPT, HOST_IPV6_LONG_OPT); fprintf (stdout, " %s, %s quiet mode (no console output, logs to file)\n", QUIET_MODE_SHORT_OPT, QUIET_MODE_LONG_OPT); fprintf (stdout, " %s, %s log scan results to the specified file\n", ENABLE_LOGFILE_SHORT_OPT, ENABLE_LOGFILE_LONG_OPT); - fprintf (stdout, " %s, %s disable fency output\n", NO_FENCY_SHORT_OPT, NO_FENCY_LONG_OPT); + fprintf (stdout, " %s, %s disable fancy output\n", NO_FENCY_SHORT_OPT, NO_FENCY_LONG_OPT); fprintf (stdout, " %s, %s disable colored output\n", NO_COLORS_SHORT_OPT, NO_COLORS_LONG_OPT); fprintf (stdout, "\n"); fprintf (stdout, " %s let you configure %s\n", CONFIGURE_LONG_OPT, PACKAGE); @@ -105,6 +107,7 @@ args->hname = NULL; args->hip = NULL; args->lfname = NULL; + args->hfamily = AF_UNSPEC; args->port = 0; args->sport = 0; args->eport = 0; @@ -189,6 +192,16 @@ } return (0); /* we should have all arguments here */ } + else if ((!strcmp (argv[i], HOST_IPV4_SHORT_OPT)) || (!strcmp (argv[i], HOST_IPV4_LONG_OPT))) + { + /* Accept only IPv4 addressing. */ + args->hfamily = AF_INET; + } + else if ((!strcmp (argv[i], HOST_IPV6_SHORT_OPT)) || (!strcmp (argv[i], HOST_IPV6_LONG_OPT))) + { + /* Accept only IPv6 addressing. */ + args->hfamily = AF_INET6; + } else if ((!strcmp (argv[i], NO_FENCY_SHORT_OPT)) || (!strcmp (argv[i], NO_FENCY_LONG_OPT))) { /* Disable fency output */ --- knocker-0.7.1.orig/src/knocker_main.c +++ knocker-0.7.1/src/knocker_main.c @@ -67,12 +67,12 @@ knocker_args_init (&knocker_args, FALSE, FALSE, TRUE); - knocker_args_parse (&knocker_args, argc, argv); - if (knocker_conf_parse () < 0) /* write a default conf file for the user if it is not already there. */ knocker_conf_write_default (); + knocker_args_parse (&knocker_args, argc, argv); + knocker_core_init_portscan_data (&pscan_data); if (knocker_args.fency) @@ -132,7 +132,7 @@ */ static void resolve (void) { - if (knocker_core_resolve_host (&pscan_data, knocker_args.hname) == NULL) + if (knocker_core_resolve_host (&pscan_data, knocker_args.hname, knocker_args.hfamily) == NULL) { knocker_output_resolve_error (knocker_args.hname); knocker_log_resolve_error (knocker_args.hname);