* Matches SSH password prompt of format: * 's password: * or * Password: * not * 's old password: * 's new password:
(data: string, details?: IInteractorDataDetails)
| 200 | * 's new password: |
| 201 | */ |
| 202 | function getPasswordPrompt(data: string, details?: IInteractorDataDetails): { user?: string; message?: string } | undefined { |
| 203 | if (data.includes('Password:')) { |
| 204 | // Password prompt for unspecified user |
| 205 | return { user: '' }; |
| 206 | } |
| 207 | |
| 208 | // Got \r\r\n as a line ending here |
| 209 | const match: RegExpMatchArray | null = stripEscapeSequences(data).match(/([a-zA-Z0-9\-_@\.]*)'s password:/); |
| 210 | if (match) { |
| 211 | return { |
| 212 | user: match[1], |
| 213 | message: details ? details.detail : undefined |
| 214 | }; |
| 215 | } |
| 216 | |
| 217 | return undefined; |
| 218 | } |
| 219 | |
| 220 | export class PasswordInteractor implements IInteractor { |
| 221 | static ID = 'password'; |
no test coverage detected