tbotnz / cisshgo

simple concurrent ssh server posing as cisco ios
131 stars 26 forks source link

fixes #2: allowing for dynamic output/templating in transcripts #15

Closed lykinsbd closed 4 years ago

lykinsbd commented 4 years ago

This Commit will introduce template support into the command transcripts. This is done via the Golang text/template library.

For example, in the packaged output of show_version.txt the hostname is listed as:

ROM: IOS-XE ROMMON
{{.Hostname}} uptime is 4 hours, 55 minutes
Uptime for this control processor is 4 hours, 56 minutes

Any value in the fakedevices.FakeDevice struct can be referenced in this way, today these are:

type FakeDevice struct {
    Vendor            string            // Vendor of this fake device
    Platform          string            // Platform of this fake device
    Hostname          string            // Hostname of the fake device
    Password          string            // Password of the fake device
    SupportedCommands SupportedCommands // What commands this fake device supports
    ContextSearch     map[string]string // The available CLI prompt/contexts on this fake device
    ContextHierarchy  map[string]string // The heiarchy of the available contexts
}

Let me know if you have any questions!

-Brett