예제 #1
0
파일: hosts.go 프로젝트: ElricleNecro/TOD
// A function which displays hosts and the number of commands they have executed.
func (hosts *Hosts) DisplayHostsCommands() {

	// counter
	counter := 0

	// loop over hosts
	for _, host := range hosts.Hosts {

		// display hostname
		formatter.ColoredPrint(
			formatter.Magenta,
			false,
			host.Hostname, ": ",
		)

		// display the number of command executed with different
		// colors in case of a disconnected host
		if host.Connected {
			formatter.ColoredPrintln(
				formatter.Green,
				false,
				host.CommandNumber, "/", len(host.Commands),
			)
			counter += host.CommandNumber
		} else {
			formatter.ColoredPrintln(
				formatter.Red,
				false,
				host.CommandNumber-1, "/", len(host.Commands),
			)
			counter += host.CommandNumber - 1
		}
	}

	// display the total number to check coherence
	formatter.ColoredPrintln(
		formatter.Magenta,
		false,
		"Total of commands:", counter,
	)

}
예제 #2
0
파일: hosts.go 프로젝트: ElricleNecro/TOD
// A function to return the remaining commands if the number of hosts
// available is zero
func displayRemainingCommands(commands []commands.Command) {

	// Display message
	formatter.ColoredPrint(
		formatter.Magenta,
		false,
		"The list of not runned commands is:\n",
	)

	// loop over commands
	for _, command := range commands {

		// Display the command
		formatter.ColoredPrintln(
			formatter.Red,
			false,
			command.Command,
		)
	}
}