Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/varugasu/getrun
A golang program to retrieve Running Configuration from Cisco IOS devices + Deprecated Kex and Ciphers
https://github.com/varugasu/getrun
go-ssh golang golang-network golang-ssh network ssh
Last synced: 1 day ago
JSON representation
A golang program to retrieve Running Configuration from Cisco IOS devices + Deprecated Kex and Ciphers
- Host: GitHub
- URL: https://github.com/varugasu/getrun
- Owner: varugasu
- License: mit
- Created: 2020-02-24T05:33:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T11:58:00.000Z (over 1 year ago)
- Last Synced: 2023-12-13T12:28:14.667Z (11 months ago)
- Topics: go-ssh, golang, golang-network, golang-ssh, network, ssh
- Language: Go
- Homepage:
- Size: 3.54 MB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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**:
```golang
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}
```