PLUSHS(1)

NAME
PluSHS - Pluf Simple Hostname Scanner

SYNOPSIS
plushs [-acDhmTv] [-f format] [-l ip-file] [-o logfile] [-P plugin-id/ids] [-s pattern] [-t timeout] [-w wait] [-x patterns-file] ip-address or ip-address-range

DESCRIPTION
Plushs is a network analisis tool, which allows a user to resolve the names of a single IP address or entire network of addresses to maintain a "map" of the names that comprise a certain network.

OPTIONS

-a  Show hostname aliasses.

-c  Turn off color of some messages.

-D  Run Plushs in daemon mode.

-f format
    Execute format string when a pattern match is found. Format must be a valid comand. Plushs has eight macros that you can use as part of format string:

    %s insert space.

    %n insert newline.

    %t insert tab.

    %i insert ip address.

    %s insert hostname.

    %c insert double quotes.

    %T insert total ip addresses.

    %d exec program in background mode.

-h  Show this information.

-l ip-file
    Get ip address or ip addresses range from file ip-file.

-m  Logs the output information to multiples files, use only with -l option.

-o logfilename
    This logs the result of the scans into the file logfilename.

-P plugin-id/ids
    Plushs has support for plugins so you can use this option to run one or some plugins for each ip address. Each plugin has a pid (plugin identifier), if you want specify more than one pid to run you must separate each pid with a coma ',' and end the list with another coma (Example: -P 1,2,3,). To display the plugins list use -P list, that display a table with all plugins available (their pid and name/info). If you want to make a plugin for plushs you find more info in MAKE PLUGINS section.

-t timeout
    Set timeout for each hostname search, if the search exceeds timeout plushs will jump to the next search. The default timeout value for timeout is nine seconds.

-T  Sets the option to send all queries to the name server using TCP sockets and to retain the connection after each call to gethostbyaddr(). UDP sockets will be use by default.

-v  Verbose mode

-w wait
    Wait wait seconds between each hostname search. The default is to wait cero seconds between each search.

-s pattern
    Search in the hostname the first occurrence of the string pattern, if successfuly log the hostname into the patterns logfile called "patterns".

-x patterns-file
    Search in the hostname the first occurrence of the patterns extracted from file patterns-file, if successfuly log the hostname into the patterns logfile called "patterns".

MAKE PLUGINS
This section explain how to make your own plugin for plushs, you must following the next steps:

  Step 1: Some info
Location of the plugin will be the plugins directory, into plugins directoy you need create a new directory (you should name this new directory as plugin name) and put there the plugin.

  Step 2: The Makefile.in
Once you have coded the plugin you need a Makefile.in file, this must have the following:

    prefix = @prefix@
    exec_prefix = @exec_prefix@
    VPATH= @srcdir@/
    SRCDIR= @srcdir@
    CC= @CC@
    CFLAGS= -Wall @CFLAGS@ -I. -I$(SRCDIR)
    PROG= your_plugin_name
    all: $(PROG)
    $(PROG):
    	$(CC) $(CFLAGS) -c $(VPATH)$(PROG).c
    clean:
    	rm -f *.o
    distclean:
    	rm -f Makefile

  Step 3: Add new info
You need to add the following into the plugin:

    #include "../../plugins.h"

The plugin function prototype must be like this one:

    int my_plugin_name(ip)
    	char *ip;
    {
     ...
    }

You need to add the plugin function prototype into plugins.h header file, something like this:

    int my_plugin_name(char*);

Also you need to add an new entry (pid, plugin info and plugin name) for your plugin into plist.h header file, something like this:

    struct plugins_list plist[] = {
    	{ 1, 0, "Plugin 1 info", plugin1},
    	{ 2, 0, "Plugin 2 info", plugin2},
    	...
    	{ n, 0, "your plugin info", your_plugin_name},
    	{ 0, 0, "", NULL}
    }

  Step 4: Predefined functions
There are two predefined functions that you can use with plugins, the functions are the following:

    int
    pbanner(int pid, char *pname)

    int
    pmessage(char *message)

The pbanner() function display information about the plugin that is going to run: pid and plugin name. Where pid s the plugin indetifier and pname is the plugin name.

The pmessage() funtion is a printf wrapper.

  Dummy plugin
If you have any problem making plugins you can look at dummy plugin because its very simple. I think you should check dummy plugin before make your own plugin and maybe you won't to need read this section.

EXAMPLES
- Search the hostname of the following ip address: plushs 192.168.1.1 - Scan a whole C class network: plushs 192.168.1.1-255 - Scan a whole C class network and get alternate names for each ip address: plushs -a 192.168.1.1-255 - Search in the hostname the first occurrence of the string "cache". We use verbose mode: plushs -av -s cache 192.168.1.1-255 - Search in the hostname the first occurrence of the patterns extracted from file "pat_list" also we log the results into the file log: plushs -v -x pat_list -o log 192.168.1.1-255 - Scan an ip address or an ip addresses range extracted from file "ip_list" and log results. We run plushs in daemon mode: plushs -va -D -l ip_list -o log - Scan the following ip addresses range: 192.168.10-20.1-40. We want to run nmap when the pattern "server" is found also we won't use colour support: plushs -va -c -s "server" -f "nmap%s-O%s%h" 192.168.10-20.1-40 - Scan the following ip addresses range: 192.168-169.1.1-100. We want to run traceroute whe the pattern "router" is found also we use plugins with pid 2, 3 and 6 (that you have been coded) and log results into the file "information": plushs -va -s "router" -f "traceroute%s%i" -P 2,3,6, -o information 192.168-169.1.1-100

SEE ALSO
gethostbyaddr(3), sethostent(3)

AUTHOR
pluf <pluf@wanadoo.es>

BUGS
Send bugs reports to pluf@wanadoo.es