Update users.js
use SessionId for windows tty
This commit is contained in:
parent
6d7d23185f
commit
4361fb23a7
@ -293,7 +293,7 @@ function users(callback) {
|
|||||||
// ).then(data => {
|
// ).then(data => {
|
||||||
let cmd = 'Get-WmiObject Win32_LogonSession | fl *' + '; echo \'#-#-#-#\';';
|
let cmd = 'Get-WmiObject Win32_LogonSession | fl *' + '; echo \'#-#-#-#\';';
|
||||||
cmd += 'Get-WmiObject Win32_LoggedOnUser | fl *' + '; echo \'#-#-#-#\';';
|
cmd += 'Get-WmiObject Win32_LoggedOnUser | fl *' + '; echo \'#-#-#-#\';';
|
||||||
cmd += 'Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl';
|
cmd += 'Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="sessionid";Expression={$_.SessionId}}, @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl';
|
||||||
util.powerShell(cmd).then(data => {
|
util.powerShell(cmd).then(data => {
|
||||||
// controller + vram
|
// controller + vram
|
||||||
// let accounts = parseWinAccounts(data[0].split(/\n\s*\n/));
|
// let accounts = parseWinAccounts(data[0].split(/\n\s*\n/));
|
||||||
@ -319,7 +319,7 @@ function users(callback) {
|
|||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
user: user.user,
|
user: user.user,
|
||||||
tty: '',
|
tty: user.tty,
|
||||||
date: `${dateTime.substr(0, 4)}-${dateTime.substr(4, 2)}-${dateTime.substr(6, 2)}`,
|
date: `${dateTime.substr(0, 4)}-${dateTime.substr(4, 2)}-${dateTime.substr(6, 2)}`,
|
||||||
time: `${dateTime.substr(8, 2)}:${dateTime.substr(10, 2)}`,
|
time: `${dateTime.substr(8, 2)}:${dateTime.substr(10, 2)}`,
|
||||||
ip: '',
|
ip: '',
|
||||||
@ -387,10 +387,13 @@ function parseWinUsers(userParts) {
|
|||||||
|
|
||||||
const domain = util.getValue(lines, 'domain', ':', true);
|
const domain = util.getValue(lines, 'domain', ':', true);
|
||||||
const username = util.getValue(lines, 'username', ':', true);
|
const username = util.getValue(lines, 'username', ':', true);
|
||||||
|
const sessionid = util.getValue(lines, 'sessionid', ':', true);
|
||||||
|
|
||||||
if (username) {
|
if (username) {
|
||||||
users.push({
|
users.push({
|
||||||
domain,
|
domain,
|
||||||
user: username
|
user: username,
|
||||||
|
tty: sessionid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user