Skip to content

Andrey812/hostsmanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hostsmanager

About

The tool includes two applications:

Hostman. It is daemon. It works in background. It reads configuration file and sends command to the hosts according special rules, described there. All results, received from hosts will be recorded to the special files. Daemon was written on the C language.

GUI. This program was written on the Perl language with using GTK library. It reads configuration file and files which were generated by hostman daemon and show summary information in the table about each scanned host.

How to use it

Change to the root project directory

cd hostman

Execute make:

make

Execute hostman

./bin/hostman

See short help of the hostman

./bin/hostman -h

Configuration

Main configuration file named "hostman.cfg" by default.

It consists several sections:

  • SETTINGS - The section describes params and scanner work (pathes to the needed files, scan period, debug etc).
  • HOSTS - The section consists list of the hosts (list for scanning and commands sending)
  • RULES - The section describes commands for sending to the each host in the list and fields for the recording of the answers
  • HOST_INFO - This section for GUI. It describes how GUI should parse and show results.

All sections well documented with examples in the hostman.cfg file.

When hostman was executed it tries to find hostman.cfg file in the same directory from which it was executed. You can use key -c <path_to_the_config> for reassign hostman to the other configuration file.

Then hostman tries to lock pid file. Path to the pid file described to main configuration file. If path to the pid file was not described, it creates file "hostman.pid" in the execution directory.

Hostman daemon tries to create log file also. This file named "hostman.log" and will be created to the same directory by default. You can reassign path to the log file in the main configuration file.

Cycle of the daemon work: Daemon reads list of the hosts. It gets each host from the list and sends commands described to the rules section of the configuration file. It can ping host, get some info from remote host using ssh connection or execute local bash command and writes results to the special files named <host_id>.info where "host_id" is the number of the host in the host's list.

You can see execution of the each command and received answers in the log file when debug mode is enabled (use execution key -d or string DEBUG=1 in the configuration file).

"info" file for each host will be rewritten in the time of next daemon's iteration. All *.info files will be deleted when daemon executes again

Limitations

  • Daemon parses only first line of the answer from host
  • String of the answer from host length must be less than 256 chars
  • The list of the hosts up to 16 items
  • The list of the scanning rules up to 32 items
  • Scaner queries only 1 host per round (with 1 thread)

About

Tool for automatic scanning and arbitrary command execution by the list of hosts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published