Skip to content
/ kornet Public

A library for mass execution of ssh commands on remote machines fleet

License

Notifications You must be signed in to change notification settings

subatiq/kornet

Repository files navigation

GitHub release (latest by date) PyPI GitHub Gitlab code coverage Code style


A library for mass execution of ssh commands on remote machines fleet.

More docs: https://subatiq.github.io/kornet/

Installation

pip install kornet

Usage examples

Run multiple commands

kornet run <strategy_file.yml> <fleet_file.yml> <group>

strategy file - yaml strategy file described above

fleet file - yaml fleet file described above

group - group to run the strategy on

$ kornet run strategy.yml fleet.yml office

...
Lots of output with results
...

Fast machine recon

$ kornet recon CPU user@192.168.0.2 --port 5022

Results:
cpu:
  arch: x86_64
  cores: 8
  model: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz

Hosts file format

You need to specify hosts and their groups. Groups so far can store only simple SSH configurations (username, password and port). Each host can override these values by specifying certain fields.

hosts:
- ip: 192.168.0.2
  groups: 
  - office
- ip: 192.168.0.3
  ssh:
    username: user  # overrides group value
  groups:
  - office

groups:
  office:
    ssh:
      username: root
      password: toor
      port: 22

Strategy file format

Strategy is a set of orders to execute via SSH. The format is pretty simple:

recon:
- CPU
- OS

orders:
- name: List all directories
  command: ls

- name: Current path
  command: pwd

recon field is responsible for specifing steps of gathering information about the target host.

orders is a list of commands that need to be executed on the target host.