Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
/ getrun Public archive

A golang program to retrieve Running Configuration from Cisco IOS devices + Deprecated Kex and Ciphers

License

Notifications You must be signed in to change notification settings

varugasu/getrun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get Running Configuration from Cisco IOS

This code works at best effort; therefore, the SSH client tries to connect to servers even with not recommended Kex and Ciphers:

DIAL:
	conn, err = ssh.Dial("tcp", addr, sshConfig)
	if err != nil {
		m := regexp.MustCompile(`server offered: \[(.*)\]`)

		errString := err.Error()
		if strings.Contains(errString, "key exchange") {
			sshConfig.Config.KeyExchanges = strings.Split(m.FindStringSubmatch(errString)[1], " ")
			goto DIAL
		}
		if strings.Contains(errString, "server cipher") {
			sshConfig.Config.Ciphers = strings.Split(m.FindStringSubmatch(errString)[1], " ")
			goto DIAL
		}
		return nil, err
	}

goto had proved very useful in this case because it reduced the amount of code to handle all these exceptions.

Usage:

./getrun -t {target} -P {port} -u {username} -p {password}

About

A golang program to retrieve Running Configuration from Cisco IOS devices + Deprecated Kex and Ciphers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published