-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (21 loc) · 696 Bytes
/
index.js
File metadata and controls
21 lines (21 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const util_1 = require("util");
const exec = util_1.promisify(require('child_process').exec);
const appRoot = path.resolve(__dirname);
function buildCredential(credStr) {
const [username, password] = credStr.split(':');
return {
username,
password,
};
}
function getCredential(target, pythonLancher = 'python') {
const script = `${pythonLancher} ${appRoot}\\wincred.py ${target}`;
return exec(script)
.then(result => result.stdout.trim())
.then(buildCredential);
}
exports.getCredential = getCredential;
exports.default = getCredential;