forked from p15670423/monkey
island: Fix secure file creation on Windows
This commit is contained in:
parent
c0d9489100
commit
37eda4e7ad
|
@ -9,6 +9,7 @@ def is_windows_os() -> bool:
|
||||||
|
|
||||||
if is_windows_os():
|
if is_windows_os():
|
||||||
import win32file
|
import win32file
|
||||||
|
import win32job
|
||||||
import win32security
|
import win32security
|
||||||
|
|
||||||
import monkey_island.cc.environment.windows_permissions as windows_permissions
|
import monkey_island.cc.environment.windows_permissions as windows_permissions
|
||||||
|
@ -83,13 +84,15 @@ def _create_secure_file_windows(path: str):
|
||||||
file_attributes = win32file.FILE_ATTRIBUTE_NORMAL
|
file_attributes = win32file.FILE_ATTRIBUTE_NORMAL
|
||||||
|
|
||||||
with win32file.CreateFile(
|
with win32file.CreateFile(
|
||||||
fileName=path,
|
path,
|
||||||
desiredAccess=file_access,
|
file_access,
|
||||||
shareMode=file_sharing,
|
file_sharing,
|
||||||
attributes=security_attributes,
|
security_attributes,
|
||||||
CreationDisposition=file_creation,
|
file_creation,
|
||||||
flagsAndAttributes=file_attributes,
|
file_attributes,
|
||||||
hTemplateFile=win32file.NULL,
|
win32job.CreateJobObject(
|
||||||
|
None, ""
|
||||||
|
), # https://stackoverflow.com/questions/46800142/in-python-with-pywin32-win32job-the-createjobobject-function-how-do-i-pass-nu # noqa: E501
|
||||||
) as x: # noqa: F841
|
) as x: # noqa: F841
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue