MCPcopy Create free account
hub / github.com/secdev/scapy / _check_perms

Function _check_perms

scapy/main.py:112–129  ·  view source on GitHub ↗

Checks that the permissions of a file are properly user-specific, if sudo is used.

(file: Union[pathlib.Path, str])

Source from the content-addressed store, hash-verified

110
111
112def _check_perms(file: Union[pathlib.Path, str]) -> None:
113 """
114 Checks that the permissions of a file are properly user-specific, if sudo is used.
115 """
116 if (
117 not WINDOWS and
118 "SUDO_UID" in os.environ and
119 "SUDO_GID" in os.environ
120 ):
121 # Was started with sudo. Still, chown to the user.
122 try:
123 os.chown(
124 file,
125 int(os.environ["SUDO_UID"]),
126 int(os.environ["SUDO_GID"]),
127 )
128 except Exception:
129 pass
130
131
132def _read_config_file(cf, _globals=globals(), _locals=locals(),

Callers 3

_read_config_fileFunction · 0.85
_add_bash_autocompletionFunction · 0.85
interactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…