Closed Jamous closed 2 months ago
hah, you win the first person to run into this in go :) (much less annoying to tweak in python flavor!).
yea we should add this to the platform definition but I think we already support ya tweaking it with this guy. can ya give that a whack to see if it gets ya rollin?
hah, you win the first person to run into this in go :) (much less annoying to tweak in python flavor!).
yea we should add this to the platform definition but I think we already support ya tweaking it with this guy. can ya give that a whack to see if it gets ya rollin?
That works perfectly! Thank you, and thanks for your work on this awesome project!
My updated code.
//Scrapli code
passPattern := regexp.MustCompile(`:$`) //Regex match for password pattern
p, err := platform.NewPlatform(
//Custom platform
"fs_s2805",
host.Address,
options.WithAuthNoStrictKey(),
options.WithAuthUsername(host.Username),
options.WithAuthPassword(host.Password),
options.WithTransportType("system"), //Uses /bin/ssh wrapper https://github.com/scrapli/scrapligo/blob/main/driver/options/generic.go#L14
options.WithSSHConfigFile("~/.ssh/config"), //Specifies ssh config file https://github.com/scrapli/scrapligo/issues/77
options.WithPasswordPattern(passPattern), //Specifies custom regex for password prompt https://github.com/scrapli/scrapligo/issues/193
)
boom! thanks for confirming and sharing the final solution! 🤘
I am working with a network switch, FS 2805s, with a non standard login prompt. See example of the login prompt below:
When trying to connect to this device using Scrapligo, I get this error:
errTimeoutError: channel timeout during in channel ssh authentication
After looking a little bit I believe this is because Scrapli is trying to match the login prompt using this regex pattern
(?im)(.*@.*)?password:\s?$
which is in channel/auth.go getAuthPatterns(). This regex pattern does not match the password prompt for this platform. If I manually change this pattern to:$
I can log into this device.Could we add in an option to pass our own regex patterns to getAuthPatterns (possibly via a custom platform yaml file)?
My code (for reference):
My fs_s2805s platform
My modified getAuthPatterns() function