MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / getPasswordPrompt

Function getPasswordPrompt

Extension/src/SSH/commandInteractors.ts:202–218  ·  view source on GitHub ↗

* Matches SSH password prompt of format: * 's password: * or * Password: * not * 's old password: * 's new password:

(data: string, details?: IInteractorDataDetails)

Source from the content-addressed store, hash-verified

200 * 's new password:
201 */
202function 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
220export class PasswordInteractor implements IInteractor {
221 static ID = 'password';

Callers 1

onDataMethod · 0.85

Calls 1

stripEscapeSequencesFunction · 0.90

Tested by

no test coverage detected