You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
python version Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) 32-bit Terminal server
Bug description
Python with elevated privileges
>>> import psutil
>>> for p in psutil.process_iter(ad_value=''): print(p.username())
NT AUTHORITY\SYSTEM
NT AUTHORITY\SYSTEM
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\adm\AppData\Roaming\Python\Python38\site-packages\psutil\__init__.py", line 715, in username
return self._proc.username()
File "C:\Users\adm\AppData\Roaming\Python\Python38\site-packages\psutil\_pswindows.py", line 681, in wrapper
raise convert_oserror(err, pid=self.pid, name=self._name)
File "C:\Users\adm\AppData\Roaming\Python\Python38\site-packages\psutil\_pswindows.py", line 671, in convert_oserror
raise exc
File "C:\Users\adm\AppData\Roaming\Python\Python38\site-packages\psutil\_pswindows.py", line 679, in wrapper
return fun(self, *args, **kwargs)
File "C:\Users\adm\AppData\Roaming\Python\Python38\site-packages\psutil\_pswindows.py", line 926, in username
domain, user = cext.proc_username(self.pid)
OSError: [WinError 1332] No Mapping between account names and Security Id was done: '(originated from LookupAccountSidW)'
These bad processes are 'dwm.exe' of non-admin remote desktop users.
It can be monkey patched like that, in _pswindows.py:
try:
domain, user = cext.proc_username(self.pid)
except OSError:
domain, user = '-', '-'
The text was updated successfully, but these errors were encountered:
Windows Sever 2012 R2 Standard
Terminal server
Bug description
Python with elevated privileges
These bad processes are 'dwm.exe' of non-admin remote desktop users.
It can be monkey patched like that, in _pswindows.py:
The text was updated successfully, but these errors were encountered: