From 32840ad8068bf584cd715e049f0a05e672fb2502 Mon Sep 17 00:00:00 2001 From: Gordiig Date: Sun, 1 Oct 2023 14:39:11 +0300 Subject: [PATCH 001/107] FIX: Getting right amount of data for search fix (#2281) * Getting right amount of data for search fix * Add line to CHANGELOG.md --- CHANGELOG.md | 3 ++- pwnlib/elf/elf.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c1a2071..eac87fc2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,8 +68,9 @@ The table below shows which release corresponds to each branch, and what date th | [2.2.0](#220) | | Jan 5, 2015 ## 4.13.0 (`dev`) +- [#2281][2281] FIX: Getting right amount of data for search fix - +[2281]: https://github.com/Gallopsled/pwntools/pull/2281 ## 4.12.0 (`beta`) - [#2202][2202] Fix `remote` and `listen` in sagemath diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index 96244af8f..4a2437206 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -1195,9 +1195,10 @@ def search(self, needle, writable = False, executable = False): for seg in segments: addr = seg.header.p_vaddr memsz = seg.header.p_memsz - zeroed = memsz - seg.header.p_filesz + filesz = seg.header.p_filesz + zeroed = memsz - filesz offset = seg.header.p_offset - data = self.mmap[offset:offset+memsz] + data = self.mmap[offset:offset+filesz] data += b'\x00' * zeroed offset = 0 while True: From 045b8c2186d042f7c682afe55f003d2cb36916db Mon Sep 17 00:00:00 2001 From: Gordiig Date: Sun, 1 Oct 2023 14:39:11 +0300 Subject: [PATCH 002/107] FIX: Getting right amount of data for search fix (#2281) --- CHANGELOG.md | 11 +++++++++-- pwnlib/elf/elf.py | 5 +++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c1a2071..d21ad85ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ The table below shows which release corresponds to each branch, and what date th | ---------------- | -------- | ---------------------- | | [4.13.0](#4130-dev) | `dev` | | [4.12.0](#4120-beta) | `beta` | -| [4.11.0](#4110-stable) | `stable` | Sep 15, 2023 +| [4.11.1](#4111-stable) | `stable` | +| [4.11.0](#4110) | | Sep 15, 2023 | [4.10.0](#4100) | | May 21, 2023 | [4.9.0](#490) | | Dec 29, 2022 | [4.8.0](#480) | | Apr 21, 2022 @@ -88,7 +89,13 @@ The table below shows which release corresponds to each branch, and what date th [2257]: https://github.com/Gallopsled/pwntools/pull/2257 [2225]: https://github.com/Gallopsled/pwntools/pull/2225 -## 4.11.0 (`stable`) +## 4.11.1 (`stable`) + +- [#2281][2281] FIX: Getting right amount of data for search fix + +[2281]: https://github.com/Gallopsled/pwntools/pull/2281 + +## 4.11.0 - [#2185][2185] make fmtstr module able to create payload without $ notation - [#2103][2103] Add search for libc binary by leaked function addresses `libcdb.search_by_symbol_offsets()` diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index 8bbf0b859..0fae91db1 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -1195,9 +1195,10 @@ def search(self, needle, writable = False, executable = False): for seg in segments: addr = seg.header.p_vaddr memsz = seg.header.p_memsz - zeroed = memsz - seg.header.p_filesz + filesz = seg.header.p_filesz + zeroed = memsz - filesz offset = seg.header.p_offset - data = self.mmap[offset:offset+memsz] + data = self.mmap[offset:offset+filesz] data += b'\x00' * zeroed offset = 0 while True: From 3ff37a8b7ef7e32ef219bd86790ed0130ba0c6a7 Mon Sep 17 00:00:00 2001 From: Tanix <56950803+TanixLu@users.noreply.github.com> Date: Sun, 29 Oct 2023 19:23:31 +0800 Subject: [PATCH 003/107] Fix _countdown_handler not invoking timeout_change; Fix value is value < 0 (#2287) --- pwnlib/timeout.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pwnlib/timeout.py b/pwnlib/timeout.py index a1a4859f8..8e21a2d09 100644 --- a/pwnlib/timeout.py +++ b/pwnlib/timeout.py @@ -30,9 +30,11 @@ def __enter__(self): self.obj._stop = min(self.obj._stop, self.old_stop) self.obj._timeout = self.timeout + self.obj.timeout_change() def __exit__(self, *a): self.obj._timeout = self.old_timeout self.obj._stop = self.old_stop + self.obj.timeout_change() class _local_handler(object): def __init__(self, obj, timeout): @@ -157,7 +159,7 @@ def _get_timeout_seconds(self, value): else: value = float(value) - if value is value < 0: + if value < 0: raise AttributeError("timeout: Timeout cannot be negative") if value > self.maximum: From dafd42b2c376e003ead70ba6ba458c4db42a7b98 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 29 Oct 2023 15:05:16 +0100 Subject: [PATCH 004/107] Fix tube.clean_and_log not logging buffered data (#2272) * Fix tube.clean_and_log not logging buffered data Only new data received after the `clean_and_log` call is printed while data already received and buffered earlier is not. Print the buffered data first before waiting for more so we don't miss anything. * Only show buffered data if DEBUG is off * Update CHANGELOG.md --------- Co-authored-by: Arusekk --- CHANGELOG.md | 2 ++ examples/clean_and_log.py | 30 ++++++++++++++++++------------ pwnlib/tubes/tube.py | 7 ++++++- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d21ad85ee..d74239b7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,8 +91,10 @@ The table below shows which release corresponds to each branch, and what date th ## 4.11.1 (`stable`) +- [#2272][2272] Fix `tube.clean_and_log` not logging buffered data - [#2281][2281] FIX: Getting right amount of data for search fix +[2272]: https://github.com/Gallopsled/pwntools/pull/2272 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 ## 4.11.0 diff --git a/examples/clean_and_log.py b/examples/clean_and_log.py index a307d76a2..5e5a2493c 100644 --- a/examples/clean_and_log.py +++ b/examples/clean_and_log.py @@ -11,18 +11,24 @@ """ from pwn import * +from multiprocessing import Process -os.system('''(( -echo prefix sometext ; -echo prefix someothertext ; -echo here comes the flag ; -echo LostInTheInterTubes -) | nc -l 1337) & -''') +def submit_data(): + with context.quiet: + with listen(1337) as io: + io.wait_for_connection() + io.sendline(b'prefix sometext') + io.sendline(b'prefix someothertext') + io.sendline(b'here comes the flag') + io.sendline(b'LostInTheInterTubes') -r = remote('localhost', 1337) -atexit.register(r.clean_and_log) +if __name__ == '__main__': + p = Process(target=submit_data) + p.start() -while True: - line = r.recvline() - print(re.findall(r'^prefix (\S+)$', line)[0]) + r = remote('localhost', 1337) + atexit.register(r.clean_and_log) + + while True: + line = r.recvline() + print(re.findall(br'^prefix (\S+)$', line)[0]) diff --git a/pwnlib/tubes/tube.py b/pwnlib/tubes/tube.py index 39a27d8ca..0e5e9dab1 100644 --- a/pwnlib/tubes/tube.py +++ b/pwnlib/tubes/tube.py @@ -1034,8 +1034,13 @@ def clean_and_log(self, timeout = 0.05): b'hooray_data' >>> context.clear() """ + cached_data = self.buffer.get() + if cached_data and not self.isEnabledFor(logging.DEBUG): + with context.local(log_level='debug'): + self.debug('Received %#x bytes:' % len(cached_data)) + self.maybe_hexdump(cached_data, level=logging.DEBUG) with context.local(log_level='debug'): - return self.clean(timeout) + return cached_data + self.clean(timeout) def connect_input(self, other): """connect_input(other) From 0c1121d32c4adbdcb2036c94fce0b9b7fe28c0ed Mon Sep 17 00:00:00 2001 From: Kexuan Shen <71251878+ksshen0000@users.noreply.github.com> Date: Sun, 29 Oct 2023 09:38:57 -0500 Subject: [PATCH 005/107] FIX: Generated shebang with path to python invalid if path contains spaces (#2285) * modify script shebang to accept path with white space * add changelog for 2271 --- CHANGELOG.md | 2 ++ pwnlib/util/misc.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d74239b7d..554b527d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,9 +91,11 @@ The table below shows which release corresponds to each branch, and what date th ## 4.11.1 (`stable`) +- [#2271][2271] FIX: Generated shebang with path to python invalid if path contains spaces - [#2272][2272] Fix `tube.clean_and_log` not logging buffered data - [#2281][2281] FIX: Getting right amount of data for search fix +[2271]: https://github.com/Gallopsled/pwntools/pull/2271 [2272]: https://github.com/Gallopsled/pwntools/pull/2272 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 7fbf479ca..32aa5351b 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -382,7 +382,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr import os os.execve({argv0!r}, {argv!r}, os.environ) ''' - script = script.format(executable=sys.executable, + script = script.format(executable='/bin/env ' * (' ' in sys.executable) + sys.executable, argv=command, argv0=which(command[0])) script = script.lstrip() From 64d52b09f322a9a40da7d5588e1a3a7410880e19 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Wed, 1 Nov 2023 23:26:43 +0100 Subject: [PATCH 006/107] shellcraft.aarch64: Fix atexit SEGV in loader (#2294) Fixes #2289 --- CHANGELOG.md | 2 ++ pwnlib/shellcraft/templates/aarch64/linux/loader.asm | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 554b527d4..722187878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,10 +94,12 @@ The table below shows which release corresponds to each branch, and what date th - [#2271][2271] FIX: Generated shebang with path to python invalid if path contains spaces - [#2272][2272] Fix `tube.clean_and_log` not logging buffered data - [#2281][2281] FIX: Getting right amount of data for search fix +- [#2294][2294] Fix atexit SEGV in aarch64 loader [2271]: https://github.com/Gallopsled/pwntools/pull/2271 [2272]: https://github.com/Gallopsled/pwntools/pull/2272 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 +[2294]: https://github.com/Gallopsled/pwntools/pull/2294 ## 4.11.0 diff --git a/pwnlib/shellcraft/templates/aarch64/linux/loader.asm b/pwnlib/shellcraft/templates/aarch64/linux/loader.asm index 7136aaedf..d6f23cd25 100644 --- a/pwnlib/shellcraft/templates/aarch64/linux/loader.asm +++ b/pwnlib/shellcraft/templates/aarch64/linux/loader.asm @@ -107,14 +107,14 @@ PT_LOAD = 1 mov x3, sp stp x2, x3, [sp, #-16]! - /* argc, argv[0], argv[1], envp */ + /* argc, argv[0], argv[1], envp; x0 must be zero! */ /* ideally these could all be empty, but unfortunately we have to keep the stack aligned. it's easier to just push an extra argument than care... */ stp x0, x1, [sp, #-16]! /* argv[1] = NULL, envp = NULL */ - mov x0, 1 - mov x1, sp - stp x0, x1, [sp, #-16]! /* argc = 1, argv[0] = "" */ + mov x2, 1 + mov x3, sp + stp x2, x3, [sp, #-16]! /* argc = 1, argv[0] = "" */ br x8 From 8d6dc0b12106f4c23ac98a2c87fa2232a4f0a1dd Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 14 Nov 2023 19:44:05 +0100 Subject: [PATCH 007/107] Python 2: Fix installing from source (#2298) * Python 2: Fix installing from source `python2.7 -m pip install git+https://github.com...` doesn't install any packages. The auto-discovery doesn't work for the old setuptools version used in Python 2. https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#flat-layout * Use Python 3 commandline tools in Docker images Since the Python 2 version was installed first, the Python 3 install didn't touch the existing shell script wrapper files. --- MANIFEST.in | 2 +- extra/docker/beta/Dockerfile | 2 +- extra/docker/dev/Dockerfile | 2 +- extra/docker/stable/Dockerfile | 2 +- setup.py | 5 ++--- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 8f001ea41..5327e1886 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,4 +6,4 @@ include *.md *.txt *.sh *.yml MANIFEST.in recursive-include docs *.rst *.png Makefile *.py *.txt recursive-include pwnlib *.py *.asm *.rst *.md *.txt *.sh __doc__ *.mako recursive-include pwn *.py *.asm *.rst *.md *.txt *.sh -recursive-exclude *.pyc +global-exclude *.pyc diff --git a/extra/docker/beta/Dockerfile b/extra/docker/beta/Dockerfile index cbfd05632..5a83dd6fc 100644 --- a/extra/docker/beta/Dockerfile +++ b/extra/docker/beta/Dockerfile @@ -2,6 +2,6 @@ FROM pwntools/pwntools:stable USER root RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@beta \ - && python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@beta + && python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@beta RUN PWNLIB_NOTERM=1 pwn update USER pwntools diff --git a/extra/docker/dev/Dockerfile b/extra/docker/dev/Dockerfile index d5f7af8f5..77d04d331 100644 --- a/extra/docker/dev/Dockerfile +++ b/extra/docker/dev/Dockerfile @@ -2,6 +2,6 @@ FROM pwntools/pwntools:stable USER root RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@dev \ - && python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@dev + && python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@dev RUN PWNLIB_NOTERM=1 pwn update USER pwntools diff --git a/extra/docker/stable/Dockerfile b/extra/docker/stable/Dockerfile index 980ef3f7e..1535d4af1 100644 --- a/extra/docker/stable/Dockerfile +++ b/extra/docker/stable/Dockerfile @@ -2,6 +2,6 @@ FROM pwntools/pwntools:base USER root RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@stable \ - && python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@stable + && python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@stable RUN PWNLIB_NOTERM=1 pwn update USER pwntools diff --git a/setup.py b/setup.py index e6bb61286..a17090ee9 100755 --- a/setup.py +++ b/setup.py @@ -3,14 +3,12 @@ import glob import os -import platform -import subprocess import sys -import traceback from distutils.command.install import INSTALL_SCHEMES from distutils.sysconfig import get_python_inc from distutils.util import convert_path +from setuptools import find_packages from setuptools import setup # Get all template files @@ -48,6 +46,7 @@ if sys.version_info < (3, 4): import toml project = toml.load('pyproject.toml')['project'] + compat['packages'] = find_packages() compat['install_requires'] = project['dependencies'] compat['name'] = project['name'] if '--user' in sys.argv: From 2e09b7dd91df719387934e58e9defc89c8b45b74 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Tue, 14 Nov 2023 20:01:02 +0100 Subject: [PATCH 008/107] Release 4.11.1 --- CHANGELOG.md | 7 +++++-- pwnlib/version.py | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 722187878..4f835c23f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The table below shows which release corresponds to each branch, and what date th | ---------------- | -------- | ---------------------- | | [4.13.0](#4130-dev) | `dev` | | [4.12.0](#4120-beta) | `beta` | -| [4.11.1](#4111-stable) | `stable` | +| [4.11.1](#4111-stable) | `stable` | Nov 14, 2023 | [4.11.0](#4110) | | Sep 15, 2023 | [4.10.0](#4100) | | May 21, 2023 | [4.9.0](#490) | | Dec 29, 2022 @@ -69,8 +69,9 @@ The table below shows which release corresponds to each branch, and what date th | [2.2.0](#220) | | Jan 5, 2015 ## 4.13.0 (`dev`) +- [#2281][2281] FIX: Getting right amount of data for search fix - +[2281]: https://github.com/Gallopsled/pwntools/pull/2281 ## 4.12.0 (`beta`) - [#2202][2202] Fix `remote` and `listen` in sagemath @@ -94,11 +95,13 @@ The table below shows which release corresponds to each branch, and what date th - [#2271][2271] FIX: Generated shebang with path to python invalid if path contains spaces - [#2272][2272] Fix `tube.clean_and_log` not logging buffered data - [#2281][2281] FIX: Getting right amount of data for search fix +- [#2287][2287] Fix `_countdown_handler` not invoking `timeout_change` - [#2294][2294] Fix atexit SEGV in aarch64 loader [2271]: https://github.com/Gallopsled/pwntools/pull/2271 [2272]: https://github.com/Gallopsled/pwntools/pull/2272 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 +[2287]: https://github.com/Gallopsled/pwntools/pull/2287 [2294]: https://github.com/Gallopsled/pwntools/pull/2294 ## 4.11.0 diff --git a/pwnlib/version.py b/pwnlib/version.py index 6c387e498..efbed2e4c 100644 --- a/pwnlib/version.py +++ b/pwnlib/version.py @@ -1 +1 @@ -__version__ = '4.11.0' +__version__ = '4.11.1' diff --git a/setup.py b/setup.py index a17090ee9..65cb5c3cd 100755 --- a/setup.py +++ b/setup.py @@ -61,7 +61,7 @@ sys.exit(-1) setup( - version = '4.11.0', + version = '4.11.1', data_files = [('pwntools-doc', glob.glob('*.md') + glob.glob('*.txt')), ], From b53d47697792c71e9c8e3261175de62b229c965a Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 14 Nov 2023 21:08:55 +0100 Subject: [PATCH 009/107] Add x86 CET status to checksec output (#2293) * Add x86 CET status to checksec output The ELF class now features two properties: - ibt for indirect branch tracking `-fcf-protection=branch` - shstk for shadow stack `-fcf-protection=return` Both checking the presence of the respective feature bit in the note property x86 feature segment. * Check if user shadowstack is enabled on SSH target Look for "user_shstk" in /proc/cpuinfo for ssh.checksec() * Add ELF.iter_notes and ELF.iter_properties helpers Allows to easily iterate the PT_NOTE segment and the properties in "GNU" notes. * Check for ibt on remote ssh machine * Update CHANGELOG * Suppress error when /proc/cpuinfo cannot be read --- CHANGELOG.md | 2 ++ pwnlib/elf/elf.py | 55 ++++++++++++++++++++++++++++++++++++++ pwnlib/tubes/ssh.py | 65 ++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 4 +-- 4 files changed, 123 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aa421748..9c2a91d1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,8 +71,10 @@ The table below shows which release corresponds to each branch, and what date th ## 4.13.0 (`dev`) - [#2281][2281] FIX: Getting right amount of data for search fix +- [#2293][2293] Add x86 CET status to checksec output [2281]: https://github.com/Gallopsled/pwntools/pull/2281 +[2293]: https://github.com/Gallopsled/pwntools/pull/2293 ## 4.12.0 (`beta`) diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index 4a2437206..abd6aae62 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -53,6 +53,7 @@ from elftools.elf.constants import SHN_INDICES from elftools.elf.descriptions import describe_e_type from elftools.elf.elffile import ELFFile +from elftools.elf.enums import ENUM_GNU_PROPERTY_X86_FEATURE_1_FLAGS from elftools.elf.gnuversions import GNUVerDefSection from elftools.elf.relocation import RelocationSection from elftools.elf.sections import SymbolTableSection @@ -510,6 +511,29 @@ def iter_segments_by_type(self, t): if t == seg.header.p_type or t in str(seg.header.p_type): yield seg + def iter_notes(self): + """ + Yields: + All the notes in the PT_NOTE segments. Each result is a dictionary- + like object with ``n_name``, ``n_type``, and ``n_desc`` fields, amongst + others. + """ + for seg in self.iter_segments_by_type('PT_NOTE'): + for note in seg.iter_notes(): + yield note + + def iter_properties(self): + """ + Yields: + All the GNU properties in the PT_NOTE segments. Each result is a dictionary- + like object with ``pr_type``, ``pr_datasz``, and ``pr_data`` fields. + """ + for note in self.iter_notes(): + if note.n_type != 'NT_GNU_PROPERTY_TYPE_0': + continue + for prop in note.n_desc: + yield prop + def get_segment_for_address(self, address, size=1): """get_segment_for_address(address, size=1) -> Segment @@ -2060,6 +2084,12 @@ def checksec(self, banner=True, color=True): if self.ubsan: res.append("UBSAN:".ljust(10) + green("Enabled")) + + if self.shadowstack: + res.append("SHSTK:".ljust(10) + green("Enabled")) + + if self.ibt: + res.append("IBT:".ljust(10) + green("Enabled")) # Check for Linux configuration, it must contain more than # just the version. @@ -2117,6 +2147,31 @@ def ubsan(self): """:class:`bool`: Whether the current binary was built with Undefined Behavior Sanitizer (``UBSAN``).""" return any(s.startswith('__ubsan_') for s in self.symbols) + + @property + def shadowstack(self): + """:class:`bool`: Whether the current binary was built with + Shadow Stack (``SHSTK``)""" + if self.arch not in ['i386', 'amd64']: + return False + for prop in self.iter_properties(): + if prop.pr_type != 'GNU_PROPERTY_X86_FEATURE_1_AND': + continue + return prop.pr_data & ENUM_GNU_PROPERTY_X86_FEATURE_1_FLAGS['GNU_PROPERTY_X86_FEATURE_1_SHSTK'] > 0 + return False + + @property + def ibt(self): + """:class:`bool`: Whether the current binary was built with + Indirect Branch Tracking (``IBT``)""" + if self.arch not in ['i386', 'amd64']: + return False + for prop in self.iter_properties(): + if prop.pr_type != 'GNU_PROPERTY_X86_FEATURE_1_AND': + continue + return prop.pr_data & ENUM_GNU_PROPERTY_X86_FEATURE_1_FLAGS['GNU_PROPERTY_X86_FEATURE_1_IBT'] > 0 + return False + def _update_args(self, kw): kw.setdefault('arch', self.arch) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 2216da0af..9337b27c3 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -17,6 +17,7 @@ from pwnlib import term from pwnlib.context import context, LocalContext +from pwnlib.exception import PwnlibException from pwnlib.log import Logger from pwnlib.log import getLogger from pwnlib.term import text @@ -613,6 +614,9 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None, self._platform_info = {} self._aslr = None self._aslr_ulimit = None + self._cpuinfo_cache = None + self._user_shstk = None + self._ibt = None misc.mkdir_p(self._cachedir) @@ -2144,6 +2148,57 @@ def preexec(): return self._aslr_ulimit + def _cpuinfo(self): + if self._cpuinfo_cache is None: + with context.quiet: + try: + self._cpuinfo_cache = self.read('/proc/cpuinfo') + except PwnlibException: + self._cpuinfo_cache = b'' + return self._cpuinfo_cache + + @property + def user_shstk(self): + """:class:`bool`: Whether userspace shadow stack is supported on the system. + + Example: + + >>> s = ssh("travis", "example.pwnme") + >>> s.user_shstk + False + """ + if self._user_shstk is None: + if self.os != 'linux': + self.warn_once("Only Linux is supported for userspace shadow stack checks.") + self._user_shstk = False + + else: + cpuinfo = self._cpuinfo() + + self._user_shstk = b' user_shstk' in cpuinfo + return self._user_shstk + + @property + def ibt(self): + """:class:`bool`: Whether kernel indirect branch tracking is supported on the system. + + Example: + + >>> s = ssh("travis", "example.pwnme") + >>> s.ibt + False + """ + if self._ibt is None: + if self.os != 'linux': + self.warn_once("Only Linux is supported for kernel indirect branch tracking checks.") + self._ibt = False + + else: + cpuinfo = self._cpuinfo() + + self._ibt = b' ibt ' in cpuinfo or b' ibt\n' in cpuinfo + return self._ibt + def _checksec_cache(self, value=None): path = self._get_cachefile('%s-%s' % (self.host, self.port)) @@ -2180,7 +2235,15 @@ def checksec(self, banner=True): "ASLR:".ljust(10) + { True: green("Enabled"), False: red("Disabled") - }[self.aslr] + }[self.aslr], + "SHSTK:".ljust(10) + { + True: green("Enabled"), + False: red("Disabled") + }[self.user_shstk], + "IBT:".ljust(10) + { + True: green("Enabled"), + False: red("Disabled") + }[self.ibt], ] if self.aslr_ulimit: diff --git a/pyproject.toml b/pyproject.toml index 517553053..b33699307 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,8 @@ requires-python = ">=2.7" dependencies = [ "paramiko>=1.15.2", "mako>=1.0.0", - "pyelftools>=0.24, <0.30; python_version < '3'", - "pyelftools>=0.24; python_version >= '3'", + "pyelftools>=0.28, <0.30; python_version < '3'", + "pyelftools>=0.28; python_version >= '3'", "capstone>=3.0.5rc2", # see Gallopsled/pwntools#971, Gallopsled/pwntools#1160 "ropgadget>=5.3", "pyserial>=2.7", From 2f2e0dc48c3a979b8ed440abf0aed3833ea8ed5d Mon Sep 17 00:00:00 2001 From: Arusekk Date: Tue, 14 Nov 2023 23:13:21 +0100 Subject: [PATCH 010/107] elf: Resolve more relocations into GOT entries (#2277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far only relocations pointing to external symbols were considered when filling GOT. Relocations in libc are a different thing, often found in CTF challenges (libc with partial RELRO has many interesting overridable function pointers, like strlen & strchrnul). Co-authored-by: Michał Radwański --- CHANGELOG.md | 2 ++ pwnlib/elf/elf.py | 26 +++++++++++++++++++++----- pyproject.toml | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c2a91d1f..16c45da47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,9 +70,11 @@ The table below shows which release corresponds to each branch, and what date th ## 4.13.0 (`dev`) +- [#2277][2277] elf: Resolve more relocations into GOT entries - [#2281][2281] FIX: Getting right amount of data for search fix - [#2293][2293] Add x86 CET status to checksec output +[2277]: https://github.com/Gallopsled/pwntools/pull/2277 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 [2293]: https://github.com/Gallopsled/pwntools/pull/2293 diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index abd6aae62..5c41f0f12 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -47,7 +47,7 @@ from six import BytesIO -from collections import namedtuple +from collections import namedtuple, defaultdict from elftools.elf.constants import P_FLAGS from elftools.elf.constants import SHN_INDICES @@ -55,7 +55,7 @@ from elftools.elf.elffile import ELFFile from elftools.elf.enums import ENUM_GNU_PROPERTY_X86_FEATURE_1_FLAGS from elftools.elf.gnuversions import GNUVerDefSection -from elftools.elf.relocation import RelocationSection +from elftools.elf.relocation import RelocationSection, RelrRelocationSection from elftools.elf.sections import SymbolTableSection from elftools.elf.segments import InterpSegment @@ -941,15 +941,25 @@ def _populate_synthetic_symbols(self): self.symbols['got.' + symbol] = address def _populate_got(self): - """Loads the symbols for all relocations""" + """Loads the symbols for all relocations. + + >>> libc = ELF(which('bash')).libc + >>> assert 'strchrnul' in libc.got + >>> assert 'memcpy' in libc.got + >>> assert libc.got.strchrnul != libc.got.memcpy + """ # Statically linked implies no relocations, since there is no linker # Could always be self-relocating like Android's linker *shrug* if self.statically_linked: return + revsymbols = defaultdict(list) + for name, addr in self.symbols.items(): + revsymbols[addr].append(name) + for section in self.sections: # We are only interested in relocations - if not isinstance(section, RelocationSection): + if not isinstance(section, (RelocationSection, RelrRelocationSection)): continue # Only get relocations which link to another section (for symbols) @@ -961,7 +971,13 @@ def _populate_got(self): for rel in section.iter_relocations(): sym_idx = rel.entry.r_info_sym - if not sym_idx: + if not sym_idx and rel.is_RELA(): + # TODO: actually resolve relocations + relocated = rel.entry.r_addend # sufficient for now + + symnames = revsymbols[relocated] + for symname in symnames: + self.got[symname] = rel.entry.r_offset continue symbol = symbols.get_symbol(sym_idx) diff --git a/pyproject.toml b/pyproject.toml index b33699307..c241db72f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,8 @@ requires-python = ">=2.7" dependencies = [ "paramiko>=1.15.2", "mako>=1.0.0", - "pyelftools>=0.28, <0.30; python_version < '3'", - "pyelftools>=0.28; python_version >= '3'", + "pyelftools>=0.29, <0.30; python_version < '3'", + "pyelftools>=0.29; python_version >= '3'", "capstone>=3.0.5rc2", # see Gallopsled/pwntools#971, Gallopsled/pwntools#1160 "ropgadget>=5.3", "pyserial>=2.7", From e4d3c82501c03de44458ae498a830fe66594f66d Mon Sep 17 00:00:00 2001 From: Arusekk Date: Tue, 14 Nov 2023 23:41:41 +0100 Subject: [PATCH 011/107] ssh: Fix unstable cpuinfo on dynscaled CPUs --- pwnlib/tubes/ssh.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 9337b27c3..5f020f4b0 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -1506,14 +1506,14 @@ def update(has, total): with open(local, 'wb') as fd: fd.write(data) - def _download_to_cache(self, remote, p): + def _download_to_cache(self, remote, p, fingerprint=True): with context.local(log_level='error'): remote = self.readlink('-f',remote) if not hasattr(remote, 'encode'): remote = remote.decode('utf-8') - fingerprint = self._get_fingerprint(remote) + fingerprint = fingerprint and self._get_fingerprint(remote) or None if fingerprint is None: local = os.path.normpath(remote) local = os.path.basename(local) @@ -1535,7 +1535,7 @@ def _download_to_cache(self, remote, p): return local - def download_data(self, remote): + def download_data(self, remote, fingerprint=True): """Downloads a file from the remote server and returns it as a string. Arguments: @@ -1556,7 +1556,7 @@ def download_data(self, remote): """ with self.progress('Downloading %r' % remote) as p: - with open(self._download_to_cache(remote, p), 'rb') as fd: + with open(self._download_to_cache(remote, p, fingerprint), 'rb') as fd: return fd.read() def download_file(self, remote, local = None): @@ -2152,7 +2152,7 @@ def _cpuinfo(self): if self._cpuinfo_cache is None: with context.quiet: try: - self._cpuinfo_cache = self.read('/proc/cpuinfo') + self._cpuinfo_cache = self.download_data('/proc/cpuinfo', fingerprint=False) except PwnlibException: self._cpuinfo_cache = b'' return self._cpuinfo_cache From bb1d16c3c64f80ec83672683715acf92d7b15535 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Mon, 20 Nov 2023 15:31:42 +0100 Subject: [PATCH 012/107] rop: Make stack move faster (#2300) This defers calculation of all 'add (e|r)sp, 0xHUGE' payload until the gadget gets actually used in a chain. Fixes #2253 --- pwnlib/rop/rop.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pwnlib/rop/rop.py b/pwnlib/rop/rop.py index 09923730f..6a57a60d1 100644 --- a/pwnlib/rop/rop.py +++ b/pwnlib/rop/rop.py @@ -717,15 +717,20 @@ def setRegisters(self, registers): name = ",".join(goodregs) stack.append((gadget.address, gadget)) for r in gadget.regs: - moved += context.bytes - if r in registers: - stack.append((registers[r], r)) - else: - stack.append((Padding('' % r), r)) + if isinstance(r, str): + if r in registers: + stack.append((registers[r], r)) + else: + stack.append((Padding('' % r), r)) + moved += context.bytes + continue + + for slot in range(moved, moved + r, context.bytes): + left = gadget.move - slot + stack.append((Padding('' % left), 'stack padding')) + moved += context.bytes - for slot in range(moved, gadget.move, context.bytes): - left = gadget.move - slot - stack.append((Padding('' % left), 'stack padding')) + assert moved == gadget.move return stack @@ -1389,9 +1394,7 @@ def __getattr__(self, k): elif add.match(insn): arg = int(add.match(insn).group(1), 16) sp_move += arg - while arg >= context.bytes: - regs.append(hex(arg)) - arg -= context.bytes + regs.append(arg) elif ret.match(insn): sp_move += context.bytes elif leave.match(insn): From 77957b4b41ada00eb21d5d591e79f336a829fdc4 Mon Sep 17 00:00:00 2001 From: Michal Ambroz <723625+xambroz@users.noreply.github.com> Date: Fri, 24 Nov 2023 13:32:08 +0100 Subject: [PATCH 013/107] Fix SyntaxWarning in Python 3.12 (#2302) * libcdb.py - python 3.12 Python 3.12 would complain if the \d atom is not escaped in the binary string. /usr/lib/python3.12/site-packages/pwnlib/commandline/libcdb.py:224: SyntaxWarning: invalid escape sequence '\d' libc_version = re.search(b'libc[ -](\d+\.\d+)', exe.data) * Use raw string --------- Co-authored-by: peace-maker --- pwnlib/commandline/libcdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/commandline/libcdb.py b/pwnlib/commandline/libcdb.py index 1555db2a7..b32400d2c 100644 --- a/pwnlib/commandline/libcdb.py +++ b/pwnlib/commandline/libcdb.py @@ -221,7 +221,7 @@ def main(args): exe = ELF(file, checksec=False) log.info('%s', text.red(os.path.basename(file))) - libc_version = re.search(b'libc[ -](\d+\.\d+)', exe.data) + libc_version = re.search(br'libc[ -](\d+\.\d+)', exe.data) if libc_version: log.indented('%-20s %s', text.green('Version:'), libc_version.group(1).decode()) From 4ef474624394070d82d894609c23d0a2dd60bee2 Mon Sep 17 00:00:00 2001 From: Michal Ambroz <723625+xambroz@users.noreply.github.com> Date: Fri, 24 Nov 2023 13:37:29 +0100 Subject: [PATCH 014/107] Remove python2 shebang lines from commandline tools (#2301) * remove python2 shabangs * Remove execute bit from commandline implementation --------- Co-authored-by: Peace-Maker --- pwnlib/commandline/__init__.py | 1 - pwnlib/commandline/asm.py | 1 - pwnlib/commandline/checksec.py | 1 - pwnlib/commandline/constgrep.py | 1 - pwnlib/commandline/cyclic.py | 1 - pwnlib/commandline/debug.py | 1 - pwnlib/commandline/disablenx.py | 1 - pwnlib/commandline/disasm.py | 1 - pwnlib/commandline/elfdiff.py | 1 - pwnlib/commandline/elfpatch.py | 1 - pwnlib/commandline/hex.py | 1 - pwnlib/commandline/phd.py | 1 - pwnlib/commandline/shellcraft.py | 1 - pwnlib/commandline/template.py | 1 - pwnlib/commandline/unhex.py | 1 - 15 files changed, 15 deletions(-) mode change 100755 => 100644 pwnlib/commandline/constgrep.py mode change 100755 => 100644 pwnlib/commandline/template.py diff --git a/pwnlib/commandline/__init__.py b/pwnlib/commandline/__init__.py index a0aeedac1..2c1b31aef 100644 --- a/pwnlib/commandline/__init__.py +++ b/pwnlib/commandline/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 __all__ = [ 'asm', 'checksec', diff --git a/pwnlib/commandline/asm.py b/pwnlib/commandline/asm.py index 8f1c39884..03c51a6a2 100644 --- a/pwnlib/commandline/asm.py +++ b/pwnlib/commandline/asm.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/checksec.py b/pwnlib/commandline/checksec.py index 1b7e74c3c..5dcea5e38 100644 --- a/pwnlib/commandline/checksec.py +++ b/pwnlib/commandline/checksec.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/constgrep.py b/pwnlib/commandline/constgrep.py old mode 100755 new mode 100644 index 5959b5155..bac138d72 --- a/pwnlib/commandline/constgrep.py +++ b/pwnlib/commandline/constgrep.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/cyclic.py b/pwnlib/commandline/cyclic.py index eeb55b9b0..ff012a359 100644 --- a/pwnlib/commandline/cyclic.py +++ b/pwnlib/commandline/cyclic.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/debug.py b/pwnlib/commandline/debug.py index 5c92af36d..fe5fca6f5 100644 --- a/pwnlib/commandline/debug.py +++ b/pwnlib/commandline/debug.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/disablenx.py b/pwnlib/commandline/disablenx.py index 9751f3b6a..29839c0f8 100644 --- a/pwnlib/commandline/disablenx.py +++ b/pwnlib/commandline/disablenx.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/disasm.py b/pwnlib/commandline/disasm.py index 78e69b904..4c4535594 100644 --- a/pwnlib/commandline/disasm.py +++ b/pwnlib/commandline/disasm.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division from __future__ import print_function diff --git a/pwnlib/commandline/elfdiff.py b/pwnlib/commandline/elfdiff.py index 60e5d8fbf..48afef09f 100644 --- a/pwnlib/commandline/elfdiff.py +++ b/pwnlib/commandline/elfdiff.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/elfpatch.py b/pwnlib/commandline/elfpatch.py index 7de0f2015..10a5adc24 100644 --- a/pwnlib/commandline/elfpatch.py +++ b/pwnlib/commandline/elfpatch.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/hex.py b/pwnlib/commandline/hex.py index 136106c67..d538af246 100644 --- a/pwnlib/commandline/hex.py +++ b/pwnlib/commandline/hex.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/phd.py b/pwnlib/commandline/phd.py index 1ef1fd91a..7f3891e0f 100644 --- a/pwnlib/commandline/phd.py +++ b/pwnlib/commandline/phd.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/shellcraft.py b/pwnlib/commandline/shellcraft.py index 9d49c5608..9f5fe36ae 100644 --- a/pwnlib/commandline/shellcraft.py +++ b/pwnlib/commandline/shellcraft.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/template.py b/pwnlib/commandline/template.py old mode 100755 new mode 100644 index a8f480dfe..f68461cb6 --- a/pwnlib/commandline/template.py +++ b/pwnlib/commandline/template.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division diff --git a/pwnlib/commandline/unhex.py b/pwnlib/commandline/unhex.py index 048bb9224..a254e6b3f 100644 --- a/pwnlib/commandline/unhex.py +++ b/pwnlib/commandline/unhex.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2 from __future__ import absolute_import from __future__ import division From 65f9d5761d1fdb7c6dc4e98cbc6ac4f221678371 Mon Sep 17 00:00:00 2001 From: Heap Crash <66139157+heapcrash@users.noreply.github.com> Date: Fri, 24 Nov 2023 07:02:53 -0600 Subject: [PATCH 015/107] Allow to add to the existing environment in `process` instead of replacing it (#1763) * Add env_add to the process module * Don't mutate passed `env` parameter dictionary Co-authored-by: Arusekk * Update CHANGELOG * Use a boolean flag instead of env_add There should be preferably only one obvious way to pass env. * Update CHANGELOG --------- Co-authored-by: peace-maker Co-authored-by: peace-maker Co-authored-by: Arusekk --- CHANGELOG.md | 2 ++ pwnlib/tubes/process.py | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c45da47..cd4c90007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,10 +73,12 @@ The table below shows which release corresponds to each branch, and what date th - [#2277][2277] elf: Resolve more relocations into GOT entries - [#2281][2281] FIX: Getting right amount of data for search fix - [#2293][2293] Add x86 CET status to checksec output +- [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it [2277]: https://github.com/Gallopsled/pwntools/pull/2277 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 [2293]: https://github.com/Gallopsled/pwntools/pull/2293 +[1763]: https://github.com/Gallopsled/pwntools/pull/1763 ## 4.12.0 (`beta`) diff --git a/pwnlib/tubes/process.py b/pwnlib/tubes/process.py index 8770ade0c..8c44e7b7d 100644 --- a/pwnlib/tubes/process.py +++ b/pwnlib/tubes/process.py @@ -58,7 +58,9 @@ class process(tube): cwd(str): Working directory. Uses the current working directory by default. env(dict): - Environment variables. By default, inherits from Python's environment. + Environment variables to add to the environment. + ignore_environ(bool): + Ignore Python's environment. By default use Python's environment iff env not specified. stdin(int): File object or file descriptor number to use for ``stdin``. By default, a pipe is used. A pty can be used instead by setting @@ -224,6 +226,7 @@ def __init__(self, argv = None, executable = None, cwd = None, env = None, + ignore_environ = None, stdin = PIPE, stdout = PTY, stderr = STDOUT, @@ -255,7 +258,7 @@ def __init__(self, argv = None, original_env = env if shell: - executable_val, argv_val, env_val = executable, argv, env + executable_val, argv_val, env_val = executable or '/bin/sh', argv, env else: executable_val, argv_val, env_val = self._validate(cwd, executable, argv, env) @@ -287,14 +290,14 @@ def __init__(self, argv = None, #: Full path to the executable self.executable = executable_val + if ignore_environ is None: + ignore_environ = env is not None # compat + #: Environment passed on envp - self.env = os.environ if env is None else env_val + self.env = {} if ignore_environ else dict(getattr(os, "environb", os.environ)) - if self.executable is None: - if shell: - self.executable = '/bin/sh' - else: - self.executable = which(self.argv[0], path=self.env.get('PATH')) + # Add environment variables as needed + self.env.update(env_val or {}) self._cwd = os.path.realpath(cwd or os.path.curdir) From d10c70fb32b7e8db595b24cf7e6d057a44a57191 Mon Sep 17 00:00:00 2001 From: Heap Crash <66139157+heapcrash@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:08:48 -0600 Subject: [PATCH 016/107] Allow to add to the existing environment in ssh instead of replacing it (#1764) * Add env_add to the ssh module * Use ignore_environ like process --------- Co-authored-by: peace-maker Co-authored-by: Arusekk --- pwnlib/tubes/ssh.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 5f020f4b0..01e6eed36 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -760,7 +760,7 @@ def shell(self, shell = None, tty = True, timeout = Timeout.default): """ return self.run(shell, tty, timeout = timeout) - def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, timeout=Timeout.default, run=True, + def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, ignore_environ=None, timeout=Timeout.default, run=True, stdin=0, stdout=1, stderr=2, preexec_fn=None, preexec_args=(), raw=True, aslr=None, setuid=None, shell=False): r""" @@ -788,8 +788,9 @@ def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, time Working directory. If :const:`None`, uses the working directory specified on :attr:`cwd` or set via :meth:`set_working_directory`. env(dict): - Environment variables to set in the child. If :const:`None`, inherits the - default environment. + Environment variables to add to the environment. + ignore_environ(bool): + Ignore default environment. By default use default environment iff env not specified. timeout(int): Timeout to set on the `tube` created to interact with the process. run(bool): @@ -909,6 +910,9 @@ def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, time aslr = aslr if aslr is not None else context.aslr + if ignore_environ is None: + ignore_environ = env is not None # compat + argv, env = misc.normalize_argv_env(argv, env, self) if shell: @@ -959,11 +963,12 @@ def func(): pass os.chdir(%(cwd)r) +if %(ignore_environ)r: + os.environ.clear() environ = getattr(os, 'environb', os.environ) if env is not None: env = OrderedDict((bytes(k), bytes(v)) for k,v in env) - os.environ.clear() environ.update(env) else: env = environ From f03582fb92c076ef8274144e1e35e0a62c950692 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Wed, 29 Nov 2023 16:08:55 +0100 Subject: [PATCH 017/107] Explicitly select readthedocs theme (#2311) The `sphinx_rtd_theme` has to be selected manually and isn't the default on RTD anymore. This seems to be part of a wave of deprecations in their build system. https://github.com/readthedocs/tutorial-template/blob/f594c40889a4d9949339bd4e0d64275fc99c22f5/docs/source/conf.py#L32 --- .readthedocs.yaml | 3 +++ docs/source/conf.py | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 5b502e342..ea7cd7250 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,6 +7,9 @@ build: tools: python: "3" +sphinx: + configuration: docs/source/conf.py + python: install: - requirements: docs/requirements.txt diff --git a/docs/source/conf.py b/docs/source/conf.py index 8ce3ccad7..ee537d0db 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -169,7 +169,7 @@ def __setattr__(self, name, value): # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -265,8 +265,8 @@ def __setattr__(self, name, value): u'2016, Gallopsled et al.', 'manual'), ] -intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None), - 'paramiko': ('https://paramiko-docs.readthedocs.org/en/2.1/', None)} +intersphinx_mapping = {'python': ('https://docs.python.org/3/', None), + 'paramiko': ('https://docs.paramiko.org/en/2.1/', None)} # The name of an image file (relative to this directory) to place at the top of # the title page. @@ -382,8 +382,6 @@ def linkcode_resolve(domain, info): html_theme_path = [alabaster.get_path()] html_theme_options = { 'nosidebar' : True } - # otherwise, readthedocs.org uses their theme by default, so no need to specify it - # -- Customization to Sphinx autodoc generation -------------------------------------------- import sphinx.ext.autodoc From a8f40936959b63cb3a41885deeaee28b48794044 Mon Sep 17 00:00:00 2001 From: Michal Ambroz <723625+xambroz@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:29:35 +0100 Subject: [PATCH 018/107] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found (#2307) * next fails if string is not found in binary fixes #2306 * Only display "str_bin_sh" symbol if it's available * Update CHANGELOG --------- Co-authored-by: Peace-Maker --- CHANGELOG.md | 2 ++ pwnlib/commandline/libcdb.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4c90007..168c4d09d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,11 +74,13 @@ The table below shows which release corresponds to each branch, and what date th - [#2281][2281] FIX: Getting right amount of data for search fix - [#2293][2293] Add x86 CET status to checksec output - [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it +- [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found [2277]: https://github.com/Gallopsled/pwntools/pull/2277 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 [2293]: https://github.com/Gallopsled/pwntools/pull/2293 [1763]: https://github.com/Gallopsled/pwntools/pull/1763 +[2307]: https://github.com/Gallopsled/pwntools/pull/2307 ## 4.12.0 (`beta`) diff --git a/pwnlib/commandline/libcdb.py b/pwnlib/commandline/libcdb.py index b32400d2c..30ee47f07 100644 --- a/pwnlib/commandline/libcdb.py +++ b/pwnlib/commandline/libcdb.py @@ -176,9 +176,13 @@ def translate_offset(offs, args, exe): return offs def collect_synthetic_symbols(exe): - available_symbols = ['str_bin_sh'] - exe.symbols['str_bin_sh'] = next(exe.search(b'/bin/sh\x00')) - + available_symbols = [] + try: + exe.symbols['str_bin_sh'] = next(exe.search(b'/bin/sh\x00')) + available_symbols.append('str_bin_sh') + except StopIteration: + pass + libc_start_main_return = exe.libc_start_main_return if libc_start_main_return > 0: exe.symbols['__libc_start_main_ret'] = libc_start_main_return From 43071cd6e52e7518baa4e7f9d7ef57dd9e691c4c Mon Sep 17 00:00:00 2001 From: Arusekk Date: Sat, 2 Dec 2023 13:31:40 +0100 Subject: [PATCH 019/107] Term rework (#2242) * term rework * towards floating cells * redraw when screen clears * term: working completion * Display non-printable characters * ui: fix options with new term * term: Clean up and fix examples/spinners * changelog and lint * Fix SSH in NOTERM mode * defer termios setup * term: py2 compat * py2: compat fixup * appease pylint * fix scroll on winch * term: fix hang on winch during readline --- CHANGELOG.md | 2 + examples/options.py | 2 +- pwnlib/log.py | 2 +- pwnlib/py2compat.py | 94 +++++ pwnlib/term/__init__.py | 5 +- pwnlib/term/key.py | 6 +- pwnlib/term/readline.py | 17 +- pwnlib/term/term.py | 805 ++++++++++++++++-------------------- pwnlib/term/unix_termcap.py | 2 +- pwnlib/ui.py | 17 +- 10 files changed, 473 insertions(+), 479 deletions(-) create mode 100644 pwnlib/py2compat.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 168c4d09d..180ac9439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,12 +70,14 @@ The table below shows which release corresponds to each branch, and what date th ## 4.13.0 (`dev`) +- [#2242][2242] Term module revamp: activating special handling of terminal only when necessary - [#2277][2277] elf: Resolve more relocations into GOT entries - [#2281][2281] FIX: Getting right amount of data for search fix - [#2293][2293] Add x86 CET status to checksec output - [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it - [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found +[2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 [2281]: https://github.com/Gallopsled/pwntools/pull/2281 [2293]: https://github.com/Gallopsled/pwntools/pull/2293 diff --git a/examples/options.py b/examples/options.py index 84e3879ae..a30243f14 100644 --- a/examples/options.py +++ b/examples/options.py @@ -4,5 +4,5 @@ from pwn import * -opts = [string.letters[x] for x in range(10)] +opts = [string.ascii_letters[x] for x in range(12)] print('You choose "%s"' % opts[options('Pick one:', opts)]) diff --git a/pwnlib/log.py b/pwnlib/log.py index 4e04997ff..317dde44a 100644 --- a/pwnlib/log.py +++ b/pwnlib/log.py @@ -560,7 +560,7 @@ def emit(self, record): # we enrich the `Progress` object to keep track of the spinner if not hasattr(progress, '_spinner_handle'): - spinner_handle = term.output('') + spinner_handle = term.output('[x] ') msg_handle = term.output(msg) stop = threading.Event() def spin(): diff --git a/pwnlib/py2compat.py b/pwnlib/py2compat.py new file mode 100644 index 000000000..8584adf43 --- /dev/null +++ b/pwnlib/py2compat.py @@ -0,0 +1,94 @@ +""" +Compatibility layer with python 2, allowing us to write normal code. +Beware, some monkey-patching is done. +""" + +import os +import shutil +import sys +try: + import fcntl + import termios +except ImportError: + pass + +from collections import namedtuple +from struct import Struct + +def py2_monkey_patch(module): + def decorator(f): + if sys.version_info < (3,): + f.__module__ = module.__name__ + setattr(module, f.__name__, f) + return decorator + +# python3 -c 'import shutil,inspect; print(inspect.getsource(shutil.get_terminal_size))' +@py2_monkey_patch(shutil) +def get_terminal_size(fallback=(80, 24)): + """Get the size of the terminal window. + + For each of the two dimensions, the environment variable, COLUMNS + and LINES respectively, is checked. If the variable is defined and + the value is a positive integer, it is used. + + When COLUMNS or LINES is not defined, which is the common case, + the terminal connected to sys.__stdout__ is queried + by invoking os.get_terminal_size. + + If the terminal size cannot be successfully queried, either because + the system doesn't support querying, or because we are not + connected to a terminal, the value given in fallback parameter + is used. Fallback defaults to (80, 24) which is the default + size used by many terminal emulators. + + The value returned is a named tuple of type os.terminal_size. + """ + # columns, lines are the working values + try: + columns = int(os.environ['COLUMNS']) + except (KeyError, ValueError): + columns = 0 + + try: + lines = int(os.environ['LINES']) + except (KeyError, ValueError): + lines = 0 + + # only query if necessary + if columns <= 0 or lines <= 0: + try: + size = os.get_terminal_size(sys.__stdout__.fileno()) + except (AttributeError, ValueError, IOError): + # stdout is None, closed, detached, or not a terminal, or + # os.get_terminal_size() is unsupported + size = os.terminal_size(fallback) + if columns <= 0: + columns = size.columns + if lines <= 0: + lines = size.lines + + return os.terminal_size((columns, lines)) + +@py2_monkey_patch(os) +class terminal_size(tuple): + @property + def columns(self): + return self[0] + + @property + def lines(self): + return self[1] + + def __repr__(self): + return 'os.terminal_size(columns=%r, lines=%r)' % self + +terminal_size = namedtuple('terminal_size', 'columns lines') + +termsize = Struct('HHHH') + +@py2_monkey_patch(os) +def get_terminal_size(fd): # pylint: disable=function-redefined + arr = b'\0' * termsize.size + arr = fcntl.ioctl(fd, termios.TIOCGWINSZ, arr) + lines, columns, xpixel, ypixel = termsize.unpack(arr) + return os.terminal_size((columns, lines)) diff --git a/pwnlib/term/__init__.py b/pwnlib/term/__init__.py index 366773583..b6be1fe45 100644 --- a/pwnlib/term/__init__.py +++ b/pwnlib/term/__init__.py @@ -12,9 +12,10 @@ from pwnlib.term import text # Re-exports (XXX: Are these needed?) -output = term.output -width = term.width +term.update_geometry() +width = term.width height = term.height +output = term.output getkey = key.get Keymap = keymap.Keymap diff --git a/pwnlib/term/key.py b/pwnlib/term/key.py index 211eb9363..dead924fc 100644 --- a/pwnlib/term/key.py +++ b/pwnlib/term/key.py @@ -10,6 +10,7 @@ from pwnlib.term import keyconsts as kc from pwnlib.term import termcap +from pwnlib.term import term __all__ = ['getch', 'getraw', 'get', 'unget'] @@ -25,7 +26,10 @@ def getch(timeout = 0): try: rfds, _wfds, _xfds = select.select([_fd], [], [], timeout) if rfds: - c = os.read(_fd, 1) + with term.rlock: + rfds, _wfds, _xfds = select.select([_fd], [], [], 0) + if not rfds: continue + c = os.read(_fd, 1) return ord(c) if c else None else: return None diff --git a/pwnlib/term/readline.py b/pwnlib/term/readline.py index b60b656de..d47b178a4 100644 --- a/pwnlib/term/readline.py +++ b/pwnlib/term/readline.py @@ -3,6 +3,7 @@ from __future__ import division from __future__ import print_function +import io import six import sys @@ -406,17 +407,20 @@ def readline(_size=-1, prompt='', float=True, priority=10): history.insert(0, buffer) return force_to_bytes(buffer) except KeyboardInterrupt: - control_c() + do_raise = False + try: + control_c() + except KeyboardInterrupt: + do_raise = True + if do_raise: + raise finally: line = buffer_left + buffer_right + '\n' buffer_handle.update(line) - buffer_handle.freeze() buffer_handle = None if prompt_handle: - prompt_handle.freeze() prompt_handle = None if suggest_handle: - suggest_handle.freeze() suggest_handle = None if shutdown_hook: shutdown_hook() @@ -484,7 +488,10 @@ class Wrapper: def __init__(self, fd): self._fd = fd def readline(self, size = None): - return readline(size) + r = readline(size) + if isinstance(self._fd, io.TextIOWrapper): + r = r.decode(encoding=self._fd.encoding, errors=self._fd.errors) + return r def __getattr__(self, k): return getattr(self._fd, k) sys.stdin = Wrapper(sys.stdin) diff --git a/pwnlib/term/term.py b/pwnlib/term/term.py index 5ed4fe07d..2176dd2e7 100644 --- a/pwnlib/term/term.py +++ b/pwnlib/term/term.py @@ -1,23 +1,26 @@ from __future__ import absolute_import from __future__ import division +from __future__ import unicode_literals import atexit import errno import os import re +import shutil import signal -import six import struct import sys import threading import traceback +import weakref if sys.platform != 'win32': import fcntl import termios -from pwnlib.context import ContextType -from pwnlib.term import termcap +from ..context import ContextType +from . import termcap +from .. import py2compat __all__ = ['output', 'init'] @@ -25,18 +28,46 @@ MAX_TERM_HEIGHT = 200 # default values -width = 80 -height = 25 +scroll = 0 # list of callbacks triggered on SIGWINCH on_winch = [] - - +cached_pos = None settings = None -_graphics_mode = False +need_scroll_update = -1 +setup_done = False +epoch = 0 fd = sys.stdout +winchretry = False +rlock = threading.RLock() + +class WinchLock(object): + def __init__(self): + self.guard = threading.RLock() + self.lock = threading.Lock() + + @property + def acquire(self): + return self.lock.acquire + + @property + def release(self): + return self.lock.release + + def __enter__(self): + self.guard.acquire() + return self.lock.__enter__() + def __exit__(self, tp, val, tb): + try: + return self.lock.__exit__(tp, val, tb) + finally: + if winchretry: + handler_sigwinch(signal.SIGWINCH, None) + self.guard.release() + +wlock = WinchLock() def show_cursor(): do('cnorm') @@ -46,102 +77,71 @@ def hide_cursor(): def update_geometry(): global width, height - hw = fcntl.ioctl(fd.fileno(), termios.TIOCGWINSZ, '1234') - h, w = struct.unpack('hh', hw) - # if the window shrunk and theres still free space at the bottom move - # everything down - if h < height and scroll == 0: - if cells and cells[-1].end[0] < 0: - delta = min(height - h, 1 - cells[-1].end[0]) - for cell in cells: - cell.end = (cell.end[0] + delta, cell.end[1]) - cell.start = (cell.start[0] + delta, cell.start[1]) - height, width = h, w + width, height = shutil.get_terminal_size() def handler_sigwinch(signum, stack): - if hasattr(signal, 'pthread_sigmask'): - signal.pthread_sigmask(signal.SIG_BLOCK, {signal.SIGWINCH}) - update_geometry() - redraw() - for cb in on_winch: - cb() - if hasattr(signal, 'pthread_sigmask'): - signal.pthread_sigmask(signal.SIG_UNBLOCK, {signal.SIGWINCH}) + global cached_pos, winchretry, need_scroll_update + with wlock.guard: + while True: + if not wlock.acquire(False): + winchretry = True + return + + winchretry = False + need_scroll_update = epoch + update_geometry() + for cb in on_winch: + cb() + wlock.release() + if not winchretry: break + def handler_sigstop(signum, stack): resetterm() - os.kill(os.getpid(), signal.SIGSTOP) + os.kill(0, signal.SIGSTOP) def handler_sigcont(signum, stack): - setupterm() - redraw() + global epoch, cached_pos, scroll, setup_done + epoch += 1 + cached_pos = None + scroll = 0 + setup_done = False def setupterm(): global settings - update_geometry() hide_cursor() + update_geometry() do('smkx') # keypad mode + mode = termios.tcgetattr(fd) + IFLAG, OFLAG, CFLAG, LFLAG, ISPEED, OSPEED, CC = range(7) if not settings: - settings = termios.tcgetattr(fd.fileno()) - mode = termios.tcgetattr(fd.fileno()) - IFLAG = 0 - OFLAG = 1 - CFLAG = 2 - LFLAG = 3 - ISPEED = 4 - OSPEED = 5 - CC = 6 - mode[LFLAG] = mode[LFLAG] & ~(termios.ECHO | termios.ICANON | termios.IEXTEN) + settings = mode[:] + settings[CC] = settings[CC][:] + mode[LFLAG] &= ~(termios.ECHO | termios.ICANON | termios.IEXTEN) mode[CC][termios.VMIN] = 1 mode[CC][termios.VTIME] = 0 - termios.tcsetattr(fd, termios.TCSAFLUSH, mode) + termios.tcsetattr(fd, termios.TCSADRAIN, mode) def resetterm(): + global settings, setup_done if settings: - termios.tcsetattr(fd.fileno(), termios.TCSADRAIN, settings) - show_cursor() - do('rmkx') - fd.write(' \x08') # XXX: i don't know why this is needed... - # only necessary when suspending the process + termios.tcsetattr(fd, termios.TCSADRAIN, settings) + settings = None + if setup_done: + setup_done = False + show_cursor() + do('rmkx') def init(): atexit.register(resetterm) - setupterm() signal.signal(signal.SIGWINCH, handler_sigwinch) signal.signal(signal.SIGTSTP, handler_sigstop) signal.signal(signal.SIGCONT, handler_sigcont) - # we start with one empty cell at the current cursor position - put('\x1b[6n') - fd.flush() - s = '' - while True: - try: - c = os.read(fd.fileno(), 1) - except OSError as e: - if e.errno != errno.EINTR: - raise - continue - if not isinstance(c, six.string_types): - c = c.decode('utf-8') - s += c - if c == 'R': - break - row, col = re.findall('\x1b' + r'\[(\d*);(\d*)R', s)[0] - row = int(row) - height - col = int(col) - 1 - cell = Cell() - cell.start = (row, col) - cell.end = (row, col) - cell.content = [] - cell.frozen = True - cell.float = 0 - cell.indent = 0 - cells.append(cell) class Wrapper: def __init__(self, fd): self._fd = fd def write(self, s): - output(s, frozen = True) + return output(s, frozen=True) def __getattr__(self, k): return getattr(self._fd, k) if sys.stdout.isatty(): @@ -156,408 +156,295 @@ def __getattr__(self, k): # freeze all cells if an exception is thrown orig_hook = sys.excepthook def hook(*args): + sys.stderr = sys.__stderr__ resetterm() - for c in cells: - c.frozen = True - c.float = 0 + cells.clear() if orig_hook: orig_hook(*args) else: traceback.print_exception(*args) - # this is a bit esoteric - # look here for details: https://stackoverflow.com/questions/12790328/how-to-silence-sys-excepthook-is-missing-error - if fd.fileno() == 2: - os.close(fd.fileno()) sys.excepthook = hook +tmap = {c: '\\x{:02x}'.format(c) for c in set(range(0x20)) - {0x09, 0x0a, 0x0d, 0x1b} | {0x7f}} + def put(s): - if not isinstance(s, six.string_types): - s = s.decode('utf-8') - fd.write(s) + global cached_pos, scroll + if cached_pos: + it = iter(s.replace('\n', '\r\n')) + for c in it: + if c == '\r': + cached_pos[1] = 0 + elif c == '\n': + cached_pos[0] += 1 + if cached_pos[0] >= height: + scroll = max(scroll, cached_pos[0] - height + 1) + elif c == '\t': + cached_pos[1] = (cached_pos[1] + 8) & -8 + elif c in '\x1b\u009b': # ESC or CSI + for c in it: + if c not in '[]0123456789;:': + break + else: + # unterminated ctrl seq, just discard cache + cached_pos = None + break -def flush(): fd.flush() + # if '\e[123;123;123;123m' then nothing + if c == 'm': + pass + else: + # undefined ctrl seq, just discard cache + cached_pos = None + break + elif c < ' ': + # undefined ctrl char, just discard cache + cached_pos = None + break + else: + # normal character, nothing to see here + cached_pos[1] += 1 + return fd.write(s.translate(tmap)) def do(c, *args): s = termcap.get(c, *args) if s: - put(s) + fd.write(s.decode('utf-8')) + +def goto(rc): + global cached_pos, scroll + r, c = rc + nowr, nowc = cached_pos or (None, None) + cached_pos = [r, c] + # common cases: we can just go up/down a couple rows + if c == 0: + if r == nowr + 1: + fd.write('\n') + return + if r == nowr: + if c != nowc: + fd.write('\r') + return + + if nowc == c: + if r == nowr - 1: + do('cuu1') + elif r < nowr: + do('cuu', nowr - r) + elif r > nowr: + do('cud', r - nowr) + return + + if r == nowr: + do('hpa', c) + return -def goto(r, c): - do('cup', r - scroll + height - 1, c) + if need_scroll_update == epoch and nowr is not None: + cached_pos = None + diffr, diffc = get_position() + scroll += nowr - diffr + cached_pos = [r, c] + do('cup', r - scroll, c) -cells = [] -scroll = 0 class Cell(object): - pass - -class Handle: - def __init__(self, cell, is_floating): - self.h = id(cell) - self.is_floating = is_floating - def update(self, s): - update(self.h, s) - def freeze(self): - freeze(self.h) - def delete(self): - delete(self.h) - -STR, CSI, LF, BS, CR, SOH, STX, OOB = range(8) -def parse_csi(buf, offset): - i = offset - while i < len(buf): - c = buf[i] - if c >= 0x40 and c < 0x80: - break - i += 1 - if i >= len(buf): - return - end = i - cmd = [c, None, None] - i = offset - in_num = False - args = [] - if buf[i] >= ord('<') and buf[i] <= ord('?'): - cmd[1] = buf[i] - i += 1 - while i < end: - c = buf[i] - if c >= ord('0') and c <= ord('9'): - if not in_num: - args.append(c - ord('0')) - in_num = True - else: - args[-1] = args[-1] * 10 + c - ord('0') - elif c == ord(';'): - if not in_num: - args.append(None) - in_num = False - if len(args) > 16: + def __init__(self, value, float): + self.value = value + self.float = float + + def draw(self): + self.pos = get_position() + self.born = epoch + put(self.value) + self.pos_after = get_position() + + def update(self, value): + if isinstance(value, bytes): + value = value.decode('utf-8', 'backslashreplace') + with wlock: + want_erase_line = len(value) < len(self.value) and '\n' in value + self.value = value + self.update_locked(erase_line=want_erase_line) + fd.flush() + + def prepare_redraw(self): + global epoch + if self.born != epoch: + return None + saved = get_position() + if saved < self.pos or saved == (1, 1): + epoch += 1 + return None + goto(self.pos) + return saved + + def update_locked(self, erase_line=False): + prev_pos = self.prepare_redraw() + if prev_pos is None: + for cell in cells: + cell.draw() + return + erased_line = None + if erase_line: + do('el') + erased_line = self.pos[0] + put(self.value) + pos = get_position() + if pos == self.pos_after: + goto(prev_pos) + return + if pos < self.pos_after: + do('el') + erased_line = self.pos[0] + old_after = self.pos_after + self.pos_after = pos + + cell = self # in case there are no more cells + for cell in cells.iter_after(self): + if old_after != cell.pos: + # do not merge gaps + break + pos = get_position() + if erased_line != pos[0]: + if pos[0] < cell.pos[0]: + # the cell moved up, erase its line + do('el') + erased_line = pos[0] + elif cell.pos == pos: + # cell got neither moved nor erased + break + + if pos[1] < cell.pos[1]: + # the cell moved left, it must be same line as self; erase if not yet erased + if not erase_line and erased_line != pos[0]: + do('el') + erased_line = pos[0] + + old_after = cell.pos_after + cell.draw() + if cell.pos_after == old_after and erased_line != old_after[0]: break - elif c >= 0x20 and c <= 0x2f: - cmd[2] = c - break - i += 1 - return cmd, args, end + 1 - -def parse_utf8(buf, offset): - c0 = buf[offset] - n = 0 - if c0 & 0b11100000 == 0b11000000: - n = 2 - elif c0 & 0b11110000 == 0b11100000: - n = 3 - elif c0 & 0b11111000 == 0b11110000: - n = 4 - elif c0 & 0b11111100 == 0b11111000: - n = 5 - elif c0 & 0b11111110 == 0b11111100: - n = 6 - if n: - return offset + n - -def parse(s): - global _graphics_mode - if isinstance(s, six.text_type): - s = s.encode('utf8') - out = [] - buf = bytearray(s) - i = 0 - while i < len(buf): - x = None - c = buf[i] - if c >= 0x20 and c <= 0x7e: - x = (STR, [six.int2byte(c)]) - i += 1 - elif c & 0xc0: - j = parse_utf8(buf, i) - if j: - x = (STR, [b''.join(map(six.int2byte, buf[i : j]))]) - i = j - elif c == 0x1b and len(buf) > i + 1: - c1 = buf[i + 1] - if c1 == ord('['): - ret = parse_csi(buf, i + 2) - if ret: - cmd, args, j = ret - x = (CSI, (cmd, args, b''.join(map(six.int2byte, buf[i : j])))) - i = j - elif c1 == ord(']'): - # XXX: this is a dirty hack: - # we still need to do our homework on this one, but what we do - # here is supporting setting the terminal title and updating - # the color map. we promise to do it properly in the next - # iteration of this terminal emulation/compatibility layer - # related: https://unix.stackexchange.com/questions/5936/can-i-set-my-local-machines-terminal-colors-to-use-those-of-the-machine-i-ssh-i - try: - j = s.index('\x07', i) - except Exception: - try: - j = s.index('\x1b\\', i) - except Exception: - j = 1 - x = (OOB, s[i:j + 1]) - i = j + 1 - elif c1 in map(ord, '()'): # select G0 or G1 - i += 3 - continue - elif c1 in map(ord, '>='): # set numeric/application keypad mode - i += 2 - continue - elif c1 == ord('P'): - _graphics_mode = True - i += 2 - continue - elif c1 == ord('\\'): - _graphics_mode = False - i += 2 - continue - elif c == 0x01: - x = (SOH, None) - i += 1 - elif c == 0x02: - x = (STX, None) - i += 1 - elif c == 0x08: - x = (BS, None) - i += 1 - elif c == 0x09: - x = (STR, [b' ']) # who the **** uses tabs anyway? - i += 1 - elif c == 0x0a: - x = (LF, None) - i += 1 - elif c == 0x0d: - x = (CR, None) - i += 1 - - if x is None: - x = (STR, [six.int2byte(c) for c in bytearray(b'\\x%02x' % c)]) - i += 1 - - if _graphics_mode: - continue - - if x[0] == STR and out and out[-1][0] == STR: - out[-1][1].extend(x[1]) else: - out.append(x) - return out - -saved_cursor = None -# XXX: render cells that is half-way on the screen -def render_cell(cell, clear_after = False): - global scroll, saved_cursor - row, col = cell.start - row = row - scroll + height - 1 - if row < 0: - return - indent = min(cell.indent, width - 1) - for t, x in cell.content: - if t == STR: - i = 0 - while i < len(x): - if col >= width: - col = 0 - row += 1 - if col < indent: - put(' ' * (indent - col)) - col = indent - c = x[i] - if not hasattr(c, 'encode'): - c = c.decode('utf-8', 'backslashreplace') - put(c) - col += 1 - i += 1 - elif t == CSI: - cmd, args, c = x - put(c) - # figure out if the cursor moved (XXX: here probably be bugs) - if cmd[1] is None and cmd[2] is None: - c = cmd[0] - if len(args) >= 1: - n = args[0] + if cell.float: + # erase all screen after last float + do('ed') + if prev_pos > get_position(): + goto(prev_pos) + + def __repr__(self): + return '{}({!r}, float={}, pos={})'.format(self.__class__.__name__, self.value, self.float, self.pos) + + +class WeakCellList(object): + def __init__(self): + self._cells = [] + self._floats = [] + self._lists = self._cells, self._floats + + @property + def cells(self): + return self.iter_field(self._cells) + + @property + def floats(self): + return self.iter_field(self._floats) + + def iter_field(self, *Ls): + for L in Ls: + for iref in L[:]: + i = iref() + if i is None: + L.remove(iref) else: - n = None - if len(args) >= 2: - m = args[1] - else: - m = None - if c == ord('A'): - n = n or 1 - row = max(0, row - n) - elif c == ord('B'): - n = n or 1 - row = min(height - 1, row + n) - elif c == ord('C'): - n = n or 1 - col = min(width - 1, col + n) - elif c == ord('D'): - n = n or 1 - col = max(0, col - n) - elif c == ord('E'): - n = n or 1 - row = min(height - 1, row + n) - col = 0 - elif c == ord('F'): - n = n or 1 - row = max(0, row - n) - col = 0 - elif c == ord('G'): - n = n or 1 - col = min(width - 1, n - 1) - elif c == ord('H') or c == ord('f'): - n = n or 1 - m = m or 1 - row = min(height - 1, n - 1) - col = min(width - 1, m - 1) - elif c == ord('S'): - n = n or 1 - scroll += n - row = max(0, row - n) - elif c == ord('T'): - n = n or 1 - scroll -= n - row = min(height - 1, row + n) - elif c == ord('s'): - saved_cursor = row, col - elif c == ord('u'): - if saved_cursor: - row, col = saved_cursor - elif t == LF: - if clear_after and col <= width - 1: - put('\x1b[K') # clear line - put('\n') - col = 0 - row += 1 - elif t == BS: - if col > 0: - put('\x08') - col -= 1 - elif t == CR: - put('\r') - col = 0 - elif t == SOH: - put('\x01') - elif t == STX: - put('\x02') - elif t == OOB: - put(x) - if row >= height: - d = row - height + 1 - scroll += d - row -= d - row = row + scroll - height + 1 - cell.end = (row, col) - -def render_from(i, force = False, clear_after = False): - e = None - # `i` should always be a valid cell, but in case i f***ed up somewhere, I'll - # check it and just do nothing if something went wrong. - if i < 0 or i >= len(cells): - return - goto(*cells[i].start) - for c in cells[i:]: - if not force and c.start == e: - goto(*cells[-1].end) - break - elif e: - c.start = e - render_cell(c, clear_after = clear_after) - e = c.end - if clear_after and (e[0] < scroll or e[1] < width - 1): - put('\x1b[J') - flush() - -def redraw(): - for i in reversed(range(len(cells))): - row = cells[i].start[0] - if row - scroll + height <= 0: - # XXX: remove this line when render_cell is fixed - i += 1 - break - else: - if not cells: - return - render_from(i, force = True, clear_after = True) - -lock = threading.Lock() -def output(s = '', float = False, priority = 10, frozen = False, - indent = 0, before = None, after = None): - with lock: - rel = before or after - if rel: - i, _ = find_cell(rel.h) - is_floating = rel.is_floating - float = cells[i].float - if before: - i -= 1 - elif float and priority: - is_floating = True - float = priority - for i in reversed(range(len(cells))): - if cells[i].float <= float: + yield i + + def __iter__(self): + return self.iter_field(*self._lists) + + def iter_after(self, v): + it = iter(self) + for cell in it: + if cell == v: + break + return it + + def clear(self): + for c in self: + c.float = False + for L in self._lists: + del L[:] + + def insert(self, v, before): + L = self._lists[v.float] + for i, e in enumerate(self.iter_field(L)): + if e == before: + L.insert(i, weakref.ref(v)) + return + raise IndexError('output before dead cell') + + def append(self, v): + L = self._lists[v.float] + L.append(weakref.ref(v)) + + +cells = WeakCellList() + + +def get_position(): + global cached_pos, setup_done, need_scroll_update + if cached_pos: + return tuple(cached_pos) + + if not setup_done: + setup_done = True + setupterm() + #do('u7') + with rlock: + fd.write('\x1b[6n') + fd.flush() + s = os.read(fd.fileno(), 6) + while True: + if s[-1:] == b'R': + mat = re.findall(b'\x1b' + br'\[(\d*);(\d*)R', s) + if mat: + [[row, col]] = mat break - else: - is_floating = False - i = len(cells) - 1 - while i > 0 and cells[i].float: - i -= 1 - # put('xx %d\n' % i) - cell = Cell() - cell.content = parse(s) - cell.frozen = frozen - cell.float = float - cell.indent = indent - cell.start = cells[i].end - i += 1 - cells.insert(i, cell) - h = Handle(cell, is_floating) - if not s: - cell.end = cell.start - return h - # the invariant is that the cursor is placed after the last cell - if i == len(cells) - 1: - render_cell(cell, clear_after = True) - flush() - else: - render_from(i, clear_after = True) - return h - -def find_cell(h): - for i, c in enumerate(cells): - if id(c) == h: - return i, c - raise KeyError - -def discard_frozen(): - # we assume that no cell will shrink very much and that noone has space - # for more than MAX_TERM_HEIGHT lines in their terminal - while len(cells) > 1 and scroll - cells[0].end[0] > MAX_TERM_HEIGHT: - c = cells.pop(0) - del c # trigger GC maybe, kthxbai - -def update(h, s): - with lock: - try: - i, c = find_cell(h) - except KeyError: - return - if not c.frozen and c.content != s: - c.content = parse(s) - render_from(i, clear_after = True) - -def freeze(h): - try: - i, c = find_cell(h) - c.frozen = True - c.float = 0 - if c.content == []: - cells.pop(i) - discard_frozen() - except KeyError: - return + try: + s += os.read(fd.fileno(), 1) + except OSError as e: + if e.errno != errno.EINTR: + raise + continue + need_scroll_update = -1 + row = int(row) + scroll - 1 + col = int(col) - 1 + cached_pos = [row, col] + return tuple(cached_pos) + -def delete(h): - update(h, '') - freeze(h) +def output(s='', float=False, priority=10, frozen=False, indent=0, before=None): + with wlock: + if before: + float = before.float + + if isinstance(s, bytes): + s = s.decode('utf-8', 'backslashreplace') + if frozen: + for f in cells.floats: + f.prepare_redraw() + break + ret = put(s) + for f in cells.floats: + f.draw() + return ret + + c = Cell(s, float) + if before is None: + cells.append(c) + c.draw() + else: + before.prepare_redraw() + cells.insert(c, before) + c.draw() + for f in cells.iter_after(c): + f.draw() + return c diff --git a/pwnlib/term/unix_termcap.py b/pwnlib/term/unix_termcap.py index f850ddb41..c6025e40b 100644 --- a/pwnlib/term/unix_termcap.py +++ b/pwnlib/term/unix_termcap.py @@ -32,7 +32,7 @@ def get(cap, *args, **kwargs): s = curses.tigetflag(cap) if s == -1: # default to empty string so tparm doesn't fail - s = '' + s = b'' else: s = bool(s) cache[cap] = s diff --git a/pwnlib/ui.py b/pwnlib/ui.py index b0dc96096..a0fc46eef 100644 --- a/pwnlib/ui.py +++ b/pwnlib/ui.py @@ -107,9 +107,9 @@ def yesno(prompt, default=None): yesfocus, yes = term.text.bold('Yes'), 'yes' nofocus, no = term.text.bold('No'), 'no' hy = term.output(yesfocus if default is True else yes) - term.output('/') + hs = term.output('/') hn = term.output(nofocus if default is False else no) - term.output(']\n') + he = term.output(']\n') cur = default while True: k = term.key.get() @@ -210,9 +210,9 @@ def options(prompt, opts, default = None): for i, opt in enumerate(opts): h = term.output(arrow if i == cur else space, frozen = False) num = numfmt % (i + 1) - term.output(num) - term.output(opt + '\n', indent = len(num) + len(space)) - hs.append(h) + h1 = term.output(num) + h2 = term.output(opt + '\n', indent = len(num) + len(space)) + hs.append((h, h1, h2)) ds = '' while True: prev = cur @@ -249,11 +249,11 @@ def options(prompt, opts, default = None): if prev != cur: if prev is not None: - hs[prev].update(space) + hs[prev][0].update(space) if was_digit: - hs[cur].update(term.text.bold_green('%5s> ' % ds)) + hs[cur][0].update(term.text.bold_green('%5s> ' % ds)) else: - hs[cur].update(arrow) + hs[cur][0].update(arrow) else: linefmt = ' %' + str(len(str(len(opts)))) + 'd) %s' if default is not None: @@ -361,6 +361,5 @@ def more(text): print(l) if i + step < len(lines): term.key.get() - h.delete() else: print(text) From b3d40438fb10ce59fde0d99f16d3acec36a2d7e9 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Mon, 4 Dec 2023 20:18:20 +0100 Subject: [PATCH 020/107] Fix support for amd64 x32 ABI (#2305) * Add back support for amd64 x32 ABI Recognize x32 ELF files as amd64. * Add x32 test binaries Regressed in fbf2727ac6f625f56fea9aa10cdb03a01a3b19e7 --- pwnlib/context/__init__.py | 2 +- pwnlib/data/elf/test-x32 | Bin 0 -> 10260 bytes pwnlib/data/elf/test-x32-pie | Bin 0 -> 10296 bytes pwnlib/data/elf/test-x32-relro | Bin 0 -> 13724 bytes pwnlib/data/elf/test-x32-relro-pie | Bin 0 -> 13768 bytes pwnlib/elf/elf.py | 1 + 6 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 pwnlib/data/elf/test-x32 create mode 100644 pwnlib/data/elf/test-x32-pie create mode 100644 pwnlib/data/elf/test-x32-relro create mode 100644 pwnlib/data/elf/test-x32-relro-pie diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 10a7a4f9c..507403e8b 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -787,7 +787,7 @@ def arch(self, arch): try: defaults = self.architectures[arch] except KeyError: - raise AttributeError('AttributeError: arch must be one of %r' % sorted(self.architectures)) + raise AttributeError('AttributeError: arch (%r) must be one of %r' % (arch, sorted(self.architectures))) for k,v in defaults.items(): if k not in self._tls: diff --git a/pwnlib/data/elf/test-x32 b/pwnlib/data/elf/test-x32 new file mode 100644 index 0000000000000000000000000000000000000000..7c07e4df906076218ccb145294fba05ee339fc1e GIT binary patch literal 10260 zcmeHNTWl0n82)$LLIrIrLac%^C^hxMxLZ~u8gu{)iy@{epg!n!+THDLYYbN*k(d}VU)tp&St4`bVk{=)SkjFK zL_K^&9k3hr?vSN$A#8#%xD`-AEQOP3Krk*XejK%64#b;bQD~@+8!!ySff=Yob^93u zz6fH#W(;~4zMtUxefHv9IpW_6)7;xVk^NqCcA(99jXxEalA(#5l%6pbpq@ z>lS&Z_wm+Yd(FL-$J2X%-un4-vGE6b$Y}+bFLLm_6ZEl7c)O=#`l>IEN1Z$hIpk94 z*HDgsC@!w@FMv*Hp}txhsA)%P>}zXm=30vZW_!*_iyAADC^>fTeTm-8eTlT4 z?U#~Mbn^XTJNc|65=dt+8AT^CU}tkuD%!cE6pGoLlSVjO%J;5Xl_>SvxwMeWTwg02 zHf>zHF418|XVsN4(EA4RIls3AXAwruyuXmDIlr)MLWH@cJpat|c(rx16*_%yD?2PU zgOCc=;T->=ex=TZ0BP;8WG)vg#GuZX18Jx3zoZCtwJ}7lqdwQ;SkxOmJt%_=1Q`f2 z5M&_8K#+kT13?CY3B z-L{h`o0nROpJ8PBgzLKLF}Ba}+hzL0S)1Q1(+6j5ez#1&HEZ+RW%`v_o8K?f&z`Z} zwns2px_Rl%-u&FQ`)ll6jh(Ks@2#=7{>hGhyQciXXl(h&WPSO>$jM6A=FaFu^!+18 zK0enHchP5t$f@R~J1{A4{6lF|n`7f$_^?{d!dW;@0unZVKkf2_`$c-}P2N_Xy0h((Orx7v)PB`!}0PbUYB>WRl~U7 z+mR{SpdSPM7+SZ(RK&i~Ei=h07phr04O15U?_(MAY1A4$vnn}mAVCI#3)8jWE30Lt-Ic6-_kRfa|VrQ)Qp*t712RuMjz?uFe9krvvm8($97g9xM*mtd2yK#kM_lcrs>{3R|dBc5E?InMAs152O;A zBs$TS*EC@li#Ddm7Fx#$_COY$_2tnQ3U-efs?K^!B{6&R0|TiX_tL)=t}Ctst|RY` zjlVYi4j7}H2XIZ1=iOxySq@zb*D&QWK=ZsiE#7?=6-1$VtEzZ2A>6IOK!zq&@isvJ z1#6V!a(^s=!u9N5Yf$~M&)Wb#3whi(F(_luITtiGc-WYge2y}ZCRchYL zuylVF@G1zrMTalsQC6lezU8r1K#Ec<)jNrd?> z$WwR0z?*{3bwFWX{4M?#;QYwrU7ZSeI%jYx4tYNUnkOBW$R*x7fLjSU#P5LS#lee% yN52-1OX0OV`Z+HDf!qb2j;S~c2=5NDzlgHH1+V&jFs7k$;`6qF*UW$~TKxm<%#aKK literal 0 HcmV?d00001 diff --git a/pwnlib/data/elf/test-x32-pie b/pwnlib/data/elf/test-x32-pie new file mode 100644 index 0000000000000000000000000000000000000000..454b212366147a88b39c6a71628c35bb09112bf2 GIT binary patch literal 10296 zcmeHNYitx%7`Q%t34iUm^jUkg@wun&G2}OVlDp$an|hOBEp`WSwOEUc^DaNH{)E z`Nl-NXJA>wjfrqwBA)CYsDq&zDYXGH=9mqz#_e}^iFE#c|nG3L9Tp-f7!>jSQZo+ zv!FjwWGm3=lR|xsG|TIh!#%>!_1hegwV`X96?-$UNSOfs85S0g^|&cVfcFov`{3T)DrRax=3f@ zNiza(+(`8{HHC~`Eg2E)%1d^$XkW9sr8U%`2FBH8jUu$Vb8RTBXY^>?F!fC5+SWuW zsds8U2_31TeW|27aLA!vlE^FM!xeM>s5zDo{)cgTytb5Aw!DI+HA(2u>Dy`BB_hor zg!f4q+T*zA1?~yzTcMi`j?Oj+Om+*}L7j^O@*wpoj^0h33kDLSKGo6ZLZ8Bg1yQKG z3#^v9y|8fYsq+Sa+(Mm`fUKZi?&#jptAJMluL52Lyb5>~@G9U{z^i~)f&W*5-zygU z9UT6-ESU4J#ye5)*}Pd|eH9$uSGLzqY~6ICS_rG=M;t4vRtWNAjEtSIEGx3vw)tK# z_Vu{UcZ0D{$8G-aKel7s=Kud=Z;so12N-+tylvI&$7qp?syl@}o>h~aU`Hm{k4~^3 zm|)*M!CrNN9XPczdnDJmXn0>~_Qddyr#m{^0{Otfk>&%Kmo=vvR&{M(>qPhz}jx#peFM-QE|tkDQ+x8MIRY~Le$ zojes)LjuD7W9ty6(v>|q{BuV%yWyi?_H;DcwmY0Ft>G^P&7~P05+~7AC1)q0=`49P;_6a+n<7g|~NP8ffYdbJ9XB)eHo!uYIe($90 zWH0~QZnn=yX@h~1Jfo(b6th-lG*kwP5)>!{0F%*c{=vGJ-<>puqR#xyb5>~ z@G9U{z^i~)0j~mH1-uG)74RzXUlrh9VT~bTS~@+bgtbAVTB$M0#p8NrP_dn`!{uUG z0Grspd6RC#R-wHY{Kv1B)eSv-+Oqg&Y@&S)?NPMc*Zuf6%i4yPd({-*`ul`$pwc&Q z`joQGK4%|tKKw)A*OGAOlu88+^KU|Kdv9`P<*J!;@2Z%#u53u$aZS?=%N8xHM7$F? z1`c%!TmB|-)SVN3%>5)V74tYuN88NG=So^;OfK1n8PMVEcXFQ-)3NtUr_+gKcqtXT zXF2=J+#8(-n?G6b8wT!=GB@o%&snMY_^pFKUlh=C`*Jy2z6a+4ZiRAga{!9H1&aMl z{yY){SQ~DgUIm1aka{UvPOlr__9^GYeRcZ&v8)v4T84Mv)KMhETRm-o5~e^7x9xV@wA&83t;4>&BlnZrTU&2cYP)*+lV-mX2&j!}eO;j6 zHUm#JG^q8Bi(R)6suAPHyw)RB?6vEev`~{NQ&*$Oezm7Rj?X0G;UZT$lS=CubI^6I zY*}4rYEfa+W10~YYIrbd4E8y#nQSh=ZL9Yo;btJr;^&v_3r)3nQDfoE#x7lhH6w_K-S;()!{^=5+5d459X> z`ug;wd3n`!Sn|6KuC?OtaAXdy8_Jac*ByECdzVGfrEr~7t_LKq_`4T7h=b%c74Zrf zgis`@h}RDN4Av{hSHOYDLzhA> zMFV)>kjHz5mzoBiI9Nj670LS;w&X2UoNucd zB?+zM9V+5=gGamppA^aa7LJ(!F01pMm@=LNE;}E&KL8Z~d3^SZ>Pz!ZA;fD&p8Z`J zcxRz=y-=8o&+yj)A7JOhbC4e*rO`+shd2XBUK+eKc=St==TU%ze&!nhZvZ?QBbPZS d{KSuXy=^(X;yN=XVb9Iwy@h<`47eiIe*t`3t_}bI literal 0 HcmV?d00001 diff --git a/pwnlib/data/elf/test-x32-relro b/pwnlib/data/elf/test-x32-relro new file mode 100644 index 0000000000000000000000000000000000000000..d8de7430d05ac2c42ff336914d591badd4ef876e GIT binary patch literal 13724 zcmeHOTWl0n82)$LLIrFqf}$m`8j5)7&~2*;3Oa&?g%CvrFArur?e4Z4+TG3WR9mk# z^^&EK6d%+FAB-V}m_8ukffync8o-2@>Vuc~Vhox#-l|qZ6dAwo%pAI|n&_K}=Wo6_ z|K&TE`RANXrsvF4ZCf{nLLt!-mRp6^be%1&DAz{)NUKC-fvl3HQZIAhVysojv1Jey zh)Vc~3g8gzLm^w?O4tNra4VpI*b0>hD9}|G#8C>yK)e|ig{snc1V#jL;2czf?d$sc zEs_1V+6wLHGy!njjH5X@fcOE#iLPa z8{#)aL~g*?2tQY|@w*WR{ZGRFdE56OUON5<&=QON3^bVq+n^Xi^NV^2EM*WU=k zDrBu@#K>6$Q~;aq+#y#tZmGHDn!9eStlL@N`QE3|qoW^fA!iA|e3FBFjM2wB;Xz+# zKlE`t)XAfeLqCOn4dwWo%d!&xLg<7R>g%+Dl6F&>eN&muXQ3qmVAsNUS*BRct$)7_MyKYd`dJ(Xl;k6UAeD zs-#9R@>uc1Sn;G9(&Vo5o)-kaytq8LCkT$cH4iPl4G1buZiE}np6VKIJGE!=QC9n) zcp_H($Zzs~)~Y%jw03fmHt458KaJX}U@BtQ@Q!nd>ldj}x>b`l{O@8K@@~`|y)Y}; zuMv|0lL3TmwDcN z6gJ-jY5#QI%dQRE>fQAWN*2|1wHLAfm` z+k-L}l!HO3$bWI!v|+=|kySf7`Z8``BpS6^t)|9kpE9FQHaA;Mt=9%_5v$P61Jq83 zSU4h`%;&_)WZk6ImFcrO`qDU-o=%jwa`|j7nRf>Q*X`>!H@Z%jD0;V3=oTw6kSPrG z`lXxqBlr(QA)U?q!H6T4Pxd&h5NNp`m!nAI3e_qkJH>L7{V-GTf|N}-t|L~mJD$or zy~%iY0*z?PuNrsqc?ZK|4XvXGr#Fqpy0U1?Z=<775UVrW+ndbrUmyQiIJY<#IG6ly zBK-NO8(@rbDZqI}p8xHE$O`CMIFBhS0nPKjLGZsnP(fTYZ%qkrX&7q(4M*V9qIsL( z_!;w({c?@0g~B-<95Yw#k$X45dm)c&XFHS;=o}00fgG-(2LY}h^3H^9z+Yo9mFW9* zU~yfL$2HN8N(-Uue(5JN0M`+9t|b?|Cg`R8!jvZfj)6R`&3)jN-v`&|^8s%?O0MN2 z;Bk$!U#@SqLEc^<1gP5d(+@eBXE$8K**!K4rm^K1NSWy^?Rs-xajeX20Z4)|7J$ydg_5_-XYj*k39d| z75_V*fOet1VGi+G!J!o$gG=eOKL%<6^7xxQ`Zv5Y zi1S&Hr@q|*?<{oA0}9*XZ|^q%??d&A-|+o74fFtPE#weC0GcPZttJ)yTJ%`i2mNf1 l2YITS{&*j3gYp|d9bqNpmFAf-4YsAF1w8$I2YtG|-vNdZnd$%l literal 0 HcmV?d00001 diff --git a/pwnlib/data/elf/test-x32-relro-pie b/pwnlib/data/elf/test-x32-relro-pie new file mode 100644 index 0000000000000000000000000000000000000000..67bd00e7284d678ba2c0a9f59f176c73ef8078a4 GIT binary patch literal 13768 zcmeHOeQXqE9)7p5Pz$y_g@}T5H1vWZL$|G7dS|s#DvJSAwKXwnw$twHcEfgeGc(ne zle0af?W2@3fdIj{s14#MsS~eP_=tw%8jJv^p%UTxcOrg;CWM5{ zlZ@YlIOx9;_Rmwk8S(J=3+RhreH3CtHq$%Q)VLv=T%XP428Y(e(Cxh5h!{D`0A7R5 zH+G8$CcoGnyKv_x+jVQxzdGO9)t0W_LCy+*`6LJVDAUI}6(hdRe(2+PsFOz_hkgq4 zxCCI_yEbhR&xR?Em~RiT49n_}aUS%)hHMQweNw1zl?F=M4fE`ddG_NWTZ4XK$Y%X# zL$(H;ajVssaYhp zbZtu{P0LJYY{#^^wzX&TIkU^?&6;Q`J&?}@9VdM18Hv0?5nM6ycfUdJBXJoxYbmyFwHggz!G9M0pI)gvSDX5A=m?zMths*W&&O5_*g}CkJGb`eI+7 zrp^finW27;uRjNUF(($}@6>|{wvW0uu`ofYW0aIb)Hxu?Vd_=Bu8t}LDg!D5Dg!D5 zDg!D5Dg!D5Dg(crf&bR5{vkg4b!EI1{dj{A@%zh8g?l(YdZ2Q@SJA!Fg4?ZkaIC3o z6Xf?ZGWEIZx~Xx`=I{QgqjNTY`%k?#XY;rH)QfXAf8S3%J!kVb{?wyC+iv}>=q*)K zw@G;Yx%IPnTMyf(=GouOv%i{We>%_p;1_o6#C63ZrRFuG2No7TAN_K=v#TRkj=ee7 zdI;lkm;VFglQnhs!4P7s^(f4-=md@}Gfr(O`UEs&ZBeo89!rhyPo;FpWxmE*pC1U%<7NG+yAh_+T|7Seb!WP`^WX8}bh_BFFIiex z&%XpfKOHNNbsR3fHWoc`F1jekiyy>`Z|q|mlMkYgAo%XDf)543@;~_+_8(S2#mRQK z(d?mgspHVt^1ZBfw0JOH{LpW*i?yQ91g*U>NgMPD&?iv49;Qc3m%2|U*Ddo#=|m@6 z;eV4elc(d&+n;ADJ657HpfaE`pfaE`pfaE`pfaE`pfaE`pfYf_3~(*5-WL5vp)jl^ zjbZx|t=_H@cbV3(<~d;}t3*=_i`bEs3;x12SiY{G{ML1QP$s8cmv6=n%H1g6L&3K#)@EeV?z*J>!({=;b7TYIdoy}o+I z4K+*dt{f59Uet1V)0#_JuM7AH9O@L7{F}sk!Ip;4bX3na45$pK45$pK45$pK45$pK45$pK45$qJKQq8RrrcY~C1vhWUCP1W1rG~_Vjni? za!)V!qpn2BWn}Iv=blu)@6rC>ted|Y>(6{gU4?aLZW+A;HrFQ00Jop=eQ`NJ;nMUt z_K0PaJB)YqWoD`OA9Evp>UYJk2UT{n-hR$^T;e-e#hrIoh8Yi<4$ z*x#dMAHP?)AN@?y5WMWR1!ZSY_5@`iC`W?wOl_Ra$NjsT+uQ%Ft?lj|%sGQvET%W> z4eMiro*DaFW24^Cd|BWYLbv<55!&b#I`%f3Rzc{wykqL=+@Rh&n8CL6OfuvuSowl! zIm3bLx{X`bJ4RY~^nSzc7kY9yXAckfrDORK`~||!gkf0*#>pB|M_0x`295dE zdu?0jeffa_Gv}NwpJ(#Ree#@V;qM|Omve@4KEOFgp8Wn`4Rk4-W5A!gC;pQ}8x`^PW83 zheR2=6nVY|9K2`9g{K zP~QmfJ|}qplgIug?-A%6t5=^V2JqPT3;q{CE2gb4Ur~q3EIm9VI@ Date: Wed, 6 Dec 2023 23:48:33 +0100 Subject: [PATCH 021/107] Nicer error when running tmux exploit outside tmux (#2314) When you set the `context.terminal` to be tmux related but then try to run the exploit outside a tmux session, you'd get a cryptic ValueError while trying to parse the pid of the new pane in tmux. Print a nicer reminder to start tmux first. --- pwnlib/util/misc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index f0ee62d96..7977f7a77 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -410,7 +410,12 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr if terminal == 'tmux': out, _ = p.communicate() - pid = int(out) + try: + pid = int(out) + except ValueError: + pid = None + if pid is None: + log.error("Could not parse PID from tmux output (%r). Start tmux first.", out) elif terminal == 'qdbus': with subprocess.Popen((qdbus, konsole_dbus_service, '/Sessions/{}'.format(last_konsole_session), 'org.kde.konsole.Session.processId'), stdout=subprocess.PIPE) as proc: From 84b6c82ff346282c0c26902b732b90a26617358d Mon Sep 17 00:00:00 2001 From: Arusekk Date: Mon, 11 Dec 2023 06:21:13 +0100 Subject: [PATCH 022/107] term: simplify even further --- pwnlib/term/key.py | 1 + pwnlib/term/term.py | 128 ++++++++++++++++++-------------------------- pwnlib/tubes/ssh.py | 2 +- pwnlib/ui.py | 7 --- 4 files changed, 54 insertions(+), 84 deletions(-) diff --git a/pwnlib/term/key.py b/pwnlib/term/key.py index dead924fc..e21477a46 100644 --- a/pwnlib/term/key.py +++ b/pwnlib/term/key.py @@ -22,6 +22,7 @@ except Exception: _fd = os.open(os.devnull, os.O_RDONLY) def getch(timeout = 0): + term.setupterm() while True: try: rfds, _wfds, _xfds = select.select([_fd], [], [], timeout) diff --git a/pwnlib/term/term.py b/pwnlib/term/term.py index 2176dd2e7..d8062bfa5 100644 --- a/pwnlib/term/term.py +++ b/pwnlib/term/term.py @@ -27,15 +27,11 @@ # we assume no terminal can display more lines than this MAX_TERM_HEIGHT = 200 -# default values -scroll = 0 - # list of callbacks triggered on SIGWINCH on_winch = [] cached_pos = None settings = None -need_scroll_update = -1 setup_done = False epoch = 0 @@ -80,7 +76,7 @@ def update_geometry(): width, height = shutil.get_terminal_size() def handler_sigwinch(signum, stack): - global cached_pos, winchretry, need_scroll_update + global cached_pos, winchretry with wlock.guard: while True: if not wlock.acquire(False): @@ -88,7 +84,6 @@ def handler_sigwinch(signum, stack): return winchretry = False - need_scroll_update = epoch update_geometry() for cb in on_winch: cb() @@ -101,14 +96,16 @@ def handler_sigstop(signum, stack): os.kill(0, signal.SIGSTOP) def handler_sigcont(signum, stack): - global epoch, cached_pos, scroll, setup_done + global epoch, cached_pos, setup_done epoch += 1 cached_pos = None - scroll = 0 setup_done = False def setupterm(): - global settings + global settings, setup_done + if setup_done: + return + setup_done = True hide_cursor() update_geometry() do('smkx') # keypad mode @@ -121,6 +118,7 @@ def setupterm(): mode[CC][termios.VMIN] = 1 mode[CC][termios.VTIME] = 0 termios.tcsetattr(fd, termios.TCSADRAIN, mode) + fd.flush() def resetterm(): global settings, setup_done @@ -131,6 +129,7 @@ def resetterm(): setup_done = False show_cursor() do('rmkx') + fd.flush() def init(): atexit.register(resetterm) @@ -168,42 +167,45 @@ def hook(*args): tmap = {c: '\\x{:02x}'.format(c) for c in set(range(0x20)) - {0x09, 0x0a, 0x0d, 0x1b} | {0x7f}} def put(s): - global cached_pos, scroll + global cached_pos, epoch + s = s.translate(tmap) if cached_pos: it = iter(s.replace('\n', '\r\n')) + sanit_s = '' for c in it: if c == '\r': cached_pos[1] = 0 elif c == '\n': cached_pos[0] += 1 - if cached_pos[0] >= height: - scroll = max(scroll, cached_pos[0] - height + 1) elif c == '\t': cached_pos[1] = (cached_pos[1] + 8) & -8 elif c in '\x1b\u009b': # ESC or CSI + seq = c for c in it: - if c not in '[]0123456789;:': + seq += c + if c not in '[0123456789;': break else: - # unterminated ctrl seq, just discard cache - cached_pos = None - break + # unterminated ctrl seq, just print it visually + c = seq.replace('\x1b', r'\x1b').replace('\u009b', r'\u009b') + cached_pos[1] += len(c) # if '\e[123;123;123;123m' then nothing if c == 'm': - pass + c = seq else: - # undefined ctrl seq, just discard cache - cached_pos = None - break + # undefined ctrl seq, just print it visually + c = seq.replace('\x1b', r'\x1b').replace('\u009b', r'\u009b') + cached_pos[1] += len(c) elif c < ' ': - # undefined ctrl char, just discard cache - cached_pos = None - break + assert False, 'impossible ctrl char' else: # normal character, nothing to see here cached_pos[1] += 1 - return fd.write(s.translate(tmap)) + sanit_s += c + else: + s = sanit_s.replace('\r\n', '\n') + return fd.write(s) def do(c, *args): s = termcap.get(c, *args) @@ -211,7 +213,7 @@ def do(c, *args): fd.write(s.decode('utf-8')) def goto(rc): - global cached_pos, scroll + global cached_pos r, c = rc nowr, nowc = cached_pos or (None, None) cached_pos = [r, c] @@ -220,30 +222,17 @@ def goto(rc): if r == nowr + 1: fd.write('\n') return - if r == nowr: - if c != nowc: - fd.write('\r') - return - - if nowc == c: - if r == nowr - 1: - do('cuu1') - elif r < nowr: - do('cuu', nowr - r) - elif r > nowr: - do('cud', r - nowr) - return - - if r == nowr: + if c != nowc: + fd.write('\r') + elif c != nowc: do('hpa', c) - return - if need_scroll_update == epoch and nowr is not None: - cached_pos = None - diffr, diffc = get_position() - scroll += nowr - diffr - cached_pos = [r, c] - do('cup', r - scroll, c) + if r == nowr - 1: + do('cuu1') + elif r < nowr: + do('cuu', nowr - r) + elif r > nowr: + do('cud', r - nowr) class Cell(object): @@ -261,7 +250,15 @@ def update(self, value): if isinstance(value, bytes): value = value.decode('utf-8', 'backslashreplace') with wlock: - want_erase_line = len(value) < len(self.value) and '\n' in value + want_erase_line = False + if '\n' in value: + if len(value) < len(self.value): + want_erase_line = True + elif '\n' not in self.value: # not really supported + for cell in cells.iter_after(self): + if cell.value: + want_erase_line = True + break self.value = value self.update_locked(erase_line=want_erase_line) fd.flush() @@ -390,34 +387,9 @@ def append(self, v): def get_position(): - global cached_pos, setup_done, need_scroll_update - if cached_pos: - return tuple(cached_pos) - - if not setup_done: - setup_done = True - setupterm() - #do('u7') - with rlock: - fd.write('\x1b[6n') - fd.flush() - s = os.read(fd.fileno(), 6) - while True: - if s[-1:] == b'R': - mat = re.findall(b'\x1b' + br'\[(\d*);(\d*)R', s) - if mat: - [[row, col]] = mat - break - try: - s += os.read(fd.fileno(), 1) - except OSError as e: - if e.errno != errno.EINTR: - raise - continue - need_scroll_update = -1 - row = int(row) + scroll - 1 - col = int(col) - 1 - cached_pos = [row, col] + global cached_pos + if not cached_pos: + cached_pos = [0, 0] return tuple(cached_pos) @@ -431,10 +403,14 @@ def output(s='', float=False, priority=10, frozen=False, indent=0, before=None): if frozen: for f in cells.floats: f.prepare_redraw() + do('ed') # we could do it only when necessary break ret = put(s) for f in cells.floats: f.draw() + for f in cells.floats: + fd.flush() + break return ret c = Cell(s, float) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 01e6eed36..1d2a2e48e 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -124,7 +124,7 @@ def resizer(): pass self.resizer = resizer - term.term.on_winch.append(self.resizer) + term.term.on_winch.append(self.resizer) # XXX memory leak else: self.resizer = None diff --git a/pwnlib/ui.py b/pwnlib/ui.py index a0fc46eef..0a55e9236 100644 --- a/pwnlib/ui.py +++ b/pwnlib/ui.py @@ -43,14 +43,7 @@ def ehook(*args): cmd = "import coverage; coverage.process_startup()\n" + cmd env.setdefault("COVERAGE_PROCESS_START", ".coveragerc") p = process([sys.executable, "-c", cmd], env=env, stderr=subprocess.PIPE) - try: - p.recvuntil(b"\33[6n") - except EOFError: - raise EOFError("process terminated with code: %r (%r)" % (p.poll(True), p.stderr.read())) # late initialization can lead to EINTR in many places - fcntl.ioctl(p.stdout.fileno(), termios.TIOCSWINSZ, struct.pack("hh", 80, 80)) - p.stdout.write(b"\x1b[1;1R") - time.sleep(0.5) return p def yesno(prompt, default=None): From 07ea0fa1859a1d10cf96662f38158a39c23ceeb0 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Mon, 11 Dec 2023 18:41:15 +0100 Subject: [PATCH 023/107] term: hotfix --- pwnlib/ui.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pwnlib/ui.py b/pwnlib/ui.py index 0a55e9236..f03491cdd 100644 --- a/pwnlib/ui.py +++ b/pwnlib/ui.py @@ -42,8 +42,11 @@ def ehook(*args): if "coverage" in sys.modules: cmd = "import coverage; coverage.process_startup()\n" + cmd env.setdefault("COVERAGE_PROCESS_START", ".coveragerc") + env['COLUMNS'] = '80' + env['ROWS'] = '24' p = process([sys.executable, "-c", cmd], env=env, stderr=subprocess.PIPE) # late initialization can lead to EINTR in many places + fcntl.ioctl(p.stdout.fileno(), termios.TIOCSWINSZ, struct.pack('HH', 24, 80)) return p def yesno(prompt, default=None): From 6f4682a41a8d2efb69a819e1d16611aae9b5eec1 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Mon, 11 Dec 2023 19:56:12 +0100 Subject: [PATCH 024/107] android: enable kvm --- .github/workflows/android.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 76cae56a5..19a6b48a7 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -37,6 +37,7 @@ jobs: - name: Install Android AVD run: | + sudo usermod -aG kvm $USER source travis/setup_avd_fast.sh sed -i 's/skip_android = True/skip_android = False/' docs/source/conf.py set | grep ^PATH >.android.env From fbce30675a612d21caa2297adb8e20c1a0165dc0 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Mon, 11 Dec 2023 23:04:08 +0100 Subject: [PATCH 025/107] Enable unprotected grpc in Android tests WARNING | The emulator now requires a signed jwt token for gRPC access! Use the -grpc flag if you really want an open unprotected grpc port --- travis/setup_avd_fast.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/setup_avd_fast.sh b/travis/setup_avd_fast.sh index 577ddc287..113682554 100644 --- a/travis/setup_avd_fast.sh +++ b/travis/setup_avd_fast.sh @@ -18,7 +18,7 @@ yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;d yes | sdkmanager --sdk_root="$ANDROID_HOME" --licenses echo no | avdmanager --silent create avd --name android-$ANDROID_ABI --force --package "system-images;$ANDROIDV;default;$ANDROID_ABI" -"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot & +"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot -grpc & adb wait-for-device adb shell id adb shell getprop From 0c6d5f5e717b7821da8b96d5bc85ea71057a251c Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Mon, 11 Dec 2023 23:31:49 +0100 Subject: [PATCH 026/107] android: Disable emulator GPU Android Emulator 33.1.23 received a Graphics backend upgrade --- travis/setup_avd_fast.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/setup_avd_fast.sh b/travis/setup_avd_fast.sh index 113682554..25e711475 100644 --- a/travis/setup_avd_fast.sh +++ b/travis/setup_avd_fast.sh @@ -18,7 +18,7 @@ yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;d yes | sdkmanager --sdk_root="$ANDROID_HOME" --licenses echo no | avdmanager --silent create avd --name android-$ANDROID_ABI --force --package "system-images;$ANDROIDV;default;$ANDROID_ABI" -"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot -grpc & +"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot -gpu off & adb wait-for-device adb shell id adb shell getprop From 5f5554fa1cab03a97a6838f5b7d7e56a1d3dcc66 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 12 Dec 2023 19:02:13 +0100 Subject: [PATCH 027/107] Detect challenge binary and libc in `pwn template` (#2309) * Detect challenge binary and libc in `pwn template` When the `args.exe` or `args.libc` arguments are missing, look for the files in the current working directory. This allows to quickly get a template by just running `pwn template` (and maybe --host --port for remote instances). This is inspired by https://github.com/io12/pwninit * Update CHANGELOG * Add --no-auto argument to disable automatic detection Allow to keep the old static template behavior. * Add logging about detection outcome Inform the user that we're looking for the binaries and if we found one. * Be more strict about libc filename detection Check about common name patterns instead of plainly the presence of "libc" in the name. Co-authored-by: Arusekk * Change --no-auto argument to reduce double negation Co-authored-by: Arusekk --------- Co-authored-by: Arusekk --- CHANGELOG.md | 2 ++ pwnlib/commandline/template.py | 55 ++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 180ac9439..d708f76c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2293][2293] Add x86 CET status to checksec output - [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it - [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found +- [#2309][2309] Detect challenge binary and libc in `pwn template` [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -83,6 +84,7 @@ The table below shows which release corresponds to each branch, and what date th [2293]: https://github.com/Gallopsled/pwntools/pull/2293 [1763]: https://github.com/Gallopsled/pwntools/pull/1763 [2307]: https://github.com/Gallopsled/pwntools/pull/2307 +[2309]: https://github.com/Gallopsled/pwntools/pull/2309 ## 4.12.0 (`beta`) diff --git a/pwnlib/commandline/template.py b/pwnlib/commandline/template.py index f68461cb6..6e5f74655 100644 --- a/pwnlib/commandline/template.py +++ b/pwnlib/commandline/template.py @@ -9,24 +9,54 @@ parser = common.parser_commands.add_parser( 'template', help = 'Generate an exploit template', - description = 'Generate an exploit template' + description = 'Generate an exploit template. If no arguments are given, ' + 'the current directory is searched for an executable binary and ' + 'libc. If only one binary is found, it is assumed to be the ' + 'challenge binary.' ) # change path to hardcoded one when building the documentation printable_data_path = "pwnlib/data" if 'sphinx' in sys.modules else pwnlib.data.path -parser.add_argument('exe', nargs='?', help='Target binary') +parser.add_argument('exe', nargs='?', help='Target binary. If not given, the current directory is searched for an executable binary.') parser.add_argument('--host', help='Remote host / SSH server') parser.add_argument('--port', help='Remote port / SSH port', type=int) parser.add_argument('--user', help='SSH Username') parser.add_argument('--pass', '--password', help='SSH Password', dest='password') -parser.add_argument('--libc', help='Path to libc binary to use') +parser.add_argument('--libc', help='Path to libc binary to use. If not given, the current directory is searched for a libc binary.') parser.add_argument('--path', help='Remote path of file on SSH server') parser.add_argument('--quiet', help='Less verbose template comments', action='store_true') parser.add_argument('--color', help='Print the output in color', choices=['never', 'always', 'auto'], default='auto') parser.add_argument('--template', help='Path to a custom template. Tries to use \'~/.config/pwntools/templates/pwnup.mako\', if it exists. ' 'Check \'%s\' for the default template shipped with pwntools.' % os.path.join(printable_data_path, "templates", "pwnup.mako")) +parser.add_argument('--no-auto', help='Do not automatically detect missing binaries', action='store_false', dest='auto') + +def detect_missing_binaries(args): + log.info("Automatically detecting challenge binaries...") + # look for challenge binary, libc, and ld in current directory + exe, libc, ld = args.exe, args.libc, None + other_files = [] + for filename in os.listdir(): + if not os.path.isfile(filename): + continue + if not libc and ('libc-' in filename or 'libc.' in filename): + libc = filename + elif not ld and 'ld-' in filename: + ld = filename + else: + if os.access(filename, os.X_OK): + other_files.append(filename) + if len(other_files) == 1: + exe = other_files[0] + elif len(other_files) > 1: + log.warning("Failed to find challenge binary. There are multiple binaries in the current directory: %s", other_files) + + if exe != args.exe: + log.success("Found challenge binary %r", exe) + if libc != args.libc: + log.success("Found libc binary %r", libc) + return exe, libc def main(args): @@ -44,19 +74,20 @@ def main(args): if not (args.path or args.exe): log.error("Must specify --path or a exe") - s = ssh(args.user, args.host, args.port or 22, args.password or None) - - try: - remote_file = args.path or args.exe - s.download(remote_file) - except Exception: - log.warning("Could not download file %r, opening a shell", remote_file) - s.interactive() - return + with ssh(args.user, args.host, args.port or 22, args.password or None) as s: + try: + remote_file = args.path or args.exe + s.download(remote_file) + except Exception: + log.warning("Could not download file %r, opening a shell", remote_file) + s.interactive() + return if not args.exe: args.exe = os.path.basename(args.path) + if args.auto and (args.exe is None or args.libc is None): + args.exe, args.libc = detect_missing_binaries(args) if args.template: template = Template(filename=args.template) # Failing on invalid file is ok From d0941566063a5df4f588a7c1f4725c15386e281e Mon Sep 17 00:00:00 2001 From: Arusekk Date: Tue, 12 Dec 2023 19:57:58 +0100 Subject: [PATCH 028/107] android: disable accel --- travis/setup_avd_fast.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/setup_avd_fast.sh b/travis/setup_avd_fast.sh index 25e711475..69079a7d6 100644 --- a/travis/setup_avd_fast.sh +++ b/travis/setup_avd_fast.sh @@ -18,7 +18,7 @@ yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;d yes | sdkmanager --sdk_root="$ANDROID_HOME" --licenses echo no | avdmanager --silent create avd --name android-$ANDROID_ABI --force --package "system-images;$ANDROIDV;default;$ANDROID_ABI" -"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot -gpu off & +"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot -gpu off -accel off & adb wait-for-device adb shell id adb shell getprop From 8baa27e7a60289f6cfb3203ebfebba9b7cf95ce8 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Tue, 12 Dec 2023 20:24:02 +0100 Subject: [PATCH 029/107] android: switch to x86_64 emulator armeabi-v7a crashes :( --- travis/setup_avd_fast.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/setup_avd_fast.sh b/travis/setup_avd_fast.sh index 69079a7d6..f55ea59d8 100644 --- a/travis/setup_avd_fast.sh +++ b/travis/setup_avd_fast.sh @@ -8,7 +8,7 @@ set -ex # - arm64-v8a # - x86 # - x86_64 -ANDROID_ABI='armeabi-v7a' +ANDROID_ABI='x86_64' ANDROIDV=android-24 # Create our emulator Android Virtual Device (AVD) From 8ec092522e5989ebd1d723301499ceeb37392c1e Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Tue, 12 Dec 2023 21:11:30 +0100 Subject: [PATCH 030/107] android: fix tests for amd64 emulator --- pwnlib/adb/adb.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pwnlib/adb/adb.py b/pwnlib/adb/adb.py index e5d0434c7..b0ebdd6c3 100644 --- a/pwnlib/adb/adb.py +++ b/pwnlib/adb/adb.py @@ -66,6 +66,7 @@ from pwnlib.context import LocalContext from pwnlib.context import context from pwnlib.device import Device +from pwnlib.exception import PwnlibException from pwnlib.log import getLogger from pwnlib.protocols.adb import AdbClient from pwnlib.util.packing import _decode @@ -122,7 +123,7 @@ def current_device(any=False): >>> device = adb.current_device(any=True) >>> device # doctest: +ELLIPSIS - AdbDevice(serial='emulator-5554', type='device', port='emulator', product='sdk_...phone_armv7', model='sdk ...phone armv7', device='generic') + AdbDevice(serial='emulator-5554', type='device', port='emulator', product='sdk_...phone_...', model='...', device='generic...') >>> device.port 'emulator' """ @@ -252,13 +253,13 @@ class AdbDevice(Device): >>> device = adb.wait_for_device() >>> device.arch - 'arm' + 'amd64' >>> device.bits - 32 + 64 >>> device.os 'android' >>> device.product # doctest: +ELLIPSIS - 'sdk_...phone_armv7' + 'sdk_...phone_...' >>> device.serial 'emulator-5554' """ @@ -1364,7 +1365,7 @@ def compile(source): >>> filename = adb.compile(temp) >>> sent = adb.push(filename, "/data/local/tmp") >>> adb.process(sent).recvall() # doctest: +ELLIPSIS - b'... /system/bin/linker\n...' + b'... /system/lib64/libc.so\n...' """ ndk_build = misc.which('ndk-build') @@ -1491,7 +1492,7 @@ class Partitions(object): def by_name_dir(self): try: return next(find('/dev/block/platform','by-name')) - except StopIteration: + except (StopIteration, PwnlibException): return '/dev/block' @context.quietfunc From 95fd121e1f36a89f4f707c138d98a1c78aaa89ae Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Tue, 12 Dec 2023 21:31:49 +0100 Subject: [PATCH 031/107] android: suppress filenotfound error when looking for partitions --- pwnlib/adb/adb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pwnlib/adb/adb.py b/pwnlib/adb/adb.py index b0ebdd6c3..84bb89213 100644 --- a/pwnlib/adb/adb.py +++ b/pwnlib/adb/adb.py @@ -1491,7 +1491,8 @@ class Partitions(object): @context.quietfunc def by_name_dir(self): try: - return next(find('/dev/block/platform','by-name')) + with context.local(log_level=logging.FATAL): + return next(find('/dev/block/platform','by-name')) except (StopIteration, PwnlibException): return '/dev/block' From b9cece5526534f4960f3a4945dac32a91eae9487 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:39:27 +0000 Subject: [PATCH 032/107] Bump actions/setup-python from 4 to 5 (#2316) --- .github/workflows/android.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/pylint.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 19a6b48a7..6cbbb7e3b 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -21,7 +21,7 @@ jobs: key: ${{ matrix.os }}-cache-pip - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3011b9427..120b171be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Python ${{ matrix.python_version }} if: matrix.python_version != '2.7' - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 52508ebae..9cc95fd00 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: key: ${{ matrix.os }}-cache-pip - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index b70becc94..a76794b0a 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -19,7 +19,7 @@ jobs: key: ${{ matrix.os }}-cache-pip - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From 8367da6500fe6810cc9b8adde335a3a7d0e97e99 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Thu, 14 Dec 2023 16:29:46 +0100 Subject: [PATCH 033/107] Bump unicorn dependency to >=2.0.1 (#2315) * Bump unicorn dependency to >=2.0.1 We're using riscv constants now which were added in unicorn2. Fixes #2303 * Add RISCV64 plt emulation test binaries --- pwnlib/data/elf/test-riscv64 | Bin 0 -> 4664 bytes pwnlib/data/elf/test-riscv64-pie | Bin 0 -> 5080 bytes pwnlib/data/elf/test-riscv64-relro | Bin 0 -> 6208 bytes pwnlib/data/elf/test-riscv64-relro-pie | Bin 0 -> 6240 bytes pyproject.toml | 2 +- 5 files changed, 1 insertion(+), 1 deletion(-) create mode 100755 pwnlib/data/elf/test-riscv64 create mode 100755 pwnlib/data/elf/test-riscv64-pie create mode 100755 pwnlib/data/elf/test-riscv64-relro create mode 100755 pwnlib/data/elf/test-riscv64-relro-pie diff --git a/pwnlib/data/elf/test-riscv64 b/pwnlib/data/elf/test-riscv64 new file mode 100755 index 0000000000000000000000000000000000000000..2f54f95f07ac32013d7d60b45d9dccce7007219f GIT binary patch literal 4664 zcmcIoYitx%6u!IL(o!R?RzrEHTM&g{$8Eb-K*c_wwGj!v5)z5aba&gXY@jni8T3AtoBdS7N}31{41fV|>I!Ya-ehpd})Zg01JwoUaTMF=*mxcFsND zIp4XDxv%N7%U3k|eLe;8tKSt{wNo6dRvaH(lw z@XtwV=wc^K1%$WA?*NPZP9Su-#6e3M=4H9Qz7h%WsA`W59&2vW);h<&IRmB9%;cZm2MlW^8>;q#~8AiNrNC zqg8S~u7m62cipt|G4*ibfv>;+sd`=8$+5->9h|aCt1* z&+YWjDe!f#ow9&2j^plbjg0^HOn7bZ_zwfK%QltdKU}!(25sfNXFgwCd$W1Z^BXDT zva*6a*Zz%{-^X?I8!D6+B{7YHhh=>TY`2f&M?LW`6BbmbCeD>#n&&>r6ZGVnE%;GS z9!+rNiJvZb$b&1>GOSEWMWabG6I;AEYR2?*tJ1AZk}!ICv8ZY3h86A5lW9W8h^>pp z+Sf%}^<+wAjbz$tRi>e*_Rs_s%KR!1mXTPo9{ zr=r;m)sZl6p&k^_9N|A7{rpn$sdn=4+z8Pxzwi z@qV?PgGuh6>5M<-l7lK$EI98CvUF@$(1kMxQs%;W{y{=69BY|<^If=morPWaR3st2 z$c6K|@yf1JrK$sm>jDS+mX!t?{v7Bf{Ya_md%IV)scCBZO|)i~Zfj@@Oj8sp_B4;Z zt={AJ*xTwneviGa7XA?x^6$@2r{OCtJXYMB2&>Ykd=ov5zNV5bBcsu?{vEr@l^W>L zKkV&RsyWfzHc*rsEG^0p#){9X0UGk2Bc+A8!QOmtcXNV$6j7KTeD%43Z|i`?uBXj?InyJnm~6C@Q#cFz2*-`P7loA5XZE*NaC+4~;Ogps{E9 z(j57ZQ?A=jkM-Twe}0lzMEyJA~WAE%ApO~0WRIG=<(+?}(MxSri)qWc*Bj2MGGl$d5+0f$JGrpAa0nym4c#W~Z z<~7L@vY&J=%6UjH*%r+G8L;Ktn+03+OwmE{^S;Ld{vYEL8MgPx`G>Rn+kn#&tfgV` z<2vvLlSt&cqPX8IH#lnYiM4fZhLaC#e4j+%oW!2M`>ZXpF9RPgaQJBV#}bA$jrwWm z?f&eR_zAI5@2J@Q;+Hi4o1*${K?QF~zy7VpeFk};n;IIHgyuii(wVk8LzR_ULgt;-EWJ(HzINSgS6aL)ZFY4y+AN{eMWIudEFiLY0hZdpdMrPE5t7J;GuPny>U&s@wu+`Dlf zFZX11X8A>s&lX+-;NyOZdn=#nZgHQLjNeK>H@{ofaknH4aga;A{0RBZ(3(O0*eCV~ zuuQnvH?TgDaw!#f48X@eGAzKT1oA$^eFq=wxsfp5L%_$r^sQ_x*oP>@7Vr42B$O85 zWc#u1`=z7Uf6#u^1N}Jhc~60jePy@sS2@)>cV;T1{Q|2eslcJ&V;>t9KKhCJ!3S;$ zza9y3UlqbW!P(@#c==s~@t9yAzqs!ZNV3CGlh2@(pf{22=1+dFO2T^2fJ?U~^YsfK z{of*I;uhK1d49PC?FY7%3S0&F_|C%j7v3M@z4h~Vft!C+>OU&=-wvW^Z~dEJ}j0sJ!c1+-P*V0{;|8J zHj2pE&ec?ckjN?yh(A$8MaqY&qCoqlNu?AOsb3JPDC(CYHPEOjvL!<6CJ=XKcYbEG zvI$5X>vrD!W`6VDzI|`@t@rldJy4fO5F|;TkXY4~A=0CcA6^zV8d&vEH?899HFPzt zV7orRLVr)F*c-~criQ*m@g!^Eb=QSJT(8$SXiY=Rs|c@UjRwS2XUqmqw2XZ@*|jS4 zK+_eWEj+nL;JdEYIMvVV_+M5Ho|wWL)x4t`4^4dkksTlU zIcZ<3{l)cFK@<@*c=s_+#`#r6r-g1UID@wqa;*iYG&0)iI$rkCu5@dm(v{8`UfF1u zeA0*XC(k-_?*sJayDzO>(es_)8Ey-}TD{GEK)TXK%mV^s-iI zh%CSCFqR#)%ps>_6`aRxHhC>%P0zPn-z-{Ai4iukyUlEVw>e}v1**7C$sZ!mwMw}Q zyu%}wnS16b4oz`H1 zM<%`{J;7bp@v2G&fAy-xmM1FfEkQqKEo(Eyzo~=I@HVNZX>N-ocx4t@V?TucWZ)O< z^&q~EUX)-K)D77SB1g2o=Cv*W@6zW`iQ%7V{OG!nk9gQ0#Be;%cNCX$0*+*OKZ0xO zAn~aPuB9Zv=OXx}0TNygC@!^COIF}G6v0tz#Bn%+N9*y?2p+9Rzlz|fk&@@P5qz}( zD!-55OT8jynut1+Cwh~|lG~e-eVECSRMNVQQr2Z}U8DZMQ|Druhsk&FEn!m}tZu)uugxy9>k0chx2NIdpPt4Al|EW7Lvz};r z-1^-_l}E#IO${5i%<%S~o_giG*(Y8hX;1#6h1 zsps>9$9`6;J^NM|d!xqoUU}UI&0L_H>i69_nW?80Cu@HXBc`?-{9`z#4>wKB%+4L3 zuVq^33>|r>F4vows5-~L^~g{Db>vj_idUyv+Fn1~a>JRkI*#r`*_QOl^NGy#%KFca z)tdPsH#Ib@nw@*;bQG~KnVsAFu^=}MjQ4M?vHzc(>y|TTCvV($ZjrZgcJ4c;!yNtG zHcxYmAu)eACmi$icxLNV*mI_RvTNV@=d*7-JwEX43C{P?=GsRO4dgahGIO$DMK*YW zqP$h9jHPncn72N)!COs_+U{5?0NKv1rq1>>CDtYHz`H4TeqmuFQ?cKZkA0sKdlHFt zm(>N>TK1(mCaBdb!x|FywDc7bQbR;wOU)5U1=la?#(K4}2edp8>W40Sg8v$gM;(#( zhzR_jo?j@7eONaw_TpOItk{EZs~>ypZ$e^04Uqd5;pKLLpw?7%V48-GY81{Ps6D)h z1L@I@f#-E#7h=(fx(fIKay&1H_}F1Yx_uGwm;s{VYH=hQkZ%> zI9G7Oqr^sTHn@D$b2=(*W>GGdT!!S5lS`H_M244_1B5k52EX}jw?am#?Ayk0X~Y;D zariaw)&?~C$Ns{;Mar$*kU0P!bqIQg-mq*J zi2)z=V1O~HLExjVL8FdwNFed~lk+%l%*FAeEr+GdYBtBr{JRwLcgzp=pTICzpwml8i%?HeKf+C+8yVQF(z}O<%r_-=z#K}@Lq&| zJjTcW6QGA;6CPhb`;?FSKcxeNmh}}Cj33yO+>kE7U+#Mt@$vqji}Bm^g#&#Hh^piL zzs$JI1>S==|KtA%@pw!J@Lw~xF~Y}tKCk0I9ESt~8~Qk-@(qptaSo__MgE_dE6*N$ zykGGD3`{K62l~bH|1)#to)-Cf4j9#g1L8R(khuL=W=g10 z>@PJD`LQTsRFr5WgeO781c5}2CdR}E6ZJ(g0VSr`5)nv|uIJ1>XPHidKMy{b^lWy{ zJ>NOs{hNF5+A{SLHEP(=i&VrdR1??OMQ~p|q zO)-ie^ebF+zA_yIBj5Oya>b#e+MzJkb)*TKa|BM*rQ6@8*6Hy@In7O|c|v z&e%~(59c{1YE_=-TNDhUh4(P>oO-hV@04`=S}yN;{Zh>J7tO7Q#ff;!;zYDO5l?n* zE;r*=WK(shJdv&rMRhBsS5Wy>H>xL%k;c`JLd{3Z)*Z^+^WdlN?`RshcsTRymxmJ+ zLv^8iDTaiwo1B#5QWeNg?eovg@pU&(SwI-YQ8#T1jsNm=u(@#f`=Q&5w-gM1xNyU* z`sxQSe!jH!PV0f)PhrS)WfgjON=%5M_joh@3wi#Cvw`tu4^H)?c+G>qf>jKybD{9gJXn#KK%PR<%4$g(Ad!MKe+29eEm7lk7*Jg z#yyT&#IMYxlojs2a)_sFoa#*^I1`DF7yueb~nYyhY`7X z@Y?f3-`rb!b=UD12L|?jIx((p`rK1}pZT^Zcx0?}{)MqUcLVf&@XpZ7kRpkk;u`TsJ=|lm@9!$!=gK>$wl2PqbxdGrO)oJfn+`bIk zQm;|AkFlS#`_B}X?}!v|ire{bb@qHK8L@6$zWjcz?9rCaq}{1iROlf+SYFZTm=#+p zEA?P#0mD#Ni5%xd2);5*=9+jkj8~?E;SPEj^k}6=lpYa$0O(db9axMO(49j;8uVn! zj_Ga5PQ9fwj;D-xl%cx%rgGb81IO2HSnZ%kyOLH{htjsGJh*YP;;G~WBaA*XmN1CG zsdT~y-HvU>r<1L+bjJJNC9{+bH%^w<@GXCWLMeb!vJlV-O z7MRWqG)IIl_Y`t}L8mmgxX(U>&&R);f0WmOqnx2eK`!y~L+HDRb4JRSb>v$HRxnrA z6`7ZkWep~%4}>r4jK&McCVMFyR2>WKvta{4T_(Ph_3Hw(cN^vQw$-vyfAwx1jCj%e`fqGpzS?ICo1nzkcRR z`;YSX@hC6+G``#-^%ra#Ca4JE%YB>N!^!)TcyIZ1&*SDpK3A9vS|mi)-tyl*dpU2sbcf)FkxN&U!k6#(DBpKV9ELa|w&)Xx(w&>|~!le9W<~Lu5 zFa0n1oxucQK>=6`f1w8#zUW`kk7cJlVcGlfDvv{W0+TIu7mW0AuD??`m&42d6MR+{ A;s5{u literal 0 HcmV?d00001 diff --git a/pwnlib/data/elf/test-riscv64-relro-pie b/pwnlib/data/elf/test-riscv64-relro-pie new file mode 100755 index 0000000000000000000000000000000000000000..074be1ab0b3b0e74cfe7f722cf7abf811793e27b GIT binary patch literal 6240 zcmeHLUu+!Z5&!Pa#=#9K!Bh^Uzy{+ahQm-)J2StT`M%lj&+NCmf9v+%cr2zs3H6m??avJX(j|sZRt7>nu`abqHPZD) zb%VN!^g164>|FsPYe32PLcUD!1aXcliapBLh#xpIq_`r-{qb6Hh_KFxjyUF=`%-l9 z>c9f7q$q!f40Q-=BT;X0+sG^#!OUwB+xmt+aGytWVEbO#C7K?(8KNY+9+M4s2h z{5h}1@OziQA0}M3AW8G|0EvsW^JBtqop-BA%}e;dOSo3^niqIv7i)i$k1tnQS-5{f zi0e6CA*T$(b_?md?>5}DnIBN5SFj07kC?`Qoi}s#qZX;O7Se|6nT}@+nRcEKQqp^j zbasz1VA?rVbnLu0pj^kyXBJoohfOD=IG$I{M)luTRNwY(TY8KRz2heeVrNPj+jiY= zWGu%Tv|Z0~cHQ5TE99+RW`B+{W80z@|1RUSsuKRMPB`m4qrBc?>Q}^hZEEzNIPzQC zUUh1UWTqIc%pu~~M}a-z+ZlVq_m8XJvojIu4ete}ze!!LN*w||AoFk`f^R@!(fn}A zQ%LlzaNwBFhXm(+1RIHJcLcj;Hmncf z;X0lS;o&;ADTHGPs2SB2!W$V7`k598-1c(8m`%4R)tNZioj5)|*_7z{W~xm57fovX zSXm8Hac|aXd^S%W8ceKEP2?ZwD*wjhWwi9Unx(oBWz+_IsN2O#q#)DgHIee zS)M4D0*^{*nmnf}^`)l{O?_}z*EdIw|E5xT{@uX$XeIFNUU};$&9_mDb#;~TzB+Z) znaXE@N5lA$Q_Vl(oUF&n(=*i*7b<-%>b!bscRbS_E0^pOH$C#iKVCXpy7u*nmgE~3 zTh^YxI8CL9^4RxWx+QgHHr6-QQ1|umN;6GBQ+@r_Gu1zw3nSLDnd<&88M(c8Z0qI< z+5b*$Z8(2%eBFUdwYY|v>MiGjHnx&%oFgBdecrjmF~+&EzReRs&!_f|Z#*#jyY!of z$9kVXN$q`cPvwi*JUl{JgSQ7vPRx@)vnw^8l2oKejONzXK@&i0gw ztxo(D&!o)k+}wH!#Xe6wx>Lm-kHuDB6Zf%IWJ{5cU!xmhK_^$PS4QB<2wWL~|KkXt z^6;622|Ax)m^A-7e-2qAI-aRFh>r8f>WKYD(Qz)}b14(z|2aEXVEwcl0;v4^v_l^L zwP(5)VAb70ZTWAEDz=`)dWT*e?T%v7 z7~+e`mjS+H_>!iJQo5Vv7ZS5y>GURHIYp)C3!bG9=7;tEVVhnX?2JI&Teh`%=AiOz zS<}rbJu{kjM~4FLIe~>9{H|TdFHj7!Iabc(0FjD0PwAdDLRY7dF+Ef1R@NAB%puFj zX2>6!(uP3xxT zId=cBXUWOsG81qaGw&~6>R6vkeWyV)vMr$cXJTGTh>w2HpyT8M3ZMDeu$KPe__w7Y zaE+Zp6pc@j?O(Kq&_C)7IQqx_!oEe5n@Qj?Kz!|GND9jixnV9B?1OmJgI>be74fKR z;HYEd;!|||`2C(XW-Wiz1#r|;9f2(320_!gx%i9II$OdRF4WaNY*r7m3GrP4I!pfJfKQ z0g1=`uabff&g&~o$RF5261WS*FZEpx{?Yzlh{W%f{=qjOPW|?7{uhc}5sJrizA7Km;72Y#K?grUD1Vbf|2PL+_#fl{O0himh_5|gI4LF>Sga59 zi}`<#T=<@9@fs;i;sE~uoL_&?KO`X>k8{K_i64QZaI^=``=3.3.0", "intervaltree>=3.0", "sortedcontainers", - "unicorn>=1.0.2rc1", # see unicorn-engine/unicorn#1100 and #1170 + "unicorn>=2.0.1", "six>=1.12.0", "rpyc", "colored_traceback", From c7649c95e234fa71ad68a8fcecaff920e0793d8d Mon Sep 17 00:00:00 2001 From: Chris Yuen Date: Thu, 14 Dec 2023 23:39:36 +0800 Subject: [PATCH 034/107] Make sure winexec shellcode is 16 byte aligned and add nCmdShow option (#2308) * Make sure winexec is 16 byte aligned and add nCmdShow option * fix typo and add changelog * Update pwnlib/shellcraft/templates/amd64/windows/winexec.asm Co-authored-by: peace-maker * tidied up winexec 16-byte alignment * fix stack alignment on return * Use stable alignment * Avoid null-bytes in `add` instruction for long commands --------- Co-authored-by: peace-maker Co-authored-by: Arusekk --- CHANGELOG.md | 2 ++ .../templates/amd64/windows/winexec.asm | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d708f76c4..b60a9a9dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ The table below shows which release corresponds to each branch, and what date th - [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it - [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found - [#2309][2309] Detect challenge binary and libc in `pwn template` +- [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -85,6 +86,7 @@ The table below shows which release corresponds to each branch, and what date th [1763]: https://github.com/Gallopsled/pwntools/pull/1763 [2307]: https://github.com/Gallopsled/pwntools/pull/2307 [2309]: https://github.com/Gallopsled/pwntools/pull/2309 +[2308]: https://github.com/Gallopsled/pwntools/pull/2308 ## 4.12.0 (`beta`) diff --git a/pwnlib/shellcraft/templates/amd64/windows/winexec.asm b/pwnlib/shellcraft/templates/amd64/windows/winexec.asm index d6805201b..eb82eb433 100644 --- a/pwnlib/shellcraft/templates/amd64/windows/winexec.asm +++ b/pwnlib/shellcraft/templates/amd64/windows/winexec.asm @@ -7,15 +7,24 @@ Args: cmd (str): The program to execute. + cmd_show (int): nCmdShow parameter. -<%page args="cmd"/> +<%page args="cmd, cmd_show = 0"/> <% cmd = _need_bytes(cmd) +stack_frame = 0x30 + align(8, len(cmd)+1) +stack_frame_align = 8 & ~stack_frame %> ${amd64.windows.getprocaddress(b'WinExec', b'kernel32.dll', 'rsi')} ${amd64.pushstr(cmd)} mov rcx, rsp - sub rsp, 0x30 + sub rsp, ${pretty(0x30 + stack_frame_align)} + ${amd64.mov('rdx', cmd_show)} call rsi - add rsp, ${pretty(0x30+align(8, len(cmd)))} +% if stack_frame + stack_frame_align < 0x80: + add rsp, ${pretty(stack_frame + stack_frame_align)} +% else: + ${amd64.mov('rcx', stack_frame + stack_frame_align)} + add rsp, rcx +% endif From 5409174aed2e94eef487387fc9e24ea9ef81c3c3 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Sat, 30 Dec 2023 00:01:07 +0100 Subject: [PATCH 035/107] elf/corefile: Clean up pyelftools workarounds (#2319) --- pwnlib/elf/corefile.py | 81 ++++++----------------------------------- pwnlib/elf/datatypes.py | 23 ------------ 2 files changed, 11 insertions(+), 93 deletions(-) diff --git a/pwnlib/elf/corefile.py b/pwnlib/elf/corefile.py index b4d0e9dc7..02ac36ebf 100644 --- a/pwnlib/elf/corefile.py +++ b/pwnlib/elf/corefile.py @@ -93,7 +93,6 @@ from pwnlib.util.fiddling import unhex from pwnlib.util.misc import read from pwnlib.util.misc import write -from pwnlib.util.packing import _decode from pwnlib.util.packing import pack from pwnlib.util.packing import unpack_many @@ -106,44 +105,11 @@ 'aarch64': elf_prstatus_aarch64 } -prpsinfo_types = { - 32: elf_prpsinfo_32, - 64: elf_prpsinfo_64, -} - siginfo_types = { 32: elf_siginfo_32, 64: elf_siginfo_64 } -# Slightly modified copy of the pyelftools version of the same function, -# until they fix this issue: -# https://github.com/eliben/pyelftools/issues/93 -def iter_notes(self): - """ Iterates the list of notes in the segment. - """ - offset = self['p_offset'] - end = self['p_offset'] + self['p_filesz'] - while offset < end: - note = struct_parse( - self.elffile.structs.Elf_Nhdr, - self.stream, - stream_pos=offset) - note['n_offset'] = offset - offset += self.elffile.structs.Elf_Nhdr.sizeof() - self.stream.seek(offset) - # n_namesz is 4-byte aligned. - disk_namesz = roundup(note['n_namesz'], 2) - with context.local(encoding='latin-1'): - note['n_name'] = _decode( - CString('').parse(self.stream.read(disk_namesz))) - offset += disk_namesz - - desc_data = _decode(self.stream.read(note['n_descsz'])) - note['n_desc'] = desc_data - offset += roundup(note['n_descsz'], 2) - note['n_size'] = offset - note['n_offset'] - yield note class Mapping(object): """Encapsulates information about a memory mapping in a :class:`Corefile`. @@ -605,7 +571,6 @@ def __init__(self, *a, **kw): log.warn_once("%s does not use a supported corefile architecture, registers are unavailable" % self.file.name) prstatus_type = prstatus_types.get(self.arch) - prpsinfo_type = prpsinfo_types.get(self.bits) siginfo_type = siginfo_types.get(self.bits) with log.waitfor("Parsing corefile...") as w: @@ -616,39 +581,30 @@ def __init__(self, *a, **kw): continue - # Note that older versions of pyelftools (<=0.24) are missing enum values - # for NT_PRSTATUS, NT_PRPSINFO, NT_AUXV, etc. - # For this reason, we have to check if note.n_type is any of several values. - for note in iter_notes(segment): - if not isinstance(note.n_desc, bytes): - note['n_desc'] = note.n_desc.encode('latin1') + for note in segment.iter_notes(): # Try to find NT_PRSTATUS. - if prstatus_type and \ - note.n_descsz == ctypes.sizeof(prstatus_type) and \ - note.n_type in ('NT_GNU_ABI_TAG', 'NT_PRSTATUS'): + if note.n_type == 'NT_PRSTATUS': self.NT_PRSTATUS = note self.prstatus = prstatus_type.from_buffer_copy(note.n_desc) # Try to find NT_PRPSINFO - if prpsinfo_type and \ - note.n_descsz == ctypes.sizeof(prpsinfo_type) and \ - note.n_type in ('NT_GNU_ABI_TAG', 'NT_PRPSINFO'): + if note.n_type == 'NT_PRPSINFO': self.NT_PRPSINFO = note - self.prpsinfo = prpsinfo_type.from_buffer_copy(note.n_desc) + self.prpsinfo = note.n_desc # Try to find NT_SIGINFO so we can see the fault - if note.n_type in (0x53494749, 'NT_SIGINFO'): + if note.n_type == 'NT_SIGINFO': self.NT_SIGINFO = note self.siginfo = siginfo_type.from_buffer_copy(note.n_desc) # Try to find the list of mapped files - if note.n_type in (constants.NT_FILE, 'NT_FILE'): + if note.n_type == 'NT_FILE': with context.local(bytes=self.bytes): self._parse_nt_file(note) # Try to find the auxiliary vector, which will tell us # where the top of the stack is. - if note.n_type in (constants.NT_AUXV, 'NT_AUXV'): + if note.n_type == 'NT_AUXV': self.NT_AUXV = note with context.local(bytes=self.bytes): self._parse_auxv(note) @@ -684,31 +640,16 @@ def __init__(self, *a, **kw): self._describe_core() def _parse_nt_file(self, note): - t = tube() - t.unrecv(note.n_desc) - - count = t.unpack() - page_size = t.unpack() - starts = [] addresses = {} - for i in range(count): - start = t.unpack() - end = t.unpack() - offset = t.unpack() - starts.append((start, offset)) - - for i in range(count): - filename = t.recvuntil(b'\x00', drop=True) + for vma, filename in zip(note.n_desc.Elf_Nt_File_Entry, note.n_desc.filename): if not isinstance(filename, str): - filename = filename.decode('utf-8') - (start, offset) = starts[i] - + filename = filename.decode('utf-8', 'surrogateescape') for mapping in self.mappings: - if mapping.start == start: + if mapping.start == vma.vm_start: mapping.name = filename - mapping.page_offset = offset + mapping.page_offset = vma.page_offset self.mappings = sorted(self.mappings, key=lambda m: m.start) diff --git a/pwnlib/elf/datatypes.py b/pwnlib/elf/datatypes.py index f3989e48d..0dffaf7f5 100644 --- a/pwnlib/elf/datatypes.py +++ b/pwnlib/elf/datatypes.py @@ -631,29 +631,6 @@ class Elf64_auxv_t(ctypes.Structure): _fields_ = [('a_type', ctypes.c_uint64), ('a_val', ctypes.c_uint64),] -def generate_prpsinfo(long): - return [ - ('pr_state', byte), - ('pr_sname', char), - ('pr_zomb', byte), - ('pr_nice', byte), - ('pr_flag', long), - ('pr_uid', ctypes.c_ushort), - ('pr_gid', ctypes.c_ushort), - ('pr_pid', ctypes.c_int), - ('pr_ppid', ctypes.c_int), - ('pr_pgrp', ctypes.c_int), - ('pr_sid', ctypes.c_int), - ('pr_fname', char * 16), - ('pr_psargs', char * 80) - ] - -class elf_prpsinfo_32(ctypes.Structure): - _fields_ = generate_prpsinfo(Elf32_Addr) - -class elf_prpsinfo_64(ctypes.Structure): - _fields_ = generate_prpsinfo(Elf64_Addr) - def generate_siginfo(int_t, long_t): class siginfo_t(ctypes.Structure): _fields_ = [('si_signo', int_t), From cd0c34a6ed8a92ff0f83b0d4cbae8ea0f8f8af4a Mon Sep 17 00:00:00 2001 From: Florian Kothmeier <79159689+FlorianKothmeier@users.noreply.github.com> Date: Sat, 30 Dec 2023 19:35:29 +0100 Subject: [PATCH 036/107] Make pwn template always set context.binary (#2279) * Make pwn template always set context.binary * Update CHANGELOG.md * Allow args.EXE override in all templates * Fall back to old behavior for remote only challenges --------- Co-authored-by: peace-maker --- CHANGELOG.md | 2 ++ pwnlib/data/templates/pwnup.mako | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b60a9a9dc..06d16837c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found - [#2309][2309] Detect challenge binary and libc in `pwn template` - [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned +- [#2279][2279] Make `pwn template` always set context.binary [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -87,6 +88,7 @@ The table below shows which release corresponds to each branch, and what date th [2307]: https://github.com/Gallopsled/pwntools/pull/2307 [2309]: https://github.com/Gallopsled/pwntools/pull/2309 [2308]: https://github.com/Gallopsled/pwntools/pull/2308 +[2279]: https://github.com/Gallopsled/pwntools/pull/2279 ## 4.12.0 (`beta`) diff --git a/pwnlib/data/templates/pwnup.mako b/pwnlib/data/templates/pwnup.mako index e47217036..28c670869 100644 --- a/pwnlib/data/templates/pwnup.mako +++ b/pwnlib/data/templates/pwnup.mako @@ -44,7 +44,7 @@ from pwn import * %if not quiet: # Set up pwntools for the correct architecture %endif -%if ctx.binary: +%if ctx.binary or not host: exe = context.binary = ELF(args.EXE or ${binary_repr}) <% binary_repr = 'exe.path' %> %else: @@ -99,11 +99,7 @@ else: %endif library_path = libcdb.download_libraries(${libc_repr}) if library_path: - %if ctx.binary: exe = context.binary = ELF.patch_custom_libraries(${binary_repr}, library_path) - %else: - exe = ELF.patch_custom_libraries(exe, library_path) - %endif libc = exe.libc else: libc = ELF(${libc_repr}) From 3bb756db45ba57cadaadd361d9ff9fcfc6117707 Mon Sep 17 00:00:00 2001 From: Lennard Hofmann Date: Tue, 2 Jan 2024 15:40:09 +0100 Subject: [PATCH 037/107] Add timeout to gdbserver startup (#2321) --- pwnlib/gdb.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 753955ea4..df2599669 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -315,7 +315,14 @@ def _gdbserver_port(gdbserver, ssh): # Process /bin/bash created; pid = 14366 # Listening on port 34816 - process_created = gdbserver.recvline() + process_created = gdbserver.recvline(timeout=3) + + if not process_created: + log.error( + 'No output from gdbserver after 3 seconds. Try setting the SHELL=/bin/sh ' + 'environment variable or using the env={} argument if you are affected by ' + 'https://sourceware.org/bugzilla/show_bug.cgi?id=26116' + ) if process_created.startswith(b'ERROR:'): raise ValueError( From c4a3d349d64d11a091eaf66582fc4d7ce42ff66e Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 2 Jan 2024 21:11:57 +0100 Subject: [PATCH 038/107] Add support to start a process on Windows (#2310) * Add support to start a process on Windows This is heavily inspired by https://github.com/masthoon/pwintools Allows to use the `process` tube on a Windows host running local processes. I've tried to keep the changes at a minimum. Windows doesn't support non-blocking reads, so I've opted to handle the reading in a separate thread to simulate the non-blocking check. * Fix `misc.which()` on Windows `os.getuid()` is only supported on unix. * Support [read|write]mem, libs and cwd * Update CHANGELOG * Don't cache loaded modules * Wait output on stdout in `process.can_recv_raw` Instead of handling the timeout for reading poorly in `process.recv_raw`, wait for any bytes to be available in `process.can_recv_raw` like on linux. This prevents a 100% spin of one core in `tube.interactive()` since it expects the thread to block for `timeout` seconds while we would return immediately previously. * Remove PythonForWindows dependency This loses the `readmem` and `writemem` feature, but that's not necessary for this basic process startup support. * Fix cyclic imports * Ignore errors in reading thread This could cause a deadlock / fastfail on shutdown when stdout is closed, thus read(1) fails and the exception is tried to be printed to the console while stderr is in the process of getting closed. --- CHANGELOG.md | 2 + pwnlib/tubes/process.py | 125 ++++++++++++++++++++++++++++++---------- pwnlib/util/misc.py | 2 +- pwnlib/util/proc.py | 17 ++++++ 4 files changed, 115 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06d16837c..bf8ed4ce4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2309][2309] Detect challenge binary and libc in `pwn template` - [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned - [#2279][2279] Make `pwn template` always set context.binary +- [#2310][2310] Add support to start a process on Windows [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -89,6 +90,7 @@ The table below shows which release corresponds to each branch, and what date th [2309]: https://github.com/Gallopsled/pwntools/pull/2309 [2308]: https://github.com/Gallopsled/pwntools/pull/2308 [2279]: https://github.com/Gallopsled/pwntools/pull/2279 +[2310]: https://github.com/Gallopsled/pwntools/pull/2310 ## 4.12.0 (`beta`) diff --git a/pwnlib/tubes/process.py b/pwnlib/tubes/process.py index 8c44e7b7d..af9879bd9 100644 --- a/pwnlib/tubes/process.py +++ b/pwnlib/tubes/process.py @@ -6,16 +6,19 @@ import errno import logging import os -import platform import select import signal -import six import stat import subprocess import sys import time -if sys.platform != 'win32': +IS_WINDOWS = sys.platform.startswith('win') + +if IS_WINDOWS: + import queue + import threading +else: import fcntl import pty import resource @@ -116,6 +119,8 @@ class process(tube): List of arguments to display, instead of the main executable name. alarm(int): Set a SIGALRM alarm timeout on the process. + creationflags(int): + Windows only. Flags to pass to ``CreateProcess``. Examples: @@ -228,7 +233,7 @@ def __init__(self, argv = None, env = None, ignore_environ = None, stdin = PIPE, - stdout = PTY, + stdout = PTY if not IS_WINDOWS else PIPE, stderr = STDOUT, close_fds = True, preexec_fn = lambda: None, @@ -238,6 +243,7 @@ def __init__(self, argv = None, where = 'local', display = None, alarm = None, + creationflags = 0, *args, **kwargs ): @@ -250,6 +256,8 @@ def __init__(self, argv = None, else: raise TypeError('Must provide argv or set context.binary') + if IS_WINDOWS and PTY in (stdin, stdout, stderr): + raise NotImplementedError("ConPTY isn't implemented yet") #: :class:`subprocess.Popen` object that backs this process self.proc = None @@ -258,7 +266,12 @@ def __init__(self, argv = None, original_env = env if shell: - executable_val, argv_val, env_val = executable or '/bin/sh', argv, env + executable_val, argv_val, env_val = executable, argv, env + if executable is None: + if IS_WINDOWS: + executable_val = os.environ.get('ComSpec', 'cmd.exe') + else: + executable_val = '/bin/sh' else: executable_val, argv_val, env_val = self._validate(cwd, executable, argv, env) @@ -266,23 +279,34 @@ def __init__(self, argv = None, if stderr is STDOUT: stderr = stdout - # Determine which descriptors will be attached to a new PTY - handles = (stdin, stdout, stderr) + if IS_WINDOWS: + self.pty = None + self.raw = False + self.aslr = True + self._setuid = False + self.suid = self.uid = None + self.sgid = self.gid = None + internal_preexec_fn = None + else: + # Determine which descriptors will be attached to a new PTY + handles = (stdin, stdout, stderr) + + #: Which file descriptor is the controlling TTY + self.pty = handles.index(PTY) if PTY in handles else None - #: Which file descriptor is the controlling TTY - self.pty = handles.index(PTY) if PTY in handles else None + #: Whether the controlling TTY is set to raw mode + self.raw = raw - #: Whether the controlling TTY is set to raw mode - self.raw = raw + #: Whether ASLR should be left on + self.aslr = aslr if aslr is not None else context.aslr - #: Whether ASLR should be left on - self.aslr = aslr if aslr is not None else context.aslr + #: Whether setuid is permitted + self._setuid = setuid if setuid is None else bool(setuid) - #: Whether setuid is permitted - self._setuid = setuid if setuid is None else bool(setuid) + # Create the PTY if necessary + stdin, stdout, stderr, master, slave = self._handles(*handles) - # Create the PTY if necessary - stdin, stdout, stderr, master, slave = self._handles(*handles) + internal_preexec_fn = self.__preexec_fn #: Arguments passed on argv self.argv = argv_val @@ -341,7 +365,8 @@ def __init__(self, argv = None, stdout = stdout, stderr = stderr, close_fds = close_fds, - preexec_fn = self.__preexec_fn) + preexec_fn = internal_preexec_fn, + creationflags = creationflags) break except OSError as exception: if exception.errno != errno.ENOEXEC: @@ -350,6 +375,16 @@ def __init__(self, argv = None, p.success('pid %i' % self.pid) + if IS_WINDOWS: + self._read_thread = None + self._read_queue = queue.Queue() + if self.proc.stdout: + # Read from stdout in a thread + self._read_thread = threading.Thread(target=_read_in_thread, args=(self._read_queue, self.proc.stdout)) + self._read_thread.daemon = True + self._read_thread.start() + return + if self.pty is not None: if stdin is slave: self.proc.stdin = os.fdopen(os.dup(master), 'r+b', 0) @@ -503,7 +538,8 @@ def cwd(self): '/proc' """ try: - self._cwd = os.readlink('/proc/%i/cwd' % self.pid) + from pwnlib.util.proc import cwd + self._cwd = cwd(self.pid) except Exception: pass @@ -676,6 +712,17 @@ def recv_raw(self, numb): if not self.can_recv_raw(self.timeout): return '' + if IS_WINDOWS: + data = b'' + count = 0 + while count < numb: + if self._read_queue.empty(): + break + last_byte = self._read_queue.get(block=False) + data += last_byte + count += 1 + return data + # This will only be reached if we either have data, # or we have reached an EOF. In either case, it # should be safe to read without expecting it to block. @@ -713,6 +760,12 @@ def can_recv_raw(self, timeout): if not self.connected_raw('recv'): return False + if IS_WINDOWS: + with self.countdown(timeout=timeout): + while self.timeout and self._read_queue.empty(): + time.sleep(0.01) + return not self._read_queue.empty() + try: if timeout is None: return select.select([self.proc.stdout], [], []) == ([self.proc.stdout], [], []) @@ -751,7 +804,7 @@ def close(self): try: fd.close() except IOError as e: - if e.errno != errno.EPIPE: + if e.errno != errno.EPIPE and e.errno != errno.EINVAL: raise if not self._stop_noticed: @@ -833,10 +886,8 @@ def libs(self): by the process to the address it is loaded at in the process' address space. """ - try: - maps_raw = open('/proc/%d/maps' % self.pid).read() - except IOError: - maps_raw = None + from pwnlib.util.proc import memory_maps + maps_raw = memory_maps(self.pid) if not maps_raw: import pwnlib.elf.elf @@ -846,18 +897,18 @@ def libs(self): # Enumerate all of the libraries actually loaded right now. maps = {} - for line in maps_raw.splitlines(): - if '/' not in line: continue - path = line[line.index('/'):] + for mapping in maps_raw: + path = mapping.path + if os.sep not in path: continue path = os.path.realpath(path) if path not in maps: maps[path]=0 for lib in maps: path = os.path.realpath(lib) - for line in maps_raw.splitlines(): - if line.endswith(path): - address = line.split('-')[0] + for mapping in maps_raw: + if mapping.path == path: + address = mapping.addr.split('-')[0] maps[lib] = int(address, 16) break @@ -1041,3 +1092,17 @@ def stderr(self): See: :obj:`.process.proc` """ return self.proc.stderr + +# Keep reading the process's output in a separate thread, +# since there's no non-blocking read in python on Windows. +def _read_in_thread(recv_queue, proc_stdout): + try: + while True: + b = proc_stdout.read(1) + if b: + recv_queue.put(b) + else: + break + except: + # Ignore any errors during Python shutdown + pass diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 7977f7a77..2ca9f31a5 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -160,7 +160,7 @@ def which(name, all = False, path=None): if os.path.sep in name: return name - isroot = os.getuid() == 0 + isroot = False if sys.platform == 'win32' else (os.getuid() == 0) out = set() try: path = path or os.environ['PATH'] diff --git a/pwnlib/util/proc.py b/pwnlib/util/proc.py index 895d8de13..9de9ac59e 100644 --- a/pwnlib/util/proc.py +++ b/pwnlib/util/proc.py @@ -223,6 +223,23 @@ def cmdline(pid): """ return psutil.Process(pid).cmdline() +def memory_maps(pid): + """memory_maps(pid) -> list + + Arguments: + pid (int): PID of the process. + + Returns: + A list of the memory mappings in the process. + + Example: + >>> maps = memory_maps(os.getpid()) + >>> [(m.path, m.perms) for m in maps if '[stack]' in m.path] + [('[stack]', 'rw-p')] + + """ + return psutil.Process(pid).memory_maps(grouped=False) + def stat(pid): """stat(pid) -> str list From d289e177fed0d9ea56d038b0b28ffac5ae6fdc14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 12:23:39 +0100 Subject: [PATCH 039/107] Bump actions/upload-artifact from 3 to 4 (#2318) * Bump actions/upload-artifact from 3 to 4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * ci: use separate coverage artifacts --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Arusekk --- .github/workflows/ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 120b171be..4ddf7e1aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,18 +178,19 @@ jobs: pwn libcdb hash b229d1da1e161f95e839cf90cded5f719e5de308 - name: Build source and wheel distributions - if: matrix.python_version > '2.7' + if: matrix.python_version != '2.7' run: | python -m build - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 + if: matrix.python_version != '2.7' with: name: packages path: dist/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: coverage + name: coverage-${{ matrix.python_version }} path: .coverage* @@ -201,10 +202,10 @@ jobs: with: fetch-depth: 20 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: coverage - path: . + pattern: coverage-* + merge-multiple: true - name: Install coveralls run: | @@ -243,7 +244,7 @@ jobs: needs: test steps: - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: packages path: dist From 43aef76a371c1440e89f4625f4ecd33cfdc913d5 Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 18:26:36 +0100 Subject: [PATCH 040/107] initial darwin support --- pwnlib/abi.py | 47 +++++++++++++--- pwnlib/asm.py | 63 +++++++++++++++++++++ pwnlib/constants/darwin/__init__.py | 0 pwnlib/context/__init__.py | 2 +- pwnlib/data/syscalls/Makefile | 3 + pwnlib/data/syscalls/generate_darwin.py | 73 +++++++++++++++++++++++++ pwnlib/elf/corefile.py | 1 + pwnlib/runner.py | 19 ++++++- 8 files changed, 199 insertions(+), 9 deletions(-) create mode 100644 pwnlib/constants/darwin/__init__.py create mode 100644 pwnlib/data/syscalls/generate_darwin.py diff --git a/pwnlib/abi.py b/pwnlib/abi.py index dbd65c719..4b2168e49 100644 --- a/pwnlib/abi.py +++ b/pwnlib/abi.py @@ -48,6 +48,8 @@ def default(): (32, 'mips', 'linux'): linux_mips, (32, 'powerpc', 'linux'): linux_ppc, (64, 'powerpc', 'linux'): linux_ppc64, + (32, 'riscv32', 'linux'): linux_riscv32, + (64, 'riscv64', 'linux'): linux_riscv64, (32, 'i386', 'freebsd'): freebsd_i386, (64, 'aarch64', 'freebsd'): freebsd_aarch64, (64, 'amd64', 'freebsd'): freebsd_amd64, @@ -55,9 +57,11 @@ def default(): (32, 'thumb', 'freebsd'): freebsd_arm, (32, 'mips', 'freebsd'): freebsd_mips, (32, 'powerpc', 'freebsd'): freebsd_ppc, - (64, 'powerpc', 'freebsd'): freebsd_ppc64, + (64, 'powerpc64', 'freebsd'): freebsd_ppc64, (32, 'i386', 'windows'): windows_i386, (64, 'amd64', 'windows'): windows_amd64, + (64, 'amd64', 'darwin'): darwin_amd64, + (64, 'aarch64', 'darwin'): darwin_aarch64, }[(context.bits, context.arch, context.os)] @staticmethod @@ -76,6 +80,8 @@ def syscall(): (64, 'aarch64', 'linux'): linux_aarch64_syscall, (32, 'powerpc', 'linux'): linux_ppc_syscall, (64, 'powerpc', 'linux'): linux_ppc64_syscall, + (32, 'riscv32', 'linux'): linux_riscv32_syscall, + (64, 'riscv64', 'linux'): linux_riscv64_syscall, (32, 'i386', 'freebsd'): freebsd_i386_syscall, (64, 'amd64', 'freebsd'): freebsd_amd64_syscall, (64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall, @@ -84,7 +90,9 @@ def syscall(): (32, 'mips', 'freebsd'): freebsd_mips_syscall, (64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall, (32, 'powerpc', 'freebsd'): freebsd_ppc_syscall, - (64, 'powerpc', 'freebsd'): freebsd_ppc64_syscall, + (64, 'powerpc64', 'freebsd'): freebsd_ppc64_syscall, + (64, 'amd64', 'darwin'): darwin_amd64_syscall, + (64, 'aarch64', 'darwin'): darwin_aarch64_syscall, }[(context.bits, context.arch, context.os)] @staticmethod @@ -99,13 +107,18 @@ def sigreturn(): (32, 'arm', 'linux'): linux_arm_sigreturn, (32, 'thumb', 'linux'): linux_arm_sigreturn, (64, 'aarch64', 'linux'): linux_aarch64_sigreturn, + (32, 'riscv32', 'linux'): linux_riscv32_sigreturn, + (64, 'riscv64', 'linux'): linux_riscv64_sigreturn, (32, 'i386', 'freebsd'): freebsd_i386_sigreturn, (64, 'amd64', 'freebsd'): freebsd_amd64_sigreturn, (32, 'arm', 'freebsd'): freebsd_arm_sigreturn, (32, 'thumb', 'freebsd'): freebsd_arm_sigreturn, (64, 'aarch64', 'freebsd'): freebsd_aarch64_sigreturn, + (64, 'amd64', 'darwin'): darwin_amd64_sigreturn, + (64, 'aarch64', 'darwin'): darwin_aarch64_sigreturn, }[(context.bits, context.arch, context.os)] + class SyscallABI(ABI): """ The syscall ABI treats the syscall number as the zeroth argument, @@ -115,6 +128,7 @@ def __init__(self, *a, **kw): super(SyscallABI, self).__init__(*a, **kw) self.syscall_register = self.register_arguments[0] + class SigreturnABI(SyscallABI): """ The sigreturn ABI is similar to the syscall ABI, except that @@ -132,6 +146,8 @@ class SigreturnABI(SyscallABI): linux_mips = ABI('$sp', ['$a0','$a1','$a2','$a3'], 4, 0) linux_ppc = ABI('sp', ['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0) linux_ppc64 = ABI('sp', ['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0) +linux_riscv32 = ABI('sp', ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7'], 8, 0) +linux_riscv64 = ABI('sp', ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7'], 8, 0) sysv_i386 = linux_i386 sysv_amd64 = linux_amd64 @@ -140,24 +156,33 @@ class SigreturnABI(SyscallABI): sysv_mips = linux_mips sysv_ppc = linux_ppc sysv_ppc64 = linux_ppc64 +sysv_riscv32 = linux_riscv32 +sysv_riscv64 = linux_riscv64 +# Docs: https://man7.org/linux/man-pages/man2/syscall.2.html linux_i386_syscall = SyscallABI('esp', ['eax', 'ebx', 'ecx', 'edx', 'esi', 'edi', 'ebp'], 4, 0) linux_amd64_syscall = SyscallABI('rsp', ['rax', 'rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'], 8, 0) -linux_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0) -linux_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6'], 16, 0) +linux_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0) +linux_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5'], 16, 0) linux_mips_syscall = SyscallABI('$sp', ['$v0','$a0','$a1','$a2','$a3'], 4, 0) -linux_ppc_syscall = ABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0) -linux_ppc64_syscall = ABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 8, 0) +linux_ppc_syscall = SyscallABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0) +linux_ppc64_syscall = SyscallABI('sp', ['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8'], 8, 0) +linux_riscv32_syscall = SyscallABI('sp', ['a7', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5'], 4, 0) +linux_riscv64_syscall = SyscallABI('sp', ['a7', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5'], 8, 0) linux_i386_sigreturn = SigreturnABI('esp', ['eax'], 4, 0) -linux_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 4, 0) +linux_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 8, 0) linux_arm_sigreturn = SigreturnABI('sp', ['r7'], 4, 0) linux_aarch64_sigreturn = SigreturnABI('sp', ['x8'], 16, 0) +linux_riscv32_sigreturn = SigreturnABI('sp', ['a7'], 4, 0) +linux_riscv64_sigreturn = SigreturnABI('sp', ['a7'], 8, 0) sysv_i386_sigreturn = linux_i386_sigreturn sysv_amd64_sigreturn = linux_amd64_sigreturn sysv_arm_sigreturn = linux_arm_sigreturn sysv_aarch64_sigreturn = linux_aarch64_sigreturn +sysv_riscv32_sigreturn = linux_riscv32_sigreturn +sysv_riscv64_sigreturn = linux_riscv64_sigreturn freebsd_i386 = sysv_i386 freebsd_amd64 = sysv_amd64 @@ -182,3 +207,11 @@ class SigreturnABI(SyscallABI): windows_i386 = ABI('esp', [], 4, 0) windows_amd64 = ABI('rsp', ['rcx','rdx','r8','r9'], 32, 32) + +darwin_aarch64 = sysv_aarch64 +darwin_aarch64_syscall = SyscallABI('sp', ['x16', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5'], 16, 0) +darwin_aarch64_sigreturn = SigreturnABI('sp', ['x16'], 16, 0) + +darwin_amd64 = sysv_amd64 +darwin_amd64_syscall = SyscallABI('rsp', ['rax', 'rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'], 8, 0) +darwin_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 8, 0) diff --git a/pwnlib/asm.py b/pwnlib/asm.py index b37d39c8a..814621bcc 100644 --- a/pwnlib/asm.py +++ b/pwnlib/asm.py @@ -469,6 +469,7 @@ def cpp(shellcode): ] return _run(cmd, code).strip('\n').rstrip() + '\n' + @LocalContext def make_elf_from_assembly(assembly, vma=None, @@ -651,6 +652,68 @@ def make_elf(data, return retval + +@LocalContext +def make_macho_from_assembly(shellcode): + return make_macho(shellcode, is_shellcode=True) + + +@LocalContext +def make_macho(data, is_shellcode=False): + prefix = [] + if context.arch == 'amd64': + prefix = [ + '.intel_syntax noprefix', + ] + prefix.extend([ + '.text', + '.global _start', + '_start:', + '.p2align 2', + ]) + code = '' + code += '\n'.join(prefix) + '\n' + if is_shellcode: + code += cpp(data) + else: + code += '.string "%s"' % ''.join('\\x%02x' % c for c in bytearray(data)) + + log.debug('Assembling\n%s' % code) + + tmpdir = tempfile.mkdtemp(prefix = 'pwn-asm-') + step1 = path.join(tmpdir, 'step1') + step2 = path.join(tmpdir, 'step2') + step3 = path.join(tmpdir, 'step3') + + with open(step1, 'w') as fd: + fd.write(code) + + assembler = [ + '/usr/bin/as', + ] + asflags = [ + '-mmacosx-version-min=11.0', + '-o', step2, step1, + ] + _run(assembler + asflags) + + linker = [ + '/usr/bin/ld', + ] + ldflags = [ + '-macosx_version_min', '11.0', + '-l', 'System', + '-e', '_start', + '-L', '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib', + '-o', step3, step2, + ] + _run(linker + ldflags) + + os.chmod(step3, 0o755) + + return step3 + + @LocalContext def asm(shellcode, vma = 0, extract = True, shared = False): r"""asm(code, vma = 0, extract = True, shared = False, ...) -> str diff --git a/pwnlib/constants/darwin/__init__.py b/pwnlib/constants/darwin/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 507403e8b..4788afd59 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -376,7 +376,7 @@ class ContextType(object): } #: Valid values for :meth:`pwnlib.context.ContextType.os` - oses = sorted(('linux','freebsd','windows','cgc','android','baremetal')) + oses = sorted(('linux','freebsd','windows','cgc','android','baremetal','darwin')) big_32 = {'endian': 'big', 'bits': 32} big_64 = {'endian': 'big', 'bits': 64} diff --git a/pwnlib/data/syscalls/Makefile b/pwnlib/data/syscalls/Makefile index 9bd7b2c3c..e80f50c2b 100644 --- a/pwnlib/data/syscalls/Makefile +++ b/pwnlib/data/syscalls/Makefile @@ -7,4 +7,7 @@ all: generate.py functions.py functions.py: wget https://raw.githubusercontent.com/zachriggle/functions/master/functions.py +generate_darwin: + python generate_darwin.py "$(ROOT)" + .phony: all diff --git a/pwnlib/data/syscalls/generate_darwin.py b/pwnlib/data/syscalls/generate_darwin.py new file mode 100644 index 000000000..96c3572b0 --- /dev/null +++ b/pwnlib/data/syscalls/generate_darwin.py @@ -0,0 +1,73 @@ + +# ./pwnlib/data/includes/darwin/aarch64.h +# ./pwnlib/constants/darwin/aarch64.py + +# https://github.com/nullgemm/instant_macos_sdk (old sdk here, please use real macos device) +# /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/ + +from pathlib import Path +import re +import sys + +# In the future, you should change the version of `MacOSX14.sdk` +sdk_path = Path('/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/') +if not sdk_path.exists(): + print('missing MacOSX sdk') + exit(1) + +project_path = Path(sys.argv[1]) + +regex = re.compile(r'^#define\s+([a-zA-Z0-9_-]+)\s+([0-9]+|0x[0-9a-fA-F]+)(?:\s|$)', re.DOTALL) + +out_data = {} +for file in sdk_path.iterdir(): + if not file.is_file(): + continue + + print(file.name) + for line in file.read_text(errors='ignore').split('\n'): + matched = regex.search(line) + if not matched: + continue + + key, value = matched.groups() + if value.startswith('0') and not value.startswith('0x') and len(value) > 1: + value = '0o'+value + + print(key, value) + out_data[key] = value + + +outbuf1_aarch64 = '' +outbuf1_aarch64 += "from pwnlib.constants.constant import Constant\n" + +outbuf1_amd64 = '' +outbuf1_amd64 += "from pwnlib.constants.constant import Constant\n" + +outbuf2_aarch64 = '' +outbuf2_amd64 = '' + +# https://www.idryman.org/blog/2014/12/02/writing-64-bit-assembly-on-mac-os-x/ +# on amd64 syscall offsets from 0x2000000 + syscall number + +for key, value in out_data.items(): + value_octal = value + if value_octal.startswith('0o'): + value_octal = value_octal.replace('0o', '0') + + outbuf1_aarch64 += "{} = Constant('{}',{})\n".format(key, key, value) + outbuf2_aarch64 += "#define {} {}\n".format(key, value_octal) + + if key.startswith('SYS_'): + value = f'{value} + 0x2000000' + value_octal = f'{value_octal} + 0x2000000' + + outbuf1_amd64 += "{} = Constant('{}',{})\n".format(key, key, value) + outbuf2_amd64 += "#define {} {}\n".format(key, value_octal) + +pp = project_path +(pp / Path('./pwnlib/constants/darwin/aarch64.py')).write_bytes(outbuf1_aarch64.encode()) +(pp / Path('./pwnlib/data/includes/darwin/aarch64.h')).write_bytes(outbuf2_aarch64.encode()) + +(pp / Path('./pwnlib/constants/darwin/amd64.py')).write_bytes(outbuf1_amd64.encode()) +(pp / Path('./pwnlib/data/includes/darwin/amd64.h')).write_bytes(outbuf2_amd64.encode()) diff --git a/pwnlib/elf/corefile.py b/pwnlib/elf/corefile.py index 02ac36ebf..ccacaf0b0 100644 --- a/pwnlib/elf/corefile.py +++ b/pwnlib/elf/corefile.py @@ -72,6 +72,7 @@ import socket import subprocess import tempfile +import sys from io import BytesIO, StringIO diff --git a/pwnlib/runner.py b/pwnlib/runner.py index b501e580e..14786e4d4 100644 --- a/pwnlib/runner.py +++ b/pwnlib/runner.py @@ -2,9 +2,10 @@ from __future__ import division import os +import sys import tempfile -from pwnlib.context import LocalContext +from pwnlib.context import LocalContext, context from pwnlib.elf import ELF from pwnlib.tubes.process import process @@ -31,6 +32,14 @@ def run_assembly(assembly): >>> p.poll() 12 """ + if context.os == 'darwin': + if sys.platform != 'darwin': + raise ValueError('Running Mach-O only supported on Darwin machines. Please use:\n' + '- https://github.com/MatthewCroughan/NixThePlanet\n' + '- https://github.com/sickcodes/Docker-OSX') + from pwnlib.asm import make_macho_from_assembly + return process(make_macho_from_assembly(assembly)) + return ELF.from_assembly(assembly).process() @LocalContext @@ -51,6 +60,14 @@ def run_shellcode(bytes, **kw): >>> p.poll() 12 """ + if context.os == 'darwin': + if sys.platform != 'darwin': + raise ValueError('Running Mach-O only supported on Darwin machines. Please use:\n' + '- https://github.com/MatthewCroughan/NixThePlanet\n' + '- https://github.com/sickcodes/Docker-OSX') + from pwnlib.asm import make_macho + return process(make_macho(bytes)) + return ELF.from_bytes(bytes, **kw).process() @LocalContext From 5d32b2499893f715d474e96bc2cd675167ecbfc1 Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 18:27:33 +0100 Subject: [PATCH 041/107] add darwin shellcrafter templates --- .../templates/aarch64/darwin/__doc__ | 0 .../templates/aarch64/darwin/cat.asm | 24 ++++ .../templates/aarch64/darwin/cat2.asm | 25 ++++ .../templates/aarch64/darwin/open.asm | 9 ++ .../templates/aarch64/darwin/syscall.asm | 61 ++++++++++ .../templates/aarch64/darwin/syscalls/__doc__ | 0 .../aarch64/darwin/syscalls/execve.asm | 103 ++++++++++++++++ .../aarch64/darwin/syscalls/exit.asm | 101 ++++++++++++++++ .../darwin/syscalls/getdirentries64.asm | 106 +++++++++++++++++ .../aarch64/darwin/syscalls/getxattr.asm | 106 +++++++++++++++++ .../aarch64/darwin/syscalls/lseek.asm | 103 ++++++++++++++++ .../aarch64/darwin/syscalls/read.asm | 103 ++++++++++++++++ .../aarch64/darwin/syscalls/write.asm | 103 ++++++++++++++++ .../shellcraft/templates/amd64/darwin/__doc__ | 0 .../shellcraft/templates/amd64/darwin/cat.asm | 16 +++ .../templates/amd64/darwin/cat2.asm | 14 +++ .../templates/amd64/darwin/open.asm | 9 ++ .../templates/amd64/darwin/syscall.asm | 112 ++++++++++++++++++ .../templates/amd64/darwin/syscalls/__doc__ | 0 .../amd64/darwin/syscalls/execve.asm | 103 ++++++++++++++++ .../templates/amd64/darwin/syscalls/exit.asm | 101 ++++++++++++++++ .../amd64/darwin/syscalls/getdirentries64.asm | 106 +++++++++++++++++ .../amd64/darwin/syscalls/getxattr.asm | 106 +++++++++++++++++ .../templates/amd64/darwin/syscalls/lseek.asm | 103 ++++++++++++++++ .../templates/amd64/darwin/syscalls/read.asm | 103 ++++++++++++++++ .../templates/amd64/darwin/syscalls/write.asm | 103 ++++++++++++++++ 26 files changed, 1720 insertions(+) create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/__doc__ create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/cat.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/cat2.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/open.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/__doc__ create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm create mode 100644 pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/__doc__ create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/cat.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/cat2.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/open.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscall.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/__doc__ create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm create mode 100644 pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/__doc__ b/pwnlib/shellcraft/templates/aarch64/darwin/__doc__ new file mode 100644 index 000000000..e69de29bb diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/cat.asm b/pwnlib/shellcraft/templates/aarch64/darwin/cat.asm new file mode 100644 index 000000000..9b889ae7e --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/cat.asm @@ -0,0 +1,24 @@ +<% + from pwnlib import shellcraft +%> +<%page args="filename, fd=1"/> +<%docstring> +Opens a file and writes its contents to the specified file descriptor. + +Example: + + >>> f = tempfile.mktemp() + >>> write(f, 'This is the flag\n') + >>> shellcode = shellcraft.cat(f) + shellcraft.exit(0) + >>> run_assembly(shellcode).recvline() + b'This is the flag\n' + +<% +if fd == 'x0': + raise Exception("File descriptor cannot be x0, it will be overwritten") +raise Exception("not implemented, please use 'cat2'") +%> + ${shellcraft.open(filename)} + /* osx: int sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr *hdtr, int flags); */ + /* linux: ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count); */ + ${shellcraft.syscall('SYS_sendfile', fd, 'x0', 0, 0x7fffffff)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/cat2.asm b/pwnlib/shellcraft/templates/aarch64/darwin/cat2.asm new file mode 100644 index 000000000..de9e5817b --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/cat2.asm @@ -0,0 +1,25 @@ +<% + from pwnlib import shellcraft +%> +<%page args="filename, fd=1, length=0x4000"/> +<%docstring> +Opens a file and writes its contents to the specified file descriptor. +Uses an extra stack buffer and must know the length. + +Example: + + >>> f = tempfile.mktemp() + >>> write(f, 'This is the flag\n') + >>> shellcode = shellcraft.cat2(f) + shellcraft.exit(0) + >>> run_assembly(shellcode).recvline() + b'This is the flag\n' + +<% +if fd == 'x0': + raise Exception("File descriptor cannot be x0, it will be overwritten") +%> + ${shellcraft.open(filename)} + ${shellcraft.mov('x2', length)} + sub sp, sp, x2 + ${shellcraft.read('x0', 'sp', 'x2')} + ${shellcraft.write(fd, 'sp', 'x0')} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/open.asm b/pwnlib/shellcraft/templates/aarch64/darwin/open.asm new file mode 100644 index 000000000..2563d8f6f --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/open.asm @@ -0,0 +1,9 @@ +<% + from pwnlib import shellcraft +%> +<%page args="filename, flags='O_RDONLY', mode='x3'"/> +<%docstring> +Opens a file + + ${shellcraft.pushstr(filename)} + ${shellcraft.syscall('SYS_open', 'sp', flags, mode)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm new file mode 100644 index 000000000..fb3d2318c --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm @@ -0,0 +1,61 @@ +<% + from pwnlib.shellcraft import aarch64, pretty + from pwnlib.constants import Constant + from pwnlib.abi import darwin_aarch64_syscall as abi + from six import text_type +%> +<%page args="syscall = None, arg0 = None, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None"/> +<%docstring> +Args: [syscall_number, \*args] + Does a syscall + +Any of the arguments can be expressions to be evaluated by :func:`pwnlib.constants.eval`. + +Example: + + >>> print(shellcraft.aarch64.darwin.syscall(11, 1, 'sp', 2, 0).rstrip()) + /* call syscall(11, 1, 'sp', 2, 0) */ + mov x0, #1 + mov x1, sp + mov x2, #2 + mov x3, xzr + mov x16, #11 + svc 0 + >>> print(shellcraft.aarch64.darwin.syscall('SYS_exit', 0).rstrip()) + /* call exit(0) */ + mov x0, xzr + mov x16, #SYS_exit + svc 0 + +<% + if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + syscall_repr = str(syscall)[4:] + "(%s)" + args = [] + else: + syscall_repr = 'syscall(%s)' + if syscall is None: + args = ['?'] + else: + args = [pretty(syscall, False)] + + for arg in [arg0, arg1, arg2, arg3, arg4, arg5]: + if arg is None: + args.append('?') + else: + args.append(pretty(arg, False)) + while args and args[-1] == '?': + args.pop() + syscall_repr = syscall_repr % ', '.join(args) + + registers = abi.register_arguments + arguments = [syscall, arg0, arg1, arg2, arg3, arg4, arg5] + arguments = iter(filter(lambda arg: arg is not None, arguments)) + regctx = dict(zip(registers, arguments)) + stack_args = reversed(list(arguments)) # push remaining args on stack in reverse order +%>\ + /* call ${syscall_repr} */ + ${aarch64.setregs(regctx)} +%for arg in stack_args: + ${aarch64.push(arg)} +%endfor + svc 0 diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/__doc__ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/__doc__ new file mode 100644 index 000000000..e69de29bb diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm new file mode 100644 index 000000000..1f74b7377 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>execve(path, argv, envp) -> str + +Invokes the syscall execve. + +See 'man 2 execve' for more information. + +Arguments: + path(char*): path + argv(char**): argv + envp(char**): envp +Returns: + int + +<%page args="path=0, argv=0, envp=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['path'] + can_pushstr_array = ['argv', 'envp'] + + argument_names = ['path', 'argv', 'envp'] + argument_values = [path, argv, envp] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_execve']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* execve(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm new file mode 100644 index 000000000..08e080de0 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>exit(status) -> str + +Invokes the syscall exit. + +See 'man 2 exit' for more information. + +Arguments: + status(int): status +Returns: + void + +<%page args="status=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['status'] + argument_values = [status] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_exit']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* exit(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm new file mode 100644 index 000000000..3e12b01f6 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm @@ -0,0 +1,106 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>getdirentries64(fd, buf, bufsize, position) -> str + +Invokes the syscall getdirentries64. + +See 'man 2 getdirentries64' for more information. + +Arguments: + fd(int): fd + buf(char*): buf + bufsize(user_size_t): bufsize + position(off_t*): position +Returns: + ssize_t + +<%page args="fd=0, buf=0, bufsize=0, position=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['buf'] + can_pushstr_array = [] + + argument_names = ['fd', 'buf', 'bufsize', 'position'] + argument_values = [fd, buf, bufsize, position] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + print('index', index, name) + print('regs', regs) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_getdirentries64']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* getdirentries64(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm new file mode 100644 index 000000000..42806a004 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm @@ -0,0 +1,106 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>getxattr(path, name, value, size) -> str + +Invokes the syscall getxattr. + +See 'man 2 getxattr' for more information. + +Arguments: + path(char*): path + name(char*): name + value(void*): value + size(size_t): size +Returns: + ssize_t + +<%page args="path=0, name=0, value=0, size=0, position=0, options=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['path', 'name', 'value'] + can_pushstr_array = [] + + argument_names = ['path', 'name', 'value', 'size', 'position', 'options'] + argument_values = [path, name, value, size, position, options] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + print('index', index, name) + print('regs', regs) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_getxattr']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* getxattr(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm new file mode 100644 index 000000000..a5f691716 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>lseek(fd, offset, whence) -> str + +Invokes the syscall lseek. + +See 'man 2 lseek' for more information. + +Arguments: + fd(int): fd + offset(off_t): offset + whence(int): whence +Returns: + off_t + +<%page args="fd=0, offset=0, whence=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['fd', 'offset', 'whence'] + argument_values = [fd, offset, whence] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_lseek']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* lseek(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm new file mode 100644 index 000000000..b4fe7b4e8 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>read(fd, buf, nbytes) -> str + +Invokes the syscall read. + +See 'man 2 read' for more information. + +Arguments: + fd(int): fd + buf(void*): buf + nbytes(size_t): nbytes +Returns: + ssize_t + +<%page args="fd=0, buf=0, nbytes=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['buf'] + can_pushstr_array = [] + + argument_names = ['fd', 'buf', 'nbytes'] + argument_values = [fd, buf, nbytes] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_read']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* read(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm new file mode 100644 index 000000000..a20c06995 --- /dev/null +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>write(fd, buf, n) -> str + +Invokes the syscall write. + +See 'man 2 write' for more information. + +Arguments: + fd(int): fd + buf(void*): buf + n(size_t): n +Returns: + ssize_t + +<%page args="fd=0, buf=0, n=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['buf'] + can_pushstr_array = [] + + argument_names = ['fd', 'buf', 'n'] + argument_values = [fd, buf, n] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_write']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* write(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/__doc__ b/pwnlib/shellcraft/templates/amd64/darwin/__doc__ new file mode 100644 index 000000000..e69de29bb diff --git a/pwnlib/shellcraft/templates/amd64/darwin/cat.asm b/pwnlib/shellcraft/templates/amd64/darwin/cat.asm new file mode 100644 index 000000000..b4b0a3178 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/cat.asm @@ -0,0 +1,16 @@ +<% + from pwnlib.shellcraft.amd64 import syscall, pushstr + from pwnlib.shellcraft import common +%> +<%page args="filename, fd=1"/> +<%docstring> +Opens a file and writes its contents to the specified file descriptor. + +<% +raise Exception("not implemented, please use 'cat2'") +%> + ${pushstr(filename)} + ${syscall('SYS_open', 'rsp', 'O_RDONLY', 'rdx')} + /* osx: int sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr *hdtr, int flags); */ + /* linux: ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count); */ + ${syscall('SYS_sendfile', fd, 'rax', 0, 0x7fffffff)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/cat2.asm b/pwnlib/shellcraft/templates/amd64/darwin/cat2.asm new file mode 100644 index 000000000..aa9deaaa9 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/cat2.asm @@ -0,0 +1,14 @@ +<% + from pwnlib import shellcraft +%> +<%page args="filename, fd=1, length=0x4000"/> +<%docstring> +Opens a file and writes its contents to the specified file descriptor. +Uses an extra stack buffer and must know the length. + + + ${shellcraft.open(filename)} + ${shellcraft.mov('rdx', length)} + sub rsp, rdx + ${shellcraft.read('rax', 'rsp', 'rdx')} + ${shellcraft.write(fd, 'rsp', 'rax')} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/open.asm b/pwnlib/shellcraft/templates/amd64/darwin/open.asm new file mode 100644 index 000000000..a3d1efca8 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/open.asm @@ -0,0 +1,9 @@ +<% + from pwnlib import shellcraft +%> +<%page args="filename, flags='O_RDONLY', mode='rdx'"/> +<%docstring> +Opens a file + + ${shellcraft.pushstr(filename)} + ${shellcraft.syscall('SYS_open', 'rsp', flags, mode)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm new file mode 100644 index 000000000..526d9a4d1 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm @@ -0,0 +1,112 @@ +<% + from pwnlib.shellcraft import amd64, pretty + from pwnlib.constants import Constant + from pwnlib.abi import darwin_amd64_syscall as abi + from six import text_type +%> +<%page args="syscall = None, arg0 = None, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None"/> +<%docstring> +Args: [syscall_number, \*args] + Does a syscall + +Any of the arguments can be expressions to be evaluated by :func:`pwnlib.constants.eval`. + +Example: + + >>> print(pwnlib.shellcraft.amd64.darwin.syscall('SYS_execve', 1, 'rsp', 2, 0).rstrip()) + /* call execve(1, 'rsp', 2, 0) */ + xor r10d, r10d /* 0 */ + push SYS_execve /* 0x3b */ + pop rax + push 1 + pop rdi + push 2 + pop rdx + mov rsi, rsp + syscall + >>> print(pwnlib.shellcraft.amd64.darwin.syscall('SYS_execve', 2, 1, 0, -1).rstrip()) + /* call execve(2, 1, 0, -1) */ + push -1 + pop r10 + push SYS_execve /* 0x3b */ + pop rax + push 2 + pop rdi + push 1 + pop rsi + cdq /* rdx=0 */ + syscall + >>> print(pwnlib.shellcraft.amd64.darwin.syscall().rstrip()) + /* call syscall() */ + syscall + >>> print(pwnlib.shellcraft.amd64.darwin.syscall('rax', 'rdi', 'rsi').rstrip()) + /* call syscall('rax', 'rdi', 'rsi') */ + /* setregs noop */ + syscall + >>> print(pwnlib.shellcraft.amd64.darwin.syscall('rbp', None, None, 1).rstrip()) + /* call syscall('rbp', ?, ?, 1) */ + mov rax, rbp + push 1 + pop rdx + syscall + >>> print(pwnlib.shellcraft.open('/home/pwn/flag').rstrip()) + /* open(file='/home/pwn/flag', oflag=0, mode=0) */ + /* push b'/home/pwn/flag\x00' */ + mov rax, 0x101010101010101 + push rax + mov rax, 0x101010101010101 ^ 0x67616c662f6e + xor [rsp], rax + mov rax, 0x77702f656d6f682f + push rax + mov rdi, rsp + xor edx, edx /* 0 */ + xor esi, esi /* 0 */ + /* call open() */ + push SYS_open /* 2 */ + pop rax + syscall + >>> print(shellcraft.amd64.write(0, '*/', 2).rstrip()) + /* write(fd=0, buf='\x2a/', n=2) */ + /* push b'\x2a/\x00' */ + push 0x1010101 ^ 0x2f2a + xor dword ptr [rsp], 0x1010101 + mov rsi, rsp + xor edi, edi /* 0 */ + push 2 + pop rdx + /* call write() */ + push SYS_write /* 1 */ + pop rax + syscall + + +<% + append_cdq = False + if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + syscall_repr = str(syscall)[4:] + "(%s)" + args = [] + else: + syscall_repr = 'syscall(%s)' + if syscall is None: + args = ['?'] + else: + args = [pretty(syscall, False)] + + for arg in [arg0, arg1, arg2, arg3, arg4, arg5]: + if arg is None: + args.append('?') + else: + args.append(pretty(arg, False)) + while args and args[-1] == '?': + args.pop() + syscall_repr = syscall_repr % ', '.join(args) + + registers = abi.register_arguments + arguments = [syscall, arg0, arg1, arg2, arg3, arg4, arg5] + regctx = dict(zip(registers, arguments)) +%>\ + /* call ${syscall_repr} */ +%if any(a is not None for a in arguments): + ${amd64.setregs(regctx)} +%endif + syscall diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/__doc__ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/__doc__ new file mode 100644 index 000000000..e69de29bb diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm new file mode 100644 index 000000000..1f74b7377 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>execve(path, argv, envp) -> str + +Invokes the syscall execve. + +See 'man 2 execve' for more information. + +Arguments: + path(char*): path + argv(char**): argv + envp(char**): envp +Returns: + int + +<%page args="path=0, argv=0, envp=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['path'] + can_pushstr_array = ['argv', 'envp'] + + argument_names = ['path', 'argv', 'envp'] + argument_values = [path, argv, envp] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_execve']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* execve(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm new file mode 100644 index 000000000..08e080de0 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>exit(status) -> str + +Invokes the syscall exit. + +See 'man 2 exit' for more information. + +Arguments: + status(int): status +Returns: + void + +<%page args="status=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['status'] + argument_values = [status] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_exit']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* exit(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm new file mode 100644 index 000000000..3e12b01f6 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm @@ -0,0 +1,106 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>getdirentries64(fd, buf, bufsize, position) -> str + +Invokes the syscall getdirentries64. + +See 'man 2 getdirentries64' for more information. + +Arguments: + fd(int): fd + buf(char*): buf + bufsize(user_size_t): bufsize + position(off_t*): position +Returns: + ssize_t + +<%page args="fd=0, buf=0, bufsize=0, position=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['buf'] + can_pushstr_array = [] + + argument_names = ['fd', 'buf', 'bufsize', 'position'] + argument_values = [fd, buf, bufsize, position] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + print('index', index, name) + print('regs', regs) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_getdirentries64']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* getdirentries64(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm new file mode 100644 index 000000000..42806a004 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm @@ -0,0 +1,106 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>getxattr(path, name, value, size) -> str + +Invokes the syscall getxattr. + +See 'man 2 getxattr' for more information. + +Arguments: + path(char*): path + name(char*): name + value(void*): value + size(size_t): size +Returns: + ssize_t + +<%page args="path=0, name=0, value=0, size=0, position=0, options=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['path', 'name', 'value'] + can_pushstr_array = [] + + argument_names = ['path', 'name', 'value', 'size', 'position', 'options'] + argument_values = [path, name, value, size, position, options] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + print('index', index, name) + print('regs', regs) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_getxattr']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* getxattr(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm new file mode 100644 index 000000000..a5f691716 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>lseek(fd, offset, whence) -> str + +Invokes the syscall lseek. + +See 'man 2 lseek' for more information. + +Arguments: + fd(int): fd + offset(off_t): offset + whence(int): whence +Returns: + off_t + +<%page args="fd=0, offset=0, whence=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['fd', 'offset', 'whence'] + argument_values = [fd, offset, whence] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_lseek']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* lseek(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm new file mode 100644 index 000000000..b4fe7b4e8 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>read(fd, buf, nbytes) -> str + +Invokes the syscall read. + +See 'man 2 read' for more information. + +Arguments: + fd(int): fd + buf(void*): buf + nbytes(size_t): nbytes +Returns: + ssize_t + +<%page args="fd=0, buf=0, nbytes=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['buf'] + can_pushstr_array = [] + + argument_names = ['fd', 'buf', 'nbytes'] + argument_values = [fd, buf, nbytes] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_read']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* read(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm new file mode 100644 index 000000000..a20c06995 --- /dev/null +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm @@ -0,0 +1,103 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>write(fd, buf, n) -> str + +Invokes the syscall write. + +See 'man 2 write' for more information. + +Arguments: + fd(int): fd + buf(void*): buf + n(size_t): n +Returns: + ssize_t + +<%page args="fd=0, buf=0, n=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['buf'] + can_pushstr_array = [] + + argument_names = ['fd', 'buf', 'n'] + argument_values = [fd, buf, n] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_write']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* write(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} From 8b56039d88c7aff41748502d3bfc881dd93f80f9 Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 18:28:05 +0100 Subject: [PATCH 042/107] add auto generated files for darwin (make generate_darwin) --- pwnlib/constants/darwin/aarch64.py | 3231 +++++++++++++++++++++++++ pwnlib/constants/darwin/amd64.py | 3231 +++++++++++++++++++++++++ pwnlib/data/includes/darwin/aarch64.h | 3230 ++++++++++++++++++++++++ pwnlib/data/includes/darwin/amd64.h | 3230 ++++++++++++++++++++++++ 4 files changed, 12922 insertions(+) create mode 100644 pwnlib/constants/darwin/aarch64.py create mode 100644 pwnlib/constants/darwin/amd64.py create mode 100644 pwnlib/data/includes/darwin/aarch64.h create mode 100644 pwnlib/data/includes/darwin/amd64.h diff --git a/pwnlib/constants/darwin/aarch64.py b/pwnlib/constants/darwin/aarch64.py new file mode 100644 index 000000000..974670014 --- /dev/null +++ b/pwnlib/constants/darwin/aarch64.py @@ -0,0 +1,3231 @@ +from pwnlib.constants.constant import Constant +ITIMER_REAL = Constant('ITIMER_REAL',0) +ITIMER_VIRTUAL = Constant('ITIMER_VIRTUAL',1) +ITIMER_PROF = Constant('ITIMER_PROF',2) +DST_NONE = Constant('DST_NONE',0) +DST_USA = Constant('DST_USA',1) +DST_AUST = Constant('DST_AUST',2) +DST_WET = Constant('DST_WET',3) +DST_MET = Constant('DST_MET',4) +DST_EET = Constant('DST_EET',5) +DST_CAN = Constant('DST_CAN',6) +CHILD_MAX = Constant('CHILD_MAX',266) +LINK_MAX = Constant('LINK_MAX',32767) +MAX_CANON = Constant('MAX_CANON',1024) +MAX_INPUT = Constant('MAX_INPUT',1024) +NAME_MAX = Constant('NAME_MAX',255) +NGROUPS_MAX = Constant('NGROUPS_MAX',16) +OPEN_MAX = Constant('OPEN_MAX',10240) +PATH_MAX = Constant('PATH_MAX',1024) +PIPE_BUF = Constant('PIPE_BUF',512) +BC_BASE_MAX = Constant('BC_BASE_MAX',99) +BC_DIM_MAX = Constant('BC_DIM_MAX',2048) +BC_SCALE_MAX = Constant('BC_SCALE_MAX',99) +BC_STRING_MAX = Constant('BC_STRING_MAX',1000) +CHARCLASS_NAME_MAX = Constant('CHARCLASS_NAME_MAX',14) +COLL_WEIGHTS_MAX = Constant('COLL_WEIGHTS_MAX',2) +EQUIV_CLASS_MAX = Constant('EQUIV_CLASS_MAX',2) +EXPR_NEST_MAX = Constant('EXPR_NEST_MAX',32) +LINE_MAX = Constant('LINE_MAX',2048) +RE_DUP_MAX = Constant('RE_DUP_MAX',255) +NZERO = Constant('NZERO',0) +GETNCNT = Constant('GETNCNT',3) +GETPID = Constant('GETPID',4) +GETVAL = Constant('GETVAL',5) +GETALL = Constant('GETALL',6) +GETZCNT = Constant('GETZCNT',7) +SETVAL = Constant('SETVAL',8) +SETALL = Constant('SETALL',9) +SEM_UNDO = Constant('SEM_UNDO',0o010000) +SEM_A = Constant('SEM_A',0o0200) +SEM_R = Constant('SEM_R',0o0400) +PSEMNAMLEN = Constant('PSEMNAMLEN',31) +PSEM_NONE = Constant('PSEM_NONE',1) +PSEM_DEFINED = Constant('PSEM_DEFINED',2) +PSEM_ALLOCATED = Constant('PSEM_ALLOCATED',4) +PSEM_MAPPED = Constant('PSEM_MAPPED',8) +PSEM_INUSE = Constant('PSEM_INUSE',0x10) +PSEM_REMOVED = Constant('PSEM_REMOVED',0x20) +PSEM_INCREATE = Constant('PSEM_INCREATE',0x40) +PSEM_INDELETE = Constant('PSEM_INDELETE',0x80) +FSOPT_NOFOLLOW = Constant('FSOPT_NOFOLLOW',0x00000001) +FSOPT_NOINMEMUPDATE = Constant('FSOPT_NOINMEMUPDATE',0x00000002) +FSOPT_REPORT_FULLSIZE = Constant('FSOPT_REPORT_FULLSIZE',0x00000004) +FSOPT_PACK_INVAL_ATTRS = Constant('FSOPT_PACK_INVAL_ATTRS',0x00000008) +FSOPT_ATTR_CMN_EXTENDED = Constant('FSOPT_ATTR_CMN_EXTENDED',0x00000020) +FSOPT_RETURN_REALDEV = Constant('FSOPT_RETURN_REALDEV',0x00000200) +FSOPT_NOFOLLOW_ANY = Constant('FSOPT_NOFOLLOW_ANY',0x00000800) +SEARCHFS_MAX_SEARCHPARMS = Constant('SEARCHFS_MAX_SEARCHPARMS',4096) +ATTR_BIT_MAP_COUNT = Constant('ATTR_BIT_MAP_COUNT',5) +VOL_CAPABILITIES_FORMAT = Constant('VOL_CAPABILITIES_FORMAT',0) +VOL_CAPABILITIES_INTERFACES = Constant('VOL_CAPABILITIES_INTERFACES',1) +VOL_CAPABILITIES_RESERVED1 = Constant('VOL_CAPABILITIES_RESERVED1',2) +VOL_CAPABILITIES_RESERVED2 = Constant('VOL_CAPABILITIES_RESERVED2',3) +ATTR_MAX_BUFFER = Constant('ATTR_MAX_BUFFER',8192) +VOL_CAP_FMT_PERSISTENTOBJECTIDS = Constant('VOL_CAP_FMT_PERSISTENTOBJECTIDS',0x00000001) +VOL_CAP_FMT_SYMBOLICLINKS = Constant('VOL_CAP_FMT_SYMBOLICLINKS',0x00000002) +VOL_CAP_FMT_HARDLINKS = Constant('VOL_CAP_FMT_HARDLINKS',0x00000004) +VOL_CAP_FMT_JOURNAL = Constant('VOL_CAP_FMT_JOURNAL',0x00000008) +VOL_CAP_FMT_JOURNAL_ACTIVE = Constant('VOL_CAP_FMT_JOURNAL_ACTIVE',0x00000010) +VOL_CAP_FMT_NO_ROOT_TIMES = Constant('VOL_CAP_FMT_NO_ROOT_TIMES',0x00000020) +VOL_CAP_FMT_SPARSE_FILES = Constant('VOL_CAP_FMT_SPARSE_FILES',0x00000040) +VOL_CAP_FMT_ZERO_RUNS = Constant('VOL_CAP_FMT_ZERO_RUNS',0x00000080) +VOL_CAP_FMT_CASE_SENSITIVE = Constant('VOL_CAP_FMT_CASE_SENSITIVE',0x00000100) +VOL_CAP_FMT_CASE_PRESERVING = Constant('VOL_CAP_FMT_CASE_PRESERVING',0x00000200) +VOL_CAP_FMT_FAST_STATFS = Constant('VOL_CAP_FMT_FAST_STATFS',0x00000400) +VOL_CAP_FMT_2TB_FILESIZE = Constant('VOL_CAP_FMT_2TB_FILESIZE',0x00000800) +VOL_CAP_FMT_OPENDENYMODES = Constant('VOL_CAP_FMT_OPENDENYMODES',0x00001000) +VOL_CAP_FMT_HIDDEN_FILES = Constant('VOL_CAP_FMT_HIDDEN_FILES',0x00002000) +VOL_CAP_FMT_PATH_FROM_ID = Constant('VOL_CAP_FMT_PATH_FROM_ID',0x00004000) +VOL_CAP_FMT_NO_VOLUME_SIZES = Constant('VOL_CAP_FMT_NO_VOLUME_SIZES',0x00008000) +VOL_CAP_FMT_DECMPFS_COMPRESSION = Constant('VOL_CAP_FMT_DECMPFS_COMPRESSION',0x00010000) +VOL_CAP_FMT_64BIT_OBJECT_IDS = Constant('VOL_CAP_FMT_64BIT_OBJECT_IDS',0x00020000) +VOL_CAP_FMT_DIR_HARDLINKS = Constant('VOL_CAP_FMT_DIR_HARDLINKS',0x00040000) +VOL_CAP_FMT_DOCUMENT_ID = Constant('VOL_CAP_FMT_DOCUMENT_ID',0x00080000) +VOL_CAP_FMT_WRITE_GENERATION_COUNT = Constant('VOL_CAP_FMT_WRITE_GENERATION_COUNT',0x00100000) +VOL_CAP_FMT_NO_IMMUTABLE_FILES = Constant('VOL_CAP_FMT_NO_IMMUTABLE_FILES',0x00200000) +VOL_CAP_FMT_NO_PERMISSIONS = Constant('VOL_CAP_FMT_NO_PERMISSIONS',0x00400000) +VOL_CAP_FMT_SHARED_SPACE = Constant('VOL_CAP_FMT_SHARED_SPACE',0x00800000) +VOL_CAP_FMT_VOL_GROUPS = Constant('VOL_CAP_FMT_VOL_GROUPS',0x01000000) +VOL_CAP_FMT_SEALED = Constant('VOL_CAP_FMT_SEALED',0x02000000) +VOL_CAP_INT_SEARCHFS = Constant('VOL_CAP_INT_SEARCHFS',0x00000001) +VOL_CAP_INT_ATTRLIST = Constant('VOL_CAP_INT_ATTRLIST',0x00000002) +VOL_CAP_INT_NFSEXPORT = Constant('VOL_CAP_INT_NFSEXPORT',0x00000004) +VOL_CAP_INT_READDIRATTR = Constant('VOL_CAP_INT_READDIRATTR',0x00000008) +VOL_CAP_INT_EXCHANGEDATA = Constant('VOL_CAP_INT_EXCHANGEDATA',0x00000010) +VOL_CAP_INT_COPYFILE = Constant('VOL_CAP_INT_COPYFILE',0x00000020) +VOL_CAP_INT_ALLOCATE = Constant('VOL_CAP_INT_ALLOCATE',0x00000040) +VOL_CAP_INT_VOL_RENAME = Constant('VOL_CAP_INT_VOL_RENAME',0x00000080) +VOL_CAP_INT_ADVLOCK = Constant('VOL_CAP_INT_ADVLOCK',0x00000100) +VOL_CAP_INT_FLOCK = Constant('VOL_CAP_INT_FLOCK',0x00000200) +VOL_CAP_INT_EXTENDED_SECURITY = Constant('VOL_CAP_INT_EXTENDED_SECURITY',0x00000400) +VOL_CAP_INT_USERACCESS = Constant('VOL_CAP_INT_USERACCESS',0x00000800) +VOL_CAP_INT_MANLOCK = Constant('VOL_CAP_INT_MANLOCK',0x00001000) +VOL_CAP_INT_NAMEDSTREAMS = Constant('VOL_CAP_INT_NAMEDSTREAMS',0x00002000) +VOL_CAP_INT_EXTENDED_ATTR = Constant('VOL_CAP_INT_EXTENDED_ATTR',0x00004000) +VOL_CAP_INT_CLONE = Constant('VOL_CAP_INT_CLONE',0x00010000) +VOL_CAP_INT_SNAPSHOT = Constant('VOL_CAP_INT_SNAPSHOT',0x00020000) +VOL_CAP_INT_RENAME_SWAP = Constant('VOL_CAP_INT_RENAME_SWAP',0x00040000) +VOL_CAP_INT_RENAME_EXCL = Constant('VOL_CAP_INT_RENAME_EXCL',0x00080000) +VOL_CAP_INT_RENAME_OPENFAIL = Constant('VOL_CAP_INT_RENAME_OPENFAIL',0x00100000) +VOL_CAP_INT_RENAME_SECLUDE = Constant('VOL_CAP_INT_RENAME_SECLUDE',0x00200000) +ATTR_CMN_NAME = Constant('ATTR_CMN_NAME',0x00000001) +ATTR_CMN_DEVID = Constant('ATTR_CMN_DEVID',0x00000002) +ATTR_CMN_FSID = Constant('ATTR_CMN_FSID',0x00000004) +ATTR_CMN_OBJTYPE = Constant('ATTR_CMN_OBJTYPE',0x00000008) +ATTR_CMN_OBJTAG = Constant('ATTR_CMN_OBJTAG',0x00000010) +ATTR_CMN_OBJID = Constant('ATTR_CMN_OBJID',0x00000020) +ATTR_CMN_OBJPERMANENTID = Constant('ATTR_CMN_OBJPERMANENTID',0x00000040) +ATTR_CMN_PAROBJID = Constant('ATTR_CMN_PAROBJID',0x00000080) +ATTR_CMN_SCRIPT = Constant('ATTR_CMN_SCRIPT',0x00000100) +ATTR_CMN_CRTIME = Constant('ATTR_CMN_CRTIME',0x00000200) +ATTR_CMN_MODTIME = Constant('ATTR_CMN_MODTIME',0x00000400) +ATTR_CMN_CHGTIME = Constant('ATTR_CMN_CHGTIME',0x00000800) +ATTR_CMN_ACCTIME = Constant('ATTR_CMN_ACCTIME',0x00001000) +ATTR_CMN_BKUPTIME = Constant('ATTR_CMN_BKUPTIME',0x00002000) +ATTR_CMN_FNDRINFO = Constant('ATTR_CMN_FNDRINFO',0x00004000) +ATTR_CMN_OWNERID = Constant('ATTR_CMN_OWNERID',0x00008000) +ATTR_CMN_GRPID = Constant('ATTR_CMN_GRPID',0x00010000) +ATTR_CMN_ACCESSMASK = Constant('ATTR_CMN_ACCESSMASK',0x00020000) +ATTR_CMN_FLAGS = Constant('ATTR_CMN_FLAGS',0x00040000) +ATTR_CMN_GEN_COUNT = Constant('ATTR_CMN_GEN_COUNT',0x00080000) +ATTR_CMN_DOCUMENT_ID = Constant('ATTR_CMN_DOCUMENT_ID',0x00100000) +ATTR_CMN_USERACCESS = Constant('ATTR_CMN_USERACCESS',0x00200000) +ATTR_CMN_EXTENDED_SECURITY = Constant('ATTR_CMN_EXTENDED_SECURITY',0x00400000) +ATTR_CMN_UUID = Constant('ATTR_CMN_UUID',0x00800000) +ATTR_CMN_GRPUUID = Constant('ATTR_CMN_GRPUUID',0x01000000) +ATTR_CMN_FILEID = Constant('ATTR_CMN_FILEID',0x02000000) +ATTR_CMN_PARENTID = Constant('ATTR_CMN_PARENTID',0x04000000) +ATTR_CMN_FULLPATH = Constant('ATTR_CMN_FULLPATH',0x08000000) +ATTR_CMN_ADDEDTIME = Constant('ATTR_CMN_ADDEDTIME',0x10000000) +ATTR_CMN_ERROR = Constant('ATTR_CMN_ERROR',0x20000000) +ATTR_CMN_DATA_PROTECT_FLAGS = Constant('ATTR_CMN_DATA_PROTECT_FLAGS',0x40000000) +ATTR_CMN_RETURNED_ATTRS = Constant('ATTR_CMN_RETURNED_ATTRS',0x80000000) +ATTR_CMN_VALIDMASK = Constant('ATTR_CMN_VALIDMASK',0xFFFFFFFF) +ATTR_CMN_SETMASK = Constant('ATTR_CMN_SETMASK',0x51C7FF00) +ATTR_CMN_VOLSETMASK = Constant('ATTR_CMN_VOLSETMASK',0x00006700) +ATTR_VOL_FSTYPE = Constant('ATTR_VOL_FSTYPE',0x00000001) +ATTR_VOL_SIGNATURE = Constant('ATTR_VOL_SIGNATURE',0x00000002) +ATTR_VOL_SIZE = Constant('ATTR_VOL_SIZE',0x00000004) +ATTR_VOL_SPACEFREE = Constant('ATTR_VOL_SPACEFREE',0x00000008) +ATTR_VOL_SPACEAVAIL = Constant('ATTR_VOL_SPACEAVAIL',0x00000010) +ATTR_VOL_MINALLOCATION = Constant('ATTR_VOL_MINALLOCATION',0x00000020) +ATTR_VOL_ALLOCATIONCLUMP = Constant('ATTR_VOL_ALLOCATIONCLUMP',0x00000040) +ATTR_VOL_IOBLOCKSIZE = Constant('ATTR_VOL_IOBLOCKSIZE',0x00000080) +ATTR_VOL_OBJCOUNT = Constant('ATTR_VOL_OBJCOUNT',0x00000100) +ATTR_VOL_FILECOUNT = Constant('ATTR_VOL_FILECOUNT',0x00000200) +ATTR_VOL_DIRCOUNT = Constant('ATTR_VOL_DIRCOUNT',0x00000400) +ATTR_VOL_MAXOBJCOUNT = Constant('ATTR_VOL_MAXOBJCOUNT',0x00000800) +ATTR_VOL_MOUNTPOINT = Constant('ATTR_VOL_MOUNTPOINT',0x00001000) +ATTR_VOL_NAME = Constant('ATTR_VOL_NAME',0x00002000) +ATTR_VOL_MOUNTFLAGS = Constant('ATTR_VOL_MOUNTFLAGS',0x00004000) +ATTR_VOL_MOUNTEDDEVICE = Constant('ATTR_VOL_MOUNTEDDEVICE',0x00008000) +ATTR_VOL_ENCODINGSUSED = Constant('ATTR_VOL_ENCODINGSUSED',0x00010000) +ATTR_VOL_CAPABILITIES = Constant('ATTR_VOL_CAPABILITIES',0x00020000) +ATTR_VOL_UUID = Constant('ATTR_VOL_UUID',0x00040000) +ATTR_VOL_FSTYPENAME = Constant('ATTR_VOL_FSTYPENAME',0x00100000) +ATTR_VOL_FSSUBTYPE = Constant('ATTR_VOL_FSSUBTYPE',0x00200000) +ATTR_VOL_SPACEUSED = Constant('ATTR_VOL_SPACEUSED',0x00800000) +ATTR_VOL_QUOTA_SIZE = Constant('ATTR_VOL_QUOTA_SIZE',0x10000000) +ATTR_VOL_RESERVED_SIZE = Constant('ATTR_VOL_RESERVED_SIZE',0x20000000) +ATTR_VOL_ATTRIBUTES = Constant('ATTR_VOL_ATTRIBUTES',0x40000000) +ATTR_VOL_INFO = Constant('ATTR_VOL_INFO',0x80000000) +ATTR_VOL_VALIDMASK = Constant('ATTR_VOL_VALIDMASK',0xF0B7FFFF) +ATTR_VOL_SETMASK = Constant('ATTR_VOL_SETMASK',0x80002000) +ATTR_DIR_LINKCOUNT = Constant('ATTR_DIR_LINKCOUNT',0x00000001) +ATTR_DIR_ENTRYCOUNT = Constant('ATTR_DIR_ENTRYCOUNT',0x00000002) +ATTR_DIR_MOUNTSTATUS = Constant('ATTR_DIR_MOUNTSTATUS',0x00000004) +ATTR_DIR_ALLOCSIZE = Constant('ATTR_DIR_ALLOCSIZE',0x00000008) +ATTR_DIR_IOBLOCKSIZE = Constant('ATTR_DIR_IOBLOCKSIZE',0x00000010) +ATTR_DIR_DATALENGTH = Constant('ATTR_DIR_DATALENGTH',0x00000020) +DIR_MNTSTATUS_MNTPOINT = Constant('DIR_MNTSTATUS_MNTPOINT',0x00000001) +DIR_MNTSTATUS_TRIGGER = Constant('DIR_MNTSTATUS_TRIGGER',0x00000002) +ATTR_DIR_VALIDMASK = Constant('ATTR_DIR_VALIDMASK',0x0000003f) +ATTR_DIR_SETMASK = Constant('ATTR_DIR_SETMASK',0x00000000) +ATTR_FILE_LINKCOUNT = Constant('ATTR_FILE_LINKCOUNT',0x00000001) +ATTR_FILE_TOTALSIZE = Constant('ATTR_FILE_TOTALSIZE',0x00000002) +ATTR_FILE_ALLOCSIZE = Constant('ATTR_FILE_ALLOCSIZE',0x00000004) +ATTR_FILE_IOBLOCKSIZE = Constant('ATTR_FILE_IOBLOCKSIZE',0x00000008) +ATTR_FILE_DEVTYPE = Constant('ATTR_FILE_DEVTYPE',0x00000020) +ATTR_FILE_FORKCOUNT = Constant('ATTR_FILE_FORKCOUNT',0x00000080) +ATTR_FILE_FORKLIST = Constant('ATTR_FILE_FORKLIST',0x00000100) +ATTR_FILE_DATALENGTH = Constant('ATTR_FILE_DATALENGTH',0x00000200) +ATTR_FILE_DATAALLOCSIZE = Constant('ATTR_FILE_DATAALLOCSIZE',0x00000400) +ATTR_FILE_RSRCLENGTH = Constant('ATTR_FILE_RSRCLENGTH',0x00001000) +ATTR_FILE_RSRCALLOCSIZE = Constant('ATTR_FILE_RSRCALLOCSIZE',0x00002000) +ATTR_FILE_VALIDMASK = Constant('ATTR_FILE_VALIDMASK',0x000037FF) +ATTR_FILE_SETMASK = Constant('ATTR_FILE_SETMASK',0x00000020) +ATTR_CMNEXT_RELPATH = Constant('ATTR_CMNEXT_RELPATH',0x00000004) +ATTR_CMNEXT_PRIVATESIZE = Constant('ATTR_CMNEXT_PRIVATESIZE',0x00000008) +ATTR_CMNEXT_LINKID = Constant('ATTR_CMNEXT_LINKID',0x00000010) +ATTR_CMNEXT_NOFIRMLINKPATH = Constant('ATTR_CMNEXT_NOFIRMLINKPATH',0x00000020) +ATTR_CMNEXT_REALDEVID = Constant('ATTR_CMNEXT_REALDEVID',0x00000040) +ATTR_CMNEXT_REALFSID = Constant('ATTR_CMNEXT_REALFSID',0x00000080) +ATTR_CMNEXT_CLONEID = Constant('ATTR_CMNEXT_CLONEID',0x00000100) +ATTR_CMNEXT_EXT_FLAGS = Constant('ATTR_CMNEXT_EXT_FLAGS',0x00000200) +ATTR_CMNEXT_RECURSIVE_GENCOUNT = Constant('ATTR_CMNEXT_RECURSIVE_GENCOUNT',0x00000400) +ATTR_CMNEXT_ATTRIBUTION_TAG = Constant('ATTR_CMNEXT_ATTRIBUTION_TAG',0x00000800) +ATTR_CMNEXT_CLONE_REFCNT = Constant('ATTR_CMNEXT_CLONE_REFCNT',0x00001000) +ATTR_CMNEXT_VALIDMASK = Constant('ATTR_CMNEXT_VALIDMASK',0x00001ffc) +ATTR_CMNEXT_SETMASK = Constant('ATTR_CMNEXT_SETMASK',0x00000000) +ATTR_FORK_TOTALSIZE = Constant('ATTR_FORK_TOTALSIZE',0x00000001) +ATTR_FORK_ALLOCSIZE = Constant('ATTR_FORK_ALLOCSIZE',0x00000002) +ATTR_FORK_RESERVED = Constant('ATTR_FORK_RESERVED',0xffffffff) +ATTR_FORK_VALIDMASK = Constant('ATTR_FORK_VALIDMASK',0x00000003) +ATTR_FORK_SETMASK = Constant('ATTR_FORK_SETMASK',0x00000000) +ATTR_CMN_NAMEDATTRCOUNT = Constant('ATTR_CMN_NAMEDATTRCOUNT',0x00080000) +ATTR_CMN_NAMEDATTRLIST = Constant('ATTR_CMN_NAMEDATTRLIST',0x00100000) +ATTR_FILE_CLUMPSIZE = Constant('ATTR_FILE_CLUMPSIZE',0x00000010) +ATTR_FILE_FILETYPE = Constant('ATTR_FILE_FILETYPE',0x00000040) +ATTR_FILE_DATAEXTENTS = Constant('ATTR_FILE_DATAEXTENTS',0x00000800) +ATTR_FILE_RSRCEXTENTS = Constant('ATTR_FILE_RSRCEXTENTS',0x00004000) +SRCHFS_START = Constant('SRCHFS_START',0x00000001) +SRCHFS_MATCHPARTIALNAMES = Constant('SRCHFS_MATCHPARTIALNAMES',0x00000002) +SRCHFS_MATCHDIRS = Constant('SRCHFS_MATCHDIRS',0x00000004) +SRCHFS_MATCHFILES = Constant('SRCHFS_MATCHFILES',0x00000008) +SRCHFS_SKIPLINKS = Constant('SRCHFS_SKIPLINKS',0x00000010) +SRCHFS_SKIPINVISIBLE = Constant('SRCHFS_SKIPINVISIBLE',0x00000020) +SRCHFS_SKIPPACKAGES = Constant('SRCHFS_SKIPPACKAGES',0x00000040) +SRCHFS_SKIPINAPPROPRIATE = Constant('SRCHFS_SKIPINAPPROPRIATE',0x00000080) +SRCHFS_NEGATEPARAMS = Constant('SRCHFS_NEGATEPARAMS',0x80000000) +SRCHFS_VALIDOPTIONSMASK = Constant('SRCHFS_VALIDOPTIONSMASK',0x800000FF) +KEV_ANY_VENDOR = Constant('KEV_ANY_VENDOR',0) +KEV_ANY_CLASS = Constant('KEV_ANY_CLASS',0) +KEV_ANY_SUBCLASS = Constant('KEV_ANY_SUBCLASS',0) +KEV_VENDOR_APPLE = Constant('KEV_VENDOR_APPLE',1) +KEV_NETWORK_CLASS = Constant('KEV_NETWORK_CLASS',1) +KEV_IOKIT_CLASS = Constant('KEV_IOKIT_CLASS',2) +KEV_SYSTEM_CLASS = Constant('KEV_SYSTEM_CLASS',3) +KEV_APPLESHARE_CLASS = Constant('KEV_APPLESHARE_CLASS',4) +KEV_FIREWALL_CLASS = Constant('KEV_FIREWALL_CLASS',5) +KEV_IEEE80211_CLASS = Constant('KEV_IEEE80211_CLASS',6) +KEV_NKE_CLASS = Constant('KEV_NKE_CLASS',7) +KEV_NKE_ALF_SUBCLASS = Constant('KEV_NKE_ALF_SUBCLASS',1) +KEV_NKE_ALF_STATE_CHANGED = Constant('KEV_NKE_ALF_STATE_CHANGED',1) +XNU_KERN_EVENT_DATA_SIZE = Constant('XNU_KERN_EVENT_DATA_SIZE',1) +KEV_VENDOR_CODE_MAX_STR_LEN = Constant('KEV_VENDOR_CODE_MAX_STR_LEN',200) +N_KEV_VECTORS = Constant('N_KEV_VECTORS',5) +M_WAITOK = Constant('M_WAITOK',0x0000) +M_NOWAIT = Constant('M_NOWAIT',0x0001) +M_ZERO = Constant('M_ZERO',0x0004) +M_NULL = Constant('M_NULL',0x0008) +M_PCB = Constant('M_PCB',4) +M_RTABLE = Constant('M_RTABLE',5) +M_IFADDR = Constant('M_IFADDR',9) +M_SONAME = Constant('M_SONAME',11) +M_LOCKF = Constant('M_LOCKF',40) +M_TEMP = Constant('M_TEMP',80) +M_UDFNODE = Constant('M_UDFNODE',84) +M_UDFMNT = Constant('M_UDFMNT',85) +M_KAUTH = Constant('M_KAUTH',100) +HAVE_VT_LOCKERFS = Constant('HAVE_VT_LOCKERFS',1) +VNODE_READ = Constant('VNODE_READ',0x01) +VNODE_WRITE = Constant('VNODE_WRITE',0x02) +VNODE_BLOCKMAP_NO_TRACK = Constant('VNODE_BLOCKMAP_NO_TRACK',0x04) +VNODE_CLUSTER_VERIFY = Constant('VNODE_CLUSTER_VERIFY',0x08) +PREALLOCATE = Constant('PREALLOCATE',0x00000001) +ALLOCATECONTIG = Constant('ALLOCATECONTIG',0x00000002) +ALLOCATEALL = Constant('ALLOCATEALL',0x00000004) +ALLOCATEPERSIST = Constant('ALLOCATEPERSIST',0x00000008) +ALLOCATEFROMPEOF = Constant('ALLOCATEFROMPEOF',0x00000010) +ALLOCATEFROMVOL = Constant('ALLOCATEFROMVOL',0x00000020) +IO_UNIT = Constant('IO_UNIT',0x0001) +IO_APPEND = Constant('IO_APPEND',0x0002) +IO_SYNC = Constant('IO_SYNC',0x0004) +IO_NODELOCKED = Constant('IO_NODELOCKED',0x0008) +IO_NDELAY = Constant('IO_NDELAY',0x0010) +IO_NOZEROFILL = Constant('IO_NOZEROFILL',0x0020) +IO_TAILZEROFILL = Constant('IO_TAILZEROFILL',0x0040) +IO_HEADZEROFILL = Constant('IO_HEADZEROFILL',0x0080) +IO_NOZEROVALID = Constant('IO_NOZEROVALID',0x0100) +IO_NOZERODIRTY = Constant('IO_NOZERODIRTY',0x0200) +IO_CLOSE = Constant('IO_CLOSE',0x0400) +IO_NOCACHE = Constant('IO_NOCACHE',0x0800) +IO_RAOFF = Constant('IO_RAOFF',0x1000) +IO_DEFWRITE = Constant('IO_DEFWRITE',0x2000) +IO_PASSIVE = Constant('IO_PASSIVE',0x4000) +IO_NOAUTH = Constant('IO_NOAUTH',0x8000) +IO_NODIRECT = Constant('IO_NODIRECT',0x10000) +IO_ENCRYPTED = Constant('IO_ENCRYPTED',0x20000) +IO_RETURN_ON_THROTTLE = Constant('IO_RETURN_ON_THROTTLE',0x40000) +IO_SINGLE_WRITER = Constant('IO_SINGLE_WRITER',0x80000) +IO_SYSCALL_DISPATCH = Constant('IO_SYSCALL_DISPATCH',0x100000) +IO_SWAP_DISPATCH = Constant('IO_SWAP_DISPATCH',0x200000) +IO_SKIP_ENCRYPTION = Constant('IO_SKIP_ENCRYPTION',0x400000) +IO_EVTONLY = Constant('IO_EVTONLY',0x800000) +LOOKUP = Constant('LOOKUP',0) +CREATE = Constant('CREATE',1) +DELETE = Constant('DELETE',2) +RENAME = Constant('RENAME',3) +OPMASK = Constant('OPMASK',3) +FOLLOW = Constant('FOLLOW',0x00000040) +ISDOTDOT = Constant('ISDOTDOT',0x00002000) +MAKEENTRY = Constant('MAKEENTRY',0x00004000) +ISLASTCN = Constant('ISLASTCN',0x00008000) +VNFS_NOCACHE = Constant('VNFS_NOCACHE',0x01) +VNFS_CANTCACHE = Constant('VNFS_CANTCACHE',0x02) +VNFS_ADDFSREF = Constant('VNFS_ADDFSREF',0x04) +VNCREATE_FLAVOR = Constant('VNCREATE_FLAVOR',0) +VA_UTIMES_NULL = Constant('VA_UTIMES_NULL',0x010000) +VA_EXCLUSIVE = Constant('VA_EXCLUSIVE',0x020000) +VA_NOINHERIT = Constant('VA_NOINHERIT',0x040000) +VA_NOAUTH = Constant('VA_NOAUTH',0x080000) +VA_64BITOBJIDS = Constant('VA_64BITOBJIDS',0x100000) +VA_REALFSID = Constant('VA_REALFSID',0x200000) +VA_USEFSID = Constant('VA_USEFSID',0x400000) +VA_FILESEC_ACL = Constant('VA_FILESEC_ACL',0x800000) +VSUID = Constant('VSUID',0x800) +VSGID = Constant('VSGID',0x400) +VSVTX = Constant('VSVTX',0x200) +VREAD = Constant('VREAD',0x100) +VWRITE = Constant('VWRITE',0x080) +VEXEC = Constant('VEXEC',0x040) +SKIPSYSTEM = Constant('SKIPSYSTEM',0x0001) +FORCECLOSE = Constant('FORCECLOSE',0x0002) +WRITECLOSE = Constant('WRITECLOSE',0x0004) +SKIPSWAP = Constant('SKIPSWAP',0x0008) +SKIPROOT = Constant('SKIPROOT',0x0010) +DOCLOSE = Constant('DOCLOSE',0x0008) +V_SAVE = Constant('V_SAVE',0x0001) +V_SAVEMETA = Constant('V_SAVEMETA',0x0002) +REVOKEALL = Constant('REVOKEALL',0x0001) +VNODE_REMOVE_NODELETEBUSY = Constant('VNODE_REMOVE_NODELETEBUSY',0x0001) +VNODE_REMOVE_SKIP_NAMESPACE_EVENT = Constant('VNODE_REMOVE_SKIP_NAMESPACE_EVENT',0x0002) +VNODE_REMOVE_NO_AUDIT_PATH = Constant('VNODE_REMOVE_NO_AUDIT_PATH',0x0004) +VNODE_REMOVE_DATALESS_DIR = Constant('VNODE_REMOVE_DATALESS_DIR',0x0008) +VNODE_READDIR_EXTENDED = Constant('VNODE_READDIR_EXTENDED',0x0001) +VNODE_READDIR_REQSEEKOFF = Constant('VNODE_READDIR_REQSEEKOFF',0x0002) +VNODE_READDIR_SEEKOFF32 = Constant('VNODE_READDIR_SEEKOFF32',0x0004) +VNODE_READDIR_NAMEMAX = Constant('VNODE_READDIR_NAMEMAX',0x0008) +VNODE_CLONEFILE_DEFAULT = Constant('VNODE_CLONEFILE_DEFAULT',0x0000) +VNODE_CLONEFILE_NOOWNERCOPY = Constant('VNODE_CLONEFILE_NOOWNERCOPY',0x0001) +VNODE_ASYNC_THROTTLE = Constant('VNODE_ASYNC_THROTTLE',15) +VNODE_UPDATE_PARENT = Constant('VNODE_UPDATE_PARENT',0x01) +VNODE_UPDATE_NAME = Constant('VNODE_UPDATE_NAME',0x02) +VNODE_UPDATE_CACHE = Constant('VNODE_UPDATE_CACHE',0x04) +VNODE_UPDATE_PURGE = Constant('VNODE_UPDATE_PURGE',0x08) +VNODE_LOOKUP_NOFOLLOW = Constant('VNODE_LOOKUP_NOFOLLOW',0x01) +VNODE_LOOKUP_NOCROSSMOUNT = Constant('VNODE_LOOKUP_NOCROSSMOUNT',0x02) +VNODE_LOOKUP_CROSSMOUNTNOWAIT = Constant('VNODE_LOOKUP_CROSSMOUNTNOWAIT',0x04) +VNODE_RELOAD = Constant('VNODE_RELOAD',0x01) +VNODE_WAIT = Constant('VNODE_WAIT',0x02) +VNODE_WRITEABLE = Constant('VNODE_WRITEABLE',0x04) +VNODE_WITHID = Constant('VNODE_WITHID',0x08) +VNODE_NOLOCK_INTERNAL = Constant('VNODE_NOLOCK_INTERNAL',0x10) +VNODE_NODEAD = Constant('VNODE_NODEAD',0x20) +VNODE_NOSUSPEND = Constant('VNODE_NOSUSPEND',0x40) +VNODE_ITERATE_ALL = Constant('VNODE_ITERATE_ALL',0x80) +VNODE_ITERATE_ACTIVE = Constant('VNODE_ITERATE_ACTIVE',0x100) +VNODE_ITERATE_INACTIVE = Constant('VNODE_ITERATE_INACTIVE',0x200) +VNODE_RETURNED = Constant('VNODE_RETURNED',0) +VNODE_RETURNED_DONE = Constant('VNODE_RETURNED_DONE',1) +VNODE_CLAIMED = Constant('VNODE_CLAIMED',2) +VNODE_CLAIMED_DONE = Constant('VNODE_CLAIMED_DONE',3) +IOCS_BUFFER_NUM_SIZE_BUCKETS = Constant('IOCS_BUFFER_NUM_SIZE_BUCKETS',10) +IOCS_BUFFER_MAX_BUCKET = Constant('IOCS_BUFFER_MAX_BUCKET',9) +IOCS_BUFFER_NUM_COMPRESSION_BUCKETS = Constant('IOCS_BUFFER_NUM_COMPRESSION_BUCKETS',7) +IOCS_BLOCK_NUM_SIZE_BUCKETS = Constant('IOCS_BLOCK_NUM_SIZE_BUCKETS',16) +IOCS_SBE_PATH_LEN = Constant('IOCS_SBE_PATH_LEN',128) +IOCS_PATH_START_BYTES_TO_COPY = Constant('IOCS_PATH_START_BYTES_TO_COPY',108) +IOCS_PATH_END_BYTES_TO_COPY = Constant('IOCS_PATH_END_BYTES_TO_COPY',20) +IOCS_SYSCTL_LIVE = Constant('IOCS_SYSCTL_LIVE',0x00000001) +IOCS_SYSCTL_STORE_BUFFER_RD_ONLY = Constant('IOCS_SYSCTL_STORE_BUFFER_RD_ONLY',0x00000002) +IOCS_SYSCTL_STORE_BUFFER_MARK = Constant('IOCS_SYSCTL_STORE_BUFFER_MARK',0x00000004) +TANDEM = Constant('TANDEM',0x00000001) +CBREAK = Constant('CBREAK',0x00000002) +LCASE = Constant('LCASE',0x00000004) +ECHO = Constant('ECHO',0x00000008) +CRMOD = Constant('CRMOD',0x00000010) +RAW = Constant('RAW',0x00000020) +ODDP = Constant('ODDP',0x00000040) +EVENP = Constant('EVENP',0x00000080) +ANYP = Constant('ANYP',0x000000c0) +NLDELAY = Constant('NLDELAY',0x00000300) +TBDELAY = Constant('TBDELAY',0x00000c00) +XTABS = Constant('XTABS',0x00000c00) +CRDELAY = Constant('CRDELAY',0x00003000) +VTDELAY = Constant('VTDELAY',0x00004000) +BSDELAY = Constant('BSDELAY',0x00008000) +NL0 = Constant('NL0',0x00000000) +NL1 = Constant('NL1',0x00000100) +NL2 = Constant('NL2',0x00000200) +NL3 = Constant('NL3',0x00000300) +TAB0 = Constant('TAB0',0x00000000) +TAB1 = Constant('TAB1',0x00000400) +TAB2 = Constant('TAB2',0x00000800) +CR0 = Constant('CR0',0x00000000) +CR1 = Constant('CR1',0x00001000) +CR2 = Constant('CR2',0x00002000) +CR3 = Constant('CR3',0x00003000) +FF0 = Constant('FF0',0x00000000) +FF1 = Constant('FF1',0x00004000) +BS0 = Constant('BS0',0x00000000) +BS1 = Constant('BS1',0x00008000) +CRTBS = Constant('CRTBS',0x00010000) +PRTERA = Constant('PRTERA',0x00020000) +CRTERA = Constant('CRTERA',0x00040000) +TILDE = Constant('TILDE',0x00080000) +MDMBUF = Constant('MDMBUF',0x00100000) +LITOUT = Constant('LITOUT',0x00200000) +TOSTOP = Constant('TOSTOP',0x00400000) +FLUSHO = Constant('FLUSHO',0x00800000) +NOHANG = Constant('NOHANG',0x01000000) +L001000 = Constant('L001000',0x02000000) +CRTKIL = Constant('CRTKIL',0x04000000) +PASS8 = Constant('PASS8',0x08000000) +CTLECH = Constant('CTLECH',0x10000000) +PENDIN = Constant('PENDIN',0x20000000) +DECCTQ = Constant('DECCTQ',0x40000000) +NOFLSH = Constant('NOFLSH',0x80000000) +OTTYDISC = Constant('OTTYDISC',0) +NETLDISC = Constant('NETLDISC',1) +NTTYDISC = Constant('NTTYDISC',2) +LOCKLEAF = Constant('LOCKLEAF',0x0004) +LOCKPARENT = Constant('LOCKPARENT',0x0008) +WANTPARENT = Constant('WANTPARENT',0x0010) +UIO_MAXIOV = Constant('UIO_MAXIOV',1024) +UIO_SMALLIOV = Constant('UIO_SMALLIOV',8) +EVFILT_SYSCOUNT = Constant('EVFILT_SYSCOUNT',17) +KEVENT_FLAG_NONE = Constant('KEVENT_FLAG_NONE',0x000000) +KEVENT_FLAG_IMMEDIATE = Constant('KEVENT_FLAG_IMMEDIATE',0x000001) +KEVENT_FLAG_ERROR_EVENTS = Constant('KEVENT_FLAG_ERROR_EVENTS',0x000002) +EV_ADD = Constant('EV_ADD',0x0001) +EV_DELETE = Constant('EV_DELETE',0x0002) +EV_ENABLE = Constant('EV_ENABLE',0x0004) +EV_DISABLE = Constant('EV_DISABLE',0x0008) +EV_ONESHOT = Constant('EV_ONESHOT',0x0010) +EV_CLEAR = Constant('EV_CLEAR',0x0020) +EV_RECEIPT = Constant('EV_RECEIPT',0x0040) +EV_DISPATCH = Constant('EV_DISPATCH',0x0080) +EV_UDATA_SPECIFIC = Constant('EV_UDATA_SPECIFIC',0x0100) +EV_VANISHED = Constant('EV_VANISHED',0x0200) +EV_SYSFLAGS = Constant('EV_SYSFLAGS',0xF000) +EV_FLAG0 = Constant('EV_FLAG0',0x1000) +EV_FLAG1 = Constant('EV_FLAG1',0x2000) +EV_EOF = Constant('EV_EOF',0x8000) +EV_ERROR = Constant('EV_ERROR',0x4000) +NOTE_TRIGGER = Constant('NOTE_TRIGGER',0x01000000) +NOTE_FFNOP = Constant('NOTE_FFNOP',0x00000000) +NOTE_FFAND = Constant('NOTE_FFAND',0x40000000) +NOTE_FFOR = Constant('NOTE_FFOR',0x80000000) +NOTE_FFCOPY = Constant('NOTE_FFCOPY',0xc0000000) +NOTE_FFCTRLMASK = Constant('NOTE_FFCTRLMASK',0xc0000000) +NOTE_FFLAGSMASK = Constant('NOTE_FFLAGSMASK',0x00ffffff) +NOTE_LOWAT = Constant('NOTE_LOWAT',0x00000001) +NOTE_OOB = Constant('NOTE_OOB',0x00000002) +NOTE_DELETE = Constant('NOTE_DELETE',0x00000001) +NOTE_WRITE = Constant('NOTE_WRITE',0x00000002) +NOTE_EXTEND = Constant('NOTE_EXTEND',0x00000004) +NOTE_ATTRIB = Constant('NOTE_ATTRIB',0x00000008) +NOTE_LINK = Constant('NOTE_LINK',0x00000010) +NOTE_RENAME = Constant('NOTE_RENAME',0x00000020) +NOTE_REVOKE = Constant('NOTE_REVOKE',0x00000040) +NOTE_NONE = Constant('NOTE_NONE',0x00000080) +NOTE_FUNLOCK = Constant('NOTE_FUNLOCK',0x00000100) +NOTE_LEASE_DOWNGRADE = Constant('NOTE_LEASE_DOWNGRADE',0x00000200) +NOTE_LEASE_RELEASE = Constant('NOTE_LEASE_RELEASE',0x00000400) +NOTE_EXIT = Constant('NOTE_EXIT',0x80000000) +NOTE_FORK = Constant('NOTE_FORK',0x40000000) +NOTE_EXEC = Constant('NOTE_EXEC',0x20000000) +NOTE_SIGNAL = Constant('NOTE_SIGNAL',0x08000000) +NOTE_EXITSTATUS = Constant('NOTE_EXITSTATUS',0x04000000) +NOTE_EXIT_DETAIL = Constant('NOTE_EXIT_DETAIL',0x02000000) +NOTE_PDATAMASK = Constant('NOTE_PDATAMASK',0x000fffff) +NOTE_EXIT_DETAIL_MASK = Constant('NOTE_EXIT_DETAIL_MASK',0x00070000) +NOTE_EXIT_DECRYPTFAIL = Constant('NOTE_EXIT_DECRYPTFAIL',0x00010000) +NOTE_EXIT_MEMORY = Constant('NOTE_EXIT_MEMORY',0x00020000) +NOTE_EXIT_CSERROR = Constant('NOTE_EXIT_CSERROR',0x00040000) +NOTE_VM_PRESSURE = Constant('NOTE_VM_PRESSURE',0x80000000) +NOTE_VM_PRESSURE_TERMINATE = Constant('NOTE_VM_PRESSURE_TERMINATE',0x40000000) +NOTE_VM_PRESSURE_SUDDEN_TERMINATE = Constant('NOTE_VM_PRESSURE_SUDDEN_TERMINATE',0x20000000) +NOTE_VM_ERROR = Constant('NOTE_VM_ERROR',0x10000000) +NOTE_SECONDS = Constant('NOTE_SECONDS',0x00000001) +NOTE_USECONDS = Constant('NOTE_USECONDS',0x00000002) +NOTE_NSECONDS = Constant('NOTE_NSECONDS',0x00000004) +NOTE_ABSOLUTE = Constant('NOTE_ABSOLUTE',0x00000008) +NOTE_LEEWAY = Constant('NOTE_LEEWAY',0x00000010) +NOTE_CRITICAL = Constant('NOTE_CRITICAL',0x00000020) +NOTE_BACKGROUND = Constant('NOTE_BACKGROUND',0x00000040) +NOTE_MACH_CONTINUOUS_TIME = Constant('NOTE_MACH_CONTINUOUS_TIME',0x00000080) +NOTE_MACHTIME = Constant('NOTE_MACHTIME',0x00000100) +NOTE_TRACK = Constant('NOTE_TRACK',0x00000001) +NOTE_TRACKERR = Constant('NOTE_TRACKERR',0x00000002) +NOTE_CHILD = Constant('NOTE_CHILD',0x00000004) +VMADDR_CID_HYPERVISOR = Constant('VMADDR_CID_HYPERVISOR',0) +VMADDR_CID_RESERVED = Constant('VMADDR_CID_RESERVED',1) +VMADDR_CID_HOST = Constant('VMADDR_CID_HOST',2) +IMG_SHSIZE = Constant('IMG_SHSIZE',512) +IMGPF_NONE = Constant('IMGPF_NONE',0x00000000) +IMGPF_INTERPRET = Constant('IMGPF_INTERPRET',0x00000001) +IMGPF_RESERVED = Constant('IMGPF_RESERVED',0x00000002) +IMGPF_WAS_64BIT_ADDR = Constant('IMGPF_WAS_64BIT_ADDR',0x00000004) +IMGPF_IS_64BIT_ADDR = Constant('IMGPF_IS_64BIT_ADDR',0x00000008) +IMGPF_SPAWN = Constant('IMGPF_SPAWN',0x00000010) +IMGPF_DISABLE_ASLR = Constant('IMGPF_DISABLE_ASLR',0x00000020) +IMGPF_ALLOW_DATA_EXEC = Constant('IMGPF_ALLOW_DATA_EXEC',0x00000040) +IMGPF_EXEC = Constant('IMGPF_EXEC',0x00000100) +IMGPF_HIGH_BITS_ASLR = Constant('IMGPF_HIGH_BITS_ASLR',0x00000200) +IMGPF_IS_64BIT_DATA = Constant('IMGPF_IS_64BIT_DATA',0x00000400) +IMGPF_DRIVER = Constant('IMGPF_DRIVER',0x00000800) +IMGPF_RESLIDE = Constant('IMGPF_RESLIDE',0x00001000) +IMGPF_PLUGIN_HOST_DISABLE_A_KEYS = Constant('IMGPF_PLUGIN_HOST_DISABLE_A_KEYS',0x00002000) +IMGPF_HW_TPRO = Constant('IMGPF_HW_TPRO',0x00004000) +IMGPF_ROSETTA = Constant('IMGPF_ROSETTA',0x10000000) +IMGPF_ALT_ROSETTA = Constant('IMGPF_ALT_ROSETTA',0x20000000) +IMGPF_NOJOP = Constant('IMGPF_NOJOP',0x80000000) +IMGPF_SB_DEFAULT = Constant('IMGPF_SB_DEFAULT',0) +IMGPF_SB_TRUE = Constant('IMGPF_SB_TRUE',1) +IMGPF_SB_FALSE = Constant('IMGPF_SB_FALSE',2) +_POSIX_THREAD_KEYS_MAX = Constant('_POSIX_THREAD_KEYS_MAX',128) +F_OK = Constant('F_OK',0) +ACCESSX_MAX_DESCRIPTORS = Constant('ACCESSX_MAX_DESCRIPTORS',100) +_PC_LINK_MAX = Constant('_PC_LINK_MAX',1) +_PC_MAX_CANON = Constant('_PC_MAX_CANON',2) +_PC_MAX_INPUT = Constant('_PC_MAX_INPUT',3) +_PC_NAME_MAX = Constant('_PC_NAME_MAX',4) +_PC_PATH_MAX = Constant('_PC_PATH_MAX',5) +_PC_PIPE_BUF = Constant('_PC_PIPE_BUF',6) +_PC_CHOWN_RESTRICTED = Constant('_PC_CHOWN_RESTRICTED',7) +_PC_NO_TRUNC = Constant('_PC_NO_TRUNC',8) +_PC_VDISABLE = Constant('_PC_VDISABLE',9) +_PC_NAME_CHARS_MAX = Constant('_PC_NAME_CHARS_MAX',10) +_PC_CASE_SENSITIVE = Constant('_PC_CASE_SENSITIVE',11) +_PC_CASE_PRESERVING = Constant('_PC_CASE_PRESERVING',12) +_PC_EXTENDED_SECURITY_NP = Constant('_PC_EXTENDED_SECURITY_NP',13) +_PC_AUTH_OPAQUE_NP = Constant('_PC_AUTH_OPAQUE_NP',14) +_PC_2_SYMLINKS = Constant('_PC_2_SYMLINKS',15) +_PC_ALLOC_SIZE_MIN = Constant('_PC_ALLOC_SIZE_MIN',16) +_PC_ASYNC_IO = Constant('_PC_ASYNC_IO',17) +_PC_FILESIZEBITS = Constant('_PC_FILESIZEBITS',18) +_PC_PRIO_IO = Constant('_PC_PRIO_IO',19) +_PC_REC_INCR_XFER_SIZE = Constant('_PC_REC_INCR_XFER_SIZE',20) +_PC_REC_MAX_XFER_SIZE = Constant('_PC_REC_MAX_XFER_SIZE',21) +_PC_REC_MIN_XFER_SIZE = Constant('_PC_REC_MIN_XFER_SIZE',22) +_PC_REC_XFER_ALIGN = Constant('_PC_REC_XFER_ALIGN',23) +_PC_SYMLINK_MAX = Constant('_PC_SYMLINK_MAX',24) +_PC_SYNC_IO = Constant('_PC_SYNC_IO',25) +_PC_XATTR_SIZE_BITS = Constant('_PC_XATTR_SIZE_BITS',26) +_PC_MIN_HOLE_SIZE = Constant('_PC_MIN_HOLE_SIZE',27) +_CS_PATH = Constant('_CS_PATH',1) +_SYS_CONF_H_ = Constant('_SYS_CONF_H_',1) +D_TAPE = Constant('D_TAPE',1) +D_DISK = Constant('D_DISK',2) +D_TTY = Constant('D_TTY',3) +WNOHANG = Constant('WNOHANG',0x00000001) +WUNTRACED = Constant('WUNTRACED',0x00000002) +WCOREFLAG = Constant('WCOREFLAG',0o0200) +_WSTOPPED = Constant('_WSTOPPED',0o0177) +WEXITED = Constant('WEXITED',0x00000004) +WSTOPPED = Constant('WSTOPPED',0x00000008) +WCONTINUED = Constant('WCONTINUED',0x00000010) +WNOWAIT = Constant('WNOWAIT',0x00000020) +WAIT_MYPGRP = Constant('WAIT_MYPGRP',0) +PRIO_DARWIN_GAME_MODE = Constant('PRIO_DARWIN_GAME_MODE',7) +PRIO_DARWIN_GAME_MODE_OFF = Constant('PRIO_DARWIN_GAME_MODE_OFF',0x0) +PRIO_DARWIN_GAME_MODE_ON = Constant('PRIO_DARWIN_GAME_MODE_ON',0x1) +IPC_CREAT = Constant('IPC_CREAT',0o001000) +IPC_EXCL = Constant('IPC_EXCL',0o002000) +IPC_NOWAIT = Constant('IPC_NOWAIT',0o004000) +IPC_RMID = Constant('IPC_RMID',0) +IPC_SET = Constant('IPC_SET',1) +IPC_STAT = Constant('IPC_STAT',2) +IPC_R = Constant('IPC_R',0o000400) +IPC_W = Constant('IPC_W',0o000200) +IPC_M = Constant('IPC_M',0o010000) +O_RDONLY = Constant('O_RDONLY',0x0000) +O_WRONLY = Constant('O_WRONLY',0x0001) +O_RDWR = Constant('O_RDWR',0x0002) +O_ACCMODE = Constant('O_ACCMODE',0x0003) +FREAD = Constant('FREAD',0x00000001) +FWRITE = Constant('FWRITE',0x00000002) +O_NONBLOCK = Constant('O_NONBLOCK',0x00000004) +O_APPEND = Constant('O_APPEND',0x00000008) +O_SHLOCK = Constant('O_SHLOCK',0x00000010) +O_EXLOCK = Constant('O_EXLOCK',0x00000020) +O_ASYNC = Constant('O_ASYNC',0x00000040) +O_NOFOLLOW = Constant('O_NOFOLLOW',0x00000100) +O_CREAT = Constant('O_CREAT',0x00000200) +O_TRUNC = Constant('O_TRUNC',0x00000400) +O_EXCL = Constant('O_EXCL',0x00000800) +FMARK = Constant('FMARK',0x00001000) +FDEFER = Constant('FDEFER',0x00002000) +FWASLOCKED = Constant('FWASLOCKED',0x00004000) +O_EVTONLY = Constant('O_EVTONLY',0x00008000) +FWASWRITTEN = Constant('FWASWRITTEN',0x00010000) +O_NOCTTY = Constant('O_NOCTTY',0x00020000) +FNOCACHE = Constant('FNOCACHE',0x00040000) +FNORDAHEAD = Constant('FNORDAHEAD',0x00080000) +O_DIRECTORY = Constant('O_DIRECTORY',0x00100000) +O_SYMLINK = Constant('O_SYMLINK',0x00200000) +FNODIRECT = Constant('FNODIRECT',0x00800000) +O_CLOEXEC = Constant('O_CLOEXEC',0x01000000) +FENCRYPTED = Constant('FENCRYPTED',0x02000000) +FSINGLE_WRITER = Constant('FSINGLE_WRITER',0x04000000) +O_CLOFORK = Constant('O_CLOFORK',0x08000000) +FUNENCRYPTED = Constant('FUNENCRYPTED',0x10000000) +O_NOFOLLOW_ANY = Constant('O_NOFOLLOW_ANY',0x20000000) +O_EXEC = Constant('O_EXEC',0x40000000) +AT_EACCESS = Constant('AT_EACCESS',0x0010) +AT_SYMLINK_NOFOLLOW = Constant('AT_SYMLINK_NOFOLLOW',0x0020) +AT_SYMLINK_FOLLOW = Constant('AT_SYMLINK_FOLLOW',0x0040) +AT_REMOVEDIR = Constant('AT_REMOVEDIR',0x0080) +AT_REALDEV = Constant('AT_REALDEV',0x0200) +AT_FDONLY = Constant('AT_FDONLY',0x0400) +AT_SYMLINK_NOFOLLOW_ANY = Constant('AT_SYMLINK_NOFOLLOW_ANY',0x0800) +O_DP_GETRAWENCRYPTED = Constant('O_DP_GETRAWENCRYPTED',0x0001) +O_DP_GETRAWUNENCRYPTED = Constant('O_DP_GETRAWUNENCRYPTED',0x0002) +O_DP_AUTHENTICATE = Constant('O_DP_AUTHENTICATE',0x0004) +CPF_OVERWRITE = Constant('CPF_OVERWRITE',0x0001) +CPF_IGNORE_MODE = Constant('CPF_IGNORE_MODE',0x0002) +F_DUPFD = Constant('F_DUPFD',0) +F_GETFD = Constant('F_GETFD',1) +F_SETFD = Constant('F_SETFD',2) +F_GETFL = Constant('F_GETFL',3) +F_SETFL = Constant('F_SETFL',4) +F_GETOWN = Constant('F_GETOWN',5) +F_SETOWN = Constant('F_SETOWN',6) +F_GETLK = Constant('F_GETLK',7) +F_SETLK = Constant('F_SETLK',8) +F_SETLKW = Constant('F_SETLKW',9) +F_SETLKWTIMEOUT = Constant('F_SETLKWTIMEOUT',10) +F_FLUSH_DATA = Constant('F_FLUSH_DATA',40) +F_CHKCLEAN = Constant('F_CHKCLEAN',41) +F_PREALLOCATE = Constant('F_PREALLOCATE',42) +F_SETSIZE = Constant('F_SETSIZE',43) +F_RDADVISE = Constant('F_RDADVISE',44) +F_RDAHEAD = Constant('F_RDAHEAD',45) +F_NOCACHE = Constant('F_NOCACHE',48) +F_LOG2PHYS = Constant('F_LOG2PHYS',49) +F_GETPATH = Constant('F_GETPATH',50) +F_FULLFSYNC = Constant('F_FULLFSYNC',51) +F_PATHPKG_CHECK = Constant('F_PATHPKG_CHECK',52) +F_FREEZE_FS = Constant('F_FREEZE_FS',53) +F_THAW_FS = Constant('F_THAW_FS',54) +F_GLOBAL_NOCACHE = Constant('F_GLOBAL_NOCACHE',55) +F_ADDSIGS = Constant('F_ADDSIGS',59) +F_ADDFILESIGS = Constant('F_ADDFILESIGS',61) +F_NODIRECT = Constant('F_NODIRECT',62) +F_GETPROTECTIONCLASS = Constant('F_GETPROTECTIONCLASS',63) +F_SETPROTECTIONCLASS = Constant('F_SETPROTECTIONCLASS',64) +F_LOG2PHYS_EXT = Constant('F_LOG2PHYS_EXT',65) +F_GETLKPID = Constant('F_GETLKPID',66) +F_SETBACKINGSTORE = Constant('F_SETBACKINGSTORE',70) +F_GETPATH_MTMINFO = Constant('F_GETPATH_MTMINFO',71) +F_GETCODEDIR = Constant('F_GETCODEDIR',72) +F_SETNOSIGPIPE = Constant('F_SETNOSIGPIPE',73) +F_GETNOSIGPIPE = Constant('F_GETNOSIGPIPE',74) +F_TRANSCODEKEY = Constant('F_TRANSCODEKEY',75) +F_SINGLE_WRITER = Constant('F_SINGLE_WRITER',76) +F_GETPROTECTIONLEVEL = Constant('F_GETPROTECTIONLEVEL',77) +F_FINDSIGS = Constant('F_FINDSIGS',78) +F_ADDFILESIGS_FOR_DYLD_SIM = Constant('F_ADDFILESIGS_FOR_DYLD_SIM',83) +F_BARRIERFSYNC = Constant('F_BARRIERFSYNC',85) +F_OFD_SETLK = Constant('F_OFD_SETLK',90) +F_OFD_SETLKW = Constant('F_OFD_SETLKW',91) +F_OFD_GETLK = Constant('F_OFD_GETLK',92) +F_OFD_SETLKWTIMEOUT = Constant('F_OFD_SETLKWTIMEOUT',93) +F_ADDFILESIGS_RETURN = Constant('F_ADDFILESIGS_RETURN',97) +F_CHECK_LV = Constant('F_CHECK_LV',98) +F_PUNCHHOLE = Constant('F_PUNCHHOLE',99) +F_TRIM_ACTIVE_FILE = Constant('F_TRIM_ACTIVE_FILE',100) +F_SPECULATIVE_READ = Constant('F_SPECULATIVE_READ',101) +F_GETPATH_NOFIRMLINK = Constant('F_GETPATH_NOFIRMLINK',102) +F_ADDFILESIGS_INFO = Constant('F_ADDFILESIGS_INFO',103) +F_ADDFILESUPPL = Constant('F_ADDFILESUPPL',104) +F_GETSIGSINFO = Constant('F_GETSIGSINFO',105) +F_SETLEASE = Constant('F_SETLEASE',106) +F_GETLEASE = Constant('F_GETLEASE',107) +F_TRANSFEREXTENTS = Constant('F_TRANSFEREXTENTS',110) +F_ATTRIBUTION_TAG = Constant('F_ATTRIBUTION_TAG',111) +FCNTL_FS_SPECIFIC_BASE = Constant('FCNTL_FS_SPECIFIC_BASE',0x00010000) +F_DUPFD_CLOEXEC = Constant('F_DUPFD_CLOEXEC',67) +FD_CLOEXEC = Constant('FD_CLOEXEC',1) +F_RDLCK = Constant('F_RDLCK',1) +F_UNLCK = Constant('F_UNLCK',2) +F_WRLCK = Constant('F_WRLCK',3) +F_WAIT = Constant('F_WAIT',0x010) +F_FLOCK = Constant('F_FLOCK',0x020) +F_POSIX = Constant('F_POSIX',0x040) +F_PROV = Constant('F_PROV',0x080) +F_WAKE1_SAFE = Constant('F_WAKE1_SAFE',0x100) +F_ABORT = Constant('F_ABORT',0x200) +F_OFD_LOCK = Constant('F_OFD_LOCK',0x400) +F_TRANSFER = Constant('F_TRANSFER',0x800) +F_CONFINED = Constant('F_CONFINED',0x1000) +F_ALLOCATECONTIG = Constant('F_ALLOCATECONTIG',0x00000002) +F_ALLOCATEALL = Constant('F_ALLOCATEALL',0x00000004) +F_ALLOCATEPERSIST = Constant('F_ALLOCATEPERSIST',0x00000008) +F_PEOFPOSMODE = Constant('F_PEOFPOSMODE',3) +F_VOLPOSMODE = Constant('F_VOLPOSMODE',4) +USER_FSIGNATURES_CDHASH_LEN = Constant('USER_FSIGNATURES_CDHASH_LEN',20) +GETSIGSINFO_PLATFORM_BINARY = Constant('GETSIGSINFO_PLATFORM_BINARY',1) +LOCK_SH = Constant('LOCK_SH',0x01) +LOCK_EX = Constant('LOCK_EX',0x02) +LOCK_NB = Constant('LOCK_NB',0x04) +LOCK_UN = Constant('LOCK_UN',0x08) +ATTRIBUTION_NAME_MAX = Constant('ATTRIBUTION_NAME_MAX',255) +F_CREATE_TAG = Constant('F_CREATE_TAG',0x00000001) +F_DELETE_TAG = Constant('F_DELETE_TAG',0x00000002) +F_QUERY_TAG = Constant('F_QUERY_TAG',0x00000004) +O_POPUP = Constant('O_POPUP',0x80000000) +O_ALERT = Constant('O_ALERT',0x20000000) +S_BLKSIZE = Constant('S_BLKSIZE',512) +UF_SETTABLE = Constant('UF_SETTABLE',0x0000ffff) +UF_NODUMP = Constant('UF_NODUMP',0x00000001) +UF_IMMUTABLE = Constant('UF_IMMUTABLE',0x00000002) +UF_APPEND = Constant('UF_APPEND',0x00000004) +UF_OPAQUE = Constant('UF_OPAQUE',0x00000008) +UF_COMPRESSED = Constant('UF_COMPRESSED',0x00000020) +UF_TRACKED = Constant('UF_TRACKED',0x00000040) +UF_DATAVAULT = Constant('UF_DATAVAULT',0x00000080) +UF_HIDDEN = Constant('UF_HIDDEN',0x00008000) +SF_SUPPORTED = Constant('SF_SUPPORTED',0x009f0000) +SF_SETTABLE = Constant('SF_SETTABLE',0x3fff0000) +SF_SYNTHETIC = Constant('SF_SYNTHETIC',0xc0000000) +SF_ARCHIVED = Constant('SF_ARCHIVED',0x00010000) +SF_IMMUTABLE = Constant('SF_IMMUTABLE',0x00020000) +SF_APPEND = Constant('SF_APPEND',0x00040000) +SF_RESTRICTED = Constant('SF_RESTRICTED',0x00080000) +SF_NOUNLINK = Constant('SF_NOUNLINK',0x00100000) +SF_FIRMLINK = Constant('SF_FIRMLINK',0x00800000) +SF_DATALESS = Constant('SF_DATALESS',0x40000000) +EF_MAY_SHARE_BLOCKS = Constant('EF_MAY_SHARE_BLOCKS',0x00000001) +EF_NO_XATTRS = Constant('EF_NO_XATTRS',0x00000002) +EF_IS_SYNC_ROOT = Constant('EF_IS_SYNC_ROOT',0x00000004) +EF_IS_PURGEABLE = Constant('EF_IS_PURGEABLE',0x00000008) +EF_IS_SPARSE = Constant('EF_IS_SPARSE',0x00000010) +EF_IS_SYNTHETIC = Constant('EF_IS_SYNTHETIC',0x00000020) +EF_SHARES_ALL_BLOCKS = Constant('EF_SHARES_ALL_BLOCKS',0x00000040) +MBUF_COPYALL = Constant('MBUF_COPYALL',1000000000) +__DARWIN_NSIG = Constant('__DARWIN_NSIG',32) +SIGHUP = Constant('SIGHUP',1) +SIGINT = Constant('SIGINT',2) +SIGQUIT = Constant('SIGQUIT',3) +SIGILL = Constant('SIGILL',4) +SIGTRAP = Constant('SIGTRAP',5) +SIGABRT = Constant('SIGABRT',6) +SIGPOLL = Constant('SIGPOLL',7) +SIGEMT = Constant('SIGEMT',7) +SIGFPE = Constant('SIGFPE',8) +SIGKILL = Constant('SIGKILL',9) +SIGBUS = Constant('SIGBUS',10) +SIGSEGV = Constant('SIGSEGV',11) +SIGSYS = Constant('SIGSYS',12) +SIGPIPE = Constant('SIGPIPE',13) +SIGALRM = Constant('SIGALRM',14) +SIGTERM = Constant('SIGTERM',15) +SIGURG = Constant('SIGURG',16) +SIGSTOP = Constant('SIGSTOP',17) +SIGTSTP = Constant('SIGTSTP',18) +SIGCONT = Constant('SIGCONT',19) +SIGCHLD = Constant('SIGCHLD',20) +SIGTTIN = Constant('SIGTTIN',21) +SIGTTOU = Constant('SIGTTOU',22) +SIGIO = Constant('SIGIO',23) +SIGXCPU = Constant('SIGXCPU',24) +SIGXFSZ = Constant('SIGXFSZ',25) +SIGVTALRM = Constant('SIGVTALRM',26) +SIGPROF = Constant('SIGPROF',27) +SIGWINCH = Constant('SIGWINCH',28) +SIGINFO = Constant('SIGINFO',29) +SIGUSR1 = Constant('SIGUSR1',30) +SIGUSR2 = Constant('SIGUSR2',31) +SIGEV_NONE = Constant('SIGEV_NONE',0) +SIGEV_SIGNAL = Constant('SIGEV_SIGNAL',1) +SIGEV_THREAD = Constant('SIGEV_THREAD',3) +ILL_NOOP = Constant('ILL_NOOP',0) +ILL_ILLOPC = Constant('ILL_ILLOPC',1) +ILL_ILLTRP = Constant('ILL_ILLTRP',2) +ILL_PRVOPC = Constant('ILL_PRVOPC',3) +ILL_ILLOPN = Constant('ILL_ILLOPN',4) +ILL_ILLADR = Constant('ILL_ILLADR',5) +ILL_PRVREG = Constant('ILL_PRVREG',6) +ILL_COPROC = Constant('ILL_COPROC',7) +ILL_BADSTK = Constant('ILL_BADSTK',8) +FPE_NOOP = Constant('FPE_NOOP',0) +FPE_FLTDIV = Constant('FPE_FLTDIV',1) +FPE_FLTOVF = Constant('FPE_FLTOVF',2) +FPE_FLTUND = Constant('FPE_FLTUND',3) +FPE_FLTRES = Constant('FPE_FLTRES',4) +FPE_FLTINV = Constant('FPE_FLTINV',5) +FPE_FLTSUB = Constant('FPE_FLTSUB',6) +FPE_INTDIV = Constant('FPE_INTDIV',7) +FPE_INTOVF = Constant('FPE_INTOVF',8) +SEGV_NOOP = Constant('SEGV_NOOP',0) +SEGV_MAPERR = Constant('SEGV_MAPERR',1) +SEGV_ACCERR = Constant('SEGV_ACCERR',2) +BUS_NOOP = Constant('BUS_NOOP',0) +BUS_ADRALN = Constant('BUS_ADRALN',1) +BUS_ADRERR = Constant('BUS_ADRERR',2) +BUS_OBJERR = Constant('BUS_OBJERR',3) +TRAP_BRKPT = Constant('TRAP_BRKPT',1) +TRAP_TRACE = Constant('TRAP_TRACE',2) +CLD_NOOP = Constant('CLD_NOOP',0) +CLD_EXITED = Constant('CLD_EXITED',1) +CLD_KILLED = Constant('CLD_KILLED',2) +CLD_DUMPED = Constant('CLD_DUMPED',3) +CLD_TRAPPED = Constant('CLD_TRAPPED',4) +CLD_STOPPED = Constant('CLD_STOPPED',5) +CLD_CONTINUED = Constant('CLD_CONTINUED',6) +POLL_IN = Constant('POLL_IN',1) +POLL_OUT = Constant('POLL_OUT',2) +POLL_MSG = Constant('POLL_MSG',3) +POLL_ERR = Constant('POLL_ERR',4) +POLL_PRI = Constant('POLL_PRI',5) +POLL_HUP = Constant('POLL_HUP',6) +SA_ONSTACK = Constant('SA_ONSTACK',0x0001) +SA_RESTART = Constant('SA_RESTART',0x0002) +SA_RESETHAND = Constant('SA_RESETHAND',0x0004) +SA_NOCLDSTOP = Constant('SA_NOCLDSTOP',0x0008) +SA_NODEFER = Constant('SA_NODEFER',0x0010) +SA_NOCLDWAIT = Constant('SA_NOCLDWAIT',0x0020) +SA_SIGINFO = Constant('SA_SIGINFO',0x0040) +SA_USERTRAMP = Constant('SA_USERTRAMP',0x0100) +SA_64REGSET = Constant('SA_64REGSET',0x0200) +SIG_BLOCK = Constant('SIG_BLOCK',1) +SIG_UNBLOCK = Constant('SIG_UNBLOCK',2) +SIG_SETMASK = Constant('SIG_SETMASK',3) +SI_USER = Constant('SI_USER',0x10001) +SI_QUEUE = Constant('SI_QUEUE',0x10002) +SI_TIMER = Constant('SI_TIMER',0x10003) +SI_ASYNCIO = Constant('SI_ASYNCIO',0x10004) +SI_MESGQ = Constant('SI_MESGQ',0x10005) +SS_ONSTACK = Constant('SS_ONSTACK',0x0001) +SS_DISABLE = Constant('SS_DISABLE',0x0004) +MINSIGSTKSZ = Constant('MINSIGSTKSZ',32768) +SIGSTKSZ = Constant('SIGSTKSZ',131072) +__DARWIN_MAXNAMLEN = Constant('__DARWIN_MAXNAMLEN',255) +__DARWIN_MAXPATHLEN = Constant('__DARWIN_MAXPATHLEN',1024) +DT_UNKNOWN = Constant('DT_UNKNOWN',0) +DT_FIFO = Constant('DT_FIFO',1) +DT_CHR = Constant('DT_CHR',2) +DT_DIR = Constant('DT_DIR',4) +DT_BLK = Constant('DT_BLK',6) +DT_REG = Constant('DT_REG',8) +DT_LNK = Constant('DT_LNK',10) +DT_SOCK = Constant('DT_SOCK',12) +DT_WHT = Constant('DT_WHT',14) +POSIX_SPAWN_RESETIDS = Constant('POSIX_SPAWN_RESETIDS',0x0001) +POSIX_SPAWN_SETPGROUP = Constant('POSIX_SPAWN_SETPGROUP',0x0002) +POSIX_SPAWN_SETSIGDEF = Constant('POSIX_SPAWN_SETSIGDEF',0x0004) +POSIX_SPAWN_SETSIGMASK = Constant('POSIX_SPAWN_SETSIGMASK',0x0008) +POSIX_SPAWN_SETSCHEDPARAM = Constant('POSIX_SPAWN_SETSCHEDPARAM',0x0010) +POSIX_SPAWN_SETSCHEDULER = Constant('POSIX_SPAWN_SETSCHEDULER',0x0020) +POSIX_SPAWN_SETEXEC = Constant('POSIX_SPAWN_SETEXEC',0x0040) +POSIX_SPAWN_START_SUSPENDED = Constant('POSIX_SPAWN_START_SUSPENDED',0x0080) +POSIX_SPAWN_SETSID = Constant('POSIX_SPAWN_SETSID',0x0400) +POSIX_SPAWN_CLOEXEC_DEFAULT = Constant('POSIX_SPAWN_CLOEXEC_DEFAULT',0x4000) +_POSIX_SPAWN_RESLIDE = Constant('_POSIX_SPAWN_RESLIDE',0x0800) +POSIX_SPAWN_PCONTROL_NONE = Constant('POSIX_SPAWN_PCONTROL_NONE',0x0000) +POSIX_SPAWN_PCONTROL_THROTTLE = Constant('POSIX_SPAWN_PCONTROL_THROTTLE',0x0001) +POSIX_SPAWN_PCONTROL_SUSPEND = Constant('POSIX_SPAWN_PCONTROL_SUSPEND',0x0002) +POSIX_SPAWN_PCONTROL_KILL = Constant('POSIX_SPAWN_PCONTROL_KILL',0x0003) +POSIX_SPAWN_PANIC_ON_CRASH = Constant('POSIX_SPAWN_PANIC_ON_CRASH',0x1) +POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT = Constant('POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT',0x2) +POSIX_SPAWN_PANIC_ON_EXIT = Constant('POSIX_SPAWN_PANIC_ON_EXIT',0x4) +POSIX_SPAWN_PANIC_ON_SPAWN_FAIL = Constant('POSIX_SPAWN_PANIC_ON_SPAWN_FAIL',0x8) +PROT_NONE = Constant('PROT_NONE',0x00) +PROT_READ = Constant('PROT_READ',0x01) +PROT_WRITE = Constant('PROT_WRITE',0x02) +PROT_EXEC = Constant('PROT_EXEC',0x04) +MAP_SHARED = Constant('MAP_SHARED',0x0001) +MAP_PRIVATE = Constant('MAP_PRIVATE',0x0002) +MAP_FIXED = Constant('MAP_FIXED',0x0010) +MAP_RENAME = Constant('MAP_RENAME',0x0020) +MAP_NORESERVE = Constant('MAP_NORESERVE',0x0040) +MAP_RESERVED0080 = Constant('MAP_RESERVED0080',0x0080) +MAP_NOEXTEND = Constant('MAP_NOEXTEND',0x0100) +MAP_HASSEMAPHORE = Constant('MAP_HASSEMAPHORE',0x0200) +MAP_NOCACHE = Constant('MAP_NOCACHE',0x0400) +MAP_JIT = Constant('MAP_JIT',0x0800) +MAP_FILE = Constant('MAP_FILE',0x0000) +MAP_ANON = Constant('MAP_ANON',0x1000) +MAP_RESILIENT_CODESIGN = Constant('MAP_RESILIENT_CODESIGN',0x2000) +MAP_RESILIENT_MEDIA = Constant('MAP_RESILIENT_MEDIA',0x4000) +MAP_32BIT = Constant('MAP_32BIT',0x8000) +MAP_TRANSLATED_ALLOW_EXECUTE = Constant('MAP_TRANSLATED_ALLOW_EXECUTE',0x20000) +MAP_UNIX03 = Constant('MAP_UNIX03',0x40000) +MAP_TPRO = Constant('MAP_TPRO',0x80000) +MCL_CURRENT = Constant('MCL_CURRENT',0x0001) +MCL_FUTURE = Constant('MCL_FUTURE',0x0002) +MS_ASYNC = Constant('MS_ASYNC',0x0001) +MS_INVALIDATE = Constant('MS_INVALIDATE',0x0002) +MS_SYNC = Constant('MS_SYNC',0x0010) +MS_KILLPAGES = Constant('MS_KILLPAGES',0x0004) +MS_DEACTIVATE = Constant('MS_DEACTIVATE',0x0008) +POSIX_MADV_NORMAL = Constant('POSIX_MADV_NORMAL',0) +POSIX_MADV_RANDOM = Constant('POSIX_MADV_RANDOM',1) +POSIX_MADV_SEQUENTIAL = Constant('POSIX_MADV_SEQUENTIAL',2) +POSIX_MADV_WILLNEED = Constant('POSIX_MADV_WILLNEED',3) +POSIX_MADV_DONTNEED = Constant('POSIX_MADV_DONTNEED',4) +MADV_FREE = Constant('MADV_FREE',5) +MADV_ZERO_WIRED_PAGES = Constant('MADV_ZERO_WIRED_PAGES',6) +MADV_FREE_REUSABLE = Constant('MADV_FREE_REUSABLE',7) +MADV_FREE_REUSE = Constant('MADV_FREE_REUSE',8) +MADV_CAN_REUSE = Constant('MADV_CAN_REUSE',9) +MADV_PAGEOUT = Constant('MADV_PAGEOUT',10) +MINCORE_INCORE = Constant('MINCORE_INCORE',0x1) +MINCORE_REFERENCED = Constant('MINCORE_REFERENCED',0x2) +MINCORE_MODIFIED = Constant('MINCORE_MODIFIED',0x4) +MINCORE_REFERENCED_OTHER = Constant('MINCORE_REFERENCED_OTHER',0x8) +MINCORE_MODIFIED_OTHER = Constant('MINCORE_MODIFIED_OTHER',0x10) +MINCORE_PAGED_OUT = Constant('MINCORE_PAGED_OUT',0x20) +MINCORE_COPIED = Constant('MINCORE_COPIED',0x40) +MINCORE_ANONYMOUS = Constant('MINCORE_ANONYMOUS',0x80) +B_WRITE = Constant('B_WRITE',0x00000000) +B_READ = Constant('B_READ',0x00000001) +B_ASYNC = Constant('B_ASYNC',0x00000002) +B_NOCACHE = Constant('B_NOCACHE',0x00000004) +B_DELWRI = Constant('B_DELWRI',0x00000008) +B_LOCKED = Constant('B_LOCKED',0x00000010) +B_PHYS = Constant('B_PHYS',0x00000020) +B_CLUSTER = Constant('B_CLUSTER',0x00000040) +B_PAGEIO = Constant('B_PAGEIO',0x00000080) +B_META = Constant('B_META',0x00000100) +B_RAW = Constant('B_RAW',0x00000200) +B_FUA = Constant('B_FUA',0x00000400) +B_PASSIVE = Constant('B_PASSIVE',0x00000800) +B_IOSTREAMING = Constant('B_IOSTREAMING',0x00001000) +B_THROTTLED_IO = Constant('B_THROTTLED_IO',0x00002000) +B_ENCRYPTED_IO = Constant('B_ENCRYPTED_IO',0x00004000) +B_STATICCONTENT = Constant('B_STATICCONTENT',0x00008000) +BUF_WAIT = Constant('BUF_WAIT',0x01) +BUF_WRITE_DATA = Constant('BUF_WRITE_DATA',0x0001) +BUF_SKIP_META = Constant('BUF_SKIP_META',0x0002) +BUF_INVALIDATE_LOCKED = Constant('BUF_INVALIDATE_LOCKED',0x0004) +BUF_SKIP_NONLOCKED = Constant('BUF_SKIP_NONLOCKED',0x01) +BUF_SKIP_LOCKED = Constant('BUF_SKIP_LOCKED',0x02) +BUF_SCAN_CLEAN = Constant('BUF_SCAN_CLEAN',0x04) +BUF_SCAN_DIRTY = Constant('BUF_SCAN_DIRTY',0x08) +BUF_NOTIFY_BUSY = Constant('BUF_NOTIFY_BUSY',0x10) +BUF_RETURNED = Constant('BUF_RETURNED',0) +BUF_RETURNED_DONE = Constant('BUF_RETURNED_DONE',1) +BUF_CLAIMED = Constant('BUF_CLAIMED',2) +BUF_CLAIMED_DONE = Constant('BUF_CLAIMED_DONE',3) +BLK_READ = Constant('BLK_READ',0x01) +BLK_WRITE = Constant('BLK_WRITE',0x02) +BLK_META = Constant('BLK_META',0x10) +BLK_ONLYVALID = Constant('BLK_ONLYVALID',0x80000000) +LOG_EMERG = Constant('LOG_EMERG',0) +LOG_ALERT = Constant('LOG_ALERT',1) +LOG_CRIT = Constant('LOG_CRIT',2) +LOG_ERR = Constant('LOG_ERR',3) +LOG_WARNING = Constant('LOG_WARNING',4) +LOG_NOTICE = Constant('LOG_NOTICE',5) +LOG_INFO = Constant('LOG_INFO',6) +LOG_DEBUG = Constant('LOG_DEBUG',7) +LOG_PRIMASK = Constant('LOG_PRIMASK',0x07) +INTERNAL_NOPRI = Constant('INTERNAL_NOPRI',0x10) +LOG_NFACILITIES = Constant('LOG_NFACILITIES',25) +LOG_FACMASK = Constant('LOG_FACMASK',0x03f8) +LOG_PID = Constant('LOG_PID',0x01) +LOG_CONS = Constant('LOG_CONS',0x02) +LOG_ODELAY = Constant('LOG_ODELAY',0x04) +LOG_NDELAY = Constant('LOG_NDELAY',0x08) +LOG_NOWAIT = Constant('LOG_NOWAIT',0x10) +LOG_PERROR = Constant('LOG_PERROR',0x20) +CRF_NOMEMBERD = Constant('CRF_NOMEMBERD',0x00000001) +CRF_MAC_ENFORCE = Constant('CRF_MAC_ENFORCE',0x00000002) +XUCRED_VERSION = Constant('XUCRED_VERSION',0) +DK_FEATURE_BARRIER = Constant('DK_FEATURE_BARRIER',0x00000002) +DK_FEATURE_PRIORITY = Constant('DK_FEATURE_PRIORITY',0x00000004) +DK_FEATURE_UNMAP = Constant('DK_FEATURE_UNMAP',0x00000010) +DK_SYNCHRONIZE_OPTION_BARRIER = Constant('DK_SYNCHRONIZE_OPTION_BARRIER',0x00000002) +DK_CORESTORAGE_PIN_YOUR_METADATA = Constant('DK_CORESTORAGE_PIN_YOUR_METADATA',0x00000001) +DK_CORESTORAGE_ENABLE_HOTFILES = Constant('DK_CORESTORAGE_ENABLE_HOTFILES',0x00000002) +DK_CORESTORAGE_PIN_YOUR_SWAPFILE = Constant('DK_CORESTORAGE_PIN_YOUR_SWAPFILE',0x00000004) +DK_PROVISION_TYPE_MAPPED = Constant('DK_PROVISION_TYPE_MAPPED',0x00) +DK_PROVISION_TYPE_DEALLOCATED = Constant('DK_PROVISION_TYPE_DEALLOCATED',0x01) +DK_PROVISION_TYPE_ANCHORED = Constant('DK_PROVISION_TYPE_ANCHORED',0x02) +DK_LOCATION_INTERNAL = Constant('DK_LOCATION_INTERNAL',0x00000000) +DK_LOCATION_EXTERNAL = Constant('DK_LOCATION_EXTERNAL',0x00000001) +DK_FEATURE_FORCE_UNIT_ACCESS = Constant('DK_FEATURE_FORCE_UNIT_ACCESS',0x00000001) +DK_ENCRYPTION_TYPE_AES_CBC = Constant('DK_ENCRYPTION_TYPE_AES_CBC',1) +DK_ENCRYPTION_TYPE_AES_XEX = Constant('DK_ENCRYPTION_TYPE_AES_XEX',2) +DK_ENCRYPTION_TYPE_AES_XTS = Constant('DK_ENCRYPTION_TYPE_AES_XTS',3) +DK_TIER_MASK = Constant('DK_TIER_MASK',0xC0) +DK_TIER_SHIFT = Constant('DK_TIER_SHIFT',6) +SOL_LOCAL = Constant('SOL_LOCAL',0) +LOCAL_PEERCRED = Constant('LOCAL_PEERCRED',0x001) +LOCAL_PEERPID = Constant('LOCAL_PEERPID',0x002) +LOCAL_PEEREPID = Constant('LOCAL_PEEREPID',0x003) +LOCAL_PEERUUID = Constant('LOCAL_PEERUUID',0x004) +LOCAL_PEEREUUID = Constant('LOCAL_PEEREUUID',0x005) +LOCAL_PEERTOKEN = Constant('LOCAL_PEERTOKEN',0x006) +_SYS_TIMEX_H_ = Constant('_SYS_TIMEX_H_',1) +NTP_API = Constant('NTP_API',4) +MINSEC = Constant('MINSEC',256) +MAXSEC = Constant('MAXSEC',2048) +MAXTC = Constant('MAXTC',10) +MOD_OFFSET = Constant('MOD_OFFSET',0x0001) +MOD_FREQUENCY = Constant('MOD_FREQUENCY',0x0002) +MOD_MAXERROR = Constant('MOD_MAXERROR',0x0004) +MOD_ESTERROR = Constant('MOD_ESTERROR',0x0008) +MOD_STATUS = Constant('MOD_STATUS',0x0010) +MOD_TIMECONST = Constant('MOD_TIMECONST',0x0020) +MOD_PPSMAX = Constant('MOD_PPSMAX',0x0040) +MOD_TAI = Constant('MOD_TAI',0x0080) +MOD_MICRO = Constant('MOD_MICRO',0x1000) +MOD_NANO = Constant('MOD_NANO',0x2000) +MOD_CLKB = Constant('MOD_CLKB',0x4000) +MOD_CLKA = Constant('MOD_CLKA',0x8000) +STA_PLL = Constant('STA_PLL',0x0001) +STA_PPSFREQ = Constant('STA_PPSFREQ',0x0002) +STA_PPSTIME = Constant('STA_PPSTIME',0x0004) +STA_FLL = Constant('STA_FLL',0x0008) +STA_INS = Constant('STA_INS',0x0010) +STA_DEL = Constant('STA_DEL',0x0020) +STA_UNSYNC = Constant('STA_UNSYNC',0x0040) +STA_FREQHOLD = Constant('STA_FREQHOLD',0x0080) +STA_PPSSIGNAL = Constant('STA_PPSSIGNAL',0x0100) +STA_PPSJITTER = Constant('STA_PPSJITTER',0x0200) +STA_PPSWANDER = Constant('STA_PPSWANDER',0x0400) +STA_PPSERROR = Constant('STA_PPSERROR',0x0800) +STA_CLOCKERR = Constant('STA_CLOCKERR',0x1000) +STA_NANO = Constant('STA_NANO',0x2000) +STA_MODE = Constant('STA_MODE',0x4000) +STA_CLK = Constant('STA_CLK',0x8000) +TIME_OK = Constant('TIME_OK',0) +TIME_INS = Constant('TIME_INS',1) +TIME_DEL = Constant('TIME_DEL',2) +TIME_OOP = Constant('TIME_OOP',3) +TIME_WAIT = Constant('TIME_WAIT',4) +TIME_ERROR = Constant('TIME_ERROR',5) +MT_FREE = Constant('MT_FREE',0) +MT_DATA = Constant('MT_DATA',1) +MT_HEADER = Constant('MT_HEADER',2) +MT_SOCKET = Constant('MT_SOCKET',3) +MT_PCB = Constant('MT_PCB',4) +MT_RTABLE = Constant('MT_RTABLE',5) +MT_HTABLE = Constant('MT_HTABLE',6) +MT_ATABLE = Constant('MT_ATABLE',7) +MT_SONAME = Constant('MT_SONAME',8) +MT_SOOPTS = Constant('MT_SOOPTS',10) +MT_FTABLE = Constant('MT_FTABLE',11) +MT_RIGHTS = Constant('MT_RIGHTS',12) +MT_IFADDR = Constant('MT_IFADDR',13) +MT_CONTROL = Constant('MT_CONTROL',14) +MT_OOBDATA = Constant('MT_OOBDATA',15) +MT_TAG = Constant('MT_TAG',16) +MT_MAX = Constant('MT_MAX',32) +MAX_MBUF_CNAME = Constant('MAX_MBUF_CNAME',15) +MCS_DISABLED = Constant('MCS_DISABLED',0) +MCS_ONLINE = Constant('MCS_ONLINE',1) +MCS_PURGING = Constant('MCS_PURGING',2) +MCS_OFFLINE = Constant('MCS_OFFLINE',3) +MSG_NOERROR = Constant('MSG_NOERROR',0o010000) +MSGSSZ = Constant('MSGSSZ',8) +MSGSEG = Constant('MSGSEG',2048) +MSGMNB = Constant('MSGMNB',2048) +MSGMNI = Constant('MSGMNI',40) +MSGTQL = Constant('MSGTQL',40) +MSG_LOCKED = Constant('MSG_LOCKED',0o01000) +DBG_MACH = Constant('DBG_MACH',1) +DBG_NETWORK = Constant('DBG_NETWORK',2) +DBG_FSYSTEM = Constant('DBG_FSYSTEM',3) +DBG_BSD = Constant('DBG_BSD',4) +DBG_IOKIT = Constant('DBG_IOKIT',5) +DBG_DRIVERS = Constant('DBG_DRIVERS',6) +DBG_TRACE = Constant('DBG_TRACE',7) +DBG_DLIL = Constant('DBG_DLIL',8) +DBG_PTHREAD = Constant('DBG_PTHREAD',9) +DBG_CORESTORAGE = Constant('DBG_CORESTORAGE',10) +DBG_CG = Constant('DBG_CG',11) +DBG_MONOTONIC = Constant('DBG_MONOTONIC',12) +DBG_MISC = Constant('DBG_MISC',20) +DBG_SECURITY = Constant('DBG_SECURITY',30) +DBG_DYLD = Constant('DBG_DYLD',31) +DBG_QT = Constant('DBG_QT',32) +DBG_APPS = Constant('DBG_APPS',33) +DBG_LAUNCHD = Constant('DBG_LAUNCHD',34) +DBG_SILICON = Constant('DBG_SILICON',35) +DBG_PERF = Constant('DBG_PERF',37) +DBG_IMPORTANCE = Constant('DBG_IMPORTANCE',38) +DBG_BANK = Constant('DBG_BANK',40) +DBG_XPC = Constant('DBG_XPC',41) +DBG_ATM = Constant('DBG_ATM',42) +DBG_ARIADNE = Constant('DBG_ARIADNE',43) +DBG_DAEMON = Constant('DBG_DAEMON',44) +DBG_ENERGYTRACE = Constant('DBG_ENERGYTRACE',45) +DBG_DISPATCH = Constant('DBG_DISPATCH',46) +DBG_IMG = Constant('DBG_IMG',49) +DBG_UMALLOC = Constant('DBG_UMALLOC',51) +DBG_TURNSTILE = Constant('DBG_TURNSTILE',53) +DBG_AUDIO = Constant('DBG_AUDIO',54) +DBG_MIG = Constant('DBG_MIG',255) +DBG_MACH_EXCP_KTRAP_x86 = Constant('DBG_MACH_EXCP_KTRAP_x86',0x02) +DBG_MACH_EXCP_DFLT = Constant('DBG_MACH_EXCP_DFLT',0x03) +DBG_MACH_EXCP_SYNC_ARM = Constant('DBG_MACH_EXCP_SYNC_ARM',0x03) +DBG_MACH_EXCP_IFLT = Constant('DBG_MACH_EXCP_IFLT',0x04) +DBG_MACH_EXCP_SERR_ARM = Constant('DBG_MACH_EXCP_SERR_ARM',0x04) +DBG_MACH_EXCP_INTR = Constant('DBG_MACH_EXCP_INTR',0x05) +DBG_MACH_EXCP_ALNG = Constant('DBG_MACH_EXCP_ALNG',0x06) +DBG_MACH_EXCP_UTRAP_x86 = Constant('DBG_MACH_EXCP_UTRAP_x86',0x07) +DBG_MACH_EXCP_FP = Constant('DBG_MACH_EXCP_FP',0x08) +DBG_MACH_EXCP_DECI = Constant('DBG_MACH_EXCP_DECI',0x09) +DBG_MACH_CHUD = Constant('DBG_MACH_CHUD',0x0A) +DBG_MACH_SIGNPOST = Constant('DBG_MACH_SIGNPOST',0x0A) +DBG_MACH_EXCP_SC = Constant('DBG_MACH_EXCP_SC',0x0C) +DBG_MACH_EXCP_TRACE = Constant('DBG_MACH_EXCP_TRACE',0x0D) +DBG_MACH_EXCP_EMUL = Constant('DBG_MACH_EXCP_EMUL',0x0E) +DBG_MACH_IHDLR = Constant('DBG_MACH_IHDLR',0x10) +DBG_MACH_IPC = Constant('DBG_MACH_IPC',0x20) +DBG_MACH_RESOURCE = Constant('DBG_MACH_RESOURCE',0x25) +DBG_MACH_VM = Constant('DBG_MACH_VM',0x30) +DBG_MACH_LEAKS = Constant('DBG_MACH_LEAKS',0x31) +DBG_MACH_WORKINGSET = Constant('DBG_MACH_WORKINGSET',0x32) +DBG_MACH_SCHED = Constant('DBG_MACH_SCHED',0x40) +DBG_MACH_MSGID_INVALID = Constant('DBG_MACH_MSGID_INVALID',0x50) +DBG_MACH_LOCKS = Constant('DBG_MACH_LOCKS',0x60) +DBG_MACH_PMAP = Constant('DBG_MACH_PMAP',0x70) +DBG_MACH_CLOCK = Constant('DBG_MACH_CLOCK',0x80) +DBG_MACH_MP = Constant('DBG_MACH_MP',0x90) +DBG_MACH_VM_PRESSURE = Constant('DBG_MACH_VM_PRESSURE',0xA0) +DBG_MACH_STACKSHOT = Constant('DBG_MACH_STACKSHOT',0xA1) +DBG_MACH_SFI = Constant('DBG_MACH_SFI',0xA2) +DBG_MACH_ENERGY_PERF = Constant('DBG_MACH_ENERGY_PERF',0xA3) +DBG_MACH_SYSDIAGNOSE = Constant('DBG_MACH_SYSDIAGNOSE',0xA4) +DBG_MACH_ZALLOC = Constant('DBG_MACH_ZALLOC',0xA5) +DBG_MACH_THREAD_GROUP = Constant('DBG_MACH_THREAD_GROUP',0xA6) +DBG_MACH_COALITION = Constant('DBG_MACH_COALITION',0xA7) +DBG_MACH_SHAREDREGION = Constant('DBG_MACH_SHAREDREGION',0xA8) +DBG_MACH_SCHED_CLUTCH = Constant('DBG_MACH_SCHED_CLUTCH',0xA9) +DBG_MACH_IO = Constant('DBG_MACH_IO',0xAA) +DBG_MACH_WORKGROUP = Constant('DBG_MACH_WORKGROUP',0xAB) +DBG_MACH_HV = Constant('DBG_MACH_HV',0xAC) +DBG_MACH_KCOV = Constant('DBG_MACH_KCOV',0xAD) +DBG_MACH_MACHDEP_EXCP_SC_x86 = Constant('DBG_MACH_MACHDEP_EXCP_SC_x86',0xAE) +DBG_MACH_MACHDEP_EXCP_SC_ARM = Constant('DBG_MACH_MACHDEP_EXCP_SC_ARM',0xAF) +DBC_MACH_IO_MMIO_READ = Constant('DBC_MACH_IO_MMIO_READ',0x1) +DBC_MACH_IO_MMIO_WRITE = Constant('DBC_MACH_IO_MMIO_WRITE',0x2) +DBC_MACH_IO_PHYS_READ = Constant('DBC_MACH_IO_PHYS_READ',0x3) +DBC_MACH_IO_PHYS_WRITE = Constant('DBC_MACH_IO_PHYS_WRITE',0x4) +DBC_MACH_IO_PORTIO_READ = Constant('DBC_MACH_IO_PORTIO_READ',0x5) +DBC_MACH_IO_PORTIO_WRITE = Constant('DBC_MACH_IO_PORTIO_WRITE',0x6) +DBG_INTR_TYPE_UNKNOWN = Constant('DBG_INTR_TYPE_UNKNOWN',0x0) +DBG_INTR_TYPE_IPI = Constant('DBG_INTR_TYPE_IPI',0x1) +DBG_INTR_TYPE_TIMER = Constant('DBG_INTR_TYPE_TIMER',0x2) +DBG_INTR_TYPE_OTHER = Constant('DBG_INTR_TYPE_OTHER',0x3) +DBG_INTR_TYPE_PMI = Constant('DBG_INTR_TYPE_PMI',0x4) +DBG_INTR_TYPE_RSVD1 = Constant('DBG_INTR_TYPE_RSVD1',0x5) +MACH_SCHED = Constant('MACH_SCHED',0x0) +MACH_STACK_ATTACH = Constant('MACH_STACK_ATTACH',0x1) +MACH_STACK_HANDOFF = Constant('MACH_STACK_HANDOFF',0x2) +MACH_CALL_CONT = Constant('MACH_CALL_CONT',0x3) +MACH_CALLOUT = Constant('MACH_CALLOUT',0x4) +MACH_STACK_DETACH = Constant('MACH_STACK_DETACH',0x5) +MACH_MAKE_RUNNABLE = Constant('MACH_MAKE_RUNNABLE',0x6) +MACH_PROMOTE = Constant('MACH_PROMOTE',0x7) +MACH_DEMOTE = Constant('MACH_DEMOTE',0x8) +MACH_IDLE = Constant('MACH_IDLE',0x9) +MACH_STACK_DEPTH = Constant('MACH_STACK_DEPTH',0xa) +MACH_MOVED = Constant('MACH_MOVED',0xb) +MACH_PSET_LOAD_AVERAGE = Constant('MACH_PSET_LOAD_AVERAGE',0xc) +MACH_AMP_DEBUG = Constant('MACH_AMP_DEBUG',0xd) +MACH_FAILSAFE = Constant('MACH_FAILSAFE',0xe) +MACH_BLOCK = Constant('MACH_BLOCK',0xf) +MACH_WAIT = Constant('MACH_WAIT',0x10) +MACH_GET_URGENCY = Constant('MACH_GET_URGENCY',0x14) +MACH_URGENCY = Constant('MACH_URGENCY',0x15) +MACH_REDISPATCH = Constant('MACH_REDISPATCH',0x16) +MACH_REMOTE_AST = Constant('MACH_REMOTE_AST',0x17) +MACH_SCHED_CHOOSE_PROCESSOR = Constant('MACH_SCHED_CHOOSE_PROCESSOR',0x18) +MACH_DEEP_IDLE = Constant('MACH_DEEP_IDLE',0x19) +MACH_CPU_THROTTLE_DISABLE = Constant('MACH_CPU_THROTTLE_DISABLE',0x1b) +MACH_RW_PROMOTE = Constant('MACH_RW_PROMOTE',0x1c) +MACH_RW_DEMOTE = Constant('MACH_RW_DEMOTE',0x1d) +MACH_SCHED_MAINTENANCE = Constant('MACH_SCHED_MAINTENANCE',0x1f) +MACH_DISPATCH = Constant('MACH_DISPATCH',0x20) +MACH_QUANTUM_HANDOFF = Constant('MACH_QUANTUM_HANDOFF',0x21) +MACH_MULTIQ_DEQUEUE = Constant('MACH_MULTIQ_DEQUEUE',0x22) +MACH_SCHED_THREAD_SWITCH = Constant('MACH_SCHED_THREAD_SWITCH',0x23) +MACH_SCHED_SMT_BALANCE = Constant('MACH_SCHED_SMT_BALANCE',0x24) +MACH_REMOTE_DEFERRED_AST = Constant('MACH_REMOTE_DEFERRED_AST',0x25) +MACH_REMOTE_CANCEL_AST = Constant('MACH_REMOTE_CANCEL_AST',0x26) +MACH_SCHED_CHANGE_PRIORITY = Constant('MACH_SCHED_CHANGE_PRIORITY',0x27) +MACH_SCHED_UPDATE_REC_CORES = Constant('MACH_SCHED_UPDATE_REC_CORES',0x28) +MACH_STACK_WAIT = Constant('MACH_STACK_WAIT',0x29) +MACH_THREAD_BIND = Constant('MACH_THREAD_BIND',0x2a) +MACH_WAITQ_PROMOTE = Constant('MACH_WAITQ_PROMOTE',0x2b) +MACH_WAITQ_DEMOTE = Constant('MACH_WAITQ_DEMOTE',0x2c) +MACH_SCHED_LOAD = Constant('MACH_SCHED_LOAD',0x2d) +MACH_REC_CORES_FAILSAFE = Constant('MACH_REC_CORES_FAILSAFE',0x2e) +MACH_SCHED_QUANTUM_EXPIRED = Constant('MACH_SCHED_QUANTUM_EXPIRED',0x2f) +MACH_EXEC_PROMOTE = Constant('MACH_EXEC_PROMOTE',0x30) +MACH_EXEC_DEMOTE = Constant('MACH_EXEC_DEMOTE',0x31) +MACH_AMP_SIGNAL_SPILL = Constant('MACH_AMP_SIGNAL_SPILL',0x32) +MACH_AMP_STEAL = Constant('MACH_AMP_STEAL',0x33) +MACH_SCHED_LOAD_EFFECTIVE = Constant('MACH_SCHED_LOAD_EFFECTIVE',0x34) +MACH_QUIESCENT_COUNTER = Constant('MACH_QUIESCENT_COUNTER',0x38) +MACH_TURNSTILE_USER_CHANGE = Constant('MACH_TURNSTILE_USER_CHANGE',0x39) +MACH_AMP_RECOMMENDATION_CHANGE = Constant('MACH_AMP_RECOMMENDATION_CHANGE',0x3a) +MACH_AMP_PERFCTL_POLICY_CHANGE = Constant('MACH_AMP_PERFCTL_POLICY_CHANGE',0x3b) +MACH_TURNSTILE_KERNEL_CHANGE = Constant('MACH_TURNSTILE_KERNEL_CHANGE',0x40) +MACH_SCHED_WI_AUTO_JOIN = Constant('MACH_SCHED_WI_AUTO_JOIN',0x41) +MACH_SCHED_WI_DEFERRED_FINISH = Constant('MACH_SCHED_WI_DEFERRED_FINISH',0x42) +MACH_SET_RT_DEADLINE = Constant('MACH_SET_RT_DEADLINE',0x43) +MACH_CANCEL_RT_DEADLINE = Constant('MACH_CANCEL_RT_DEADLINE',0x44) +MACH_RT_SIGNAL_SPILL = Constant('MACH_RT_SIGNAL_SPILL',0x45) +MACH_RT_STEAL = Constant('MACH_RT_STEAL',0x46) +MACH_PENDING_AST_URGENT = Constant('MACH_PENDING_AST_URGENT',0x47) +MACH_SCHED_THREAD_SELECT = Constant('MACH_SCHED_THREAD_SELECT',0x48) +MACH_SCHED_NEXT_PROCESSOR = Constant('MACH_SCHED_NEXT_PROCESSOR',0x49) +MACH_PSET_AVG_EXEC_TIME = Constant('MACH_PSET_AVG_EXEC_TIME',0x50) +MACH_SUSPEND_USERSPACE = Constant('MACH_SUSPEND_USERSPACE',0x51) +MACH_PREEMPTION_EXPIRED = Constant('MACH_PREEMPTION_EXPIRED',0x52) +MACH_FLOOR_PROMOTE = Constant('MACH_FLOOR_PROMOTE',0x53) +MACH_FLOOR_DEMOTE = Constant('MACH_FLOOR_DEMOTE',0x54) +MACH_INT_MASKED_EXPIRED = Constant('MACH_INT_MASKED_EXPIRED',0x55) +MACH_INT_HANDLED_EXPIRED = Constant('MACH_INT_HANDLED_EXPIRED',0x56) +MACH_UPDATE_POWERED_CORES = Constant('MACH_UPDATE_POWERED_CORES',0x58) +MACH_MODE_DEMOTE_THROTTLED = Constant('MACH_MODE_DEMOTE_THROTTLED',0x59) +MACH_MODE_DEMOTE_FAILSAFE = Constant('MACH_MODE_DEMOTE_FAILSAFE',0x5a) +MACH_MODE_DEMOTE_RT_DISALLOWED = Constant('MACH_MODE_DEMOTE_RT_DISALLOWED',0x5b) +MACH_MODE_UNDEMOTE_THROTTLED = Constant('MACH_MODE_UNDEMOTE_THROTTLED',0x5c) +MACH_MODE_UNDEMOTE_FAILSAFE = Constant('MACH_MODE_UNDEMOTE_FAILSAFE',0x5d) +MACH_MODE_UNDEMOTE_RT_DISALLOWED = Constant('MACH_MODE_UNDEMOTE_RT_DISALLOWED',0x5e) +MACH_INT_MASKED_RESET = Constant('MACH_INT_MASKED_RESET',0x5f) +MACH_RT_DISALLOWED_WORK_INTERVAL = Constant('MACH_RT_DISALLOWED_WORK_INTERVAL',0x60) +MACH_SCHED_WI_EXTERNAL_WAKEUP = Constant('MACH_SCHED_WI_EXTERNAL_WAKEUP',0x61) +MACH_SCHED_AST_CHECK = Constant('MACH_SCHED_AST_CHECK',0x62) +MACH_SCHED_PREEMPT_TIMER_ACTIVE = Constant('MACH_SCHED_PREEMPT_TIMER_ACTIVE',0x63) +MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE = Constant('MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE',0x0) +MACH_SCHED_CLUTCH_TG_BUCKET_STATE = Constant('MACH_SCHED_CLUTCH_TG_BUCKET_STATE',0x1) +MACH_SCHED_CLUTCH_THREAD_SELECT = Constant('MACH_SCHED_CLUTCH_THREAD_SELECT',0x2) +MACH_SCHED_CLUTCH_THREAD_STATE = Constant('MACH_SCHED_CLUTCH_THREAD_STATE',0x3) +MACH_SCHED_CLUTCH_TG_BUCKET_PRI = Constant('MACH_SCHED_CLUTCH_TG_BUCKET_PRI',0x4) +MACH_SCHED_EDGE_CLUSTER_OVERLOAD = Constant('MACH_SCHED_EDGE_CLUSTER_OVERLOAD',0x5) +MACH_SCHED_EDGE_STEAL = Constant('MACH_SCHED_EDGE_STEAL',0x6) +MACH_SCHED_EDGE_REBAL_RUNNABLE = Constant('MACH_SCHED_EDGE_REBAL_RUNNABLE',0x7) +MACH_SCHED_EDGE_REBAL_RUNNING = Constant('MACH_SCHED_EDGE_REBAL_RUNNING',0x8) +MACH_SCHED_EDGE_SHOULD_YIELD = Constant('MACH_SCHED_EDGE_SHOULD_YIELD',0x9) +MACH_SCHED_CLUTCH_THR_COUNT = Constant('MACH_SCHED_CLUTCH_THR_COUNT',0xa) +MACH_SCHED_EDGE_LOAD_AVG = Constant('MACH_SCHED_EDGE_LOAD_AVG',0xb) +MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD = Constant('MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD',0xc) +MACH_SCHED_EDGE_RSRC_HEAVY_THREAD = Constant('MACH_SCHED_EDGE_RSRC_HEAVY_THREAD',0xd) +MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE = Constant('MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE',0xe) +WORKGROUP_INTERVAL_CREATE = Constant('WORKGROUP_INTERVAL_CREATE',0x0) +WORKGROUP_INTERVAL_DESTROY = Constant('WORKGROUP_INTERVAL_DESTROY',0x1) +WORKGROUP_INTERVAL_CHANGE = Constant('WORKGROUP_INTERVAL_CHANGE',0x2) +WORKGROUP_INTERVAL_START = Constant('WORKGROUP_INTERVAL_START',0x3) +WORKGROUP_INTERVAL_UPDATE = Constant('WORKGROUP_INTERVAL_UPDATE',0x4) +WORKGROUP_INTERVAL_FINISH = Constant('WORKGROUP_INTERVAL_FINISH',0x5) +WORKGROUP_INTERVAL_SET_WORKLOAD_ID = Constant('WORKGROUP_INTERVAL_SET_WORKLOAD_ID',0x6) +WORKGROUP_INTERVAL_SET_WORKLOAD_ID_NAME = Constant('WORKGROUP_INTERVAL_SET_WORKLOAD_ID_NAME',0x7) +KCOV_STKSZ_THRESHOLD_ABOVE = Constant('KCOV_STKSZ_THRESHOLD_ABOVE',0x0) +KCOV_STKSZ_THRESHOLD_BELOW = Constant('KCOV_STKSZ_THRESHOLD_BELOW',0x1) +MACH_MULTIQ_BOUND = Constant('MACH_MULTIQ_BOUND',1) +MACH_MULTIQ_GROUP = Constant('MACH_MULTIQ_GROUP',2) +MACH_MULTIQ_GLOBAL = Constant('MACH_MULTIQ_GLOBAL',3) +DBG_ZERO_FILL_FAULT = Constant('DBG_ZERO_FILL_FAULT',1) +DBG_PAGEIN_FAULT = Constant('DBG_PAGEIN_FAULT',2) +DBG_COW_FAULT = Constant('DBG_COW_FAULT',3) +DBG_CACHE_HIT_FAULT = Constant('DBG_CACHE_HIT_FAULT',4) +DBG_NZF_PAGE_FAULT = Constant('DBG_NZF_PAGE_FAULT',5) +DBG_GUARD_FAULT = Constant('DBG_GUARD_FAULT',6) +DBG_PAGEINV_FAULT = Constant('DBG_PAGEINV_FAULT',7) +DBG_PAGEIND_FAULT = Constant('DBG_PAGEIND_FAULT',8) +DBG_COMPRESSOR_FAULT = Constant('DBG_COMPRESSOR_FAULT',9) +DBG_COMPRESSOR_SWAPIN_FAULT = Constant('DBG_COMPRESSOR_SWAPIN_FAULT',10) +DBG_COR_FAULT = Constant('DBG_COR_FAULT',11) +MACH_TASK_SUSPEND = Constant('MACH_TASK_SUSPEND',0x0) +MACH_TASK_RESUME = Constant('MACH_TASK_RESUME',0x1) +MACH_THREAD_SET_VOUCHER = Constant('MACH_THREAD_SET_VOUCHER',0x2) +MACH_IPC_MSG_SEND = Constant('MACH_IPC_MSG_SEND',0x3) +MACH_IPC_MSG_RECV = Constant('MACH_IPC_MSG_RECV',0x4) +MACH_IPC_MSG_RECV_VOUCHER_REFUSED = Constant('MACH_IPC_MSG_RECV_VOUCHER_REFUSED',0x5) +MACH_IPC_KMSG_FREE = Constant('MACH_IPC_KMSG_FREE',0x6) +MACH_IPC_VOUCHER_CREATE = Constant('MACH_IPC_VOUCHER_CREATE',0x7) +MACH_IPC_VOUCHER_CREATE_ATTR_DATA = Constant('MACH_IPC_VOUCHER_CREATE_ATTR_DATA',0x8) +MACH_IPC_VOUCHER_DESTROY = Constant('MACH_IPC_VOUCHER_DESTROY',0x9) +MACH_IPC_KMSG_INFO = Constant('MACH_IPC_KMSG_INFO',0xa) +MACH_IPC_KMSG_LINK = Constant('MACH_IPC_KMSG_LINK',0xb) +MACH_IPC_PORT_ENTRY_MODIFY = Constant('MACH_IPC_PORT_ENTRY_MODIFY',0xc) +MACH_IPC_DESTROY_GUARDED_DESC = Constant('MACH_IPC_DESTROY_GUARDED_DESC',0xd) +MACH_THREAD_GROUP_NEW = Constant('MACH_THREAD_GROUP_NEW',0x0) +MACH_THREAD_GROUP_FREE = Constant('MACH_THREAD_GROUP_FREE',0x1) +MACH_THREAD_GROUP_SET = Constant('MACH_THREAD_GROUP_SET',0x2) +MACH_THREAD_GROUP_NAME = Constant('MACH_THREAD_GROUP_NAME',0x3) +MACH_THREAD_GROUP_NAME_FREE = Constant('MACH_THREAD_GROUP_NAME_FREE',0x4) +MACH_THREAD_GROUP_FLAGS = Constant('MACH_THREAD_GROUP_FLAGS',0x5) +MACH_THREAD_GROUP_BLOCK = Constant('MACH_THREAD_GROUP_BLOCK',0x6) +MACH_THREAD_GROUP_PREADOPT = Constant('MACH_THREAD_GROUP_PREADOPT',0x7) +MACH_THREAD_GROUP_PREADOPT_NEXTTIME = Constant('MACH_THREAD_GROUP_PREADOPT_NEXTTIME',0x8) +MACH_THREAD_GROUP_PREADOPT_CLEAR = Constant('MACH_THREAD_GROUP_PREADOPT_CLEAR',0x9) +MACH_THREAD_GROUP_PREADOPT_NA = Constant('MACH_THREAD_GROUP_PREADOPT_NA',0xa) +MACH_COALITION_NEW = Constant('MACH_COALITION_NEW',0x0) +MACH_COALITION_FREE = Constant('MACH_COALITION_FREE',0x1) +MACH_COALITION_ADOPT = Constant('MACH_COALITION_ADOPT',0x2) +MACH_COALITION_REMOVE = Constant('MACH_COALITION_REMOVE',0x3) +MACH_COALITION_THREAD_GROUP_SET = Constant('MACH_COALITION_THREAD_GROUP_SET',0x4) +PMAP__CREATE = Constant('PMAP__CREATE',0x0) +PMAP__DESTROY = Constant('PMAP__DESTROY',0x1) +PMAP__PROTECT = Constant('PMAP__PROTECT',0x2) +PMAP__PAGE_PROTECT = Constant('PMAP__PAGE_PROTECT',0x3) +PMAP__ENTER = Constant('PMAP__ENTER',0x4) +PMAP__REMOVE = Constant('PMAP__REMOVE',0x5) +PMAP__NEST = Constant('PMAP__NEST',0x6) +PMAP__UNNEST = Constant('PMAP__UNNEST',0x7) +PMAP__FLUSH_TLBS = Constant('PMAP__FLUSH_TLBS',0x8) +PMAP__UPDATE_INTERRUPT = Constant('PMAP__UPDATE_INTERRUPT',0x9) +PMAP__ATTRIBUTE_CLEAR = Constant('PMAP__ATTRIBUTE_CLEAR',0xa) +PMAP__REUSABLE = Constant('PMAP__REUSABLE',0xb) +PMAP__QUERY_RESIDENT = Constant('PMAP__QUERY_RESIDENT',0xc) +PMAP__FLUSH_KERN_TLBS = Constant('PMAP__FLUSH_KERN_TLBS',0xd) +PMAP__FLUSH_DELAYED_TLBS = Constant('PMAP__FLUSH_DELAYED_TLBS',0xe) +PMAP__FLUSH_TLBS_TO = Constant('PMAP__FLUSH_TLBS_TO',0xf) +PMAP__FLUSH_EPT = Constant('PMAP__FLUSH_EPT',0x10) +PMAP__FAST_FAULT = Constant('PMAP__FAST_FAULT',0x11) +PMAP__SWITCH = Constant('PMAP__SWITCH',0x12) +PMAP__TTE = Constant('PMAP__TTE',0x13) +PMAP__SWITCH_USER_TTB = Constant('PMAP__SWITCH_USER_TTB',0x14) +PMAP__UPDATE_CACHING = Constant('PMAP__UPDATE_CACHING',0x15) +PMAP__ATTRIBUTE_CLEAR_RANGE = Constant('PMAP__ATTRIBUTE_CLEAR_RANGE',0x16) +PMAP__CLEAR_USER_TTB = Constant('PMAP__CLEAR_USER_TTB',0x17) +PMAP__IOMMU_INIT = Constant('PMAP__IOMMU_INIT',0x18) +PMAP__IOMMU_IOVMALLOC = Constant('PMAP__IOMMU_IOVMALLOC',0x19) +PMAP__IOMMU_IOVMFREE = Constant('PMAP__IOMMU_IOVMFREE',0x1a) +PMAP__IOMMU_MAP = Constant('PMAP__IOMMU_MAP',0x1b) +PMAP__IOMMU_UNMAP = Constant('PMAP__IOMMU_UNMAP',0x1c) +PMAP__IOMMU_IOCTL = Constant('PMAP__IOMMU_IOCTL',0x1d) +PMAP__IOMMU_GRANT_PAGE = Constant('PMAP__IOMMU_GRANT_PAGE',0x1e) +PMAP__BATCH_UPDATE_CACHING = Constant('PMAP__BATCH_UPDATE_CACHING',0x1f) +PMAP__COLLECT_CACHE_OPS = Constant('PMAP__COLLECT_CACHE_OPS',0x20) +MACH_EPOCH_CHANGE = Constant('MACH_EPOCH_CHANGE',0x0) +MACH_BRIDGE_RCV_TS = Constant('MACH_BRIDGE_RCV_TS',0x1) +MACH_BRIDGE_REMOTE_TIME = Constant('MACH_BRIDGE_REMOTE_TIME',0x2) +MACH_BRIDGE_RESET_TS = Constant('MACH_BRIDGE_RESET_TS',0x3) +MACH_BRIDGE_TS_PARAMS = Constant('MACH_BRIDGE_TS_PARAMS',0x4) +MACH_BRIDGE_SKIP_TS = Constant('MACH_BRIDGE_SKIP_TS',0x5) +MACH_BRIDGE_TS_MISMATCH = Constant('MACH_BRIDGE_TS_MISMATCH',0x6) +MACH_BRIDGE_OBSV_RATE = Constant('MACH_BRIDGE_OBSV_RATE',0x7) +MICROSTACKSHOT_RECORD = Constant('MICROSTACKSHOT_RECORD',0x0) +MICROSTACKSHOT_GATHER = Constant('MICROSTACKSHOT_GATHER',0x1) +STACKSHOT_RECORD = Constant('STACKSHOT_RECORD',0x2) +STACKSHOT_RECORD_SHORT = Constant('STACKSHOT_RECORD_SHORT',0x3) +STACKSHOT_KERN_RECORD = Constant('STACKSHOT_KERN_RECORD',0x4) +SYSDIAGNOSE_NOTIFY_USER = Constant('SYSDIAGNOSE_NOTIFY_USER',0x0) +SYSDIAGNOSE_FULL = Constant('SYSDIAGNOSE_FULL',0x1) +SYSDIAGNOSE_STACKSHOT = Constant('SYSDIAGNOSE_STACKSHOT',0x2) +SYSDIAGNOSE_TAILSPIN = Constant('SYSDIAGNOSE_TAILSPIN',0x3) +SFI_SET_WINDOW = Constant('SFI_SET_WINDOW',0x0) +SFI_CANCEL_WINDOW = Constant('SFI_CANCEL_WINDOW',0x1) +SFI_SET_CLASS_OFFTIME = Constant('SFI_SET_CLASS_OFFTIME',0x2) +SFI_CANCEL_CLASS_OFFTIME = Constant('SFI_CANCEL_CLASS_OFFTIME',0x3) +SFI_THREAD_DEFER = Constant('SFI_THREAD_DEFER',0x4) +SFI_OFF_TIMER = Constant('SFI_OFF_TIMER',0x5) +SFI_ON_TIMER = Constant('SFI_ON_TIMER',0x6) +SFI_WAIT_CANCELED = Constant('SFI_WAIT_CANCELED',0x7) +SFI_PID_SET_MANAGED = Constant('SFI_PID_SET_MANAGED',0x8) +SFI_PID_CLEAR_MANAGED = Constant('SFI_PID_CLEAR_MANAGED',0x9) +SFI_GLOBAL_DEFER = Constant('SFI_GLOBAL_DEFER',0xa) +ZALLOC_ZCRAM = Constant('ZALLOC_ZCRAM',0x0) +RMON_ENABLE_CPUUSAGE_MONITOR = Constant('RMON_ENABLE_CPUUSAGE_MONITOR',0x001) +RMON_CPUUSAGE_VIOLATED = Constant('RMON_CPUUSAGE_VIOLATED',0x002) +RMON_CPUUSAGE_SUSPENDED = Constant('RMON_CPUUSAGE_SUSPENDED',0x003) +RMON_CPUUSAGE_VIOLATED_K32A = Constant('RMON_CPUUSAGE_VIOLATED_K32A',0x004) +RMON_CPUUSAGE_VIOLATED_K32B = Constant('RMON_CPUUSAGE_VIOLATED_K32B',0x005) +RMON_CPUUSAGE_RESUMED = Constant('RMON_CPUUSAGE_RESUMED',0x006) +RMON_DISABLE_CPUUSAGE_MONITOR = Constant('RMON_DISABLE_CPUUSAGE_MONITOR',0x00f) +RMON_ENABLE_CPUWAKES_MONITOR = Constant('RMON_ENABLE_CPUWAKES_MONITOR',0x011) +RMON_CPUWAKES_VIOLATED = Constant('RMON_CPUWAKES_VIOLATED',0x012) +RMON_CPUWAKES_VIOLATED_K32A = Constant('RMON_CPUWAKES_VIOLATED_K32A',0x014) +RMON_CPUWAKES_VIOLATED_K32B = Constant('RMON_CPUWAKES_VIOLATED_K32B',0x015) +RMON_DISABLE_CPUWAKES_MONITOR = Constant('RMON_DISABLE_CPUWAKES_MONITOR',0x01f) +RMON_ENABLE_IO_MONITOR = Constant('RMON_ENABLE_IO_MONITOR',0x021) +RMON_LOGWRITES_VIOLATED = Constant('RMON_LOGWRITES_VIOLATED',0x022) +RMON_PHYSWRITES_VIOLATED = Constant('RMON_PHYSWRITES_VIOLATED',0x023) +RMON_LOGWRITES_VIOLATED_K32A = Constant('RMON_LOGWRITES_VIOLATED_K32A',0x024) +RMON_LOGWRITES_VIOLATED_K32B = Constant('RMON_LOGWRITES_VIOLATED_K32B',0x025) +RMON_DISABLE_IO_MONITOR = Constant('RMON_DISABLE_IO_MONITOR',0x02f) +HV_X86_ENTER = Constant('HV_X86_ENTER',0x00) +HV_X86_ENTER_ERROR = Constant('HV_X86_ENTER_ERROR',0x01) +HV_X86_TRAP_TASK = Constant('HV_X86_TRAP_TASK',0x02) +HV_X86_TRAP_THREAD = Constant('HV_X86_TRAP_THREAD',0x03) +HV_X86_INTERRUPT_INJECT = Constant('HV_X86_INTERRUPT_INJECT',0x04) +HV_X86_INTERRUPT_RECV = Constant('HV_X86_INTERRUPT_RECV',0x05) +HV_X86_INTERRUPT_SEND = Constant('HV_X86_INTERRUPT_SEND',0x06) +HV_X86_IPI_SEND = Constant('HV_X86_IPI_SEND',0x07) +HV_X86_NMI_INJECT = Constant('HV_X86_NMI_INJECT',0x08) +HV_X86_NMI_SEND = Constant('HV_X86_NMI_SEND',0x09) +HV_X86_LSC_HIT = Constant('HV_X86_LSC_HIT',0x0a) +HV_X86_LSC_INSERT = Constant('HV_X86_LSC_INSERT',0x0b) +HV_X86_LSC_INSERT_IMM32 = Constant('HV_X86_LSC_INSERT_IMM32',0x0c) +HV_X86_LSC_INVALID = Constant('HV_X86_LSC_INVALID',0x0d) +HV_X86_LSC_INVALIDATE = Constant('HV_X86_LSC_INVALIDATE',0x0e) +HV_X86_LSC_MISS = Constant('HV_X86_LSC_MISS',0x0f) +HV_X86_TIMER_CANCEL = Constant('HV_X86_TIMER_CANCEL',0x10) +HV_X86_TIMER_FIRE = Constant('HV_X86_TIMER_FIRE',0x11) +HV_X86_TIMER_SCHEDULE = Constant('HV_X86_TIMER_SCHEDULE',0x12) +HV_X86_APIC_ACCESS_EXIT = Constant('HV_X86_APIC_ACCESS_EXIT',0x13) +HV_X86_APIC_WRITE_EXIT = Constant('HV_X86_APIC_WRITE_EXIT',0x14) +HV_X86_EPT_VIOLATION_EXIT = Constant('HV_X86_EPT_VIOLATION_EXIT',0x15) +HV_X86_EXC_NMI_EXIT = Constant('HV_X86_EXC_NMI_EXIT',0x16) +HV_X86_HLT_EXIT = Constant('HV_X86_HLT_EXIT',0x17) +HV_X86_IO_EXIT = Constant('HV_X86_IO_EXIT',0x18) +HV_X86_IRQ_EXIT = Constant('HV_X86_IRQ_EXIT',0x19) +HV_X86_IRQ_WND_EXIT = Constant('HV_X86_IRQ_WND_EXIT',0x1a) +HV_X86_MOV_DR_EXIT = Constant('HV_X86_MOV_DR_EXIT',0x1b) +HV_X86_NMI_WND_EXIT = Constant('HV_X86_NMI_WND_EXIT',0x1c) +HV_X86_RDMSR_EXIT = Constant('HV_X86_RDMSR_EXIT',0x1d) +HV_X86_RDPMC_EXIT = Constant('HV_X86_RDPMC_EXIT',0x1e) +HV_X86_TPR_THRESHOLD_EXIT = Constant('HV_X86_TPR_THRESHOLD_EXIT',0x1f) +HV_X86_VMX_TIMER_EXPIRED_EXIT = Constant('HV_X86_VMX_TIMER_EXPIRED_EXIT',0x20) +HV_X86_WRMSR_EXIT = Constant('HV_X86_WRMSR_EXIT',0x21) +HV_X86_VCPU_READ_APIC_TRAP = Constant('HV_X86_VCPU_READ_APIC_TRAP',0x22) +HV_X86_VCPU_READ_VMCS_TRAP = Constant('HV_X86_VCPU_READ_VMCS_TRAP',0x23) +HV_X86_VCPU_RUN_TRAP = Constant('HV_X86_VCPU_RUN_TRAP',0x24) +HV_X86_VCPU_RUN_UNTIL_TRAP = Constant('HV_X86_VCPU_RUN_UNTIL_TRAP',0x25) +HV_X86_VCPU_WRITE_APIC_TRAP = Constant('HV_X86_VCPU_WRITE_APIC_TRAP',0x26) +HV_X86_VM_ADDRSPACE_CREATE_TRAP = Constant('HV_X86_VM_ADDRSPACE_CREATE_TRAP',0x27) +HV_X86_VM_ADDRSPACE_DESTROY_TRAP = Constant('HV_X86_VM_ADDRSPACE_DESTROY_TRAP',0x28) +HV_X86_VM_INTR_MSI_TRAP = Constant('HV_X86_VM_INTR_MSI_TRAP',0x29) +HV_X86_VM_MAP_TRAP = Constant('HV_X86_VM_MAP_TRAP',0x2a) +HV_X86_VM_PROTECT_TRAP = Constant('HV_X86_VM_PROTECT_TRAP',0x2b) +HV_X86_VM_UNMAP_TRAP = Constant('HV_X86_VM_UNMAP_TRAP',0x2c) +HV_X86_TSC_OFFSET_SET = Constant('HV_X86_TSC_OFFSET_SET',0x2d) +DBG_NETIP = Constant('DBG_NETIP',1) +DBG_NETARP = Constant('DBG_NETARP',2) +DBG_NETUDP = Constant('DBG_NETUDP',3) +DBG_NETTCP = Constant('DBG_NETTCP',4) +DBG_NETICMP = Constant('DBG_NETICMP',5) +DBG_NETIGMP = Constant('DBG_NETIGMP',6) +DBG_NETRIP = Constant('DBG_NETRIP',7) +DBG_NETOSPF = Constant('DBG_NETOSPF',8) +DBG_NETISIS = Constant('DBG_NETISIS',9) +DBG_NETSNMP = Constant('DBG_NETSNMP',10) +DBG_NETSOCK = Constant('DBG_NETSOCK',11) +DBG_NETAARP = Constant('DBG_NETAARP',100) +DBG_NETDDP = Constant('DBG_NETDDP',101) +DBG_NETNBP = Constant('DBG_NETNBP',102) +DBG_NETZIP = Constant('DBG_NETZIP',103) +DBG_NETADSP = Constant('DBG_NETADSP',104) +DBG_NETATP = Constant('DBG_NETATP',105) +DBG_NETASP = Constant('DBG_NETASP',106) +DBG_NETAFP = Constant('DBG_NETAFP',107) +DBG_NETRTMP = Constant('DBG_NETRTMP',108) +DBG_NETAURP = Constant('DBG_NETAURP',109) +DBG_NETIPSEC = Constant('DBG_NETIPSEC',128) +DBG_NETVMNET = Constant('DBG_NETVMNET',129) +DBG_IOINTC = Constant('DBG_IOINTC',0) +DBG_IOWORKLOOP = Constant('DBG_IOWORKLOOP',1) +DBG_IOINTES = Constant('DBG_IOINTES',2) +DBG_IOCLKES = Constant('DBG_IOCLKES',3) +DBG_IOCMDQ = Constant('DBG_IOCMDQ',4) +DBG_IOMCURS = Constant('DBG_IOMCURS',5) +DBG_IOMDESC = Constant('DBG_IOMDESC',6) +DBG_IOPOWER = Constant('DBG_IOPOWER',7) +DBG_IOSERVICE = Constant('DBG_IOSERVICE',8) +DBG_IOREGISTRY = Constant('DBG_IOREGISTRY',9) +DBG_IOPORT = Constant('DBG_IOPORT',10) +DBG_IOSTORAGE = Constant('DBG_IOSTORAGE',32) +DBG_IONETWORK = Constant('DBG_IONETWORK',33) +DBG_IOKEYBOARD = Constant('DBG_IOKEYBOARD',34) +DBG_IOHID = Constant('DBG_IOHID',35) +DBG_IOAUDIO = Constant('DBG_IOAUDIO',36) +DBG_IOSERIAL = Constant('DBG_IOSERIAL',37) +DBG_IOTTY = Constant('DBG_IOTTY',38) +DBG_IOSAM = Constant('DBG_IOSAM',39) +DBG_IOPARALLELATA = Constant('DBG_IOPARALLELATA',40) +DBG_IOPARALLELSCSI = Constant('DBG_IOPARALLELSCSI',41) +DBG_IOSATA = Constant('DBG_IOSATA',42) +DBG_IOSAS = Constant('DBG_IOSAS',43) +DBG_IOFIBRECHANNEL = Constant('DBG_IOFIBRECHANNEL',44) +DBG_IOUSB = Constant('DBG_IOUSB',45) +DBG_IOBLUETOOTH = Constant('DBG_IOBLUETOOTH',46) +DBG_IOFIREWIRE = Constant('DBG_IOFIREWIRE',47) +DBG_IOINFINIBAND = Constant('DBG_IOINFINIBAND',48) +DBG_IOCPUPM = Constant('DBG_IOCPUPM',49) +DBG_IOGRAPHICS = Constant('DBG_IOGRAPHICS',50) +DBG_HIBERNATE = Constant('DBG_HIBERNATE',51) +DBG_IOTHUNDERBOLT = Constant('DBG_IOTHUNDERBOLT',52) +DBG_BOOTER = Constant('DBG_BOOTER',53) +DBG_IOAUDIO2 = Constant('DBG_IOAUDIO2',54) +DBG_IOAFK = Constant('DBG_IOAFK',55) +DBG_IOSURFACEPA = Constant('DBG_IOSURFACEPA',64) +DBG_IOMDPA = Constant('DBG_IOMDPA',65) +DBG_IODARTPA = Constant('DBG_IODARTPA',66) +DBG_DRVSTORAGE = Constant('DBG_DRVSTORAGE',1) +DBG_DRVNETWORK = Constant('DBG_DRVNETWORK',2) +DBG_DRVKEYBOARD = Constant('DBG_DRVKEYBOARD',3) +DBG_DRVHID = Constant('DBG_DRVHID',4) +DBG_DRVAUDIO = Constant('DBG_DRVAUDIO',5) +DBG_DRVSERIAL = Constant('DBG_DRVSERIAL',7) +DBG_DRVSAM = Constant('DBG_DRVSAM',8) +DBG_DRVPARALLELATA = Constant('DBG_DRVPARALLELATA',9) +DBG_DRVPARALLELSCSI = Constant('DBG_DRVPARALLELSCSI',10) +DBG_DRVSATA = Constant('DBG_DRVSATA',11) +DBG_DRVSAS = Constant('DBG_DRVSAS',12) +DBG_DRVFIBRECHANNEL = Constant('DBG_DRVFIBRECHANNEL',13) +DBG_DRVUSB = Constant('DBG_DRVUSB',14) +DBG_DRVBLUETOOTH = Constant('DBG_DRVBLUETOOTH',15) +DBG_DRVFIREWIRE = Constant('DBG_DRVFIREWIRE',16) +DBG_DRVINFINIBAND = Constant('DBG_DRVINFINIBAND',17) +DBG_DRVGRAPHICS = Constant('DBG_DRVGRAPHICS',18) +DBG_DRVSD = Constant('DBG_DRVSD',19) +DBG_DRVNAND = Constant('DBG_DRVNAND',20) +DBG_SSD = Constant('DBG_SSD',21) +DBG_DRVSPI = Constant('DBG_DRVSPI',22) +DBG_DRVWLAN_802_11 = Constant('DBG_DRVWLAN_802_11',23) +DBG_DRVSSM = Constant('DBG_DRVSSM',24) +DBG_DRVSMC = Constant('DBG_DRVSMC',25) +DBG_DRVMACEFIMANAGER = Constant('DBG_DRVMACEFIMANAGER',26) +DBG_DRVANE = Constant('DBG_DRVANE',27) +DBG_DRVETHERNET = Constant('DBG_DRVETHERNET',28) +DBG_DRVMCC = Constant('DBG_DRVMCC',29) +DBG_DRVACCESSORY = Constant('DBG_DRVACCESSORY',30) +DBG_SOCDIAGS = Constant('DBG_SOCDIAGS',31) +DBG_DRVVIRTIO = Constant('DBG_DRVVIRTIO',32) +DBG_DRVCELLULAR = Constant('DBG_DRVCELLULAR',33) +DBG_DRVSPMI = Constant('DBG_DRVSPMI',34) +DBG_DLIL_STATIC = Constant('DBG_DLIL_STATIC',1) +DBG_DLIL_PR_MOD = Constant('DBG_DLIL_PR_MOD',2) +DBG_DLIL_IF_MOD = Constant('DBG_DLIL_IF_MOD',3) +DBG_DLIL_PR_FLT = Constant('DBG_DLIL_PR_FLT',4) +DBG_DLIL_IF_FLT = Constant('DBG_DLIL_IF_FLT',5) +DBG_FSRW = Constant('DBG_FSRW',0x1) +DBG_DKRW = Constant('DBG_DKRW',0x2) +DBG_FSVN = Constant('DBG_FSVN',0x3) +DBG_FSLOOOKUP = Constant('DBG_FSLOOOKUP',0x4) +DBG_JOURNAL = Constant('DBG_JOURNAL',0x5) +DBG_IOCTL = Constant('DBG_IOCTL',0x6) +DBG_BOOTCACHE = Constant('DBG_BOOTCACHE',0x7) +DBG_HFS = Constant('DBG_HFS',0x8) +DBG_APFS = Constant('DBG_APFS',0x9) +DBG_SMB = Constant('DBG_SMB',0xA) +DBG_MOUNT = Constant('DBG_MOUNT',0xB) +DBG_EXFAT = Constant('DBG_EXFAT',0xE) +DBG_MSDOS = Constant('DBG_MSDOS',0xF) +DBG_ACFS = Constant('DBG_ACFS',0x10) +DBG_THROTTLE = Constant('DBG_THROTTLE',0x11) +DBG_DECMP = Constant('DBG_DECMP',0x12) +DBG_VFS = Constant('DBG_VFS',0x13) +DBG_LIVEFS = Constant('DBG_LIVEFS',0x14) +DBG_NFS = Constant('DBG_NFS',0x15) +DBG_CONTENT_PROT = Constant('DBG_CONTENT_PROT',0xCF) +DBG_HFS_UPDATE_ACCTIME = Constant('DBG_HFS_UPDATE_ACCTIME',0x01) +DBG_HFS_UPDATE_MODTIME = Constant('DBG_HFS_UPDATE_MODTIME',0x02) +DBG_HFS_UPDATE_CHGTIME = Constant('DBG_HFS_UPDATE_CHGTIME',0x04) +DBG_HFS_UPDATE_MODIFIED = Constant('DBG_HFS_UPDATE_MODIFIED',0x08) +DBG_HFS_UPDATE_FORCE = Constant('DBG_HFS_UPDATE_FORCE',0x10) +DBG_HFS_UPDATE_DATEADDED = Constant('DBG_HFS_UPDATE_DATEADDED',0x20) +DBG_HFS_UPDATE_MINOR = Constant('DBG_HFS_UPDATE_MINOR',0x40) +DBG_HFS_UPDATE_SKIPPED = Constant('DBG_HFS_UPDATE_SKIPPED',0x80) +DBG_VFS_IO_COMPRESSION_STATS = Constant('DBG_VFS_IO_COMPRESSION_STATS',0x1000) +DBG_BSD_PROC = Constant('DBG_BSD_PROC',0x01) +DBG_BSD_MEMSTAT = Constant('DBG_BSD_MEMSTAT',0x02) +DBG_BSD_KEVENT = Constant('DBG_BSD_KEVENT',0x03) +DBG_BSD_EXCP_SC = Constant('DBG_BSD_EXCP_SC',0x0C) +DBG_BSD_AIO = Constant('DBG_BSD_AIO',0x0D) +DBG_BSD_SC_EXTENDED_INFO = Constant('DBG_BSD_SC_EXTENDED_INFO',0x0E) +DBG_BSD_SC_EXTENDED_INFO2 = Constant('DBG_BSD_SC_EXTENDED_INFO2',0x0F) +DBG_BSD_KDEBUG_TEST = Constant('DBG_BSD_KDEBUG_TEST',0xFF) +BSD_PROC_EXIT = Constant('BSD_PROC_EXIT',1) +BSD_PROC_FRCEXIT = Constant('BSD_PROC_FRCEXIT',2) +BSD_PROC_EXEC = Constant('BSD_PROC_EXEC',3) +BSD_PROC_EXITREASON_CREATE = Constant('BSD_PROC_EXITREASON_CREATE',4) +BSD_PROC_EXITREASON_COMMIT = Constant('BSD_PROC_EXITREASON_COMMIT',5) +BSD_MEMSTAT_SCAN = Constant('BSD_MEMSTAT_SCAN',1) +BSD_MEMSTAT_JETSAM = Constant('BSD_MEMSTAT_JETSAM',2) +BSD_MEMSTAT_JETSAM_HIWAT = Constant('BSD_MEMSTAT_JETSAM_HIWAT',3) +BSD_MEMSTAT_FREEZE = Constant('BSD_MEMSTAT_FREEZE',4) +BSD_MEMSTAT_FREEZE_SCAN = Constant('BSD_MEMSTAT_FREEZE_SCAN',5) +BSD_MEMSTAT_UPDATE = Constant('BSD_MEMSTAT_UPDATE',6) +BSD_MEMSTAT_IDLE_DEMOTE = Constant('BSD_MEMSTAT_IDLE_DEMOTE',7) +BSD_MEMSTAT_CLEAR_ERRORS = Constant('BSD_MEMSTAT_CLEAR_ERRORS',8) +BSD_MEMSTAT_DIRTY_TRACK = Constant('BSD_MEMSTAT_DIRTY_TRACK',9) +BSD_MEMSTAT_DIRTY_SET = Constant('BSD_MEMSTAT_DIRTY_SET',10) +BSD_MEMSTAT_DIRTY_CLEAR = Constant('BSD_MEMSTAT_DIRTY_CLEAR',11) +BSD_MEMSTAT_FAST_JETSAM = Constant('BSD_MEMSTAT_FAST_JETSAM',15) +BSD_MEMSTAT_COMPACTOR_RUN = Constant('BSD_MEMSTAT_COMPACTOR_RUN',16) +BSD_MEMSTAT_FREEZE_DISABLE = Constant('BSD_MEMSTAT_FREEZE_DISABLE',17) +BSD_MEMSTAT_RELAUNCH_FLAGS = Constant('BSD_MEMSTAT_RELAUNCH_FLAGS',18) +BSD_KEVENT_KQ_PROCESS_BEGIN = Constant('BSD_KEVENT_KQ_PROCESS_BEGIN',1) +BSD_KEVENT_KQ_PROCESS_END = Constant('BSD_KEVENT_KQ_PROCESS_END',2) +BSD_KEVENT_KQWQ_PROCESS_BEGIN = Constant('BSD_KEVENT_KQWQ_PROCESS_BEGIN',3) +BSD_KEVENT_KQWQ_PROCESS_END = Constant('BSD_KEVENT_KQWQ_PROCESS_END',4) +BSD_KEVENT_KQWQ_BIND = Constant('BSD_KEVENT_KQWQ_BIND',5) +BSD_KEVENT_KQWQ_UNBIND = Constant('BSD_KEVENT_KQWQ_UNBIND',6) +BSD_KEVENT_KQWQ_THREQUEST = Constant('BSD_KEVENT_KQWQ_THREQUEST',7) +BSD_KEVENT_KQWL_PROCESS_BEGIN = Constant('BSD_KEVENT_KQWL_PROCESS_BEGIN',8) +BSD_KEVENT_KQWL_PROCESS_END = Constant('BSD_KEVENT_KQWL_PROCESS_END',9) +BSD_KEVENT_KQWL_THREQUEST = Constant('BSD_KEVENT_KQWL_THREQUEST',10) +BSD_KEVENT_KQWL_THADJUST = Constant('BSD_KEVENT_KQWL_THADJUST',11) +BSD_KEVENT_KQ_REGISTER = Constant('BSD_KEVENT_KQ_REGISTER',12) +BSD_KEVENT_KQWQ_REGISTER = Constant('BSD_KEVENT_KQWQ_REGISTER',13) +BSD_KEVENT_KQWL_REGISTER = Constant('BSD_KEVENT_KQWL_REGISTER',14) +BSD_KEVENT_KNOTE_ACTIVATE = Constant('BSD_KEVENT_KNOTE_ACTIVATE',15) +BSD_KEVENT_KQ_PROCESS = Constant('BSD_KEVENT_KQ_PROCESS',16) +BSD_KEVENT_KQWQ_PROCESS = Constant('BSD_KEVENT_KQWQ_PROCESS',17) +BSD_KEVENT_KQWL_PROCESS = Constant('BSD_KEVENT_KQWL_PROCESS',18) +BSD_KEVENT_KQWL_BIND = Constant('BSD_KEVENT_KQWL_BIND',19) +BSD_KEVENT_KQWL_UNBIND = Constant('BSD_KEVENT_KQWL_UNBIND',20) +BSD_KEVENT_KNOTE_ENABLE = Constant('BSD_KEVENT_KNOTE_ENABLE',21) +BSD_KEVENT_KNOTE_VANISHED = Constant('BSD_KEVENT_KNOTE_VANISHED',22) +DBG_TRACE_DATA = Constant('DBG_TRACE_DATA',0) +DBG_TRACE_STRING = Constant('DBG_TRACE_STRING',1) +DBG_TRACE_INFO = Constant('DBG_TRACE_INFO',2) +DBG_CS_IO = Constant('DBG_CS_IO',0) +DBG_SEC_KERNEL = Constant('DBG_SEC_KERNEL',0) +DBG_SEC_SANDBOX = Constant('DBG_SEC_SANDBOX',1) +DBG_MT_INSTRS_CYCLES = Constant('DBG_MT_INSTRS_CYCLES',1) +DBG_MT_DEBUG = Constant('DBG_MT_DEBUG',2) +DBG_MT_RESOURCES_PROC_EXIT = Constant('DBG_MT_RESOURCES_PROC_EXIT',3) +DBG_MT_RESOURCES_THR_EXIT = Constant('DBG_MT_RESOURCES_THR_EXIT',4) +DBG_MT_INSTRS_CYCLES_ON_CPU = Constant('DBG_MT_INSTRS_CYCLES_ON_CPU',5) +DBG_MT_TMPTH = Constant('DBG_MT_TMPTH',0xfe) +DBG_MT_TMPCPU = Constant('DBG_MT_TMPCPU',0xff) +DBG_MISC_COREBRIGHTNESS = Constant('DBG_MISC_COREBRIGHTNESS',0x01) +DBG_MISC_VIDEOENG = Constant('DBG_MISC_VIDEOENG',0x02) +DBG_EVENT = Constant('DBG_EVENT',0x10) +DBG_MISC_INSTRUMENTS = Constant('DBG_MISC_INSTRUMENTS',0x11) +DBG_MISC_INSTRUMENTSBT = Constant('DBG_MISC_INSTRUMENTSBT',0x12) +DBG_MISC_RUNLOOP_DETAILS = Constant('DBG_MISC_RUNLOOP_DETAILS',0x13) +DBG_MISC_RUNLOOP_BUSY = Constant('DBG_MISC_RUNLOOP_BUSY',0x14) +DBG_MISC_LAYOUT = Constant('DBG_MISC_LAYOUT',0x1a) +DBG_BUFFER = Constant('DBG_BUFFER',0x20) +DKIO_DONE = Constant('DKIO_DONE',0x01) +DKIO_READ = Constant('DKIO_READ',0x02) +DKIO_ASYNC = Constant('DKIO_ASYNC',0x04) +DKIO_META = Constant('DKIO_META',0x08) +DKIO_PAGING = Constant('DKIO_PAGING',0x10) +DKIO_THROTTLE = Constant('DKIO_THROTTLE',0x20) +DKIO_PASSIVE = Constant('DKIO_PASSIVE',0x40) +DKIO_NOCACHE = Constant('DKIO_NOCACHE',0x80) +DKIO_TIER_MASK = Constant('DKIO_TIER_MASK',0xF00) +DKIO_TIER_SHIFT = Constant('DKIO_TIER_SHIFT',8) +DKIO_TIER_UPGRADE = Constant('DKIO_TIER_UPGRADE',0x1000) +DBG_APP_LOGINWINDOW = Constant('DBG_APP_LOGINWINDOW',0x03) +DBG_APP_AUDIO = Constant('DBG_APP_AUDIO',0x04) +DBG_APP_SYSTEMUI = Constant('DBG_APP_SYSTEMUI',0x05) +DBG_APP_SIGNPOST = Constant('DBG_APP_SIGNPOST',0x0A) +DBG_APP_TAL = Constant('DBG_APP_TAL',0x0B) +DBG_APP_APPKIT = Constant('DBG_APP_APPKIT',0x0C) +DBG_APP_UIKIT = Constant('DBG_APP_UIKIT',0x0D) +DBG_APP_DFR = Constant('DBG_APP_DFR',0x0E) +DBG_APP_LAYOUT = Constant('DBG_APP_LAYOUT',0x0F) +DBG_APP_COREDATA = Constant('DBG_APP_COREDATA',0x10) +DBG_APP_RUNLOOP_BASIC = Constant('DBG_APP_RUNLOOP_BASIC',0x11) +DBG_APP_RUNLOOP_ADVANCED = Constant('DBG_APP_RUNLOOP_ADVANCED',0x12) +DBG_APP_SAMBA = Constant('DBG_APP_SAMBA',0x80) +DBG_APP_EOSSUPPORT = Constant('DBG_APP_EOSSUPPORT',0x81) +DBG_APP_MACEFIMANAGER = Constant('DBG_APP_MACEFIMANAGER',0x82) +DBG_APP_ENTERPRISE = Constant('DBG_APP_ENTERPRISE',0x83) +OPEN_THROTTLE_WINDOW = Constant('OPEN_THROTTLE_WINDOW',0x1) +PROCESS_THROTTLED = Constant('PROCESS_THROTTLED',0x2) +IO_THROTTLE_DISABLE = Constant('IO_THROTTLE_DISABLE',0x3) +IO_TIER_UPL_MISMATCH = Constant('IO_TIER_UPL_MISMATCH',0x4) +IMP_ASSERTION = Constant('IMP_ASSERTION',0x10) +IMP_BOOST = Constant('IMP_BOOST',0x11) +IMP_MSG = Constant('IMP_MSG',0x12) +IMP_WATCHPORT = Constant('IMP_WATCHPORT',0x13) +IMP_TASK_SUPPRESSION = Constant('IMP_TASK_SUPPRESSION',0x17) +IMP_TASK_APPTYPE = Constant('IMP_TASK_APPTYPE',0x18) +IMP_UPDATE = Constant('IMP_UPDATE',0x19) +IMP_USYNCH_QOS_OVERRIDE = Constant('IMP_USYNCH_QOS_OVERRIDE',0x1A) +IMP_DONOR_CHANGE = Constant('IMP_DONOR_CHANGE',0x1B) +IMP_MAIN_THREAD_QOS = Constant('IMP_MAIN_THREAD_QOS',0x1C) +IMP_SYNC_IPC_QOS = Constant('IMP_SYNC_IPC_QOS',0x1D) +IMP_TASK_POLICY_DARWIN_BG = Constant('IMP_TASK_POLICY_DARWIN_BG',0x21) +IMP_TASK_POLICY_IOPOL = Constant('IMP_TASK_POLICY_IOPOL',0x22) +IMP_TASK_POLICY_IO = Constant('IMP_TASK_POLICY_IO',0x23) +IMP_TASK_POLICY_PASSIVE_IO = Constant('IMP_TASK_POLICY_PASSIVE_IO',0x24) +IMP_TASK_POLICY_DARWIN_BG_IOPOL = Constant('IMP_TASK_POLICY_DARWIN_BG_IOPOL',0x27) +IMP_TASK_POLICY_BOOST = Constant('IMP_TASK_POLICY_BOOST',0x29) +IMP_TASK_POLICY_ROLE = Constant('IMP_TASK_POLICY_ROLE',0x2A) +IMP_TASK_POLICY_TERMINATED = Constant('IMP_TASK_POLICY_TERMINATED',0x2C) +IMP_TASK_POLICY_NEW_SOCKETS_BG = Constant('IMP_TASK_POLICY_NEW_SOCKETS_BG',0x2D) +IMP_TASK_POLICY_SUP_ACTIVE = Constant('IMP_TASK_POLICY_SUP_ACTIVE',0x2E) +IMP_TASK_POLICY_LATENCY_QOS = Constant('IMP_TASK_POLICY_LATENCY_QOS',0x2F) +IMP_TASK_POLICY_THROUGH_QOS = Constant('IMP_TASK_POLICY_THROUGH_QOS',0x30) +IMP_TASK_POLICY_WATCHERS_BG = Constant('IMP_TASK_POLICY_WATCHERS_BG',0x31) +IMP_TASK_POLICY_SFI_MANAGED = Constant('IMP_TASK_POLICY_SFI_MANAGED',0x34) +IMP_TASK_POLICY_ALL_SOCKETS_BG = Constant('IMP_TASK_POLICY_ALL_SOCKETS_BG',0x37) +IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS = Constant('IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS',0x39) +IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS = Constant('IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS',0x3A) +IMP_TASK_POLICY_PIDBIND_BG = Constant('IMP_TASK_POLICY_PIDBIND_BG',0x32) +IMP_TASK_POLICY_QOS_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_OVERRIDE',0x36) +IMP_TASK_POLICY_QOS_AND_RELPRIO = Constant('IMP_TASK_POLICY_QOS_AND_RELPRIO',0x38) +IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE',0x3B) +IMP_TASK_POLICY_QOS_PROMOTE = Constant('IMP_TASK_POLICY_QOS_PROMOTE',0x3C) +IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE',0x3D) +IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE',0x3E) +IMP_TASK_POLICY_IOTIER_KEVENT_OVERRIDE = Constant('IMP_TASK_POLICY_IOTIER_KEVENT_OVERRIDE',0x3F) +IMP_TASK_POLICY_WI_DRIVEN = Constant('IMP_TASK_POLICY_WI_DRIVEN',0x40) +IMP_HOLD = Constant('IMP_HOLD',0x2) +IMP_DROP = Constant('IMP_DROP',0x4) +IMP_EXTERN = Constant('IMP_EXTERN',0x8) +IMP_BOOSTED = Constant('IMP_BOOSTED',0x1) +IMP_UNBOOSTED = Constant('IMP_UNBOOSTED',0x2) +IMP_MSG_SEND = Constant('IMP_MSG_SEND',0x1) +IMP_MSG_DELV = Constant('IMP_MSG_DELV',0x2) +IMP_UPDATE_TASK_CREATE = Constant('IMP_UPDATE_TASK_CREATE',0x1) +IMP_USYNCH_ADD_OVERRIDE = Constant('IMP_USYNCH_ADD_OVERRIDE',0x0) +IMP_USYNCH_REMOVE_OVERRIDE = Constant('IMP_USYNCH_REMOVE_OVERRIDE',0x1) +IMP_DONOR_UPDATE_LIVE_DONOR_STATE = Constant('IMP_DONOR_UPDATE_LIVE_DONOR_STATE',0x0) +IMP_DONOR_INIT_DONOR_STATE = Constant('IMP_DONOR_INIT_DONOR_STATE',0x1) +IMP_SYNC_IPC_QOS_APPLIED = Constant('IMP_SYNC_IPC_QOS_APPLIED',0x0) +IMP_SYNC_IPC_QOS_REMOVED = Constant('IMP_SYNC_IPC_QOS_REMOVED',0x1) +IMP_SYNC_IPC_QOS_OVERFLOW = Constant('IMP_SYNC_IPC_QOS_OVERFLOW',0x2) +IMP_SYNC_IPC_QOS_UNDERFLOW = Constant('IMP_SYNC_IPC_QOS_UNDERFLOW',0x3) +TURNSTILE_HEAP_OPERATIONS = Constant('TURNSTILE_HEAP_OPERATIONS',0x10) +TURNSTILE_PRIORITY_OPERATIONS = Constant('TURNSTILE_PRIORITY_OPERATIONS',0x20) +TURNSTILE_FREELIST_OPERATIONS = Constant('TURNSTILE_FREELIST_OPERATIONS',0x30) +THREAD_ADDED_TO_TURNSTILE_WAITQ = Constant('THREAD_ADDED_TO_TURNSTILE_WAITQ',0x1) +THREAD_REMOVED_FROM_TURNSTILE_WAITQ = Constant('THREAD_REMOVED_FROM_TURNSTILE_WAITQ',0x2) +THREAD_MOVED_IN_TURNSTILE_WAITQ = Constant('THREAD_MOVED_IN_TURNSTILE_WAITQ',0x3) +TURNSTILE_ADDED_TO_TURNSTILE_HEAP = Constant('TURNSTILE_ADDED_TO_TURNSTILE_HEAP',0x4) +TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP = Constant('TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP',0x5) +TURNSTILE_MOVED_IN_TURNSTILE_HEAP = Constant('TURNSTILE_MOVED_IN_TURNSTILE_HEAP',0x6) +TURNSTILE_ADDED_TO_THREAD_HEAP = Constant('TURNSTILE_ADDED_TO_THREAD_HEAP',0x7) +TURNSTILE_REMOVED_FROM_THREAD_HEAP = Constant('TURNSTILE_REMOVED_FROM_THREAD_HEAP',0x8) +TURNSTILE_MOVED_IN_THREAD_HEAP = Constant('TURNSTILE_MOVED_IN_THREAD_HEAP',0x9) +TURNSTILE_UPDATE_STOPPED_BY_LIMIT = Constant('TURNSTILE_UPDATE_STOPPED_BY_LIMIT',0xa) +THREAD_NOT_WAITING_ON_TURNSTILE = Constant('THREAD_NOT_WAITING_ON_TURNSTILE',0xb) +TURNSTILE_PRIORITY_CHANGE = Constant('TURNSTILE_PRIORITY_CHANGE',0x1) +THREAD_USER_PROMOTION_CHANGE = Constant('THREAD_USER_PROMOTION_CHANGE',0x2) +TURNSTILE_PREPARE = Constant('TURNSTILE_PREPARE',0x1) +TURNSTILE_COMPLETE = Constant('TURNSTILE_COMPLETE',0x2) +BANK_ACCOUNT_INFO = Constant('BANK_ACCOUNT_INFO',0x10) +BANK_TASK_INFO = Constant('BANK_TASK_INFO',0x11) +ATM_SUBAID_INFO = Constant('ATM_SUBAID_INFO',0x10) +ATM_GETVALUE_INFO = Constant('ATM_GETVALUE_INFO',0x20) +ATM_UNREGISTER_INFO = Constant('ATM_UNREGISTER_INFO',0x30) +BANK_SETTLE_CPU_TIME = Constant('BANK_SETTLE_CPU_TIME',0x1) +BANK_SECURE_ORIGINATOR_CHANGED = Constant('BANK_SECURE_ORIGINATOR_CHANGED',0x2) +BANK_SETTLE_ENERGY = Constant('BANK_SETTLE_ENERGY',0x3) +ATM_MIN_CALLED = Constant('ATM_MIN_CALLED',0x1) +ATM_LINK_LIST_TRIM = Constant('ATM_LINK_LIST_TRIM',0x2) +ATM_VALUE_REPLACED = Constant('ATM_VALUE_REPLACED',0x1) +ATM_VALUE_ADDED = Constant('ATM_VALUE_ADDED',0x2) +ATM_VALUE_UNREGISTERED = Constant('ATM_VALUE_UNREGISTERED',0x1) +ATM_VALUE_DIFF_MAILBOX = Constant('ATM_VALUE_DIFF_MAILBOX',0x2) +DBG_DAEMON_COREDUET = Constant('DBG_DAEMON_COREDUET',0x1) +DBG_DAEMON_POWERD = Constant('DBG_DAEMON_POWERD',0x2) +DBG_UMALLOC_EXTERNAL = Constant('DBG_UMALLOC_EXTERNAL',0x1) +DBG_UMALLOC_INTERNAL = Constant('DBG_UMALLOC_INTERNAL',0x2) +BSD = Constant('BSD',199506) +BSD4_3 = Constant('BSD4_3',1) +BSD4_4 = Constant('BSD4_4',1) +NeXTBSD = Constant('NeXTBSD',1995064) +NeXTBSD4_0 = Constant('NeXTBSD4_0',0) +MAXCOMLEN = Constant('MAXCOMLEN',16) +MAXINTERP = Constant('MAXINTERP',64) +MAXLOGNAME = Constant('MAXLOGNAME',255) +NOFILE = Constant('NOFILE',256) +NOGROUP = Constant('NOGROUP',65535) +MAXHOSTNAMELEN = Constant('MAXHOSTNAMELEN',256) +MAXDOMNAMELEN = Constant('MAXDOMNAMELEN',256) +PSWP = Constant('PSWP',0) +PVM = Constant('PVM',4) +PINOD = Constant('PINOD',8) +PRIBIO = Constant('PRIBIO',16) +PVFS = Constant('PVFS',20) +PZERO = Constant('PZERO',22) +PSOCK = Constant('PSOCK',24) +PWAIT = Constant('PWAIT',32) +PLOCK = Constant('PLOCK',36) +PPAUSE = Constant('PPAUSE',40) +PUSER = Constant('PUSER',50) +MAXPRI = Constant('MAXPRI',127) +PRIMASK = Constant('PRIMASK',0x0ff) +PCATCH = Constant('PCATCH',0x100) +PTTYBLOCK = Constant('PTTYBLOCK',0x200) +PDROP = Constant('PDROP',0x400) +PSPIN = Constant('PSPIN',0x800) +CMASK = Constant('CMASK',0o022) +CBLOCK = Constant('CBLOCK',64) +MAXFRAG = Constant('MAXFRAG',8) +MAXSYMLINKS = Constant('MAXSYMLINKS',32) +FSHIFT = Constant('FSHIFT',11) +LF_NOT_BOOSTED = Constant('LF_NOT_BOOSTED',0) +LF_BOOSTED = Constant('LF_BOOSTED',1) +PSHMNAMLEN = Constant('PSHMNAMLEN',31) +SHM_RDONLY = Constant('SHM_RDONLY',0o010000) +SHM_RND = Constant('SHM_RND',0o020000) +SHMLBA = Constant('SHMLBA',4096) +TIOCM_LE = Constant('TIOCM_LE',0o0001) +TIOCM_DTR = Constant('TIOCM_DTR',0o0002) +TIOCM_RTS = Constant('TIOCM_RTS',0o0004) +TIOCM_ST = Constant('TIOCM_ST',0o0010) +TIOCM_SR = Constant('TIOCM_SR',0o0020) +TIOCM_CTS = Constant('TIOCM_CTS',0o0040) +TIOCM_CAR = Constant('TIOCM_CAR',0o0100) +TIOCM_RNG = Constant('TIOCM_RNG',0o0200) +TIOCM_DSR = Constant('TIOCM_DSR',0o0400) +TIOCPKT_DATA = Constant('TIOCPKT_DATA',0x00) +TIOCPKT_FLUSHREAD = Constant('TIOCPKT_FLUSHREAD',0x01) +TIOCPKT_FLUSHWRITE = Constant('TIOCPKT_FLUSHWRITE',0x02) +TIOCPKT_STOP = Constant('TIOCPKT_STOP',0x04) +TIOCPKT_START = Constant('TIOCPKT_START',0x08) +TIOCPKT_NOSTOP = Constant('TIOCPKT_NOSTOP',0x10) +TIOCPKT_DOSTOP = Constant('TIOCPKT_DOSTOP',0x20) +TIOCPKT_IOCTL = Constant('TIOCPKT_IOCTL',0x40) +TTYDISC = Constant('TTYDISC',0) +TABLDISC = Constant('TABLDISC',3) +SLIPDISC = Constant('SLIPDISC',4) +PPPDISC = Constant('PPPDISC',5) +CTL_MAXNAME = Constant('CTL_MAXNAME',12) +CTLTYPE = Constant('CTLTYPE',0xf) +CTLTYPE_NODE = Constant('CTLTYPE_NODE',1) +CTLTYPE_INT = Constant('CTLTYPE_INT',2) +CTLTYPE_STRING = Constant('CTLTYPE_STRING',3) +CTLTYPE_QUAD = Constant('CTLTYPE_QUAD',4) +CTLTYPE_OPAQUE = Constant('CTLTYPE_OPAQUE',5) +CTLFLAG_RD = Constant('CTLFLAG_RD',0x80000000) +CTLFLAG_WR = Constant('CTLFLAG_WR',0x40000000) +CTLFLAG_NOLOCK = Constant('CTLFLAG_NOLOCK',0x20000000) +CTLFLAG_ANYBODY = Constant('CTLFLAG_ANYBODY',0x10000000) +CTLFLAG_SECURE = Constant('CTLFLAG_SECURE',0x08000000) +CTLFLAG_MASKED = Constant('CTLFLAG_MASKED',0x04000000) +CTLFLAG_NOAUTO = Constant('CTLFLAG_NOAUTO',0x02000000) +CTLFLAG_KERN = Constant('CTLFLAG_KERN',0x01000000) +CTLFLAG_LOCKED = Constant('CTLFLAG_LOCKED',0x00800000) +CTLFLAG_OID2 = Constant('CTLFLAG_OID2',0x00400000) +CTLFLAG_EXPERIMENT = Constant('CTLFLAG_EXPERIMENT',0x00100000) +OID_AUTO_START = Constant('OID_AUTO_START',100) +SYSCTL_OID_VERSION = Constant('SYSCTL_OID_VERSION',1) +SYSCTL_SKMEM = Constant('SYSCTL_SKMEM',1) +CTL_UNSPEC = Constant('CTL_UNSPEC',0) +CTL_KERN = Constant('CTL_KERN',1) +CTL_VM = Constant('CTL_VM',2) +CTL_VFS = Constant('CTL_VFS',3) +CTL_NET = Constant('CTL_NET',4) +CTL_DEBUG = Constant('CTL_DEBUG',5) +CTL_HW = Constant('CTL_HW',6) +CTL_MACHDEP = Constant('CTL_MACHDEP',7) +CTL_USER = Constant('CTL_USER',8) +CTL_MAXID = Constant('CTL_MAXID',9) +KERN_OSTYPE = Constant('KERN_OSTYPE',1) +KERN_OSRELEASE = Constant('KERN_OSRELEASE',2) +KERN_OSREV = Constant('KERN_OSREV',3) +KERN_VERSION = Constant('KERN_VERSION',4) +KERN_MAXVNODES = Constant('KERN_MAXVNODES',5) +KERN_MAXPROC = Constant('KERN_MAXPROC',6) +KERN_MAXFILES = Constant('KERN_MAXFILES',7) +KERN_ARGMAX = Constant('KERN_ARGMAX',8) +KERN_SECURELVL = Constant('KERN_SECURELVL',9) +KERN_HOSTNAME = Constant('KERN_HOSTNAME',10) +KERN_HOSTID = Constant('KERN_HOSTID',11) +KERN_CLOCKRATE = Constant('KERN_CLOCKRATE',12) +KERN_VNODE = Constant('KERN_VNODE',13) +KERN_PROC = Constant('KERN_PROC',14) +KERN_FILE = Constant('KERN_FILE',15) +KERN_PROF = Constant('KERN_PROF',16) +KERN_POSIX1 = Constant('KERN_POSIX1',17) +KERN_NGROUPS = Constant('KERN_NGROUPS',18) +KERN_JOB_CONTROL = Constant('KERN_JOB_CONTROL',19) +KERN_SAVED_IDS = Constant('KERN_SAVED_IDS',20) +KERN_BOOTTIME = Constant('KERN_BOOTTIME',21) +KERN_NISDOMAINNAME = Constant('KERN_NISDOMAINNAME',22) +KERN_MAXPARTITIONS = Constant('KERN_MAXPARTITIONS',23) +KERN_KDEBUG = Constant('KERN_KDEBUG',24) +KERN_UPDATEINTERVAL = Constant('KERN_UPDATEINTERVAL',25) +KERN_OSRELDATE = Constant('KERN_OSRELDATE',26) +KERN_NTP_PLL = Constant('KERN_NTP_PLL',27) +KERN_BOOTFILE = Constant('KERN_BOOTFILE',28) +KERN_MAXFILESPERPROC = Constant('KERN_MAXFILESPERPROC',29) +KERN_MAXPROCPERUID = Constant('KERN_MAXPROCPERUID',30) +KERN_DUMPDEV = Constant('KERN_DUMPDEV',31) +KERN_IPC = Constant('KERN_IPC',32) +KERN_DUMMY = Constant('KERN_DUMMY',33) +KERN_PS_STRINGS = Constant('KERN_PS_STRINGS',34) +KERN_USRSTACK32 = Constant('KERN_USRSTACK32',35) +KERN_LOGSIGEXIT = Constant('KERN_LOGSIGEXIT',36) +KERN_SYMFILE = Constant('KERN_SYMFILE',37) +KERN_PROCARGS = Constant('KERN_PROCARGS',38) +KERN_NETBOOT = Constant('KERN_NETBOOT',40) +KERN_SYSV = Constant('KERN_SYSV',42) +KERN_AFFINITY = Constant('KERN_AFFINITY',43) +KERN_TRANSLATE = Constant('KERN_TRANSLATE',44) +KERN_EXEC = Constant('KERN_EXEC',45) +KERN_AIOMAX = Constant('KERN_AIOMAX',46) +KERN_AIOPROCMAX = Constant('KERN_AIOPROCMAX',47) +KERN_AIOTHREADS = Constant('KERN_AIOTHREADS',48) +KERN_PROCARGS2 = Constant('KERN_PROCARGS2',49) +KERN_COREFILE = Constant('KERN_COREFILE',50) +KERN_COREDUMP = Constant('KERN_COREDUMP',51) +KERN_SUGID_COREDUMP = Constant('KERN_SUGID_COREDUMP',52) +KERN_PROCDELAYTERM = Constant('KERN_PROCDELAYTERM',53) +KERN_SHREG_PRIVATIZABLE = Constant('KERN_SHREG_PRIVATIZABLE',54) +KERN_LOW_PRI_WINDOW = Constant('KERN_LOW_PRI_WINDOW',56) +KERN_LOW_PRI_DELAY = Constant('KERN_LOW_PRI_DELAY',57) +KERN_POSIX = Constant('KERN_POSIX',58) +KERN_USRSTACK64 = Constant('KERN_USRSTACK64',59) +KERN_NX_PROTECTION = Constant('KERN_NX_PROTECTION',60) +KERN_TFP = Constant('KERN_TFP',61) +KERN_PROCNAME = Constant('KERN_PROCNAME',62) +KERN_THALTSTACK = Constant('KERN_THALTSTACK',63) +KERN_SPECULATIVE_READS = Constant('KERN_SPECULATIVE_READS',64) +KERN_OSVERSION = Constant('KERN_OSVERSION',65) +KERN_SAFEBOOT = Constant('KERN_SAFEBOOT',66) +KERN_RAGEVNODE = Constant('KERN_RAGEVNODE',68) +KERN_TTY = Constant('KERN_TTY',69) +KERN_CHECKOPENEVT = Constant('KERN_CHECKOPENEVT',70) +KERN_THREADNAME = Constant('KERN_THREADNAME',71) +KERN_MAXID = Constant('KERN_MAXID',72) +KERN_RAGE_PROC = Constant('KERN_RAGE_PROC',1) +KERN_RAGE_THREAD = Constant('KERN_RAGE_THREAD',2) +KERN_UNRAGE_PROC = Constant('KERN_UNRAGE_PROC',3) +KERN_UNRAGE_THREAD = Constant('KERN_UNRAGE_THREAD',4) +KERN_OPENEVT_PROC = Constant('KERN_OPENEVT_PROC',1) +KERN_UNOPENEVT_PROC = Constant('KERN_UNOPENEVT_PROC',2) +KERN_TFP_POLICY = Constant('KERN_TFP_POLICY',1) +KERN_TFP_POLICY_DENY = Constant('KERN_TFP_POLICY_DENY',0) +KERN_TFP_POLICY_DEFAULT = Constant('KERN_TFP_POLICY_DEFAULT',2) +KERN_KDEFLAGS = Constant('KERN_KDEFLAGS',1) +KERN_KDDFLAGS = Constant('KERN_KDDFLAGS',2) +KERN_KDENABLE = Constant('KERN_KDENABLE',3) +KERN_KDSETBUF = Constant('KERN_KDSETBUF',4) +KERN_KDGETBUF = Constant('KERN_KDGETBUF',5) +KERN_KDSETUP = Constant('KERN_KDSETUP',6) +KERN_KDREMOVE = Constant('KERN_KDREMOVE',7) +KERN_KDSETREG = Constant('KERN_KDSETREG',8) +KERN_KDGETREG = Constant('KERN_KDGETREG',9) +KERN_KDREADTR = Constant('KERN_KDREADTR',10) +KERN_KDPIDTR = Constant('KERN_KDPIDTR',11) +KERN_KDTHRMAP = Constant('KERN_KDTHRMAP',12) +KERN_KDPIDEX = Constant('KERN_KDPIDEX',14) +KERN_KDSETRTCDEC = Constant('KERN_KDSETRTCDEC',15) +KERN_KDGETENTROPY = Constant('KERN_KDGETENTROPY',16) +KERN_KDWRITETR = Constant('KERN_KDWRITETR',17) +KERN_KDWRITEMAP = Constant('KERN_KDWRITEMAP',18) +KERN_KDTEST = Constant('KERN_KDTEST',19) +KERN_KDREADCURTHRMAP = Constant('KERN_KDREADCURTHRMAP',21) +KERN_KDSET_TYPEFILTER = Constant('KERN_KDSET_TYPEFILTER',22) +KERN_KDBUFWAIT = Constant('KERN_KDBUFWAIT',23) +KERN_KDCPUMAP = Constant('KERN_KDCPUMAP',24) +KERN_KDCPUMAP_EXT = Constant('KERN_KDCPUMAP_EXT',25) +KERN_KDSET_EDM = Constant('KERN_KDSET_EDM',26) +KERN_KDGET_EDM = Constant('KERN_KDGET_EDM',27) +KERN_KDWRITETR_V3 = Constant('KERN_KDWRITETR_V3',28) +KERN_PROC_ALL = Constant('KERN_PROC_ALL',0) +KERN_PROC_PID = Constant('KERN_PROC_PID',1) +KERN_PROC_PGRP = Constant('KERN_PROC_PGRP',2) +KERN_PROC_SESSION = Constant('KERN_PROC_SESSION',3) +KERN_PROC_TTY = Constant('KERN_PROC_TTY',4) +KERN_PROC_UID = Constant('KERN_PROC_UID',5) +KERN_PROC_RUID = Constant('KERN_PROC_RUID',6) +KERN_PROC_LCID = Constant('KERN_PROC_LCID',7) +KERN_VFSNSPACE_HANDLE_PROC = Constant('KERN_VFSNSPACE_HANDLE_PROC',1) +KERN_VFSNSPACE_UNHANDLE_PROC = Constant('KERN_VFSNSPACE_UNHANDLE_PROC',2) +KIPC_MAXSOCKBUF = Constant('KIPC_MAXSOCKBUF',1) +KIPC_SOCKBUF_WASTE = Constant('KIPC_SOCKBUF_WASTE',2) +KIPC_SOMAXCONN = Constant('KIPC_SOMAXCONN',3) +KIPC_MAX_LINKHDR = Constant('KIPC_MAX_LINKHDR',4) +KIPC_MAX_PROTOHDR = Constant('KIPC_MAX_PROTOHDR',5) +KIPC_MAX_HDR = Constant('KIPC_MAX_HDR',6) +KIPC_MAX_DATALEN = Constant('KIPC_MAX_DATALEN',7) +KIPC_MBSTAT = Constant('KIPC_MBSTAT',8) +KIPC_NMBCLUSTERS = Constant('KIPC_NMBCLUSTERS',9) +KIPC_SOQLIMITCOMPAT = Constant('KIPC_SOQLIMITCOMPAT',10) +VM_METER = Constant('VM_METER',1) +VM_LOADAVG = Constant('VM_LOADAVG',2) +VM_MACHFACTOR = Constant('VM_MACHFACTOR',4) +VM_SWAPUSAGE = Constant('VM_SWAPUSAGE',5) +VM_MAXID = Constant('VM_MAXID',6) +LSCALE = Constant('LSCALE',1000) +HW_MACHINE = Constant('HW_MACHINE',1) +HW_MODEL = Constant('HW_MODEL',2) +HW_NCPU = Constant('HW_NCPU',3) +HW_BYTEORDER = Constant('HW_BYTEORDER',4) +HW_PHYSMEM = Constant('HW_PHYSMEM',5) +HW_USERMEM = Constant('HW_USERMEM',6) +HW_PAGESIZE = Constant('HW_PAGESIZE',7) +HW_DISKNAMES = Constant('HW_DISKNAMES',8) +HW_DISKSTATS = Constant('HW_DISKSTATS',9) +HW_EPOCH = Constant('HW_EPOCH',10) +HW_FLOATINGPT = Constant('HW_FLOATINGPT',11) +HW_MACHINE_ARCH = Constant('HW_MACHINE_ARCH',12) +HW_VECTORUNIT = Constant('HW_VECTORUNIT',13) +HW_BUS_FREQ = Constant('HW_BUS_FREQ',14) +HW_CPU_FREQ = Constant('HW_CPU_FREQ',15) +HW_CACHELINE = Constant('HW_CACHELINE',16) +HW_L1ICACHESIZE = Constant('HW_L1ICACHESIZE',17) +HW_L1DCACHESIZE = Constant('HW_L1DCACHESIZE',18) +HW_L2SETTINGS = Constant('HW_L2SETTINGS',19) +HW_L2CACHESIZE = Constant('HW_L2CACHESIZE',20) +HW_L3SETTINGS = Constant('HW_L3SETTINGS',21) +HW_L3CACHESIZE = Constant('HW_L3CACHESIZE',22) +HW_TB_FREQ = Constant('HW_TB_FREQ',23) +HW_MEMSIZE = Constant('HW_MEMSIZE',24) +HW_AVAILCPU = Constant('HW_AVAILCPU',25) +HW_TARGET = Constant('HW_TARGET',26) +HW_PRODUCT = Constant('HW_PRODUCT',27) +HW_MAXID = Constant('HW_MAXID',28) +USER_CS_PATH = Constant('USER_CS_PATH',1) +USER_BC_BASE_MAX = Constant('USER_BC_BASE_MAX',2) +USER_BC_DIM_MAX = Constant('USER_BC_DIM_MAX',3) +USER_BC_SCALE_MAX = Constant('USER_BC_SCALE_MAX',4) +USER_BC_STRING_MAX = Constant('USER_BC_STRING_MAX',5) +USER_COLL_WEIGHTS_MAX = Constant('USER_COLL_WEIGHTS_MAX',6) +USER_EXPR_NEST_MAX = Constant('USER_EXPR_NEST_MAX',7) +USER_LINE_MAX = Constant('USER_LINE_MAX',8) +USER_RE_DUP_MAX = Constant('USER_RE_DUP_MAX',9) +USER_POSIX2_VERSION = Constant('USER_POSIX2_VERSION',10) +USER_POSIX2_C_BIND = Constant('USER_POSIX2_C_BIND',11) +USER_POSIX2_C_DEV = Constant('USER_POSIX2_C_DEV',12) +USER_POSIX2_CHAR_TERM = Constant('USER_POSIX2_CHAR_TERM',13) +USER_POSIX2_FORT_DEV = Constant('USER_POSIX2_FORT_DEV',14) +USER_POSIX2_FORT_RUN = Constant('USER_POSIX2_FORT_RUN',15) +USER_POSIX2_LOCALEDEF = Constant('USER_POSIX2_LOCALEDEF',16) +USER_POSIX2_SW_DEV = Constant('USER_POSIX2_SW_DEV',17) +USER_POSIX2_UPE = Constant('USER_POSIX2_UPE',18) +USER_STREAM_MAX = Constant('USER_STREAM_MAX',19) +USER_TZNAME_MAX = Constant('USER_TZNAME_MAX',20) +USER_MAXID = Constant('USER_MAXID',21) +CTL_DEBUG_NAME = Constant('CTL_DEBUG_NAME',0) +CTL_DEBUG_VALUE = Constant('CTL_DEBUG_VALUE',1) +CTL_DEBUG_MAXID = Constant('CTL_DEBUG_MAXID',20) +UTF_REVERSE_ENDIAN = Constant('UTF_REVERSE_ENDIAN',0x0001) +UTF_NO_NULL_TERM = Constant('UTF_NO_NULL_TERM',0x0002) +UTF_DECOMPOSED = Constant('UTF_DECOMPOSED',0x0004) +UTF_PRECOMPOSED = Constant('UTF_PRECOMPOSED',0x0008) +UTF_ESCAPE_ILLEGAL = Constant('UTF_ESCAPE_ILLEGAL',0x0010) +UTF_SFM_CONVERSIONS = Constant('UTF_SFM_CONVERSIONS',0x0020) +PRIO_PROCESS = Constant('PRIO_PROCESS',0) +PRIO_PGRP = Constant('PRIO_PGRP',1) +PRIO_USER = Constant('PRIO_USER',2) +PRIO_DARWIN_THREAD = Constant('PRIO_DARWIN_THREAD',3) +PRIO_DARWIN_PROCESS = Constant('PRIO_DARWIN_PROCESS',4) +PRIO_MAX = Constant('PRIO_MAX',20) +PRIO_DARWIN_BG = Constant('PRIO_DARWIN_BG',0x1000) +PRIO_DARWIN_NONUI = Constant('PRIO_DARWIN_NONUI',0x1001) +RUSAGE_SELF = Constant('RUSAGE_SELF',0) +RUSAGE_INFO_V0 = Constant('RUSAGE_INFO_V0',0) +RUSAGE_INFO_V1 = Constant('RUSAGE_INFO_V1',1) +RUSAGE_INFO_V2 = Constant('RUSAGE_INFO_V2',2) +RUSAGE_INFO_V3 = Constant('RUSAGE_INFO_V3',3) +RUSAGE_INFO_V4 = Constant('RUSAGE_INFO_V4',4) +RUSAGE_INFO_V5 = Constant('RUSAGE_INFO_V5',5) +RUSAGE_INFO_V6 = Constant('RUSAGE_INFO_V6',6) +RU_PROC_RUNS_RESLIDE = Constant('RU_PROC_RUNS_RESLIDE',0x00000001) +RLIMIT_CPU = Constant('RLIMIT_CPU',0) +RLIMIT_FSIZE = Constant('RLIMIT_FSIZE',1) +RLIMIT_DATA = Constant('RLIMIT_DATA',2) +RLIMIT_STACK = Constant('RLIMIT_STACK',3) +RLIMIT_CORE = Constant('RLIMIT_CORE',4) +RLIMIT_AS = Constant('RLIMIT_AS',5) +RLIMIT_MEMLOCK = Constant('RLIMIT_MEMLOCK',6) +RLIMIT_NPROC = Constant('RLIMIT_NPROC',7) +RLIMIT_NOFILE = Constant('RLIMIT_NOFILE',8) +RLIM_NLIMITS = Constant('RLIM_NLIMITS',9) +_RLIMIT_POSIX_FLAG = Constant('_RLIMIT_POSIX_FLAG',0x1000) +RLIMIT_WAKEUPS_MONITOR = Constant('RLIMIT_WAKEUPS_MONITOR',0x1) +RLIMIT_CPU_USAGE_MONITOR = Constant('RLIMIT_CPU_USAGE_MONITOR',0x2) +RLIMIT_THREAD_CPULIMITS = Constant('RLIMIT_THREAD_CPULIMITS',0x3) +RLIMIT_FOOTPRINT_INTERVAL = Constant('RLIMIT_FOOTPRINT_INTERVAL',0x4) +WAKEMON_ENABLE = Constant('WAKEMON_ENABLE',0x01) +WAKEMON_DISABLE = Constant('WAKEMON_DISABLE',0x02) +WAKEMON_GET_PARAMS = Constant('WAKEMON_GET_PARAMS',0x04) +WAKEMON_SET_DEFAULTS = Constant('WAKEMON_SET_DEFAULTS',0x08) +WAKEMON_MAKE_FATAL = Constant('WAKEMON_MAKE_FATAL',0x10) +CPUMON_MAKE_FATAL = Constant('CPUMON_MAKE_FATAL',0x1000) +FOOTPRINT_INTERVAL_RESET = Constant('FOOTPRINT_INTERVAL_RESET',0x1) +IOPOL_TYPE_DISK = Constant('IOPOL_TYPE_DISK',0) +IOPOL_TYPE_VFS_ATIME_UPDATES = Constant('IOPOL_TYPE_VFS_ATIME_UPDATES',2) +IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = Constant('IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES',3) +IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = Constant('IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME',4) +IOPOL_TYPE_VFS_TRIGGER_RESOLVE = Constant('IOPOL_TYPE_VFS_TRIGGER_RESOLVE',5) +IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = Constant('IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION',6) +IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = Constant('IOPOL_TYPE_VFS_IGNORE_PERMISSIONS',7) +IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = Constant('IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE',8) +IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = Constant('IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES',9) +IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = Constant('IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY',10) +IOPOL_SCOPE_PROCESS = Constant('IOPOL_SCOPE_PROCESS',0) +IOPOL_SCOPE_THREAD = Constant('IOPOL_SCOPE_THREAD',1) +IOPOL_SCOPE_DARWIN_BG = Constant('IOPOL_SCOPE_DARWIN_BG',2) +IOPOL_DEFAULT = Constant('IOPOL_DEFAULT',0) +IOPOL_IMPORTANT = Constant('IOPOL_IMPORTANT',1) +IOPOL_PASSIVE = Constant('IOPOL_PASSIVE',2) +IOPOL_THROTTLE = Constant('IOPOL_THROTTLE',3) +IOPOL_UTILITY = Constant('IOPOL_UTILITY',4) +IOPOL_STANDARD = Constant('IOPOL_STANDARD',5) +IOPOL_ATIME_UPDATES_DEFAULT = Constant('IOPOL_ATIME_UPDATES_DEFAULT',0) +IOPOL_ATIME_UPDATES_OFF = Constant('IOPOL_ATIME_UPDATES_OFF',1) +IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = Constant('IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT',0) +IOPOL_MATERIALIZE_DATALESS_FILES_OFF = Constant('IOPOL_MATERIALIZE_DATALESS_FILES_OFF',1) +IOPOL_MATERIALIZE_DATALESS_FILES_ON = Constant('IOPOL_MATERIALIZE_DATALESS_FILES_ON',2) +IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = Constant('IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT',0) +IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = Constant('IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME',1) +IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = Constant('IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT',0) +IOPOL_VFS_TRIGGER_RESOLVE_OFF = Constant('IOPOL_VFS_TRIGGER_RESOLVE_OFF',1) +IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = Constant('IOPOL_VFS_CONTENT_PROTECTION_DEFAULT',0) +IOPOL_VFS_CONTENT_PROTECTION_IGNORE = Constant('IOPOL_VFS_CONTENT_PROTECTION_IGNORE',1) +IOPOL_VFS_IGNORE_PERMISSIONS_OFF = Constant('IOPOL_VFS_IGNORE_PERMISSIONS_OFF',0) +IOPOL_VFS_IGNORE_PERMISSIONS_ON = Constant('IOPOL_VFS_IGNORE_PERMISSIONS_ON',1) +IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = Constant('IOPOL_VFS_SKIP_MTIME_UPDATE_OFF',0) +IOPOL_VFS_SKIP_MTIME_UPDATE_ON = Constant('IOPOL_VFS_SKIP_MTIME_UPDATE_ON',1) +IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = Constant('IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF',0) +IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = Constant('IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON',1) +IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = Constant('IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT',0) +IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = Constant('IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON',1) +IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = Constant('IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT',0) +IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = Constant('IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON',1) +IOCPARM_MASK = Constant('IOCPARM_MASK',0x1fff) +XATTR_NOFOLLOW = Constant('XATTR_NOFOLLOW',0x0001) +XATTR_CREATE = Constant('XATTR_CREATE',0x0002) +XATTR_REPLACE = Constant('XATTR_REPLACE',0x0004) +XATTR_NOSECURITY = Constant('XATTR_NOSECURITY',0x0008) +XATTR_NODEFAULT = Constant('XATTR_NODEFAULT',0x0010) +XATTR_SHOWCOMPRESSION = Constant('XATTR_SHOWCOMPRESSION',0x0020) +XATTR_MAXNAMELEN = Constant('XATTR_MAXNAMELEN',127) +PR_SLOWHZ = Constant('PR_SLOWHZ',2) +PRC_IFDOWN = Constant('PRC_IFDOWN',0) +PRC_ROUTEDEAD = Constant('PRC_ROUTEDEAD',1) +PRC_IFUP = Constant('PRC_IFUP',2) +PRC_QUENCH2 = Constant('PRC_QUENCH2',3) +PRC_QUENCH = Constant('PRC_QUENCH',4) +PRC_MSGSIZE = Constant('PRC_MSGSIZE',5) +PRC_HOSTDEAD = Constant('PRC_HOSTDEAD',6) +PRC_HOSTUNREACH = Constant('PRC_HOSTUNREACH',7) +PRC_UNREACH_NET = Constant('PRC_UNREACH_NET',8) +PRC_UNREACH_HOST = Constant('PRC_UNREACH_HOST',9) +PRC_UNREACH_PROTOCOL = Constant('PRC_UNREACH_PROTOCOL',10) +PRC_UNREACH_PORT = Constant('PRC_UNREACH_PORT',11) +PRC_UNREACH_SRCFAIL = Constant('PRC_UNREACH_SRCFAIL',13) +PRC_REDIRECT_NET = Constant('PRC_REDIRECT_NET',14) +PRC_REDIRECT_HOST = Constant('PRC_REDIRECT_HOST',15) +PRC_REDIRECT_TOSNET = Constant('PRC_REDIRECT_TOSNET',16) +PRC_REDIRECT_TOSHOST = Constant('PRC_REDIRECT_TOSHOST',17) +PRC_TIMXCEED_INTRANS = Constant('PRC_TIMXCEED_INTRANS',18) +PRC_TIMXCEED_REASS = Constant('PRC_TIMXCEED_REASS',19) +PRC_PARAMPROB = Constant('PRC_PARAMPROB',20) +PRC_UNREACH_ADMIN_PROHIB = Constant('PRC_UNREACH_ADMIN_PROHIB',21) +PRC_NCMDS = Constant('PRC_NCMDS',22) +KEV_CTL_SUBCLASS = Constant('KEV_CTL_SUBCLASS',2) +KEV_CTL_REGISTERED = Constant('KEV_CTL_REGISTERED',1) +KEV_CTL_DEREGISTERED = Constant('KEV_CTL_DEREGISTERED',2) +MAX_KCTL_NAME = Constant('MAX_KCTL_NAME',96) +CTL_FLAG_PRIVILEGED = Constant('CTL_FLAG_PRIVILEGED',0x1) +CTL_FLAG_REG_ID_UNIT = Constant('CTL_FLAG_REG_ID_UNIT',0x2) +CTL_FLAG_REG_SOCK_STREAM = Constant('CTL_FLAG_REG_SOCK_STREAM',0x4) +CTL_DATA_NOWAKEUP = Constant('CTL_DATA_NOWAKEUP',0x1) +CTL_DATA_EOR = Constant('CTL_DATA_EOR',0x2) +__DARWIN_ONLY_64_BIT_INO_T = Constant('__DARWIN_ONLY_64_BIT_INO_T',0) +__DARWIN_ONLY_UNIX_CONFORMANCE = Constant('__DARWIN_ONLY_UNIX_CONFORMANCE',0) +__DARWIN_ONLY_VERS_1050 = Constant('__DARWIN_ONLY_VERS_1050',0) +__STDC_WANT_LIB_EXT1__ = Constant('__STDC_WANT_LIB_EXT1__',1) +__DARWIN_NO_LONG_LONG = Constant('__DARWIN_NO_LONG_LONG',0) +_DARWIN_FEATURE_64_BIT_INODE = Constant('_DARWIN_FEATURE_64_BIT_INODE',1) +_DARWIN_FEATURE_ONLY_64_BIT_INODE = Constant('_DARWIN_FEATURE_ONLY_64_BIT_INODE',1) +_DARWIN_FEATURE_ONLY_VERS_1050 = Constant('_DARWIN_FEATURE_ONLY_VERS_1050',1) +_DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = Constant('_DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE',1) +_DARWIN_FEATURE_UNIX_CONFORMANCE = Constant('_DARWIN_FEATURE_UNIX_CONFORMANCE',3) +__has_ptrcheck = Constant('__has_ptrcheck',0) +MAXMAXPARTITIONS = Constant('MAXMAXPARTITIONS',22) +NDDATA = Constant('NDDATA',5) +NSPARE = Constant('NSPARE',5) +DTYPE_SMD = Constant('DTYPE_SMD',1) +DTYPE_MSCP = Constant('DTYPE_MSCP',2) +DTYPE_DEC = Constant('DTYPE_DEC',3) +DTYPE_SCSI = Constant('DTYPE_SCSI',4) +DTYPE_ESDI = Constant('DTYPE_ESDI',5) +DTYPE_ST506 = Constant('DTYPE_ST506',6) +DTYPE_HPIB = Constant('DTYPE_HPIB',7) +DTYPE_HPFL = Constant('DTYPE_HPFL',8) +DTYPE_FLOPPY = Constant('DTYPE_FLOPPY',10) +FS_UNUSED = Constant('FS_UNUSED',0) +FS_SWAP = Constant('FS_SWAP',1) +FS_V6 = Constant('FS_V6',2) +FS_V7 = Constant('FS_V7',3) +FS_SYSV = Constant('FS_SYSV',4) +FS_V71K = Constant('FS_V71K',5) +FS_V8 = Constant('FS_V8',6) +FS_BSDFFS = Constant('FS_BSDFFS',7) +FS_MSDOS = Constant('FS_MSDOS',8) +FS_BSDLFS = Constant('FS_BSDLFS',9) +FS_OTHER = Constant('FS_OTHER',10) +FS_HPFS = Constant('FS_HPFS',11) +FS_ISO9660 = Constant('FS_ISO9660',12) +FS_BOOT = Constant('FS_BOOT',13) +FS_ADOS = Constant('FS_ADOS',14) +FS_HFS = Constant('FS_HFS',15) +D_REMOVABLE = Constant('D_REMOVABLE',0x01) +D_ECC = Constant('D_ECC',0x02) +D_BADSECT = Constant('D_BADSECT',0x04) +D_RAMDISK = Constant('D_RAMDISK',0x08) +D_CHAIN = Constant('D_CHAIN',0x10) +D_SSE = Constant('D_SSE',0x1) +EPERM = Constant('EPERM',1) +ENOENT = Constant('ENOENT',2) +ESRCH = Constant('ESRCH',3) +EINTR = Constant('EINTR',4) +EIO = Constant('EIO',5) +ENXIO = Constant('ENXIO',6) +E2BIG = Constant('E2BIG',7) +ENOEXEC = Constant('ENOEXEC',8) +EBADF = Constant('EBADF',9) +ECHILD = Constant('ECHILD',10) +EDEADLK = Constant('EDEADLK',11) +ENOMEM = Constant('ENOMEM',12) +EACCES = Constant('EACCES',13) +EFAULT = Constant('EFAULT',14) +ENOTBLK = Constant('ENOTBLK',15) +EBUSY = Constant('EBUSY',16) +EEXIST = Constant('EEXIST',17) +EXDEV = Constant('EXDEV',18) +ENODEV = Constant('ENODEV',19) +ENOTDIR = Constant('ENOTDIR',20) +EISDIR = Constant('EISDIR',21) +EINVAL = Constant('EINVAL',22) +ENFILE = Constant('ENFILE',23) +EMFILE = Constant('EMFILE',24) +ENOTTY = Constant('ENOTTY',25) +ETXTBSY = Constant('ETXTBSY',26) +EFBIG = Constant('EFBIG',27) +ENOSPC = Constant('ENOSPC',28) +ESPIPE = Constant('ESPIPE',29) +EROFS = Constant('EROFS',30) +EMLINK = Constant('EMLINK',31) +EPIPE = Constant('EPIPE',32) +EDOM = Constant('EDOM',33) +ERANGE = Constant('ERANGE',34) +EAGAIN = Constant('EAGAIN',35) +EINPROGRESS = Constant('EINPROGRESS',36) +EALREADY = Constant('EALREADY',37) +ENOTSOCK = Constant('ENOTSOCK',38) +EDESTADDRREQ = Constant('EDESTADDRREQ',39) +EMSGSIZE = Constant('EMSGSIZE',40) +EPROTOTYPE = Constant('EPROTOTYPE',41) +ENOPROTOOPT = Constant('ENOPROTOOPT',42) +EPROTONOSUPPORT = Constant('EPROTONOSUPPORT',43) +ESOCKTNOSUPPORT = Constant('ESOCKTNOSUPPORT',44) +ENOTSUP = Constant('ENOTSUP',45) +EPFNOSUPPORT = Constant('EPFNOSUPPORT',46) +EAFNOSUPPORT = Constant('EAFNOSUPPORT',47) +EADDRINUSE = Constant('EADDRINUSE',48) +EADDRNOTAVAIL = Constant('EADDRNOTAVAIL',49) +ENETDOWN = Constant('ENETDOWN',50) +ENETUNREACH = Constant('ENETUNREACH',51) +ENETRESET = Constant('ENETRESET',52) +ECONNABORTED = Constant('ECONNABORTED',53) +ECONNRESET = Constant('ECONNRESET',54) +ENOBUFS = Constant('ENOBUFS',55) +EISCONN = Constant('EISCONN',56) +ENOTCONN = Constant('ENOTCONN',57) +ESHUTDOWN = Constant('ESHUTDOWN',58) +ETOOMANYREFS = Constant('ETOOMANYREFS',59) +ETIMEDOUT = Constant('ETIMEDOUT',60) +ECONNREFUSED = Constant('ECONNREFUSED',61) +ELOOP = Constant('ELOOP',62) +ENAMETOOLONG = Constant('ENAMETOOLONG',63) +EHOSTDOWN = Constant('EHOSTDOWN',64) +EHOSTUNREACH = Constant('EHOSTUNREACH',65) +ENOTEMPTY = Constant('ENOTEMPTY',66) +EPROCLIM = Constant('EPROCLIM',67) +EUSERS = Constant('EUSERS',68) +EDQUOT = Constant('EDQUOT',69) +ESTALE = Constant('ESTALE',70) +EREMOTE = Constant('EREMOTE',71) +EBADRPC = Constant('EBADRPC',72) +ERPCMISMATCH = Constant('ERPCMISMATCH',73) +EPROGUNAVAIL = Constant('EPROGUNAVAIL',74) +EPROGMISMATCH = Constant('EPROGMISMATCH',75) +EPROCUNAVAIL = Constant('EPROCUNAVAIL',76) +ENOLCK = Constant('ENOLCK',77) +ENOSYS = Constant('ENOSYS',78) +EFTYPE = Constant('EFTYPE',79) +EAUTH = Constant('EAUTH',80) +ENEEDAUTH = Constant('ENEEDAUTH',81) +EPWROFF = Constant('EPWROFF',82) +EDEVERR = Constant('EDEVERR',83) +EOVERFLOW = Constant('EOVERFLOW',84) +EBADEXEC = Constant('EBADEXEC',85) +EBADARCH = Constant('EBADARCH',86) +ESHLIBVERS = Constant('ESHLIBVERS',87) +EBADMACHO = Constant('EBADMACHO',88) +ECANCELED = Constant('ECANCELED',89) +EIDRM = Constant('EIDRM',90) +ENOMSG = Constant('ENOMSG',91) +EILSEQ = Constant('EILSEQ',92) +ENOATTR = Constant('ENOATTR',93) +EBADMSG = Constant('EBADMSG',94) +EMULTIHOP = Constant('EMULTIHOP',95) +ENODATA = Constant('ENODATA',96) +ENOLINK = Constant('ENOLINK',97) +ENOSR = Constant('ENOSR',98) +ENOSTR = Constant('ENOSTR',99) +EPROTO = Constant('EPROTO',100) +ETIME = Constant('ETIME',101) +EOPNOTSUPP = Constant('EOPNOTSUPP',102) +ENOPOLICY = Constant('ENOPOLICY',103) +ENOTRECOVERABLE = Constant('ENOTRECOVERABLE',104) +EOWNERDEAD = Constant('EOWNERDEAD',105) +EQFULL = Constant('EQFULL',106) +ELAST = Constant('ELAST',106) +VEOF = Constant('VEOF',0) +VEOL = Constant('VEOL',1) +VEOL2 = Constant('VEOL2',2) +VERASE = Constant('VERASE',3) +VWERASE = Constant('VWERASE',4) +VKILL = Constant('VKILL',5) +VREPRINT = Constant('VREPRINT',6) +VINTR = Constant('VINTR',8) +VQUIT = Constant('VQUIT',9) +VSUSP = Constant('VSUSP',10) +VDSUSP = Constant('VDSUSP',11) +VSTART = Constant('VSTART',12) +VSTOP = Constant('VSTOP',13) +VLNEXT = Constant('VLNEXT',14) +VDISCARD = Constant('VDISCARD',15) +VMIN = Constant('VMIN',16) +VTIME = Constant('VTIME',17) +VSTATUS = Constant('VSTATUS',18) +NCCS = Constant('NCCS',20) +IGNBRK = Constant('IGNBRK',0x00000001) +BRKINT = Constant('BRKINT',0x00000002) +IGNPAR = Constant('IGNPAR',0x00000004) +PARMRK = Constant('PARMRK',0x00000008) +INPCK = Constant('INPCK',0x00000010) +ISTRIP = Constant('ISTRIP',0x00000020) +INLCR = Constant('INLCR',0x00000040) +IGNCR = Constant('IGNCR',0x00000080) +ICRNL = Constant('ICRNL',0x00000100) +IXON = Constant('IXON',0x00000200) +IXOFF = Constant('IXOFF',0x00000400) +IXANY = Constant('IXANY',0x00000800) +IMAXBEL = Constant('IMAXBEL',0x00002000) +IUTF8 = Constant('IUTF8',0x00004000) +OPOST = Constant('OPOST',0x00000001) +ONLCR = Constant('ONLCR',0x00000002) +OXTABS = Constant('OXTABS',0x00000004) +ONOEOT = Constant('ONOEOT',0x00000008) +OCRNL = Constant('OCRNL',0x00000010) +ONOCR = Constant('ONOCR',0x00000020) +ONLRET = Constant('ONLRET',0x00000040) +OFILL = Constant('OFILL',0x00000080) +NLDLY = Constant('NLDLY',0x00000300) +TABDLY = Constant('TABDLY',0x00000c04) +CRDLY = Constant('CRDLY',0x00003000) +FFDLY = Constant('FFDLY',0x00004000) +BSDLY = Constant('BSDLY',0x00008000) +VTDLY = Constant('VTDLY',0x00010000) +OFDEL = Constant('OFDEL',0x00020000) +TAB3 = Constant('TAB3',0x00000004) +VT0 = Constant('VT0',0x00000000) +VT1 = Constant('VT1',0x00010000) +CIGNORE = Constant('CIGNORE',0x00000001) +CSIZE = Constant('CSIZE',0x00000300) +CS5 = Constant('CS5',0x00000000) +CS6 = Constant('CS6',0x00000100) +CS7 = Constant('CS7',0x00000200) +CS8 = Constant('CS8',0x00000300) +CSTOPB = Constant('CSTOPB',0x00000400) +CREAD = Constant('CREAD',0x00000800) +PARENB = Constant('PARENB',0x00001000) +PARODD = Constant('PARODD',0x00002000) +HUPCL = Constant('HUPCL',0x00004000) +CLOCAL = Constant('CLOCAL',0x00008000) +CCTS_OFLOW = Constant('CCTS_OFLOW',0x00010000) +CRTS_IFLOW = Constant('CRTS_IFLOW',0x00020000) +CDTR_IFLOW = Constant('CDTR_IFLOW',0x00040000) +CDSR_OFLOW = Constant('CDSR_OFLOW',0x00080000) +CCAR_OFLOW = Constant('CCAR_OFLOW',0x00100000) +ECHOKE = Constant('ECHOKE',0x00000001) +ECHOE = Constant('ECHOE',0x00000002) +ECHOK = Constant('ECHOK',0x00000004) +ECHONL = Constant('ECHONL',0x00000010) +ECHOPRT = Constant('ECHOPRT',0x00000020) +ECHOCTL = Constant('ECHOCTL',0x00000040) +ISIG = Constant('ISIG',0x00000080) +ICANON = Constant('ICANON',0x00000100) +ALTWERASE = Constant('ALTWERASE',0x00000200) +IEXTEN = Constant('IEXTEN',0x00000400) +EXTPROC = Constant('EXTPROC',0x00000800) +NOKERNINFO = Constant('NOKERNINFO',0x02000000) +TCSANOW = Constant('TCSANOW',0) +TCSADRAIN = Constant('TCSADRAIN',1) +TCSAFLUSH = Constant('TCSAFLUSH',2) +TCSASOFT = Constant('TCSASOFT',0x10) +B0 = Constant('B0',0) +B50 = Constant('B50',50) +B75 = Constant('B75',75) +B110 = Constant('B110',110) +B134 = Constant('B134',134) +B150 = Constant('B150',150) +B200 = Constant('B200',200) +B300 = Constant('B300',300) +B600 = Constant('B600',600) +B1200 = Constant('B1200',1200) +B1800 = Constant('B1800',1800) +B2400 = Constant('B2400',2400) +B4800 = Constant('B4800',4800) +B9600 = Constant('B9600',9600) +B19200 = Constant('B19200',19200) +B38400 = Constant('B38400',38400) +B7200 = Constant('B7200',7200) +B14400 = Constant('B14400',14400) +B28800 = Constant('B28800',28800) +B57600 = Constant('B57600',57600) +B76800 = Constant('B76800',76800) +B115200 = Constant('B115200',115200) +B230400 = Constant('B230400',230400) +EXTA = Constant('EXTA',19200) +EXTB = Constant('EXTB',38400) +RENAME_SECLUDE = Constant('RENAME_SECLUDE',0x00000001) +RENAME_SWAP = Constant('RENAME_SWAP',0x00000002) +RENAME_EXCL = Constant('RENAME_EXCL',0x00000004) +RENAME_RESERVED1 = Constant('RENAME_RESERVED1',0x00000008) +RENAME_NOFOLLOW_ANY = Constant('RENAME_NOFOLLOW_ANY',0x00000010) +MFSNAMELEN = Constant('MFSNAMELEN',15) +MFSTYPENAMELEN = Constant('MFSTYPENAMELEN',16) +MNAMELEN = Constant('MNAMELEN',90) +MNT_EXT_ROOT_DATA_VOL = Constant('MNT_EXT_ROOT_DATA_VOL',0x00000001) +MNT_EXT_FSKIT = Constant('MNT_EXT_FSKIT',0x00000002) +MNT_RDONLY = Constant('MNT_RDONLY',0x00000001) +MNT_SYNCHRONOUS = Constant('MNT_SYNCHRONOUS',0x00000002) +MNT_NOEXEC = Constant('MNT_NOEXEC',0x00000004) +MNT_NOSUID = Constant('MNT_NOSUID',0x00000008) +MNT_NODEV = Constant('MNT_NODEV',0x00000010) +MNT_UNION = Constant('MNT_UNION',0x00000020) +MNT_ASYNC = Constant('MNT_ASYNC',0x00000040) +MNT_CPROTECT = Constant('MNT_CPROTECT',0x00000080) +MNT_EXPORTED = Constant('MNT_EXPORTED',0x00000100) +MNT_REMOVABLE = Constant('MNT_REMOVABLE',0x00000200) +MNT_QUARANTINE = Constant('MNT_QUARANTINE',0x00000400) +MNT_LOCAL = Constant('MNT_LOCAL',0x00001000) +MNT_QUOTA = Constant('MNT_QUOTA',0x00002000) +MNT_ROOTFS = Constant('MNT_ROOTFS',0x00004000) +MNT_DOVOLFS = Constant('MNT_DOVOLFS',0x00008000) +MNT_DONTBROWSE = Constant('MNT_DONTBROWSE',0x00100000) +MNT_IGNORE_OWNERSHIP = Constant('MNT_IGNORE_OWNERSHIP',0x00200000) +MNT_AUTOMOUNTED = Constant('MNT_AUTOMOUNTED',0x00400000) +MNT_JOURNALED = Constant('MNT_JOURNALED',0x00800000) +MNT_NOUSERXATTR = Constant('MNT_NOUSERXATTR',0x01000000) +MNT_DEFWRITE = Constant('MNT_DEFWRITE',0x02000000) +MNT_MULTILABEL = Constant('MNT_MULTILABEL',0x04000000) +MNT_NOFOLLOW = Constant('MNT_NOFOLLOW',0x08000000) +MNT_NOATIME = Constant('MNT_NOATIME',0x10000000) +MNT_SNAPSHOT = Constant('MNT_SNAPSHOT',0x40000000) +MNT_STRICTATIME = Constant('MNT_STRICTATIME',0x80000000) +MNT_UPDATE = Constant('MNT_UPDATE',0x00010000) +MNT_NOBLOCK = Constant('MNT_NOBLOCK',0x00020000) +MNT_RELOAD = Constant('MNT_RELOAD',0x00040000) +MNT_FORCE = Constant('MNT_FORCE',0x00080000) +VFS_GENERIC = Constant('VFS_GENERIC',0) +VFS_NUMMNTOPS = Constant('VFS_NUMMNTOPS',1) +VFS_MAXTYPENUM = Constant('VFS_MAXTYPENUM',1) +VFS_CONF = Constant('VFS_CONF',2) +MNT_WAIT = Constant('MNT_WAIT',1) +MNT_NOWAIT = Constant('MNT_NOWAIT',2) +MNT_DWAIT = Constant('MNT_DWAIT',4) +MNT_VOLUME = Constant('MNT_VOLUME',8) +VFS_CTL_VERS1 = Constant('VFS_CTL_VERS1',0x01) +VFS_CTL_OSTATFS = Constant('VFS_CTL_OSTATFS',0x00010001) +VFS_CTL_UMOUNT = Constant('VFS_CTL_UMOUNT',0x00010002) +VFS_CTL_QUERY = Constant('VFS_CTL_QUERY',0x00010003) +VFS_CTL_NEWADDR = Constant('VFS_CTL_NEWADDR',0x00010004) +VFS_CTL_TIMEO = Constant('VFS_CTL_TIMEO',0x00010005) +VFS_CTL_NOLOCKS = Constant('VFS_CTL_NOLOCKS',0x00010006) +VFS_CTL_SADDR = Constant('VFS_CTL_SADDR',0x00010007) +VFS_CTL_DISC = Constant('VFS_CTL_DISC',0x00010008) +VFS_CTL_SERVERINFO = Constant('VFS_CTL_SERVERINFO',0x00010009) +VFS_CTL_NSTATUS = Constant('VFS_CTL_NSTATUS',0x0001000A) +VFS_CTL_STATFS64 = Constant('VFS_CTL_STATFS64',0x0001000B) +VQ_NOTRESP = Constant('VQ_NOTRESP',0x0001) +VQ_NEEDAUTH = Constant('VQ_NEEDAUTH',0x0002) +VQ_LOWDISK = Constant('VQ_LOWDISK',0x0004) +VQ_MOUNT = Constant('VQ_MOUNT',0x0008) +VQ_UNMOUNT = Constant('VQ_UNMOUNT',0x0010) +VQ_DEAD = Constant('VQ_DEAD',0x0020) +VQ_ASSIST = Constant('VQ_ASSIST',0x0040) +VQ_NOTRESPLOCK = Constant('VQ_NOTRESPLOCK',0x0080) +VQ_UPDATE = Constant('VQ_UPDATE',0x0100) +VQ_VERYLOWDISK = Constant('VQ_VERYLOWDISK',0x0200) +VQ_SYNCEVENT = Constant('VQ_SYNCEVENT',0x0400) +VQ_SERVEREVENT = Constant('VQ_SERVEREVENT',0x0800) +VQ_QUOTA = Constant('VQ_QUOTA',0x1000) +VQ_NEARLOWDISK = Constant('VQ_NEARLOWDISK',0x2000) +VQ_DESIRED_DISK = Constant('VQ_DESIRED_DISK',0x4000) +VQ_FREE_SPACE_CHANGE = Constant('VQ_FREE_SPACE_CHANGE',0x8000) +VQ_FLAG10000 = Constant('VQ_FLAG10000',0x10000) +VFS_IOATTR_FLAGS_FUA = Constant('VFS_IOATTR_FLAGS_FUA',0x00000001) +VFS_IOATTR_FLAGS_UNMAP = Constant('VFS_IOATTR_FLAGS_UNMAP',0x00000002) +VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED = Constant('VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED',0x00000010) +VFS_TBLTHREADSAFE = Constant('VFS_TBLTHREADSAFE',0x0001) +VFS_TBLFSNODELOCK = Constant('VFS_TBLFSNODELOCK',0x0002) +VFS_TBLNOTYPENUM = Constant('VFS_TBLNOTYPENUM',0x0008) +VFS_TBLLOCALVOL = Constant('VFS_TBLLOCALVOL',0x0010) +VFS_TBL64BITREADY = Constant('VFS_TBL64BITREADY',0x0020) +VFS_TBLNATIVEXATTR = Constant('VFS_TBLNATIVEXATTR',0x0040) +VFS_TBLDIRLINKS = Constant('VFS_TBLDIRLINKS',0x0080) +VFS_TBLUNMOUNT_PREFLIGHT = Constant('VFS_TBLUNMOUNT_PREFLIGHT',0x0100) +VFS_TBLGENERICMNTARGS = Constant('VFS_TBLGENERICMNTARGS',0x0200) +VFS_TBLREADDIR_EXTENDED = Constant('VFS_TBLREADDIR_EXTENDED',0x0400) +VFS_TBLNOMACLABEL = Constant('VFS_TBLNOMACLABEL',0x1000) +VFS_TBLVNOP_PAGEINV2 = Constant('VFS_TBLVNOP_PAGEINV2',0x2000) +VFS_TBLVNOP_PAGEOUTV2 = Constant('VFS_TBLVNOP_PAGEOUTV2',0x4000) +VFS_TBLVNOP_NOUPDATEID_RENAME = Constant('VFS_TBLVNOP_NOUPDATEID_RENAME',0x8000) +VFS_TBLVNOP_SECLUDE_RENAME = Constant('VFS_TBLVNOP_SECLUDE_RENAME',0x10000) +VFS_TBLCANMOUNTROOT = Constant('VFS_TBLCANMOUNTROOT',0x20000) +VFSIOC_MOUNT_BYROLE_has_recovery = Constant('VFSIOC_MOUNT_BYROLE_has_recovery',1) +VFS_RETURNED = Constant('VFS_RETURNED',0) +VFS_RETURNED_DONE = Constant('VFS_RETURNED_DONE',1) +VFS_CLAIMED = Constant('VFS_CLAIMED',2) +VFS_CLAIMED_DONE = Constant('VFS_CLAIMED_DONE',3) +VFS_USER_EVENT = Constant('VFS_USER_EVENT',0) +VFS_KERNEL_EVENT = Constant('VFS_KERNEL_EVENT',1) +LK_NOWAIT = Constant('LK_NOWAIT',1) +NFSV4_MAX_FH_SIZE = Constant('NFSV4_MAX_FH_SIZE',128) +NFSV3_MAX_FH_SIZE = Constant('NFSV3_MAX_FH_SIZE',64) +NFSV2_MAX_FH_SIZE = Constant('NFSV2_MAX_FH_SIZE',32) +CRYPTEX_AUTH_STRUCT_VERSION = Constant('CRYPTEX_AUTH_STRUCT_VERSION',1) +EV_FD = Constant('EV_FD',1) +EV_RE = Constant('EV_RE',1) +EV_WR = Constant('EV_WR',2) +EV_EX = Constant('EV_EX',4) +EV_RM = Constant('EV_RM',8) +EV_MASK = Constant('EV_MASK',0xf) +EV_RBYTES = Constant('EV_RBYTES',0x100) +EV_WBYTES = Constant('EV_WBYTES',0x200) +EV_RCLOSED = Constant('EV_RCLOSED',0x400) +EV_RCONN = Constant('EV_RCONN',0x800) +EV_WCLOSED = Constant('EV_WCLOSED',0x1000) +EV_WCONN = Constant('EV_WCONN',0x2000) +EV_OOB = Constant('EV_OOB',0x4000) +EV_FIN = Constant('EV_FIN',0x8000) +EV_RESET = Constant('EV_RESET',0x10000) +EV_TIMEOUT = Constant('EV_TIMEOUT',0x20000) +EV_DMASK = Constant('EV_DMASK',0xffffff00) +KDEBUG_LEVEL_NONE = Constant('KDEBUG_LEVEL_NONE',0) +KDEBUG_LEVEL_IST = Constant('KDEBUG_LEVEL_IST',1) +KDEBUG_LEVEL_STANDARD = Constant('KDEBUG_LEVEL_STANDARD',2) +KDEBUG_LEVEL_FULL = Constant('KDEBUG_LEVEL_FULL',3) +KDBG_FLAG_FILTERED = Constant('KDBG_FLAG_FILTERED',0x01) +KDBG_FLAG_NOPROCFILT = Constant('KDBG_FLAG_NOPROCFILT',0x02) +__DARWIN_NULL = Constant('__DARWIN_NULL',0) +UBC_PUSHDIRTY = Constant('UBC_PUSHDIRTY',0x01) +UBC_PUSHALL = Constant('UBC_PUSHALL',0x02) +UBC_INVALIDATE = Constant('UBC_INVALIDATE',0x04) +UBC_SYNC = Constant('UBC_SYNC',0x08) +KAUTH_NTSID_MAX_AUTHORITIES = Constant('KAUTH_NTSID_MAX_AUTHORITIES',16) +KAUTH_EXTLOOKUP_SUCCESS = Constant('KAUTH_EXTLOOKUP_SUCCESS',0) +KAUTH_EXTLOOKUP_BADRQ = Constant('KAUTH_EXTLOOKUP_BADRQ',1) +KAUTH_EXTLOOKUP_FAILURE = Constant('KAUTH_EXTLOOKUP_FAILURE',2) +KAUTH_EXTLOOKUP_FATAL = Constant('KAUTH_EXTLOOKUP_FATAL',3) +KAUTH_EXTLOOKUP_INPROG = Constant('KAUTH_EXTLOOKUP_INPROG',100) +KAUTH_ACE_KINDMASK = Constant('KAUTH_ACE_KINDMASK',0xf) +KAUTH_ACE_PERMIT = Constant('KAUTH_ACE_PERMIT',1) +KAUTH_ACE_DENY = Constant('KAUTH_ACE_DENY',2) +KAUTH_ACE_AUDIT = Constant('KAUTH_ACE_AUDIT',3) +KAUTH_ACE_ALARM = Constant('KAUTH_ACE_ALARM',4) +KAUTH_ACL_MAX_ENTRIES = Constant('KAUTH_ACL_MAX_ENTRIES',128) +KAUTH_FILESEC_MAGIC = Constant('KAUTH_FILESEC_MAGIC',0x012cc16d) +KAUTH_ENDIAN_HOST = Constant('KAUTH_ENDIAN_HOST',0x00000001) +KAUTH_ENDIAN_DISK = Constant('KAUTH_ENDIAN_DISK',0x00000002) +KAUTH_GENERIC_ISSUSER = Constant('KAUTH_GENERIC_ISSUSER',1) +KAUTH_PROCESS_CANSIGNAL = Constant('KAUTH_PROCESS_CANSIGNAL',1) +KAUTH_PROCESS_CANTRACE = Constant('KAUTH_PROCESS_CANTRACE',2) +KAUTH_FILEOP_OPEN = Constant('KAUTH_FILEOP_OPEN',1) +KAUTH_FILEOP_CLOSE = Constant('KAUTH_FILEOP_CLOSE',2) +KAUTH_FILEOP_RENAME = Constant('KAUTH_FILEOP_RENAME',3) +KAUTH_FILEOP_EXCHANGE = Constant('KAUTH_FILEOP_EXCHANGE',4) +KAUTH_FILEOP_LINK = Constant('KAUTH_FILEOP_LINK',5) +KAUTH_FILEOP_EXEC = Constant('KAUTH_FILEOP_EXEC',6) +KAUTH_FILEOP_DELETE = Constant('KAUTH_FILEOP_DELETE',7) +KAUTH_FILEOP_WILL_RENAME = Constant('KAUTH_FILEOP_WILL_RENAME',8) +DBG_PPT = Constant('DBG_PPT',36) +DBG_PERFCTRL = Constant('DBG_PERFCTRL',39) +DBG_CLPC = Constant('DBG_CLPC',50) +DBG_MUSE = Constant('DBG_MUSE',52) +DBG_ANS = Constant('DBG_ANS',128) +DBG_SIO = Constant('DBG_SIO',129) +DBG_SEP = Constant('DBG_SEP',130) +DBG_ISP = Constant('DBG_ISP',131) +DBG_OSCAR = Constant('DBG_OSCAR',132) +DBG_EMBEDDEDGFX = Constant('DBG_EMBEDDEDGFX',133) +DBG_PMP = Constant('DBG_PMP',134) +DBG_RTKIT = Constant('DBG_RTKIT',135) +DBG_DCP = Constant('DBG_DCP',136) +DBG_KMP = Constant('DBG_KMP',137) +DBG_SKYWALK_ALWAYSON = Constant('DBG_SKYWALK_ALWAYSON',0x10) +DBG_SKYWALK_FLOWSWITCH = Constant('DBG_SKYWALK_FLOWSWITCH',0x11) +DBG_SKYWALK_NETIF = Constant('DBG_SKYWALK_NETIF',0x12) +DBG_SKYWALK_CHANNEL = Constant('DBG_SKYWALK_CHANNEL',0x13) +DBG_SKYWALK_PACKET = Constant('DBG_SKYWALK_PACKET',0x14) +DBG_AQM_ALWAYSON = Constant('DBG_AQM_ALWAYSON',0x30) +DBG_AQM_STATS = Constant('DBG_AQM_STATS',0x31) +PPT_TEST = Constant('PPT_TEST',0x01) +PPT_JETSAM_HIWAT = Constant('PPT_JETSAM_HIWAT',0x02) +PPT_JETSAM_TOPPROC = Constant('PPT_JETSAM_TOPPROC',0x03) +DBG_SEC_SSMA = Constant('DBG_SEC_SSMA',0x02) +KDBG_CPU_SHIFT = Constant('KDBG_CPU_SHIFT',56) +KDBG_INIT = Constant('KDBG_INIT',0x01) +KDBG_FREERUN = Constant('KDBG_FREERUN',0x04) +KDBG_CPUMAP_IS_IOP = Constant('KDBG_CPUMAP_IS_IOP',0x1) +KDEBUG_COMMPAGE_ENABLE_TRACE = Constant('KDEBUG_COMMPAGE_ENABLE_TRACE',0x1) +KDEBUG_COMMPAGE_ENABLE_TYPEFILTER = Constant('KDEBUG_COMMPAGE_ENABLE_TYPEFILTER',0x2) +KDEBUG_COMMPAGE_CONTINUOUS = Constant('KDEBUG_COMMPAGE_CONTINUOUS',0x4) +KDBG_LOCKINIT = Constant('KDBG_LOCKINIT',0x0080) +KDBG_CLASSTYPE = Constant('KDBG_CLASSTYPE',0x10000) +KDBG_SUBCLSTYPE = Constant('KDBG_SUBCLSTYPE',0x20000) +KDBG_RANGETYPE = Constant('KDBG_RANGETYPE',0x40000) +KDBG_TYPENONE = Constant('KDBG_TYPENONE',0x80000) +KDBG_CKTYPES = Constant('KDBG_CKTYPES',0xF0000) +RAW_VERSION0 = Constant('RAW_VERSION0',0x55aa0000) +RAW_VERSION1 = Constant('RAW_VERSION1',0x55aa0101) +RAW_VERSION2 = Constant('RAW_VERSION2',0x55aa0200) +kEnTrCompKernel = Constant('kEnTrCompKernel',2) +kEnTrActKernSocket = Constant('kEnTrActKernSocket',1) +kEnTrActKernSockRead = Constant('kEnTrActKernSockRead',2) +kEnTrActKernSockWrite = Constant('kEnTrActKernSockWrite',3) +kEnTrActKernPoll = Constant('kEnTrActKernPoll',10) +kEnTrActKernSelect = Constant('kEnTrActKernSelect',11) +kEnTrActKernKQWait = Constant('kEnTrActKernKQWait',12) +kEnTrEvUnblocked = Constant('kEnTrEvUnblocked',256) +kEnTrFlagNonBlocking = Constant('kEnTrFlagNonBlocking',0x1) +kEnTrFlagNoWork = Constant('kEnTrFlagNoWork',0x2) +ENTR_SHOULDTRACE = Constant('ENTR_SHOULDTRACE',0) +SYS_syscall = Constant('SYS_syscall',0) +SYS_exit = Constant('SYS_exit',1) +SYS_fork = Constant('SYS_fork',2) +SYS_read = Constant('SYS_read',3) +SYS_write = Constant('SYS_write',4) +SYS_open = Constant('SYS_open',5) +SYS_close = Constant('SYS_close',6) +SYS_wait4 = Constant('SYS_wait4',7) +SYS_link = Constant('SYS_link',9) +SYS_unlink = Constant('SYS_unlink',10) +SYS_chdir = Constant('SYS_chdir',12) +SYS_fchdir = Constant('SYS_fchdir',13) +SYS_mknod = Constant('SYS_mknod',14) +SYS_chmod = Constant('SYS_chmod',15) +SYS_chown = Constant('SYS_chown',16) +SYS_getfsstat = Constant('SYS_getfsstat',18) +SYS_getpid = Constant('SYS_getpid',20) +SYS_setuid = Constant('SYS_setuid',23) +SYS_getuid = Constant('SYS_getuid',24) +SYS_geteuid = Constant('SYS_geteuid',25) +SYS_ptrace = Constant('SYS_ptrace',26) +SYS_recvmsg = Constant('SYS_recvmsg',27) +SYS_sendmsg = Constant('SYS_sendmsg',28) +SYS_recvfrom = Constant('SYS_recvfrom',29) +SYS_accept = Constant('SYS_accept',30) +SYS_getpeername = Constant('SYS_getpeername',31) +SYS_getsockname = Constant('SYS_getsockname',32) +SYS_access = Constant('SYS_access',33) +SYS_chflags = Constant('SYS_chflags',34) +SYS_fchflags = Constant('SYS_fchflags',35) +SYS_sync = Constant('SYS_sync',36) +SYS_kill = Constant('SYS_kill',37) +SYS_crossarch_trap = Constant('SYS_crossarch_trap',38) +SYS_getppid = Constant('SYS_getppid',39) +SYS_dup = Constant('SYS_dup',41) +SYS_pipe = Constant('SYS_pipe',42) +SYS_getegid = Constant('SYS_getegid',43) +SYS_sigaction = Constant('SYS_sigaction',46) +SYS_getgid = Constant('SYS_getgid',47) +SYS_sigprocmask = Constant('SYS_sigprocmask',48) +SYS_getlogin = Constant('SYS_getlogin',49) +SYS_setlogin = Constant('SYS_setlogin',50) +SYS_acct = Constant('SYS_acct',51) +SYS_sigpending = Constant('SYS_sigpending',52) +SYS_sigaltstack = Constant('SYS_sigaltstack',53) +SYS_ioctl = Constant('SYS_ioctl',54) +SYS_reboot = Constant('SYS_reboot',55) +SYS_revoke = Constant('SYS_revoke',56) +SYS_symlink = Constant('SYS_symlink',57) +SYS_readlink = Constant('SYS_readlink',58) +SYS_execve = Constant('SYS_execve',59) +SYS_umask = Constant('SYS_umask',60) +SYS_chroot = Constant('SYS_chroot',61) +SYS_msync = Constant('SYS_msync',65) +SYS_vfork = Constant('SYS_vfork',66) +SYS_munmap = Constant('SYS_munmap',73) +SYS_mprotect = Constant('SYS_mprotect',74) +SYS_madvise = Constant('SYS_madvise',75) +SYS_mincore = Constant('SYS_mincore',78) +SYS_getgroups = Constant('SYS_getgroups',79) +SYS_setgroups = Constant('SYS_setgroups',80) +SYS_getpgrp = Constant('SYS_getpgrp',81) +SYS_setpgid = Constant('SYS_setpgid',82) +SYS_setitimer = Constant('SYS_setitimer',83) +SYS_swapon = Constant('SYS_swapon',85) +SYS_getitimer = Constant('SYS_getitimer',86) +SYS_getdtablesize = Constant('SYS_getdtablesize',89) +SYS_dup2 = Constant('SYS_dup2',90) +SYS_fcntl = Constant('SYS_fcntl',92) +SYS_select = Constant('SYS_select',93) +SYS_fsync = Constant('SYS_fsync',95) +SYS_setpriority = Constant('SYS_setpriority',96) +SYS_socket = Constant('SYS_socket',97) +SYS_connect = Constant('SYS_connect',98) +SYS_getpriority = Constant('SYS_getpriority',100) +SYS_bind = Constant('SYS_bind',104) +SYS_setsockopt = Constant('SYS_setsockopt',105) +SYS_listen = Constant('SYS_listen',106) +SYS_sigsuspend = Constant('SYS_sigsuspend',111) +SYS_gettimeofday = Constant('SYS_gettimeofday',116) +SYS_getrusage = Constant('SYS_getrusage',117) +SYS_getsockopt = Constant('SYS_getsockopt',118) +SYS_readv = Constant('SYS_readv',120) +SYS_writev = Constant('SYS_writev',121) +SYS_settimeofday = Constant('SYS_settimeofday',122) +SYS_fchown = Constant('SYS_fchown',123) +SYS_fchmod = Constant('SYS_fchmod',124) +SYS_setreuid = Constant('SYS_setreuid',126) +SYS_setregid = Constant('SYS_setregid',127) +SYS_rename = Constant('SYS_rename',128) +SYS_flock = Constant('SYS_flock',131) +SYS_mkfifo = Constant('SYS_mkfifo',132) +SYS_sendto = Constant('SYS_sendto',133) +SYS_shutdown = Constant('SYS_shutdown',134) +SYS_socketpair = Constant('SYS_socketpair',135) +SYS_mkdir = Constant('SYS_mkdir',136) +SYS_rmdir = Constant('SYS_rmdir',137) +SYS_utimes = Constant('SYS_utimes',138) +SYS_futimes = Constant('SYS_futimes',139) +SYS_adjtime = Constant('SYS_adjtime',140) +SYS_gethostuuid = Constant('SYS_gethostuuid',142) +SYS_setsid = Constant('SYS_setsid',147) +SYS_getpgid = Constant('SYS_getpgid',151) +SYS_setprivexec = Constant('SYS_setprivexec',152) +SYS_pread = Constant('SYS_pread',153) +SYS_pwrite = Constant('SYS_pwrite',154) +SYS_nfssvc = Constant('SYS_nfssvc',155) +SYS_statfs = Constant('SYS_statfs',157) +SYS_fstatfs = Constant('SYS_fstatfs',158) +SYS_unmount = Constant('SYS_unmount',159) +SYS_getfh = Constant('SYS_getfh',161) +SYS_quotactl = Constant('SYS_quotactl',165) +SYS_mount = Constant('SYS_mount',167) +SYS_csops = Constant('SYS_csops',169) +SYS_csops_audittoken = Constant('SYS_csops_audittoken',170) +SYS_waitid = Constant('SYS_waitid',173) +SYS_kdebug_typefilter = Constant('SYS_kdebug_typefilter',177) +SYS_kdebug_trace_string = Constant('SYS_kdebug_trace_string',178) +SYS_kdebug_trace64 = Constant('SYS_kdebug_trace64',179) +SYS_kdebug_trace = Constant('SYS_kdebug_trace',180) +SYS_setgid = Constant('SYS_setgid',181) +SYS_setegid = Constant('SYS_setegid',182) +SYS_seteuid = Constant('SYS_seteuid',183) +SYS_sigreturn = Constant('SYS_sigreturn',184) +SYS_panic_with_data = Constant('SYS_panic_with_data',185) +SYS_thread_selfcounts = Constant('SYS_thread_selfcounts',186) +SYS_fdatasync = Constant('SYS_fdatasync',187) +SYS_stat = Constant('SYS_stat',188) +SYS_fstat = Constant('SYS_fstat',189) +SYS_lstat = Constant('SYS_lstat',190) +SYS_pathconf = Constant('SYS_pathconf',191) +SYS_fpathconf = Constant('SYS_fpathconf',192) +SYS_getrlimit = Constant('SYS_getrlimit',194) +SYS_setrlimit = Constant('SYS_setrlimit',195) +SYS_getdirentries = Constant('SYS_getdirentries',196) +SYS_mmap = Constant('SYS_mmap',197) +SYS_lseek = Constant('SYS_lseek',199) +SYS_truncate = Constant('SYS_truncate',200) +SYS_ftruncate = Constant('SYS_ftruncate',201) +SYS_sysctl = Constant('SYS_sysctl',202) +SYS_mlock = Constant('SYS_mlock',203) +SYS_munlock = Constant('SYS_munlock',204) +SYS_undelete = Constant('SYS_undelete',205) +SYS_open_dprotected_np = Constant('SYS_open_dprotected_np',216) +SYS_fsgetpath_ext = Constant('SYS_fsgetpath_ext',217) +SYS_openat_dprotected_np = Constant('SYS_openat_dprotected_np',218) +SYS_getattrlist = Constant('SYS_getattrlist',220) +SYS_setattrlist = Constant('SYS_setattrlist',221) +SYS_getdirentriesattr = Constant('SYS_getdirentriesattr',222) +SYS_exchangedata = Constant('SYS_exchangedata',223) +SYS_searchfs = Constant('SYS_searchfs',225) +SYS_delete = Constant('SYS_delete',226) +SYS_copyfile = Constant('SYS_copyfile',227) +SYS_fgetattrlist = Constant('SYS_fgetattrlist',228) +SYS_fsetattrlist = Constant('SYS_fsetattrlist',229) +SYS_poll = Constant('SYS_poll',230) +SYS_getxattr = Constant('SYS_getxattr',234) +SYS_fgetxattr = Constant('SYS_fgetxattr',235) +SYS_setxattr = Constant('SYS_setxattr',236) +SYS_fsetxattr = Constant('SYS_fsetxattr',237) +SYS_removexattr = Constant('SYS_removexattr',238) +SYS_fremovexattr = Constant('SYS_fremovexattr',239) +SYS_listxattr = Constant('SYS_listxattr',240) +SYS_flistxattr = Constant('SYS_flistxattr',241) +SYS_fsctl = Constant('SYS_fsctl',242) +SYS_initgroups = Constant('SYS_initgroups',243) +SYS_posix_spawn = Constant('SYS_posix_spawn',244) +SYS_ffsctl = Constant('SYS_ffsctl',245) +SYS_fhopen = Constant('SYS_fhopen',248) +SYS_minherit = Constant('SYS_minherit',250) +SYS_semsys = Constant('SYS_semsys',251) +SYS_msgsys = Constant('SYS_msgsys',252) +SYS_shmsys = Constant('SYS_shmsys',253) +SYS_semctl = Constant('SYS_semctl',254) +SYS_semget = Constant('SYS_semget',255) +SYS_semop = Constant('SYS_semop',256) +SYS_msgctl = Constant('SYS_msgctl',258) +SYS_msgget = Constant('SYS_msgget',259) +SYS_msgsnd = Constant('SYS_msgsnd',260) +SYS_msgrcv = Constant('SYS_msgrcv',261) +SYS_shmat = Constant('SYS_shmat',262) +SYS_shmctl = Constant('SYS_shmctl',263) +SYS_shmdt = Constant('SYS_shmdt',264) +SYS_shmget = Constant('SYS_shmget',265) +SYS_shm_open = Constant('SYS_shm_open',266) +SYS_shm_unlink = Constant('SYS_shm_unlink',267) +SYS_sem_open = Constant('SYS_sem_open',268) +SYS_sem_close = Constant('SYS_sem_close',269) +SYS_sem_unlink = Constant('SYS_sem_unlink',270) +SYS_sem_wait = Constant('SYS_sem_wait',271) +SYS_sem_trywait = Constant('SYS_sem_trywait',272) +SYS_sem_post = Constant('SYS_sem_post',273) +SYS_sysctlbyname = Constant('SYS_sysctlbyname',274) +SYS_open_extended = Constant('SYS_open_extended',277) +SYS_umask_extended = Constant('SYS_umask_extended',278) +SYS_stat_extended = Constant('SYS_stat_extended',279) +SYS_lstat_extended = Constant('SYS_lstat_extended',280) +SYS_fstat_extended = Constant('SYS_fstat_extended',281) +SYS_chmod_extended = Constant('SYS_chmod_extended',282) +SYS_fchmod_extended = Constant('SYS_fchmod_extended',283) +SYS_access_extended = Constant('SYS_access_extended',284) +SYS_settid = Constant('SYS_settid',285) +SYS_gettid = Constant('SYS_gettid',286) +SYS_setsgroups = Constant('SYS_setsgroups',287) +SYS_getsgroups = Constant('SYS_getsgroups',288) +SYS_setwgroups = Constant('SYS_setwgroups',289) +SYS_getwgroups = Constant('SYS_getwgroups',290) +SYS_mkfifo_extended = Constant('SYS_mkfifo_extended',291) +SYS_mkdir_extended = Constant('SYS_mkdir_extended',292) +SYS_identitysvc = Constant('SYS_identitysvc',293) +SYS_shared_region_check_np = Constant('SYS_shared_region_check_np',294) +SYS_vm_pressure_monitor = Constant('SYS_vm_pressure_monitor',296) +SYS_psynch_rw_longrdlock = Constant('SYS_psynch_rw_longrdlock',297) +SYS_psynch_rw_yieldwrlock = Constant('SYS_psynch_rw_yieldwrlock',298) +SYS_psynch_rw_downgrade = Constant('SYS_psynch_rw_downgrade',299) +SYS_psynch_rw_upgrade = Constant('SYS_psynch_rw_upgrade',300) +SYS_psynch_mutexwait = Constant('SYS_psynch_mutexwait',301) +SYS_psynch_mutexdrop = Constant('SYS_psynch_mutexdrop',302) +SYS_psynch_cvbroad = Constant('SYS_psynch_cvbroad',303) +SYS_psynch_cvsignal = Constant('SYS_psynch_cvsignal',304) +SYS_psynch_cvwait = Constant('SYS_psynch_cvwait',305) +SYS_psynch_rw_rdlock = Constant('SYS_psynch_rw_rdlock',306) +SYS_psynch_rw_wrlock = Constant('SYS_psynch_rw_wrlock',307) +SYS_psynch_rw_unlock = Constant('SYS_psynch_rw_unlock',308) +SYS_psynch_rw_unlock2 = Constant('SYS_psynch_rw_unlock2',309) +SYS_getsid = Constant('SYS_getsid',310) +SYS_settid_with_pid = Constant('SYS_settid_with_pid',311) +SYS_psynch_cvclrprepost = Constant('SYS_psynch_cvclrprepost',312) +SYS_aio_fsync = Constant('SYS_aio_fsync',313) +SYS_aio_return = Constant('SYS_aio_return',314) +SYS_aio_suspend = Constant('SYS_aio_suspend',315) +SYS_aio_cancel = Constant('SYS_aio_cancel',316) +SYS_aio_error = Constant('SYS_aio_error',317) +SYS_aio_read = Constant('SYS_aio_read',318) +SYS_aio_write = Constant('SYS_aio_write',319) +SYS_lio_listio = Constant('SYS_lio_listio',320) +SYS_iopolicysys = Constant('SYS_iopolicysys',322) +SYS_process_policy = Constant('SYS_process_policy',323) +SYS_mlockall = Constant('SYS_mlockall',324) +SYS_munlockall = Constant('SYS_munlockall',325) +SYS_issetugid = Constant('SYS_issetugid',327) +SYS___pthread_kill = Constant('SYS___pthread_kill',328) +SYS___pthread_sigmask = Constant('SYS___pthread_sigmask',329) +SYS___sigwait = Constant('SYS___sigwait',330) +SYS___disable_threadsignal = Constant('SYS___disable_threadsignal',331) +SYS___pthread_markcancel = Constant('SYS___pthread_markcancel',332) +SYS___pthread_canceled = Constant('SYS___pthread_canceled',333) +SYS___semwait_signal = Constant('SYS___semwait_signal',334) +SYS_proc_info = Constant('SYS_proc_info',336) +SYS_sendfile = Constant('SYS_sendfile',337) +SYS_stat64 = Constant('SYS_stat64',338) +SYS_fstat64 = Constant('SYS_fstat64',339) +SYS_lstat64 = Constant('SYS_lstat64',340) +SYS_stat64_extended = Constant('SYS_stat64_extended',341) +SYS_lstat64_extended = Constant('SYS_lstat64_extended',342) +SYS_fstat64_extended = Constant('SYS_fstat64_extended',343) +SYS_getdirentries64 = Constant('SYS_getdirentries64',344) +SYS_statfs64 = Constant('SYS_statfs64',345) +SYS_fstatfs64 = Constant('SYS_fstatfs64',346) +SYS_getfsstat64 = Constant('SYS_getfsstat64',347) +SYS___pthread_chdir = Constant('SYS___pthread_chdir',348) +SYS___pthread_fchdir = Constant('SYS___pthread_fchdir',349) +SYS_audit = Constant('SYS_audit',350) +SYS_auditon = Constant('SYS_auditon',351) +SYS_getauid = Constant('SYS_getauid',353) +SYS_setauid = Constant('SYS_setauid',354) +SYS_getaudit_addr = Constant('SYS_getaudit_addr',357) +SYS_setaudit_addr = Constant('SYS_setaudit_addr',358) +SYS_auditctl = Constant('SYS_auditctl',359) +SYS_bsdthread_create = Constant('SYS_bsdthread_create',360) +SYS_bsdthread_terminate = Constant('SYS_bsdthread_terminate',361) +SYS_kqueue = Constant('SYS_kqueue',362) +SYS_kevent = Constant('SYS_kevent',363) +SYS_lchown = Constant('SYS_lchown',364) +SYS_bsdthread_register = Constant('SYS_bsdthread_register',366) +SYS_workq_open = Constant('SYS_workq_open',367) +SYS_workq_kernreturn = Constant('SYS_workq_kernreturn',368) +SYS_kevent64 = Constant('SYS_kevent64',369) +SYS_thread_selfid = Constant('SYS_thread_selfid',372) +SYS_ledger = Constant('SYS_ledger',373) +SYS_kevent_qos = Constant('SYS_kevent_qos',374) +SYS_kevent_id = Constant('SYS_kevent_id',375) +SYS___mac_execve = Constant('SYS___mac_execve',380) +SYS___mac_syscall = Constant('SYS___mac_syscall',381) +SYS___mac_get_file = Constant('SYS___mac_get_file',382) +SYS___mac_set_file = Constant('SYS___mac_set_file',383) +SYS___mac_get_link = Constant('SYS___mac_get_link',384) +SYS___mac_set_link = Constant('SYS___mac_set_link',385) +SYS___mac_get_proc = Constant('SYS___mac_get_proc',386) +SYS___mac_set_proc = Constant('SYS___mac_set_proc',387) +SYS___mac_get_fd = Constant('SYS___mac_get_fd',388) +SYS___mac_set_fd = Constant('SYS___mac_set_fd',389) +SYS___mac_get_pid = Constant('SYS___mac_get_pid',390) +SYS_pselect = Constant('SYS_pselect',394) +SYS_pselect_nocancel = Constant('SYS_pselect_nocancel',395) +SYS_read_nocancel = Constant('SYS_read_nocancel',396) +SYS_write_nocancel = Constant('SYS_write_nocancel',397) +SYS_open_nocancel = Constant('SYS_open_nocancel',398) +SYS_close_nocancel = Constant('SYS_close_nocancel',399) +SYS_wait4_nocancel = Constant('SYS_wait4_nocancel',400) +SYS_recvmsg_nocancel = Constant('SYS_recvmsg_nocancel',401) +SYS_sendmsg_nocancel = Constant('SYS_sendmsg_nocancel',402) +SYS_recvfrom_nocancel = Constant('SYS_recvfrom_nocancel',403) +SYS_accept_nocancel = Constant('SYS_accept_nocancel',404) +SYS_msync_nocancel = Constant('SYS_msync_nocancel',405) +SYS_fcntl_nocancel = Constant('SYS_fcntl_nocancel',406) +SYS_select_nocancel = Constant('SYS_select_nocancel',407) +SYS_fsync_nocancel = Constant('SYS_fsync_nocancel',408) +SYS_connect_nocancel = Constant('SYS_connect_nocancel',409) +SYS_sigsuspend_nocancel = Constant('SYS_sigsuspend_nocancel',410) +SYS_readv_nocancel = Constant('SYS_readv_nocancel',411) +SYS_writev_nocancel = Constant('SYS_writev_nocancel',412) +SYS_sendto_nocancel = Constant('SYS_sendto_nocancel',413) +SYS_pread_nocancel = Constant('SYS_pread_nocancel',414) +SYS_pwrite_nocancel = Constant('SYS_pwrite_nocancel',415) +SYS_waitid_nocancel = Constant('SYS_waitid_nocancel',416) +SYS_poll_nocancel = Constant('SYS_poll_nocancel',417) +SYS_msgsnd_nocancel = Constant('SYS_msgsnd_nocancel',418) +SYS_msgrcv_nocancel = Constant('SYS_msgrcv_nocancel',419) +SYS_sem_wait_nocancel = Constant('SYS_sem_wait_nocancel',420) +SYS_aio_suspend_nocancel = Constant('SYS_aio_suspend_nocancel',421) +SYS___sigwait_nocancel = Constant('SYS___sigwait_nocancel',422) +SYS___semwait_signal_nocancel = Constant('SYS___semwait_signal_nocancel',423) +SYS___mac_mount = Constant('SYS___mac_mount',424) +SYS___mac_get_mount = Constant('SYS___mac_get_mount',425) +SYS___mac_getfsstat = Constant('SYS___mac_getfsstat',426) +SYS_fsgetpath = Constant('SYS_fsgetpath',427) +SYS_audit_session_self = Constant('SYS_audit_session_self',428) +SYS_audit_session_join = Constant('SYS_audit_session_join',429) +SYS_fileport_makeport = Constant('SYS_fileport_makeport',430) +SYS_fileport_makefd = Constant('SYS_fileport_makefd',431) +SYS_audit_session_port = Constant('SYS_audit_session_port',432) +SYS_pid_suspend = Constant('SYS_pid_suspend',433) +SYS_pid_resume = Constant('SYS_pid_resume',434) +SYS_pid_hibernate = Constant('SYS_pid_hibernate',435) +SYS_pid_shutdown_sockets = Constant('SYS_pid_shutdown_sockets',436) +SYS_kas_info = Constant('SYS_kas_info',439) +SYS_memorystatus_control = Constant('SYS_memorystatus_control',440) +SYS_guarded_open_np = Constant('SYS_guarded_open_np',441) +SYS_guarded_close_np = Constant('SYS_guarded_close_np',442) +SYS_guarded_kqueue_np = Constant('SYS_guarded_kqueue_np',443) +SYS_change_fdguard_np = Constant('SYS_change_fdguard_np',444) +SYS_usrctl = Constant('SYS_usrctl',445) +SYS_proc_rlimit_control = Constant('SYS_proc_rlimit_control',446) +SYS_connectx = Constant('SYS_connectx',447) +SYS_disconnectx = Constant('SYS_disconnectx',448) +SYS_peeloff = Constant('SYS_peeloff',449) +SYS_socket_delegate = Constant('SYS_socket_delegate',450) +SYS_telemetry = Constant('SYS_telemetry',451) +SYS_proc_uuid_policy = Constant('SYS_proc_uuid_policy',452) +SYS_memorystatus_get_level = Constant('SYS_memorystatus_get_level',453) +SYS_system_override = Constant('SYS_system_override',454) +SYS_vfs_purge = Constant('SYS_vfs_purge',455) +SYS_sfi_ctl = Constant('SYS_sfi_ctl',456) +SYS_sfi_pidctl = Constant('SYS_sfi_pidctl',457) +SYS_coalition = Constant('SYS_coalition',458) +SYS_coalition_info = Constant('SYS_coalition_info',459) +SYS_necp_match_policy = Constant('SYS_necp_match_policy',460) +SYS_getattrlistbulk = Constant('SYS_getattrlistbulk',461) +SYS_clonefileat = Constant('SYS_clonefileat',462) +SYS_openat = Constant('SYS_openat',463) +SYS_openat_nocancel = Constant('SYS_openat_nocancel',464) +SYS_renameat = Constant('SYS_renameat',465) +SYS_faccessat = Constant('SYS_faccessat',466) +SYS_fchmodat = Constant('SYS_fchmodat',467) +SYS_fchownat = Constant('SYS_fchownat',468) +SYS_fstatat = Constant('SYS_fstatat',469) +SYS_fstatat64 = Constant('SYS_fstatat64',470) +SYS_linkat = Constant('SYS_linkat',471) +SYS_unlinkat = Constant('SYS_unlinkat',472) +SYS_readlinkat = Constant('SYS_readlinkat',473) +SYS_symlinkat = Constant('SYS_symlinkat',474) +SYS_mkdirat = Constant('SYS_mkdirat',475) +SYS_getattrlistat = Constant('SYS_getattrlistat',476) +SYS_proc_trace_log = Constant('SYS_proc_trace_log',477) +SYS_bsdthread_ctl = Constant('SYS_bsdthread_ctl',478) +SYS_openbyid_np = Constant('SYS_openbyid_np',479) +SYS_recvmsg_x = Constant('SYS_recvmsg_x',480) +SYS_sendmsg_x = Constant('SYS_sendmsg_x',481) +SYS_thread_selfusage = Constant('SYS_thread_selfusage',482) +SYS_csrctl = Constant('SYS_csrctl',483) +SYS_guarded_open_dprotected_np = Constant('SYS_guarded_open_dprotected_np',484) +SYS_guarded_write_np = Constant('SYS_guarded_write_np',485) +SYS_guarded_pwrite_np = Constant('SYS_guarded_pwrite_np',486) +SYS_guarded_writev_np = Constant('SYS_guarded_writev_np',487) +SYS_renameatx_np = Constant('SYS_renameatx_np',488) +SYS_mremap_encrypted = Constant('SYS_mremap_encrypted',489) +SYS_netagent_trigger = Constant('SYS_netagent_trigger',490) +SYS_stack_snapshot_with_config = Constant('SYS_stack_snapshot_with_config',491) +SYS_microstackshot = Constant('SYS_microstackshot',492) +SYS_grab_pgo_data = Constant('SYS_grab_pgo_data',493) +SYS_persona = Constant('SYS_persona',494) +SYS_mach_eventlink_signal = Constant('SYS_mach_eventlink_signal',496) +SYS_mach_eventlink_wait_until = Constant('SYS_mach_eventlink_wait_until',497) +SYS_mach_eventlink_signal_wait_until = Constant('SYS_mach_eventlink_signal_wait_until',498) +SYS_work_interval_ctl = Constant('SYS_work_interval_ctl',499) +SYS_getentropy = Constant('SYS_getentropy',500) +SYS_necp_open = Constant('SYS_necp_open',501) +SYS_necp_client_action = Constant('SYS_necp_client_action',502) +SYS___nexus_open = Constant('SYS___nexus_open',503) +SYS___nexus_register = Constant('SYS___nexus_register',504) +SYS___nexus_deregister = Constant('SYS___nexus_deregister',505) +SYS___nexus_create = Constant('SYS___nexus_create',506) +SYS___nexus_destroy = Constant('SYS___nexus_destroy',507) +SYS___nexus_get_opt = Constant('SYS___nexus_get_opt',508) +SYS___nexus_set_opt = Constant('SYS___nexus_set_opt',509) +SYS___channel_open = Constant('SYS___channel_open',510) +SYS___channel_get_info = Constant('SYS___channel_get_info',511) +SYS___channel_sync = Constant('SYS___channel_sync',512) +SYS___channel_get_opt = Constant('SYS___channel_get_opt',513) +SYS___channel_set_opt = Constant('SYS___channel_set_opt',514) +SYS_ulock_wait = Constant('SYS_ulock_wait',515) +SYS_ulock_wake = Constant('SYS_ulock_wake',516) +SYS_fclonefileat = Constant('SYS_fclonefileat',517) +SYS_fs_snapshot = Constant('SYS_fs_snapshot',518) +SYS_register_uexc_handler = Constant('SYS_register_uexc_handler',519) +SYS_terminate_with_payload = Constant('SYS_terminate_with_payload',520) +SYS_abort_with_payload = Constant('SYS_abort_with_payload',521) +SYS_necp_session_open = Constant('SYS_necp_session_open',522) +SYS_necp_session_action = Constant('SYS_necp_session_action',523) +SYS_setattrlistat = Constant('SYS_setattrlistat',524) +SYS_net_qos_guideline = Constant('SYS_net_qos_guideline',525) +SYS_fmount = Constant('SYS_fmount',526) +SYS_ntp_adjtime = Constant('SYS_ntp_adjtime',527) +SYS_ntp_gettime = Constant('SYS_ntp_gettime',528) +SYS_os_fault_with_payload = Constant('SYS_os_fault_with_payload',529) +SYS_kqueue_workloop_ctl = Constant('SYS_kqueue_workloop_ctl',530) +SYS___mach_bridge_remote_time = Constant('SYS___mach_bridge_remote_time',531) +SYS_coalition_ledger = Constant('SYS_coalition_ledger',532) +SYS_log_data = Constant('SYS_log_data',533) +SYS_memorystatus_available_memory = Constant('SYS_memorystatus_available_memory',534) +SYS_objc_bp_assist_cfg_np = Constant('SYS_objc_bp_assist_cfg_np',535) +SYS_shared_region_map_and_slide_2_np = Constant('SYS_shared_region_map_and_slide_2_np',536) +SYS_pivot_root = Constant('SYS_pivot_root',537) +SYS_task_inspect_for_pid = Constant('SYS_task_inspect_for_pid',538) +SYS_task_read_for_pid = Constant('SYS_task_read_for_pid',539) +SYS_preadv = Constant('SYS_preadv',540) +SYS_pwritev = Constant('SYS_pwritev',541) +SYS_preadv_nocancel = Constant('SYS_preadv_nocancel',542) +SYS_pwritev_nocancel = Constant('SYS_pwritev_nocancel',543) +SYS_ulock_wait2 = Constant('SYS_ulock_wait2',544) +SYS_proc_info_extended_id = Constant('SYS_proc_info_extended_id',545) +SYS_tracker_action = Constant('SYS_tracker_action',546) +SYS_debug_syscall_reject = Constant('SYS_debug_syscall_reject',547) +SYS_debug_syscall_reject_config = Constant('SYS_debug_syscall_reject_config',548) +SYS_graftdmg = Constant('SYS_graftdmg',549) +SYS_map_with_linking_np = Constant('SYS_map_with_linking_np',550) +SYS_freadlink = Constant('SYS_freadlink',551) +SYS_record_system_event = Constant('SYS_record_system_event',552) +SYS_mkfifoat = Constant('SYS_mkfifoat',553) +SYS_mknodat = Constant('SYS_mknodat',554) +SYS_ungraftdmg = Constant('SYS_ungraftdmg',555) +SYS_MAXSYSCALL = Constant('SYS_MAXSYSCALL',556) +SYS_invalid = Constant('SYS_invalid',63) +SOCK_STREAM = Constant('SOCK_STREAM',1) +SOCK_DGRAM = Constant('SOCK_DGRAM',2) +SOCK_RAW = Constant('SOCK_RAW',3) +SOCK_RDM = Constant('SOCK_RDM',4) +SOCK_SEQPACKET = Constant('SOCK_SEQPACKET',5) +SO_DEBUG = Constant('SO_DEBUG',0x0001) +SO_ACCEPTCONN = Constant('SO_ACCEPTCONN',0x0002) +SO_REUSEADDR = Constant('SO_REUSEADDR',0x0004) +SO_KEEPALIVE = Constant('SO_KEEPALIVE',0x0008) +SO_DONTROUTE = Constant('SO_DONTROUTE',0x0010) +SO_BROADCAST = Constant('SO_BROADCAST',0x0020) +SO_USELOOPBACK = Constant('SO_USELOOPBACK',0x0040) +SO_LINGER = Constant('SO_LINGER',0x1080) +SO_LINGER_SEC = Constant('SO_LINGER_SEC',0x1080) +SO_OOBINLINE = Constant('SO_OOBINLINE',0x0100) +SO_REUSEPORT = Constant('SO_REUSEPORT',0x0200) +SO_TIMESTAMP = Constant('SO_TIMESTAMP',0x0400) +SO_TIMESTAMP_MONOTONIC = Constant('SO_TIMESTAMP_MONOTONIC',0x0800) +SO_ACCEPTFILTER = Constant('SO_ACCEPTFILTER',0x1000) +SO_DONTTRUNC = Constant('SO_DONTTRUNC',0x2000) +SO_WANTMORE = Constant('SO_WANTMORE',0x4000) +SO_WANTOOBFLAG = Constant('SO_WANTOOBFLAG',0x8000) +SO_SNDBUF = Constant('SO_SNDBUF',0x1001) +SO_RCVBUF = Constant('SO_RCVBUF',0x1002) +SO_SNDLOWAT = Constant('SO_SNDLOWAT',0x1003) +SO_RCVLOWAT = Constant('SO_RCVLOWAT',0x1004) +SO_SNDTIMEO = Constant('SO_SNDTIMEO',0x1005) +SO_RCVTIMEO = Constant('SO_RCVTIMEO',0x1006) +SO_ERROR = Constant('SO_ERROR',0x1007) +SO_TYPE = Constant('SO_TYPE',0x1008) +SO_LABEL = Constant('SO_LABEL',0x1010) +SO_PEERLABEL = Constant('SO_PEERLABEL',0x1011) +SO_NREAD = Constant('SO_NREAD',0x1020) +SO_NKE = Constant('SO_NKE',0x1021) +SO_NOSIGPIPE = Constant('SO_NOSIGPIPE',0x1022) +SO_NOADDRERR = Constant('SO_NOADDRERR',0x1023) +SO_NWRITE = Constant('SO_NWRITE',0x1024) +SO_REUSESHAREUID = Constant('SO_REUSESHAREUID',0x1025) +SO_NOTIFYCONFLICT = Constant('SO_NOTIFYCONFLICT',0x1026) +SO_UPCALLCLOSEWAIT = Constant('SO_UPCALLCLOSEWAIT',0x1027) +SO_RANDOMPORT = Constant('SO_RANDOMPORT',0x1082) +SO_NP_EXTENSIONS = Constant('SO_NP_EXTENSIONS',0x1083) +SO_NUMRCVPKT = Constant('SO_NUMRCVPKT',0x1112) +SO_NET_SERVICE_TYPE = Constant('SO_NET_SERVICE_TYPE',0x1116) +SO_NETSVC_MARKING_LEVEL = Constant('SO_NETSVC_MARKING_LEVEL',0x1119) +SO_RESOLVER_SIGNATURE = Constant('SO_RESOLVER_SIGNATURE',0x1131) +NET_SERVICE_TYPE_BE = Constant('NET_SERVICE_TYPE_BE',0) +NET_SERVICE_TYPE_BK = Constant('NET_SERVICE_TYPE_BK',1) +NET_SERVICE_TYPE_SIG = Constant('NET_SERVICE_TYPE_SIG',2) +NET_SERVICE_TYPE_VI = Constant('NET_SERVICE_TYPE_VI',3) +NET_SERVICE_TYPE_VO = Constant('NET_SERVICE_TYPE_VO',4) +NET_SERVICE_TYPE_RV = Constant('NET_SERVICE_TYPE_RV',5) +NET_SERVICE_TYPE_AV = Constant('NET_SERVICE_TYPE_AV',6) +NET_SERVICE_TYPE_OAM = Constant('NET_SERVICE_TYPE_OAM',7) +NET_SERVICE_TYPE_RD = Constant('NET_SERVICE_TYPE_RD',8) +NETSVC_MRKNG_UNKNOWN = Constant('NETSVC_MRKNG_UNKNOWN',0) +NETSVC_MRKNG_LVL_L2 = Constant('NETSVC_MRKNG_LVL_L2',1) +NETSVC_MRKNG_LVL_L3L2_ALL = Constant('NETSVC_MRKNG_LVL_L3L2_ALL',2) +NETSVC_MRKNG_LVL_L3L2_BK = Constant('NETSVC_MRKNG_LVL_L3L2_BK',3) +SAE_ASSOCID_ANY = Constant('SAE_ASSOCID_ANY',0) +SAE_CONNID_ANY = Constant('SAE_CONNID_ANY',0) +CONNECT_RESUME_ON_READ_WRITE = Constant('CONNECT_RESUME_ON_READ_WRITE',0x1) +CONNECT_DATA_IDEMPOTENT = Constant('CONNECT_DATA_IDEMPOTENT',0x2) +CONNECT_DATA_AUTHENTICATED = Constant('CONNECT_DATA_AUTHENTICATED',0x4) +SONPX_SETOPTSHUT = Constant('SONPX_SETOPTSHUT',0x000000001) +SOL_SOCKET = Constant('SOL_SOCKET',0xffff) +AF_UNSPEC = Constant('AF_UNSPEC',0) +AF_UNIX = Constant('AF_UNIX',1) +AF_INET = Constant('AF_INET',2) +AF_IMPLINK = Constant('AF_IMPLINK',3) +AF_PUP = Constant('AF_PUP',4) +AF_CHAOS = Constant('AF_CHAOS',5) +AF_NS = Constant('AF_NS',6) +AF_ISO = Constant('AF_ISO',7) +AF_ECMA = Constant('AF_ECMA',8) +AF_DATAKIT = Constant('AF_DATAKIT',9) +AF_CCITT = Constant('AF_CCITT',10) +AF_SNA = Constant('AF_SNA',11) +AF_DECnet = Constant('AF_DECnet',12) +AF_DLI = Constant('AF_DLI',13) +AF_LAT = Constant('AF_LAT',14) +AF_HYLINK = Constant('AF_HYLINK',15) +AF_APPLETALK = Constant('AF_APPLETALK',16) +AF_ROUTE = Constant('AF_ROUTE',17) +AF_LINK = Constant('AF_LINK',18) +pseudo_AF_XTP = Constant('pseudo_AF_XTP',19) +AF_COIP = Constant('AF_COIP',20) +AF_CNT = Constant('AF_CNT',21) +pseudo_AF_RTIP = Constant('pseudo_AF_RTIP',22) +AF_IPX = Constant('AF_IPX',23) +AF_SIP = Constant('AF_SIP',24) +pseudo_AF_PIP = Constant('pseudo_AF_PIP',25) +AF_NDRV = Constant('AF_NDRV',27) +AF_ISDN = Constant('AF_ISDN',28) +pseudo_AF_KEY = Constant('pseudo_AF_KEY',29) +AF_INET6 = Constant('AF_INET6',30) +AF_NATM = Constant('AF_NATM',31) +AF_SYSTEM = Constant('AF_SYSTEM',32) +AF_NETBIOS = Constant('AF_NETBIOS',33) +AF_PPP = Constant('AF_PPP',34) +pseudo_AF_HDRCMPLT = Constant('pseudo_AF_HDRCMPLT',35) +AF_RESERVED_36 = Constant('AF_RESERVED_36',36) +AF_IEEE80211 = Constant('AF_IEEE80211',37) +AF_UTUN = Constant('AF_UTUN',38) +AF_VSOCK = Constant('AF_VSOCK',40) +AF_MAX = Constant('AF_MAX',41) +SOCK_MAXADDRLEN = Constant('SOCK_MAXADDRLEN',255) +_SS_MAXSIZE = Constant('_SS_MAXSIZE',128) +NET_RT_DUMP = Constant('NET_RT_DUMP',1) +NET_RT_FLAGS = Constant('NET_RT_FLAGS',2) +NET_RT_IFLIST = Constant('NET_RT_IFLIST',3) +NET_RT_STAT = Constant('NET_RT_STAT',4) +NET_RT_TRASH = Constant('NET_RT_TRASH',5) +NET_RT_IFLIST2 = Constant('NET_RT_IFLIST2',6) +NET_RT_DUMP2 = Constant('NET_RT_DUMP2',7) +NET_RT_FLAGS_PRIV = Constant('NET_RT_FLAGS_PRIV',10) +NET_RT_MAXID = Constant('NET_RT_MAXID',11) +SOMAXCONN = Constant('SOMAXCONN',128) +MSG_OOB = Constant('MSG_OOB',0x1) +MSG_PEEK = Constant('MSG_PEEK',0x2) +MSG_DONTROUTE = Constant('MSG_DONTROUTE',0x4) +MSG_EOR = Constant('MSG_EOR',0x8) +MSG_TRUNC = Constant('MSG_TRUNC',0x10) +MSG_CTRUNC = Constant('MSG_CTRUNC',0x20) +MSG_WAITALL = Constant('MSG_WAITALL',0x40) +MSG_DONTWAIT = Constant('MSG_DONTWAIT',0x80) +MSG_EOF = Constant('MSG_EOF',0x100) +MSG_WAITSTREAM = Constant('MSG_WAITSTREAM',0x200) +MSG_FLUSH = Constant('MSG_FLUSH',0x400) +MSG_HOLD = Constant('MSG_HOLD',0x800) +MSG_SEND = Constant('MSG_SEND',0x1000) +MSG_HAVEMORE = Constant('MSG_HAVEMORE',0x2000) +MSG_RCVMORE = Constant('MSG_RCVMORE',0x4000) +MSG_NEEDSA = Constant('MSG_NEEDSA',0x10000) +MSG_NOSIGNAL = Constant('MSG_NOSIGNAL',0x80000) +MSG_USEUPCALL = Constant('MSG_USEUPCALL',0x80000000) +CMGROUP_MAX = Constant('CMGROUP_MAX',16) +SCM_RIGHTS = Constant('SCM_RIGHTS',0x01) +SCM_TIMESTAMP = Constant('SCM_TIMESTAMP',0x02) +SCM_CREDS = Constant('SCM_CREDS',0x03) +SCM_TIMESTAMP_MONOTONIC = Constant('SCM_TIMESTAMP_MONOTONIC',0x04) +SHUT_RD = Constant('SHUT_RD',0) +SHUT_WR = Constant('SHUT_WR',1) +SHUT_RDWR = Constant('SHUT_RDWR',2) +SBUF_FIXEDLEN = Constant('SBUF_FIXEDLEN',0x00000000) +SBUF_AUTOEXTEND = Constant('SBUF_AUTOEXTEND',0x00000001) +SBUF_USRFLAGMSK = Constant('SBUF_USRFLAGMSK',0x0000ffff) +SBUF_DYNAMIC = Constant('SBUF_DYNAMIC',0x00010000) +SBUF_FINISHED = Constant('SBUF_FINISHED',0x00020000) +SBUF_OVERFLOWED = Constant('SBUF_OVERFLOWED',0x00040000) +SBUF_DYNSTRUCT = Constant('SBUF_DYNSTRUCT',0x00080000) +SYSPROTO_EVENT = Constant('SYSPROTO_EVENT',1) +SYSPROTO_CONTROL = Constant('SYSPROTO_CONTROL',2) +AF_SYS_CONTROL = Constant('AF_SYS_CONTROL',2) +SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = Constant('SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED',0x00000001) +SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = Constant('SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER',0x00000002) +SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = Constant('SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT',0x00000004) +NS_GETRAWENCRYPTED = Constant('NS_GETRAWENCRYPTED',0x00000001) diff --git a/pwnlib/constants/darwin/amd64.py b/pwnlib/constants/darwin/amd64.py new file mode 100644 index 000000000..9c7f28401 --- /dev/null +++ b/pwnlib/constants/darwin/amd64.py @@ -0,0 +1,3231 @@ +from pwnlib.constants.constant import Constant +ITIMER_REAL = Constant('ITIMER_REAL',0) +ITIMER_VIRTUAL = Constant('ITIMER_VIRTUAL',1) +ITIMER_PROF = Constant('ITIMER_PROF',2) +DST_NONE = Constant('DST_NONE',0) +DST_USA = Constant('DST_USA',1) +DST_AUST = Constant('DST_AUST',2) +DST_WET = Constant('DST_WET',3) +DST_MET = Constant('DST_MET',4) +DST_EET = Constant('DST_EET',5) +DST_CAN = Constant('DST_CAN',6) +CHILD_MAX = Constant('CHILD_MAX',266) +LINK_MAX = Constant('LINK_MAX',32767) +MAX_CANON = Constant('MAX_CANON',1024) +MAX_INPUT = Constant('MAX_INPUT',1024) +NAME_MAX = Constant('NAME_MAX',255) +NGROUPS_MAX = Constant('NGROUPS_MAX',16) +OPEN_MAX = Constant('OPEN_MAX',10240) +PATH_MAX = Constant('PATH_MAX',1024) +PIPE_BUF = Constant('PIPE_BUF',512) +BC_BASE_MAX = Constant('BC_BASE_MAX',99) +BC_DIM_MAX = Constant('BC_DIM_MAX',2048) +BC_SCALE_MAX = Constant('BC_SCALE_MAX',99) +BC_STRING_MAX = Constant('BC_STRING_MAX',1000) +CHARCLASS_NAME_MAX = Constant('CHARCLASS_NAME_MAX',14) +COLL_WEIGHTS_MAX = Constant('COLL_WEIGHTS_MAX',2) +EQUIV_CLASS_MAX = Constant('EQUIV_CLASS_MAX',2) +EXPR_NEST_MAX = Constant('EXPR_NEST_MAX',32) +LINE_MAX = Constant('LINE_MAX',2048) +RE_DUP_MAX = Constant('RE_DUP_MAX',255) +NZERO = Constant('NZERO',0) +GETNCNT = Constant('GETNCNT',3) +GETPID = Constant('GETPID',4) +GETVAL = Constant('GETVAL',5) +GETALL = Constant('GETALL',6) +GETZCNT = Constant('GETZCNT',7) +SETVAL = Constant('SETVAL',8) +SETALL = Constant('SETALL',9) +SEM_UNDO = Constant('SEM_UNDO',0o010000) +SEM_A = Constant('SEM_A',0o0200) +SEM_R = Constant('SEM_R',0o0400) +PSEMNAMLEN = Constant('PSEMNAMLEN',31) +PSEM_NONE = Constant('PSEM_NONE',1) +PSEM_DEFINED = Constant('PSEM_DEFINED',2) +PSEM_ALLOCATED = Constant('PSEM_ALLOCATED',4) +PSEM_MAPPED = Constant('PSEM_MAPPED',8) +PSEM_INUSE = Constant('PSEM_INUSE',0x10) +PSEM_REMOVED = Constant('PSEM_REMOVED',0x20) +PSEM_INCREATE = Constant('PSEM_INCREATE',0x40) +PSEM_INDELETE = Constant('PSEM_INDELETE',0x80) +FSOPT_NOFOLLOW = Constant('FSOPT_NOFOLLOW',0x00000001) +FSOPT_NOINMEMUPDATE = Constant('FSOPT_NOINMEMUPDATE',0x00000002) +FSOPT_REPORT_FULLSIZE = Constant('FSOPT_REPORT_FULLSIZE',0x00000004) +FSOPT_PACK_INVAL_ATTRS = Constant('FSOPT_PACK_INVAL_ATTRS',0x00000008) +FSOPT_ATTR_CMN_EXTENDED = Constant('FSOPT_ATTR_CMN_EXTENDED',0x00000020) +FSOPT_RETURN_REALDEV = Constant('FSOPT_RETURN_REALDEV',0x00000200) +FSOPT_NOFOLLOW_ANY = Constant('FSOPT_NOFOLLOW_ANY',0x00000800) +SEARCHFS_MAX_SEARCHPARMS = Constant('SEARCHFS_MAX_SEARCHPARMS',4096) +ATTR_BIT_MAP_COUNT = Constant('ATTR_BIT_MAP_COUNT',5) +VOL_CAPABILITIES_FORMAT = Constant('VOL_CAPABILITIES_FORMAT',0) +VOL_CAPABILITIES_INTERFACES = Constant('VOL_CAPABILITIES_INTERFACES',1) +VOL_CAPABILITIES_RESERVED1 = Constant('VOL_CAPABILITIES_RESERVED1',2) +VOL_CAPABILITIES_RESERVED2 = Constant('VOL_CAPABILITIES_RESERVED2',3) +ATTR_MAX_BUFFER = Constant('ATTR_MAX_BUFFER',8192) +VOL_CAP_FMT_PERSISTENTOBJECTIDS = Constant('VOL_CAP_FMT_PERSISTENTOBJECTIDS',0x00000001) +VOL_CAP_FMT_SYMBOLICLINKS = Constant('VOL_CAP_FMT_SYMBOLICLINKS',0x00000002) +VOL_CAP_FMT_HARDLINKS = Constant('VOL_CAP_FMT_HARDLINKS',0x00000004) +VOL_CAP_FMT_JOURNAL = Constant('VOL_CAP_FMT_JOURNAL',0x00000008) +VOL_CAP_FMT_JOURNAL_ACTIVE = Constant('VOL_CAP_FMT_JOURNAL_ACTIVE',0x00000010) +VOL_CAP_FMT_NO_ROOT_TIMES = Constant('VOL_CAP_FMT_NO_ROOT_TIMES',0x00000020) +VOL_CAP_FMT_SPARSE_FILES = Constant('VOL_CAP_FMT_SPARSE_FILES',0x00000040) +VOL_CAP_FMT_ZERO_RUNS = Constant('VOL_CAP_FMT_ZERO_RUNS',0x00000080) +VOL_CAP_FMT_CASE_SENSITIVE = Constant('VOL_CAP_FMT_CASE_SENSITIVE',0x00000100) +VOL_CAP_FMT_CASE_PRESERVING = Constant('VOL_CAP_FMT_CASE_PRESERVING',0x00000200) +VOL_CAP_FMT_FAST_STATFS = Constant('VOL_CAP_FMT_FAST_STATFS',0x00000400) +VOL_CAP_FMT_2TB_FILESIZE = Constant('VOL_CAP_FMT_2TB_FILESIZE',0x00000800) +VOL_CAP_FMT_OPENDENYMODES = Constant('VOL_CAP_FMT_OPENDENYMODES',0x00001000) +VOL_CAP_FMT_HIDDEN_FILES = Constant('VOL_CAP_FMT_HIDDEN_FILES',0x00002000) +VOL_CAP_FMT_PATH_FROM_ID = Constant('VOL_CAP_FMT_PATH_FROM_ID',0x00004000) +VOL_CAP_FMT_NO_VOLUME_SIZES = Constant('VOL_CAP_FMT_NO_VOLUME_SIZES',0x00008000) +VOL_CAP_FMT_DECMPFS_COMPRESSION = Constant('VOL_CAP_FMT_DECMPFS_COMPRESSION',0x00010000) +VOL_CAP_FMT_64BIT_OBJECT_IDS = Constant('VOL_CAP_FMT_64BIT_OBJECT_IDS',0x00020000) +VOL_CAP_FMT_DIR_HARDLINKS = Constant('VOL_CAP_FMT_DIR_HARDLINKS',0x00040000) +VOL_CAP_FMT_DOCUMENT_ID = Constant('VOL_CAP_FMT_DOCUMENT_ID',0x00080000) +VOL_CAP_FMT_WRITE_GENERATION_COUNT = Constant('VOL_CAP_FMT_WRITE_GENERATION_COUNT',0x00100000) +VOL_CAP_FMT_NO_IMMUTABLE_FILES = Constant('VOL_CAP_FMT_NO_IMMUTABLE_FILES',0x00200000) +VOL_CAP_FMT_NO_PERMISSIONS = Constant('VOL_CAP_FMT_NO_PERMISSIONS',0x00400000) +VOL_CAP_FMT_SHARED_SPACE = Constant('VOL_CAP_FMT_SHARED_SPACE',0x00800000) +VOL_CAP_FMT_VOL_GROUPS = Constant('VOL_CAP_FMT_VOL_GROUPS',0x01000000) +VOL_CAP_FMT_SEALED = Constant('VOL_CAP_FMT_SEALED',0x02000000) +VOL_CAP_INT_SEARCHFS = Constant('VOL_CAP_INT_SEARCHFS',0x00000001) +VOL_CAP_INT_ATTRLIST = Constant('VOL_CAP_INT_ATTRLIST',0x00000002) +VOL_CAP_INT_NFSEXPORT = Constant('VOL_CAP_INT_NFSEXPORT',0x00000004) +VOL_CAP_INT_READDIRATTR = Constant('VOL_CAP_INT_READDIRATTR',0x00000008) +VOL_CAP_INT_EXCHANGEDATA = Constant('VOL_CAP_INT_EXCHANGEDATA',0x00000010) +VOL_CAP_INT_COPYFILE = Constant('VOL_CAP_INT_COPYFILE',0x00000020) +VOL_CAP_INT_ALLOCATE = Constant('VOL_CAP_INT_ALLOCATE',0x00000040) +VOL_CAP_INT_VOL_RENAME = Constant('VOL_CAP_INT_VOL_RENAME',0x00000080) +VOL_CAP_INT_ADVLOCK = Constant('VOL_CAP_INT_ADVLOCK',0x00000100) +VOL_CAP_INT_FLOCK = Constant('VOL_CAP_INT_FLOCK',0x00000200) +VOL_CAP_INT_EXTENDED_SECURITY = Constant('VOL_CAP_INT_EXTENDED_SECURITY',0x00000400) +VOL_CAP_INT_USERACCESS = Constant('VOL_CAP_INT_USERACCESS',0x00000800) +VOL_CAP_INT_MANLOCK = Constant('VOL_CAP_INT_MANLOCK',0x00001000) +VOL_CAP_INT_NAMEDSTREAMS = Constant('VOL_CAP_INT_NAMEDSTREAMS',0x00002000) +VOL_CAP_INT_EXTENDED_ATTR = Constant('VOL_CAP_INT_EXTENDED_ATTR',0x00004000) +VOL_CAP_INT_CLONE = Constant('VOL_CAP_INT_CLONE',0x00010000) +VOL_CAP_INT_SNAPSHOT = Constant('VOL_CAP_INT_SNAPSHOT',0x00020000) +VOL_CAP_INT_RENAME_SWAP = Constant('VOL_CAP_INT_RENAME_SWAP',0x00040000) +VOL_CAP_INT_RENAME_EXCL = Constant('VOL_CAP_INT_RENAME_EXCL',0x00080000) +VOL_CAP_INT_RENAME_OPENFAIL = Constant('VOL_CAP_INT_RENAME_OPENFAIL',0x00100000) +VOL_CAP_INT_RENAME_SECLUDE = Constant('VOL_CAP_INT_RENAME_SECLUDE',0x00200000) +ATTR_CMN_NAME = Constant('ATTR_CMN_NAME',0x00000001) +ATTR_CMN_DEVID = Constant('ATTR_CMN_DEVID',0x00000002) +ATTR_CMN_FSID = Constant('ATTR_CMN_FSID',0x00000004) +ATTR_CMN_OBJTYPE = Constant('ATTR_CMN_OBJTYPE',0x00000008) +ATTR_CMN_OBJTAG = Constant('ATTR_CMN_OBJTAG',0x00000010) +ATTR_CMN_OBJID = Constant('ATTR_CMN_OBJID',0x00000020) +ATTR_CMN_OBJPERMANENTID = Constant('ATTR_CMN_OBJPERMANENTID',0x00000040) +ATTR_CMN_PAROBJID = Constant('ATTR_CMN_PAROBJID',0x00000080) +ATTR_CMN_SCRIPT = Constant('ATTR_CMN_SCRIPT',0x00000100) +ATTR_CMN_CRTIME = Constant('ATTR_CMN_CRTIME',0x00000200) +ATTR_CMN_MODTIME = Constant('ATTR_CMN_MODTIME',0x00000400) +ATTR_CMN_CHGTIME = Constant('ATTR_CMN_CHGTIME',0x00000800) +ATTR_CMN_ACCTIME = Constant('ATTR_CMN_ACCTIME',0x00001000) +ATTR_CMN_BKUPTIME = Constant('ATTR_CMN_BKUPTIME',0x00002000) +ATTR_CMN_FNDRINFO = Constant('ATTR_CMN_FNDRINFO',0x00004000) +ATTR_CMN_OWNERID = Constant('ATTR_CMN_OWNERID',0x00008000) +ATTR_CMN_GRPID = Constant('ATTR_CMN_GRPID',0x00010000) +ATTR_CMN_ACCESSMASK = Constant('ATTR_CMN_ACCESSMASK',0x00020000) +ATTR_CMN_FLAGS = Constant('ATTR_CMN_FLAGS',0x00040000) +ATTR_CMN_GEN_COUNT = Constant('ATTR_CMN_GEN_COUNT',0x00080000) +ATTR_CMN_DOCUMENT_ID = Constant('ATTR_CMN_DOCUMENT_ID',0x00100000) +ATTR_CMN_USERACCESS = Constant('ATTR_CMN_USERACCESS',0x00200000) +ATTR_CMN_EXTENDED_SECURITY = Constant('ATTR_CMN_EXTENDED_SECURITY',0x00400000) +ATTR_CMN_UUID = Constant('ATTR_CMN_UUID',0x00800000) +ATTR_CMN_GRPUUID = Constant('ATTR_CMN_GRPUUID',0x01000000) +ATTR_CMN_FILEID = Constant('ATTR_CMN_FILEID',0x02000000) +ATTR_CMN_PARENTID = Constant('ATTR_CMN_PARENTID',0x04000000) +ATTR_CMN_FULLPATH = Constant('ATTR_CMN_FULLPATH',0x08000000) +ATTR_CMN_ADDEDTIME = Constant('ATTR_CMN_ADDEDTIME',0x10000000) +ATTR_CMN_ERROR = Constant('ATTR_CMN_ERROR',0x20000000) +ATTR_CMN_DATA_PROTECT_FLAGS = Constant('ATTR_CMN_DATA_PROTECT_FLAGS',0x40000000) +ATTR_CMN_RETURNED_ATTRS = Constant('ATTR_CMN_RETURNED_ATTRS',0x80000000) +ATTR_CMN_VALIDMASK = Constant('ATTR_CMN_VALIDMASK',0xFFFFFFFF) +ATTR_CMN_SETMASK = Constant('ATTR_CMN_SETMASK',0x51C7FF00) +ATTR_CMN_VOLSETMASK = Constant('ATTR_CMN_VOLSETMASK',0x00006700) +ATTR_VOL_FSTYPE = Constant('ATTR_VOL_FSTYPE',0x00000001) +ATTR_VOL_SIGNATURE = Constant('ATTR_VOL_SIGNATURE',0x00000002) +ATTR_VOL_SIZE = Constant('ATTR_VOL_SIZE',0x00000004) +ATTR_VOL_SPACEFREE = Constant('ATTR_VOL_SPACEFREE',0x00000008) +ATTR_VOL_SPACEAVAIL = Constant('ATTR_VOL_SPACEAVAIL',0x00000010) +ATTR_VOL_MINALLOCATION = Constant('ATTR_VOL_MINALLOCATION',0x00000020) +ATTR_VOL_ALLOCATIONCLUMP = Constant('ATTR_VOL_ALLOCATIONCLUMP',0x00000040) +ATTR_VOL_IOBLOCKSIZE = Constant('ATTR_VOL_IOBLOCKSIZE',0x00000080) +ATTR_VOL_OBJCOUNT = Constant('ATTR_VOL_OBJCOUNT',0x00000100) +ATTR_VOL_FILECOUNT = Constant('ATTR_VOL_FILECOUNT',0x00000200) +ATTR_VOL_DIRCOUNT = Constant('ATTR_VOL_DIRCOUNT',0x00000400) +ATTR_VOL_MAXOBJCOUNT = Constant('ATTR_VOL_MAXOBJCOUNT',0x00000800) +ATTR_VOL_MOUNTPOINT = Constant('ATTR_VOL_MOUNTPOINT',0x00001000) +ATTR_VOL_NAME = Constant('ATTR_VOL_NAME',0x00002000) +ATTR_VOL_MOUNTFLAGS = Constant('ATTR_VOL_MOUNTFLAGS',0x00004000) +ATTR_VOL_MOUNTEDDEVICE = Constant('ATTR_VOL_MOUNTEDDEVICE',0x00008000) +ATTR_VOL_ENCODINGSUSED = Constant('ATTR_VOL_ENCODINGSUSED',0x00010000) +ATTR_VOL_CAPABILITIES = Constant('ATTR_VOL_CAPABILITIES',0x00020000) +ATTR_VOL_UUID = Constant('ATTR_VOL_UUID',0x00040000) +ATTR_VOL_FSTYPENAME = Constant('ATTR_VOL_FSTYPENAME',0x00100000) +ATTR_VOL_FSSUBTYPE = Constant('ATTR_VOL_FSSUBTYPE',0x00200000) +ATTR_VOL_SPACEUSED = Constant('ATTR_VOL_SPACEUSED',0x00800000) +ATTR_VOL_QUOTA_SIZE = Constant('ATTR_VOL_QUOTA_SIZE',0x10000000) +ATTR_VOL_RESERVED_SIZE = Constant('ATTR_VOL_RESERVED_SIZE',0x20000000) +ATTR_VOL_ATTRIBUTES = Constant('ATTR_VOL_ATTRIBUTES',0x40000000) +ATTR_VOL_INFO = Constant('ATTR_VOL_INFO',0x80000000) +ATTR_VOL_VALIDMASK = Constant('ATTR_VOL_VALIDMASK',0xF0B7FFFF) +ATTR_VOL_SETMASK = Constant('ATTR_VOL_SETMASK',0x80002000) +ATTR_DIR_LINKCOUNT = Constant('ATTR_DIR_LINKCOUNT',0x00000001) +ATTR_DIR_ENTRYCOUNT = Constant('ATTR_DIR_ENTRYCOUNT',0x00000002) +ATTR_DIR_MOUNTSTATUS = Constant('ATTR_DIR_MOUNTSTATUS',0x00000004) +ATTR_DIR_ALLOCSIZE = Constant('ATTR_DIR_ALLOCSIZE',0x00000008) +ATTR_DIR_IOBLOCKSIZE = Constant('ATTR_DIR_IOBLOCKSIZE',0x00000010) +ATTR_DIR_DATALENGTH = Constant('ATTR_DIR_DATALENGTH',0x00000020) +DIR_MNTSTATUS_MNTPOINT = Constant('DIR_MNTSTATUS_MNTPOINT',0x00000001) +DIR_MNTSTATUS_TRIGGER = Constant('DIR_MNTSTATUS_TRIGGER',0x00000002) +ATTR_DIR_VALIDMASK = Constant('ATTR_DIR_VALIDMASK',0x0000003f) +ATTR_DIR_SETMASK = Constant('ATTR_DIR_SETMASK',0x00000000) +ATTR_FILE_LINKCOUNT = Constant('ATTR_FILE_LINKCOUNT',0x00000001) +ATTR_FILE_TOTALSIZE = Constant('ATTR_FILE_TOTALSIZE',0x00000002) +ATTR_FILE_ALLOCSIZE = Constant('ATTR_FILE_ALLOCSIZE',0x00000004) +ATTR_FILE_IOBLOCKSIZE = Constant('ATTR_FILE_IOBLOCKSIZE',0x00000008) +ATTR_FILE_DEVTYPE = Constant('ATTR_FILE_DEVTYPE',0x00000020) +ATTR_FILE_FORKCOUNT = Constant('ATTR_FILE_FORKCOUNT',0x00000080) +ATTR_FILE_FORKLIST = Constant('ATTR_FILE_FORKLIST',0x00000100) +ATTR_FILE_DATALENGTH = Constant('ATTR_FILE_DATALENGTH',0x00000200) +ATTR_FILE_DATAALLOCSIZE = Constant('ATTR_FILE_DATAALLOCSIZE',0x00000400) +ATTR_FILE_RSRCLENGTH = Constant('ATTR_FILE_RSRCLENGTH',0x00001000) +ATTR_FILE_RSRCALLOCSIZE = Constant('ATTR_FILE_RSRCALLOCSIZE',0x00002000) +ATTR_FILE_VALIDMASK = Constant('ATTR_FILE_VALIDMASK',0x000037FF) +ATTR_FILE_SETMASK = Constant('ATTR_FILE_SETMASK',0x00000020) +ATTR_CMNEXT_RELPATH = Constant('ATTR_CMNEXT_RELPATH',0x00000004) +ATTR_CMNEXT_PRIVATESIZE = Constant('ATTR_CMNEXT_PRIVATESIZE',0x00000008) +ATTR_CMNEXT_LINKID = Constant('ATTR_CMNEXT_LINKID',0x00000010) +ATTR_CMNEXT_NOFIRMLINKPATH = Constant('ATTR_CMNEXT_NOFIRMLINKPATH',0x00000020) +ATTR_CMNEXT_REALDEVID = Constant('ATTR_CMNEXT_REALDEVID',0x00000040) +ATTR_CMNEXT_REALFSID = Constant('ATTR_CMNEXT_REALFSID',0x00000080) +ATTR_CMNEXT_CLONEID = Constant('ATTR_CMNEXT_CLONEID',0x00000100) +ATTR_CMNEXT_EXT_FLAGS = Constant('ATTR_CMNEXT_EXT_FLAGS',0x00000200) +ATTR_CMNEXT_RECURSIVE_GENCOUNT = Constant('ATTR_CMNEXT_RECURSIVE_GENCOUNT',0x00000400) +ATTR_CMNEXT_ATTRIBUTION_TAG = Constant('ATTR_CMNEXT_ATTRIBUTION_TAG',0x00000800) +ATTR_CMNEXT_CLONE_REFCNT = Constant('ATTR_CMNEXT_CLONE_REFCNT',0x00001000) +ATTR_CMNEXT_VALIDMASK = Constant('ATTR_CMNEXT_VALIDMASK',0x00001ffc) +ATTR_CMNEXT_SETMASK = Constant('ATTR_CMNEXT_SETMASK',0x00000000) +ATTR_FORK_TOTALSIZE = Constant('ATTR_FORK_TOTALSIZE',0x00000001) +ATTR_FORK_ALLOCSIZE = Constant('ATTR_FORK_ALLOCSIZE',0x00000002) +ATTR_FORK_RESERVED = Constant('ATTR_FORK_RESERVED',0xffffffff) +ATTR_FORK_VALIDMASK = Constant('ATTR_FORK_VALIDMASK',0x00000003) +ATTR_FORK_SETMASK = Constant('ATTR_FORK_SETMASK',0x00000000) +ATTR_CMN_NAMEDATTRCOUNT = Constant('ATTR_CMN_NAMEDATTRCOUNT',0x00080000) +ATTR_CMN_NAMEDATTRLIST = Constant('ATTR_CMN_NAMEDATTRLIST',0x00100000) +ATTR_FILE_CLUMPSIZE = Constant('ATTR_FILE_CLUMPSIZE',0x00000010) +ATTR_FILE_FILETYPE = Constant('ATTR_FILE_FILETYPE',0x00000040) +ATTR_FILE_DATAEXTENTS = Constant('ATTR_FILE_DATAEXTENTS',0x00000800) +ATTR_FILE_RSRCEXTENTS = Constant('ATTR_FILE_RSRCEXTENTS',0x00004000) +SRCHFS_START = Constant('SRCHFS_START',0x00000001) +SRCHFS_MATCHPARTIALNAMES = Constant('SRCHFS_MATCHPARTIALNAMES',0x00000002) +SRCHFS_MATCHDIRS = Constant('SRCHFS_MATCHDIRS',0x00000004) +SRCHFS_MATCHFILES = Constant('SRCHFS_MATCHFILES',0x00000008) +SRCHFS_SKIPLINKS = Constant('SRCHFS_SKIPLINKS',0x00000010) +SRCHFS_SKIPINVISIBLE = Constant('SRCHFS_SKIPINVISIBLE',0x00000020) +SRCHFS_SKIPPACKAGES = Constant('SRCHFS_SKIPPACKAGES',0x00000040) +SRCHFS_SKIPINAPPROPRIATE = Constant('SRCHFS_SKIPINAPPROPRIATE',0x00000080) +SRCHFS_NEGATEPARAMS = Constant('SRCHFS_NEGATEPARAMS',0x80000000) +SRCHFS_VALIDOPTIONSMASK = Constant('SRCHFS_VALIDOPTIONSMASK',0x800000FF) +KEV_ANY_VENDOR = Constant('KEV_ANY_VENDOR',0) +KEV_ANY_CLASS = Constant('KEV_ANY_CLASS',0) +KEV_ANY_SUBCLASS = Constant('KEV_ANY_SUBCLASS',0) +KEV_VENDOR_APPLE = Constant('KEV_VENDOR_APPLE',1) +KEV_NETWORK_CLASS = Constant('KEV_NETWORK_CLASS',1) +KEV_IOKIT_CLASS = Constant('KEV_IOKIT_CLASS',2) +KEV_SYSTEM_CLASS = Constant('KEV_SYSTEM_CLASS',3) +KEV_APPLESHARE_CLASS = Constant('KEV_APPLESHARE_CLASS',4) +KEV_FIREWALL_CLASS = Constant('KEV_FIREWALL_CLASS',5) +KEV_IEEE80211_CLASS = Constant('KEV_IEEE80211_CLASS',6) +KEV_NKE_CLASS = Constant('KEV_NKE_CLASS',7) +KEV_NKE_ALF_SUBCLASS = Constant('KEV_NKE_ALF_SUBCLASS',1) +KEV_NKE_ALF_STATE_CHANGED = Constant('KEV_NKE_ALF_STATE_CHANGED',1) +XNU_KERN_EVENT_DATA_SIZE = Constant('XNU_KERN_EVENT_DATA_SIZE',1) +KEV_VENDOR_CODE_MAX_STR_LEN = Constant('KEV_VENDOR_CODE_MAX_STR_LEN',200) +N_KEV_VECTORS = Constant('N_KEV_VECTORS',5) +M_WAITOK = Constant('M_WAITOK',0x0000) +M_NOWAIT = Constant('M_NOWAIT',0x0001) +M_ZERO = Constant('M_ZERO',0x0004) +M_NULL = Constant('M_NULL',0x0008) +M_PCB = Constant('M_PCB',4) +M_RTABLE = Constant('M_RTABLE',5) +M_IFADDR = Constant('M_IFADDR',9) +M_SONAME = Constant('M_SONAME',11) +M_LOCKF = Constant('M_LOCKF',40) +M_TEMP = Constant('M_TEMP',80) +M_UDFNODE = Constant('M_UDFNODE',84) +M_UDFMNT = Constant('M_UDFMNT',85) +M_KAUTH = Constant('M_KAUTH',100) +HAVE_VT_LOCKERFS = Constant('HAVE_VT_LOCKERFS',1) +VNODE_READ = Constant('VNODE_READ',0x01) +VNODE_WRITE = Constant('VNODE_WRITE',0x02) +VNODE_BLOCKMAP_NO_TRACK = Constant('VNODE_BLOCKMAP_NO_TRACK',0x04) +VNODE_CLUSTER_VERIFY = Constant('VNODE_CLUSTER_VERIFY',0x08) +PREALLOCATE = Constant('PREALLOCATE',0x00000001) +ALLOCATECONTIG = Constant('ALLOCATECONTIG',0x00000002) +ALLOCATEALL = Constant('ALLOCATEALL',0x00000004) +ALLOCATEPERSIST = Constant('ALLOCATEPERSIST',0x00000008) +ALLOCATEFROMPEOF = Constant('ALLOCATEFROMPEOF',0x00000010) +ALLOCATEFROMVOL = Constant('ALLOCATEFROMVOL',0x00000020) +IO_UNIT = Constant('IO_UNIT',0x0001) +IO_APPEND = Constant('IO_APPEND',0x0002) +IO_SYNC = Constant('IO_SYNC',0x0004) +IO_NODELOCKED = Constant('IO_NODELOCKED',0x0008) +IO_NDELAY = Constant('IO_NDELAY',0x0010) +IO_NOZEROFILL = Constant('IO_NOZEROFILL',0x0020) +IO_TAILZEROFILL = Constant('IO_TAILZEROFILL',0x0040) +IO_HEADZEROFILL = Constant('IO_HEADZEROFILL',0x0080) +IO_NOZEROVALID = Constant('IO_NOZEROVALID',0x0100) +IO_NOZERODIRTY = Constant('IO_NOZERODIRTY',0x0200) +IO_CLOSE = Constant('IO_CLOSE',0x0400) +IO_NOCACHE = Constant('IO_NOCACHE',0x0800) +IO_RAOFF = Constant('IO_RAOFF',0x1000) +IO_DEFWRITE = Constant('IO_DEFWRITE',0x2000) +IO_PASSIVE = Constant('IO_PASSIVE',0x4000) +IO_NOAUTH = Constant('IO_NOAUTH',0x8000) +IO_NODIRECT = Constant('IO_NODIRECT',0x10000) +IO_ENCRYPTED = Constant('IO_ENCRYPTED',0x20000) +IO_RETURN_ON_THROTTLE = Constant('IO_RETURN_ON_THROTTLE',0x40000) +IO_SINGLE_WRITER = Constant('IO_SINGLE_WRITER',0x80000) +IO_SYSCALL_DISPATCH = Constant('IO_SYSCALL_DISPATCH',0x100000) +IO_SWAP_DISPATCH = Constant('IO_SWAP_DISPATCH',0x200000) +IO_SKIP_ENCRYPTION = Constant('IO_SKIP_ENCRYPTION',0x400000) +IO_EVTONLY = Constant('IO_EVTONLY',0x800000) +LOOKUP = Constant('LOOKUP',0) +CREATE = Constant('CREATE',1) +DELETE = Constant('DELETE',2) +RENAME = Constant('RENAME',3) +OPMASK = Constant('OPMASK',3) +FOLLOW = Constant('FOLLOW',0x00000040) +ISDOTDOT = Constant('ISDOTDOT',0x00002000) +MAKEENTRY = Constant('MAKEENTRY',0x00004000) +ISLASTCN = Constant('ISLASTCN',0x00008000) +VNFS_NOCACHE = Constant('VNFS_NOCACHE',0x01) +VNFS_CANTCACHE = Constant('VNFS_CANTCACHE',0x02) +VNFS_ADDFSREF = Constant('VNFS_ADDFSREF',0x04) +VNCREATE_FLAVOR = Constant('VNCREATE_FLAVOR',0) +VA_UTIMES_NULL = Constant('VA_UTIMES_NULL',0x010000) +VA_EXCLUSIVE = Constant('VA_EXCLUSIVE',0x020000) +VA_NOINHERIT = Constant('VA_NOINHERIT',0x040000) +VA_NOAUTH = Constant('VA_NOAUTH',0x080000) +VA_64BITOBJIDS = Constant('VA_64BITOBJIDS',0x100000) +VA_REALFSID = Constant('VA_REALFSID',0x200000) +VA_USEFSID = Constant('VA_USEFSID',0x400000) +VA_FILESEC_ACL = Constant('VA_FILESEC_ACL',0x800000) +VSUID = Constant('VSUID',0x800) +VSGID = Constant('VSGID',0x400) +VSVTX = Constant('VSVTX',0x200) +VREAD = Constant('VREAD',0x100) +VWRITE = Constant('VWRITE',0x080) +VEXEC = Constant('VEXEC',0x040) +SKIPSYSTEM = Constant('SKIPSYSTEM',0x0001) +FORCECLOSE = Constant('FORCECLOSE',0x0002) +WRITECLOSE = Constant('WRITECLOSE',0x0004) +SKIPSWAP = Constant('SKIPSWAP',0x0008) +SKIPROOT = Constant('SKIPROOT',0x0010) +DOCLOSE = Constant('DOCLOSE',0x0008) +V_SAVE = Constant('V_SAVE',0x0001) +V_SAVEMETA = Constant('V_SAVEMETA',0x0002) +REVOKEALL = Constant('REVOKEALL',0x0001) +VNODE_REMOVE_NODELETEBUSY = Constant('VNODE_REMOVE_NODELETEBUSY',0x0001) +VNODE_REMOVE_SKIP_NAMESPACE_EVENT = Constant('VNODE_REMOVE_SKIP_NAMESPACE_EVENT',0x0002) +VNODE_REMOVE_NO_AUDIT_PATH = Constant('VNODE_REMOVE_NO_AUDIT_PATH',0x0004) +VNODE_REMOVE_DATALESS_DIR = Constant('VNODE_REMOVE_DATALESS_DIR',0x0008) +VNODE_READDIR_EXTENDED = Constant('VNODE_READDIR_EXTENDED',0x0001) +VNODE_READDIR_REQSEEKOFF = Constant('VNODE_READDIR_REQSEEKOFF',0x0002) +VNODE_READDIR_SEEKOFF32 = Constant('VNODE_READDIR_SEEKOFF32',0x0004) +VNODE_READDIR_NAMEMAX = Constant('VNODE_READDIR_NAMEMAX',0x0008) +VNODE_CLONEFILE_DEFAULT = Constant('VNODE_CLONEFILE_DEFAULT',0x0000) +VNODE_CLONEFILE_NOOWNERCOPY = Constant('VNODE_CLONEFILE_NOOWNERCOPY',0x0001) +VNODE_ASYNC_THROTTLE = Constant('VNODE_ASYNC_THROTTLE',15) +VNODE_UPDATE_PARENT = Constant('VNODE_UPDATE_PARENT',0x01) +VNODE_UPDATE_NAME = Constant('VNODE_UPDATE_NAME',0x02) +VNODE_UPDATE_CACHE = Constant('VNODE_UPDATE_CACHE',0x04) +VNODE_UPDATE_PURGE = Constant('VNODE_UPDATE_PURGE',0x08) +VNODE_LOOKUP_NOFOLLOW = Constant('VNODE_LOOKUP_NOFOLLOW',0x01) +VNODE_LOOKUP_NOCROSSMOUNT = Constant('VNODE_LOOKUP_NOCROSSMOUNT',0x02) +VNODE_LOOKUP_CROSSMOUNTNOWAIT = Constant('VNODE_LOOKUP_CROSSMOUNTNOWAIT',0x04) +VNODE_RELOAD = Constant('VNODE_RELOAD',0x01) +VNODE_WAIT = Constant('VNODE_WAIT',0x02) +VNODE_WRITEABLE = Constant('VNODE_WRITEABLE',0x04) +VNODE_WITHID = Constant('VNODE_WITHID',0x08) +VNODE_NOLOCK_INTERNAL = Constant('VNODE_NOLOCK_INTERNAL',0x10) +VNODE_NODEAD = Constant('VNODE_NODEAD',0x20) +VNODE_NOSUSPEND = Constant('VNODE_NOSUSPEND',0x40) +VNODE_ITERATE_ALL = Constant('VNODE_ITERATE_ALL',0x80) +VNODE_ITERATE_ACTIVE = Constant('VNODE_ITERATE_ACTIVE',0x100) +VNODE_ITERATE_INACTIVE = Constant('VNODE_ITERATE_INACTIVE',0x200) +VNODE_RETURNED = Constant('VNODE_RETURNED',0) +VNODE_RETURNED_DONE = Constant('VNODE_RETURNED_DONE',1) +VNODE_CLAIMED = Constant('VNODE_CLAIMED',2) +VNODE_CLAIMED_DONE = Constant('VNODE_CLAIMED_DONE',3) +IOCS_BUFFER_NUM_SIZE_BUCKETS = Constant('IOCS_BUFFER_NUM_SIZE_BUCKETS',10) +IOCS_BUFFER_MAX_BUCKET = Constant('IOCS_BUFFER_MAX_BUCKET',9) +IOCS_BUFFER_NUM_COMPRESSION_BUCKETS = Constant('IOCS_BUFFER_NUM_COMPRESSION_BUCKETS',7) +IOCS_BLOCK_NUM_SIZE_BUCKETS = Constant('IOCS_BLOCK_NUM_SIZE_BUCKETS',16) +IOCS_SBE_PATH_LEN = Constant('IOCS_SBE_PATH_LEN',128) +IOCS_PATH_START_BYTES_TO_COPY = Constant('IOCS_PATH_START_BYTES_TO_COPY',108) +IOCS_PATH_END_BYTES_TO_COPY = Constant('IOCS_PATH_END_BYTES_TO_COPY',20) +IOCS_SYSCTL_LIVE = Constant('IOCS_SYSCTL_LIVE',0x00000001) +IOCS_SYSCTL_STORE_BUFFER_RD_ONLY = Constant('IOCS_SYSCTL_STORE_BUFFER_RD_ONLY',0x00000002) +IOCS_SYSCTL_STORE_BUFFER_MARK = Constant('IOCS_SYSCTL_STORE_BUFFER_MARK',0x00000004) +TANDEM = Constant('TANDEM',0x00000001) +CBREAK = Constant('CBREAK',0x00000002) +LCASE = Constant('LCASE',0x00000004) +ECHO = Constant('ECHO',0x00000008) +CRMOD = Constant('CRMOD',0x00000010) +RAW = Constant('RAW',0x00000020) +ODDP = Constant('ODDP',0x00000040) +EVENP = Constant('EVENP',0x00000080) +ANYP = Constant('ANYP',0x000000c0) +NLDELAY = Constant('NLDELAY',0x00000300) +TBDELAY = Constant('TBDELAY',0x00000c00) +XTABS = Constant('XTABS',0x00000c00) +CRDELAY = Constant('CRDELAY',0x00003000) +VTDELAY = Constant('VTDELAY',0x00004000) +BSDELAY = Constant('BSDELAY',0x00008000) +NL0 = Constant('NL0',0x00000000) +NL1 = Constant('NL1',0x00000100) +NL2 = Constant('NL2',0x00000200) +NL3 = Constant('NL3',0x00000300) +TAB0 = Constant('TAB0',0x00000000) +TAB1 = Constant('TAB1',0x00000400) +TAB2 = Constant('TAB2',0x00000800) +CR0 = Constant('CR0',0x00000000) +CR1 = Constant('CR1',0x00001000) +CR2 = Constant('CR2',0x00002000) +CR3 = Constant('CR3',0x00003000) +FF0 = Constant('FF0',0x00000000) +FF1 = Constant('FF1',0x00004000) +BS0 = Constant('BS0',0x00000000) +BS1 = Constant('BS1',0x00008000) +CRTBS = Constant('CRTBS',0x00010000) +PRTERA = Constant('PRTERA',0x00020000) +CRTERA = Constant('CRTERA',0x00040000) +TILDE = Constant('TILDE',0x00080000) +MDMBUF = Constant('MDMBUF',0x00100000) +LITOUT = Constant('LITOUT',0x00200000) +TOSTOP = Constant('TOSTOP',0x00400000) +FLUSHO = Constant('FLUSHO',0x00800000) +NOHANG = Constant('NOHANG',0x01000000) +L001000 = Constant('L001000',0x02000000) +CRTKIL = Constant('CRTKIL',0x04000000) +PASS8 = Constant('PASS8',0x08000000) +CTLECH = Constant('CTLECH',0x10000000) +PENDIN = Constant('PENDIN',0x20000000) +DECCTQ = Constant('DECCTQ',0x40000000) +NOFLSH = Constant('NOFLSH',0x80000000) +OTTYDISC = Constant('OTTYDISC',0) +NETLDISC = Constant('NETLDISC',1) +NTTYDISC = Constant('NTTYDISC',2) +LOCKLEAF = Constant('LOCKLEAF',0x0004) +LOCKPARENT = Constant('LOCKPARENT',0x0008) +WANTPARENT = Constant('WANTPARENT',0x0010) +UIO_MAXIOV = Constant('UIO_MAXIOV',1024) +UIO_SMALLIOV = Constant('UIO_SMALLIOV',8) +EVFILT_SYSCOUNT = Constant('EVFILT_SYSCOUNT',17) +KEVENT_FLAG_NONE = Constant('KEVENT_FLAG_NONE',0x000000) +KEVENT_FLAG_IMMEDIATE = Constant('KEVENT_FLAG_IMMEDIATE',0x000001) +KEVENT_FLAG_ERROR_EVENTS = Constant('KEVENT_FLAG_ERROR_EVENTS',0x000002) +EV_ADD = Constant('EV_ADD',0x0001) +EV_DELETE = Constant('EV_DELETE',0x0002) +EV_ENABLE = Constant('EV_ENABLE',0x0004) +EV_DISABLE = Constant('EV_DISABLE',0x0008) +EV_ONESHOT = Constant('EV_ONESHOT',0x0010) +EV_CLEAR = Constant('EV_CLEAR',0x0020) +EV_RECEIPT = Constant('EV_RECEIPT',0x0040) +EV_DISPATCH = Constant('EV_DISPATCH',0x0080) +EV_UDATA_SPECIFIC = Constant('EV_UDATA_SPECIFIC',0x0100) +EV_VANISHED = Constant('EV_VANISHED',0x0200) +EV_SYSFLAGS = Constant('EV_SYSFLAGS',0xF000) +EV_FLAG0 = Constant('EV_FLAG0',0x1000) +EV_FLAG1 = Constant('EV_FLAG1',0x2000) +EV_EOF = Constant('EV_EOF',0x8000) +EV_ERROR = Constant('EV_ERROR',0x4000) +NOTE_TRIGGER = Constant('NOTE_TRIGGER',0x01000000) +NOTE_FFNOP = Constant('NOTE_FFNOP',0x00000000) +NOTE_FFAND = Constant('NOTE_FFAND',0x40000000) +NOTE_FFOR = Constant('NOTE_FFOR',0x80000000) +NOTE_FFCOPY = Constant('NOTE_FFCOPY',0xc0000000) +NOTE_FFCTRLMASK = Constant('NOTE_FFCTRLMASK',0xc0000000) +NOTE_FFLAGSMASK = Constant('NOTE_FFLAGSMASK',0x00ffffff) +NOTE_LOWAT = Constant('NOTE_LOWAT',0x00000001) +NOTE_OOB = Constant('NOTE_OOB',0x00000002) +NOTE_DELETE = Constant('NOTE_DELETE',0x00000001) +NOTE_WRITE = Constant('NOTE_WRITE',0x00000002) +NOTE_EXTEND = Constant('NOTE_EXTEND',0x00000004) +NOTE_ATTRIB = Constant('NOTE_ATTRIB',0x00000008) +NOTE_LINK = Constant('NOTE_LINK',0x00000010) +NOTE_RENAME = Constant('NOTE_RENAME',0x00000020) +NOTE_REVOKE = Constant('NOTE_REVOKE',0x00000040) +NOTE_NONE = Constant('NOTE_NONE',0x00000080) +NOTE_FUNLOCK = Constant('NOTE_FUNLOCK',0x00000100) +NOTE_LEASE_DOWNGRADE = Constant('NOTE_LEASE_DOWNGRADE',0x00000200) +NOTE_LEASE_RELEASE = Constant('NOTE_LEASE_RELEASE',0x00000400) +NOTE_EXIT = Constant('NOTE_EXIT',0x80000000) +NOTE_FORK = Constant('NOTE_FORK',0x40000000) +NOTE_EXEC = Constant('NOTE_EXEC',0x20000000) +NOTE_SIGNAL = Constant('NOTE_SIGNAL',0x08000000) +NOTE_EXITSTATUS = Constant('NOTE_EXITSTATUS',0x04000000) +NOTE_EXIT_DETAIL = Constant('NOTE_EXIT_DETAIL',0x02000000) +NOTE_PDATAMASK = Constant('NOTE_PDATAMASK',0x000fffff) +NOTE_EXIT_DETAIL_MASK = Constant('NOTE_EXIT_DETAIL_MASK',0x00070000) +NOTE_EXIT_DECRYPTFAIL = Constant('NOTE_EXIT_DECRYPTFAIL',0x00010000) +NOTE_EXIT_MEMORY = Constant('NOTE_EXIT_MEMORY',0x00020000) +NOTE_EXIT_CSERROR = Constant('NOTE_EXIT_CSERROR',0x00040000) +NOTE_VM_PRESSURE = Constant('NOTE_VM_PRESSURE',0x80000000) +NOTE_VM_PRESSURE_TERMINATE = Constant('NOTE_VM_PRESSURE_TERMINATE',0x40000000) +NOTE_VM_PRESSURE_SUDDEN_TERMINATE = Constant('NOTE_VM_PRESSURE_SUDDEN_TERMINATE',0x20000000) +NOTE_VM_ERROR = Constant('NOTE_VM_ERROR',0x10000000) +NOTE_SECONDS = Constant('NOTE_SECONDS',0x00000001) +NOTE_USECONDS = Constant('NOTE_USECONDS',0x00000002) +NOTE_NSECONDS = Constant('NOTE_NSECONDS',0x00000004) +NOTE_ABSOLUTE = Constant('NOTE_ABSOLUTE',0x00000008) +NOTE_LEEWAY = Constant('NOTE_LEEWAY',0x00000010) +NOTE_CRITICAL = Constant('NOTE_CRITICAL',0x00000020) +NOTE_BACKGROUND = Constant('NOTE_BACKGROUND',0x00000040) +NOTE_MACH_CONTINUOUS_TIME = Constant('NOTE_MACH_CONTINUOUS_TIME',0x00000080) +NOTE_MACHTIME = Constant('NOTE_MACHTIME',0x00000100) +NOTE_TRACK = Constant('NOTE_TRACK',0x00000001) +NOTE_TRACKERR = Constant('NOTE_TRACKERR',0x00000002) +NOTE_CHILD = Constant('NOTE_CHILD',0x00000004) +VMADDR_CID_HYPERVISOR = Constant('VMADDR_CID_HYPERVISOR',0) +VMADDR_CID_RESERVED = Constant('VMADDR_CID_RESERVED',1) +VMADDR_CID_HOST = Constant('VMADDR_CID_HOST',2) +IMG_SHSIZE = Constant('IMG_SHSIZE',512) +IMGPF_NONE = Constant('IMGPF_NONE',0x00000000) +IMGPF_INTERPRET = Constant('IMGPF_INTERPRET',0x00000001) +IMGPF_RESERVED = Constant('IMGPF_RESERVED',0x00000002) +IMGPF_WAS_64BIT_ADDR = Constant('IMGPF_WAS_64BIT_ADDR',0x00000004) +IMGPF_IS_64BIT_ADDR = Constant('IMGPF_IS_64BIT_ADDR',0x00000008) +IMGPF_SPAWN = Constant('IMGPF_SPAWN',0x00000010) +IMGPF_DISABLE_ASLR = Constant('IMGPF_DISABLE_ASLR',0x00000020) +IMGPF_ALLOW_DATA_EXEC = Constant('IMGPF_ALLOW_DATA_EXEC',0x00000040) +IMGPF_EXEC = Constant('IMGPF_EXEC',0x00000100) +IMGPF_HIGH_BITS_ASLR = Constant('IMGPF_HIGH_BITS_ASLR',0x00000200) +IMGPF_IS_64BIT_DATA = Constant('IMGPF_IS_64BIT_DATA',0x00000400) +IMGPF_DRIVER = Constant('IMGPF_DRIVER',0x00000800) +IMGPF_RESLIDE = Constant('IMGPF_RESLIDE',0x00001000) +IMGPF_PLUGIN_HOST_DISABLE_A_KEYS = Constant('IMGPF_PLUGIN_HOST_DISABLE_A_KEYS',0x00002000) +IMGPF_HW_TPRO = Constant('IMGPF_HW_TPRO',0x00004000) +IMGPF_ROSETTA = Constant('IMGPF_ROSETTA',0x10000000) +IMGPF_ALT_ROSETTA = Constant('IMGPF_ALT_ROSETTA',0x20000000) +IMGPF_NOJOP = Constant('IMGPF_NOJOP',0x80000000) +IMGPF_SB_DEFAULT = Constant('IMGPF_SB_DEFAULT',0) +IMGPF_SB_TRUE = Constant('IMGPF_SB_TRUE',1) +IMGPF_SB_FALSE = Constant('IMGPF_SB_FALSE',2) +_POSIX_THREAD_KEYS_MAX = Constant('_POSIX_THREAD_KEYS_MAX',128) +F_OK = Constant('F_OK',0) +ACCESSX_MAX_DESCRIPTORS = Constant('ACCESSX_MAX_DESCRIPTORS',100) +_PC_LINK_MAX = Constant('_PC_LINK_MAX',1) +_PC_MAX_CANON = Constant('_PC_MAX_CANON',2) +_PC_MAX_INPUT = Constant('_PC_MAX_INPUT',3) +_PC_NAME_MAX = Constant('_PC_NAME_MAX',4) +_PC_PATH_MAX = Constant('_PC_PATH_MAX',5) +_PC_PIPE_BUF = Constant('_PC_PIPE_BUF',6) +_PC_CHOWN_RESTRICTED = Constant('_PC_CHOWN_RESTRICTED',7) +_PC_NO_TRUNC = Constant('_PC_NO_TRUNC',8) +_PC_VDISABLE = Constant('_PC_VDISABLE',9) +_PC_NAME_CHARS_MAX = Constant('_PC_NAME_CHARS_MAX',10) +_PC_CASE_SENSITIVE = Constant('_PC_CASE_SENSITIVE',11) +_PC_CASE_PRESERVING = Constant('_PC_CASE_PRESERVING',12) +_PC_EXTENDED_SECURITY_NP = Constant('_PC_EXTENDED_SECURITY_NP',13) +_PC_AUTH_OPAQUE_NP = Constant('_PC_AUTH_OPAQUE_NP',14) +_PC_2_SYMLINKS = Constant('_PC_2_SYMLINKS',15) +_PC_ALLOC_SIZE_MIN = Constant('_PC_ALLOC_SIZE_MIN',16) +_PC_ASYNC_IO = Constant('_PC_ASYNC_IO',17) +_PC_FILESIZEBITS = Constant('_PC_FILESIZEBITS',18) +_PC_PRIO_IO = Constant('_PC_PRIO_IO',19) +_PC_REC_INCR_XFER_SIZE = Constant('_PC_REC_INCR_XFER_SIZE',20) +_PC_REC_MAX_XFER_SIZE = Constant('_PC_REC_MAX_XFER_SIZE',21) +_PC_REC_MIN_XFER_SIZE = Constant('_PC_REC_MIN_XFER_SIZE',22) +_PC_REC_XFER_ALIGN = Constant('_PC_REC_XFER_ALIGN',23) +_PC_SYMLINK_MAX = Constant('_PC_SYMLINK_MAX',24) +_PC_SYNC_IO = Constant('_PC_SYNC_IO',25) +_PC_XATTR_SIZE_BITS = Constant('_PC_XATTR_SIZE_BITS',26) +_PC_MIN_HOLE_SIZE = Constant('_PC_MIN_HOLE_SIZE',27) +_CS_PATH = Constant('_CS_PATH',1) +_SYS_CONF_H_ = Constant('_SYS_CONF_H_',1) +D_TAPE = Constant('D_TAPE',1) +D_DISK = Constant('D_DISK',2) +D_TTY = Constant('D_TTY',3) +WNOHANG = Constant('WNOHANG',0x00000001) +WUNTRACED = Constant('WUNTRACED',0x00000002) +WCOREFLAG = Constant('WCOREFLAG',0o0200) +_WSTOPPED = Constant('_WSTOPPED',0o0177) +WEXITED = Constant('WEXITED',0x00000004) +WSTOPPED = Constant('WSTOPPED',0x00000008) +WCONTINUED = Constant('WCONTINUED',0x00000010) +WNOWAIT = Constant('WNOWAIT',0x00000020) +WAIT_MYPGRP = Constant('WAIT_MYPGRP',0) +PRIO_DARWIN_GAME_MODE = Constant('PRIO_DARWIN_GAME_MODE',7) +PRIO_DARWIN_GAME_MODE_OFF = Constant('PRIO_DARWIN_GAME_MODE_OFF',0x0) +PRIO_DARWIN_GAME_MODE_ON = Constant('PRIO_DARWIN_GAME_MODE_ON',0x1) +IPC_CREAT = Constant('IPC_CREAT',0o001000) +IPC_EXCL = Constant('IPC_EXCL',0o002000) +IPC_NOWAIT = Constant('IPC_NOWAIT',0o004000) +IPC_RMID = Constant('IPC_RMID',0) +IPC_SET = Constant('IPC_SET',1) +IPC_STAT = Constant('IPC_STAT',2) +IPC_R = Constant('IPC_R',0o000400) +IPC_W = Constant('IPC_W',0o000200) +IPC_M = Constant('IPC_M',0o010000) +O_RDONLY = Constant('O_RDONLY',0x0000) +O_WRONLY = Constant('O_WRONLY',0x0001) +O_RDWR = Constant('O_RDWR',0x0002) +O_ACCMODE = Constant('O_ACCMODE',0x0003) +FREAD = Constant('FREAD',0x00000001) +FWRITE = Constant('FWRITE',0x00000002) +O_NONBLOCK = Constant('O_NONBLOCK',0x00000004) +O_APPEND = Constant('O_APPEND',0x00000008) +O_SHLOCK = Constant('O_SHLOCK',0x00000010) +O_EXLOCK = Constant('O_EXLOCK',0x00000020) +O_ASYNC = Constant('O_ASYNC',0x00000040) +O_NOFOLLOW = Constant('O_NOFOLLOW',0x00000100) +O_CREAT = Constant('O_CREAT',0x00000200) +O_TRUNC = Constant('O_TRUNC',0x00000400) +O_EXCL = Constant('O_EXCL',0x00000800) +FMARK = Constant('FMARK',0x00001000) +FDEFER = Constant('FDEFER',0x00002000) +FWASLOCKED = Constant('FWASLOCKED',0x00004000) +O_EVTONLY = Constant('O_EVTONLY',0x00008000) +FWASWRITTEN = Constant('FWASWRITTEN',0x00010000) +O_NOCTTY = Constant('O_NOCTTY',0x00020000) +FNOCACHE = Constant('FNOCACHE',0x00040000) +FNORDAHEAD = Constant('FNORDAHEAD',0x00080000) +O_DIRECTORY = Constant('O_DIRECTORY',0x00100000) +O_SYMLINK = Constant('O_SYMLINK',0x00200000) +FNODIRECT = Constant('FNODIRECT',0x00800000) +O_CLOEXEC = Constant('O_CLOEXEC',0x01000000) +FENCRYPTED = Constant('FENCRYPTED',0x02000000) +FSINGLE_WRITER = Constant('FSINGLE_WRITER',0x04000000) +O_CLOFORK = Constant('O_CLOFORK',0x08000000) +FUNENCRYPTED = Constant('FUNENCRYPTED',0x10000000) +O_NOFOLLOW_ANY = Constant('O_NOFOLLOW_ANY',0x20000000) +O_EXEC = Constant('O_EXEC',0x40000000) +AT_EACCESS = Constant('AT_EACCESS',0x0010) +AT_SYMLINK_NOFOLLOW = Constant('AT_SYMLINK_NOFOLLOW',0x0020) +AT_SYMLINK_FOLLOW = Constant('AT_SYMLINK_FOLLOW',0x0040) +AT_REMOVEDIR = Constant('AT_REMOVEDIR',0x0080) +AT_REALDEV = Constant('AT_REALDEV',0x0200) +AT_FDONLY = Constant('AT_FDONLY',0x0400) +AT_SYMLINK_NOFOLLOW_ANY = Constant('AT_SYMLINK_NOFOLLOW_ANY',0x0800) +O_DP_GETRAWENCRYPTED = Constant('O_DP_GETRAWENCRYPTED',0x0001) +O_DP_GETRAWUNENCRYPTED = Constant('O_DP_GETRAWUNENCRYPTED',0x0002) +O_DP_AUTHENTICATE = Constant('O_DP_AUTHENTICATE',0x0004) +CPF_OVERWRITE = Constant('CPF_OVERWRITE',0x0001) +CPF_IGNORE_MODE = Constant('CPF_IGNORE_MODE',0x0002) +F_DUPFD = Constant('F_DUPFD',0) +F_GETFD = Constant('F_GETFD',1) +F_SETFD = Constant('F_SETFD',2) +F_GETFL = Constant('F_GETFL',3) +F_SETFL = Constant('F_SETFL',4) +F_GETOWN = Constant('F_GETOWN',5) +F_SETOWN = Constant('F_SETOWN',6) +F_GETLK = Constant('F_GETLK',7) +F_SETLK = Constant('F_SETLK',8) +F_SETLKW = Constant('F_SETLKW',9) +F_SETLKWTIMEOUT = Constant('F_SETLKWTIMEOUT',10) +F_FLUSH_DATA = Constant('F_FLUSH_DATA',40) +F_CHKCLEAN = Constant('F_CHKCLEAN',41) +F_PREALLOCATE = Constant('F_PREALLOCATE',42) +F_SETSIZE = Constant('F_SETSIZE',43) +F_RDADVISE = Constant('F_RDADVISE',44) +F_RDAHEAD = Constant('F_RDAHEAD',45) +F_NOCACHE = Constant('F_NOCACHE',48) +F_LOG2PHYS = Constant('F_LOG2PHYS',49) +F_GETPATH = Constant('F_GETPATH',50) +F_FULLFSYNC = Constant('F_FULLFSYNC',51) +F_PATHPKG_CHECK = Constant('F_PATHPKG_CHECK',52) +F_FREEZE_FS = Constant('F_FREEZE_FS',53) +F_THAW_FS = Constant('F_THAW_FS',54) +F_GLOBAL_NOCACHE = Constant('F_GLOBAL_NOCACHE',55) +F_ADDSIGS = Constant('F_ADDSIGS',59) +F_ADDFILESIGS = Constant('F_ADDFILESIGS',61) +F_NODIRECT = Constant('F_NODIRECT',62) +F_GETPROTECTIONCLASS = Constant('F_GETPROTECTIONCLASS',63) +F_SETPROTECTIONCLASS = Constant('F_SETPROTECTIONCLASS',64) +F_LOG2PHYS_EXT = Constant('F_LOG2PHYS_EXT',65) +F_GETLKPID = Constant('F_GETLKPID',66) +F_SETBACKINGSTORE = Constant('F_SETBACKINGSTORE',70) +F_GETPATH_MTMINFO = Constant('F_GETPATH_MTMINFO',71) +F_GETCODEDIR = Constant('F_GETCODEDIR',72) +F_SETNOSIGPIPE = Constant('F_SETNOSIGPIPE',73) +F_GETNOSIGPIPE = Constant('F_GETNOSIGPIPE',74) +F_TRANSCODEKEY = Constant('F_TRANSCODEKEY',75) +F_SINGLE_WRITER = Constant('F_SINGLE_WRITER',76) +F_GETPROTECTIONLEVEL = Constant('F_GETPROTECTIONLEVEL',77) +F_FINDSIGS = Constant('F_FINDSIGS',78) +F_ADDFILESIGS_FOR_DYLD_SIM = Constant('F_ADDFILESIGS_FOR_DYLD_SIM',83) +F_BARRIERFSYNC = Constant('F_BARRIERFSYNC',85) +F_OFD_SETLK = Constant('F_OFD_SETLK',90) +F_OFD_SETLKW = Constant('F_OFD_SETLKW',91) +F_OFD_GETLK = Constant('F_OFD_GETLK',92) +F_OFD_SETLKWTIMEOUT = Constant('F_OFD_SETLKWTIMEOUT',93) +F_ADDFILESIGS_RETURN = Constant('F_ADDFILESIGS_RETURN',97) +F_CHECK_LV = Constant('F_CHECK_LV',98) +F_PUNCHHOLE = Constant('F_PUNCHHOLE',99) +F_TRIM_ACTIVE_FILE = Constant('F_TRIM_ACTIVE_FILE',100) +F_SPECULATIVE_READ = Constant('F_SPECULATIVE_READ',101) +F_GETPATH_NOFIRMLINK = Constant('F_GETPATH_NOFIRMLINK',102) +F_ADDFILESIGS_INFO = Constant('F_ADDFILESIGS_INFO',103) +F_ADDFILESUPPL = Constant('F_ADDFILESUPPL',104) +F_GETSIGSINFO = Constant('F_GETSIGSINFO',105) +F_SETLEASE = Constant('F_SETLEASE',106) +F_GETLEASE = Constant('F_GETLEASE',107) +F_TRANSFEREXTENTS = Constant('F_TRANSFEREXTENTS',110) +F_ATTRIBUTION_TAG = Constant('F_ATTRIBUTION_TAG',111) +FCNTL_FS_SPECIFIC_BASE = Constant('FCNTL_FS_SPECIFIC_BASE',0x00010000) +F_DUPFD_CLOEXEC = Constant('F_DUPFD_CLOEXEC',67) +FD_CLOEXEC = Constant('FD_CLOEXEC',1) +F_RDLCK = Constant('F_RDLCK',1) +F_UNLCK = Constant('F_UNLCK',2) +F_WRLCK = Constant('F_WRLCK',3) +F_WAIT = Constant('F_WAIT',0x010) +F_FLOCK = Constant('F_FLOCK',0x020) +F_POSIX = Constant('F_POSIX',0x040) +F_PROV = Constant('F_PROV',0x080) +F_WAKE1_SAFE = Constant('F_WAKE1_SAFE',0x100) +F_ABORT = Constant('F_ABORT',0x200) +F_OFD_LOCK = Constant('F_OFD_LOCK',0x400) +F_TRANSFER = Constant('F_TRANSFER',0x800) +F_CONFINED = Constant('F_CONFINED',0x1000) +F_ALLOCATECONTIG = Constant('F_ALLOCATECONTIG',0x00000002) +F_ALLOCATEALL = Constant('F_ALLOCATEALL',0x00000004) +F_ALLOCATEPERSIST = Constant('F_ALLOCATEPERSIST',0x00000008) +F_PEOFPOSMODE = Constant('F_PEOFPOSMODE',3) +F_VOLPOSMODE = Constant('F_VOLPOSMODE',4) +USER_FSIGNATURES_CDHASH_LEN = Constant('USER_FSIGNATURES_CDHASH_LEN',20) +GETSIGSINFO_PLATFORM_BINARY = Constant('GETSIGSINFO_PLATFORM_BINARY',1) +LOCK_SH = Constant('LOCK_SH',0x01) +LOCK_EX = Constant('LOCK_EX',0x02) +LOCK_NB = Constant('LOCK_NB',0x04) +LOCK_UN = Constant('LOCK_UN',0x08) +ATTRIBUTION_NAME_MAX = Constant('ATTRIBUTION_NAME_MAX',255) +F_CREATE_TAG = Constant('F_CREATE_TAG',0x00000001) +F_DELETE_TAG = Constant('F_DELETE_TAG',0x00000002) +F_QUERY_TAG = Constant('F_QUERY_TAG',0x00000004) +O_POPUP = Constant('O_POPUP',0x80000000) +O_ALERT = Constant('O_ALERT',0x20000000) +S_BLKSIZE = Constant('S_BLKSIZE',512) +UF_SETTABLE = Constant('UF_SETTABLE',0x0000ffff) +UF_NODUMP = Constant('UF_NODUMP',0x00000001) +UF_IMMUTABLE = Constant('UF_IMMUTABLE',0x00000002) +UF_APPEND = Constant('UF_APPEND',0x00000004) +UF_OPAQUE = Constant('UF_OPAQUE',0x00000008) +UF_COMPRESSED = Constant('UF_COMPRESSED',0x00000020) +UF_TRACKED = Constant('UF_TRACKED',0x00000040) +UF_DATAVAULT = Constant('UF_DATAVAULT',0x00000080) +UF_HIDDEN = Constant('UF_HIDDEN',0x00008000) +SF_SUPPORTED = Constant('SF_SUPPORTED',0x009f0000) +SF_SETTABLE = Constant('SF_SETTABLE',0x3fff0000) +SF_SYNTHETIC = Constant('SF_SYNTHETIC',0xc0000000) +SF_ARCHIVED = Constant('SF_ARCHIVED',0x00010000) +SF_IMMUTABLE = Constant('SF_IMMUTABLE',0x00020000) +SF_APPEND = Constant('SF_APPEND',0x00040000) +SF_RESTRICTED = Constant('SF_RESTRICTED',0x00080000) +SF_NOUNLINK = Constant('SF_NOUNLINK',0x00100000) +SF_FIRMLINK = Constant('SF_FIRMLINK',0x00800000) +SF_DATALESS = Constant('SF_DATALESS',0x40000000) +EF_MAY_SHARE_BLOCKS = Constant('EF_MAY_SHARE_BLOCKS',0x00000001) +EF_NO_XATTRS = Constant('EF_NO_XATTRS',0x00000002) +EF_IS_SYNC_ROOT = Constant('EF_IS_SYNC_ROOT',0x00000004) +EF_IS_PURGEABLE = Constant('EF_IS_PURGEABLE',0x00000008) +EF_IS_SPARSE = Constant('EF_IS_SPARSE',0x00000010) +EF_IS_SYNTHETIC = Constant('EF_IS_SYNTHETIC',0x00000020) +EF_SHARES_ALL_BLOCKS = Constant('EF_SHARES_ALL_BLOCKS',0x00000040) +MBUF_COPYALL = Constant('MBUF_COPYALL',1000000000) +__DARWIN_NSIG = Constant('__DARWIN_NSIG',32) +SIGHUP = Constant('SIGHUP',1) +SIGINT = Constant('SIGINT',2) +SIGQUIT = Constant('SIGQUIT',3) +SIGILL = Constant('SIGILL',4) +SIGTRAP = Constant('SIGTRAP',5) +SIGABRT = Constant('SIGABRT',6) +SIGPOLL = Constant('SIGPOLL',7) +SIGEMT = Constant('SIGEMT',7) +SIGFPE = Constant('SIGFPE',8) +SIGKILL = Constant('SIGKILL',9) +SIGBUS = Constant('SIGBUS',10) +SIGSEGV = Constant('SIGSEGV',11) +SIGSYS = Constant('SIGSYS',12) +SIGPIPE = Constant('SIGPIPE',13) +SIGALRM = Constant('SIGALRM',14) +SIGTERM = Constant('SIGTERM',15) +SIGURG = Constant('SIGURG',16) +SIGSTOP = Constant('SIGSTOP',17) +SIGTSTP = Constant('SIGTSTP',18) +SIGCONT = Constant('SIGCONT',19) +SIGCHLD = Constant('SIGCHLD',20) +SIGTTIN = Constant('SIGTTIN',21) +SIGTTOU = Constant('SIGTTOU',22) +SIGIO = Constant('SIGIO',23) +SIGXCPU = Constant('SIGXCPU',24) +SIGXFSZ = Constant('SIGXFSZ',25) +SIGVTALRM = Constant('SIGVTALRM',26) +SIGPROF = Constant('SIGPROF',27) +SIGWINCH = Constant('SIGWINCH',28) +SIGINFO = Constant('SIGINFO',29) +SIGUSR1 = Constant('SIGUSR1',30) +SIGUSR2 = Constant('SIGUSR2',31) +SIGEV_NONE = Constant('SIGEV_NONE',0) +SIGEV_SIGNAL = Constant('SIGEV_SIGNAL',1) +SIGEV_THREAD = Constant('SIGEV_THREAD',3) +ILL_NOOP = Constant('ILL_NOOP',0) +ILL_ILLOPC = Constant('ILL_ILLOPC',1) +ILL_ILLTRP = Constant('ILL_ILLTRP',2) +ILL_PRVOPC = Constant('ILL_PRVOPC',3) +ILL_ILLOPN = Constant('ILL_ILLOPN',4) +ILL_ILLADR = Constant('ILL_ILLADR',5) +ILL_PRVREG = Constant('ILL_PRVREG',6) +ILL_COPROC = Constant('ILL_COPROC',7) +ILL_BADSTK = Constant('ILL_BADSTK',8) +FPE_NOOP = Constant('FPE_NOOP',0) +FPE_FLTDIV = Constant('FPE_FLTDIV',1) +FPE_FLTOVF = Constant('FPE_FLTOVF',2) +FPE_FLTUND = Constant('FPE_FLTUND',3) +FPE_FLTRES = Constant('FPE_FLTRES',4) +FPE_FLTINV = Constant('FPE_FLTINV',5) +FPE_FLTSUB = Constant('FPE_FLTSUB',6) +FPE_INTDIV = Constant('FPE_INTDIV',7) +FPE_INTOVF = Constant('FPE_INTOVF',8) +SEGV_NOOP = Constant('SEGV_NOOP',0) +SEGV_MAPERR = Constant('SEGV_MAPERR',1) +SEGV_ACCERR = Constant('SEGV_ACCERR',2) +BUS_NOOP = Constant('BUS_NOOP',0) +BUS_ADRALN = Constant('BUS_ADRALN',1) +BUS_ADRERR = Constant('BUS_ADRERR',2) +BUS_OBJERR = Constant('BUS_OBJERR',3) +TRAP_BRKPT = Constant('TRAP_BRKPT',1) +TRAP_TRACE = Constant('TRAP_TRACE',2) +CLD_NOOP = Constant('CLD_NOOP',0) +CLD_EXITED = Constant('CLD_EXITED',1) +CLD_KILLED = Constant('CLD_KILLED',2) +CLD_DUMPED = Constant('CLD_DUMPED',3) +CLD_TRAPPED = Constant('CLD_TRAPPED',4) +CLD_STOPPED = Constant('CLD_STOPPED',5) +CLD_CONTINUED = Constant('CLD_CONTINUED',6) +POLL_IN = Constant('POLL_IN',1) +POLL_OUT = Constant('POLL_OUT',2) +POLL_MSG = Constant('POLL_MSG',3) +POLL_ERR = Constant('POLL_ERR',4) +POLL_PRI = Constant('POLL_PRI',5) +POLL_HUP = Constant('POLL_HUP',6) +SA_ONSTACK = Constant('SA_ONSTACK',0x0001) +SA_RESTART = Constant('SA_RESTART',0x0002) +SA_RESETHAND = Constant('SA_RESETHAND',0x0004) +SA_NOCLDSTOP = Constant('SA_NOCLDSTOP',0x0008) +SA_NODEFER = Constant('SA_NODEFER',0x0010) +SA_NOCLDWAIT = Constant('SA_NOCLDWAIT',0x0020) +SA_SIGINFO = Constant('SA_SIGINFO',0x0040) +SA_USERTRAMP = Constant('SA_USERTRAMP',0x0100) +SA_64REGSET = Constant('SA_64REGSET',0x0200) +SIG_BLOCK = Constant('SIG_BLOCK',1) +SIG_UNBLOCK = Constant('SIG_UNBLOCK',2) +SIG_SETMASK = Constant('SIG_SETMASK',3) +SI_USER = Constant('SI_USER',0x10001) +SI_QUEUE = Constant('SI_QUEUE',0x10002) +SI_TIMER = Constant('SI_TIMER',0x10003) +SI_ASYNCIO = Constant('SI_ASYNCIO',0x10004) +SI_MESGQ = Constant('SI_MESGQ',0x10005) +SS_ONSTACK = Constant('SS_ONSTACK',0x0001) +SS_DISABLE = Constant('SS_DISABLE',0x0004) +MINSIGSTKSZ = Constant('MINSIGSTKSZ',32768) +SIGSTKSZ = Constant('SIGSTKSZ',131072) +__DARWIN_MAXNAMLEN = Constant('__DARWIN_MAXNAMLEN',255) +__DARWIN_MAXPATHLEN = Constant('__DARWIN_MAXPATHLEN',1024) +DT_UNKNOWN = Constant('DT_UNKNOWN',0) +DT_FIFO = Constant('DT_FIFO',1) +DT_CHR = Constant('DT_CHR',2) +DT_DIR = Constant('DT_DIR',4) +DT_BLK = Constant('DT_BLK',6) +DT_REG = Constant('DT_REG',8) +DT_LNK = Constant('DT_LNK',10) +DT_SOCK = Constant('DT_SOCK',12) +DT_WHT = Constant('DT_WHT',14) +POSIX_SPAWN_RESETIDS = Constant('POSIX_SPAWN_RESETIDS',0x0001) +POSIX_SPAWN_SETPGROUP = Constant('POSIX_SPAWN_SETPGROUP',0x0002) +POSIX_SPAWN_SETSIGDEF = Constant('POSIX_SPAWN_SETSIGDEF',0x0004) +POSIX_SPAWN_SETSIGMASK = Constant('POSIX_SPAWN_SETSIGMASK',0x0008) +POSIX_SPAWN_SETSCHEDPARAM = Constant('POSIX_SPAWN_SETSCHEDPARAM',0x0010) +POSIX_SPAWN_SETSCHEDULER = Constant('POSIX_SPAWN_SETSCHEDULER',0x0020) +POSIX_SPAWN_SETEXEC = Constant('POSIX_SPAWN_SETEXEC',0x0040) +POSIX_SPAWN_START_SUSPENDED = Constant('POSIX_SPAWN_START_SUSPENDED',0x0080) +POSIX_SPAWN_SETSID = Constant('POSIX_SPAWN_SETSID',0x0400) +POSIX_SPAWN_CLOEXEC_DEFAULT = Constant('POSIX_SPAWN_CLOEXEC_DEFAULT',0x4000) +_POSIX_SPAWN_RESLIDE = Constant('_POSIX_SPAWN_RESLIDE',0x0800) +POSIX_SPAWN_PCONTROL_NONE = Constant('POSIX_SPAWN_PCONTROL_NONE',0x0000) +POSIX_SPAWN_PCONTROL_THROTTLE = Constant('POSIX_SPAWN_PCONTROL_THROTTLE',0x0001) +POSIX_SPAWN_PCONTROL_SUSPEND = Constant('POSIX_SPAWN_PCONTROL_SUSPEND',0x0002) +POSIX_SPAWN_PCONTROL_KILL = Constant('POSIX_SPAWN_PCONTROL_KILL',0x0003) +POSIX_SPAWN_PANIC_ON_CRASH = Constant('POSIX_SPAWN_PANIC_ON_CRASH',0x1) +POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT = Constant('POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT',0x2) +POSIX_SPAWN_PANIC_ON_EXIT = Constant('POSIX_SPAWN_PANIC_ON_EXIT',0x4) +POSIX_SPAWN_PANIC_ON_SPAWN_FAIL = Constant('POSIX_SPAWN_PANIC_ON_SPAWN_FAIL',0x8) +PROT_NONE = Constant('PROT_NONE',0x00) +PROT_READ = Constant('PROT_READ',0x01) +PROT_WRITE = Constant('PROT_WRITE',0x02) +PROT_EXEC = Constant('PROT_EXEC',0x04) +MAP_SHARED = Constant('MAP_SHARED',0x0001) +MAP_PRIVATE = Constant('MAP_PRIVATE',0x0002) +MAP_FIXED = Constant('MAP_FIXED',0x0010) +MAP_RENAME = Constant('MAP_RENAME',0x0020) +MAP_NORESERVE = Constant('MAP_NORESERVE',0x0040) +MAP_RESERVED0080 = Constant('MAP_RESERVED0080',0x0080) +MAP_NOEXTEND = Constant('MAP_NOEXTEND',0x0100) +MAP_HASSEMAPHORE = Constant('MAP_HASSEMAPHORE',0x0200) +MAP_NOCACHE = Constant('MAP_NOCACHE',0x0400) +MAP_JIT = Constant('MAP_JIT',0x0800) +MAP_FILE = Constant('MAP_FILE',0x0000) +MAP_ANON = Constant('MAP_ANON',0x1000) +MAP_RESILIENT_CODESIGN = Constant('MAP_RESILIENT_CODESIGN',0x2000) +MAP_RESILIENT_MEDIA = Constant('MAP_RESILIENT_MEDIA',0x4000) +MAP_32BIT = Constant('MAP_32BIT',0x8000) +MAP_TRANSLATED_ALLOW_EXECUTE = Constant('MAP_TRANSLATED_ALLOW_EXECUTE',0x20000) +MAP_UNIX03 = Constant('MAP_UNIX03',0x40000) +MAP_TPRO = Constant('MAP_TPRO',0x80000) +MCL_CURRENT = Constant('MCL_CURRENT',0x0001) +MCL_FUTURE = Constant('MCL_FUTURE',0x0002) +MS_ASYNC = Constant('MS_ASYNC',0x0001) +MS_INVALIDATE = Constant('MS_INVALIDATE',0x0002) +MS_SYNC = Constant('MS_SYNC',0x0010) +MS_KILLPAGES = Constant('MS_KILLPAGES',0x0004) +MS_DEACTIVATE = Constant('MS_DEACTIVATE',0x0008) +POSIX_MADV_NORMAL = Constant('POSIX_MADV_NORMAL',0) +POSIX_MADV_RANDOM = Constant('POSIX_MADV_RANDOM',1) +POSIX_MADV_SEQUENTIAL = Constant('POSIX_MADV_SEQUENTIAL',2) +POSIX_MADV_WILLNEED = Constant('POSIX_MADV_WILLNEED',3) +POSIX_MADV_DONTNEED = Constant('POSIX_MADV_DONTNEED',4) +MADV_FREE = Constant('MADV_FREE',5) +MADV_ZERO_WIRED_PAGES = Constant('MADV_ZERO_WIRED_PAGES',6) +MADV_FREE_REUSABLE = Constant('MADV_FREE_REUSABLE',7) +MADV_FREE_REUSE = Constant('MADV_FREE_REUSE',8) +MADV_CAN_REUSE = Constant('MADV_CAN_REUSE',9) +MADV_PAGEOUT = Constant('MADV_PAGEOUT',10) +MINCORE_INCORE = Constant('MINCORE_INCORE',0x1) +MINCORE_REFERENCED = Constant('MINCORE_REFERENCED',0x2) +MINCORE_MODIFIED = Constant('MINCORE_MODIFIED',0x4) +MINCORE_REFERENCED_OTHER = Constant('MINCORE_REFERENCED_OTHER',0x8) +MINCORE_MODIFIED_OTHER = Constant('MINCORE_MODIFIED_OTHER',0x10) +MINCORE_PAGED_OUT = Constant('MINCORE_PAGED_OUT',0x20) +MINCORE_COPIED = Constant('MINCORE_COPIED',0x40) +MINCORE_ANONYMOUS = Constant('MINCORE_ANONYMOUS',0x80) +B_WRITE = Constant('B_WRITE',0x00000000) +B_READ = Constant('B_READ',0x00000001) +B_ASYNC = Constant('B_ASYNC',0x00000002) +B_NOCACHE = Constant('B_NOCACHE',0x00000004) +B_DELWRI = Constant('B_DELWRI',0x00000008) +B_LOCKED = Constant('B_LOCKED',0x00000010) +B_PHYS = Constant('B_PHYS',0x00000020) +B_CLUSTER = Constant('B_CLUSTER',0x00000040) +B_PAGEIO = Constant('B_PAGEIO',0x00000080) +B_META = Constant('B_META',0x00000100) +B_RAW = Constant('B_RAW',0x00000200) +B_FUA = Constant('B_FUA',0x00000400) +B_PASSIVE = Constant('B_PASSIVE',0x00000800) +B_IOSTREAMING = Constant('B_IOSTREAMING',0x00001000) +B_THROTTLED_IO = Constant('B_THROTTLED_IO',0x00002000) +B_ENCRYPTED_IO = Constant('B_ENCRYPTED_IO',0x00004000) +B_STATICCONTENT = Constant('B_STATICCONTENT',0x00008000) +BUF_WAIT = Constant('BUF_WAIT',0x01) +BUF_WRITE_DATA = Constant('BUF_WRITE_DATA',0x0001) +BUF_SKIP_META = Constant('BUF_SKIP_META',0x0002) +BUF_INVALIDATE_LOCKED = Constant('BUF_INVALIDATE_LOCKED',0x0004) +BUF_SKIP_NONLOCKED = Constant('BUF_SKIP_NONLOCKED',0x01) +BUF_SKIP_LOCKED = Constant('BUF_SKIP_LOCKED',0x02) +BUF_SCAN_CLEAN = Constant('BUF_SCAN_CLEAN',0x04) +BUF_SCAN_DIRTY = Constant('BUF_SCAN_DIRTY',0x08) +BUF_NOTIFY_BUSY = Constant('BUF_NOTIFY_BUSY',0x10) +BUF_RETURNED = Constant('BUF_RETURNED',0) +BUF_RETURNED_DONE = Constant('BUF_RETURNED_DONE',1) +BUF_CLAIMED = Constant('BUF_CLAIMED',2) +BUF_CLAIMED_DONE = Constant('BUF_CLAIMED_DONE',3) +BLK_READ = Constant('BLK_READ',0x01) +BLK_WRITE = Constant('BLK_WRITE',0x02) +BLK_META = Constant('BLK_META',0x10) +BLK_ONLYVALID = Constant('BLK_ONLYVALID',0x80000000) +LOG_EMERG = Constant('LOG_EMERG',0) +LOG_ALERT = Constant('LOG_ALERT',1) +LOG_CRIT = Constant('LOG_CRIT',2) +LOG_ERR = Constant('LOG_ERR',3) +LOG_WARNING = Constant('LOG_WARNING',4) +LOG_NOTICE = Constant('LOG_NOTICE',5) +LOG_INFO = Constant('LOG_INFO',6) +LOG_DEBUG = Constant('LOG_DEBUG',7) +LOG_PRIMASK = Constant('LOG_PRIMASK',0x07) +INTERNAL_NOPRI = Constant('INTERNAL_NOPRI',0x10) +LOG_NFACILITIES = Constant('LOG_NFACILITIES',25) +LOG_FACMASK = Constant('LOG_FACMASK',0x03f8) +LOG_PID = Constant('LOG_PID',0x01) +LOG_CONS = Constant('LOG_CONS',0x02) +LOG_ODELAY = Constant('LOG_ODELAY',0x04) +LOG_NDELAY = Constant('LOG_NDELAY',0x08) +LOG_NOWAIT = Constant('LOG_NOWAIT',0x10) +LOG_PERROR = Constant('LOG_PERROR',0x20) +CRF_NOMEMBERD = Constant('CRF_NOMEMBERD',0x00000001) +CRF_MAC_ENFORCE = Constant('CRF_MAC_ENFORCE',0x00000002) +XUCRED_VERSION = Constant('XUCRED_VERSION',0) +DK_FEATURE_BARRIER = Constant('DK_FEATURE_BARRIER',0x00000002) +DK_FEATURE_PRIORITY = Constant('DK_FEATURE_PRIORITY',0x00000004) +DK_FEATURE_UNMAP = Constant('DK_FEATURE_UNMAP',0x00000010) +DK_SYNCHRONIZE_OPTION_BARRIER = Constant('DK_SYNCHRONIZE_OPTION_BARRIER',0x00000002) +DK_CORESTORAGE_PIN_YOUR_METADATA = Constant('DK_CORESTORAGE_PIN_YOUR_METADATA',0x00000001) +DK_CORESTORAGE_ENABLE_HOTFILES = Constant('DK_CORESTORAGE_ENABLE_HOTFILES',0x00000002) +DK_CORESTORAGE_PIN_YOUR_SWAPFILE = Constant('DK_CORESTORAGE_PIN_YOUR_SWAPFILE',0x00000004) +DK_PROVISION_TYPE_MAPPED = Constant('DK_PROVISION_TYPE_MAPPED',0x00) +DK_PROVISION_TYPE_DEALLOCATED = Constant('DK_PROVISION_TYPE_DEALLOCATED',0x01) +DK_PROVISION_TYPE_ANCHORED = Constant('DK_PROVISION_TYPE_ANCHORED',0x02) +DK_LOCATION_INTERNAL = Constant('DK_LOCATION_INTERNAL',0x00000000) +DK_LOCATION_EXTERNAL = Constant('DK_LOCATION_EXTERNAL',0x00000001) +DK_FEATURE_FORCE_UNIT_ACCESS = Constant('DK_FEATURE_FORCE_UNIT_ACCESS',0x00000001) +DK_ENCRYPTION_TYPE_AES_CBC = Constant('DK_ENCRYPTION_TYPE_AES_CBC',1) +DK_ENCRYPTION_TYPE_AES_XEX = Constant('DK_ENCRYPTION_TYPE_AES_XEX',2) +DK_ENCRYPTION_TYPE_AES_XTS = Constant('DK_ENCRYPTION_TYPE_AES_XTS',3) +DK_TIER_MASK = Constant('DK_TIER_MASK',0xC0) +DK_TIER_SHIFT = Constant('DK_TIER_SHIFT',6) +SOL_LOCAL = Constant('SOL_LOCAL',0) +LOCAL_PEERCRED = Constant('LOCAL_PEERCRED',0x001) +LOCAL_PEERPID = Constant('LOCAL_PEERPID',0x002) +LOCAL_PEEREPID = Constant('LOCAL_PEEREPID',0x003) +LOCAL_PEERUUID = Constant('LOCAL_PEERUUID',0x004) +LOCAL_PEEREUUID = Constant('LOCAL_PEEREUUID',0x005) +LOCAL_PEERTOKEN = Constant('LOCAL_PEERTOKEN',0x006) +_SYS_TIMEX_H_ = Constant('_SYS_TIMEX_H_',1) +NTP_API = Constant('NTP_API',4) +MINSEC = Constant('MINSEC',256) +MAXSEC = Constant('MAXSEC',2048) +MAXTC = Constant('MAXTC',10) +MOD_OFFSET = Constant('MOD_OFFSET',0x0001) +MOD_FREQUENCY = Constant('MOD_FREQUENCY',0x0002) +MOD_MAXERROR = Constant('MOD_MAXERROR',0x0004) +MOD_ESTERROR = Constant('MOD_ESTERROR',0x0008) +MOD_STATUS = Constant('MOD_STATUS',0x0010) +MOD_TIMECONST = Constant('MOD_TIMECONST',0x0020) +MOD_PPSMAX = Constant('MOD_PPSMAX',0x0040) +MOD_TAI = Constant('MOD_TAI',0x0080) +MOD_MICRO = Constant('MOD_MICRO',0x1000) +MOD_NANO = Constant('MOD_NANO',0x2000) +MOD_CLKB = Constant('MOD_CLKB',0x4000) +MOD_CLKA = Constant('MOD_CLKA',0x8000) +STA_PLL = Constant('STA_PLL',0x0001) +STA_PPSFREQ = Constant('STA_PPSFREQ',0x0002) +STA_PPSTIME = Constant('STA_PPSTIME',0x0004) +STA_FLL = Constant('STA_FLL',0x0008) +STA_INS = Constant('STA_INS',0x0010) +STA_DEL = Constant('STA_DEL',0x0020) +STA_UNSYNC = Constant('STA_UNSYNC',0x0040) +STA_FREQHOLD = Constant('STA_FREQHOLD',0x0080) +STA_PPSSIGNAL = Constant('STA_PPSSIGNAL',0x0100) +STA_PPSJITTER = Constant('STA_PPSJITTER',0x0200) +STA_PPSWANDER = Constant('STA_PPSWANDER',0x0400) +STA_PPSERROR = Constant('STA_PPSERROR',0x0800) +STA_CLOCKERR = Constant('STA_CLOCKERR',0x1000) +STA_NANO = Constant('STA_NANO',0x2000) +STA_MODE = Constant('STA_MODE',0x4000) +STA_CLK = Constant('STA_CLK',0x8000) +TIME_OK = Constant('TIME_OK',0) +TIME_INS = Constant('TIME_INS',1) +TIME_DEL = Constant('TIME_DEL',2) +TIME_OOP = Constant('TIME_OOP',3) +TIME_WAIT = Constant('TIME_WAIT',4) +TIME_ERROR = Constant('TIME_ERROR',5) +MT_FREE = Constant('MT_FREE',0) +MT_DATA = Constant('MT_DATA',1) +MT_HEADER = Constant('MT_HEADER',2) +MT_SOCKET = Constant('MT_SOCKET',3) +MT_PCB = Constant('MT_PCB',4) +MT_RTABLE = Constant('MT_RTABLE',5) +MT_HTABLE = Constant('MT_HTABLE',6) +MT_ATABLE = Constant('MT_ATABLE',7) +MT_SONAME = Constant('MT_SONAME',8) +MT_SOOPTS = Constant('MT_SOOPTS',10) +MT_FTABLE = Constant('MT_FTABLE',11) +MT_RIGHTS = Constant('MT_RIGHTS',12) +MT_IFADDR = Constant('MT_IFADDR',13) +MT_CONTROL = Constant('MT_CONTROL',14) +MT_OOBDATA = Constant('MT_OOBDATA',15) +MT_TAG = Constant('MT_TAG',16) +MT_MAX = Constant('MT_MAX',32) +MAX_MBUF_CNAME = Constant('MAX_MBUF_CNAME',15) +MCS_DISABLED = Constant('MCS_DISABLED',0) +MCS_ONLINE = Constant('MCS_ONLINE',1) +MCS_PURGING = Constant('MCS_PURGING',2) +MCS_OFFLINE = Constant('MCS_OFFLINE',3) +MSG_NOERROR = Constant('MSG_NOERROR',0o010000) +MSGSSZ = Constant('MSGSSZ',8) +MSGSEG = Constant('MSGSEG',2048) +MSGMNB = Constant('MSGMNB',2048) +MSGMNI = Constant('MSGMNI',40) +MSGTQL = Constant('MSGTQL',40) +MSG_LOCKED = Constant('MSG_LOCKED',0o01000) +DBG_MACH = Constant('DBG_MACH',1) +DBG_NETWORK = Constant('DBG_NETWORK',2) +DBG_FSYSTEM = Constant('DBG_FSYSTEM',3) +DBG_BSD = Constant('DBG_BSD',4) +DBG_IOKIT = Constant('DBG_IOKIT',5) +DBG_DRIVERS = Constant('DBG_DRIVERS',6) +DBG_TRACE = Constant('DBG_TRACE',7) +DBG_DLIL = Constant('DBG_DLIL',8) +DBG_PTHREAD = Constant('DBG_PTHREAD',9) +DBG_CORESTORAGE = Constant('DBG_CORESTORAGE',10) +DBG_CG = Constant('DBG_CG',11) +DBG_MONOTONIC = Constant('DBG_MONOTONIC',12) +DBG_MISC = Constant('DBG_MISC',20) +DBG_SECURITY = Constant('DBG_SECURITY',30) +DBG_DYLD = Constant('DBG_DYLD',31) +DBG_QT = Constant('DBG_QT',32) +DBG_APPS = Constant('DBG_APPS',33) +DBG_LAUNCHD = Constant('DBG_LAUNCHD',34) +DBG_SILICON = Constant('DBG_SILICON',35) +DBG_PERF = Constant('DBG_PERF',37) +DBG_IMPORTANCE = Constant('DBG_IMPORTANCE',38) +DBG_BANK = Constant('DBG_BANK',40) +DBG_XPC = Constant('DBG_XPC',41) +DBG_ATM = Constant('DBG_ATM',42) +DBG_ARIADNE = Constant('DBG_ARIADNE',43) +DBG_DAEMON = Constant('DBG_DAEMON',44) +DBG_ENERGYTRACE = Constant('DBG_ENERGYTRACE',45) +DBG_DISPATCH = Constant('DBG_DISPATCH',46) +DBG_IMG = Constant('DBG_IMG',49) +DBG_UMALLOC = Constant('DBG_UMALLOC',51) +DBG_TURNSTILE = Constant('DBG_TURNSTILE',53) +DBG_AUDIO = Constant('DBG_AUDIO',54) +DBG_MIG = Constant('DBG_MIG',255) +DBG_MACH_EXCP_KTRAP_x86 = Constant('DBG_MACH_EXCP_KTRAP_x86',0x02) +DBG_MACH_EXCP_DFLT = Constant('DBG_MACH_EXCP_DFLT',0x03) +DBG_MACH_EXCP_SYNC_ARM = Constant('DBG_MACH_EXCP_SYNC_ARM',0x03) +DBG_MACH_EXCP_IFLT = Constant('DBG_MACH_EXCP_IFLT',0x04) +DBG_MACH_EXCP_SERR_ARM = Constant('DBG_MACH_EXCP_SERR_ARM',0x04) +DBG_MACH_EXCP_INTR = Constant('DBG_MACH_EXCP_INTR',0x05) +DBG_MACH_EXCP_ALNG = Constant('DBG_MACH_EXCP_ALNG',0x06) +DBG_MACH_EXCP_UTRAP_x86 = Constant('DBG_MACH_EXCP_UTRAP_x86',0x07) +DBG_MACH_EXCP_FP = Constant('DBG_MACH_EXCP_FP',0x08) +DBG_MACH_EXCP_DECI = Constant('DBG_MACH_EXCP_DECI',0x09) +DBG_MACH_CHUD = Constant('DBG_MACH_CHUD',0x0A) +DBG_MACH_SIGNPOST = Constant('DBG_MACH_SIGNPOST',0x0A) +DBG_MACH_EXCP_SC = Constant('DBG_MACH_EXCP_SC',0x0C) +DBG_MACH_EXCP_TRACE = Constant('DBG_MACH_EXCP_TRACE',0x0D) +DBG_MACH_EXCP_EMUL = Constant('DBG_MACH_EXCP_EMUL',0x0E) +DBG_MACH_IHDLR = Constant('DBG_MACH_IHDLR',0x10) +DBG_MACH_IPC = Constant('DBG_MACH_IPC',0x20) +DBG_MACH_RESOURCE = Constant('DBG_MACH_RESOURCE',0x25) +DBG_MACH_VM = Constant('DBG_MACH_VM',0x30) +DBG_MACH_LEAKS = Constant('DBG_MACH_LEAKS',0x31) +DBG_MACH_WORKINGSET = Constant('DBG_MACH_WORKINGSET',0x32) +DBG_MACH_SCHED = Constant('DBG_MACH_SCHED',0x40) +DBG_MACH_MSGID_INVALID = Constant('DBG_MACH_MSGID_INVALID',0x50) +DBG_MACH_LOCKS = Constant('DBG_MACH_LOCKS',0x60) +DBG_MACH_PMAP = Constant('DBG_MACH_PMAP',0x70) +DBG_MACH_CLOCK = Constant('DBG_MACH_CLOCK',0x80) +DBG_MACH_MP = Constant('DBG_MACH_MP',0x90) +DBG_MACH_VM_PRESSURE = Constant('DBG_MACH_VM_PRESSURE',0xA0) +DBG_MACH_STACKSHOT = Constant('DBG_MACH_STACKSHOT',0xA1) +DBG_MACH_SFI = Constant('DBG_MACH_SFI',0xA2) +DBG_MACH_ENERGY_PERF = Constant('DBG_MACH_ENERGY_PERF',0xA3) +DBG_MACH_SYSDIAGNOSE = Constant('DBG_MACH_SYSDIAGNOSE',0xA4) +DBG_MACH_ZALLOC = Constant('DBG_MACH_ZALLOC',0xA5) +DBG_MACH_THREAD_GROUP = Constant('DBG_MACH_THREAD_GROUP',0xA6) +DBG_MACH_COALITION = Constant('DBG_MACH_COALITION',0xA7) +DBG_MACH_SHAREDREGION = Constant('DBG_MACH_SHAREDREGION',0xA8) +DBG_MACH_SCHED_CLUTCH = Constant('DBG_MACH_SCHED_CLUTCH',0xA9) +DBG_MACH_IO = Constant('DBG_MACH_IO',0xAA) +DBG_MACH_WORKGROUP = Constant('DBG_MACH_WORKGROUP',0xAB) +DBG_MACH_HV = Constant('DBG_MACH_HV',0xAC) +DBG_MACH_KCOV = Constant('DBG_MACH_KCOV',0xAD) +DBG_MACH_MACHDEP_EXCP_SC_x86 = Constant('DBG_MACH_MACHDEP_EXCP_SC_x86',0xAE) +DBG_MACH_MACHDEP_EXCP_SC_ARM = Constant('DBG_MACH_MACHDEP_EXCP_SC_ARM',0xAF) +DBC_MACH_IO_MMIO_READ = Constant('DBC_MACH_IO_MMIO_READ',0x1) +DBC_MACH_IO_MMIO_WRITE = Constant('DBC_MACH_IO_MMIO_WRITE',0x2) +DBC_MACH_IO_PHYS_READ = Constant('DBC_MACH_IO_PHYS_READ',0x3) +DBC_MACH_IO_PHYS_WRITE = Constant('DBC_MACH_IO_PHYS_WRITE',0x4) +DBC_MACH_IO_PORTIO_READ = Constant('DBC_MACH_IO_PORTIO_READ',0x5) +DBC_MACH_IO_PORTIO_WRITE = Constant('DBC_MACH_IO_PORTIO_WRITE',0x6) +DBG_INTR_TYPE_UNKNOWN = Constant('DBG_INTR_TYPE_UNKNOWN',0x0) +DBG_INTR_TYPE_IPI = Constant('DBG_INTR_TYPE_IPI',0x1) +DBG_INTR_TYPE_TIMER = Constant('DBG_INTR_TYPE_TIMER',0x2) +DBG_INTR_TYPE_OTHER = Constant('DBG_INTR_TYPE_OTHER',0x3) +DBG_INTR_TYPE_PMI = Constant('DBG_INTR_TYPE_PMI',0x4) +DBG_INTR_TYPE_RSVD1 = Constant('DBG_INTR_TYPE_RSVD1',0x5) +MACH_SCHED = Constant('MACH_SCHED',0x0) +MACH_STACK_ATTACH = Constant('MACH_STACK_ATTACH',0x1) +MACH_STACK_HANDOFF = Constant('MACH_STACK_HANDOFF',0x2) +MACH_CALL_CONT = Constant('MACH_CALL_CONT',0x3) +MACH_CALLOUT = Constant('MACH_CALLOUT',0x4) +MACH_STACK_DETACH = Constant('MACH_STACK_DETACH',0x5) +MACH_MAKE_RUNNABLE = Constant('MACH_MAKE_RUNNABLE',0x6) +MACH_PROMOTE = Constant('MACH_PROMOTE',0x7) +MACH_DEMOTE = Constant('MACH_DEMOTE',0x8) +MACH_IDLE = Constant('MACH_IDLE',0x9) +MACH_STACK_DEPTH = Constant('MACH_STACK_DEPTH',0xa) +MACH_MOVED = Constant('MACH_MOVED',0xb) +MACH_PSET_LOAD_AVERAGE = Constant('MACH_PSET_LOAD_AVERAGE',0xc) +MACH_AMP_DEBUG = Constant('MACH_AMP_DEBUG',0xd) +MACH_FAILSAFE = Constant('MACH_FAILSAFE',0xe) +MACH_BLOCK = Constant('MACH_BLOCK',0xf) +MACH_WAIT = Constant('MACH_WAIT',0x10) +MACH_GET_URGENCY = Constant('MACH_GET_URGENCY',0x14) +MACH_URGENCY = Constant('MACH_URGENCY',0x15) +MACH_REDISPATCH = Constant('MACH_REDISPATCH',0x16) +MACH_REMOTE_AST = Constant('MACH_REMOTE_AST',0x17) +MACH_SCHED_CHOOSE_PROCESSOR = Constant('MACH_SCHED_CHOOSE_PROCESSOR',0x18) +MACH_DEEP_IDLE = Constant('MACH_DEEP_IDLE',0x19) +MACH_CPU_THROTTLE_DISABLE = Constant('MACH_CPU_THROTTLE_DISABLE',0x1b) +MACH_RW_PROMOTE = Constant('MACH_RW_PROMOTE',0x1c) +MACH_RW_DEMOTE = Constant('MACH_RW_DEMOTE',0x1d) +MACH_SCHED_MAINTENANCE = Constant('MACH_SCHED_MAINTENANCE',0x1f) +MACH_DISPATCH = Constant('MACH_DISPATCH',0x20) +MACH_QUANTUM_HANDOFF = Constant('MACH_QUANTUM_HANDOFF',0x21) +MACH_MULTIQ_DEQUEUE = Constant('MACH_MULTIQ_DEQUEUE',0x22) +MACH_SCHED_THREAD_SWITCH = Constant('MACH_SCHED_THREAD_SWITCH',0x23) +MACH_SCHED_SMT_BALANCE = Constant('MACH_SCHED_SMT_BALANCE',0x24) +MACH_REMOTE_DEFERRED_AST = Constant('MACH_REMOTE_DEFERRED_AST',0x25) +MACH_REMOTE_CANCEL_AST = Constant('MACH_REMOTE_CANCEL_AST',0x26) +MACH_SCHED_CHANGE_PRIORITY = Constant('MACH_SCHED_CHANGE_PRIORITY',0x27) +MACH_SCHED_UPDATE_REC_CORES = Constant('MACH_SCHED_UPDATE_REC_CORES',0x28) +MACH_STACK_WAIT = Constant('MACH_STACK_WAIT',0x29) +MACH_THREAD_BIND = Constant('MACH_THREAD_BIND',0x2a) +MACH_WAITQ_PROMOTE = Constant('MACH_WAITQ_PROMOTE',0x2b) +MACH_WAITQ_DEMOTE = Constant('MACH_WAITQ_DEMOTE',0x2c) +MACH_SCHED_LOAD = Constant('MACH_SCHED_LOAD',0x2d) +MACH_REC_CORES_FAILSAFE = Constant('MACH_REC_CORES_FAILSAFE',0x2e) +MACH_SCHED_QUANTUM_EXPIRED = Constant('MACH_SCHED_QUANTUM_EXPIRED',0x2f) +MACH_EXEC_PROMOTE = Constant('MACH_EXEC_PROMOTE',0x30) +MACH_EXEC_DEMOTE = Constant('MACH_EXEC_DEMOTE',0x31) +MACH_AMP_SIGNAL_SPILL = Constant('MACH_AMP_SIGNAL_SPILL',0x32) +MACH_AMP_STEAL = Constant('MACH_AMP_STEAL',0x33) +MACH_SCHED_LOAD_EFFECTIVE = Constant('MACH_SCHED_LOAD_EFFECTIVE',0x34) +MACH_QUIESCENT_COUNTER = Constant('MACH_QUIESCENT_COUNTER',0x38) +MACH_TURNSTILE_USER_CHANGE = Constant('MACH_TURNSTILE_USER_CHANGE',0x39) +MACH_AMP_RECOMMENDATION_CHANGE = Constant('MACH_AMP_RECOMMENDATION_CHANGE',0x3a) +MACH_AMP_PERFCTL_POLICY_CHANGE = Constant('MACH_AMP_PERFCTL_POLICY_CHANGE',0x3b) +MACH_TURNSTILE_KERNEL_CHANGE = Constant('MACH_TURNSTILE_KERNEL_CHANGE',0x40) +MACH_SCHED_WI_AUTO_JOIN = Constant('MACH_SCHED_WI_AUTO_JOIN',0x41) +MACH_SCHED_WI_DEFERRED_FINISH = Constant('MACH_SCHED_WI_DEFERRED_FINISH',0x42) +MACH_SET_RT_DEADLINE = Constant('MACH_SET_RT_DEADLINE',0x43) +MACH_CANCEL_RT_DEADLINE = Constant('MACH_CANCEL_RT_DEADLINE',0x44) +MACH_RT_SIGNAL_SPILL = Constant('MACH_RT_SIGNAL_SPILL',0x45) +MACH_RT_STEAL = Constant('MACH_RT_STEAL',0x46) +MACH_PENDING_AST_URGENT = Constant('MACH_PENDING_AST_URGENT',0x47) +MACH_SCHED_THREAD_SELECT = Constant('MACH_SCHED_THREAD_SELECT',0x48) +MACH_SCHED_NEXT_PROCESSOR = Constant('MACH_SCHED_NEXT_PROCESSOR',0x49) +MACH_PSET_AVG_EXEC_TIME = Constant('MACH_PSET_AVG_EXEC_TIME',0x50) +MACH_SUSPEND_USERSPACE = Constant('MACH_SUSPEND_USERSPACE',0x51) +MACH_PREEMPTION_EXPIRED = Constant('MACH_PREEMPTION_EXPIRED',0x52) +MACH_FLOOR_PROMOTE = Constant('MACH_FLOOR_PROMOTE',0x53) +MACH_FLOOR_DEMOTE = Constant('MACH_FLOOR_DEMOTE',0x54) +MACH_INT_MASKED_EXPIRED = Constant('MACH_INT_MASKED_EXPIRED',0x55) +MACH_INT_HANDLED_EXPIRED = Constant('MACH_INT_HANDLED_EXPIRED',0x56) +MACH_UPDATE_POWERED_CORES = Constant('MACH_UPDATE_POWERED_CORES',0x58) +MACH_MODE_DEMOTE_THROTTLED = Constant('MACH_MODE_DEMOTE_THROTTLED',0x59) +MACH_MODE_DEMOTE_FAILSAFE = Constant('MACH_MODE_DEMOTE_FAILSAFE',0x5a) +MACH_MODE_DEMOTE_RT_DISALLOWED = Constant('MACH_MODE_DEMOTE_RT_DISALLOWED',0x5b) +MACH_MODE_UNDEMOTE_THROTTLED = Constant('MACH_MODE_UNDEMOTE_THROTTLED',0x5c) +MACH_MODE_UNDEMOTE_FAILSAFE = Constant('MACH_MODE_UNDEMOTE_FAILSAFE',0x5d) +MACH_MODE_UNDEMOTE_RT_DISALLOWED = Constant('MACH_MODE_UNDEMOTE_RT_DISALLOWED',0x5e) +MACH_INT_MASKED_RESET = Constant('MACH_INT_MASKED_RESET',0x5f) +MACH_RT_DISALLOWED_WORK_INTERVAL = Constant('MACH_RT_DISALLOWED_WORK_INTERVAL',0x60) +MACH_SCHED_WI_EXTERNAL_WAKEUP = Constant('MACH_SCHED_WI_EXTERNAL_WAKEUP',0x61) +MACH_SCHED_AST_CHECK = Constant('MACH_SCHED_AST_CHECK',0x62) +MACH_SCHED_PREEMPT_TIMER_ACTIVE = Constant('MACH_SCHED_PREEMPT_TIMER_ACTIVE',0x63) +MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE = Constant('MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE',0x0) +MACH_SCHED_CLUTCH_TG_BUCKET_STATE = Constant('MACH_SCHED_CLUTCH_TG_BUCKET_STATE',0x1) +MACH_SCHED_CLUTCH_THREAD_SELECT = Constant('MACH_SCHED_CLUTCH_THREAD_SELECT',0x2) +MACH_SCHED_CLUTCH_THREAD_STATE = Constant('MACH_SCHED_CLUTCH_THREAD_STATE',0x3) +MACH_SCHED_CLUTCH_TG_BUCKET_PRI = Constant('MACH_SCHED_CLUTCH_TG_BUCKET_PRI',0x4) +MACH_SCHED_EDGE_CLUSTER_OVERLOAD = Constant('MACH_SCHED_EDGE_CLUSTER_OVERLOAD',0x5) +MACH_SCHED_EDGE_STEAL = Constant('MACH_SCHED_EDGE_STEAL',0x6) +MACH_SCHED_EDGE_REBAL_RUNNABLE = Constant('MACH_SCHED_EDGE_REBAL_RUNNABLE',0x7) +MACH_SCHED_EDGE_REBAL_RUNNING = Constant('MACH_SCHED_EDGE_REBAL_RUNNING',0x8) +MACH_SCHED_EDGE_SHOULD_YIELD = Constant('MACH_SCHED_EDGE_SHOULD_YIELD',0x9) +MACH_SCHED_CLUTCH_THR_COUNT = Constant('MACH_SCHED_CLUTCH_THR_COUNT',0xa) +MACH_SCHED_EDGE_LOAD_AVG = Constant('MACH_SCHED_EDGE_LOAD_AVG',0xb) +MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD = Constant('MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD',0xc) +MACH_SCHED_EDGE_RSRC_HEAVY_THREAD = Constant('MACH_SCHED_EDGE_RSRC_HEAVY_THREAD',0xd) +MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE = Constant('MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE',0xe) +WORKGROUP_INTERVAL_CREATE = Constant('WORKGROUP_INTERVAL_CREATE',0x0) +WORKGROUP_INTERVAL_DESTROY = Constant('WORKGROUP_INTERVAL_DESTROY',0x1) +WORKGROUP_INTERVAL_CHANGE = Constant('WORKGROUP_INTERVAL_CHANGE',0x2) +WORKGROUP_INTERVAL_START = Constant('WORKGROUP_INTERVAL_START',0x3) +WORKGROUP_INTERVAL_UPDATE = Constant('WORKGROUP_INTERVAL_UPDATE',0x4) +WORKGROUP_INTERVAL_FINISH = Constant('WORKGROUP_INTERVAL_FINISH',0x5) +WORKGROUP_INTERVAL_SET_WORKLOAD_ID = Constant('WORKGROUP_INTERVAL_SET_WORKLOAD_ID',0x6) +WORKGROUP_INTERVAL_SET_WORKLOAD_ID_NAME = Constant('WORKGROUP_INTERVAL_SET_WORKLOAD_ID_NAME',0x7) +KCOV_STKSZ_THRESHOLD_ABOVE = Constant('KCOV_STKSZ_THRESHOLD_ABOVE',0x0) +KCOV_STKSZ_THRESHOLD_BELOW = Constant('KCOV_STKSZ_THRESHOLD_BELOW',0x1) +MACH_MULTIQ_BOUND = Constant('MACH_MULTIQ_BOUND',1) +MACH_MULTIQ_GROUP = Constant('MACH_MULTIQ_GROUP',2) +MACH_MULTIQ_GLOBAL = Constant('MACH_MULTIQ_GLOBAL',3) +DBG_ZERO_FILL_FAULT = Constant('DBG_ZERO_FILL_FAULT',1) +DBG_PAGEIN_FAULT = Constant('DBG_PAGEIN_FAULT',2) +DBG_COW_FAULT = Constant('DBG_COW_FAULT',3) +DBG_CACHE_HIT_FAULT = Constant('DBG_CACHE_HIT_FAULT',4) +DBG_NZF_PAGE_FAULT = Constant('DBG_NZF_PAGE_FAULT',5) +DBG_GUARD_FAULT = Constant('DBG_GUARD_FAULT',6) +DBG_PAGEINV_FAULT = Constant('DBG_PAGEINV_FAULT',7) +DBG_PAGEIND_FAULT = Constant('DBG_PAGEIND_FAULT',8) +DBG_COMPRESSOR_FAULT = Constant('DBG_COMPRESSOR_FAULT',9) +DBG_COMPRESSOR_SWAPIN_FAULT = Constant('DBG_COMPRESSOR_SWAPIN_FAULT',10) +DBG_COR_FAULT = Constant('DBG_COR_FAULT',11) +MACH_TASK_SUSPEND = Constant('MACH_TASK_SUSPEND',0x0) +MACH_TASK_RESUME = Constant('MACH_TASK_RESUME',0x1) +MACH_THREAD_SET_VOUCHER = Constant('MACH_THREAD_SET_VOUCHER',0x2) +MACH_IPC_MSG_SEND = Constant('MACH_IPC_MSG_SEND',0x3) +MACH_IPC_MSG_RECV = Constant('MACH_IPC_MSG_RECV',0x4) +MACH_IPC_MSG_RECV_VOUCHER_REFUSED = Constant('MACH_IPC_MSG_RECV_VOUCHER_REFUSED',0x5) +MACH_IPC_KMSG_FREE = Constant('MACH_IPC_KMSG_FREE',0x6) +MACH_IPC_VOUCHER_CREATE = Constant('MACH_IPC_VOUCHER_CREATE',0x7) +MACH_IPC_VOUCHER_CREATE_ATTR_DATA = Constant('MACH_IPC_VOUCHER_CREATE_ATTR_DATA',0x8) +MACH_IPC_VOUCHER_DESTROY = Constant('MACH_IPC_VOUCHER_DESTROY',0x9) +MACH_IPC_KMSG_INFO = Constant('MACH_IPC_KMSG_INFO',0xa) +MACH_IPC_KMSG_LINK = Constant('MACH_IPC_KMSG_LINK',0xb) +MACH_IPC_PORT_ENTRY_MODIFY = Constant('MACH_IPC_PORT_ENTRY_MODIFY',0xc) +MACH_IPC_DESTROY_GUARDED_DESC = Constant('MACH_IPC_DESTROY_GUARDED_DESC',0xd) +MACH_THREAD_GROUP_NEW = Constant('MACH_THREAD_GROUP_NEW',0x0) +MACH_THREAD_GROUP_FREE = Constant('MACH_THREAD_GROUP_FREE',0x1) +MACH_THREAD_GROUP_SET = Constant('MACH_THREAD_GROUP_SET',0x2) +MACH_THREAD_GROUP_NAME = Constant('MACH_THREAD_GROUP_NAME',0x3) +MACH_THREAD_GROUP_NAME_FREE = Constant('MACH_THREAD_GROUP_NAME_FREE',0x4) +MACH_THREAD_GROUP_FLAGS = Constant('MACH_THREAD_GROUP_FLAGS',0x5) +MACH_THREAD_GROUP_BLOCK = Constant('MACH_THREAD_GROUP_BLOCK',0x6) +MACH_THREAD_GROUP_PREADOPT = Constant('MACH_THREAD_GROUP_PREADOPT',0x7) +MACH_THREAD_GROUP_PREADOPT_NEXTTIME = Constant('MACH_THREAD_GROUP_PREADOPT_NEXTTIME',0x8) +MACH_THREAD_GROUP_PREADOPT_CLEAR = Constant('MACH_THREAD_GROUP_PREADOPT_CLEAR',0x9) +MACH_THREAD_GROUP_PREADOPT_NA = Constant('MACH_THREAD_GROUP_PREADOPT_NA',0xa) +MACH_COALITION_NEW = Constant('MACH_COALITION_NEW',0x0) +MACH_COALITION_FREE = Constant('MACH_COALITION_FREE',0x1) +MACH_COALITION_ADOPT = Constant('MACH_COALITION_ADOPT',0x2) +MACH_COALITION_REMOVE = Constant('MACH_COALITION_REMOVE',0x3) +MACH_COALITION_THREAD_GROUP_SET = Constant('MACH_COALITION_THREAD_GROUP_SET',0x4) +PMAP__CREATE = Constant('PMAP__CREATE',0x0) +PMAP__DESTROY = Constant('PMAP__DESTROY',0x1) +PMAP__PROTECT = Constant('PMAP__PROTECT',0x2) +PMAP__PAGE_PROTECT = Constant('PMAP__PAGE_PROTECT',0x3) +PMAP__ENTER = Constant('PMAP__ENTER',0x4) +PMAP__REMOVE = Constant('PMAP__REMOVE',0x5) +PMAP__NEST = Constant('PMAP__NEST',0x6) +PMAP__UNNEST = Constant('PMAP__UNNEST',0x7) +PMAP__FLUSH_TLBS = Constant('PMAP__FLUSH_TLBS',0x8) +PMAP__UPDATE_INTERRUPT = Constant('PMAP__UPDATE_INTERRUPT',0x9) +PMAP__ATTRIBUTE_CLEAR = Constant('PMAP__ATTRIBUTE_CLEAR',0xa) +PMAP__REUSABLE = Constant('PMAP__REUSABLE',0xb) +PMAP__QUERY_RESIDENT = Constant('PMAP__QUERY_RESIDENT',0xc) +PMAP__FLUSH_KERN_TLBS = Constant('PMAP__FLUSH_KERN_TLBS',0xd) +PMAP__FLUSH_DELAYED_TLBS = Constant('PMAP__FLUSH_DELAYED_TLBS',0xe) +PMAP__FLUSH_TLBS_TO = Constant('PMAP__FLUSH_TLBS_TO',0xf) +PMAP__FLUSH_EPT = Constant('PMAP__FLUSH_EPT',0x10) +PMAP__FAST_FAULT = Constant('PMAP__FAST_FAULT',0x11) +PMAP__SWITCH = Constant('PMAP__SWITCH',0x12) +PMAP__TTE = Constant('PMAP__TTE',0x13) +PMAP__SWITCH_USER_TTB = Constant('PMAP__SWITCH_USER_TTB',0x14) +PMAP__UPDATE_CACHING = Constant('PMAP__UPDATE_CACHING',0x15) +PMAP__ATTRIBUTE_CLEAR_RANGE = Constant('PMAP__ATTRIBUTE_CLEAR_RANGE',0x16) +PMAP__CLEAR_USER_TTB = Constant('PMAP__CLEAR_USER_TTB',0x17) +PMAP__IOMMU_INIT = Constant('PMAP__IOMMU_INIT',0x18) +PMAP__IOMMU_IOVMALLOC = Constant('PMAP__IOMMU_IOVMALLOC',0x19) +PMAP__IOMMU_IOVMFREE = Constant('PMAP__IOMMU_IOVMFREE',0x1a) +PMAP__IOMMU_MAP = Constant('PMAP__IOMMU_MAP',0x1b) +PMAP__IOMMU_UNMAP = Constant('PMAP__IOMMU_UNMAP',0x1c) +PMAP__IOMMU_IOCTL = Constant('PMAP__IOMMU_IOCTL',0x1d) +PMAP__IOMMU_GRANT_PAGE = Constant('PMAP__IOMMU_GRANT_PAGE',0x1e) +PMAP__BATCH_UPDATE_CACHING = Constant('PMAP__BATCH_UPDATE_CACHING',0x1f) +PMAP__COLLECT_CACHE_OPS = Constant('PMAP__COLLECT_CACHE_OPS',0x20) +MACH_EPOCH_CHANGE = Constant('MACH_EPOCH_CHANGE',0x0) +MACH_BRIDGE_RCV_TS = Constant('MACH_BRIDGE_RCV_TS',0x1) +MACH_BRIDGE_REMOTE_TIME = Constant('MACH_BRIDGE_REMOTE_TIME',0x2) +MACH_BRIDGE_RESET_TS = Constant('MACH_BRIDGE_RESET_TS',0x3) +MACH_BRIDGE_TS_PARAMS = Constant('MACH_BRIDGE_TS_PARAMS',0x4) +MACH_BRIDGE_SKIP_TS = Constant('MACH_BRIDGE_SKIP_TS',0x5) +MACH_BRIDGE_TS_MISMATCH = Constant('MACH_BRIDGE_TS_MISMATCH',0x6) +MACH_BRIDGE_OBSV_RATE = Constant('MACH_BRIDGE_OBSV_RATE',0x7) +MICROSTACKSHOT_RECORD = Constant('MICROSTACKSHOT_RECORD',0x0) +MICROSTACKSHOT_GATHER = Constant('MICROSTACKSHOT_GATHER',0x1) +STACKSHOT_RECORD = Constant('STACKSHOT_RECORD',0x2) +STACKSHOT_RECORD_SHORT = Constant('STACKSHOT_RECORD_SHORT',0x3) +STACKSHOT_KERN_RECORD = Constant('STACKSHOT_KERN_RECORD',0x4) +SYSDIAGNOSE_NOTIFY_USER = Constant('SYSDIAGNOSE_NOTIFY_USER',0x0) +SYSDIAGNOSE_FULL = Constant('SYSDIAGNOSE_FULL',0x1) +SYSDIAGNOSE_STACKSHOT = Constant('SYSDIAGNOSE_STACKSHOT',0x2) +SYSDIAGNOSE_TAILSPIN = Constant('SYSDIAGNOSE_TAILSPIN',0x3) +SFI_SET_WINDOW = Constant('SFI_SET_WINDOW',0x0) +SFI_CANCEL_WINDOW = Constant('SFI_CANCEL_WINDOW',0x1) +SFI_SET_CLASS_OFFTIME = Constant('SFI_SET_CLASS_OFFTIME',0x2) +SFI_CANCEL_CLASS_OFFTIME = Constant('SFI_CANCEL_CLASS_OFFTIME',0x3) +SFI_THREAD_DEFER = Constant('SFI_THREAD_DEFER',0x4) +SFI_OFF_TIMER = Constant('SFI_OFF_TIMER',0x5) +SFI_ON_TIMER = Constant('SFI_ON_TIMER',0x6) +SFI_WAIT_CANCELED = Constant('SFI_WAIT_CANCELED',0x7) +SFI_PID_SET_MANAGED = Constant('SFI_PID_SET_MANAGED',0x8) +SFI_PID_CLEAR_MANAGED = Constant('SFI_PID_CLEAR_MANAGED',0x9) +SFI_GLOBAL_DEFER = Constant('SFI_GLOBAL_DEFER',0xa) +ZALLOC_ZCRAM = Constant('ZALLOC_ZCRAM',0x0) +RMON_ENABLE_CPUUSAGE_MONITOR = Constant('RMON_ENABLE_CPUUSAGE_MONITOR',0x001) +RMON_CPUUSAGE_VIOLATED = Constant('RMON_CPUUSAGE_VIOLATED',0x002) +RMON_CPUUSAGE_SUSPENDED = Constant('RMON_CPUUSAGE_SUSPENDED',0x003) +RMON_CPUUSAGE_VIOLATED_K32A = Constant('RMON_CPUUSAGE_VIOLATED_K32A',0x004) +RMON_CPUUSAGE_VIOLATED_K32B = Constant('RMON_CPUUSAGE_VIOLATED_K32B',0x005) +RMON_CPUUSAGE_RESUMED = Constant('RMON_CPUUSAGE_RESUMED',0x006) +RMON_DISABLE_CPUUSAGE_MONITOR = Constant('RMON_DISABLE_CPUUSAGE_MONITOR',0x00f) +RMON_ENABLE_CPUWAKES_MONITOR = Constant('RMON_ENABLE_CPUWAKES_MONITOR',0x011) +RMON_CPUWAKES_VIOLATED = Constant('RMON_CPUWAKES_VIOLATED',0x012) +RMON_CPUWAKES_VIOLATED_K32A = Constant('RMON_CPUWAKES_VIOLATED_K32A',0x014) +RMON_CPUWAKES_VIOLATED_K32B = Constant('RMON_CPUWAKES_VIOLATED_K32B',0x015) +RMON_DISABLE_CPUWAKES_MONITOR = Constant('RMON_DISABLE_CPUWAKES_MONITOR',0x01f) +RMON_ENABLE_IO_MONITOR = Constant('RMON_ENABLE_IO_MONITOR',0x021) +RMON_LOGWRITES_VIOLATED = Constant('RMON_LOGWRITES_VIOLATED',0x022) +RMON_PHYSWRITES_VIOLATED = Constant('RMON_PHYSWRITES_VIOLATED',0x023) +RMON_LOGWRITES_VIOLATED_K32A = Constant('RMON_LOGWRITES_VIOLATED_K32A',0x024) +RMON_LOGWRITES_VIOLATED_K32B = Constant('RMON_LOGWRITES_VIOLATED_K32B',0x025) +RMON_DISABLE_IO_MONITOR = Constant('RMON_DISABLE_IO_MONITOR',0x02f) +HV_X86_ENTER = Constant('HV_X86_ENTER',0x00) +HV_X86_ENTER_ERROR = Constant('HV_X86_ENTER_ERROR',0x01) +HV_X86_TRAP_TASK = Constant('HV_X86_TRAP_TASK',0x02) +HV_X86_TRAP_THREAD = Constant('HV_X86_TRAP_THREAD',0x03) +HV_X86_INTERRUPT_INJECT = Constant('HV_X86_INTERRUPT_INJECT',0x04) +HV_X86_INTERRUPT_RECV = Constant('HV_X86_INTERRUPT_RECV',0x05) +HV_X86_INTERRUPT_SEND = Constant('HV_X86_INTERRUPT_SEND',0x06) +HV_X86_IPI_SEND = Constant('HV_X86_IPI_SEND',0x07) +HV_X86_NMI_INJECT = Constant('HV_X86_NMI_INJECT',0x08) +HV_X86_NMI_SEND = Constant('HV_X86_NMI_SEND',0x09) +HV_X86_LSC_HIT = Constant('HV_X86_LSC_HIT',0x0a) +HV_X86_LSC_INSERT = Constant('HV_X86_LSC_INSERT',0x0b) +HV_X86_LSC_INSERT_IMM32 = Constant('HV_X86_LSC_INSERT_IMM32',0x0c) +HV_X86_LSC_INVALID = Constant('HV_X86_LSC_INVALID',0x0d) +HV_X86_LSC_INVALIDATE = Constant('HV_X86_LSC_INVALIDATE',0x0e) +HV_X86_LSC_MISS = Constant('HV_X86_LSC_MISS',0x0f) +HV_X86_TIMER_CANCEL = Constant('HV_X86_TIMER_CANCEL',0x10) +HV_X86_TIMER_FIRE = Constant('HV_X86_TIMER_FIRE',0x11) +HV_X86_TIMER_SCHEDULE = Constant('HV_X86_TIMER_SCHEDULE',0x12) +HV_X86_APIC_ACCESS_EXIT = Constant('HV_X86_APIC_ACCESS_EXIT',0x13) +HV_X86_APIC_WRITE_EXIT = Constant('HV_X86_APIC_WRITE_EXIT',0x14) +HV_X86_EPT_VIOLATION_EXIT = Constant('HV_X86_EPT_VIOLATION_EXIT',0x15) +HV_X86_EXC_NMI_EXIT = Constant('HV_X86_EXC_NMI_EXIT',0x16) +HV_X86_HLT_EXIT = Constant('HV_X86_HLT_EXIT',0x17) +HV_X86_IO_EXIT = Constant('HV_X86_IO_EXIT',0x18) +HV_X86_IRQ_EXIT = Constant('HV_X86_IRQ_EXIT',0x19) +HV_X86_IRQ_WND_EXIT = Constant('HV_X86_IRQ_WND_EXIT',0x1a) +HV_X86_MOV_DR_EXIT = Constant('HV_X86_MOV_DR_EXIT',0x1b) +HV_X86_NMI_WND_EXIT = Constant('HV_X86_NMI_WND_EXIT',0x1c) +HV_X86_RDMSR_EXIT = Constant('HV_X86_RDMSR_EXIT',0x1d) +HV_X86_RDPMC_EXIT = Constant('HV_X86_RDPMC_EXIT',0x1e) +HV_X86_TPR_THRESHOLD_EXIT = Constant('HV_X86_TPR_THRESHOLD_EXIT',0x1f) +HV_X86_VMX_TIMER_EXPIRED_EXIT = Constant('HV_X86_VMX_TIMER_EXPIRED_EXIT',0x20) +HV_X86_WRMSR_EXIT = Constant('HV_X86_WRMSR_EXIT',0x21) +HV_X86_VCPU_READ_APIC_TRAP = Constant('HV_X86_VCPU_READ_APIC_TRAP',0x22) +HV_X86_VCPU_READ_VMCS_TRAP = Constant('HV_X86_VCPU_READ_VMCS_TRAP',0x23) +HV_X86_VCPU_RUN_TRAP = Constant('HV_X86_VCPU_RUN_TRAP',0x24) +HV_X86_VCPU_RUN_UNTIL_TRAP = Constant('HV_X86_VCPU_RUN_UNTIL_TRAP',0x25) +HV_X86_VCPU_WRITE_APIC_TRAP = Constant('HV_X86_VCPU_WRITE_APIC_TRAP',0x26) +HV_X86_VM_ADDRSPACE_CREATE_TRAP = Constant('HV_X86_VM_ADDRSPACE_CREATE_TRAP',0x27) +HV_X86_VM_ADDRSPACE_DESTROY_TRAP = Constant('HV_X86_VM_ADDRSPACE_DESTROY_TRAP',0x28) +HV_X86_VM_INTR_MSI_TRAP = Constant('HV_X86_VM_INTR_MSI_TRAP',0x29) +HV_X86_VM_MAP_TRAP = Constant('HV_X86_VM_MAP_TRAP',0x2a) +HV_X86_VM_PROTECT_TRAP = Constant('HV_X86_VM_PROTECT_TRAP',0x2b) +HV_X86_VM_UNMAP_TRAP = Constant('HV_X86_VM_UNMAP_TRAP',0x2c) +HV_X86_TSC_OFFSET_SET = Constant('HV_X86_TSC_OFFSET_SET',0x2d) +DBG_NETIP = Constant('DBG_NETIP',1) +DBG_NETARP = Constant('DBG_NETARP',2) +DBG_NETUDP = Constant('DBG_NETUDP',3) +DBG_NETTCP = Constant('DBG_NETTCP',4) +DBG_NETICMP = Constant('DBG_NETICMP',5) +DBG_NETIGMP = Constant('DBG_NETIGMP',6) +DBG_NETRIP = Constant('DBG_NETRIP',7) +DBG_NETOSPF = Constant('DBG_NETOSPF',8) +DBG_NETISIS = Constant('DBG_NETISIS',9) +DBG_NETSNMP = Constant('DBG_NETSNMP',10) +DBG_NETSOCK = Constant('DBG_NETSOCK',11) +DBG_NETAARP = Constant('DBG_NETAARP',100) +DBG_NETDDP = Constant('DBG_NETDDP',101) +DBG_NETNBP = Constant('DBG_NETNBP',102) +DBG_NETZIP = Constant('DBG_NETZIP',103) +DBG_NETADSP = Constant('DBG_NETADSP',104) +DBG_NETATP = Constant('DBG_NETATP',105) +DBG_NETASP = Constant('DBG_NETASP',106) +DBG_NETAFP = Constant('DBG_NETAFP',107) +DBG_NETRTMP = Constant('DBG_NETRTMP',108) +DBG_NETAURP = Constant('DBG_NETAURP',109) +DBG_NETIPSEC = Constant('DBG_NETIPSEC',128) +DBG_NETVMNET = Constant('DBG_NETVMNET',129) +DBG_IOINTC = Constant('DBG_IOINTC',0) +DBG_IOWORKLOOP = Constant('DBG_IOWORKLOOP',1) +DBG_IOINTES = Constant('DBG_IOINTES',2) +DBG_IOCLKES = Constant('DBG_IOCLKES',3) +DBG_IOCMDQ = Constant('DBG_IOCMDQ',4) +DBG_IOMCURS = Constant('DBG_IOMCURS',5) +DBG_IOMDESC = Constant('DBG_IOMDESC',6) +DBG_IOPOWER = Constant('DBG_IOPOWER',7) +DBG_IOSERVICE = Constant('DBG_IOSERVICE',8) +DBG_IOREGISTRY = Constant('DBG_IOREGISTRY',9) +DBG_IOPORT = Constant('DBG_IOPORT',10) +DBG_IOSTORAGE = Constant('DBG_IOSTORAGE',32) +DBG_IONETWORK = Constant('DBG_IONETWORK',33) +DBG_IOKEYBOARD = Constant('DBG_IOKEYBOARD',34) +DBG_IOHID = Constant('DBG_IOHID',35) +DBG_IOAUDIO = Constant('DBG_IOAUDIO',36) +DBG_IOSERIAL = Constant('DBG_IOSERIAL',37) +DBG_IOTTY = Constant('DBG_IOTTY',38) +DBG_IOSAM = Constant('DBG_IOSAM',39) +DBG_IOPARALLELATA = Constant('DBG_IOPARALLELATA',40) +DBG_IOPARALLELSCSI = Constant('DBG_IOPARALLELSCSI',41) +DBG_IOSATA = Constant('DBG_IOSATA',42) +DBG_IOSAS = Constant('DBG_IOSAS',43) +DBG_IOFIBRECHANNEL = Constant('DBG_IOFIBRECHANNEL',44) +DBG_IOUSB = Constant('DBG_IOUSB',45) +DBG_IOBLUETOOTH = Constant('DBG_IOBLUETOOTH',46) +DBG_IOFIREWIRE = Constant('DBG_IOFIREWIRE',47) +DBG_IOINFINIBAND = Constant('DBG_IOINFINIBAND',48) +DBG_IOCPUPM = Constant('DBG_IOCPUPM',49) +DBG_IOGRAPHICS = Constant('DBG_IOGRAPHICS',50) +DBG_HIBERNATE = Constant('DBG_HIBERNATE',51) +DBG_IOTHUNDERBOLT = Constant('DBG_IOTHUNDERBOLT',52) +DBG_BOOTER = Constant('DBG_BOOTER',53) +DBG_IOAUDIO2 = Constant('DBG_IOAUDIO2',54) +DBG_IOAFK = Constant('DBG_IOAFK',55) +DBG_IOSURFACEPA = Constant('DBG_IOSURFACEPA',64) +DBG_IOMDPA = Constant('DBG_IOMDPA',65) +DBG_IODARTPA = Constant('DBG_IODARTPA',66) +DBG_DRVSTORAGE = Constant('DBG_DRVSTORAGE',1) +DBG_DRVNETWORK = Constant('DBG_DRVNETWORK',2) +DBG_DRVKEYBOARD = Constant('DBG_DRVKEYBOARD',3) +DBG_DRVHID = Constant('DBG_DRVHID',4) +DBG_DRVAUDIO = Constant('DBG_DRVAUDIO',5) +DBG_DRVSERIAL = Constant('DBG_DRVSERIAL',7) +DBG_DRVSAM = Constant('DBG_DRVSAM',8) +DBG_DRVPARALLELATA = Constant('DBG_DRVPARALLELATA',9) +DBG_DRVPARALLELSCSI = Constant('DBG_DRVPARALLELSCSI',10) +DBG_DRVSATA = Constant('DBG_DRVSATA',11) +DBG_DRVSAS = Constant('DBG_DRVSAS',12) +DBG_DRVFIBRECHANNEL = Constant('DBG_DRVFIBRECHANNEL',13) +DBG_DRVUSB = Constant('DBG_DRVUSB',14) +DBG_DRVBLUETOOTH = Constant('DBG_DRVBLUETOOTH',15) +DBG_DRVFIREWIRE = Constant('DBG_DRVFIREWIRE',16) +DBG_DRVINFINIBAND = Constant('DBG_DRVINFINIBAND',17) +DBG_DRVGRAPHICS = Constant('DBG_DRVGRAPHICS',18) +DBG_DRVSD = Constant('DBG_DRVSD',19) +DBG_DRVNAND = Constant('DBG_DRVNAND',20) +DBG_SSD = Constant('DBG_SSD',21) +DBG_DRVSPI = Constant('DBG_DRVSPI',22) +DBG_DRVWLAN_802_11 = Constant('DBG_DRVWLAN_802_11',23) +DBG_DRVSSM = Constant('DBG_DRVSSM',24) +DBG_DRVSMC = Constant('DBG_DRVSMC',25) +DBG_DRVMACEFIMANAGER = Constant('DBG_DRVMACEFIMANAGER',26) +DBG_DRVANE = Constant('DBG_DRVANE',27) +DBG_DRVETHERNET = Constant('DBG_DRVETHERNET',28) +DBG_DRVMCC = Constant('DBG_DRVMCC',29) +DBG_DRVACCESSORY = Constant('DBG_DRVACCESSORY',30) +DBG_SOCDIAGS = Constant('DBG_SOCDIAGS',31) +DBG_DRVVIRTIO = Constant('DBG_DRVVIRTIO',32) +DBG_DRVCELLULAR = Constant('DBG_DRVCELLULAR',33) +DBG_DRVSPMI = Constant('DBG_DRVSPMI',34) +DBG_DLIL_STATIC = Constant('DBG_DLIL_STATIC',1) +DBG_DLIL_PR_MOD = Constant('DBG_DLIL_PR_MOD',2) +DBG_DLIL_IF_MOD = Constant('DBG_DLIL_IF_MOD',3) +DBG_DLIL_PR_FLT = Constant('DBG_DLIL_PR_FLT',4) +DBG_DLIL_IF_FLT = Constant('DBG_DLIL_IF_FLT',5) +DBG_FSRW = Constant('DBG_FSRW',0x1) +DBG_DKRW = Constant('DBG_DKRW',0x2) +DBG_FSVN = Constant('DBG_FSVN',0x3) +DBG_FSLOOOKUP = Constant('DBG_FSLOOOKUP',0x4) +DBG_JOURNAL = Constant('DBG_JOURNAL',0x5) +DBG_IOCTL = Constant('DBG_IOCTL',0x6) +DBG_BOOTCACHE = Constant('DBG_BOOTCACHE',0x7) +DBG_HFS = Constant('DBG_HFS',0x8) +DBG_APFS = Constant('DBG_APFS',0x9) +DBG_SMB = Constant('DBG_SMB',0xA) +DBG_MOUNT = Constant('DBG_MOUNT',0xB) +DBG_EXFAT = Constant('DBG_EXFAT',0xE) +DBG_MSDOS = Constant('DBG_MSDOS',0xF) +DBG_ACFS = Constant('DBG_ACFS',0x10) +DBG_THROTTLE = Constant('DBG_THROTTLE',0x11) +DBG_DECMP = Constant('DBG_DECMP',0x12) +DBG_VFS = Constant('DBG_VFS',0x13) +DBG_LIVEFS = Constant('DBG_LIVEFS',0x14) +DBG_NFS = Constant('DBG_NFS',0x15) +DBG_CONTENT_PROT = Constant('DBG_CONTENT_PROT',0xCF) +DBG_HFS_UPDATE_ACCTIME = Constant('DBG_HFS_UPDATE_ACCTIME',0x01) +DBG_HFS_UPDATE_MODTIME = Constant('DBG_HFS_UPDATE_MODTIME',0x02) +DBG_HFS_UPDATE_CHGTIME = Constant('DBG_HFS_UPDATE_CHGTIME',0x04) +DBG_HFS_UPDATE_MODIFIED = Constant('DBG_HFS_UPDATE_MODIFIED',0x08) +DBG_HFS_UPDATE_FORCE = Constant('DBG_HFS_UPDATE_FORCE',0x10) +DBG_HFS_UPDATE_DATEADDED = Constant('DBG_HFS_UPDATE_DATEADDED',0x20) +DBG_HFS_UPDATE_MINOR = Constant('DBG_HFS_UPDATE_MINOR',0x40) +DBG_HFS_UPDATE_SKIPPED = Constant('DBG_HFS_UPDATE_SKIPPED',0x80) +DBG_VFS_IO_COMPRESSION_STATS = Constant('DBG_VFS_IO_COMPRESSION_STATS',0x1000) +DBG_BSD_PROC = Constant('DBG_BSD_PROC',0x01) +DBG_BSD_MEMSTAT = Constant('DBG_BSD_MEMSTAT',0x02) +DBG_BSD_KEVENT = Constant('DBG_BSD_KEVENT',0x03) +DBG_BSD_EXCP_SC = Constant('DBG_BSD_EXCP_SC',0x0C) +DBG_BSD_AIO = Constant('DBG_BSD_AIO',0x0D) +DBG_BSD_SC_EXTENDED_INFO = Constant('DBG_BSD_SC_EXTENDED_INFO',0x0E) +DBG_BSD_SC_EXTENDED_INFO2 = Constant('DBG_BSD_SC_EXTENDED_INFO2',0x0F) +DBG_BSD_KDEBUG_TEST = Constant('DBG_BSD_KDEBUG_TEST',0xFF) +BSD_PROC_EXIT = Constant('BSD_PROC_EXIT',1) +BSD_PROC_FRCEXIT = Constant('BSD_PROC_FRCEXIT',2) +BSD_PROC_EXEC = Constant('BSD_PROC_EXEC',3) +BSD_PROC_EXITREASON_CREATE = Constant('BSD_PROC_EXITREASON_CREATE',4) +BSD_PROC_EXITREASON_COMMIT = Constant('BSD_PROC_EXITREASON_COMMIT',5) +BSD_MEMSTAT_SCAN = Constant('BSD_MEMSTAT_SCAN',1) +BSD_MEMSTAT_JETSAM = Constant('BSD_MEMSTAT_JETSAM',2) +BSD_MEMSTAT_JETSAM_HIWAT = Constant('BSD_MEMSTAT_JETSAM_HIWAT',3) +BSD_MEMSTAT_FREEZE = Constant('BSD_MEMSTAT_FREEZE',4) +BSD_MEMSTAT_FREEZE_SCAN = Constant('BSD_MEMSTAT_FREEZE_SCAN',5) +BSD_MEMSTAT_UPDATE = Constant('BSD_MEMSTAT_UPDATE',6) +BSD_MEMSTAT_IDLE_DEMOTE = Constant('BSD_MEMSTAT_IDLE_DEMOTE',7) +BSD_MEMSTAT_CLEAR_ERRORS = Constant('BSD_MEMSTAT_CLEAR_ERRORS',8) +BSD_MEMSTAT_DIRTY_TRACK = Constant('BSD_MEMSTAT_DIRTY_TRACK',9) +BSD_MEMSTAT_DIRTY_SET = Constant('BSD_MEMSTAT_DIRTY_SET',10) +BSD_MEMSTAT_DIRTY_CLEAR = Constant('BSD_MEMSTAT_DIRTY_CLEAR',11) +BSD_MEMSTAT_FAST_JETSAM = Constant('BSD_MEMSTAT_FAST_JETSAM',15) +BSD_MEMSTAT_COMPACTOR_RUN = Constant('BSD_MEMSTAT_COMPACTOR_RUN',16) +BSD_MEMSTAT_FREEZE_DISABLE = Constant('BSD_MEMSTAT_FREEZE_DISABLE',17) +BSD_MEMSTAT_RELAUNCH_FLAGS = Constant('BSD_MEMSTAT_RELAUNCH_FLAGS',18) +BSD_KEVENT_KQ_PROCESS_BEGIN = Constant('BSD_KEVENT_KQ_PROCESS_BEGIN',1) +BSD_KEVENT_KQ_PROCESS_END = Constant('BSD_KEVENT_KQ_PROCESS_END',2) +BSD_KEVENT_KQWQ_PROCESS_BEGIN = Constant('BSD_KEVENT_KQWQ_PROCESS_BEGIN',3) +BSD_KEVENT_KQWQ_PROCESS_END = Constant('BSD_KEVENT_KQWQ_PROCESS_END',4) +BSD_KEVENT_KQWQ_BIND = Constant('BSD_KEVENT_KQWQ_BIND',5) +BSD_KEVENT_KQWQ_UNBIND = Constant('BSD_KEVENT_KQWQ_UNBIND',6) +BSD_KEVENT_KQWQ_THREQUEST = Constant('BSD_KEVENT_KQWQ_THREQUEST',7) +BSD_KEVENT_KQWL_PROCESS_BEGIN = Constant('BSD_KEVENT_KQWL_PROCESS_BEGIN',8) +BSD_KEVENT_KQWL_PROCESS_END = Constant('BSD_KEVENT_KQWL_PROCESS_END',9) +BSD_KEVENT_KQWL_THREQUEST = Constant('BSD_KEVENT_KQWL_THREQUEST',10) +BSD_KEVENT_KQWL_THADJUST = Constant('BSD_KEVENT_KQWL_THADJUST',11) +BSD_KEVENT_KQ_REGISTER = Constant('BSD_KEVENT_KQ_REGISTER',12) +BSD_KEVENT_KQWQ_REGISTER = Constant('BSD_KEVENT_KQWQ_REGISTER',13) +BSD_KEVENT_KQWL_REGISTER = Constant('BSD_KEVENT_KQWL_REGISTER',14) +BSD_KEVENT_KNOTE_ACTIVATE = Constant('BSD_KEVENT_KNOTE_ACTIVATE',15) +BSD_KEVENT_KQ_PROCESS = Constant('BSD_KEVENT_KQ_PROCESS',16) +BSD_KEVENT_KQWQ_PROCESS = Constant('BSD_KEVENT_KQWQ_PROCESS',17) +BSD_KEVENT_KQWL_PROCESS = Constant('BSD_KEVENT_KQWL_PROCESS',18) +BSD_KEVENT_KQWL_BIND = Constant('BSD_KEVENT_KQWL_BIND',19) +BSD_KEVENT_KQWL_UNBIND = Constant('BSD_KEVENT_KQWL_UNBIND',20) +BSD_KEVENT_KNOTE_ENABLE = Constant('BSD_KEVENT_KNOTE_ENABLE',21) +BSD_KEVENT_KNOTE_VANISHED = Constant('BSD_KEVENT_KNOTE_VANISHED',22) +DBG_TRACE_DATA = Constant('DBG_TRACE_DATA',0) +DBG_TRACE_STRING = Constant('DBG_TRACE_STRING',1) +DBG_TRACE_INFO = Constant('DBG_TRACE_INFO',2) +DBG_CS_IO = Constant('DBG_CS_IO',0) +DBG_SEC_KERNEL = Constant('DBG_SEC_KERNEL',0) +DBG_SEC_SANDBOX = Constant('DBG_SEC_SANDBOX',1) +DBG_MT_INSTRS_CYCLES = Constant('DBG_MT_INSTRS_CYCLES',1) +DBG_MT_DEBUG = Constant('DBG_MT_DEBUG',2) +DBG_MT_RESOURCES_PROC_EXIT = Constant('DBG_MT_RESOURCES_PROC_EXIT',3) +DBG_MT_RESOURCES_THR_EXIT = Constant('DBG_MT_RESOURCES_THR_EXIT',4) +DBG_MT_INSTRS_CYCLES_ON_CPU = Constant('DBG_MT_INSTRS_CYCLES_ON_CPU',5) +DBG_MT_TMPTH = Constant('DBG_MT_TMPTH',0xfe) +DBG_MT_TMPCPU = Constant('DBG_MT_TMPCPU',0xff) +DBG_MISC_COREBRIGHTNESS = Constant('DBG_MISC_COREBRIGHTNESS',0x01) +DBG_MISC_VIDEOENG = Constant('DBG_MISC_VIDEOENG',0x02) +DBG_EVENT = Constant('DBG_EVENT',0x10) +DBG_MISC_INSTRUMENTS = Constant('DBG_MISC_INSTRUMENTS',0x11) +DBG_MISC_INSTRUMENTSBT = Constant('DBG_MISC_INSTRUMENTSBT',0x12) +DBG_MISC_RUNLOOP_DETAILS = Constant('DBG_MISC_RUNLOOP_DETAILS',0x13) +DBG_MISC_RUNLOOP_BUSY = Constant('DBG_MISC_RUNLOOP_BUSY',0x14) +DBG_MISC_LAYOUT = Constant('DBG_MISC_LAYOUT',0x1a) +DBG_BUFFER = Constant('DBG_BUFFER',0x20) +DKIO_DONE = Constant('DKIO_DONE',0x01) +DKIO_READ = Constant('DKIO_READ',0x02) +DKIO_ASYNC = Constant('DKIO_ASYNC',0x04) +DKIO_META = Constant('DKIO_META',0x08) +DKIO_PAGING = Constant('DKIO_PAGING',0x10) +DKIO_THROTTLE = Constant('DKIO_THROTTLE',0x20) +DKIO_PASSIVE = Constant('DKIO_PASSIVE',0x40) +DKIO_NOCACHE = Constant('DKIO_NOCACHE',0x80) +DKIO_TIER_MASK = Constant('DKIO_TIER_MASK',0xF00) +DKIO_TIER_SHIFT = Constant('DKIO_TIER_SHIFT',8) +DKIO_TIER_UPGRADE = Constant('DKIO_TIER_UPGRADE',0x1000) +DBG_APP_LOGINWINDOW = Constant('DBG_APP_LOGINWINDOW',0x03) +DBG_APP_AUDIO = Constant('DBG_APP_AUDIO',0x04) +DBG_APP_SYSTEMUI = Constant('DBG_APP_SYSTEMUI',0x05) +DBG_APP_SIGNPOST = Constant('DBG_APP_SIGNPOST',0x0A) +DBG_APP_TAL = Constant('DBG_APP_TAL',0x0B) +DBG_APP_APPKIT = Constant('DBG_APP_APPKIT',0x0C) +DBG_APP_UIKIT = Constant('DBG_APP_UIKIT',0x0D) +DBG_APP_DFR = Constant('DBG_APP_DFR',0x0E) +DBG_APP_LAYOUT = Constant('DBG_APP_LAYOUT',0x0F) +DBG_APP_COREDATA = Constant('DBG_APP_COREDATA',0x10) +DBG_APP_RUNLOOP_BASIC = Constant('DBG_APP_RUNLOOP_BASIC',0x11) +DBG_APP_RUNLOOP_ADVANCED = Constant('DBG_APP_RUNLOOP_ADVANCED',0x12) +DBG_APP_SAMBA = Constant('DBG_APP_SAMBA',0x80) +DBG_APP_EOSSUPPORT = Constant('DBG_APP_EOSSUPPORT',0x81) +DBG_APP_MACEFIMANAGER = Constant('DBG_APP_MACEFIMANAGER',0x82) +DBG_APP_ENTERPRISE = Constant('DBG_APP_ENTERPRISE',0x83) +OPEN_THROTTLE_WINDOW = Constant('OPEN_THROTTLE_WINDOW',0x1) +PROCESS_THROTTLED = Constant('PROCESS_THROTTLED',0x2) +IO_THROTTLE_DISABLE = Constant('IO_THROTTLE_DISABLE',0x3) +IO_TIER_UPL_MISMATCH = Constant('IO_TIER_UPL_MISMATCH',0x4) +IMP_ASSERTION = Constant('IMP_ASSERTION',0x10) +IMP_BOOST = Constant('IMP_BOOST',0x11) +IMP_MSG = Constant('IMP_MSG',0x12) +IMP_WATCHPORT = Constant('IMP_WATCHPORT',0x13) +IMP_TASK_SUPPRESSION = Constant('IMP_TASK_SUPPRESSION',0x17) +IMP_TASK_APPTYPE = Constant('IMP_TASK_APPTYPE',0x18) +IMP_UPDATE = Constant('IMP_UPDATE',0x19) +IMP_USYNCH_QOS_OVERRIDE = Constant('IMP_USYNCH_QOS_OVERRIDE',0x1A) +IMP_DONOR_CHANGE = Constant('IMP_DONOR_CHANGE',0x1B) +IMP_MAIN_THREAD_QOS = Constant('IMP_MAIN_THREAD_QOS',0x1C) +IMP_SYNC_IPC_QOS = Constant('IMP_SYNC_IPC_QOS',0x1D) +IMP_TASK_POLICY_DARWIN_BG = Constant('IMP_TASK_POLICY_DARWIN_BG',0x21) +IMP_TASK_POLICY_IOPOL = Constant('IMP_TASK_POLICY_IOPOL',0x22) +IMP_TASK_POLICY_IO = Constant('IMP_TASK_POLICY_IO',0x23) +IMP_TASK_POLICY_PASSIVE_IO = Constant('IMP_TASK_POLICY_PASSIVE_IO',0x24) +IMP_TASK_POLICY_DARWIN_BG_IOPOL = Constant('IMP_TASK_POLICY_DARWIN_BG_IOPOL',0x27) +IMP_TASK_POLICY_BOOST = Constant('IMP_TASK_POLICY_BOOST',0x29) +IMP_TASK_POLICY_ROLE = Constant('IMP_TASK_POLICY_ROLE',0x2A) +IMP_TASK_POLICY_TERMINATED = Constant('IMP_TASK_POLICY_TERMINATED',0x2C) +IMP_TASK_POLICY_NEW_SOCKETS_BG = Constant('IMP_TASK_POLICY_NEW_SOCKETS_BG',0x2D) +IMP_TASK_POLICY_SUP_ACTIVE = Constant('IMP_TASK_POLICY_SUP_ACTIVE',0x2E) +IMP_TASK_POLICY_LATENCY_QOS = Constant('IMP_TASK_POLICY_LATENCY_QOS',0x2F) +IMP_TASK_POLICY_THROUGH_QOS = Constant('IMP_TASK_POLICY_THROUGH_QOS',0x30) +IMP_TASK_POLICY_WATCHERS_BG = Constant('IMP_TASK_POLICY_WATCHERS_BG',0x31) +IMP_TASK_POLICY_SFI_MANAGED = Constant('IMP_TASK_POLICY_SFI_MANAGED',0x34) +IMP_TASK_POLICY_ALL_SOCKETS_BG = Constant('IMP_TASK_POLICY_ALL_SOCKETS_BG',0x37) +IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS = Constant('IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS',0x39) +IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS = Constant('IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS',0x3A) +IMP_TASK_POLICY_PIDBIND_BG = Constant('IMP_TASK_POLICY_PIDBIND_BG',0x32) +IMP_TASK_POLICY_QOS_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_OVERRIDE',0x36) +IMP_TASK_POLICY_QOS_AND_RELPRIO = Constant('IMP_TASK_POLICY_QOS_AND_RELPRIO',0x38) +IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE',0x3B) +IMP_TASK_POLICY_QOS_PROMOTE = Constant('IMP_TASK_POLICY_QOS_PROMOTE',0x3C) +IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE',0x3D) +IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE = Constant('IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE',0x3E) +IMP_TASK_POLICY_IOTIER_KEVENT_OVERRIDE = Constant('IMP_TASK_POLICY_IOTIER_KEVENT_OVERRIDE',0x3F) +IMP_TASK_POLICY_WI_DRIVEN = Constant('IMP_TASK_POLICY_WI_DRIVEN',0x40) +IMP_HOLD = Constant('IMP_HOLD',0x2) +IMP_DROP = Constant('IMP_DROP',0x4) +IMP_EXTERN = Constant('IMP_EXTERN',0x8) +IMP_BOOSTED = Constant('IMP_BOOSTED',0x1) +IMP_UNBOOSTED = Constant('IMP_UNBOOSTED',0x2) +IMP_MSG_SEND = Constant('IMP_MSG_SEND',0x1) +IMP_MSG_DELV = Constant('IMP_MSG_DELV',0x2) +IMP_UPDATE_TASK_CREATE = Constant('IMP_UPDATE_TASK_CREATE',0x1) +IMP_USYNCH_ADD_OVERRIDE = Constant('IMP_USYNCH_ADD_OVERRIDE',0x0) +IMP_USYNCH_REMOVE_OVERRIDE = Constant('IMP_USYNCH_REMOVE_OVERRIDE',0x1) +IMP_DONOR_UPDATE_LIVE_DONOR_STATE = Constant('IMP_DONOR_UPDATE_LIVE_DONOR_STATE',0x0) +IMP_DONOR_INIT_DONOR_STATE = Constant('IMP_DONOR_INIT_DONOR_STATE',0x1) +IMP_SYNC_IPC_QOS_APPLIED = Constant('IMP_SYNC_IPC_QOS_APPLIED',0x0) +IMP_SYNC_IPC_QOS_REMOVED = Constant('IMP_SYNC_IPC_QOS_REMOVED',0x1) +IMP_SYNC_IPC_QOS_OVERFLOW = Constant('IMP_SYNC_IPC_QOS_OVERFLOW',0x2) +IMP_SYNC_IPC_QOS_UNDERFLOW = Constant('IMP_SYNC_IPC_QOS_UNDERFLOW',0x3) +TURNSTILE_HEAP_OPERATIONS = Constant('TURNSTILE_HEAP_OPERATIONS',0x10) +TURNSTILE_PRIORITY_OPERATIONS = Constant('TURNSTILE_PRIORITY_OPERATIONS',0x20) +TURNSTILE_FREELIST_OPERATIONS = Constant('TURNSTILE_FREELIST_OPERATIONS',0x30) +THREAD_ADDED_TO_TURNSTILE_WAITQ = Constant('THREAD_ADDED_TO_TURNSTILE_WAITQ',0x1) +THREAD_REMOVED_FROM_TURNSTILE_WAITQ = Constant('THREAD_REMOVED_FROM_TURNSTILE_WAITQ',0x2) +THREAD_MOVED_IN_TURNSTILE_WAITQ = Constant('THREAD_MOVED_IN_TURNSTILE_WAITQ',0x3) +TURNSTILE_ADDED_TO_TURNSTILE_HEAP = Constant('TURNSTILE_ADDED_TO_TURNSTILE_HEAP',0x4) +TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP = Constant('TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP',0x5) +TURNSTILE_MOVED_IN_TURNSTILE_HEAP = Constant('TURNSTILE_MOVED_IN_TURNSTILE_HEAP',0x6) +TURNSTILE_ADDED_TO_THREAD_HEAP = Constant('TURNSTILE_ADDED_TO_THREAD_HEAP',0x7) +TURNSTILE_REMOVED_FROM_THREAD_HEAP = Constant('TURNSTILE_REMOVED_FROM_THREAD_HEAP',0x8) +TURNSTILE_MOVED_IN_THREAD_HEAP = Constant('TURNSTILE_MOVED_IN_THREAD_HEAP',0x9) +TURNSTILE_UPDATE_STOPPED_BY_LIMIT = Constant('TURNSTILE_UPDATE_STOPPED_BY_LIMIT',0xa) +THREAD_NOT_WAITING_ON_TURNSTILE = Constant('THREAD_NOT_WAITING_ON_TURNSTILE',0xb) +TURNSTILE_PRIORITY_CHANGE = Constant('TURNSTILE_PRIORITY_CHANGE',0x1) +THREAD_USER_PROMOTION_CHANGE = Constant('THREAD_USER_PROMOTION_CHANGE',0x2) +TURNSTILE_PREPARE = Constant('TURNSTILE_PREPARE',0x1) +TURNSTILE_COMPLETE = Constant('TURNSTILE_COMPLETE',0x2) +BANK_ACCOUNT_INFO = Constant('BANK_ACCOUNT_INFO',0x10) +BANK_TASK_INFO = Constant('BANK_TASK_INFO',0x11) +ATM_SUBAID_INFO = Constant('ATM_SUBAID_INFO',0x10) +ATM_GETVALUE_INFO = Constant('ATM_GETVALUE_INFO',0x20) +ATM_UNREGISTER_INFO = Constant('ATM_UNREGISTER_INFO',0x30) +BANK_SETTLE_CPU_TIME = Constant('BANK_SETTLE_CPU_TIME',0x1) +BANK_SECURE_ORIGINATOR_CHANGED = Constant('BANK_SECURE_ORIGINATOR_CHANGED',0x2) +BANK_SETTLE_ENERGY = Constant('BANK_SETTLE_ENERGY',0x3) +ATM_MIN_CALLED = Constant('ATM_MIN_CALLED',0x1) +ATM_LINK_LIST_TRIM = Constant('ATM_LINK_LIST_TRIM',0x2) +ATM_VALUE_REPLACED = Constant('ATM_VALUE_REPLACED',0x1) +ATM_VALUE_ADDED = Constant('ATM_VALUE_ADDED',0x2) +ATM_VALUE_UNREGISTERED = Constant('ATM_VALUE_UNREGISTERED',0x1) +ATM_VALUE_DIFF_MAILBOX = Constant('ATM_VALUE_DIFF_MAILBOX',0x2) +DBG_DAEMON_COREDUET = Constant('DBG_DAEMON_COREDUET',0x1) +DBG_DAEMON_POWERD = Constant('DBG_DAEMON_POWERD',0x2) +DBG_UMALLOC_EXTERNAL = Constant('DBG_UMALLOC_EXTERNAL',0x1) +DBG_UMALLOC_INTERNAL = Constant('DBG_UMALLOC_INTERNAL',0x2) +BSD = Constant('BSD',199506) +BSD4_3 = Constant('BSD4_3',1) +BSD4_4 = Constant('BSD4_4',1) +NeXTBSD = Constant('NeXTBSD',1995064) +NeXTBSD4_0 = Constant('NeXTBSD4_0',0) +MAXCOMLEN = Constant('MAXCOMLEN',16) +MAXINTERP = Constant('MAXINTERP',64) +MAXLOGNAME = Constant('MAXLOGNAME',255) +NOFILE = Constant('NOFILE',256) +NOGROUP = Constant('NOGROUP',65535) +MAXHOSTNAMELEN = Constant('MAXHOSTNAMELEN',256) +MAXDOMNAMELEN = Constant('MAXDOMNAMELEN',256) +PSWP = Constant('PSWP',0) +PVM = Constant('PVM',4) +PINOD = Constant('PINOD',8) +PRIBIO = Constant('PRIBIO',16) +PVFS = Constant('PVFS',20) +PZERO = Constant('PZERO',22) +PSOCK = Constant('PSOCK',24) +PWAIT = Constant('PWAIT',32) +PLOCK = Constant('PLOCK',36) +PPAUSE = Constant('PPAUSE',40) +PUSER = Constant('PUSER',50) +MAXPRI = Constant('MAXPRI',127) +PRIMASK = Constant('PRIMASK',0x0ff) +PCATCH = Constant('PCATCH',0x100) +PTTYBLOCK = Constant('PTTYBLOCK',0x200) +PDROP = Constant('PDROP',0x400) +PSPIN = Constant('PSPIN',0x800) +CMASK = Constant('CMASK',0o022) +CBLOCK = Constant('CBLOCK',64) +MAXFRAG = Constant('MAXFRAG',8) +MAXSYMLINKS = Constant('MAXSYMLINKS',32) +FSHIFT = Constant('FSHIFT',11) +LF_NOT_BOOSTED = Constant('LF_NOT_BOOSTED',0) +LF_BOOSTED = Constant('LF_BOOSTED',1) +PSHMNAMLEN = Constant('PSHMNAMLEN',31) +SHM_RDONLY = Constant('SHM_RDONLY',0o010000) +SHM_RND = Constant('SHM_RND',0o020000) +SHMLBA = Constant('SHMLBA',4096) +TIOCM_LE = Constant('TIOCM_LE',0o0001) +TIOCM_DTR = Constant('TIOCM_DTR',0o0002) +TIOCM_RTS = Constant('TIOCM_RTS',0o0004) +TIOCM_ST = Constant('TIOCM_ST',0o0010) +TIOCM_SR = Constant('TIOCM_SR',0o0020) +TIOCM_CTS = Constant('TIOCM_CTS',0o0040) +TIOCM_CAR = Constant('TIOCM_CAR',0o0100) +TIOCM_RNG = Constant('TIOCM_RNG',0o0200) +TIOCM_DSR = Constant('TIOCM_DSR',0o0400) +TIOCPKT_DATA = Constant('TIOCPKT_DATA',0x00) +TIOCPKT_FLUSHREAD = Constant('TIOCPKT_FLUSHREAD',0x01) +TIOCPKT_FLUSHWRITE = Constant('TIOCPKT_FLUSHWRITE',0x02) +TIOCPKT_STOP = Constant('TIOCPKT_STOP',0x04) +TIOCPKT_START = Constant('TIOCPKT_START',0x08) +TIOCPKT_NOSTOP = Constant('TIOCPKT_NOSTOP',0x10) +TIOCPKT_DOSTOP = Constant('TIOCPKT_DOSTOP',0x20) +TIOCPKT_IOCTL = Constant('TIOCPKT_IOCTL',0x40) +TTYDISC = Constant('TTYDISC',0) +TABLDISC = Constant('TABLDISC',3) +SLIPDISC = Constant('SLIPDISC',4) +PPPDISC = Constant('PPPDISC',5) +CTL_MAXNAME = Constant('CTL_MAXNAME',12) +CTLTYPE = Constant('CTLTYPE',0xf) +CTLTYPE_NODE = Constant('CTLTYPE_NODE',1) +CTLTYPE_INT = Constant('CTLTYPE_INT',2) +CTLTYPE_STRING = Constant('CTLTYPE_STRING',3) +CTLTYPE_QUAD = Constant('CTLTYPE_QUAD',4) +CTLTYPE_OPAQUE = Constant('CTLTYPE_OPAQUE',5) +CTLFLAG_RD = Constant('CTLFLAG_RD',0x80000000) +CTLFLAG_WR = Constant('CTLFLAG_WR',0x40000000) +CTLFLAG_NOLOCK = Constant('CTLFLAG_NOLOCK',0x20000000) +CTLFLAG_ANYBODY = Constant('CTLFLAG_ANYBODY',0x10000000) +CTLFLAG_SECURE = Constant('CTLFLAG_SECURE',0x08000000) +CTLFLAG_MASKED = Constant('CTLFLAG_MASKED',0x04000000) +CTLFLAG_NOAUTO = Constant('CTLFLAG_NOAUTO',0x02000000) +CTLFLAG_KERN = Constant('CTLFLAG_KERN',0x01000000) +CTLFLAG_LOCKED = Constant('CTLFLAG_LOCKED',0x00800000) +CTLFLAG_OID2 = Constant('CTLFLAG_OID2',0x00400000) +CTLFLAG_EXPERIMENT = Constant('CTLFLAG_EXPERIMENT',0x00100000) +OID_AUTO_START = Constant('OID_AUTO_START',100) +SYSCTL_OID_VERSION = Constant('SYSCTL_OID_VERSION',1) +SYSCTL_SKMEM = Constant('SYSCTL_SKMEM',1) +CTL_UNSPEC = Constant('CTL_UNSPEC',0) +CTL_KERN = Constant('CTL_KERN',1) +CTL_VM = Constant('CTL_VM',2) +CTL_VFS = Constant('CTL_VFS',3) +CTL_NET = Constant('CTL_NET',4) +CTL_DEBUG = Constant('CTL_DEBUG',5) +CTL_HW = Constant('CTL_HW',6) +CTL_MACHDEP = Constant('CTL_MACHDEP',7) +CTL_USER = Constant('CTL_USER',8) +CTL_MAXID = Constant('CTL_MAXID',9) +KERN_OSTYPE = Constant('KERN_OSTYPE',1) +KERN_OSRELEASE = Constant('KERN_OSRELEASE',2) +KERN_OSREV = Constant('KERN_OSREV',3) +KERN_VERSION = Constant('KERN_VERSION',4) +KERN_MAXVNODES = Constant('KERN_MAXVNODES',5) +KERN_MAXPROC = Constant('KERN_MAXPROC',6) +KERN_MAXFILES = Constant('KERN_MAXFILES',7) +KERN_ARGMAX = Constant('KERN_ARGMAX',8) +KERN_SECURELVL = Constant('KERN_SECURELVL',9) +KERN_HOSTNAME = Constant('KERN_HOSTNAME',10) +KERN_HOSTID = Constant('KERN_HOSTID',11) +KERN_CLOCKRATE = Constant('KERN_CLOCKRATE',12) +KERN_VNODE = Constant('KERN_VNODE',13) +KERN_PROC = Constant('KERN_PROC',14) +KERN_FILE = Constant('KERN_FILE',15) +KERN_PROF = Constant('KERN_PROF',16) +KERN_POSIX1 = Constant('KERN_POSIX1',17) +KERN_NGROUPS = Constant('KERN_NGROUPS',18) +KERN_JOB_CONTROL = Constant('KERN_JOB_CONTROL',19) +KERN_SAVED_IDS = Constant('KERN_SAVED_IDS',20) +KERN_BOOTTIME = Constant('KERN_BOOTTIME',21) +KERN_NISDOMAINNAME = Constant('KERN_NISDOMAINNAME',22) +KERN_MAXPARTITIONS = Constant('KERN_MAXPARTITIONS',23) +KERN_KDEBUG = Constant('KERN_KDEBUG',24) +KERN_UPDATEINTERVAL = Constant('KERN_UPDATEINTERVAL',25) +KERN_OSRELDATE = Constant('KERN_OSRELDATE',26) +KERN_NTP_PLL = Constant('KERN_NTP_PLL',27) +KERN_BOOTFILE = Constant('KERN_BOOTFILE',28) +KERN_MAXFILESPERPROC = Constant('KERN_MAXFILESPERPROC',29) +KERN_MAXPROCPERUID = Constant('KERN_MAXPROCPERUID',30) +KERN_DUMPDEV = Constant('KERN_DUMPDEV',31) +KERN_IPC = Constant('KERN_IPC',32) +KERN_DUMMY = Constant('KERN_DUMMY',33) +KERN_PS_STRINGS = Constant('KERN_PS_STRINGS',34) +KERN_USRSTACK32 = Constant('KERN_USRSTACK32',35) +KERN_LOGSIGEXIT = Constant('KERN_LOGSIGEXIT',36) +KERN_SYMFILE = Constant('KERN_SYMFILE',37) +KERN_PROCARGS = Constant('KERN_PROCARGS',38) +KERN_NETBOOT = Constant('KERN_NETBOOT',40) +KERN_SYSV = Constant('KERN_SYSV',42) +KERN_AFFINITY = Constant('KERN_AFFINITY',43) +KERN_TRANSLATE = Constant('KERN_TRANSLATE',44) +KERN_EXEC = Constant('KERN_EXEC',45) +KERN_AIOMAX = Constant('KERN_AIOMAX',46) +KERN_AIOPROCMAX = Constant('KERN_AIOPROCMAX',47) +KERN_AIOTHREADS = Constant('KERN_AIOTHREADS',48) +KERN_PROCARGS2 = Constant('KERN_PROCARGS2',49) +KERN_COREFILE = Constant('KERN_COREFILE',50) +KERN_COREDUMP = Constant('KERN_COREDUMP',51) +KERN_SUGID_COREDUMP = Constant('KERN_SUGID_COREDUMP',52) +KERN_PROCDELAYTERM = Constant('KERN_PROCDELAYTERM',53) +KERN_SHREG_PRIVATIZABLE = Constant('KERN_SHREG_PRIVATIZABLE',54) +KERN_LOW_PRI_WINDOW = Constant('KERN_LOW_PRI_WINDOW',56) +KERN_LOW_PRI_DELAY = Constant('KERN_LOW_PRI_DELAY',57) +KERN_POSIX = Constant('KERN_POSIX',58) +KERN_USRSTACK64 = Constant('KERN_USRSTACK64',59) +KERN_NX_PROTECTION = Constant('KERN_NX_PROTECTION',60) +KERN_TFP = Constant('KERN_TFP',61) +KERN_PROCNAME = Constant('KERN_PROCNAME',62) +KERN_THALTSTACK = Constant('KERN_THALTSTACK',63) +KERN_SPECULATIVE_READS = Constant('KERN_SPECULATIVE_READS',64) +KERN_OSVERSION = Constant('KERN_OSVERSION',65) +KERN_SAFEBOOT = Constant('KERN_SAFEBOOT',66) +KERN_RAGEVNODE = Constant('KERN_RAGEVNODE',68) +KERN_TTY = Constant('KERN_TTY',69) +KERN_CHECKOPENEVT = Constant('KERN_CHECKOPENEVT',70) +KERN_THREADNAME = Constant('KERN_THREADNAME',71) +KERN_MAXID = Constant('KERN_MAXID',72) +KERN_RAGE_PROC = Constant('KERN_RAGE_PROC',1) +KERN_RAGE_THREAD = Constant('KERN_RAGE_THREAD',2) +KERN_UNRAGE_PROC = Constant('KERN_UNRAGE_PROC',3) +KERN_UNRAGE_THREAD = Constant('KERN_UNRAGE_THREAD',4) +KERN_OPENEVT_PROC = Constant('KERN_OPENEVT_PROC',1) +KERN_UNOPENEVT_PROC = Constant('KERN_UNOPENEVT_PROC',2) +KERN_TFP_POLICY = Constant('KERN_TFP_POLICY',1) +KERN_TFP_POLICY_DENY = Constant('KERN_TFP_POLICY_DENY',0) +KERN_TFP_POLICY_DEFAULT = Constant('KERN_TFP_POLICY_DEFAULT',2) +KERN_KDEFLAGS = Constant('KERN_KDEFLAGS',1) +KERN_KDDFLAGS = Constant('KERN_KDDFLAGS',2) +KERN_KDENABLE = Constant('KERN_KDENABLE',3) +KERN_KDSETBUF = Constant('KERN_KDSETBUF',4) +KERN_KDGETBUF = Constant('KERN_KDGETBUF',5) +KERN_KDSETUP = Constant('KERN_KDSETUP',6) +KERN_KDREMOVE = Constant('KERN_KDREMOVE',7) +KERN_KDSETREG = Constant('KERN_KDSETREG',8) +KERN_KDGETREG = Constant('KERN_KDGETREG',9) +KERN_KDREADTR = Constant('KERN_KDREADTR',10) +KERN_KDPIDTR = Constant('KERN_KDPIDTR',11) +KERN_KDTHRMAP = Constant('KERN_KDTHRMAP',12) +KERN_KDPIDEX = Constant('KERN_KDPIDEX',14) +KERN_KDSETRTCDEC = Constant('KERN_KDSETRTCDEC',15) +KERN_KDGETENTROPY = Constant('KERN_KDGETENTROPY',16) +KERN_KDWRITETR = Constant('KERN_KDWRITETR',17) +KERN_KDWRITEMAP = Constant('KERN_KDWRITEMAP',18) +KERN_KDTEST = Constant('KERN_KDTEST',19) +KERN_KDREADCURTHRMAP = Constant('KERN_KDREADCURTHRMAP',21) +KERN_KDSET_TYPEFILTER = Constant('KERN_KDSET_TYPEFILTER',22) +KERN_KDBUFWAIT = Constant('KERN_KDBUFWAIT',23) +KERN_KDCPUMAP = Constant('KERN_KDCPUMAP',24) +KERN_KDCPUMAP_EXT = Constant('KERN_KDCPUMAP_EXT',25) +KERN_KDSET_EDM = Constant('KERN_KDSET_EDM',26) +KERN_KDGET_EDM = Constant('KERN_KDGET_EDM',27) +KERN_KDWRITETR_V3 = Constant('KERN_KDWRITETR_V3',28) +KERN_PROC_ALL = Constant('KERN_PROC_ALL',0) +KERN_PROC_PID = Constant('KERN_PROC_PID',1) +KERN_PROC_PGRP = Constant('KERN_PROC_PGRP',2) +KERN_PROC_SESSION = Constant('KERN_PROC_SESSION',3) +KERN_PROC_TTY = Constant('KERN_PROC_TTY',4) +KERN_PROC_UID = Constant('KERN_PROC_UID',5) +KERN_PROC_RUID = Constant('KERN_PROC_RUID',6) +KERN_PROC_LCID = Constant('KERN_PROC_LCID',7) +KERN_VFSNSPACE_HANDLE_PROC = Constant('KERN_VFSNSPACE_HANDLE_PROC',1) +KERN_VFSNSPACE_UNHANDLE_PROC = Constant('KERN_VFSNSPACE_UNHANDLE_PROC',2) +KIPC_MAXSOCKBUF = Constant('KIPC_MAXSOCKBUF',1) +KIPC_SOCKBUF_WASTE = Constant('KIPC_SOCKBUF_WASTE',2) +KIPC_SOMAXCONN = Constant('KIPC_SOMAXCONN',3) +KIPC_MAX_LINKHDR = Constant('KIPC_MAX_LINKHDR',4) +KIPC_MAX_PROTOHDR = Constant('KIPC_MAX_PROTOHDR',5) +KIPC_MAX_HDR = Constant('KIPC_MAX_HDR',6) +KIPC_MAX_DATALEN = Constant('KIPC_MAX_DATALEN',7) +KIPC_MBSTAT = Constant('KIPC_MBSTAT',8) +KIPC_NMBCLUSTERS = Constant('KIPC_NMBCLUSTERS',9) +KIPC_SOQLIMITCOMPAT = Constant('KIPC_SOQLIMITCOMPAT',10) +VM_METER = Constant('VM_METER',1) +VM_LOADAVG = Constant('VM_LOADAVG',2) +VM_MACHFACTOR = Constant('VM_MACHFACTOR',4) +VM_SWAPUSAGE = Constant('VM_SWAPUSAGE',5) +VM_MAXID = Constant('VM_MAXID',6) +LSCALE = Constant('LSCALE',1000) +HW_MACHINE = Constant('HW_MACHINE',1) +HW_MODEL = Constant('HW_MODEL',2) +HW_NCPU = Constant('HW_NCPU',3) +HW_BYTEORDER = Constant('HW_BYTEORDER',4) +HW_PHYSMEM = Constant('HW_PHYSMEM',5) +HW_USERMEM = Constant('HW_USERMEM',6) +HW_PAGESIZE = Constant('HW_PAGESIZE',7) +HW_DISKNAMES = Constant('HW_DISKNAMES',8) +HW_DISKSTATS = Constant('HW_DISKSTATS',9) +HW_EPOCH = Constant('HW_EPOCH',10) +HW_FLOATINGPT = Constant('HW_FLOATINGPT',11) +HW_MACHINE_ARCH = Constant('HW_MACHINE_ARCH',12) +HW_VECTORUNIT = Constant('HW_VECTORUNIT',13) +HW_BUS_FREQ = Constant('HW_BUS_FREQ',14) +HW_CPU_FREQ = Constant('HW_CPU_FREQ',15) +HW_CACHELINE = Constant('HW_CACHELINE',16) +HW_L1ICACHESIZE = Constant('HW_L1ICACHESIZE',17) +HW_L1DCACHESIZE = Constant('HW_L1DCACHESIZE',18) +HW_L2SETTINGS = Constant('HW_L2SETTINGS',19) +HW_L2CACHESIZE = Constant('HW_L2CACHESIZE',20) +HW_L3SETTINGS = Constant('HW_L3SETTINGS',21) +HW_L3CACHESIZE = Constant('HW_L3CACHESIZE',22) +HW_TB_FREQ = Constant('HW_TB_FREQ',23) +HW_MEMSIZE = Constant('HW_MEMSIZE',24) +HW_AVAILCPU = Constant('HW_AVAILCPU',25) +HW_TARGET = Constant('HW_TARGET',26) +HW_PRODUCT = Constant('HW_PRODUCT',27) +HW_MAXID = Constant('HW_MAXID',28) +USER_CS_PATH = Constant('USER_CS_PATH',1) +USER_BC_BASE_MAX = Constant('USER_BC_BASE_MAX',2) +USER_BC_DIM_MAX = Constant('USER_BC_DIM_MAX',3) +USER_BC_SCALE_MAX = Constant('USER_BC_SCALE_MAX',4) +USER_BC_STRING_MAX = Constant('USER_BC_STRING_MAX',5) +USER_COLL_WEIGHTS_MAX = Constant('USER_COLL_WEIGHTS_MAX',6) +USER_EXPR_NEST_MAX = Constant('USER_EXPR_NEST_MAX',7) +USER_LINE_MAX = Constant('USER_LINE_MAX',8) +USER_RE_DUP_MAX = Constant('USER_RE_DUP_MAX',9) +USER_POSIX2_VERSION = Constant('USER_POSIX2_VERSION',10) +USER_POSIX2_C_BIND = Constant('USER_POSIX2_C_BIND',11) +USER_POSIX2_C_DEV = Constant('USER_POSIX2_C_DEV',12) +USER_POSIX2_CHAR_TERM = Constant('USER_POSIX2_CHAR_TERM',13) +USER_POSIX2_FORT_DEV = Constant('USER_POSIX2_FORT_DEV',14) +USER_POSIX2_FORT_RUN = Constant('USER_POSIX2_FORT_RUN',15) +USER_POSIX2_LOCALEDEF = Constant('USER_POSIX2_LOCALEDEF',16) +USER_POSIX2_SW_DEV = Constant('USER_POSIX2_SW_DEV',17) +USER_POSIX2_UPE = Constant('USER_POSIX2_UPE',18) +USER_STREAM_MAX = Constant('USER_STREAM_MAX',19) +USER_TZNAME_MAX = Constant('USER_TZNAME_MAX',20) +USER_MAXID = Constant('USER_MAXID',21) +CTL_DEBUG_NAME = Constant('CTL_DEBUG_NAME',0) +CTL_DEBUG_VALUE = Constant('CTL_DEBUG_VALUE',1) +CTL_DEBUG_MAXID = Constant('CTL_DEBUG_MAXID',20) +UTF_REVERSE_ENDIAN = Constant('UTF_REVERSE_ENDIAN',0x0001) +UTF_NO_NULL_TERM = Constant('UTF_NO_NULL_TERM',0x0002) +UTF_DECOMPOSED = Constant('UTF_DECOMPOSED',0x0004) +UTF_PRECOMPOSED = Constant('UTF_PRECOMPOSED',0x0008) +UTF_ESCAPE_ILLEGAL = Constant('UTF_ESCAPE_ILLEGAL',0x0010) +UTF_SFM_CONVERSIONS = Constant('UTF_SFM_CONVERSIONS',0x0020) +PRIO_PROCESS = Constant('PRIO_PROCESS',0) +PRIO_PGRP = Constant('PRIO_PGRP',1) +PRIO_USER = Constant('PRIO_USER',2) +PRIO_DARWIN_THREAD = Constant('PRIO_DARWIN_THREAD',3) +PRIO_DARWIN_PROCESS = Constant('PRIO_DARWIN_PROCESS',4) +PRIO_MAX = Constant('PRIO_MAX',20) +PRIO_DARWIN_BG = Constant('PRIO_DARWIN_BG',0x1000) +PRIO_DARWIN_NONUI = Constant('PRIO_DARWIN_NONUI',0x1001) +RUSAGE_SELF = Constant('RUSAGE_SELF',0) +RUSAGE_INFO_V0 = Constant('RUSAGE_INFO_V0',0) +RUSAGE_INFO_V1 = Constant('RUSAGE_INFO_V1',1) +RUSAGE_INFO_V2 = Constant('RUSAGE_INFO_V2',2) +RUSAGE_INFO_V3 = Constant('RUSAGE_INFO_V3',3) +RUSAGE_INFO_V4 = Constant('RUSAGE_INFO_V4',4) +RUSAGE_INFO_V5 = Constant('RUSAGE_INFO_V5',5) +RUSAGE_INFO_V6 = Constant('RUSAGE_INFO_V6',6) +RU_PROC_RUNS_RESLIDE = Constant('RU_PROC_RUNS_RESLIDE',0x00000001) +RLIMIT_CPU = Constant('RLIMIT_CPU',0) +RLIMIT_FSIZE = Constant('RLIMIT_FSIZE',1) +RLIMIT_DATA = Constant('RLIMIT_DATA',2) +RLIMIT_STACK = Constant('RLIMIT_STACK',3) +RLIMIT_CORE = Constant('RLIMIT_CORE',4) +RLIMIT_AS = Constant('RLIMIT_AS',5) +RLIMIT_MEMLOCK = Constant('RLIMIT_MEMLOCK',6) +RLIMIT_NPROC = Constant('RLIMIT_NPROC',7) +RLIMIT_NOFILE = Constant('RLIMIT_NOFILE',8) +RLIM_NLIMITS = Constant('RLIM_NLIMITS',9) +_RLIMIT_POSIX_FLAG = Constant('_RLIMIT_POSIX_FLAG',0x1000) +RLIMIT_WAKEUPS_MONITOR = Constant('RLIMIT_WAKEUPS_MONITOR',0x1) +RLIMIT_CPU_USAGE_MONITOR = Constant('RLIMIT_CPU_USAGE_MONITOR',0x2) +RLIMIT_THREAD_CPULIMITS = Constant('RLIMIT_THREAD_CPULIMITS',0x3) +RLIMIT_FOOTPRINT_INTERVAL = Constant('RLIMIT_FOOTPRINT_INTERVAL',0x4) +WAKEMON_ENABLE = Constant('WAKEMON_ENABLE',0x01) +WAKEMON_DISABLE = Constant('WAKEMON_DISABLE',0x02) +WAKEMON_GET_PARAMS = Constant('WAKEMON_GET_PARAMS',0x04) +WAKEMON_SET_DEFAULTS = Constant('WAKEMON_SET_DEFAULTS',0x08) +WAKEMON_MAKE_FATAL = Constant('WAKEMON_MAKE_FATAL',0x10) +CPUMON_MAKE_FATAL = Constant('CPUMON_MAKE_FATAL',0x1000) +FOOTPRINT_INTERVAL_RESET = Constant('FOOTPRINT_INTERVAL_RESET',0x1) +IOPOL_TYPE_DISK = Constant('IOPOL_TYPE_DISK',0) +IOPOL_TYPE_VFS_ATIME_UPDATES = Constant('IOPOL_TYPE_VFS_ATIME_UPDATES',2) +IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = Constant('IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES',3) +IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = Constant('IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME',4) +IOPOL_TYPE_VFS_TRIGGER_RESOLVE = Constant('IOPOL_TYPE_VFS_TRIGGER_RESOLVE',5) +IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = Constant('IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION',6) +IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = Constant('IOPOL_TYPE_VFS_IGNORE_PERMISSIONS',7) +IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = Constant('IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE',8) +IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = Constant('IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES',9) +IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = Constant('IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY',10) +IOPOL_SCOPE_PROCESS = Constant('IOPOL_SCOPE_PROCESS',0) +IOPOL_SCOPE_THREAD = Constant('IOPOL_SCOPE_THREAD',1) +IOPOL_SCOPE_DARWIN_BG = Constant('IOPOL_SCOPE_DARWIN_BG',2) +IOPOL_DEFAULT = Constant('IOPOL_DEFAULT',0) +IOPOL_IMPORTANT = Constant('IOPOL_IMPORTANT',1) +IOPOL_PASSIVE = Constant('IOPOL_PASSIVE',2) +IOPOL_THROTTLE = Constant('IOPOL_THROTTLE',3) +IOPOL_UTILITY = Constant('IOPOL_UTILITY',4) +IOPOL_STANDARD = Constant('IOPOL_STANDARD',5) +IOPOL_ATIME_UPDATES_DEFAULT = Constant('IOPOL_ATIME_UPDATES_DEFAULT',0) +IOPOL_ATIME_UPDATES_OFF = Constant('IOPOL_ATIME_UPDATES_OFF',1) +IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = Constant('IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT',0) +IOPOL_MATERIALIZE_DATALESS_FILES_OFF = Constant('IOPOL_MATERIALIZE_DATALESS_FILES_OFF',1) +IOPOL_MATERIALIZE_DATALESS_FILES_ON = Constant('IOPOL_MATERIALIZE_DATALESS_FILES_ON',2) +IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = Constant('IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT',0) +IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = Constant('IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME',1) +IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = Constant('IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT',0) +IOPOL_VFS_TRIGGER_RESOLVE_OFF = Constant('IOPOL_VFS_TRIGGER_RESOLVE_OFF',1) +IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = Constant('IOPOL_VFS_CONTENT_PROTECTION_DEFAULT',0) +IOPOL_VFS_CONTENT_PROTECTION_IGNORE = Constant('IOPOL_VFS_CONTENT_PROTECTION_IGNORE',1) +IOPOL_VFS_IGNORE_PERMISSIONS_OFF = Constant('IOPOL_VFS_IGNORE_PERMISSIONS_OFF',0) +IOPOL_VFS_IGNORE_PERMISSIONS_ON = Constant('IOPOL_VFS_IGNORE_PERMISSIONS_ON',1) +IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = Constant('IOPOL_VFS_SKIP_MTIME_UPDATE_OFF',0) +IOPOL_VFS_SKIP_MTIME_UPDATE_ON = Constant('IOPOL_VFS_SKIP_MTIME_UPDATE_ON',1) +IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = Constant('IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF',0) +IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = Constant('IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON',1) +IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = Constant('IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT',0) +IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = Constant('IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON',1) +IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = Constant('IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT',0) +IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = Constant('IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON',1) +IOCPARM_MASK = Constant('IOCPARM_MASK',0x1fff) +XATTR_NOFOLLOW = Constant('XATTR_NOFOLLOW',0x0001) +XATTR_CREATE = Constant('XATTR_CREATE',0x0002) +XATTR_REPLACE = Constant('XATTR_REPLACE',0x0004) +XATTR_NOSECURITY = Constant('XATTR_NOSECURITY',0x0008) +XATTR_NODEFAULT = Constant('XATTR_NODEFAULT',0x0010) +XATTR_SHOWCOMPRESSION = Constant('XATTR_SHOWCOMPRESSION',0x0020) +XATTR_MAXNAMELEN = Constant('XATTR_MAXNAMELEN',127) +PR_SLOWHZ = Constant('PR_SLOWHZ',2) +PRC_IFDOWN = Constant('PRC_IFDOWN',0) +PRC_ROUTEDEAD = Constant('PRC_ROUTEDEAD',1) +PRC_IFUP = Constant('PRC_IFUP',2) +PRC_QUENCH2 = Constant('PRC_QUENCH2',3) +PRC_QUENCH = Constant('PRC_QUENCH',4) +PRC_MSGSIZE = Constant('PRC_MSGSIZE',5) +PRC_HOSTDEAD = Constant('PRC_HOSTDEAD',6) +PRC_HOSTUNREACH = Constant('PRC_HOSTUNREACH',7) +PRC_UNREACH_NET = Constant('PRC_UNREACH_NET',8) +PRC_UNREACH_HOST = Constant('PRC_UNREACH_HOST',9) +PRC_UNREACH_PROTOCOL = Constant('PRC_UNREACH_PROTOCOL',10) +PRC_UNREACH_PORT = Constant('PRC_UNREACH_PORT',11) +PRC_UNREACH_SRCFAIL = Constant('PRC_UNREACH_SRCFAIL',13) +PRC_REDIRECT_NET = Constant('PRC_REDIRECT_NET',14) +PRC_REDIRECT_HOST = Constant('PRC_REDIRECT_HOST',15) +PRC_REDIRECT_TOSNET = Constant('PRC_REDIRECT_TOSNET',16) +PRC_REDIRECT_TOSHOST = Constant('PRC_REDIRECT_TOSHOST',17) +PRC_TIMXCEED_INTRANS = Constant('PRC_TIMXCEED_INTRANS',18) +PRC_TIMXCEED_REASS = Constant('PRC_TIMXCEED_REASS',19) +PRC_PARAMPROB = Constant('PRC_PARAMPROB',20) +PRC_UNREACH_ADMIN_PROHIB = Constant('PRC_UNREACH_ADMIN_PROHIB',21) +PRC_NCMDS = Constant('PRC_NCMDS',22) +KEV_CTL_SUBCLASS = Constant('KEV_CTL_SUBCLASS',2) +KEV_CTL_REGISTERED = Constant('KEV_CTL_REGISTERED',1) +KEV_CTL_DEREGISTERED = Constant('KEV_CTL_DEREGISTERED',2) +MAX_KCTL_NAME = Constant('MAX_KCTL_NAME',96) +CTL_FLAG_PRIVILEGED = Constant('CTL_FLAG_PRIVILEGED',0x1) +CTL_FLAG_REG_ID_UNIT = Constant('CTL_FLAG_REG_ID_UNIT',0x2) +CTL_FLAG_REG_SOCK_STREAM = Constant('CTL_FLAG_REG_SOCK_STREAM',0x4) +CTL_DATA_NOWAKEUP = Constant('CTL_DATA_NOWAKEUP',0x1) +CTL_DATA_EOR = Constant('CTL_DATA_EOR',0x2) +__DARWIN_ONLY_64_BIT_INO_T = Constant('__DARWIN_ONLY_64_BIT_INO_T',0) +__DARWIN_ONLY_UNIX_CONFORMANCE = Constant('__DARWIN_ONLY_UNIX_CONFORMANCE',0) +__DARWIN_ONLY_VERS_1050 = Constant('__DARWIN_ONLY_VERS_1050',0) +__STDC_WANT_LIB_EXT1__ = Constant('__STDC_WANT_LIB_EXT1__',1) +__DARWIN_NO_LONG_LONG = Constant('__DARWIN_NO_LONG_LONG',0) +_DARWIN_FEATURE_64_BIT_INODE = Constant('_DARWIN_FEATURE_64_BIT_INODE',1) +_DARWIN_FEATURE_ONLY_64_BIT_INODE = Constant('_DARWIN_FEATURE_ONLY_64_BIT_INODE',1) +_DARWIN_FEATURE_ONLY_VERS_1050 = Constant('_DARWIN_FEATURE_ONLY_VERS_1050',1) +_DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = Constant('_DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE',1) +_DARWIN_FEATURE_UNIX_CONFORMANCE = Constant('_DARWIN_FEATURE_UNIX_CONFORMANCE',3) +__has_ptrcheck = Constant('__has_ptrcheck',0) +MAXMAXPARTITIONS = Constant('MAXMAXPARTITIONS',22) +NDDATA = Constant('NDDATA',5) +NSPARE = Constant('NSPARE',5) +DTYPE_SMD = Constant('DTYPE_SMD',1) +DTYPE_MSCP = Constant('DTYPE_MSCP',2) +DTYPE_DEC = Constant('DTYPE_DEC',3) +DTYPE_SCSI = Constant('DTYPE_SCSI',4) +DTYPE_ESDI = Constant('DTYPE_ESDI',5) +DTYPE_ST506 = Constant('DTYPE_ST506',6) +DTYPE_HPIB = Constant('DTYPE_HPIB',7) +DTYPE_HPFL = Constant('DTYPE_HPFL',8) +DTYPE_FLOPPY = Constant('DTYPE_FLOPPY',10) +FS_UNUSED = Constant('FS_UNUSED',0) +FS_SWAP = Constant('FS_SWAP',1) +FS_V6 = Constant('FS_V6',2) +FS_V7 = Constant('FS_V7',3) +FS_SYSV = Constant('FS_SYSV',4) +FS_V71K = Constant('FS_V71K',5) +FS_V8 = Constant('FS_V8',6) +FS_BSDFFS = Constant('FS_BSDFFS',7) +FS_MSDOS = Constant('FS_MSDOS',8) +FS_BSDLFS = Constant('FS_BSDLFS',9) +FS_OTHER = Constant('FS_OTHER',10) +FS_HPFS = Constant('FS_HPFS',11) +FS_ISO9660 = Constant('FS_ISO9660',12) +FS_BOOT = Constant('FS_BOOT',13) +FS_ADOS = Constant('FS_ADOS',14) +FS_HFS = Constant('FS_HFS',15) +D_REMOVABLE = Constant('D_REMOVABLE',0x01) +D_ECC = Constant('D_ECC',0x02) +D_BADSECT = Constant('D_BADSECT',0x04) +D_RAMDISK = Constant('D_RAMDISK',0x08) +D_CHAIN = Constant('D_CHAIN',0x10) +D_SSE = Constant('D_SSE',0x1) +EPERM = Constant('EPERM',1) +ENOENT = Constant('ENOENT',2) +ESRCH = Constant('ESRCH',3) +EINTR = Constant('EINTR',4) +EIO = Constant('EIO',5) +ENXIO = Constant('ENXIO',6) +E2BIG = Constant('E2BIG',7) +ENOEXEC = Constant('ENOEXEC',8) +EBADF = Constant('EBADF',9) +ECHILD = Constant('ECHILD',10) +EDEADLK = Constant('EDEADLK',11) +ENOMEM = Constant('ENOMEM',12) +EACCES = Constant('EACCES',13) +EFAULT = Constant('EFAULT',14) +ENOTBLK = Constant('ENOTBLK',15) +EBUSY = Constant('EBUSY',16) +EEXIST = Constant('EEXIST',17) +EXDEV = Constant('EXDEV',18) +ENODEV = Constant('ENODEV',19) +ENOTDIR = Constant('ENOTDIR',20) +EISDIR = Constant('EISDIR',21) +EINVAL = Constant('EINVAL',22) +ENFILE = Constant('ENFILE',23) +EMFILE = Constant('EMFILE',24) +ENOTTY = Constant('ENOTTY',25) +ETXTBSY = Constant('ETXTBSY',26) +EFBIG = Constant('EFBIG',27) +ENOSPC = Constant('ENOSPC',28) +ESPIPE = Constant('ESPIPE',29) +EROFS = Constant('EROFS',30) +EMLINK = Constant('EMLINK',31) +EPIPE = Constant('EPIPE',32) +EDOM = Constant('EDOM',33) +ERANGE = Constant('ERANGE',34) +EAGAIN = Constant('EAGAIN',35) +EINPROGRESS = Constant('EINPROGRESS',36) +EALREADY = Constant('EALREADY',37) +ENOTSOCK = Constant('ENOTSOCK',38) +EDESTADDRREQ = Constant('EDESTADDRREQ',39) +EMSGSIZE = Constant('EMSGSIZE',40) +EPROTOTYPE = Constant('EPROTOTYPE',41) +ENOPROTOOPT = Constant('ENOPROTOOPT',42) +EPROTONOSUPPORT = Constant('EPROTONOSUPPORT',43) +ESOCKTNOSUPPORT = Constant('ESOCKTNOSUPPORT',44) +ENOTSUP = Constant('ENOTSUP',45) +EPFNOSUPPORT = Constant('EPFNOSUPPORT',46) +EAFNOSUPPORT = Constant('EAFNOSUPPORT',47) +EADDRINUSE = Constant('EADDRINUSE',48) +EADDRNOTAVAIL = Constant('EADDRNOTAVAIL',49) +ENETDOWN = Constant('ENETDOWN',50) +ENETUNREACH = Constant('ENETUNREACH',51) +ENETRESET = Constant('ENETRESET',52) +ECONNABORTED = Constant('ECONNABORTED',53) +ECONNRESET = Constant('ECONNRESET',54) +ENOBUFS = Constant('ENOBUFS',55) +EISCONN = Constant('EISCONN',56) +ENOTCONN = Constant('ENOTCONN',57) +ESHUTDOWN = Constant('ESHUTDOWN',58) +ETOOMANYREFS = Constant('ETOOMANYREFS',59) +ETIMEDOUT = Constant('ETIMEDOUT',60) +ECONNREFUSED = Constant('ECONNREFUSED',61) +ELOOP = Constant('ELOOP',62) +ENAMETOOLONG = Constant('ENAMETOOLONG',63) +EHOSTDOWN = Constant('EHOSTDOWN',64) +EHOSTUNREACH = Constant('EHOSTUNREACH',65) +ENOTEMPTY = Constant('ENOTEMPTY',66) +EPROCLIM = Constant('EPROCLIM',67) +EUSERS = Constant('EUSERS',68) +EDQUOT = Constant('EDQUOT',69) +ESTALE = Constant('ESTALE',70) +EREMOTE = Constant('EREMOTE',71) +EBADRPC = Constant('EBADRPC',72) +ERPCMISMATCH = Constant('ERPCMISMATCH',73) +EPROGUNAVAIL = Constant('EPROGUNAVAIL',74) +EPROGMISMATCH = Constant('EPROGMISMATCH',75) +EPROCUNAVAIL = Constant('EPROCUNAVAIL',76) +ENOLCK = Constant('ENOLCK',77) +ENOSYS = Constant('ENOSYS',78) +EFTYPE = Constant('EFTYPE',79) +EAUTH = Constant('EAUTH',80) +ENEEDAUTH = Constant('ENEEDAUTH',81) +EPWROFF = Constant('EPWROFF',82) +EDEVERR = Constant('EDEVERR',83) +EOVERFLOW = Constant('EOVERFLOW',84) +EBADEXEC = Constant('EBADEXEC',85) +EBADARCH = Constant('EBADARCH',86) +ESHLIBVERS = Constant('ESHLIBVERS',87) +EBADMACHO = Constant('EBADMACHO',88) +ECANCELED = Constant('ECANCELED',89) +EIDRM = Constant('EIDRM',90) +ENOMSG = Constant('ENOMSG',91) +EILSEQ = Constant('EILSEQ',92) +ENOATTR = Constant('ENOATTR',93) +EBADMSG = Constant('EBADMSG',94) +EMULTIHOP = Constant('EMULTIHOP',95) +ENODATA = Constant('ENODATA',96) +ENOLINK = Constant('ENOLINK',97) +ENOSR = Constant('ENOSR',98) +ENOSTR = Constant('ENOSTR',99) +EPROTO = Constant('EPROTO',100) +ETIME = Constant('ETIME',101) +EOPNOTSUPP = Constant('EOPNOTSUPP',102) +ENOPOLICY = Constant('ENOPOLICY',103) +ENOTRECOVERABLE = Constant('ENOTRECOVERABLE',104) +EOWNERDEAD = Constant('EOWNERDEAD',105) +EQFULL = Constant('EQFULL',106) +ELAST = Constant('ELAST',106) +VEOF = Constant('VEOF',0) +VEOL = Constant('VEOL',1) +VEOL2 = Constant('VEOL2',2) +VERASE = Constant('VERASE',3) +VWERASE = Constant('VWERASE',4) +VKILL = Constant('VKILL',5) +VREPRINT = Constant('VREPRINT',6) +VINTR = Constant('VINTR',8) +VQUIT = Constant('VQUIT',9) +VSUSP = Constant('VSUSP',10) +VDSUSP = Constant('VDSUSP',11) +VSTART = Constant('VSTART',12) +VSTOP = Constant('VSTOP',13) +VLNEXT = Constant('VLNEXT',14) +VDISCARD = Constant('VDISCARD',15) +VMIN = Constant('VMIN',16) +VTIME = Constant('VTIME',17) +VSTATUS = Constant('VSTATUS',18) +NCCS = Constant('NCCS',20) +IGNBRK = Constant('IGNBRK',0x00000001) +BRKINT = Constant('BRKINT',0x00000002) +IGNPAR = Constant('IGNPAR',0x00000004) +PARMRK = Constant('PARMRK',0x00000008) +INPCK = Constant('INPCK',0x00000010) +ISTRIP = Constant('ISTRIP',0x00000020) +INLCR = Constant('INLCR',0x00000040) +IGNCR = Constant('IGNCR',0x00000080) +ICRNL = Constant('ICRNL',0x00000100) +IXON = Constant('IXON',0x00000200) +IXOFF = Constant('IXOFF',0x00000400) +IXANY = Constant('IXANY',0x00000800) +IMAXBEL = Constant('IMAXBEL',0x00002000) +IUTF8 = Constant('IUTF8',0x00004000) +OPOST = Constant('OPOST',0x00000001) +ONLCR = Constant('ONLCR',0x00000002) +OXTABS = Constant('OXTABS',0x00000004) +ONOEOT = Constant('ONOEOT',0x00000008) +OCRNL = Constant('OCRNL',0x00000010) +ONOCR = Constant('ONOCR',0x00000020) +ONLRET = Constant('ONLRET',0x00000040) +OFILL = Constant('OFILL',0x00000080) +NLDLY = Constant('NLDLY',0x00000300) +TABDLY = Constant('TABDLY',0x00000c04) +CRDLY = Constant('CRDLY',0x00003000) +FFDLY = Constant('FFDLY',0x00004000) +BSDLY = Constant('BSDLY',0x00008000) +VTDLY = Constant('VTDLY',0x00010000) +OFDEL = Constant('OFDEL',0x00020000) +TAB3 = Constant('TAB3',0x00000004) +VT0 = Constant('VT0',0x00000000) +VT1 = Constant('VT1',0x00010000) +CIGNORE = Constant('CIGNORE',0x00000001) +CSIZE = Constant('CSIZE',0x00000300) +CS5 = Constant('CS5',0x00000000) +CS6 = Constant('CS6',0x00000100) +CS7 = Constant('CS7',0x00000200) +CS8 = Constant('CS8',0x00000300) +CSTOPB = Constant('CSTOPB',0x00000400) +CREAD = Constant('CREAD',0x00000800) +PARENB = Constant('PARENB',0x00001000) +PARODD = Constant('PARODD',0x00002000) +HUPCL = Constant('HUPCL',0x00004000) +CLOCAL = Constant('CLOCAL',0x00008000) +CCTS_OFLOW = Constant('CCTS_OFLOW',0x00010000) +CRTS_IFLOW = Constant('CRTS_IFLOW',0x00020000) +CDTR_IFLOW = Constant('CDTR_IFLOW',0x00040000) +CDSR_OFLOW = Constant('CDSR_OFLOW',0x00080000) +CCAR_OFLOW = Constant('CCAR_OFLOW',0x00100000) +ECHOKE = Constant('ECHOKE',0x00000001) +ECHOE = Constant('ECHOE',0x00000002) +ECHOK = Constant('ECHOK',0x00000004) +ECHONL = Constant('ECHONL',0x00000010) +ECHOPRT = Constant('ECHOPRT',0x00000020) +ECHOCTL = Constant('ECHOCTL',0x00000040) +ISIG = Constant('ISIG',0x00000080) +ICANON = Constant('ICANON',0x00000100) +ALTWERASE = Constant('ALTWERASE',0x00000200) +IEXTEN = Constant('IEXTEN',0x00000400) +EXTPROC = Constant('EXTPROC',0x00000800) +NOKERNINFO = Constant('NOKERNINFO',0x02000000) +TCSANOW = Constant('TCSANOW',0) +TCSADRAIN = Constant('TCSADRAIN',1) +TCSAFLUSH = Constant('TCSAFLUSH',2) +TCSASOFT = Constant('TCSASOFT',0x10) +B0 = Constant('B0',0) +B50 = Constant('B50',50) +B75 = Constant('B75',75) +B110 = Constant('B110',110) +B134 = Constant('B134',134) +B150 = Constant('B150',150) +B200 = Constant('B200',200) +B300 = Constant('B300',300) +B600 = Constant('B600',600) +B1200 = Constant('B1200',1200) +B1800 = Constant('B1800',1800) +B2400 = Constant('B2400',2400) +B4800 = Constant('B4800',4800) +B9600 = Constant('B9600',9600) +B19200 = Constant('B19200',19200) +B38400 = Constant('B38400',38400) +B7200 = Constant('B7200',7200) +B14400 = Constant('B14400',14400) +B28800 = Constant('B28800',28800) +B57600 = Constant('B57600',57600) +B76800 = Constant('B76800',76800) +B115200 = Constant('B115200',115200) +B230400 = Constant('B230400',230400) +EXTA = Constant('EXTA',19200) +EXTB = Constant('EXTB',38400) +RENAME_SECLUDE = Constant('RENAME_SECLUDE',0x00000001) +RENAME_SWAP = Constant('RENAME_SWAP',0x00000002) +RENAME_EXCL = Constant('RENAME_EXCL',0x00000004) +RENAME_RESERVED1 = Constant('RENAME_RESERVED1',0x00000008) +RENAME_NOFOLLOW_ANY = Constant('RENAME_NOFOLLOW_ANY',0x00000010) +MFSNAMELEN = Constant('MFSNAMELEN',15) +MFSTYPENAMELEN = Constant('MFSTYPENAMELEN',16) +MNAMELEN = Constant('MNAMELEN',90) +MNT_EXT_ROOT_DATA_VOL = Constant('MNT_EXT_ROOT_DATA_VOL',0x00000001) +MNT_EXT_FSKIT = Constant('MNT_EXT_FSKIT',0x00000002) +MNT_RDONLY = Constant('MNT_RDONLY',0x00000001) +MNT_SYNCHRONOUS = Constant('MNT_SYNCHRONOUS',0x00000002) +MNT_NOEXEC = Constant('MNT_NOEXEC',0x00000004) +MNT_NOSUID = Constant('MNT_NOSUID',0x00000008) +MNT_NODEV = Constant('MNT_NODEV',0x00000010) +MNT_UNION = Constant('MNT_UNION',0x00000020) +MNT_ASYNC = Constant('MNT_ASYNC',0x00000040) +MNT_CPROTECT = Constant('MNT_CPROTECT',0x00000080) +MNT_EXPORTED = Constant('MNT_EXPORTED',0x00000100) +MNT_REMOVABLE = Constant('MNT_REMOVABLE',0x00000200) +MNT_QUARANTINE = Constant('MNT_QUARANTINE',0x00000400) +MNT_LOCAL = Constant('MNT_LOCAL',0x00001000) +MNT_QUOTA = Constant('MNT_QUOTA',0x00002000) +MNT_ROOTFS = Constant('MNT_ROOTFS',0x00004000) +MNT_DOVOLFS = Constant('MNT_DOVOLFS',0x00008000) +MNT_DONTBROWSE = Constant('MNT_DONTBROWSE',0x00100000) +MNT_IGNORE_OWNERSHIP = Constant('MNT_IGNORE_OWNERSHIP',0x00200000) +MNT_AUTOMOUNTED = Constant('MNT_AUTOMOUNTED',0x00400000) +MNT_JOURNALED = Constant('MNT_JOURNALED',0x00800000) +MNT_NOUSERXATTR = Constant('MNT_NOUSERXATTR',0x01000000) +MNT_DEFWRITE = Constant('MNT_DEFWRITE',0x02000000) +MNT_MULTILABEL = Constant('MNT_MULTILABEL',0x04000000) +MNT_NOFOLLOW = Constant('MNT_NOFOLLOW',0x08000000) +MNT_NOATIME = Constant('MNT_NOATIME',0x10000000) +MNT_SNAPSHOT = Constant('MNT_SNAPSHOT',0x40000000) +MNT_STRICTATIME = Constant('MNT_STRICTATIME',0x80000000) +MNT_UPDATE = Constant('MNT_UPDATE',0x00010000) +MNT_NOBLOCK = Constant('MNT_NOBLOCK',0x00020000) +MNT_RELOAD = Constant('MNT_RELOAD',0x00040000) +MNT_FORCE = Constant('MNT_FORCE',0x00080000) +VFS_GENERIC = Constant('VFS_GENERIC',0) +VFS_NUMMNTOPS = Constant('VFS_NUMMNTOPS',1) +VFS_MAXTYPENUM = Constant('VFS_MAXTYPENUM',1) +VFS_CONF = Constant('VFS_CONF',2) +MNT_WAIT = Constant('MNT_WAIT',1) +MNT_NOWAIT = Constant('MNT_NOWAIT',2) +MNT_DWAIT = Constant('MNT_DWAIT',4) +MNT_VOLUME = Constant('MNT_VOLUME',8) +VFS_CTL_VERS1 = Constant('VFS_CTL_VERS1',0x01) +VFS_CTL_OSTATFS = Constant('VFS_CTL_OSTATFS',0x00010001) +VFS_CTL_UMOUNT = Constant('VFS_CTL_UMOUNT',0x00010002) +VFS_CTL_QUERY = Constant('VFS_CTL_QUERY',0x00010003) +VFS_CTL_NEWADDR = Constant('VFS_CTL_NEWADDR',0x00010004) +VFS_CTL_TIMEO = Constant('VFS_CTL_TIMEO',0x00010005) +VFS_CTL_NOLOCKS = Constant('VFS_CTL_NOLOCKS',0x00010006) +VFS_CTL_SADDR = Constant('VFS_CTL_SADDR',0x00010007) +VFS_CTL_DISC = Constant('VFS_CTL_DISC',0x00010008) +VFS_CTL_SERVERINFO = Constant('VFS_CTL_SERVERINFO',0x00010009) +VFS_CTL_NSTATUS = Constant('VFS_CTL_NSTATUS',0x0001000A) +VFS_CTL_STATFS64 = Constant('VFS_CTL_STATFS64',0x0001000B) +VQ_NOTRESP = Constant('VQ_NOTRESP',0x0001) +VQ_NEEDAUTH = Constant('VQ_NEEDAUTH',0x0002) +VQ_LOWDISK = Constant('VQ_LOWDISK',0x0004) +VQ_MOUNT = Constant('VQ_MOUNT',0x0008) +VQ_UNMOUNT = Constant('VQ_UNMOUNT',0x0010) +VQ_DEAD = Constant('VQ_DEAD',0x0020) +VQ_ASSIST = Constant('VQ_ASSIST',0x0040) +VQ_NOTRESPLOCK = Constant('VQ_NOTRESPLOCK',0x0080) +VQ_UPDATE = Constant('VQ_UPDATE',0x0100) +VQ_VERYLOWDISK = Constant('VQ_VERYLOWDISK',0x0200) +VQ_SYNCEVENT = Constant('VQ_SYNCEVENT',0x0400) +VQ_SERVEREVENT = Constant('VQ_SERVEREVENT',0x0800) +VQ_QUOTA = Constant('VQ_QUOTA',0x1000) +VQ_NEARLOWDISK = Constant('VQ_NEARLOWDISK',0x2000) +VQ_DESIRED_DISK = Constant('VQ_DESIRED_DISK',0x4000) +VQ_FREE_SPACE_CHANGE = Constant('VQ_FREE_SPACE_CHANGE',0x8000) +VQ_FLAG10000 = Constant('VQ_FLAG10000',0x10000) +VFS_IOATTR_FLAGS_FUA = Constant('VFS_IOATTR_FLAGS_FUA',0x00000001) +VFS_IOATTR_FLAGS_UNMAP = Constant('VFS_IOATTR_FLAGS_UNMAP',0x00000002) +VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED = Constant('VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED',0x00000010) +VFS_TBLTHREADSAFE = Constant('VFS_TBLTHREADSAFE',0x0001) +VFS_TBLFSNODELOCK = Constant('VFS_TBLFSNODELOCK',0x0002) +VFS_TBLNOTYPENUM = Constant('VFS_TBLNOTYPENUM',0x0008) +VFS_TBLLOCALVOL = Constant('VFS_TBLLOCALVOL',0x0010) +VFS_TBL64BITREADY = Constant('VFS_TBL64BITREADY',0x0020) +VFS_TBLNATIVEXATTR = Constant('VFS_TBLNATIVEXATTR',0x0040) +VFS_TBLDIRLINKS = Constant('VFS_TBLDIRLINKS',0x0080) +VFS_TBLUNMOUNT_PREFLIGHT = Constant('VFS_TBLUNMOUNT_PREFLIGHT',0x0100) +VFS_TBLGENERICMNTARGS = Constant('VFS_TBLGENERICMNTARGS',0x0200) +VFS_TBLREADDIR_EXTENDED = Constant('VFS_TBLREADDIR_EXTENDED',0x0400) +VFS_TBLNOMACLABEL = Constant('VFS_TBLNOMACLABEL',0x1000) +VFS_TBLVNOP_PAGEINV2 = Constant('VFS_TBLVNOP_PAGEINV2',0x2000) +VFS_TBLVNOP_PAGEOUTV2 = Constant('VFS_TBLVNOP_PAGEOUTV2',0x4000) +VFS_TBLVNOP_NOUPDATEID_RENAME = Constant('VFS_TBLVNOP_NOUPDATEID_RENAME',0x8000) +VFS_TBLVNOP_SECLUDE_RENAME = Constant('VFS_TBLVNOP_SECLUDE_RENAME',0x10000) +VFS_TBLCANMOUNTROOT = Constant('VFS_TBLCANMOUNTROOT',0x20000) +VFSIOC_MOUNT_BYROLE_has_recovery = Constant('VFSIOC_MOUNT_BYROLE_has_recovery',1) +VFS_RETURNED = Constant('VFS_RETURNED',0) +VFS_RETURNED_DONE = Constant('VFS_RETURNED_DONE',1) +VFS_CLAIMED = Constant('VFS_CLAIMED',2) +VFS_CLAIMED_DONE = Constant('VFS_CLAIMED_DONE',3) +VFS_USER_EVENT = Constant('VFS_USER_EVENT',0) +VFS_KERNEL_EVENT = Constant('VFS_KERNEL_EVENT',1) +LK_NOWAIT = Constant('LK_NOWAIT',1) +NFSV4_MAX_FH_SIZE = Constant('NFSV4_MAX_FH_SIZE',128) +NFSV3_MAX_FH_SIZE = Constant('NFSV3_MAX_FH_SIZE',64) +NFSV2_MAX_FH_SIZE = Constant('NFSV2_MAX_FH_SIZE',32) +CRYPTEX_AUTH_STRUCT_VERSION = Constant('CRYPTEX_AUTH_STRUCT_VERSION',1) +EV_FD = Constant('EV_FD',1) +EV_RE = Constant('EV_RE',1) +EV_WR = Constant('EV_WR',2) +EV_EX = Constant('EV_EX',4) +EV_RM = Constant('EV_RM',8) +EV_MASK = Constant('EV_MASK',0xf) +EV_RBYTES = Constant('EV_RBYTES',0x100) +EV_WBYTES = Constant('EV_WBYTES',0x200) +EV_RCLOSED = Constant('EV_RCLOSED',0x400) +EV_RCONN = Constant('EV_RCONN',0x800) +EV_WCLOSED = Constant('EV_WCLOSED',0x1000) +EV_WCONN = Constant('EV_WCONN',0x2000) +EV_OOB = Constant('EV_OOB',0x4000) +EV_FIN = Constant('EV_FIN',0x8000) +EV_RESET = Constant('EV_RESET',0x10000) +EV_TIMEOUT = Constant('EV_TIMEOUT',0x20000) +EV_DMASK = Constant('EV_DMASK',0xffffff00) +KDEBUG_LEVEL_NONE = Constant('KDEBUG_LEVEL_NONE',0) +KDEBUG_LEVEL_IST = Constant('KDEBUG_LEVEL_IST',1) +KDEBUG_LEVEL_STANDARD = Constant('KDEBUG_LEVEL_STANDARD',2) +KDEBUG_LEVEL_FULL = Constant('KDEBUG_LEVEL_FULL',3) +KDBG_FLAG_FILTERED = Constant('KDBG_FLAG_FILTERED',0x01) +KDBG_FLAG_NOPROCFILT = Constant('KDBG_FLAG_NOPROCFILT',0x02) +__DARWIN_NULL = Constant('__DARWIN_NULL',0) +UBC_PUSHDIRTY = Constant('UBC_PUSHDIRTY',0x01) +UBC_PUSHALL = Constant('UBC_PUSHALL',0x02) +UBC_INVALIDATE = Constant('UBC_INVALIDATE',0x04) +UBC_SYNC = Constant('UBC_SYNC',0x08) +KAUTH_NTSID_MAX_AUTHORITIES = Constant('KAUTH_NTSID_MAX_AUTHORITIES',16) +KAUTH_EXTLOOKUP_SUCCESS = Constant('KAUTH_EXTLOOKUP_SUCCESS',0) +KAUTH_EXTLOOKUP_BADRQ = Constant('KAUTH_EXTLOOKUP_BADRQ',1) +KAUTH_EXTLOOKUP_FAILURE = Constant('KAUTH_EXTLOOKUP_FAILURE',2) +KAUTH_EXTLOOKUP_FATAL = Constant('KAUTH_EXTLOOKUP_FATAL',3) +KAUTH_EXTLOOKUP_INPROG = Constant('KAUTH_EXTLOOKUP_INPROG',100) +KAUTH_ACE_KINDMASK = Constant('KAUTH_ACE_KINDMASK',0xf) +KAUTH_ACE_PERMIT = Constant('KAUTH_ACE_PERMIT',1) +KAUTH_ACE_DENY = Constant('KAUTH_ACE_DENY',2) +KAUTH_ACE_AUDIT = Constant('KAUTH_ACE_AUDIT',3) +KAUTH_ACE_ALARM = Constant('KAUTH_ACE_ALARM',4) +KAUTH_ACL_MAX_ENTRIES = Constant('KAUTH_ACL_MAX_ENTRIES',128) +KAUTH_FILESEC_MAGIC = Constant('KAUTH_FILESEC_MAGIC',0x012cc16d) +KAUTH_ENDIAN_HOST = Constant('KAUTH_ENDIAN_HOST',0x00000001) +KAUTH_ENDIAN_DISK = Constant('KAUTH_ENDIAN_DISK',0x00000002) +KAUTH_GENERIC_ISSUSER = Constant('KAUTH_GENERIC_ISSUSER',1) +KAUTH_PROCESS_CANSIGNAL = Constant('KAUTH_PROCESS_CANSIGNAL',1) +KAUTH_PROCESS_CANTRACE = Constant('KAUTH_PROCESS_CANTRACE',2) +KAUTH_FILEOP_OPEN = Constant('KAUTH_FILEOP_OPEN',1) +KAUTH_FILEOP_CLOSE = Constant('KAUTH_FILEOP_CLOSE',2) +KAUTH_FILEOP_RENAME = Constant('KAUTH_FILEOP_RENAME',3) +KAUTH_FILEOP_EXCHANGE = Constant('KAUTH_FILEOP_EXCHANGE',4) +KAUTH_FILEOP_LINK = Constant('KAUTH_FILEOP_LINK',5) +KAUTH_FILEOP_EXEC = Constant('KAUTH_FILEOP_EXEC',6) +KAUTH_FILEOP_DELETE = Constant('KAUTH_FILEOP_DELETE',7) +KAUTH_FILEOP_WILL_RENAME = Constant('KAUTH_FILEOP_WILL_RENAME',8) +DBG_PPT = Constant('DBG_PPT',36) +DBG_PERFCTRL = Constant('DBG_PERFCTRL',39) +DBG_CLPC = Constant('DBG_CLPC',50) +DBG_MUSE = Constant('DBG_MUSE',52) +DBG_ANS = Constant('DBG_ANS',128) +DBG_SIO = Constant('DBG_SIO',129) +DBG_SEP = Constant('DBG_SEP',130) +DBG_ISP = Constant('DBG_ISP',131) +DBG_OSCAR = Constant('DBG_OSCAR',132) +DBG_EMBEDDEDGFX = Constant('DBG_EMBEDDEDGFX',133) +DBG_PMP = Constant('DBG_PMP',134) +DBG_RTKIT = Constant('DBG_RTKIT',135) +DBG_DCP = Constant('DBG_DCP',136) +DBG_KMP = Constant('DBG_KMP',137) +DBG_SKYWALK_ALWAYSON = Constant('DBG_SKYWALK_ALWAYSON',0x10) +DBG_SKYWALK_FLOWSWITCH = Constant('DBG_SKYWALK_FLOWSWITCH',0x11) +DBG_SKYWALK_NETIF = Constant('DBG_SKYWALK_NETIF',0x12) +DBG_SKYWALK_CHANNEL = Constant('DBG_SKYWALK_CHANNEL',0x13) +DBG_SKYWALK_PACKET = Constant('DBG_SKYWALK_PACKET',0x14) +DBG_AQM_ALWAYSON = Constant('DBG_AQM_ALWAYSON',0x30) +DBG_AQM_STATS = Constant('DBG_AQM_STATS',0x31) +PPT_TEST = Constant('PPT_TEST',0x01) +PPT_JETSAM_HIWAT = Constant('PPT_JETSAM_HIWAT',0x02) +PPT_JETSAM_TOPPROC = Constant('PPT_JETSAM_TOPPROC',0x03) +DBG_SEC_SSMA = Constant('DBG_SEC_SSMA',0x02) +KDBG_CPU_SHIFT = Constant('KDBG_CPU_SHIFT',56) +KDBG_INIT = Constant('KDBG_INIT',0x01) +KDBG_FREERUN = Constant('KDBG_FREERUN',0x04) +KDBG_CPUMAP_IS_IOP = Constant('KDBG_CPUMAP_IS_IOP',0x1) +KDEBUG_COMMPAGE_ENABLE_TRACE = Constant('KDEBUG_COMMPAGE_ENABLE_TRACE',0x1) +KDEBUG_COMMPAGE_ENABLE_TYPEFILTER = Constant('KDEBUG_COMMPAGE_ENABLE_TYPEFILTER',0x2) +KDEBUG_COMMPAGE_CONTINUOUS = Constant('KDEBUG_COMMPAGE_CONTINUOUS',0x4) +KDBG_LOCKINIT = Constant('KDBG_LOCKINIT',0x0080) +KDBG_CLASSTYPE = Constant('KDBG_CLASSTYPE',0x10000) +KDBG_SUBCLSTYPE = Constant('KDBG_SUBCLSTYPE',0x20000) +KDBG_RANGETYPE = Constant('KDBG_RANGETYPE',0x40000) +KDBG_TYPENONE = Constant('KDBG_TYPENONE',0x80000) +KDBG_CKTYPES = Constant('KDBG_CKTYPES',0xF0000) +RAW_VERSION0 = Constant('RAW_VERSION0',0x55aa0000) +RAW_VERSION1 = Constant('RAW_VERSION1',0x55aa0101) +RAW_VERSION2 = Constant('RAW_VERSION2',0x55aa0200) +kEnTrCompKernel = Constant('kEnTrCompKernel',2) +kEnTrActKernSocket = Constant('kEnTrActKernSocket',1) +kEnTrActKernSockRead = Constant('kEnTrActKernSockRead',2) +kEnTrActKernSockWrite = Constant('kEnTrActKernSockWrite',3) +kEnTrActKernPoll = Constant('kEnTrActKernPoll',10) +kEnTrActKernSelect = Constant('kEnTrActKernSelect',11) +kEnTrActKernKQWait = Constant('kEnTrActKernKQWait',12) +kEnTrEvUnblocked = Constant('kEnTrEvUnblocked',256) +kEnTrFlagNonBlocking = Constant('kEnTrFlagNonBlocking',0x1) +kEnTrFlagNoWork = Constant('kEnTrFlagNoWork',0x2) +ENTR_SHOULDTRACE = Constant('ENTR_SHOULDTRACE',0) +SYS_syscall = Constant('SYS_syscall',0 + 0x2000000) +SYS_exit = Constant('SYS_exit',1 + 0x2000000) +SYS_fork = Constant('SYS_fork',2 + 0x2000000) +SYS_read = Constant('SYS_read',3 + 0x2000000) +SYS_write = Constant('SYS_write',4 + 0x2000000) +SYS_open = Constant('SYS_open',5 + 0x2000000) +SYS_close = Constant('SYS_close',6 + 0x2000000) +SYS_wait4 = Constant('SYS_wait4',7 + 0x2000000) +SYS_link = Constant('SYS_link',9 + 0x2000000) +SYS_unlink = Constant('SYS_unlink',10 + 0x2000000) +SYS_chdir = Constant('SYS_chdir',12 + 0x2000000) +SYS_fchdir = Constant('SYS_fchdir',13 + 0x2000000) +SYS_mknod = Constant('SYS_mknod',14 + 0x2000000) +SYS_chmod = Constant('SYS_chmod',15 + 0x2000000) +SYS_chown = Constant('SYS_chown',16 + 0x2000000) +SYS_getfsstat = Constant('SYS_getfsstat',18 + 0x2000000) +SYS_getpid = Constant('SYS_getpid',20 + 0x2000000) +SYS_setuid = Constant('SYS_setuid',23 + 0x2000000) +SYS_getuid = Constant('SYS_getuid',24 + 0x2000000) +SYS_geteuid = Constant('SYS_geteuid',25 + 0x2000000) +SYS_ptrace = Constant('SYS_ptrace',26 + 0x2000000) +SYS_recvmsg = Constant('SYS_recvmsg',27 + 0x2000000) +SYS_sendmsg = Constant('SYS_sendmsg',28 + 0x2000000) +SYS_recvfrom = Constant('SYS_recvfrom',29 + 0x2000000) +SYS_accept = Constant('SYS_accept',30 + 0x2000000) +SYS_getpeername = Constant('SYS_getpeername',31 + 0x2000000) +SYS_getsockname = Constant('SYS_getsockname',32 + 0x2000000) +SYS_access = Constant('SYS_access',33 + 0x2000000) +SYS_chflags = Constant('SYS_chflags',34 + 0x2000000) +SYS_fchflags = Constant('SYS_fchflags',35 + 0x2000000) +SYS_sync = Constant('SYS_sync',36 + 0x2000000) +SYS_kill = Constant('SYS_kill',37 + 0x2000000) +SYS_crossarch_trap = Constant('SYS_crossarch_trap',38 + 0x2000000) +SYS_getppid = Constant('SYS_getppid',39 + 0x2000000) +SYS_dup = Constant('SYS_dup',41 + 0x2000000) +SYS_pipe = Constant('SYS_pipe',42 + 0x2000000) +SYS_getegid = Constant('SYS_getegid',43 + 0x2000000) +SYS_sigaction = Constant('SYS_sigaction',46 + 0x2000000) +SYS_getgid = Constant('SYS_getgid',47 + 0x2000000) +SYS_sigprocmask = Constant('SYS_sigprocmask',48 + 0x2000000) +SYS_getlogin = Constant('SYS_getlogin',49 + 0x2000000) +SYS_setlogin = Constant('SYS_setlogin',50 + 0x2000000) +SYS_acct = Constant('SYS_acct',51 + 0x2000000) +SYS_sigpending = Constant('SYS_sigpending',52 + 0x2000000) +SYS_sigaltstack = Constant('SYS_sigaltstack',53 + 0x2000000) +SYS_ioctl = Constant('SYS_ioctl',54 + 0x2000000) +SYS_reboot = Constant('SYS_reboot',55 + 0x2000000) +SYS_revoke = Constant('SYS_revoke',56 + 0x2000000) +SYS_symlink = Constant('SYS_symlink',57 + 0x2000000) +SYS_readlink = Constant('SYS_readlink',58 + 0x2000000) +SYS_execve = Constant('SYS_execve',59 + 0x2000000) +SYS_umask = Constant('SYS_umask',60 + 0x2000000) +SYS_chroot = Constant('SYS_chroot',61 + 0x2000000) +SYS_msync = Constant('SYS_msync',65 + 0x2000000) +SYS_vfork = Constant('SYS_vfork',66 + 0x2000000) +SYS_munmap = Constant('SYS_munmap',73 + 0x2000000) +SYS_mprotect = Constant('SYS_mprotect',74 + 0x2000000) +SYS_madvise = Constant('SYS_madvise',75 + 0x2000000) +SYS_mincore = Constant('SYS_mincore',78 + 0x2000000) +SYS_getgroups = Constant('SYS_getgroups',79 + 0x2000000) +SYS_setgroups = Constant('SYS_setgroups',80 + 0x2000000) +SYS_getpgrp = Constant('SYS_getpgrp',81 + 0x2000000) +SYS_setpgid = Constant('SYS_setpgid',82 + 0x2000000) +SYS_setitimer = Constant('SYS_setitimer',83 + 0x2000000) +SYS_swapon = Constant('SYS_swapon',85 + 0x2000000) +SYS_getitimer = Constant('SYS_getitimer',86 + 0x2000000) +SYS_getdtablesize = Constant('SYS_getdtablesize',89 + 0x2000000) +SYS_dup2 = Constant('SYS_dup2',90 + 0x2000000) +SYS_fcntl = Constant('SYS_fcntl',92 + 0x2000000) +SYS_select = Constant('SYS_select',93 + 0x2000000) +SYS_fsync = Constant('SYS_fsync',95 + 0x2000000) +SYS_setpriority = Constant('SYS_setpriority',96 + 0x2000000) +SYS_socket = Constant('SYS_socket',97 + 0x2000000) +SYS_connect = Constant('SYS_connect',98 + 0x2000000) +SYS_getpriority = Constant('SYS_getpriority',100 + 0x2000000) +SYS_bind = Constant('SYS_bind',104 + 0x2000000) +SYS_setsockopt = Constant('SYS_setsockopt',105 + 0x2000000) +SYS_listen = Constant('SYS_listen',106 + 0x2000000) +SYS_sigsuspend = Constant('SYS_sigsuspend',111 + 0x2000000) +SYS_gettimeofday = Constant('SYS_gettimeofday',116 + 0x2000000) +SYS_getrusage = Constant('SYS_getrusage',117 + 0x2000000) +SYS_getsockopt = Constant('SYS_getsockopt',118 + 0x2000000) +SYS_readv = Constant('SYS_readv',120 + 0x2000000) +SYS_writev = Constant('SYS_writev',121 + 0x2000000) +SYS_settimeofday = Constant('SYS_settimeofday',122 + 0x2000000) +SYS_fchown = Constant('SYS_fchown',123 + 0x2000000) +SYS_fchmod = Constant('SYS_fchmod',124 + 0x2000000) +SYS_setreuid = Constant('SYS_setreuid',126 + 0x2000000) +SYS_setregid = Constant('SYS_setregid',127 + 0x2000000) +SYS_rename = Constant('SYS_rename',128 + 0x2000000) +SYS_flock = Constant('SYS_flock',131 + 0x2000000) +SYS_mkfifo = Constant('SYS_mkfifo',132 + 0x2000000) +SYS_sendto = Constant('SYS_sendto',133 + 0x2000000) +SYS_shutdown = Constant('SYS_shutdown',134 + 0x2000000) +SYS_socketpair = Constant('SYS_socketpair',135 + 0x2000000) +SYS_mkdir = Constant('SYS_mkdir',136 + 0x2000000) +SYS_rmdir = Constant('SYS_rmdir',137 + 0x2000000) +SYS_utimes = Constant('SYS_utimes',138 + 0x2000000) +SYS_futimes = Constant('SYS_futimes',139 + 0x2000000) +SYS_adjtime = Constant('SYS_adjtime',140 + 0x2000000) +SYS_gethostuuid = Constant('SYS_gethostuuid',142 + 0x2000000) +SYS_setsid = Constant('SYS_setsid',147 + 0x2000000) +SYS_getpgid = Constant('SYS_getpgid',151 + 0x2000000) +SYS_setprivexec = Constant('SYS_setprivexec',152 + 0x2000000) +SYS_pread = Constant('SYS_pread',153 + 0x2000000) +SYS_pwrite = Constant('SYS_pwrite',154 + 0x2000000) +SYS_nfssvc = Constant('SYS_nfssvc',155 + 0x2000000) +SYS_statfs = Constant('SYS_statfs',157 + 0x2000000) +SYS_fstatfs = Constant('SYS_fstatfs',158 + 0x2000000) +SYS_unmount = Constant('SYS_unmount',159 + 0x2000000) +SYS_getfh = Constant('SYS_getfh',161 + 0x2000000) +SYS_quotactl = Constant('SYS_quotactl',165 + 0x2000000) +SYS_mount = Constant('SYS_mount',167 + 0x2000000) +SYS_csops = Constant('SYS_csops',169 + 0x2000000) +SYS_csops_audittoken = Constant('SYS_csops_audittoken',170 + 0x2000000) +SYS_waitid = Constant('SYS_waitid',173 + 0x2000000) +SYS_kdebug_typefilter = Constant('SYS_kdebug_typefilter',177 + 0x2000000) +SYS_kdebug_trace_string = Constant('SYS_kdebug_trace_string',178 + 0x2000000) +SYS_kdebug_trace64 = Constant('SYS_kdebug_trace64',179 + 0x2000000) +SYS_kdebug_trace = Constant('SYS_kdebug_trace',180 + 0x2000000) +SYS_setgid = Constant('SYS_setgid',181 + 0x2000000) +SYS_setegid = Constant('SYS_setegid',182 + 0x2000000) +SYS_seteuid = Constant('SYS_seteuid',183 + 0x2000000) +SYS_sigreturn = Constant('SYS_sigreturn',184 + 0x2000000) +SYS_panic_with_data = Constant('SYS_panic_with_data',185 + 0x2000000) +SYS_thread_selfcounts = Constant('SYS_thread_selfcounts',186 + 0x2000000) +SYS_fdatasync = Constant('SYS_fdatasync',187 + 0x2000000) +SYS_stat = Constant('SYS_stat',188 + 0x2000000) +SYS_fstat = Constant('SYS_fstat',189 + 0x2000000) +SYS_lstat = Constant('SYS_lstat',190 + 0x2000000) +SYS_pathconf = Constant('SYS_pathconf',191 + 0x2000000) +SYS_fpathconf = Constant('SYS_fpathconf',192 + 0x2000000) +SYS_getrlimit = Constant('SYS_getrlimit',194 + 0x2000000) +SYS_setrlimit = Constant('SYS_setrlimit',195 + 0x2000000) +SYS_getdirentries = Constant('SYS_getdirentries',196 + 0x2000000) +SYS_mmap = Constant('SYS_mmap',197 + 0x2000000) +SYS_lseek = Constant('SYS_lseek',199 + 0x2000000) +SYS_truncate = Constant('SYS_truncate',200 + 0x2000000) +SYS_ftruncate = Constant('SYS_ftruncate',201 + 0x2000000) +SYS_sysctl = Constant('SYS_sysctl',202 + 0x2000000) +SYS_mlock = Constant('SYS_mlock',203 + 0x2000000) +SYS_munlock = Constant('SYS_munlock',204 + 0x2000000) +SYS_undelete = Constant('SYS_undelete',205 + 0x2000000) +SYS_open_dprotected_np = Constant('SYS_open_dprotected_np',216 + 0x2000000) +SYS_fsgetpath_ext = Constant('SYS_fsgetpath_ext',217 + 0x2000000) +SYS_openat_dprotected_np = Constant('SYS_openat_dprotected_np',218 + 0x2000000) +SYS_getattrlist = Constant('SYS_getattrlist',220 + 0x2000000) +SYS_setattrlist = Constant('SYS_setattrlist',221 + 0x2000000) +SYS_getdirentriesattr = Constant('SYS_getdirentriesattr',222 + 0x2000000) +SYS_exchangedata = Constant('SYS_exchangedata',223 + 0x2000000) +SYS_searchfs = Constant('SYS_searchfs',225 + 0x2000000) +SYS_delete = Constant('SYS_delete',226 + 0x2000000) +SYS_copyfile = Constant('SYS_copyfile',227 + 0x2000000) +SYS_fgetattrlist = Constant('SYS_fgetattrlist',228 + 0x2000000) +SYS_fsetattrlist = Constant('SYS_fsetattrlist',229 + 0x2000000) +SYS_poll = Constant('SYS_poll',230 + 0x2000000) +SYS_getxattr = Constant('SYS_getxattr',234 + 0x2000000) +SYS_fgetxattr = Constant('SYS_fgetxattr',235 + 0x2000000) +SYS_setxattr = Constant('SYS_setxattr',236 + 0x2000000) +SYS_fsetxattr = Constant('SYS_fsetxattr',237 + 0x2000000) +SYS_removexattr = Constant('SYS_removexattr',238 + 0x2000000) +SYS_fremovexattr = Constant('SYS_fremovexattr',239 + 0x2000000) +SYS_listxattr = Constant('SYS_listxattr',240 + 0x2000000) +SYS_flistxattr = Constant('SYS_flistxattr',241 + 0x2000000) +SYS_fsctl = Constant('SYS_fsctl',242 + 0x2000000) +SYS_initgroups = Constant('SYS_initgroups',243 + 0x2000000) +SYS_posix_spawn = Constant('SYS_posix_spawn',244 + 0x2000000) +SYS_ffsctl = Constant('SYS_ffsctl',245 + 0x2000000) +SYS_fhopen = Constant('SYS_fhopen',248 + 0x2000000) +SYS_minherit = Constant('SYS_minherit',250 + 0x2000000) +SYS_semsys = Constant('SYS_semsys',251 + 0x2000000) +SYS_msgsys = Constant('SYS_msgsys',252 + 0x2000000) +SYS_shmsys = Constant('SYS_shmsys',253 + 0x2000000) +SYS_semctl = Constant('SYS_semctl',254 + 0x2000000) +SYS_semget = Constant('SYS_semget',255 + 0x2000000) +SYS_semop = Constant('SYS_semop',256 + 0x2000000) +SYS_msgctl = Constant('SYS_msgctl',258 + 0x2000000) +SYS_msgget = Constant('SYS_msgget',259 + 0x2000000) +SYS_msgsnd = Constant('SYS_msgsnd',260 + 0x2000000) +SYS_msgrcv = Constant('SYS_msgrcv',261 + 0x2000000) +SYS_shmat = Constant('SYS_shmat',262 + 0x2000000) +SYS_shmctl = Constant('SYS_shmctl',263 + 0x2000000) +SYS_shmdt = Constant('SYS_shmdt',264 + 0x2000000) +SYS_shmget = Constant('SYS_shmget',265 + 0x2000000) +SYS_shm_open = Constant('SYS_shm_open',266 + 0x2000000) +SYS_shm_unlink = Constant('SYS_shm_unlink',267 + 0x2000000) +SYS_sem_open = Constant('SYS_sem_open',268 + 0x2000000) +SYS_sem_close = Constant('SYS_sem_close',269 + 0x2000000) +SYS_sem_unlink = Constant('SYS_sem_unlink',270 + 0x2000000) +SYS_sem_wait = Constant('SYS_sem_wait',271 + 0x2000000) +SYS_sem_trywait = Constant('SYS_sem_trywait',272 + 0x2000000) +SYS_sem_post = Constant('SYS_sem_post',273 + 0x2000000) +SYS_sysctlbyname = Constant('SYS_sysctlbyname',274 + 0x2000000) +SYS_open_extended = Constant('SYS_open_extended',277 + 0x2000000) +SYS_umask_extended = Constant('SYS_umask_extended',278 + 0x2000000) +SYS_stat_extended = Constant('SYS_stat_extended',279 + 0x2000000) +SYS_lstat_extended = Constant('SYS_lstat_extended',280 + 0x2000000) +SYS_fstat_extended = Constant('SYS_fstat_extended',281 + 0x2000000) +SYS_chmod_extended = Constant('SYS_chmod_extended',282 + 0x2000000) +SYS_fchmod_extended = Constant('SYS_fchmod_extended',283 + 0x2000000) +SYS_access_extended = Constant('SYS_access_extended',284 + 0x2000000) +SYS_settid = Constant('SYS_settid',285 + 0x2000000) +SYS_gettid = Constant('SYS_gettid',286 + 0x2000000) +SYS_setsgroups = Constant('SYS_setsgroups',287 + 0x2000000) +SYS_getsgroups = Constant('SYS_getsgroups',288 + 0x2000000) +SYS_setwgroups = Constant('SYS_setwgroups',289 + 0x2000000) +SYS_getwgroups = Constant('SYS_getwgroups',290 + 0x2000000) +SYS_mkfifo_extended = Constant('SYS_mkfifo_extended',291 + 0x2000000) +SYS_mkdir_extended = Constant('SYS_mkdir_extended',292 + 0x2000000) +SYS_identitysvc = Constant('SYS_identitysvc',293 + 0x2000000) +SYS_shared_region_check_np = Constant('SYS_shared_region_check_np',294 + 0x2000000) +SYS_vm_pressure_monitor = Constant('SYS_vm_pressure_monitor',296 + 0x2000000) +SYS_psynch_rw_longrdlock = Constant('SYS_psynch_rw_longrdlock',297 + 0x2000000) +SYS_psynch_rw_yieldwrlock = Constant('SYS_psynch_rw_yieldwrlock',298 + 0x2000000) +SYS_psynch_rw_downgrade = Constant('SYS_psynch_rw_downgrade',299 + 0x2000000) +SYS_psynch_rw_upgrade = Constant('SYS_psynch_rw_upgrade',300 + 0x2000000) +SYS_psynch_mutexwait = Constant('SYS_psynch_mutexwait',301 + 0x2000000) +SYS_psynch_mutexdrop = Constant('SYS_psynch_mutexdrop',302 + 0x2000000) +SYS_psynch_cvbroad = Constant('SYS_psynch_cvbroad',303 + 0x2000000) +SYS_psynch_cvsignal = Constant('SYS_psynch_cvsignal',304 + 0x2000000) +SYS_psynch_cvwait = Constant('SYS_psynch_cvwait',305 + 0x2000000) +SYS_psynch_rw_rdlock = Constant('SYS_psynch_rw_rdlock',306 + 0x2000000) +SYS_psynch_rw_wrlock = Constant('SYS_psynch_rw_wrlock',307 + 0x2000000) +SYS_psynch_rw_unlock = Constant('SYS_psynch_rw_unlock',308 + 0x2000000) +SYS_psynch_rw_unlock2 = Constant('SYS_psynch_rw_unlock2',309 + 0x2000000) +SYS_getsid = Constant('SYS_getsid',310 + 0x2000000) +SYS_settid_with_pid = Constant('SYS_settid_with_pid',311 + 0x2000000) +SYS_psynch_cvclrprepost = Constant('SYS_psynch_cvclrprepost',312 + 0x2000000) +SYS_aio_fsync = Constant('SYS_aio_fsync',313 + 0x2000000) +SYS_aio_return = Constant('SYS_aio_return',314 + 0x2000000) +SYS_aio_suspend = Constant('SYS_aio_suspend',315 + 0x2000000) +SYS_aio_cancel = Constant('SYS_aio_cancel',316 + 0x2000000) +SYS_aio_error = Constant('SYS_aio_error',317 + 0x2000000) +SYS_aio_read = Constant('SYS_aio_read',318 + 0x2000000) +SYS_aio_write = Constant('SYS_aio_write',319 + 0x2000000) +SYS_lio_listio = Constant('SYS_lio_listio',320 + 0x2000000) +SYS_iopolicysys = Constant('SYS_iopolicysys',322 + 0x2000000) +SYS_process_policy = Constant('SYS_process_policy',323 + 0x2000000) +SYS_mlockall = Constant('SYS_mlockall',324 + 0x2000000) +SYS_munlockall = Constant('SYS_munlockall',325 + 0x2000000) +SYS_issetugid = Constant('SYS_issetugid',327 + 0x2000000) +SYS___pthread_kill = Constant('SYS___pthread_kill',328 + 0x2000000) +SYS___pthread_sigmask = Constant('SYS___pthread_sigmask',329 + 0x2000000) +SYS___sigwait = Constant('SYS___sigwait',330 + 0x2000000) +SYS___disable_threadsignal = Constant('SYS___disable_threadsignal',331 + 0x2000000) +SYS___pthread_markcancel = Constant('SYS___pthread_markcancel',332 + 0x2000000) +SYS___pthread_canceled = Constant('SYS___pthread_canceled',333 + 0x2000000) +SYS___semwait_signal = Constant('SYS___semwait_signal',334 + 0x2000000) +SYS_proc_info = Constant('SYS_proc_info',336 + 0x2000000) +SYS_sendfile = Constant('SYS_sendfile',337 + 0x2000000) +SYS_stat64 = Constant('SYS_stat64',338 + 0x2000000) +SYS_fstat64 = Constant('SYS_fstat64',339 + 0x2000000) +SYS_lstat64 = Constant('SYS_lstat64',340 + 0x2000000) +SYS_stat64_extended = Constant('SYS_stat64_extended',341 + 0x2000000) +SYS_lstat64_extended = Constant('SYS_lstat64_extended',342 + 0x2000000) +SYS_fstat64_extended = Constant('SYS_fstat64_extended',343 + 0x2000000) +SYS_getdirentries64 = Constant('SYS_getdirentries64',344 + 0x2000000) +SYS_statfs64 = Constant('SYS_statfs64',345 + 0x2000000) +SYS_fstatfs64 = Constant('SYS_fstatfs64',346 + 0x2000000) +SYS_getfsstat64 = Constant('SYS_getfsstat64',347 + 0x2000000) +SYS___pthread_chdir = Constant('SYS___pthread_chdir',348 + 0x2000000) +SYS___pthread_fchdir = Constant('SYS___pthread_fchdir',349 + 0x2000000) +SYS_audit = Constant('SYS_audit',350 + 0x2000000) +SYS_auditon = Constant('SYS_auditon',351 + 0x2000000) +SYS_getauid = Constant('SYS_getauid',353 + 0x2000000) +SYS_setauid = Constant('SYS_setauid',354 + 0x2000000) +SYS_getaudit_addr = Constant('SYS_getaudit_addr',357 + 0x2000000) +SYS_setaudit_addr = Constant('SYS_setaudit_addr',358 + 0x2000000) +SYS_auditctl = Constant('SYS_auditctl',359 + 0x2000000) +SYS_bsdthread_create = Constant('SYS_bsdthread_create',360 + 0x2000000) +SYS_bsdthread_terminate = Constant('SYS_bsdthread_terminate',361 + 0x2000000) +SYS_kqueue = Constant('SYS_kqueue',362 + 0x2000000) +SYS_kevent = Constant('SYS_kevent',363 + 0x2000000) +SYS_lchown = Constant('SYS_lchown',364 + 0x2000000) +SYS_bsdthread_register = Constant('SYS_bsdthread_register',366 + 0x2000000) +SYS_workq_open = Constant('SYS_workq_open',367 + 0x2000000) +SYS_workq_kernreturn = Constant('SYS_workq_kernreturn',368 + 0x2000000) +SYS_kevent64 = Constant('SYS_kevent64',369 + 0x2000000) +SYS_thread_selfid = Constant('SYS_thread_selfid',372 + 0x2000000) +SYS_ledger = Constant('SYS_ledger',373 + 0x2000000) +SYS_kevent_qos = Constant('SYS_kevent_qos',374 + 0x2000000) +SYS_kevent_id = Constant('SYS_kevent_id',375 + 0x2000000) +SYS___mac_execve = Constant('SYS___mac_execve',380 + 0x2000000) +SYS___mac_syscall = Constant('SYS___mac_syscall',381 + 0x2000000) +SYS___mac_get_file = Constant('SYS___mac_get_file',382 + 0x2000000) +SYS___mac_set_file = Constant('SYS___mac_set_file',383 + 0x2000000) +SYS___mac_get_link = Constant('SYS___mac_get_link',384 + 0x2000000) +SYS___mac_set_link = Constant('SYS___mac_set_link',385 + 0x2000000) +SYS___mac_get_proc = Constant('SYS___mac_get_proc',386 + 0x2000000) +SYS___mac_set_proc = Constant('SYS___mac_set_proc',387 + 0x2000000) +SYS___mac_get_fd = Constant('SYS___mac_get_fd',388 + 0x2000000) +SYS___mac_set_fd = Constant('SYS___mac_set_fd',389 + 0x2000000) +SYS___mac_get_pid = Constant('SYS___mac_get_pid',390 + 0x2000000) +SYS_pselect = Constant('SYS_pselect',394 + 0x2000000) +SYS_pselect_nocancel = Constant('SYS_pselect_nocancel',395 + 0x2000000) +SYS_read_nocancel = Constant('SYS_read_nocancel',396 + 0x2000000) +SYS_write_nocancel = Constant('SYS_write_nocancel',397 + 0x2000000) +SYS_open_nocancel = Constant('SYS_open_nocancel',398 + 0x2000000) +SYS_close_nocancel = Constant('SYS_close_nocancel',399 + 0x2000000) +SYS_wait4_nocancel = Constant('SYS_wait4_nocancel',400 + 0x2000000) +SYS_recvmsg_nocancel = Constant('SYS_recvmsg_nocancel',401 + 0x2000000) +SYS_sendmsg_nocancel = Constant('SYS_sendmsg_nocancel',402 + 0x2000000) +SYS_recvfrom_nocancel = Constant('SYS_recvfrom_nocancel',403 + 0x2000000) +SYS_accept_nocancel = Constant('SYS_accept_nocancel',404 + 0x2000000) +SYS_msync_nocancel = Constant('SYS_msync_nocancel',405 + 0x2000000) +SYS_fcntl_nocancel = Constant('SYS_fcntl_nocancel',406 + 0x2000000) +SYS_select_nocancel = Constant('SYS_select_nocancel',407 + 0x2000000) +SYS_fsync_nocancel = Constant('SYS_fsync_nocancel',408 + 0x2000000) +SYS_connect_nocancel = Constant('SYS_connect_nocancel',409 + 0x2000000) +SYS_sigsuspend_nocancel = Constant('SYS_sigsuspend_nocancel',410 + 0x2000000) +SYS_readv_nocancel = Constant('SYS_readv_nocancel',411 + 0x2000000) +SYS_writev_nocancel = Constant('SYS_writev_nocancel',412 + 0x2000000) +SYS_sendto_nocancel = Constant('SYS_sendto_nocancel',413 + 0x2000000) +SYS_pread_nocancel = Constant('SYS_pread_nocancel',414 + 0x2000000) +SYS_pwrite_nocancel = Constant('SYS_pwrite_nocancel',415 + 0x2000000) +SYS_waitid_nocancel = Constant('SYS_waitid_nocancel',416 + 0x2000000) +SYS_poll_nocancel = Constant('SYS_poll_nocancel',417 + 0x2000000) +SYS_msgsnd_nocancel = Constant('SYS_msgsnd_nocancel',418 + 0x2000000) +SYS_msgrcv_nocancel = Constant('SYS_msgrcv_nocancel',419 + 0x2000000) +SYS_sem_wait_nocancel = Constant('SYS_sem_wait_nocancel',420 + 0x2000000) +SYS_aio_suspend_nocancel = Constant('SYS_aio_suspend_nocancel',421 + 0x2000000) +SYS___sigwait_nocancel = Constant('SYS___sigwait_nocancel',422 + 0x2000000) +SYS___semwait_signal_nocancel = Constant('SYS___semwait_signal_nocancel',423 + 0x2000000) +SYS___mac_mount = Constant('SYS___mac_mount',424 + 0x2000000) +SYS___mac_get_mount = Constant('SYS___mac_get_mount',425 + 0x2000000) +SYS___mac_getfsstat = Constant('SYS___mac_getfsstat',426 + 0x2000000) +SYS_fsgetpath = Constant('SYS_fsgetpath',427 + 0x2000000) +SYS_audit_session_self = Constant('SYS_audit_session_self',428 + 0x2000000) +SYS_audit_session_join = Constant('SYS_audit_session_join',429 + 0x2000000) +SYS_fileport_makeport = Constant('SYS_fileport_makeport',430 + 0x2000000) +SYS_fileport_makefd = Constant('SYS_fileport_makefd',431 + 0x2000000) +SYS_audit_session_port = Constant('SYS_audit_session_port',432 + 0x2000000) +SYS_pid_suspend = Constant('SYS_pid_suspend',433 + 0x2000000) +SYS_pid_resume = Constant('SYS_pid_resume',434 + 0x2000000) +SYS_pid_hibernate = Constant('SYS_pid_hibernate',435 + 0x2000000) +SYS_pid_shutdown_sockets = Constant('SYS_pid_shutdown_sockets',436 + 0x2000000) +SYS_kas_info = Constant('SYS_kas_info',439 + 0x2000000) +SYS_memorystatus_control = Constant('SYS_memorystatus_control',440 + 0x2000000) +SYS_guarded_open_np = Constant('SYS_guarded_open_np',441 + 0x2000000) +SYS_guarded_close_np = Constant('SYS_guarded_close_np',442 + 0x2000000) +SYS_guarded_kqueue_np = Constant('SYS_guarded_kqueue_np',443 + 0x2000000) +SYS_change_fdguard_np = Constant('SYS_change_fdguard_np',444 + 0x2000000) +SYS_usrctl = Constant('SYS_usrctl',445 + 0x2000000) +SYS_proc_rlimit_control = Constant('SYS_proc_rlimit_control',446 + 0x2000000) +SYS_connectx = Constant('SYS_connectx',447 + 0x2000000) +SYS_disconnectx = Constant('SYS_disconnectx',448 + 0x2000000) +SYS_peeloff = Constant('SYS_peeloff',449 + 0x2000000) +SYS_socket_delegate = Constant('SYS_socket_delegate',450 + 0x2000000) +SYS_telemetry = Constant('SYS_telemetry',451 + 0x2000000) +SYS_proc_uuid_policy = Constant('SYS_proc_uuid_policy',452 + 0x2000000) +SYS_memorystatus_get_level = Constant('SYS_memorystatus_get_level',453 + 0x2000000) +SYS_system_override = Constant('SYS_system_override',454 + 0x2000000) +SYS_vfs_purge = Constant('SYS_vfs_purge',455 + 0x2000000) +SYS_sfi_ctl = Constant('SYS_sfi_ctl',456 + 0x2000000) +SYS_sfi_pidctl = Constant('SYS_sfi_pidctl',457 + 0x2000000) +SYS_coalition = Constant('SYS_coalition',458 + 0x2000000) +SYS_coalition_info = Constant('SYS_coalition_info',459 + 0x2000000) +SYS_necp_match_policy = Constant('SYS_necp_match_policy',460 + 0x2000000) +SYS_getattrlistbulk = Constant('SYS_getattrlistbulk',461 + 0x2000000) +SYS_clonefileat = Constant('SYS_clonefileat',462 + 0x2000000) +SYS_openat = Constant('SYS_openat',463 + 0x2000000) +SYS_openat_nocancel = Constant('SYS_openat_nocancel',464 + 0x2000000) +SYS_renameat = Constant('SYS_renameat',465 + 0x2000000) +SYS_faccessat = Constant('SYS_faccessat',466 + 0x2000000) +SYS_fchmodat = Constant('SYS_fchmodat',467 + 0x2000000) +SYS_fchownat = Constant('SYS_fchownat',468 + 0x2000000) +SYS_fstatat = Constant('SYS_fstatat',469 + 0x2000000) +SYS_fstatat64 = Constant('SYS_fstatat64',470 + 0x2000000) +SYS_linkat = Constant('SYS_linkat',471 + 0x2000000) +SYS_unlinkat = Constant('SYS_unlinkat',472 + 0x2000000) +SYS_readlinkat = Constant('SYS_readlinkat',473 + 0x2000000) +SYS_symlinkat = Constant('SYS_symlinkat',474 + 0x2000000) +SYS_mkdirat = Constant('SYS_mkdirat',475 + 0x2000000) +SYS_getattrlistat = Constant('SYS_getattrlistat',476 + 0x2000000) +SYS_proc_trace_log = Constant('SYS_proc_trace_log',477 + 0x2000000) +SYS_bsdthread_ctl = Constant('SYS_bsdthread_ctl',478 + 0x2000000) +SYS_openbyid_np = Constant('SYS_openbyid_np',479 + 0x2000000) +SYS_recvmsg_x = Constant('SYS_recvmsg_x',480 + 0x2000000) +SYS_sendmsg_x = Constant('SYS_sendmsg_x',481 + 0x2000000) +SYS_thread_selfusage = Constant('SYS_thread_selfusage',482 + 0x2000000) +SYS_csrctl = Constant('SYS_csrctl',483 + 0x2000000) +SYS_guarded_open_dprotected_np = Constant('SYS_guarded_open_dprotected_np',484 + 0x2000000) +SYS_guarded_write_np = Constant('SYS_guarded_write_np',485 + 0x2000000) +SYS_guarded_pwrite_np = Constant('SYS_guarded_pwrite_np',486 + 0x2000000) +SYS_guarded_writev_np = Constant('SYS_guarded_writev_np',487 + 0x2000000) +SYS_renameatx_np = Constant('SYS_renameatx_np',488 + 0x2000000) +SYS_mremap_encrypted = Constant('SYS_mremap_encrypted',489 + 0x2000000) +SYS_netagent_trigger = Constant('SYS_netagent_trigger',490 + 0x2000000) +SYS_stack_snapshot_with_config = Constant('SYS_stack_snapshot_with_config',491 + 0x2000000) +SYS_microstackshot = Constant('SYS_microstackshot',492 + 0x2000000) +SYS_grab_pgo_data = Constant('SYS_grab_pgo_data',493 + 0x2000000) +SYS_persona = Constant('SYS_persona',494 + 0x2000000) +SYS_mach_eventlink_signal = Constant('SYS_mach_eventlink_signal',496 + 0x2000000) +SYS_mach_eventlink_wait_until = Constant('SYS_mach_eventlink_wait_until',497 + 0x2000000) +SYS_mach_eventlink_signal_wait_until = Constant('SYS_mach_eventlink_signal_wait_until',498 + 0x2000000) +SYS_work_interval_ctl = Constant('SYS_work_interval_ctl',499 + 0x2000000) +SYS_getentropy = Constant('SYS_getentropy',500 + 0x2000000) +SYS_necp_open = Constant('SYS_necp_open',501 + 0x2000000) +SYS_necp_client_action = Constant('SYS_necp_client_action',502 + 0x2000000) +SYS___nexus_open = Constant('SYS___nexus_open',503 + 0x2000000) +SYS___nexus_register = Constant('SYS___nexus_register',504 + 0x2000000) +SYS___nexus_deregister = Constant('SYS___nexus_deregister',505 + 0x2000000) +SYS___nexus_create = Constant('SYS___nexus_create',506 + 0x2000000) +SYS___nexus_destroy = Constant('SYS___nexus_destroy',507 + 0x2000000) +SYS___nexus_get_opt = Constant('SYS___nexus_get_opt',508 + 0x2000000) +SYS___nexus_set_opt = Constant('SYS___nexus_set_opt',509 + 0x2000000) +SYS___channel_open = Constant('SYS___channel_open',510 + 0x2000000) +SYS___channel_get_info = Constant('SYS___channel_get_info',511 + 0x2000000) +SYS___channel_sync = Constant('SYS___channel_sync',512 + 0x2000000) +SYS___channel_get_opt = Constant('SYS___channel_get_opt',513 + 0x2000000) +SYS___channel_set_opt = Constant('SYS___channel_set_opt',514 + 0x2000000) +SYS_ulock_wait = Constant('SYS_ulock_wait',515 + 0x2000000) +SYS_ulock_wake = Constant('SYS_ulock_wake',516 + 0x2000000) +SYS_fclonefileat = Constant('SYS_fclonefileat',517 + 0x2000000) +SYS_fs_snapshot = Constant('SYS_fs_snapshot',518 + 0x2000000) +SYS_register_uexc_handler = Constant('SYS_register_uexc_handler',519 + 0x2000000) +SYS_terminate_with_payload = Constant('SYS_terminate_with_payload',520 + 0x2000000) +SYS_abort_with_payload = Constant('SYS_abort_with_payload',521 + 0x2000000) +SYS_necp_session_open = Constant('SYS_necp_session_open',522 + 0x2000000) +SYS_necp_session_action = Constant('SYS_necp_session_action',523 + 0x2000000) +SYS_setattrlistat = Constant('SYS_setattrlistat',524 + 0x2000000) +SYS_net_qos_guideline = Constant('SYS_net_qos_guideline',525 + 0x2000000) +SYS_fmount = Constant('SYS_fmount',526 + 0x2000000) +SYS_ntp_adjtime = Constant('SYS_ntp_adjtime',527 + 0x2000000) +SYS_ntp_gettime = Constant('SYS_ntp_gettime',528 + 0x2000000) +SYS_os_fault_with_payload = Constant('SYS_os_fault_with_payload',529 + 0x2000000) +SYS_kqueue_workloop_ctl = Constant('SYS_kqueue_workloop_ctl',530 + 0x2000000) +SYS___mach_bridge_remote_time = Constant('SYS___mach_bridge_remote_time',531 + 0x2000000) +SYS_coalition_ledger = Constant('SYS_coalition_ledger',532 + 0x2000000) +SYS_log_data = Constant('SYS_log_data',533 + 0x2000000) +SYS_memorystatus_available_memory = Constant('SYS_memorystatus_available_memory',534 + 0x2000000) +SYS_objc_bp_assist_cfg_np = Constant('SYS_objc_bp_assist_cfg_np',535 + 0x2000000) +SYS_shared_region_map_and_slide_2_np = Constant('SYS_shared_region_map_and_slide_2_np',536 + 0x2000000) +SYS_pivot_root = Constant('SYS_pivot_root',537 + 0x2000000) +SYS_task_inspect_for_pid = Constant('SYS_task_inspect_for_pid',538 + 0x2000000) +SYS_task_read_for_pid = Constant('SYS_task_read_for_pid',539 + 0x2000000) +SYS_preadv = Constant('SYS_preadv',540 + 0x2000000) +SYS_pwritev = Constant('SYS_pwritev',541 + 0x2000000) +SYS_preadv_nocancel = Constant('SYS_preadv_nocancel',542 + 0x2000000) +SYS_pwritev_nocancel = Constant('SYS_pwritev_nocancel',543 + 0x2000000) +SYS_ulock_wait2 = Constant('SYS_ulock_wait2',544 + 0x2000000) +SYS_proc_info_extended_id = Constant('SYS_proc_info_extended_id',545 + 0x2000000) +SYS_tracker_action = Constant('SYS_tracker_action',546 + 0x2000000) +SYS_debug_syscall_reject = Constant('SYS_debug_syscall_reject',547 + 0x2000000) +SYS_debug_syscall_reject_config = Constant('SYS_debug_syscall_reject_config',548 + 0x2000000) +SYS_graftdmg = Constant('SYS_graftdmg',549 + 0x2000000) +SYS_map_with_linking_np = Constant('SYS_map_with_linking_np',550 + 0x2000000) +SYS_freadlink = Constant('SYS_freadlink',551 + 0x2000000) +SYS_record_system_event = Constant('SYS_record_system_event',552 + 0x2000000) +SYS_mkfifoat = Constant('SYS_mkfifoat',553 + 0x2000000) +SYS_mknodat = Constant('SYS_mknodat',554 + 0x2000000) +SYS_ungraftdmg = Constant('SYS_ungraftdmg',555 + 0x2000000) +SYS_MAXSYSCALL = Constant('SYS_MAXSYSCALL',556 + 0x2000000) +SYS_invalid = Constant('SYS_invalid',63 + 0x2000000) +SOCK_STREAM = Constant('SOCK_STREAM',1) +SOCK_DGRAM = Constant('SOCK_DGRAM',2) +SOCK_RAW = Constant('SOCK_RAW',3) +SOCK_RDM = Constant('SOCK_RDM',4) +SOCK_SEQPACKET = Constant('SOCK_SEQPACKET',5) +SO_DEBUG = Constant('SO_DEBUG',0x0001) +SO_ACCEPTCONN = Constant('SO_ACCEPTCONN',0x0002) +SO_REUSEADDR = Constant('SO_REUSEADDR',0x0004) +SO_KEEPALIVE = Constant('SO_KEEPALIVE',0x0008) +SO_DONTROUTE = Constant('SO_DONTROUTE',0x0010) +SO_BROADCAST = Constant('SO_BROADCAST',0x0020) +SO_USELOOPBACK = Constant('SO_USELOOPBACK',0x0040) +SO_LINGER = Constant('SO_LINGER',0x1080) +SO_LINGER_SEC = Constant('SO_LINGER_SEC',0x1080) +SO_OOBINLINE = Constant('SO_OOBINLINE',0x0100) +SO_REUSEPORT = Constant('SO_REUSEPORT',0x0200) +SO_TIMESTAMP = Constant('SO_TIMESTAMP',0x0400) +SO_TIMESTAMP_MONOTONIC = Constant('SO_TIMESTAMP_MONOTONIC',0x0800) +SO_ACCEPTFILTER = Constant('SO_ACCEPTFILTER',0x1000) +SO_DONTTRUNC = Constant('SO_DONTTRUNC',0x2000) +SO_WANTMORE = Constant('SO_WANTMORE',0x4000) +SO_WANTOOBFLAG = Constant('SO_WANTOOBFLAG',0x8000) +SO_SNDBUF = Constant('SO_SNDBUF',0x1001) +SO_RCVBUF = Constant('SO_RCVBUF',0x1002) +SO_SNDLOWAT = Constant('SO_SNDLOWAT',0x1003) +SO_RCVLOWAT = Constant('SO_RCVLOWAT',0x1004) +SO_SNDTIMEO = Constant('SO_SNDTIMEO',0x1005) +SO_RCVTIMEO = Constant('SO_RCVTIMEO',0x1006) +SO_ERROR = Constant('SO_ERROR',0x1007) +SO_TYPE = Constant('SO_TYPE',0x1008) +SO_LABEL = Constant('SO_LABEL',0x1010) +SO_PEERLABEL = Constant('SO_PEERLABEL',0x1011) +SO_NREAD = Constant('SO_NREAD',0x1020) +SO_NKE = Constant('SO_NKE',0x1021) +SO_NOSIGPIPE = Constant('SO_NOSIGPIPE',0x1022) +SO_NOADDRERR = Constant('SO_NOADDRERR',0x1023) +SO_NWRITE = Constant('SO_NWRITE',0x1024) +SO_REUSESHAREUID = Constant('SO_REUSESHAREUID',0x1025) +SO_NOTIFYCONFLICT = Constant('SO_NOTIFYCONFLICT',0x1026) +SO_UPCALLCLOSEWAIT = Constant('SO_UPCALLCLOSEWAIT',0x1027) +SO_RANDOMPORT = Constant('SO_RANDOMPORT',0x1082) +SO_NP_EXTENSIONS = Constant('SO_NP_EXTENSIONS',0x1083) +SO_NUMRCVPKT = Constant('SO_NUMRCVPKT',0x1112) +SO_NET_SERVICE_TYPE = Constant('SO_NET_SERVICE_TYPE',0x1116) +SO_NETSVC_MARKING_LEVEL = Constant('SO_NETSVC_MARKING_LEVEL',0x1119) +SO_RESOLVER_SIGNATURE = Constant('SO_RESOLVER_SIGNATURE',0x1131) +NET_SERVICE_TYPE_BE = Constant('NET_SERVICE_TYPE_BE',0) +NET_SERVICE_TYPE_BK = Constant('NET_SERVICE_TYPE_BK',1) +NET_SERVICE_TYPE_SIG = Constant('NET_SERVICE_TYPE_SIG',2) +NET_SERVICE_TYPE_VI = Constant('NET_SERVICE_TYPE_VI',3) +NET_SERVICE_TYPE_VO = Constant('NET_SERVICE_TYPE_VO',4) +NET_SERVICE_TYPE_RV = Constant('NET_SERVICE_TYPE_RV',5) +NET_SERVICE_TYPE_AV = Constant('NET_SERVICE_TYPE_AV',6) +NET_SERVICE_TYPE_OAM = Constant('NET_SERVICE_TYPE_OAM',7) +NET_SERVICE_TYPE_RD = Constant('NET_SERVICE_TYPE_RD',8) +NETSVC_MRKNG_UNKNOWN = Constant('NETSVC_MRKNG_UNKNOWN',0) +NETSVC_MRKNG_LVL_L2 = Constant('NETSVC_MRKNG_LVL_L2',1) +NETSVC_MRKNG_LVL_L3L2_ALL = Constant('NETSVC_MRKNG_LVL_L3L2_ALL',2) +NETSVC_MRKNG_LVL_L3L2_BK = Constant('NETSVC_MRKNG_LVL_L3L2_BK',3) +SAE_ASSOCID_ANY = Constant('SAE_ASSOCID_ANY',0) +SAE_CONNID_ANY = Constant('SAE_CONNID_ANY',0) +CONNECT_RESUME_ON_READ_WRITE = Constant('CONNECT_RESUME_ON_READ_WRITE',0x1) +CONNECT_DATA_IDEMPOTENT = Constant('CONNECT_DATA_IDEMPOTENT',0x2) +CONNECT_DATA_AUTHENTICATED = Constant('CONNECT_DATA_AUTHENTICATED',0x4) +SONPX_SETOPTSHUT = Constant('SONPX_SETOPTSHUT',0x000000001) +SOL_SOCKET = Constant('SOL_SOCKET',0xffff) +AF_UNSPEC = Constant('AF_UNSPEC',0) +AF_UNIX = Constant('AF_UNIX',1) +AF_INET = Constant('AF_INET',2) +AF_IMPLINK = Constant('AF_IMPLINK',3) +AF_PUP = Constant('AF_PUP',4) +AF_CHAOS = Constant('AF_CHAOS',5) +AF_NS = Constant('AF_NS',6) +AF_ISO = Constant('AF_ISO',7) +AF_ECMA = Constant('AF_ECMA',8) +AF_DATAKIT = Constant('AF_DATAKIT',9) +AF_CCITT = Constant('AF_CCITT',10) +AF_SNA = Constant('AF_SNA',11) +AF_DECnet = Constant('AF_DECnet',12) +AF_DLI = Constant('AF_DLI',13) +AF_LAT = Constant('AF_LAT',14) +AF_HYLINK = Constant('AF_HYLINK',15) +AF_APPLETALK = Constant('AF_APPLETALK',16) +AF_ROUTE = Constant('AF_ROUTE',17) +AF_LINK = Constant('AF_LINK',18) +pseudo_AF_XTP = Constant('pseudo_AF_XTP',19) +AF_COIP = Constant('AF_COIP',20) +AF_CNT = Constant('AF_CNT',21) +pseudo_AF_RTIP = Constant('pseudo_AF_RTIP',22) +AF_IPX = Constant('AF_IPX',23) +AF_SIP = Constant('AF_SIP',24) +pseudo_AF_PIP = Constant('pseudo_AF_PIP',25) +AF_NDRV = Constant('AF_NDRV',27) +AF_ISDN = Constant('AF_ISDN',28) +pseudo_AF_KEY = Constant('pseudo_AF_KEY',29) +AF_INET6 = Constant('AF_INET6',30) +AF_NATM = Constant('AF_NATM',31) +AF_SYSTEM = Constant('AF_SYSTEM',32) +AF_NETBIOS = Constant('AF_NETBIOS',33) +AF_PPP = Constant('AF_PPP',34) +pseudo_AF_HDRCMPLT = Constant('pseudo_AF_HDRCMPLT',35) +AF_RESERVED_36 = Constant('AF_RESERVED_36',36) +AF_IEEE80211 = Constant('AF_IEEE80211',37) +AF_UTUN = Constant('AF_UTUN',38) +AF_VSOCK = Constant('AF_VSOCK',40) +AF_MAX = Constant('AF_MAX',41) +SOCK_MAXADDRLEN = Constant('SOCK_MAXADDRLEN',255) +_SS_MAXSIZE = Constant('_SS_MAXSIZE',128) +NET_RT_DUMP = Constant('NET_RT_DUMP',1) +NET_RT_FLAGS = Constant('NET_RT_FLAGS',2) +NET_RT_IFLIST = Constant('NET_RT_IFLIST',3) +NET_RT_STAT = Constant('NET_RT_STAT',4) +NET_RT_TRASH = Constant('NET_RT_TRASH',5) +NET_RT_IFLIST2 = Constant('NET_RT_IFLIST2',6) +NET_RT_DUMP2 = Constant('NET_RT_DUMP2',7) +NET_RT_FLAGS_PRIV = Constant('NET_RT_FLAGS_PRIV',10) +NET_RT_MAXID = Constant('NET_RT_MAXID',11) +SOMAXCONN = Constant('SOMAXCONN',128) +MSG_OOB = Constant('MSG_OOB',0x1) +MSG_PEEK = Constant('MSG_PEEK',0x2) +MSG_DONTROUTE = Constant('MSG_DONTROUTE',0x4) +MSG_EOR = Constant('MSG_EOR',0x8) +MSG_TRUNC = Constant('MSG_TRUNC',0x10) +MSG_CTRUNC = Constant('MSG_CTRUNC',0x20) +MSG_WAITALL = Constant('MSG_WAITALL',0x40) +MSG_DONTWAIT = Constant('MSG_DONTWAIT',0x80) +MSG_EOF = Constant('MSG_EOF',0x100) +MSG_WAITSTREAM = Constant('MSG_WAITSTREAM',0x200) +MSG_FLUSH = Constant('MSG_FLUSH',0x400) +MSG_HOLD = Constant('MSG_HOLD',0x800) +MSG_SEND = Constant('MSG_SEND',0x1000) +MSG_HAVEMORE = Constant('MSG_HAVEMORE',0x2000) +MSG_RCVMORE = Constant('MSG_RCVMORE',0x4000) +MSG_NEEDSA = Constant('MSG_NEEDSA',0x10000) +MSG_NOSIGNAL = Constant('MSG_NOSIGNAL',0x80000) +MSG_USEUPCALL = Constant('MSG_USEUPCALL',0x80000000) +CMGROUP_MAX = Constant('CMGROUP_MAX',16) +SCM_RIGHTS = Constant('SCM_RIGHTS',0x01) +SCM_TIMESTAMP = Constant('SCM_TIMESTAMP',0x02) +SCM_CREDS = Constant('SCM_CREDS',0x03) +SCM_TIMESTAMP_MONOTONIC = Constant('SCM_TIMESTAMP_MONOTONIC',0x04) +SHUT_RD = Constant('SHUT_RD',0) +SHUT_WR = Constant('SHUT_WR',1) +SHUT_RDWR = Constant('SHUT_RDWR',2) +SBUF_FIXEDLEN = Constant('SBUF_FIXEDLEN',0x00000000) +SBUF_AUTOEXTEND = Constant('SBUF_AUTOEXTEND',0x00000001) +SBUF_USRFLAGMSK = Constant('SBUF_USRFLAGMSK',0x0000ffff) +SBUF_DYNAMIC = Constant('SBUF_DYNAMIC',0x00010000) +SBUF_FINISHED = Constant('SBUF_FINISHED',0x00020000) +SBUF_OVERFLOWED = Constant('SBUF_OVERFLOWED',0x00040000) +SBUF_DYNSTRUCT = Constant('SBUF_DYNSTRUCT',0x00080000) +SYSPROTO_EVENT = Constant('SYSPROTO_EVENT',1) +SYSPROTO_CONTROL = Constant('SYSPROTO_CONTROL',2) +AF_SYS_CONTROL = Constant('AF_SYS_CONTROL',2) +SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = Constant('SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED',0x00000001) +SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = Constant('SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER',0x00000002) +SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = Constant('SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT',0x00000004) +NS_GETRAWENCRYPTED = Constant('NS_GETRAWENCRYPTED',0x00000001) diff --git a/pwnlib/data/includes/darwin/aarch64.h b/pwnlib/data/includes/darwin/aarch64.h new file mode 100644 index 000000000..81fb6f979 --- /dev/null +++ b/pwnlib/data/includes/darwin/aarch64.h @@ -0,0 +1,3230 @@ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 +#define DST_NONE 0 +#define DST_USA 1 +#define DST_AUST 2 +#define DST_WET 3 +#define DST_MET 4 +#define DST_EET 5 +#define DST_CAN 6 +#define CHILD_MAX 266 +#define LINK_MAX 32767 +#define MAX_CANON 1024 +#define MAX_INPUT 1024 +#define NAME_MAX 255 +#define NGROUPS_MAX 16 +#define OPEN_MAX 10240 +#define PATH_MAX 1024 +#define PIPE_BUF 512 +#define BC_BASE_MAX 99 +#define BC_DIM_MAX 2048 +#define BC_SCALE_MAX 99 +#define BC_STRING_MAX 1000 +#define CHARCLASS_NAME_MAX 14 +#define COLL_WEIGHTS_MAX 2 +#define EQUIV_CLASS_MAX 2 +#define EXPR_NEST_MAX 32 +#define LINE_MAX 2048 +#define RE_DUP_MAX 255 +#define NZERO 0 +#define GETNCNT 3 +#define GETPID 4 +#define GETVAL 5 +#define GETALL 6 +#define GETZCNT 7 +#define SETVAL 8 +#define SETALL 9 +#define SEM_UNDO 0010000 +#define SEM_A 00200 +#define SEM_R 00400 +#define PSEMNAMLEN 31 +#define PSEM_NONE 1 +#define PSEM_DEFINED 2 +#define PSEM_ALLOCATED 4 +#define PSEM_MAPPED 8 +#define PSEM_INUSE 0x10 +#define PSEM_REMOVED 0x20 +#define PSEM_INCREATE 0x40 +#define PSEM_INDELETE 0x80 +#define FSOPT_NOFOLLOW 0x00000001 +#define FSOPT_NOINMEMUPDATE 0x00000002 +#define FSOPT_REPORT_FULLSIZE 0x00000004 +#define FSOPT_PACK_INVAL_ATTRS 0x00000008 +#define FSOPT_ATTR_CMN_EXTENDED 0x00000020 +#define FSOPT_RETURN_REALDEV 0x00000200 +#define FSOPT_NOFOLLOW_ANY 0x00000800 +#define SEARCHFS_MAX_SEARCHPARMS 4096 +#define ATTR_BIT_MAP_COUNT 5 +#define VOL_CAPABILITIES_FORMAT 0 +#define VOL_CAPABILITIES_INTERFACES 1 +#define VOL_CAPABILITIES_RESERVED1 2 +#define VOL_CAPABILITIES_RESERVED2 3 +#define ATTR_MAX_BUFFER 8192 +#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001 +#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002 +#define VOL_CAP_FMT_HARDLINKS 0x00000004 +#define VOL_CAP_FMT_JOURNAL 0x00000008 +#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010 +#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020 +#define VOL_CAP_FMT_SPARSE_FILES 0x00000040 +#define VOL_CAP_FMT_ZERO_RUNS 0x00000080 +#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100 +#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200 +#define VOL_CAP_FMT_FAST_STATFS 0x00000400 +#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800 +#define VOL_CAP_FMT_OPENDENYMODES 0x00001000 +#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000 +#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000 +#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000 +#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000 +#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000 +#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000 +#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000 +#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000 +#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000 +#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000 +#define VOL_CAP_FMT_SHARED_SPACE 0x00800000 +#define VOL_CAP_FMT_VOL_GROUPS 0x01000000 +#define VOL_CAP_FMT_SEALED 0x02000000 +#define VOL_CAP_INT_SEARCHFS 0x00000001 +#define VOL_CAP_INT_ATTRLIST 0x00000002 +#define VOL_CAP_INT_NFSEXPORT 0x00000004 +#define VOL_CAP_INT_READDIRATTR 0x00000008 +#define VOL_CAP_INT_EXCHANGEDATA 0x00000010 +#define VOL_CAP_INT_COPYFILE 0x00000020 +#define VOL_CAP_INT_ALLOCATE 0x00000040 +#define VOL_CAP_INT_VOL_RENAME 0x00000080 +#define VOL_CAP_INT_ADVLOCK 0x00000100 +#define VOL_CAP_INT_FLOCK 0x00000200 +#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400 +#define VOL_CAP_INT_USERACCESS 0x00000800 +#define VOL_CAP_INT_MANLOCK 0x00001000 +#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000 +#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000 +#define VOL_CAP_INT_CLONE 0x00010000 +#define VOL_CAP_INT_SNAPSHOT 0x00020000 +#define VOL_CAP_INT_RENAME_SWAP 0x00040000 +#define VOL_CAP_INT_RENAME_EXCL 0x00080000 +#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 +#define VOL_CAP_INT_RENAME_SECLUDE 0x00200000 +#define ATTR_CMN_NAME 0x00000001 +#define ATTR_CMN_DEVID 0x00000002 +#define ATTR_CMN_FSID 0x00000004 +#define ATTR_CMN_OBJTYPE 0x00000008 +#define ATTR_CMN_OBJTAG 0x00000010 +#define ATTR_CMN_OBJID 0x00000020 +#define ATTR_CMN_OBJPERMANENTID 0x00000040 +#define ATTR_CMN_PAROBJID 0x00000080 +#define ATTR_CMN_SCRIPT 0x00000100 +#define ATTR_CMN_CRTIME 0x00000200 +#define ATTR_CMN_MODTIME 0x00000400 +#define ATTR_CMN_CHGTIME 0x00000800 +#define ATTR_CMN_ACCTIME 0x00001000 +#define ATTR_CMN_BKUPTIME 0x00002000 +#define ATTR_CMN_FNDRINFO 0x00004000 +#define ATTR_CMN_OWNERID 0x00008000 +#define ATTR_CMN_GRPID 0x00010000 +#define ATTR_CMN_ACCESSMASK 0x00020000 +#define ATTR_CMN_FLAGS 0x00040000 +#define ATTR_CMN_GEN_COUNT 0x00080000 +#define ATTR_CMN_DOCUMENT_ID 0x00100000 +#define ATTR_CMN_USERACCESS 0x00200000 +#define ATTR_CMN_EXTENDED_SECURITY 0x00400000 +#define ATTR_CMN_UUID 0x00800000 +#define ATTR_CMN_GRPUUID 0x01000000 +#define ATTR_CMN_FILEID 0x02000000 +#define ATTR_CMN_PARENTID 0x04000000 +#define ATTR_CMN_FULLPATH 0x08000000 +#define ATTR_CMN_ADDEDTIME 0x10000000 +#define ATTR_CMN_ERROR 0x20000000 +#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000 +#define ATTR_CMN_RETURNED_ATTRS 0x80000000 +#define ATTR_CMN_VALIDMASK 0xFFFFFFFF +#define ATTR_CMN_SETMASK 0x51C7FF00 +#define ATTR_CMN_VOLSETMASK 0x00006700 +#define ATTR_VOL_FSTYPE 0x00000001 +#define ATTR_VOL_SIGNATURE 0x00000002 +#define ATTR_VOL_SIZE 0x00000004 +#define ATTR_VOL_SPACEFREE 0x00000008 +#define ATTR_VOL_SPACEAVAIL 0x00000010 +#define ATTR_VOL_MINALLOCATION 0x00000020 +#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040 +#define ATTR_VOL_IOBLOCKSIZE 0x00000080 +#define ATTR_VOL_OBJCOUNT 0x00000100 +#define ATTR_VOL_FILECOUNT 0x00000200 +#define ATTR_VOL_DIRCOUNT 0x00000400 +#define ATTR_VOL_MAXOBJCOUNT 0x00000800 +#define ATTR_VOL_MOUNTPOINT 0x00001000 +#define ATTR_VOL_NAME 0x00002000 +#define ATTR_VOL_MOUNTFLAGS 0x00004000 +#define ATTR_VOL_MOUNTEDDEVICE 0x00008000 +#define ATTR_VOL_ENCODINGSUSED 0x00010000 +#define ATTR_VOL_CAPABILITIES 0x00020000 +#define ATTR_VOL_UUID 0x00040000 +#define ATTR_VOL_FSTYPENAME 0x00100000 +#define ATTR_VOL_FSSUBTYPE 0x00200000 +#define ATTR_VOL_SPACEUSED 0x00800000 +#define ATTR_VOL_QUOTA_SIZE 0x10000000 +#define ATTR_VOL_RESERVED_SIZE 0x20000000 +#define ATTR_VOL_ATTRIBUTES 0x40000000 +#define ATTR_VOL_INFO 0x80000000 +#define ATTR_VOL_VALIDMASK 0xF0B7FFFF +#define ATTR_VOL_SETMASK 0x80002000 +#define ATTR_DIR_LINKCOUNT 0x00000001 +#define ATTR_DIR_ENTRYCOUNT 0x00000002 +#define ATTR_DIR_MOUNTSTATUS 0x00000004 +#define ATTR_DIR_ALLOCSIZE 0x00000008 +#define ATTR_DIR_IOBLOCKSIZE 0x00000010 +#define ATTR_DIR_DATALENGTH 0x00000020 +#define DIR_MNTSTATUS_MNTPOINT 0x00000001 +#define DIR_MNTSTATUS_TRIGGER 0x00000002 +#define ATTR_DIR_VALIDMASK 0x0000003f +#define ATTR_DIR_SETMASK 0x00000000 +#define ATTR_FILE_LINKCOUNT 0x00000001 +#define ATTR_FILE_TOTALSIZE 0x00000002 +#define ATTR_FILE_ALLOCSIZE 0x00000004 +#define ATTR_FILE_IOBLOCKSIZE 0x00000008 +#define ATTR_FILE_DEVTYPE 0x00000020 +#define ATTR_FILE_FORKCOUNT 0x00000080 +#define ATTR_FILE_FORKLIST 0x00000100 +#define ATTR_FILE_DATALENGTH 0x00000200 +#define ATTR_FILE_DATAALLOCSIZE 0x00000400 +#define ATTR_FILE_RSRCLENGTH 0x00001000 +#define ATTR_FILE_RSRCALLOCSIZE 0x00002000 +#define ATTR_FILE_VALIDMASK 0x000037FF +#define ATTR_FILE_SETMASK 0x00000020 +#define ATTR_CMNEXT_RELPATH 0x00000004 +#define ATTR_CMNEXT_PRIVATESIZE 0x00000008 +#define ATTR_CMNEXT_LINKID 0x00000010 +#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020 +#define ATTR_CMNEXT_REALDEVID 0x00000040 +#define ATTR_CMNEXT_REALFSID 0x00000080 +#define ATTR_CMNEXT_CLONEID 0x00000100 +#define ATTR_CMNEXT_EXT_FLAGS 0x00000200 +#define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400 +#define ATTR_CMNEXT_ATTRIBUTION_TAG 0x00000800 +#define ATTR_CMNEXT_CLONE_REFCNT 0x00001000 +#define ATTR_CMNEXT_VALIDMASK 0x00001ffc +#define ATTR_CMNEXT_SETMASK 0x00000000 +#define ATTR_FORK_TOTALSIZE 0x00000001 +#define ATTR_FORK_ALLOCSIZE 0x00000002 +#define ATTR_FORK_RESERVED 0xffffffff +#define ATTR_FORK_VALIDMASK 0x00000003 +#define ATTR_FORK_SETMASK 0x00000000 +#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 +#define ATTR_CMN_NAMEDATTRLIST 0x00100000 +#define ATTR_FILE_CLUMPSIZE 0x00000010 +#define ATTR_FILE_FILETYPE 0x00000040 +#define ATTR_FILE_DATAEXTENTS 0x00000800 +#define ATTR_FILE_RSRCEXTENTS 0x00004000 +#define SRCHFS_START 0x00000001 +#define SRCHFS_MATCHPARTIALNAMES 0x00000002 +#define SRCHFS_MATCHDIRS 0x00000004 +#define SRCHFS_MATCHFILES 0x00000008 +#define SRCHFS_SKIPLINKS 0x00000010 +#define SRCHFS_SKIPINVISIBLE 0x00000020 +#define SRCHFS_SKIPPACKAGES 0x00000040 +#define SRCHFS_SKIPINAPPROPRIATE 0x00000080 +#define SRCHFS_NEGATEPARAMS 0x80000000 +#define SRCHFS_VALIDOPTIONSMASK 0x800000FF +#define KEV_ANY_VENDOR 0 +#define KEV_ANY_CLASS 0 +#define KEV_ANY_SUBCLASS 0 +#define KEV_VENDOR_APPLE 1 +#define KEV_NETWORK_CLASS 1 +#define KEV_IOKIT_CLASS 2 +#define KEV_SYSTEM_CLASS 3 +#define KEV_APPLESHARE_CLASS 4 +#define KEV_FIREWALL_CLASS 5 +#define KEV_IEEE80211_CLASS 6 +#define KEV_NKE_CLASS 7 +#define KEV_NKE_ALF_SUBCLASS 1 +#define KEV_NKE_ALF_STATE_CHANGED 1 +#define XNU_KERN_EVENT_DATA_SIZE 1 +#define KEV_VENDOR_CODE_MAX_STR_LEN 200 +#define N_KEV_VECTORS 5 +#define M_WAITOK 0x0000 +#define M_NOWAIT 0x0001 +#define M_ZERO 0x0004 +#define M_NULL 0x0008 +#define M_PCB 4 +#define M_RTABLE 5 +#define M_IFADDR 9 +#define M_SONAME 11 +#define M_LOCKF 40 +#define M_TEMP 80 +#define M_UDFNODE 84 +#define M_UDFMNT 85 +#define M_KAUTH 100 +#define HAVE_VT_LOCKERFS 1 +#define VNODE_READ 0x01 +#define VNODE_WRITE 0x02 +#define VNODE_BLOCKMAP_NO_TRACK 0x04 +#define VNODE_CLUSTER_VERIFY 0x08 +#define PREALLOCATE 0x00000001 +#define ALLOCATECONTIG 0x00000002 +#define ALLOCATEALL 0x00000004 +#define ALLOCATEPERSIST 0x00000008 +#define ALLOCATEFROMPEOF 0x00000010 +#define ALLOCATEFROMVOL 0x00000020 +#define IO_UNIT 0x0001 +#define IO_APPEND 0x0002 +#define IO_SYNC 0x0004 +#define IO_NODELOCKED 0x0008 +#define IO_NDELAY 0x0010 +#define IO_NOZEROFILL 0x0020 +#define IO_TAILZEROFILL 0x0040 +#define IO_HEADZEROFILL 0x0080 +#define IO_NOZEROVALID 0x0100 +#define IO_NOZERODIRTY 0x0200 +#define IO_CLOSE 0x0400 +#define IO_NOCACHE 0x0800 +#define IO_RAOFF 0x1000 +#define IO_DEFWRITE 0x2000 +#define IO_PASSIVE 0x4000 +#define IO_NOAUTH 0x8000 +#define IO_NODIRECT 0x10000 +#define IO_ENCRYPTED 0x20000 +#define IO_RETURN_ON_THROTTLE 0x40000 +#define IO_SINGLE_WRITER 0x80000 +#define IO_SYSCALL_DISPATCH 0x100000 +#define IO_SWAP_DISPATCH 0x200000 +#define IO_SKIP_ENCRYPTION 0x400000 +#define IO_EVTONLY 0x800000 +#define LOOKUP 0 +#define CREATE 1 +#define DELETE 2 +#define RENAME 3 +#define OPMASK 3 +#define FOLLOW 0x00000040 +#define ISDOTDOT 0x00002000 +#define MAKEENTRY 0x00004000 +#define ISLASTCN 0x00008000 +#define VNFS_NOCACHE 0x01 +#define VNFS_CANTCACHE 0x02 +#define VNFS_ADDFSREF 0x04 +#define VNCREATE_FLAVOR 0 +#define VA_UTIMES_NULL 0x010000 +#define VA_EXCLUSIVE 0x020000 +#define VA_NOINHERIT 0x040000 +#define VA_NOAUTH 0x080000 +#define VA_64BITOBJIDS 0x100000 +#define VA_REALFSID 0x200000 +#define VA_USEFSID 0x400000 +#define VA_FILESEC_ACL 0x800000 +#define VSUID 0x800 +#define VSGID 0x400 +#define VSVTX 0x200 +#define VREAD 0x100 +#define VWRITE 0x080 +#define VEXEC 0x040 +#define SKIPSYSTEM 0x0001 +#define FORCECLOSE 0x0002 +#define WRITECLOSE 0x0004 +#define SKIPSWAP 0x0008 +#define SKIPROOT 0x0010 +#define DOCLOSE 0x0008 +#define V_SAVE 0x0001 +#define V_SAVEMETA 0x0002 +#define REVOKEALL 0x0001 +#define VNODE_REMOVE_NODELETEBUSY 0x0001 +#define VNODE_REMOVE_SKIP_NAMESPACE_EVENT 0x0002 +#define VNODE_REMOVE_NO_AUDIT_PATH 0x0004 +#define VNODE_REMOVE_DATALESS_DIR 0x0008 +#define VNODE_READDIR_EXTENDED 0x0001 +#define VNODE_READDIR_REQSEEKOFF 0x0002 +#define VNODE_READDIR_SEEKOFF32 0x0004 +#define VNODE_READDIR_NAMEMAX 0x0008 +#define VNODE_CLONEFILE_DEFAULT 0x0000 +#define VNODE_CLONEFILE_NOOWNERCOPY 0x0001 +#define VNODE_ASYNC_THROTTLE 15 +#define VNODE_UPDATE_PARENT 0x01 +#define VNODE_UPDATE_NAME 0x02 +#define VNODE_UPDATE_CACHE 0x04 +#define VNODE_UPDATE_PURGE 0x08 +#define VNODE_LOOKUP_NOFOLLOW 0x01 +#define VNODE_LOOKUP_NOCROSSMOUNT 0x02 +#define VNODE_LOOKUP_CROSSMOUNTNOWAIT 0x04 +#define VNODE_RELOAD 0x01 +#define VNODE_WAIT 0x02 +#define VNODE_WRITEABLE 0x04 +#define VNODE_WITHID 0x08 +#define VNODE_NOLOCK_INTERNAL 0x10 +#define VNODE_NODEAD 0x20 +#define VNODE_NOSUSPEND 0x40 +#define VNODE_ITERATE_ALL 0x80 +#define VNODE_ITERATE_ACTIVE 0x100 +#define VNODE_ITERATE_INACTIVE 0x200 +#define VNODE_RETURNED 0 +#define VNODE_RETURNED_DONE 1 +#define VNODE_CLAIMED 2 +#define VNODE_CLAIMED_DONE 3 +#define IOCS_BUFFER_NUM_SIZE_BUCKETS 10 +#define IOCS_BUFFER_MAX_BUCKET 9 +#define IOCS_BUFFER_NUM_COMPRESSION_BUCKETS 7 +#define IOCS_BLOCK_NUM_SIZE_BUCKETS 16 +#define IOCS_SBE_PATH_LEN 128 +#define IOCS_PATH_START_BYTES_TO_COPY 108 +#define IOCS_PATH_END_BYTES_TO_COPY 20 +#define IOCS_SYSCTL_LIVE 0x00000001 +#define IOCS_SYSCTL_STORE_BUFFER_RD_ONLY 0x00000002 +#define IOCS_SYSCTL_STORE_BUFFER_MARK 0x00000004 +#define TANDEM 0x00000001 +#define CBREAK 0x00000002 +#define LCASE 0x00000004 +#define ECHO 0x00000008 +#define CRMOD 0x00000010 +#define RAW 0x00000020 +#define ODDP 0x00000040 +#define EVENP 0x00000080 +#define ANYP 0x000000c0 +#define NLDELAY 0x00000300 +#define TBDELAY 0x00000c00 +#define XTABS 0x00000c00 +#define CRDELAY 0x00003000 +#define VTDELAY 0x00004000 +#define BSDELAY 0x00008000 +#define NL0 0x00000000 +#define NL1 0x00000100 +#define NL2 0x00000200 +#define NL3 0x00000300 +#define TAB0 0x00000000 +#define TAB1 0x00000400 +#define TAB2 0x00000800 +#define CR0 0x00000000 +#define CR1 0x00001000 +#define CR2 0x00002000 +#define CR3 0x00003000 +#define FF0 0x00000000 +#define FF1 0x00004000 +#define BS0 0x00000000 +#define BS1 0x00008000 +#define CRTBS 0x00010000 +#define PRTERA 0x00020000 +#define CRTERA 0x00040000 +#define TILDE 0x00080000 +#define MDMBUF 0x00100000 +#define LITOUT 0x00200000 +#define TOSTOP 0x00400000 +#define FLUSHO 0x00800000 +#define NOHANG 0x01000000 +#define L001000 0x02000000 +#define CRTKIL 0x04000000 +#define PASS8 0x08000000 +#define CTLECH 0x10000000 +#define PENDIN 0x20000000 +#define DECCTQ 0x40000000 +#define NOFLSH 0x80000000 +#define OTTYDISC 0 +#define NETLDISC 1 +#define NTTYDISC 2 +#define LOCKLEAF 0x0004 +#define LOCKPARENT 0x0008 +#define WANTPARENT 0x0010 +#define UIO_MAXIOV 1024 +#define UIO_SMALLIOV 8 +#define EVFILT_SYSCOUNT 17 +#define KEVENT_FLAG_NONE 0x000000 +#define KEVENT_FLAG_IMMEDIATE 0x000001 +#define KEVENT_FLAG_ERROR_EVENTS 0x000002 +#define EV_ADD 0x0001 +#define EV_DELETE 0x0002 +#define EV_ENABLE 0x0004 +#define EV_DISABLE 0x0008 +#define EV_ONESHOT 0x0010 +#define EV_CLEAR 0x0020 +#define EV_RECEIPT 0x0040 +#define EV_DISPATCH 0x0080 +#define EV_UDATA_SPECIFIC 0x0100 +#define EV_VANISHED 0x0200 +#define EV_SYSFLAGS 0xF000 +#define EV_FLAG0 0x1000 +#define EV_FLAG1 0x2000 +#define EV_EOF 0x8000 +#define EV_ERROR 0x4000 +#define NOTE_TRIGGER 0x01000000 +#define NOTE_FFNOP 0x00000000 +#define NOTE_FFAND 0x40000000 +#define NOTE_FFOR 0x80000000 +#define NOTE_FFCOPY 0xc0000000 +#define NOTE_FFCTRLMASK 0xc0000000 +#define NOTE_FFLAGSMASK 0x00ffffff +#define NOTE_LOWAT 0x00000001 +#define NOTE_OOB 0x00000002 +#define NOTE_DELETE 0x00000001 +#define NOTE_WRITE 0x00000002 +#define NOTE_EXTEND 0x00000004 +#define NOTE_ATTRIB 0x00000008 +#define NOTE_LINK 0x00000010 +#define NOTE_RENAME 0x00000020 +#define NOTE_REVOKE 0x00000040 +#define NOTE_NONE 0x00000080 +#define NOTE_FUNLOCK 0x00000100 +#define NOTE_LEASE_DOWNGRADE 0x00000200 +#define NOTE_LEASE_RELEASE 0x00000400 +#define NOTE_EXIT 0x80000000 +#define NOTE_FORK 0x40000000 +#define NOTE_EXEC 0x20000000 +#define NOTE_SIGNAL 0x08000000 +#define NOTE_EXITSTATUS 0x04000000 +#define NOTE_EXIT_DETAIL 0x02000000 +#define NOTE_PDATAMASK 0x000fffff +#define NOTE_EXIT_DETAIL_MASK 0x00070000 +#define NOTE_EXIT_DECRYPTFAIL 0x00010000 +#define NOTE_EXIT_MEMORY 0x00020000 +#define NOTE_EXIT_CSERROR 0x00040000 +#define NOTE_VM_PRESSURE 0x80000000 +#define NOTE_VM_PRESSURE_TERMINATE 0x40000000 +#define NOTE_VM_PRESSURE_SUDDEN_TERMINATE 0x20000000 +#define NOTE_VM_ERROR 0x10000000 +#define NOTE_SECONDS 0x00000001 +#define NOTE_USECONDS 0x00000002 +#define NOTE_NSECONDS 0x00000004 +#define NOTE_ABSOLUTE 0x00000008 +#define NOTE_LEEWAY 0x00000010 +#define NOTE_CRITICAL 0x00000020 +#define NOTE_BACKGROUND 0x00000040 +#define NOTE_MACH_CONTINUOUS_TIME 0x00000080 +#define NOTE_MACHTIME 0x00000100 +#define NOTE_TRACK 0x00000001 +#define NOTE_TRACKERR 0x00000002 +#define NOTE_CHILD 0x00000004 +#define VMADDR_CID_HYPERVISOR 0 +#define VMADDR_CID_RESERVED 1 +#define VMADDR_CID_HOST 2 +#define IMG_SHSIZE 512 +#define IMGPF_NONE 0x00000000 +#define IMGPF_INTERPRET 0x00000001 +#define IMGPF_RESERVED 0x00000002 +#define IMGPF_WAS_64BIT_ADDR 0x00000004 +#define IMGPF_IS_64BIT_ADDR 0x00000008 +#define IMGPF_SPAWN 0x00000010 +#define IMGPF_DISABLE_ASLR 0x00000020 +#define IMGPF_ALLOW_DATA_EXEC 0x00000040 +#define IMGPF_EXEC 0x00000100 +#define IMGPF_HIGH_BITS_ASLR 0x00000200 +#define IMGPF_IS_64BIT_DATA 0x00000400 +#define IMGPF_DRIVER 0x00000800 +#define IMGPF_RESLIDE 0x00001000 +#define IMGPF_PLUGIN_HOST_DISABLE_A_KEYS 0x00002000 +#define IMGPF_HW_TPRO 0x00004000 +#define IMGPF_ROSETTA 0x10000000 +#define IMGPF_ALT_ROSETTA 0x20000000 +#define IMGPF_NOJOP 0x80000000 +#define IMGPF_SB_DEFAULT 0 +#define IMGPF_SB_TRUE 1 +#define IMGPF_SB_FALSE 2 +#define _POSIX_THREAD_KEYS_MAX 128 +#define F_OK 0 +#define ACCESSX_MAX_DESCRIPTORS 100 +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_CHOWN_RESTRICTED 7 +#define _PC_NO_TRUNC 8 +#define _PC_VDISABLE 9 +#define _PC_NAME_CHARS_MAX 10 +#define _PC_CASE_SENSITIVE 11 +#define _PC_CASE_PRESERVING 12 +#define _PC_EXTENDED_SECURITY_NP 13 +#define _PC_AUTH_OPAQUE_NP 14 +#define _PC_2_SYMLINKS 15 +#define _PC_ALLOC_SIZE_MIN 16 +#define _PC_ASYNC_IO 17 +#define _PC_FILESIZEBITS 18 +#define _PC_PRIO_IO 19 +#define _PC_REC_INCR_XFER_SIZE 20 +#define _PC_REC_MAX_XFER_SIZE 21 +#define _PC_REC_MIN_XFER_SIZE 22 +#define _PC_REC_XFER_ALIGN 23 +#define _PC_SYMLINK_MAX 24 +#define _PC_SYNC_IO 25 +#define _PC_XATTR_SIZE_BITS 26 +#define _PC_MIN_HOLE_SIZE 27 +#define _CS_PATH 1 +#define _SYS_CONF_H_ 1 +#define D_TAPE 1 +#define D_DISK 2 +#define D_TTY 3 +#define WNOHANG 0x00000001 +#define WUNTRACED 0x00000002 +#define WCOREFLAG 00200 +#define _WSTOPPED 00177 +#define WEXITED 0x00000004 +#define WSTOPPED 0x00000008 +#define WCONTINUED 0x00000010 +#define WNOWAIT 0x00000020 +#define WAIT_MYPGRP 0 +#define PRIO_DARWIN_GAME_MODE 7 +#define PRIO_DARWIN_GAME_MODE_OFF 0x0 +#define PRIO_DARWIN_GAME_MODE_ON 0x1 +#define IPC_CREAT 0001000 +#define IPC_EXCL 0002000 +#define IPC_NOWAIT 0004000 +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_STAT 2 +#define IPC_R 0000400 +#define IPC_W 0000200 +#define IPC_M 0010000 +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_ACCMODE 0x0003 +#define FREAD 0x00000001 +#define FWRITE 0x00000002 +#define O_NONBLOCK 0x00000004 +#define O_APPEND 0x00000008 +#define O_SHLOCK 0x00000010 +#define O_EXLOCK 0x00000020 +#define O_ASYNC 0x00000040 +#define O_NOFOLLOW 0x00000100 +#define O_CREAT 0x00000200 +#define O_TRUNC 0x00000400 +#define O_EXCL 0x00000800 +#define FMARK 0x00001000 +#define FDEFER 0x00002000 +#define FWASLOCKED 0x00004000 +#define O_EVTONLY 0x00008000 +#define FWASWRITTEN 0x00010000 +#define O_NOCTTY 0x00020000 +#define FNOCACHE 0x00040000 +#define FNORDAHEAD 0x00080000 +#define O_DIRECTORY 0x00100000 +#define O_SYMLINK 0x00200000 +#define FNODIRECT 0x00800000 +#define O_CLOEXEC 0x01000000 +#define FENCRYPTED 0x02000000 +#define FSINGLE_WRITER 0x04000000 +#define O_CLOFORK 0x08000000 +#define FUNENCRYPTED 0x10000000 +#define O_NOFOLLOW_ANY 0x20000000 +#define O_EXEC 0x40000000 +#define AT_EACCESS 0x0010 +#define AT_SYMLINK_NOFOLLOW 0x0020 +#define AT_SYMLINK_FOLLOW 0x0040 +#define AT_REMOVEDIR 0x0080 +#define AT_REALDEV 0x0200 +#define AT_FDONLY 0x0400 +#define AT_SYMLINK_NOFOLLOW_ANY 0x0800 +#define O_DP_GETRAWENCRYPTED 0x0001 +#define O_DP_GETRAWUNENCRYPTED 0x0002 +#define O_DP_AUTHENTICATE 0x0004 +#define CPF_OVERWRITE 0x0001 +#define CPF_IGNORE_MODE 0x0002 +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#define F_GETOWN 5 +#define F_SETOWN 6 +#define F_GETLK 7 +#define F_SETLK 8 +#define F_SETLKW 9 +#define F_SETLKWTIMEOUT 10 +#define F_FLUSH_DATA 40 +#define F_CHKCLEAN 41 +#define F_PREALLOCATE 42 +#define F_SETSIZE 43 +#define F_RDADVISE 44 +#define F_RDAHEAD 45 +#define F_NOCACHE 48 +#define F_LOG2PHYS 49 +#define F_GETPATH 50 +#define F_FULLFSYNC 51 +#define F_PATHPKG_CHECK 52 +#define F_FREEZE_FS 53 +#define F_THAW_FS 54 +#define F_GLOBAL_NOCACHE 55 +#define F_ADDSIGS 59 +#define F_ADDFILESIGS 61 +#define F_NODIRECT 62 +#define F_GETPROTECTIONCLASS 63 +#define F_SETPROTECTIONCLASS 64 +#define F_LOG2PHYS_EXT 65 +#define F_GETLKPID 66 +#define F_SETBACKINGSTORE 70 +#define F_GETPATH_MTMINFO 71 +#define F_GETCODEDIR 72 +#define F_SETNOSIGPIPE 73 +#define F_GETNOSIGPIPE 74 +#define F_TRANSCODEKEY 75 +#define F_SINGLE_WRITER 76 +#define F_GETPROTECTIONLEVEL 77 +#define F_FINDSIGS 78 +#define F_ADDFILESIGS_FOR_DYLD_SIM 83 +#define F_BARRIERFSYNC 85 +#define F_OFD_SETLK 90 +#define F_OFD_SETLKW 91 +#define F_OFD_GETLK 92 +#define F_OFD_SETLKWTIMEOUT 93 +#define F_ADDFILESIGS_RETURN 97 +#define F_CHECK_LV 98 +#define F_PUNCHHOLE 99 +#define F_TRIM_ACTIVE_FILE 100 +#define F_SPECULATIVE_READ 101 +#define F_GETPATH_NOFIRMLINK 102 +#define F_ADDFILESIGS_INFO 103 +#define F_ADDFILESUPPL 104 +#define F_GETSIGSINFO 105 +#define F_SETLEASE 106 +#define F_GETLEASE 107 +#define F_TRANSFEREXTENTS 110 +#define F_ATTRIBUTION_TAG 111 +#define FCNTL_FS_SPECIFIC_BASE 0x00010000 +#define F_DUPFD_CLOEXEC 67 +#define FD_CLOEXEC 1 +#define F_RDLCK 1 +#define F_UNLCK 2 +#define F_WRLCK 3 +#define F_WAIT 0x010 +#define F_FLOCK 0x020 +#define F_POSIX 0x040 +#define F_PROV 0x080 +#define F_WAKE1_SAFE 0x100 +#define F_ABORT 0x200 +#define F_OFD_LOCK 0x400 +#define F_TRANSFER 0x800 +#define F_CONFINED 0x1000 +#define F_ALLOCATECONTIG 0x00000002 +#define F_ALLOCATEALL 0x00000004 +#define F_ALLOCATEPERSIST 0x00000008 +#define F_PEOFPOSMODE 3 +#define F_VOLPOSMODE 4 +#define USER_FSIGNATURES_CDHASH_LEN 20 +#define GETSIGSINFO_PLATFORM_BINARY 1 +#define LOCK_SH 0x01 +#define LOCK_EX 0x02 +#define LOCK_NB 0x04 +#define LOCK_UN 0x08 +#define ATTRIBUTION_NAME_MAX 255 +#define F_CREATE_TAG 0x00000001 +#define F_DELETE_TAG 0x00000002 +#define F_QUERY_TAG 0x00000004 +#define O_POPUP 0x80000000 +#define O_ALERT 0x20000000 +#define S_BLKSIZE 512 +#define UF_SETTABLE 0x0000ffff +#define UF_NODUMP 0x00000001 +#define UF_IMMUTABLE 0x00000002 +#define UF_APPEND 0x00000004 +#define UF_OPAQUE 0x00000008 +#define UF_COMPRESSED 0x00000020 +#define UF_TRACKED 0x00000040 +#define UF_DATAVAULT 0x00000080 +#define UF_HIDDEN 0x00008000 +#define SF_SUPPORTED 0x009f0000 +#define SF_SETTABLE 0x3fff0000 +#define SF_SYNTHETIC 0xc0000000 +#define SF_ARCHIVED 0x00010000 +#define SF_IMMUTABLE 0x00020000 +#define SF_APPEND 0x00040000 +#define SF_RESTRICTED 0x00080000 +#define SF_NOUNLINK 0x00100000 +#define SF_FIRMLINK 0x00800000 +#define SF_DATALESS 0x40000000 +#define EF_MAY_SHARE_BLOCKS 0x00000001 +#define EF_NO_XATTRS 0x00000002 +#define EF_IS_SYNC_ROOT 0x00000004 +#define EF_IS_PURGEABLE 0x00000008 +#define EF_IS_SPARSE 0x00000010 +#define EF_IS_SYNTHETIC 0x00000020 +#define EF_SHARES_ALL_BLOCKS 0x00000040 +#define MBUF_COPYALL 1000000000 +#define __DARWIN_NSIG 32 +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGPOLL 7 +#define SIGEMT 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGBUS 10 +#define SIGSEGV 11 +#define SIGSYS 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGURG 16 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGIO 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGINFO 29 +#define SIGUSR1 30 +#define SIGUSR2 31 +#define SIGEV_NONE 0 +#define SIGEV_SIGNAL 1 +#define SIGEV_THREAD 3 +#define ILL_NOOP 0 +#define ILL_ILLOPC 1 +#define ILL_ILLTRP 2 +#define ILL_PRVOPC 3 +#define ILL_ILLOPN 4 +#define ILL_ILLADR 5 +#define ILL_PRVREG 6 +#define ILL_COPROC 7 +#define ILL_BADSTK 8 +#define FPE_NOOP 0 +#define FPE_FLTDIV 1 +#define FPE_FLTOVF 2 +#define FPE_FLTUND 3 +#define FPE_FLTRES 4 +#define FPE_FLTINV 5 +#define FPE_FLTSUB 6 +#define FPE_INTDIV 7 +#define FPE_INTOVF 8 +#define SEGV_NOOP 0 +#define SEGV_MAPERR 1 +#define SEGV_ACCERR 2 +#define BUS_NOOP 0 +#define BUS_ADRALN 1 +#define BUS_ADRERR 2 +#define BUS_OBJERR 3 +#define TRAP_BRKPT 1 +#define TRAP_TRACE 2 +#define CLD_NOOP 0 +#define CLD_EXITED 1 +#define CLD_KILLED 2 +#define CLD_DUMPED 3 +#define CLD_TRAPPED 4 +#define CLD_STOPPED 5 +#define CLD_CONTINUED 6 +#define POLL_IN 1 +#define POLL_OUT 2 +#define POLL_MSG 3 +#define POLL_ERR 4 +#define POLL_PRI 5 +#define POLL_HUP 6 +#define SA_ONSTACK 0x0001 +#define SA_RESTART 0x0002 +#define SA_RESETHAND 0x0004 +#define SA_NOCLDSTOP 0x0008 +#define SA_NODEFER 0x0010 +#define SA_NOCLDWAIT 0x0020 +#define SA_SIGINFO 0x0040 +#define SA_USERTRAMP 0x0100 +#define SA_64REGSET 0x0200 +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 +#define SI_USER 0x10001 +#define SI_QUEUE 0x10002 +#define SI_TIMER 0x10003 +#define SI_ASYNCIO 0x10004 +#define SI_MESGQ 0x10005 +#define SS_ONSTACK 0x0001 +#define SS_DISABLE 0x0004 +#define MINSIGSTKSZ 32768 +#define SIGSTKSZ 131072 +#define __DARWIN_MAXNAMLEN 255 +#define __DARWIN_MAXPATHLEN 1024 +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#define POSIX_SPAWN_RESETIDS 0x0001 +#define POSIX_SPAWN_SETPGROUP 0x0002 +#define POSIX_SPAWN_SETSIGDEF 0x0004 +#define POSIX_SPAWN_SETSIGMASK 0x0008 +#define POSIX_SPAWN_SETSCHEDPARAM 0x0010 +#define POSIX_SPAWN_SETSCHEDULER 0x0020 +#define POSIX_SPAWN_SETEXEC 0x0040 +#define POSIX_SPAWN_START_SUSPENDED 0x0080 +#define POSIX_SPAWN_SETSID 0x0400 +#define POSIX_SPAWN_CLOEXEC_DEFAULT 0x4000 +#define _POSIX_SPAWN_RESLIDE 0x0800 +#define POSIX_SPAWN_PCONTROL_NONE 0x0000 +#define POSIX_SPAWN_PCONTROL_THROTTLE 0x0001 +#define POSIX_SPAWN_PCONTROL_SUSPEND 0x0002 +#define POSIX_SPAWN_PCONTROL_KILL 0x0003 +#define POSIX_SPAWN_PANIC_ON_CRASH 0x1 +#define POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT 0x2 +#define POSIX_SPAWN_PANIC_ON_EXIT 0x4 +#define POSIX_SPAWN_PANIC_ON_SPAWN_FAIL 0x8 +#define PROT_NONE 0x00 +#define PROT_READ 0x01 +#define PROT_WRITE 0x02 +#define PROT_EXEC 0x04 +#define MAP_SHARED 0x0001 +#define MAP_PRIVATE 0x0002 +#define MAP_FIXED 0x0010 +#define MAP_RENAME 0x0020 +#define MAP_NORESERVE 0x0040 +#define MAP_RESERVED0080 0x0080 +#define MAP_NOEXTEND 0x0100 +#define MAP_HASSEMAPHORE 0x0200 +#define MAP_NOCACHE 0x0400 +#define MAP_JIT 0x0800 +#define MAP_FILE 0x0000 +#define MAP_ANON 0x1000 +#define MAP_RESILIENT_CODESIGN 0x2000 +#define MAP_RESILIENT_MEDIA 0x4000 +#define MAP_32BIT 0x8000 +#define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000 +#define MAP_UNIX03 0x40000 +#define MAP_TPRO 0x80000 +#define MCL_CURRENT 0x0001 +#define MCL_FUTURE 0x0002 +#define MS_ASYNC 0x0001 +#define MS_INVALIDATE 0x0002 +#define MS_SYNC 0x0010 +#define MS_KILLPAGES 0x0004 +#define MS_DEACTIVATE 0x0008 +#define POSIX_MADV_NORMAL 0 +#define POSIX_MADV_RANDOM 1 +#define POSIX_MADV_SEQUENTIAL 2 +#define POSIX_MADV_WILLNEED 3 +#define POSIX_MADV_DONTNEED 4 +#define MADV_FREE 5 +#define MADV_ZERO_WIRED_PAGES 6 +#define MADV_FREE_REUSABLE 7 +#define MADV_FREE_REUSE 8 +#define MADV_CAN_REUSE 9 +#define MADV_PAGEOUT 10 +#define MINCORE_INCORE 0x1 +#define MINCORE_REFERENCED 0x2 +#define MINCORE_MODIFIED 0x4 +#define MINCORE_REFERENCED_OTHER 0x8 +#define MINCORE_MODIFIED_OTHER 0x10 +#define MINCORE_PAGED_OUT 0x20 +#define MINCORE_COPIED 0x40 +#define MINCORE_ANONYMOUS 0x80 +#define B_WRITE 0x00000000 +#define B_READ 0x00000001 +#define B_ASYNC 0x00000002 +#define B_NOCACHE 0x00000004 +#define B_DELWRI 0x00000008 +#define B_LOCKED 0x00000010 +#define B_PHYS 0x00000020 +#define B_CLUSTER 0x00000040 +#define B_PAGEIO 0x00000080 +#define B_META 0x00000100 +#define B_RAW 0x00000200 +#define B_FUA 0x00000400 +#define B_PASSIVE 0x00000800 +#define B_IOSTREAMING 0x00001000 +#define B_THROTTLED_IO 0x00002000 +#define B_ENCRYPTED_IO 0x00004000 +#define B_STATICCONTENT 0x00008000 +#define BUF_WAIT 0x01 +#define BUF_WRITE_DATA 0x0001 +#define BUF_SKIP_META 0x0002 +#define BUF_INVALIDATE_LOCKED 0x0004 +#define BUF_SKIP_NONLOCKED 0x01 +#define BUF_SKIP_LOCKED 0x02 +#define BUF_SCAN_CLEAN 0x04 +#define BUF_SCAN_DIRTY 0x08 +#define BUF_NOTIFY_BUSY 0x10 +#define BUF_RETURNED 0 +#define BUF_RETURNED_DONE 1 +#define BUF_CLAIMED 2 +#define BUF_CLAIMED_DONE 3 +#define BLK_READ 0x01 +#define BLK_WRITE 0x02 +#define BLK_META 0x10 +#define BLK_ONLYVALID 0x80000000 +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 +#define LOG_PRIMASK 0x07 +#define INTERNAL_NOPRI 0x10 +#define LOG_NFACILITIES 25 +#define LOG_FACMASK 0x03f8 +#define LOG_PID 0x01 +#define LOG_CONS 0x02 +#define LOG_ODELAY 0x04 +#define LOG_NDELAY 0x08 +#define LOG_NOWAIT 0x10 +#define LOG_PERROR 0x20 +#define CRF_NOMEMBERD 0x00000001 +#define CRF_MAC_ENFORCE 0x00000002 +#define XUCRED_VERSION 0 +#define DK_FEATURE_BARRIER 0x00000002 +#define DK_FEATURE_PRIORITY 0x00000004 +#define DK_FEATURE_UNMAP 0x00000010 +#define DK_SYNCHRONIZE_OPTION_BARRIER 0x00000002 +#define DK_CORESTORAGE_PIN_YOUR_METADATA 0x00000001 +#define DK_CORESTORAGE_ENABLE_HOTFILES 0x00000002 +#define DK_CORESTORAGE_PIN_YOUR_SWAPFILE 0x00000004 +#define DK_PROVISION_TYPE_MAPPED 0x00 +#define DK_PROVISION_TYPE_DEALLOCATED 0x01 +#define DK_PROVISION_TYPE_ANCHORED 0x02 +#define DK_LOCATION_INTERNAL 0x00000000 +#define DK_LOCATION_EXTERNAL 0x00000001 +#define DK_FEATURE_FORCE_UNIT_ACCESS 0x00000001 +#define DK_ENCRYPTION_TYPE_AES_CBC 1 +#define DK_ENCRYPTION_TYPE_AES_XEX 2 +#define DK_ENCRYPTION_TYPE_AES_XTS 3 +#define DK_TIER_MASK 0xC0 +#define DK_TIER_SHIFT 6 +#define SOL_LOCAL 0 +#define LOCAL_PEERCRED 0x001 +#define LOCAL_PEERPID 0x002 +#define LOCAL_PEEREPID 0x003 +#define LOCAL_PEERUUID 0x004 +#define LOCAL_PEEREUUID 0x005 +#define LOCAL_PEERTOKEN 0x006 +#define _SYS_TIMEX_H_ 1 +#define NTP_API 4 +#define MINSEC 256 +#define MAXSEC 2048 +#define MAXTC 10 +#define MOD_OFFSET 0x0001 +#define MOD_FREQUENCY 0x0002 +#define MOD_MAXERROR 0x0004 +#define MOD_ESTERROR 0x0008 +#define MOD_STATUS 0x0010 +#define MOD_TIMECONST 0x0020 +#define MOD_PPSMAX 0x0040 +#define MOD_TAI 0x0080 +#define MOD_MICRO 0x1000 +#define MOD_NANO 0x2000 +#define MOD_CLKB 0x4000 +#define MOD_CLKA 0x8000 +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 +#define TIME_OK 0 +#define TIME_INS 1 +#define TIME_DEL 2 +#define TIME_OOP 3 +#define TIME_WAIT 4 +#define TIME_ERROR 5 +#define MT_FREE 0 +#define MT_DATA 1 +#define MT_HEADER 2 +#define MT_SOCKET 3 +#define MT_PCB 4 +#define MT_RTABLE 5 +#define MT_HTABLE 6 +#define MT_ATABLE 7 +#define MT_SONAME 8 +#define MT_SOOPTS 10 +#define MT_FTABLE 11 +#define MT_RIGHTS 12 +#define MT_IFADDR 13 +#define MT_CONTROL 14 +#define MT_OOBDATA 15 +#define MT_TAG 16 +#define MT_MAX 32 +#define MAX_MBUF_CNAME 15 +#define MCS_DISABLED 0 +#define MCS_ONLINE 1 +#define MCS_PURGING 2 +#define MCS_OFFLINE 3 +#define MSG_NOERROR 0010000 +#define MSGSSZ 8 +#define MSGSEG 2048 +#define MSGMNB 2048 +#define MSGMNI 40 +#define MSGTQL 40 +#define MSG_LOCKED 001000 +#define DBG_MACH 1 +#define DBG_NETWORK 2 +#define DBG_FSYSTEM 3 +#define DBG_BSD 4 +#define DBG_IOKIT 5 +#define DBG_DRIVERS 6 +#define DBG_TRACE 7 +#define DBG_DLIL 8 +#define DBG_PTHREAD 9 +#define DBG_CORESTORAGE 10 +#define DBG_CG 11 +#define DBG_MONOTONIC 12 +#define DBG_MISC 20 +#define DBG_SECURITY 30 +#define DBG_DYLD 31 +#define DBG_QT 32 +#define DBG_APPS 33 +#define DBG_LAUNCHD 34 +#define DBG_SILICON 35 +#define DBG_PERF 37 +#define DBG_IMPORTANCE 38 +#define DBG_BANK 40 +#define DBG_XPC 41 +#define DBG_ATM 42 +#define DBG_ARIADNE 43 +#define DBG_DAEMON 44 +#define DBG_ENERGYTRACE 45 +#define DBG_DISPATCH 46 +#define DBG_IMG 49 +#define DBG_UMALLOC 51 +#define DBG_TURNSTILE 53 +#define DBG_AUDIO 54 +#define DBG_MIG 255 +#define DBG_MACH_EXCP_KTRAP_x86 0x02 +#define DBG_MACH_EXCP_DFLT 0x03 +#define DBG_MACH_EXCP_SYNC_ARM 0x03 +#define DBG_MACH_EXCP_IFLT 0x04 +#define DBG_MACH_EXCP_SERR_ARM 0x04 +#define DBG_MACH_EXCP_INTR 0x05 +#define DBG_MACH_EXCP_ALNG 0x06 +#define DBG_MACH_EXCP_UTRAP_x86 0x07 +#define DBG_MACH_EXCP_FP 0x08 +#define DBG_MACH_EXCP_DECI 0x09 +#define DBG_MACH_CHUD 0x0A +#define DBG_MACH_SIGNPOST 0x0A +#define DBG_MACH_EXCP_SC 0x0C +#define DBG_MACH_EXCP_TRACE 0x0D +#define DBG_MACH_EXCP_EMUL 0x0E +#define DBG_MACH_IHDLR 0x10 +#define DBG_MACH_IPC 0x20 +#define DBG_MACH_RESOURCE 0x25 +#define DBG_MACH_VM 0x30 +#define DBG_MACH_LEAKS 0x31 +#define DBG_MACH_WORKINGSET 0x32 +#define DBG_MACH_SCHED 0x40 +#define DBG_MACH_MSGID_INVALID 0x50 +#define DBG_MACH_LOCKS 0x60 +#define DBG_MACH_PMAP 0x70 +#define DBG_MACH_CLOCK 0x80 +#define DBG_MACH_MP 0x90 +#define DBG_MACH_VM_PRESSURE 0xA0 +#define DBG_MACH_STACKSHOT 0xA1 +#define DBG_MACH_SFI 0xA2 +#define DBG_MACH_ENERGY_PERF 0xA3 +#define DBG_MACH_SYSDIAGNOSE 0xA4 +#define DBG_MACH_ZALLOC 0xA5 +#define DBG_MACH_THREAD_GROUP 0xA6 +#define DBG_MACH_COALITION 0xA7 +#define DBG_MACH_SHAREDREGION 0xA8 +#define DBG_MACH_SCHED_CLUTCH 0xA9 +#define DBG_MACH_IO 0xAA +#define DBG_MACH_WORKGROUP 0xAB +#define DBG_MACH_HV 0xAC +#define DBG_MACH_KCOV 0xAD +#define DBG_MACH_MACHDEP_EXCP_SC_x86 0xAE +#define DBG_MACH_MACHDEP_EXCP_SC_ARM 0xAF +#define DBC_MACH_IO_MMIO_READ 0x1 +#define DBC_MACH_IO_MMIO_WRITE 0x2 +#define DBC_MACH_IO_PHYS_READ 0x3 +#define DBC_MACH_IO_PHYS_WRITE 0x4 +#define DBC_MACH_IO_PORTIO_READ 0x5 +#define DBC_MACH_IO_PORTIO_WRITE 0x6 +#define DBG_INTR_TYPE_UNKNOWN 0x0 +#define DBG_INTR_TYPE_IPI 0x1 +#define DBG_INTR_TYPE_TIMER 0x2 +#define DBG_INTR_TYPE_OTHER 0x3 +#define DBG_INTR_TYPE_PMI 0x4 +#define DBG_INTR_TYPE_RSVD1 0x5 +#define MACH_SCHED 0x0 +#define MACH_STACK_ATTACH 0x1 +#define MACH_STACK_HANDOFF 0x2 +#define MACH_CALL_CONT 0x3 +#define MACH_CALLOUT 0x4 +#define MACH_STACK_DETACH 0x5 +#define MACH_MAKE_RUNNABLE 0x6 +#define MACH_PROMOTE 0x7 +#define MACH_DEMOTE 0x8 +#define MACH_IDLE 0x9 +#define MACH_STACK_DEPTH 0xa +#define MACH_MOVED 0xb +#define MACH_PSET_LOAD_AVERAGE 0xc +#define MACH_AMP_DEBUG 0xd +#define MACH_FAILSAFE 0xe +#define MACH_BLOCK 0xf +#define MACH_WAIT 0x10 +#define MACH_GET_URGENCY 0x14 +#define MACH_URGENCY 0x15 +#define MACH_REDISPATCH 0x16 +#define MACH_REMOTE_AST 0x17 +#define MACH_SCHED_CHOOSE_PROCESSOR 0x18 +#define MACH_DEEP_IDLE 0x19 +#define MACH_CPU_THROTTLE_DISABLE 0x1b +#define MACH_RW_PROMOTE 0x1c +#define MACH_RW_DEMOTE 0x1d +#define MACH_SCHED_MAINTENANCE 0x1f +#define MACH_DISPATCH 0x20 +#define MACH_QUANTUM_HANDOFF 0x21 +#define MACH_MULTIQ_DEQUEUE 0x22 +#define MACH_SCHED_THREAD_SWITCH 0x23 +#define MACH_SCHED_SMT_BALANCE 0x24 +#define MACH_REMOTE_DEFERRED_AST 0x25 +#define MACH_REMOTE_CANCEL_AST 0x26 +#define MACH_SCHED_CHANGE_PRIORITY 0x27 +#define MACH_SCHED_UPDATE_REC_CORES 0x28 +#define MACH_STACK_WAIT 0x29 +#define MACH_THREAD_BIND 0x2a +#define MACH_WAITQ_PROMOTE 0x2b +#define MACH_WAITQ_DEMOTE 0x2c +#define MACH_SCHED_LOAD 0x2d +#define MACH_REC_CORES_FAILSAFE 0x2e +#define MACH_SCHED_QUANTUM_EXPIRED 0x2f +#define MACH_EXEC_PROMOTE 0x30 +#define MACH_EXEC_DEMOTE 0x31 +#define MACH_AMP_SIGNAL_SPILL 0x32 +#define MACH_AMP_STEAL 0x33 +#define MACH_SCHED_LOAD_EFFECTIVE 0x34 +#define MACH_QUIESCENT_COUNTER 0x38 +#define MACH_TURNSTILE_USER_CHANGE 0x39 +#define MACH_AMP_RECOMMENDATION_CHANGE 0x3a +#define MACH_AMP_PERFCTL_POLICY_CHANGE 0x3b +#define MACH_TURNSTILE_KERNEL_CHANGE 0x40 +#define MACH_SCHED_WI_AUTO_JOIN 0x41 +#define MACH_SCHED_WI_DEFERRED_FINISH 0x42 +#define MACH_SET_RT_DEADLINE 0x43 +#define MACH_CANCEL_RT_DEADLINE 0x44 +#define MACH_RT_SIGNAL_SPILL 0x45 +#define MACH_RT_STEAL 0x46 +#define MACH_PENDING_AST_URGENT 0x47 +#define MACH_SCHED_THREAD_SELECT 0x48 +#define MACH_SCHED_NEXT_PROCESSOR 0x49 +#define MACH_PSET_AVG_EXEC_TIME 0x50 +#define MACH_SUSPEND_USERSPACE 0x51 +#define MACH_PREEMPTION_EXPIRED 0x52 +#define MACH_FLOOR_PROMOTE 0x53 +#define MACH_FLOOR_DEMOTE 0x54 +#define MACH_INT_MASKED_EXPIRED 0x55 +#define MACH_INT_HANDLED_EXPIRED 0x56 +#define MACH_UPDATE_POWERED_CORES 0x58 +#define MACH_MODE_DEMOTE_THROTTLED 0x59 +#define MACH_MODE_DEMOTE_FAILSAFE 0x5a +#define MACH_MODE_DEMOTE_RT_DISALLOWED 0x5b +#define MACH_MODE_UNDEMOTE_THROTTLED 0x5c +#define MACH_MODE_UNDEMOTE_FAILSAFE 0x5d +#define MACH_MODE_UNDEMOTE_RT_DISALLOWED 0x5e +#define MACH_INT_MASKED_RESET 0x5f +#define MACH_RT_DISALLOWED_WORK_INTERVAL 0x60 +#define MACH_SCHED_WI_EXTERNAL_WAKEUP 0x61 +#define MACH_SCHED_AST_CHECK 0x62 +#define MACH_SCHED_PREEMPT_TIMER_ACTIVE 0x63 +#define MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE 0x0 +#define MACH_SCHED_CLUTCH_TG_BUCKET_STATE 0x1 +#define MACH_SCHED_CLUTCH_THREAD_SELECT 0x2 +#define MACH_SCHED_CLUTCH_THREAD_STATE 0x3 +#define MACH_SCHED_CLUTCH_TG_BUCKET_PRI 0x4 +#define MACH_SCHED_EDGE_CLUSTER_OVERLOAD 0x5 +#define MACH_SCHED_EDGE_STEAL 0x6 +#define MACH_SCHED_EDGE_REBAL_RUNNABLE 0x7 +#define MACH_SCHED_EDGE_REBAL_RUNNING 0x8 +#define MACH_SCHED_EDGE_SHOULD_YIELD 0x9 +#define MACH_SCHED_CLUTCH_THR_COUNT 0xa +#define MACH_SCHED_EDGE_LOAD_AVG 0xb +#define MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD 0xc +#define MACH_SCHED_EDGE_RSRC_HEAVY_THREAD 0xd +#define MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE 0xe +#define WORKGROUP_INTERVAL_CREATE 0x0 +#define WORKGROUP_INTERVAL_DESTROY 0x1 +#define WORKGROUP_INTERVAL_CHANGE 0x2 +#define WORKGROUP_INTERVAL_START 0x3 +#define WORKGROUP_INTERVAL_UPDATE 0x4 +#define WORKGROUP_INTERVAL_FINISH 0x5 +#define WORKGROUP_INTERVAL_SET_WORKLOAD_ID 0x6 +#define WORKGROUP_INTERVAL_SET_WORKLOAD_ID_NAME 0x7 +#define KCOV_STKSZ_THRESHOLD_ABOVE 0x0 +#define KCOV_STKSZ_THRESHOLD_BELOW 0x1 +#define MACH_MULTIQ_BOUND 1 +#define MACH_MULTIQ_GROUP 2 +#define MACH_MULTIQ_GLOBAL 3 +#define DBG_ZERO_FILL_FAULT 1 +#define DBG_PAGEIN_FAULT 2 +#define DBG_COW_FAULT 3 +#define DBG_CACHE_HIT_FAULT 4 +#define DBG_NZF_PAGE_FAULT 5 +#define DBG_GUARD_FAULT 6 +#define DBG_PAGEINV_FAULT 7 +#define DBG_PAGEIND_FAULT 8 +#define DBG_COMPRESSOR_FAULT 9 +#define DBG_COMPRESSOR_SWAPIN_FAULT 10 +#define DBG_COR_FAULT 11 +#define MACH_TASK_SUSPEND 0x0 +#define MACH_TASK_RESUME 0x1 +#define MACH_THREAD_SET_VOUCHER 0x2 +#define MACH_IPC_MSG_SEND 0x3 +#define MACH_IPC_MSG_RECV 0x4 +#define MACH_IPC_MSG_RECV_VOUCHER_REFUSED 0x5 +#define MACH_IPC_KMSG_FREE 0x6 +#define MACH_IPC_VOUCHER_CREATE 0x7 +#define MACH_IPC_VOUCHER_CREATE_ATTR_DATA 0x8 +#define MACH_IPC_VOUCHER_DESTROY 0x9 +#define MACH_IPC_KMSG_INFO 0xa +#define MACH_IPC_KMSG_LINK 0xb +#define MACH_IPC_PORT_ENTRY_MODIFY 0xc +#define MACH_IPC_DESTROY_GUARDED_DESC 0xd +#define MACH_THREAD_GROUP_NEW 0x0 +#define MACH_THREAD_GROUP_FREE 0x1 +#define MACH_THREAD_GROUP_SET 0x2 +#define MACH_THREAD_GROUP_NAME 0x3 +#define MACH_THREAD_GROUP_NAME_FREE 0x4 +#define MACH_THREAD_GROUP_FLAGS 0x5 +#define MACH_THREAD_GROUP_BLOCK 0x6 +#define MACH_THREAD_GROUP_PREADOPT 0x7 +#define MACH_THREAD_GROUP_PREADOPT_NEXTTIME 0x8 +#define MACH_THREAD_GROUP_PREADOPT_CLEAR 0x9 +#define MACH_THREAD_GROUP_PREADOPT_NA 0xa +#define MACH_COALITION_NEW 0x0 +#define MACH_COALITION_FREE 0x1 +#define MACH_COALITION_ADOPT 0x2 +#define MACH_COALITION_REMOVE 0x3 +#define MACH_COALITION_THREAD_GROUP_SET 0x4 +#define PMAP__CREATE 0x0 +#define PMAP__DESTROY 0x1 +#define PMAP__PROTECT 0x2 +#define PMAP__PAGE_PROTECT 0x3 +#define PMAP__ENTER 0x4 +#define PMAP__REMOVE 0x5 +#define PMAP__NEST 0x6 +#define PMAP__UNNEST 0x7 +#define PMAP__FLUSH_TLBS 0x8 +#define PMAP__UPDATE_INTERRUPT 0x9 +#define PMAP__ATTRIBUTE_CLEAR 0xa +#define PMAP__REUSABLE 0xb +#define PMAP__QUERY_RESIDENT 0xc +#define PMAP__FLUSH_KERN_TLBS 0xd +#define PMAP__FLUSH_DELAYED_TLBS 0xe +#define PMAP__FLUSH_TLBS_TO 0xf +#define PMAP__FLUSH_EPT 0x10 +#define PMAP__FAST_FAULT 0x11 +#define PMAP__SWITCH 0x12 +#define PMAP__TTE 0x13 +#define PMAP__SWITCH_USER_TTB 0x14 +#define PMAP__UPDATE_CACHING 0x15 +#define PMAP__ATTRIBUTE_CLEAR_RANGE 0x16 +#define PMAP__CLEAR_USER_TTB 0x17 +#define PMAP__IOMMU_INIT 0x18 +#define PMAP__IOMMU_IOVMALLOC 0x19 +#define PMAP__IOMMU_IOVMFREE 0x1a +#define PMAP__IOMMU_MAP 0x1b +#define PMAP__IOMMU_UNMAP 0x1c +#define PMAP__IOMMU_IOCTL 0x1d +#define PMAP__IOMMU_GRANT_PAGE 0x1e +#define PMAP__BATCH_UPDATE_CACHING 0x1f +#define PMAP__COLLECT_CACHE_OPS 0x20 +#define MACH_EPOCH_CHANGE 0x0 +#define MACH_BRIDGE_RCV_TS 0x1 +#define MACH_BRIDGE_REMOTE_TIME 0x2 +#define MACH_BRIDGE_RESET_TS 0x3 +#define MACH_BRIDGE_TS_PARAMS 0x4 +#define MACH_BRIDGE_SKIP_TS 0x5 +#define MACH_BRIDGE_TS_MISMATCH 0x6 +#define MACH_BRIDGE_OBSV_RATE 0x7 +#define MICROSTACKSHOT_RECORD 0x0 +#define MICROSTACKSHOT_GATHER 0x1 +#define STACKSHOT_RECORD 0x2 +#define STACKSHOT_RECORD_SHORT 0x3 +#define STACKSHOT_KERN_RECORD 0x4 +#define SYSDIAGNOSE_NOTIFY_USER 0x0 +#define SYSDIAGNOSE_FULL 0x1 +#define SYSDIAGNOSE_STACKSHOT 0x2 +#define SYSDIAGNOSE_TAILSPIN 0x3 +#define SFI_SET_WINDOW 0x0 +#define SFI_CANCEL_WINDOW 0x1 +#define SFI_SET_CLASS_OFFTIME 0x2 +#define SFI_CANCEL_CLASS_OFFTIME 0x3 +#define SFI_THREAD_DEFER 0x4 +#define SFI_OFF_TIMER 0x5 +#define SFI_ON_TIMER 0x6 +#define SFI_WAIT_CANCELED 0x7 +#define SFI_PID_SET_MANAGED 0x8 +#define SFI_PID_CLEAR_MANAGED 0x9 +#define SFI_GLOBAL_DEFER 0xa +#define ZALLOC_ZCRAM 0x0 +#define RMON_ENABLE_CPUUSAGE_MONITOR 0x001 +#define RMON_CPUUSAGE_VIOLATED 0x002 +#define RMON_CPUUSAGE_SUSPENDED 0x003 +#define RMON_CPUUSAGE_VIOLATED_K32A 0x004 +#define RMON_CPUUSAGE_VIOLATED_K32B 0x005 +#define RMON_CPUUSAGE_RESUMED 0x006 +#define RMON_DISABLE_CPUUSAGE_MONITOR 0x00f +#define RMON_ENABLE_CPUWAKES_MONITOR 0x011 +#define RMON_CPUWAKES_VIOLATED 0x012 +#define RMON_CPUWAKES_VIOLATED_K32A 0x014 +#define RMON_CPUWAKES_VIOLATED_K32B 0x015 +#define RMON_DISABLE_CPUWAKES_MONITOR 0x01f +#define RMON_ENABLE_IO_MONITOR 0x021 +#define RMON_LOGWRITES_VIOLATED 0x022 +#define RMON_PHYSWRITES_VIOLATED 0x023 +#define RMON_LOGWRITES_VIOLATED_K32A 0x024 +#define RMON_LOGWRITES_VIOLATED_K32B 0x025 +#define RMON_DISABLE_IO_MONITOR 0x02f +#define HV_X86_ENTER 0x00 +#define HV_X86_ENTER_ERROR 0x01 +#define HV_X86_TRAP_TASK 0x02 +#define HV_X86_TRAP_THREAD 0x03 +#define HV_X86_INTERRUPT_INJECT 0x04 +#define HV_X86_INTERRUPT_RECV 0x05 +#define HV_X86_INTERRUPT_SEND 0x06 +#define HV_X86_IPI_SEND 0x07 +#define HV_X86_NMI_INJECT 0x08 +#define HV_X86_NMI_SEND 0x09 +#define HV_X86_LSC_HIT 0x0a +#define HV_X86_LSC_INSERT 0x0b +#define HV_X86_LSC_INSERT_IMM32 0x0c +#define HV_X86_LSC_INVALID 0x0d +#define HV_X86_LSC_INVALIDATE 0x0e +#define HV_X86_LSC_MISS 0x0f +#define HV_X86_TIMER_CANCEL 0x10 +#define HV_X86_TIMER_FIRE 0x11 +#define HV_X86_TIMER_SCHEDULE 0x12 +#define HV_X86_APIC_ACCESS_EXIT 0x13 +#define HV_X86_APIC_WRITE_EXIT 0x14 +#define HV_X86_EPT_VIOLATION_EXIT 0x15 +#define HV_X86_EXC_NMI_EXIT 0x16 +#define HV_X86_HLT_EXIT 0x17 +#define HV_X86_IO_EXIT 0x18 +#define HV_X86_IRQ_EXIT 0x19 +#define HV_X86_IRQ_WND_EXIT 0x1a +#define HV_X86_MOV_DR_EXIT 0x1b +#define HV_X86_NMI_WND_EXIT 0x1c +#define HV_X86_RDMSR_EXIT 0x1d +#define HV_X86_RDPMC_EXIT 0x1e +#define HV_X86_TPR_THRESHOLD_EXIT 0x1f +#define HV_X86_VMX_TIMER_EXPIRED_EXIT 0x20 +#define HV_X86_WRMSR_EXIT 0x21 +#define HV_X86_VCPU_READ_APIC_TRAP 0x22 +#define HV_X86_VCPU_READ_VMCS_TRAP 0x23 +#define HV_X86_VCPU_RUN_TRAP 0x24 +#define HV_X86_VCPU_RUN_UNTIL_TRAP 0x25 +#define HV_X86_VCPU_WRITE_APIC_TRAP 0x26 +#define HV_X86_VM_ADDRSPACE_CREATE_TRAP 0x27 +#define HV_X86_VM_ADDRSPACE_DESTROY_TRAP 0x28 +#define HV_X86_VM_INTR_MSI_TRAP 0x29 +#define HV_X86_VM_MAP_TRAP 0x2a +#define HV_X86_VM_PROTECT_TRAP 0x2b +#define HV_X86_VM_UNMAP_TRAP 0x2c +#define HV_X86_TSC_OFFSET_SET 0x2d +#define DBG_NETIP 1 +#define DBG_NETARP 2 +#define DBG_NETUDP 3 +#define DBG_NETTCP 4 +#define DBG_NETICMP 5 +#define DBG_NETIGMP 6 +#define DBG_NETRIP 7 +#define DBG_NETOSPF 8 +#define DBG_NETISIS 9 +#define DBG_NETSNMP 10 +#define DBG_NETSOCK 11 +#define DBG_NETAARP 100 +#define DBG_NETDDP 101 +#define DBG_NETNBP 102 +#define DBG_NETZIP 103 +#define DBG_NETADSP 104 +#define DBG_NETATP 105 +#define DBG_NETASP 106 +#define DBG_NETAFP 107 +#define DBG_NETRTMP 108 +#define DBG_NETAURP 109 +#define DBG_NETIPSEC 128 +#define DBG_NETVMNET 129 +#define DBG_IOINTC 0 +#define DBG_IOWORKLOOP 1 +#define DBG_IOINTES 2 +#define DBG_IOCLKES 3 +#define DBG_IOCMDQ 4 +#define DBG_IOMCURS 5 +#define DBG_IOMDESC 6 +#define DBG_IOPOWER 7 +#define DBG_IOSERVICE 8 +#define DBG_IOREGISTRY 9 +#define DBG_IOPORT 10 +#define DBG_IOSTORAGE 32 +#define DBG_IONETWORK 33 +#define DBG_IOKEYBOARD 34 +#define DBG_IOHID 35 +#define DBG_IOAUDIO 36 +#define DBG_IOSERIAL 37 +#define DBG_IOTTY 38 +#define DBG_IOSAM 39 +#define DBG_IOPARALLELATA 40 +#define DBG_IOPARALLELSCSI 41 +#define DBG_IOSATA 42 +#define DBG_IOSAS 43 +#define DBG_IOFIBRECHANNEL 44 +#define DBG_IOUSB 45 +#define DBG_IOBLUETOOTH 46 +#define DBG_IOFIREWIRE 47 +#define DBG_IOINFINIBAND 48 +#define DBG_IOCPUPM 49 +#define DBG_IOGRAPHICS 50 +#define DBG_HIBERNATE 51 +#define DBG_IOTHUNDERBOLT 52 +#define DBG_BOOTER 53 +#define DBG_IOAUDIO2 54 +#define DBG_IOAFK 55 +#define DBG_IOSURFACEPA 64 +#define DBG_IOMDPA 65 +#define DBG_IODARTPA 66 +#define DBG_DRVSTORAGE 1 +#define DBG_DRVNETWORK 2 +#define DBG_DRVKEYBOARD 3 +#define DBG_DRVHID 4 +#define DBG_DRVAUDIO 5 +#define DBG_DRVSERIAL 7 +#define DBG_DRVSAM 8 +#define DBG_DRVPARALLELATA 9 +#define DBG_DRVPARALLELSCSI 10 +#define DBG_DRVSATA 11 +#define DBG_DRVSAS 12 +#define DBG_DRVFIBRECHANNEL 13 +#define DBG_DRVUSB 14 +#define DBG_DRVBLUETOOTH 15 +#define DBG_DRVFIREWIRE 16 +#define DBG_DRVINFINIBAND 17 +#define DBG_DRVGRAPHICS 18 +#define DBG_DRVSD 19 +#define DBG_DRVNAND 20 +#define DBG_SSD 21 +#define DBG_DRVSPI 22 +#define DBG_DRVWLAN_802_11 23 +#define DBG_DRVSSM 24 +#define DBG_DRVSMC 25 +#define DBG_DRVMACEFIMANAGER 26 +#define DBG_DRVANE 27 +#define DBG_DRVETHERNET 28 +#define DBG_DRVMCC 29 +#define DBG_DRVACCESSORY 30 +#define DBG_SOCDIAGS 31 +#define DBG_DRVVIRTIO 32 +#define DBG_DRVCELLULAR 33 +#define DBG_DRVSPMI 34 +#define DBG_DLIL_STATIC 1 +#define DBG_DLIL_PR_MOD 2 +#define DBG_DLIL_IF_MOD 3 +#define DBG_DLIL_PR_FLT 4 +#define DBG_DLIL_IF_FLT 5 +#define DBG_FSRW 0x1 +#define DBG_DKRW 0x2 +#define DBG_FSVN 0x3 +#define DBG_FSLOOOKUP 0x4 +#define DBG_JOURNAL 0x5 +#define DBG_IOCTL 0x6 +#define DBG_BOOTCACHE 0x7 +#define DBG_HFS 0x8 +#define DBG_APFS 0x9 +#define DBG_SMB 0xA +#define DBG_MOUNT 0xB +#define DBG_EXFAT 0xE +#define DBG_MSDOS 0xF +#define DBG_ACFS 0x10 +#define DBG_THROTTLE 0x11 +#define DBG_DECMP 0x12 +#define DBG_VFS 0x13 +#define DBG_LIVEFS 0x14 +#define DBG_NFS 0x15 +#define DBG_CONTENT_PROT 0xCF +#define DBG_HFS_UPDATE_ACCTIME 0x01 +#define DBG_HFS_UPDATE_MODTIME 0x02 +#define DBG_HFS_UPDATE_CHGTIME 0x04 +#define DBG_HFS_UPDATE_MODIFIED 0x08 +#define DBG_HFS_UPDATE_FORCE 0x10 +#define DBG_HFS_UPDATE_DATEADDED 0x20 +#define DBG_HFS_UPDATE_MINOR 0x40 +#define DBG_HFS_UPDATE_SKIPPED 0x80 +#define DBG_VFS_IO_COMPRESSION_STATS 0x1000 +#define DBG_BSD_PROC 0x01 +#define DBG_BSD_MEMSTAT 0x02 +#define DBG_BSD_KEVENT 0x03 +#define DBG_BSD_EXCP_SC 0x0C +#define DBG_BSD_AIO 0x0D +#define DBG_BSD_SC_EXTENDED_INFO 0x0E +#define DBG_BSD_SC_EXTENDED_INFO2 0x0F +#define DBG_BSD_KDEBUG_TEST 0xFF +#define BSD_PROC_EXIT 1 +#define BSD_PROC_FRCEXIT 2 +#define BSD_PROC_EXEC 3 +#define BSD_PROC_EXITREASON_CREATE 4 +#define BSD_PROC_EXITREASON_COMMIT 5 +#define BSD_MEMSTAT_SCAN 1 +#define BSD_MEMSTAT_JETSAM 2 +#define BSD_MEMSTAT_JETSAM_HIWAT 3 +#define BSD_MEMSTAT_FREEZE 4 +#define BSD_MEMSTAT_FREEZE_SCAN 5 +#define BSD_MEMSTAT_UPDATE 6 +#define BSD_MEMSTAT_IDLE_DEMOTE 7 +#define BSD_MEMSTAT_CLEAR_ERRORS 8 +#define BSD_MEMSTAT_DIRTY_TRACK 9 +#define BSD_MEMSTAT_DIRTY_SET 10 +#define BSD_MEMSTAT_DIRTY_CLEAR 11 +#define BSD_MEMSTAT_FAST_JETSAM 15 +#define BSD_MEMSTAT_COMPACTOR_RUN 16 +#define BSD_MEMSTAT_FREEZE_DISABLE 17 +#define BSD_MEMSTAT_RELAUNCH_FLAGS 18 +#define BSD_KEVENT_KQ_PROCESS_BEGIN 1 +#define BSD_KEVENT_KQ_PROCESS_END 2 +#define BSD_KEVENT_KQWQ_PROCESS_BEGIN 3 +#define BSD_KEVENT_KQWQ_PROCESS_END 4 +#define BSD_KEVENT_KQWQ_BIND 5 +#define BSD_KEVENT_KQWQ_UNBIND 6 +#define BSD_KEVENT_KQWQ_THREQUEST 7 +#define BSD_KEVENT_KQWL_PROCESS_BEGIN 8 +#define BSD_KEVENT_KQWL_PROCESS_END 9 +#define BSD_KEVENT_KQWL_THREQUEST 10 +#define BSD_KEVENT_KQWL_THADJUST 11 +#define BSD_KEVENT_KQ_REGISTER 12 +#define BSD_KEVENT_KQWQ_REGISTER 13 +#define BSD_KEVENT_KQWL_REGISTER 14 +#define BSD_KEVENT_KNOTE_ACTIVATE 15 +#define BSD_KEVENT_KQ_PROCESS 16 +#define BSD_KEVENT_KQWQ_PROCESS 17 +#define BSD_KEVENT_KQWL_PROCESS 18 +#define BSD_KEVENT_KQWL_BIND 19 +#define BSD_KEVENT_KQWL_UNBIND 20 +#define BSD_KEVENT_KNOTE_ENABLE 21 +#define BSD_KEVENT_KNOTE_VANISHED 22 +#define DBG_TRACE_DATA 0 +#define DBG_TRACE_STRING 1 +#define DBG_TRACE_INFO 2 +#define DBG_CS_IO 0 +#define DBG_SEC_KERNEL 0 +#define DBG_SEC_SANDBOX 1 +#define DBG_MT_INSTRS_CYCLES 1 +#define DBG_MT_DEBUG 2 +#define DBG_MT_RESOURCES_PROC_EXIT 3 +#define DBG_MT_RESOURCES_THR_EXIT 4 +#define DBG_MT_INSTRS_CYCLES_ON_CPU 5 +#define DBG_MT_TMPTH 0xfe +#define DBG_MT_TMPCPU 0xff +#define DBG_MISC_COREBRIGHTNESS 0x01 +#define DBG_MISC_VIDEOENG 0x02 +#define DBG_EVENT 0x10 +#define DBG_MISC_INSTRUMENTS 0x11 +#define DBG_MISC_INSTRUMENTSBT 0x12 +#define DBG_MISC_RUNLOOP_DETAILS 0x13 +#define DBG_MISC_RUNLOOP_BUSY 0x14 +#define DBG_MISC_LAYOUT 0x1a +#define DBG_BUFFER 0x20 +#define DKIO_DONE 0x01 +#define DKIO_READ 0x02 +#define DKIO_ASYNC 0x04 +#define DKIO_META 0x08 +#define DKIO_PAGING 0x10 +#define DKIO_THROTTLE 0x20 +#define DKIO_PASSIVE 0x40 +#define DKIO_NOCACHE 0x80 +#define DKIO_TIER_MASK 0xF00 +#define DKIO_TIER_SHIFT 8 +#define DKIO_TIER_UPGRADE 0x1000 +#define DBG_APP_LOGINWINDOW 0x03 +#define DBG_APP_AUDIO 0x04 +#define DBG_APP_SYSTEMUI 0x05 +#define DBG_APP_SIGNPOST 0x0A +#define DBG_APP_TAL 0x0B +#define DBG_APP_APPKIT 0x0C +#define DBG_APP_UIKIT 0x0D +#define DBG_APP_DFR 0x0E +#define DBG_APP_LAYOUT 0x0F +#define DBG_APP_COREDATA 0x10 +#define DBG_APP_RUNLOOP_BASIC 0x11 +#define DBG_APP_RUNLOOP_ADVANCED 0x12 +#define DBG_APP_SAMBA 0x80 +#define DBG_APP_EOSSUPPORT 0x81 +#define DBG_APP_MACEFIMANAGER 0x82 +#define DBG_APP_ENTERPRISE 0x83 +#define OPEN_THROTTLE_WINDOW 0x1 +#define PROCESS_THROTTLED 0x2 +#define IO_THROTTLE_DISABLE 0x3 +#define IO_TIER_UPL_MISMATCH 0x4 +#define IMP_ASSERTION 0x10 +#define IMP_BOOST 0x11 +#define IMP_MSG 0x12 +#define IMP_WATCHPORT 0x13 +#define IMP_TASK_SUPPRESSION 0x17 +#define IMP_TASK_APPTYPE 0x18 +#define IMP_UPDATE 0x19 +#define IMP_USYNCH_QOS_OVERRIDE 0x1A +#define IMP_DONOR_CHANGE 0x1B +#define IMP_MAIN_THREAD_QOS 0x1C +#define IMP_SYNC_IPC_QOS 0x1D +#define IMP_TASK_POLICY_DARWIN_BG 0x21 +#define IMP_TASK_POLICY_IOPOL 0x22 +#define IMP_TASK_POLICY_IO 0x23 +#define IMP_TASK_POLICY_PASSIVE_IO 0x24 +#define IMP_TASK_POLICY_DARWIN_BG_IOPOL 0x27 +#define IMP_TASK_POLICY_BOOST 0x29 +#define IMP_TASK_POLICY_ROLE 0x2A +#define IMP_TASK_POLICY_TERMINATED 0x2C +#define IMP_TASK_POLICY_NEW_SOCKETS_BG 0x2D +#define IMP_TASK_POLICY_SUP_ACTIVE 0x2E +#define IMP_TASK_POLICY_LATENCY_QOS 0x2F +#define IMP_TASK_POLICY_THROUGH_QOS 0x30 +#define IMP_TASK_POLICY_WATCHERS_BG 0x31 +#define IMP_TASK_POLICY_SFI_MANAGED 0x34 +#define IMP_TASK_POLICY_ALL_SOCKETS_BG 0x37 +#define IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS 0x39 +#define IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS 0x3A +#define IMP_TASK_POLICY_PIDBIND_BG 0x32 +#define IMP_TASK_POLICY_QOS_OVERRIDE 0x36 +#define IMP_TASK_POLICY_QOS_AND_RELPRIO 0x38 +#define IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE 0x3B +#define IMP_TASK_POLICY_QOS_PROMOTE 0x3C +#define IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE 0x3D +#define IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE 0x3E +#define IMP_TASK_POLICY_IOTIER_KEVENT_OVERRIDE 0x3F +#define IMP_TASK_POLICY_WI_DRIVEN 0x40 +#define IMP_HOLD 0x2 +#define IMP_DROP 0x4 +#define IMP_EXTERN 0x8 +#define IMP_BOOSTED 0x1 +#define IMP_UNBOOSTED 0x2 +#define IMP_MSG_SEND 0x1 +#define IMP_MSG_DELV 0x2 +#define IMP_UPDATE_TASK_CREATE 0x1 +#define IMP_USYNCH_ADD_OVERRIDE 0x0 +#define IMP_USYNCH_REMOVE_OVERRIDE 0x1 +#define IMP_DONOR_UPDATE_LIVE_DONOR_STATE 0x0 +#define IMP_DONOR_INIT_DONOR_STATE 0x1 +#define IMP_SYNC_IPC_QOS_APPLIED 0x0 +#define IMP_SYNC_IPC_QOS_REMOVED 0x1 +#define IMP_SYNC_IPC_QOS_OVERFLOW 0x2 +#define IMP_SYNC_IPC_QOS_UNDERFLOW 0x3 +#define TURNSTILE_HEAP_OPERATIONS 0x10 +#define TURNSTILE_PRIORITY_OPERATIONS 0x20 +#define TURNSTILE_FREELIST_OPERATIONS 0x30 +#define THREAD_ADDED_TO_TURNSTILE_WAITQ 0x1 +#define THREAD_REMOVED_FROM_TURNSTILE_WAITQ 0x2 +#define THREAD_MOVED_IN_TURNSTILE_WAITQ 0x3 +#define TURNSTILE_ADDED_TO_TURNSTILE_HEAP 0x4 +#define TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP 0x5 +#define TURNSTILE_MOVED_IN_TURNSTILE_HEAP 0x6 +#define TURNSTILE_ADDED_TO_THREAD_HEAP 0x7 +#define TURNSTILE_REMOVED_FROM_THREAD_HEAP 0x8 +#define TURNSTILE_MOVED_IN_THREAD_HEAP 0x9 +#define TURNSTILE_UPDATE_STOPPED_BY_LIMIT 0xa +#define THREAD_NOT_WAITING_ON_TURNSTILE 0xb +#define TURNSTILE_PRIORITY_CHANGE 0x1 +#define THREAD_USER_PROMOTION_CHANGE 0x2 +#define TURNSTILE_PREPARE 0x1 +#define TURNSTILE_COMPLETE 0x2 +#define BANK_ACCOUNT_INFO 0x10 +#define BANK_TASK_INFO 0x11 +#define ATM_SUBAID_INFO 0x10 +#define ATM_GETVALUE_INFO 0x20 +#define ATM_UNREGISTER_INFO 0x30 +#define BANK_SETTLE_CPU_TIME 0x1 +#define BANK_SECURE_ORIGINATOR_CHANGED 0x2 +#define BANK_SETTLE_ENERGY 0x3 +#define ATM_MIN_CALLED 0x1 +#define ATM_LINK_LIST_TRIM 0x2 +#define ATM_VALUE_REPLACED 0x1 +#define ATM_VALUE_ADDED 0x2 +#define ATM_VALUE_UNREGISTERED 0x1 +#define ATM_VALUE_DIFF_MAILBOX 0x2 +#define DBG_DAEMON_COREDUET 0x1 +#define DBG_DAEMON_POWERD 0x2 +#define DBG_UMALLOC_EXTERNAL 0x1 +#define DBG_UMALLOC_INTERNAL 0x2 +#define BSD 199506 +#define BSD4_3 1 +#define BSD4_4 1 +#define NeXTBSD 1995064 +#define NeXTBSD4_0 0 +#define MAXCOMLEN 16 +#define MAXINTERP 64 +#define MAXLOGNAME 255 +#define NOFILE 256 +#define NOGROUP 65535 +#define MAXHOSTNAMELEN 256 +#define MAXDOMNAMELEN 256 +#define PSWP 0 +#define PVM 4 +#define PINOD 8 +#define PRIBIO 16 +#define PVFS 20 +#define PZERO 22 +#define PSOCK 24 +#define PWAIT 32 +#define PLOCK 36 +#define PPAUSE 40 +#define PUSER 50 +#define MAXPRI 127 +#define PRIMASK 0x0ff +#define PCATCH 0x100 +#define PTTYBLOCK 0x200 +#define PDROP 0x400 +#define PSPIN 0x800 +#define CMASK 0022 +#define CBLOCK 64 +#define MAXFRAG 8 +#define MAXSYMLINKS 32 +#define FSHIFT 11 +#define LF_NOT_BOOSTED 0 +#define LF_BOOSTED 1 +#define PSHMNAMLEN 31 +#define SHM_RDONLY 0010000 +#define SHM_RND 0020000 +#define SHMLBA 4096 +#define TIOCM_LE 00001 +#define TIOCM_DTR 00002 +#define TIOCM_RTS 00004 +#define TIOCM_ST 00010 +#define TIOCM_SR 00020 +#define TIOCM_CTS 00040 +#define TIOCM_CAR 00100 +#define TIOCM_RNG 00200 +#define TIOCM_DSR 00400 +#define TIOCPKT_DATA 0x00 +#define TIOCPKT_FLUSHREAD 0x01 +#define TIOCPKT_FLUSHWRITE 0x02 +#define TIOCPKT_STOP 0x04 +#define TIOCPKT_START 0x08 +#define TIOCPKT_NOSTOP 0x10 +#define TIOCPKT_DOSTOP 0x20 +#define TIOCPKT_IOCTL 0x40 +#define TTYDISC 0 +#define TABLDISC 3 +#define SLIPDISC 4 +#define PPPDISC 5 +#define CTL_MAXNAME 12 +#define CTLTYPE 0xf +#define CTLTYPE_NODE 1 +#define CTLTYPE_INT 2 +#define CTLTYPE_STRING 3 +#define CTLTYPE_QUAD 4 +#define CTLTYPE_OPAQUE 5 +#define CTLFLAG_RD 0x80000000 +#define CTLFLAG_WR 0x40000000 +#define CTLFLAG_NOLOCK 0x20000000 +#define CTLFLAG_ANYBODY 0x10000000 +#define CTLFLAG_SECURE 0x08000000 +#define CTLFLAG_MASKED 0x04000000 +#define CTLFLAG_NOAUTO 0x02000000 +#define CTLFLAG_KERN 0x01000000 +#define CTLFLAG_LOCKED 0x00800000 +#define CTLFLAG_OID2 0x00400000 +#define CTLFLAG_EXPERIMENT 0x00100000 +#define OID_AUTO_START 100 +#define SYSCTL_OID_VERSION 1 +#define SYSCTL_SKMEM 1 +#define CTL_UNSPEC 0 +#define CTL_KERN 1 +#define CTL_VM 2 +#define CTL_VFS 3 +#define CTL_NET 4 +#define CTL_DEBUG 5 +#define CTL_HW 6 +#define CTL_MACHDEP 7 +#define CTL_USER 8 +#define CTL_MAXID 9 +#define KERN_OSTYPE 1 +#define KERN_OSRELEASE 2 +#define KERN_OSREV 3 +#define KERN_VERSION 4 +#define KERN_MAXVNODES 5 +#define KERN_MAXPROC 6 +#define KERN_MAXFILES 7 +#define KERN_ARGMAX 8 +#define KERN_SECURELVL 9 +#define KERN_HOSTNAME 10 +#define KERN_HOSTID 11 +#define KERN_CLOCKRATE 12 +#define KERN_VNODE 13 +#define KERN_PROC 14 +#define KERN_FILE 15 +#define KERN_PROF 16 +#define KERN_POSIX1 17 +#define KERN_NGROUPS 18 +#define KERN_JOB_CONTROL 19 +#define KERN_SAVED_IDS 20 +#define KERN_BOOTTIME 21 +#define KERN_NISDOMAINNAME 22 +#define KERN_MAXPARTITIONS 23 +#define KERN_KDEBUG 24 +#define KERN_UPDATEINTERVAL 25 +#define KERN_OSRELDATE 26 +#define KERN_NTP_PLL 27 +#define KERN_BOOTFILE 28 +#define KERN_MAXFILESPERPROC 29 +#define KERN_MAXPROCPERUID 30 +#define KERN_DUMPDEV 31 +#define KERN_IPC 32 +#define KERN_DUMMY 33 +#define KERN_PS_STRINGS 34 +#define KERN_USRSTACK32 35 +#define KERN_LOGSIGEXIT 36 +#define KERN_SYMFILE 37 +#define KERN_PROCARGS 38 +#define KERN_NETBOOT 40 +#define KERN_SYSV 42 +#define KERN_AFFINITY 43 +#define KERN_TRANSLATE 44 +#define KERN_EXEC 45 +#define KERN_AIOMAX 46 +#define KERN_AIOPROCMAX 47 +#define KERN_AIOTHREADS 48 +#define KERN_PROCARGS2 49 +#define KERN_COREFILE 50 +#define KERN_COREDUMP 51 +#define KERN_SUGID_COREDUMP 52 +#define KERN_PROCDELAYTERM 53 +#define KERN_SHREG_PRIVATIZABLE 54 +#define KERN_LOW_PRI_WINDOW 56 +#define KERN_LOW_PRI_DELAY 57 +#define KERN_POSIX 58 +#define KERN_USRSTACK64 59 +#define KERN_NX_PROTECTION 60 +#define KERN_TFP 61 +#define KERN_PROCNAME 62 +#define KERN_THALTSTACK 63 +#define KERN_SPECULATIVE_READS 64 +#define KERN_OSVERSION 65 +#define KERN_SAFEBOOT 66 +#define KERN_RAGEVNODE 68 +#define KERN_TTY 69 +#define KERN_CHECKOPENEVT 70 +#define KERN_THREADNAME 71 +#define KERN_MAXID 72 +#define KERN_RAGE_PROC 1 +#define KERN_RAGE_THREAD 2 +#define KERN_UNRAGE_PROC 3 +#define KERN_UNRAGE_THREAD 4 +#define KERN_OPENEVT_PROC 1 +#define KERN_UNOPENEVT_PROC 2 +#define KERN_TFP_POLICY 1 +#define KERN_TFP_POLICY_DENY 0 +#define KERN_TFP_POLICY_DEFAULT 2 +#define KERN_KDEFLAGS 1 +#define KERN_KDDFLAGS 2 +#define KERN_KDENABLE 3 +#define KERN_KDSETBUF 4 +#define KERN_KDGETBUF 5 +#define KERN_KDSETUP 6 +#define KERN_KDREMOVE 7 +#define KERN_KDSETREG 8 +#define KERN_KDGETREG 9 +#define KERN_KDREADTR 10 +#define KERN_KDPIDTR 11 +#define KERN_KDTHRMAP 12 +#define KERN_KDPIDEX 14 +#define KERN_KDSETRTCDEC 15 +#define KERN_KDGETENTROPY 16 +#define KERN_KDWRITETR 17 +#define KERN_KDWRITEMAP 18 +#define KERN_KDTEST 19 +#define KERN_KDREADCURTHRMAP 21 +#define KERN_KDSET_TYPEFILTER 22 +#define KERN_KDBUFWAIT 23 +#define KERN_KDCPUMAP 24 +#define KERN_KDCPUMAP_EXT 25 +#define KERN_KDSET_EDM 26 +#define KERN_KDGET_EDM 27 +#define KERN_KDWRITETR_V3 28 +#define KERN_PROC_ALL 0 +#define KERN_PROC_PID 1 +#define KERN_PROC_PGRP 2 +#define KERN_PROC_SESSION 3 +#define KERN_PROC_TTY 4 +#define KERN_PROC_UID 5 +#define KERN_PROC_RUID 6 +#define KERN_PROC_LCID 7 +#define KERN_VFSNSPACE_HANDLE_PROC 1 +#define KERN_VFSNSPACE_UNHANDLE_PROC 2 +#define KIPC_MAXSOCKBUF 1 +#define KIPC_SOCKBUF_WASTE 2 +#define KIPC_SOMAXCONN 3 +#define KIPC_MAX_LINKHDR 4 +#define KIPC_MAX_PROTOHDR 5 +#define KIPC_MAX_HDR 6 +#define KIPC_MAX_DATALEN 7 +#define KIPC_MBSTAT 8 +#define KIPC_NMBCLUSTERS 9 +#define KIPC_SOQLIMITCOMPAT 10 +#define VM_METER 1 +#define VM_LOADAVG 2 +#define VM_MACHFACTOR 4 +#define VM_SWAPUSAGE 5 +#define VM_MAXID 6 +#define LSCALE 1000 +#define HW_MACHINE 1 +#define HW_MODEL 2 +#define HW_NCPU 3 +#define HW_BYTEORDER 4 +#define HW_PHYSMEM 5 +#define HW_USERMEM 6 +#define HW_PAGESIZE 7 +#define HW_DISKNAMES 8 +#define HW_DISKSTATS 9 +#define HW_EPOCH 10 +#define HW_FLOATINGPT 11 +#define HW_MACHINE_ARCH 12 +#define HW_VECTORUNIT 13 +#define HW_BUS_FREQ 14 +#define HW_CPU_FREQ 15 +#define HW_CACHELINE 16 +#define HW_L1ICACHESIZE 17 +#define HW_L1DCACHESIZE 18 +#define HW_L2SETTINGS 19 +#define HW_L2CACHESIZE 20 +#define HW_L3SETTINGS 21 +#define HW_L3CACHESIZE 22 +#define HW_TB_FREQ 23 +#define HW_MEMSIZE 24 +#define HW_AVAILCPU 25 +#define HW_TARGET 26 +#define HW_PRODUCT 27 +#define HW_MAXID 28 +#define USER_CS_PATH 1 +#define USER_BC_BASE_MAX 2 +#define USER_BC_DIM_MAX 3 +#define USER_BC_SCALE_MAX 4 +#define USER_BC_STRING_MAX 5 +#define USER_COLL_WEIGHTS_MAX 6 +#define USER_EXPR_NEST_MAX 7 +#define USER_LINE_MAX 8 +#define USER_RE_DUP_MAX 9 +#define USER_POSIX2_VERSION 10 +#define USER_POSIX2_C_BIND 11 +#define USER_POSIX2_C_DEV 12 +#define USER_POSIX2_CHAR_TERM 13 +#define USER_POSIX2_FORT_DEV 14 +#define USER_POSIX2_FORT_RUN 15 +#define USER_POSIX2_LOCALEDEF 16 +#define USER_POSIX2_SW_DEV 17 +#define USER_POSIX2_UPE 18 +#define USER_STREAM_MAX 19 +#define USER_TZNAME_MAX 20 +#define USER_MAXID 21 +#define CTL_DEBUG_NAME 0 +#define CTL_DEBUG_VALUE 1 +#define CTL_DEBUG_MAXID 20 +#define UTF_REVERSE_ENDIAN 0x0001 +#define UTF_NO_NULL_TERM 0x0002 +#define UTF_DECOMPOSED 0x0004 +#define UTF_PRECOMPOSED 0x0008 +#define UTF_ESCAPE_ILLEGAL 0x0010 +#define UTF_SFM_CONVERSIONS 0x0020 +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 +#define PRIO_DARWIN_THREAD 3 +#define PRIO_DARWIN_PROCESS 4 +#define PRIO_MAX 20 +#define PRIO_DARWIN_BG 0x1000 +#define PRIO_DARWIN_NONUI 0x1001 +#define RUSAGE_SELF 0 +#define RUSAGE_INFO_V0 0 +#define RUSAGE_INFO_V1 1 +#define RUSAGE_INFO_V2 2 +#define RUSAGE_INFO_V3 3 +#define RUSAGE_INFO_V4 4 +#define RUSAGE_INFO_V5 5 +#define RUSAGE_INFO_V6 6 +#define RU_PROC_RUNS_RESLIDE 0x00000001 +#define RLIMIT_CPU 0 +#define RLIMIT_FSIZE 1 +#define RLIMIT_DATA 2 +#define RLIMIT_STACK 3 +#define RLIMIT_CORE 4 +#define RLIMIT_AS 5 +#define RLIMIT_MEMLOCK 6 +#define RLIMIT_NPROC 7 +#define RLIMIT_NOFILE 8 +#define RLIM_NLIMITS 9 +#define _RLIMIT_POSIX_FLAG 0x1000 +#define RLIMIT_WAKEUPS_MONITOR 0x1 +#define RLIMIT_CPU_USAGE_MONITOR 0x2 +#define RLIMIT_THREAD_CPULIMITS 0x3 +#define RLIMIT_FOOTPRINT_INTERVAL 0x4 +#define WAKEMON_ENABLE 0x01 +#define WAKEMON_DISABLE 0x02 +#define WAKEMON_GET_PARAMS 0x04 +#define WAKEMON_SET_DEFAULTS 0x08 +#define WAKEMON_MAKE_FATAL 0x10 +#define CPUMON_MAKE_FATAL 0x1000 +#define FOOTPRINT_INTERVAL_RESET 0x1 +#define IOPOL_TYPE_DISK 0 +#define IOPOL_TYPE_VFS_ATIME_UPDATES 2 +#define IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES 3 +#define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4 +#define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5 +#define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6 +#define IOPOL_TYPE_VFS_IGNORE_PERMISSIONS 7 +#define IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE 8 +#define IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES 9 +#define IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY 10 +#define IOPOL_SCOPE_PROCESS 0 +#define IOPOL_SCOPE_THREAD 1 +#define IOPOL_SCOPE_DARWIN_BG 2 +#define IOPOL_DEFAULT 0 +#define IOPOL_IMPORTANT 1 +#define IOPOL_PASSIVE 2 +#define IOPOL_THROTTLE 3 +#define IOPOL_UTILITY 4 +#define IOPOL_STANDARD 5 +#define IOPOL_ATIME_UPDATES_DEFAULT 0 +#define IOPOL_ATIME_UPDATES_OFF 1 +#define IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT 0 +#define IOPOL_MATERIALIZE_DATALESS_FILES_OFF 1 +#define IOPOL_MATERIALIZE_DATALESS_FILES_ON 2 +#define IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT 0 +#define IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME 1 +#define IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT 0 +#define IOPOL_VFS_TRIGGER_RESOLVE_OFF 1 +#define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0 +#define IOPOL_VFS_CONTENT_PROTECTION_IGNORE 1 +#define IOPOL_VFS_IGNORE_PERMISSIONS_OFF 0 +#define IOPOL_VFS_IGNORE_PERMISSIONS_ON 1 +#define IOPOL_VFS_SKIP_MTIME_UPDATE_OFF 0 +#define IOPOL_VFS_SKIP_MTIME_UPDATE_ON 1 +#define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF 0 +#define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON 1 +#define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT 0 +#define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON 1 +#define IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT 0 +#define IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON 1 +#define IOCPARM_MASK 0x1fff +#define XATTR_NOFOLLOW 0x0001 +#define XATTR_CREATE 0x0002 +#define XATTR_REPLACE 0x0004 +#define XATTR_NOSECURITY 0x0008 +#define XATTR_NODEFAULT 0x0010 +#define XATTR_SHOWCOMPRESSION 0x0020 +#define XATTR_MAXNAMELEN 127 +#define PR_SLOWHZ 2 +#define PRC_IFDOWN 0 +#define PRC_ROUTEDEAD 1 +#define PRC_IFUP 2 +#define PRC_QUENCH2 3 +#define PRC_QUENCH 4 +#define PRC_MSGSIZE 5 +#define PRC_HOSTDEAD 6 +#define PRC_HOSTUNREACH 7 +#define PRC_UNREACH_NET 8 +#define PRC_UNREACH_HOST 9 +#define PRC_UNREACH_PROTOCOL 10 +#define PRC_UNREACH_PORT 11 +#define PRC_UNREACH_SRCFAIL 13 +#define PRC_REDIRECT_NET 14 +#define PRC_REDIRECT_HOST 15 +#define PRC_REDIRECT_TOSNET 16 +#define PRC_REDIRECT_TOSHOST 17 +#define PRC_TIMXCEED_INTRANS 18 +#define PRC_TIMXCEED_REASS 19 +#define PRC_PARAMPROB 20 +#define PRC_UNREACH_ADMIN_PROHIB 21 +#define PRC_NCMDS 22 +#define KEV_CTL_SUBCLASS 2 +#define KEV_CTL_REGISTERED 1 +#define KEV_CTL_DEREGISTERED 2 +#define MAX_KCTL_NAME 96 +#define CTL_FLAG_PRIVILEGED 0x1 +#define CTL_FLAG_REG_ID_UNIT 0x2 +#define CTL_FLAG_REG_SOCK_STREAM 0x4 +#define CTL_DATA_NOWAKEUP 0x1 +#define CTL_DATA_EOR 0x2 +#define __DARWIN_ONLY_64_BIT_INO_T 0 +#define __DARWIN_ONLY_UNIX_CONFORMANCE 0 +#define __DARWIN_ONLY_VERS_1050 0 +#define __STDC_WANT_LIB_EXT1__ 1 +#define __DARWIN_NO_LONG_LONG 0 +#define _DARWIN_FEATURE_64_BIT_INODE 1 +#define _DARWIN_FEATURE_ONLY_64_BIT_INODE 1 +#define _DARWIN_FEATURE_ONLY_VERS_1050 1 +#define _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE 1 +#define _DARWIN_FEATURE_UNIX_CONFORMANCE 3 +#define __has_ptrcheck 0 +#define MAXMAXPARTITIONS 22 +#define NDDATA 5 +#define NSPARE 5 +#define DTYPE_SMD 1 +#define DTYPE_MSCP 2 +#define DTYPE_DEC 3 +#define DTYPE_SCSI 4 +#define DTYPE_ESDI 5 +#define DTYPE_ST506 6 +#define DTYPE_HPIB 7 +#define DTYPE_HPFL 8 +#define DTYPE_FLOPPY 10 +#define FS_UNUSED 0 +#define FS_SWAP 1 +#define FS_V6 2 +#define FS_V7 3 +#define FS_SYSV 4 +#define FS_V71K 5 +#define FS_V8 6 +#define FS_BSDFFS 7 +#define FS_MSDOS 8 +#define FS_BSDLFS 9 +#define FS_OTHER 10 +#define FS_HPFS 11 +#define FS_ISO9660 12 +#define FS_BOOT 13 +#define FS_ADOS 14 +#define FS_HFS 15 +#define D_REMOVABLE 0x01 +#define D_ECC 0x02 +#define D_BADSECT 0x04 +#define D_RAMDISK 0x08 +#define D_CHAIN 0x10 +#define D_SSE 0x1 +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EDEADLK 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EAGAIN 35 +#define EINPROGRESS 36 +#define EALREADY 37 +#define ENOTSOCK 38 +#define EDESTADDRREQ 39 +#define EMSGSIZE 40 +#define EPROTOTYPE 41 +#define ENOPROTOOPT 42 +#define EPROTONOSUPPORT 43 +#define ESOCKTNOSUPPORT 44 +#define ENOTSUP 45 +#define EPFNOSUPPORT 46 +#define EAFNOSUPPORT 47 +#define EADDRINUSE 48 +#define EADDRNOTAVAIL 49 +#define ENETDOWN 50 +#define ENETUNREACH 51 +#define ENETRESET 52 +#define ECONNABORTED 53 +#define ECONNRESET 54 +#define ENOBUFS 55 +#define EISCONN 56 +#define ENOTCONN 57 +#define ESHUTDOWN 58 +#define ETOOMANYREFS 59 +#define ETIMEDOUT 60 +#define ECONNREFUSED 61 +#define ELOOP 62 +#define ENAMETOOLONG 63 +#define EHOSTDOWN 64 +#define EHOSTUNREACH 65 +#define ENOTEMPTY 66 +#define EPROCLIM 67 +#define EUSERS 68 +#define EDQUOT 69 +#define ESTALE 70 +#define EREMOTE 71 +#define EBADRPC 72 +#define ERPCMISMATCH 73 +#define EPROGUNAVAIL 74 +#define EPROGMISMATCH 75 +#define EPROCUNAVAIL 76 +#define ENOLCK 77 +#define ENOSYS 78 +#define EFTYPE 79 +#define EAUTH 80 +#define ENEEDAUTH 81 +#define EPWROFF 82 +#define EDEVERR 83 +#define EOVERFLOW 84 +#define EBADEXEC 85 +#define EBADARCH 86 +#define ESHLIBVERS 87 +#define EBADMACHO 88 +#define ECANCELED 89 +#define EIDRM 90 +#define ENOMSG 91 +#define EILSEQ 92 +#define ENOATTR 93 +#define EBADMSG 94 +#define EMULTIHOP 95 +#define ENODATA 96 +#define ENOLINK 97 +#define ENOSR 98 +#define ENOSTR 99 +#define EPROTO 100 +#define ETIME 101 +#define EOPNOTSUPP 102 +#define ENOPOLICY 103 +#define ENOTRECOVERABLE 104 +#define EOWNERDEAD 105 +#define EQFULL 106 +#define ELAST 106 +#define VEOF 0 +#define VEOL 1 +#define VEOL2 2 +#define VERASE 3 +#define VWERASE 4 +#define VKILL 5 +#define VREPRINT 6 +#define VINTR 8 +#define VQUIT 9 +#define VSUSP 10 +#define VDSUSP 11 +#define VSTART 12 +#define VSTOP 13 +#define VLNEXT 14 +#define VDISCARD 15 +#define VMIN 16 +#define VTIME 17 +#define VSTATUS 18 +#define NCCS 20 +#define IGNBRK 0x00000001 +#define BRKINT 0x00000002 +#define IGNPAR 0x00000004 +#define PARMRK 0x00000008 +#define INPCK 0x00000010 +#define ISTRIP 0x00000020 +#define INLCR 0x00000040 +#define IGNCR 0x00000080 +#define ICRNL 0x00000100 +#define IXON 0x00000200 +#define IXOFF 0x00000400 +#define IXANY 0x00000800 +#define IMAXBEL 0x00002000 +#define IUTF8 0x00004000 +#define OPOST 0x00000001 +#define ONLCR 0x00000002 +#define OXTABS 0x00000004 +#define ONOEOT 0x00000008 +#define OCRNL 0x00000010 +#define ONOCR 0x00000020 +#define ONLRET 0x00000040 +#define OFILL 0x00000080 +#define NLDLY 0x00000300 +#define TABDLY 0x00000c04 +#define CRDLY 0x00003000 +#define FFDLY 0x00004000 +#define BSDLY 0x00008000 +#define VTDLY 0x00010000 +#define OFDEL 0x00020000 +#define TAB3 0x00000004 +#define VT0 0x00000000 +#define VT1 0x00010000 +#define CIGNORE 0x00000001 +#define CSIZE 0x00000300 +#define CS5 0x00000000 +#define CS6 0x00000100 +#define CS7 0x00000200 +#define CS8 0x00000300 +#define CSTOPB 0x00000400 +#define CREAD 0x00000800 +#define PARENB 0x00001000 +#define PARODD 0x00002000 +#define HUPCL 0x00004000 +#define CLOCAL 0x00008000 +#define CCTS_OFLOW 0x00010000 +#define CRTS_IFLOW 0x00020000 +#define CDTR_IFLOW 0x00040000 +#define CDSR_OFLOW 0x00080000 +#define CCAR_OFLOW 0x00100000 +#define ECHOKE 0x00000001 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define ECHOPRT 0x00000020 +#define ECHOCTL 0x00000040 +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#define ALTWERASE 0x00000200 +#define IEXTEN 0x00000400 +#define EXTPROC 0x00000800 +#define NOKERNINFO 0x02000000 +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 +#define TCSASOFT 0x10 +#define B0 0 +#define B50 50 +#define B75 75 +#define B110 110 +#define B134 134 +#define B150 150 +#define B200 200 +#define B300 300 +#define B600 600 +#define B1200 1200 +#define B1800 1800 +#define B2400 2400 +#define B4800 4800 +#define B9600 9600 +#define B19200 19200 +#define B38400 38400 +#define B7200 7200 +#define B14400 14400 +#define B28800 28800 +#define B57600 57600 +#define B76800 76800 +#define B115200 115200 +#define B230400 230400 +#define EXTA 19200 +#define EXTB 38400 +#define RENAME_SECLUDE 0x00000001 +#define RENAME_SWAP 0x00000002 +#define RENAME_EXCL 0x00000004 +#define RENAME_RESERVED1 0x00000008 +#define RENAME_NOFOLLOW_ANY 0x00000010 +#define MFSNAMELEN 15 +#define MFSTYPENAMELEN 16 +#define MNAMELEN 90 +#define MNT_EXT_ROOT_DATA_VOL 0x00000001 +#define MNT_EXT_FSKIT 0x00000002 +#define MNT_RDONLY 0x00000001 +#define MNT_SYNCHRONOUS 0x00000002 +#define MNT_NOEXEC 0x00000004 +#define MNT_NOSUID 0x00000008 +#define MNT_NODEV 0x00000010 +#define MNT_UNION 0x00000020 +#define MNT_ASYNC 0x00000040 +#define MNT_CPROTECT 0x00000080 +#define MNT_EXPORTED 0x00000100 +#define MNT_REMOVABLE 0x00000200 +#define MNT_QUARANTINE 0x00000400 +#define MNT_LOCAL 0x00001000 +#define MNT_QUOTA 0x00002000 +#define MNT_ROOTFS 0x00004000 +#define MNT_DOVOLFS 0x00008000 +#define MNT_DONTBROWSE 0x00100000 +#define MNT_IGNORE_OWNERSHIP 0x00200000 +#define MNT_AUTOMOUNTED 0x00400000 +#define MNT_JOURNALED 0x00800000 +#define MNT_NOUSERXATTR 0x01000000 +#define MNT_DEFWRITE 0x02000000 +#define MNT_MULTILABEL 0x04000000 +#define MNT_NOFOLLOW 0x08000000 +#define MNT_NOATIME 0x10000000 +#define MNT_SNAPSHOT 0x40000000 +#define MNT_STRICTATIME 0x80000000 +#define MNT_UPDATE 0x00010000 +#define MNT_NOBLOCK 0x00020000 +#define MNT_RELOAD 0x00040000 +#define MNT_FORCE 0x00080000 +#define VFS_GENERIC 0 +#define VFS_NUMMNTOPS 1 +#define VFS_MAXTYPENUM 1 +#define VFS_CONF 2 +#define MNT_WAIT 1 +#define MNT_NOWAIT 2 +#define MNT_DWAIT 4 +#define MNT_VOLUME 8 +#define VFS_CTL_VERS1 0x01 +#define VFS_CTL_OSTATFS 0x00010001 +#define VFS_CTL_UMOUNT 0x00010002 +#define VFS_CTL_QUERY 0x00010003 +#define VFS_CTL_NEWADDR 0x00010004 +#define VFS_CTL_TIMEO 0x00010005 +#define VFS_CTL_NOLOCKS 0x00010006 +#define VFS_CTL_SADDR 0x00010007 +#define VFS_CTL_DISC 0x00010008 +#define VFS_CTL_SERVERINFO 0x00010009 +#define VFS_CTL_NSTATUS 0x0001000A +#define VFS_CTL_STATFS64 0x0001000B +#define VQ_NOTRESP 0x0001 +#define VQ_NEEDAUTH 0x0002 +#define VQ_LOWDISK 0x0004 +#define VQ_MOUNT 0x0008 +#define VQ_UNMOUNT 0x0010 +#define VQ_DEAD 0x0020 +#define VQ_ASSIST 0x0040 +#define VQ_NOTRESPLOCK 0x0080 +#define VQ_UPDATE 0x0100 +#define VQ_VERYLOWDISK 0x0200 +#define VQ_SYNCEVENT 0x0400 +#define VQ_SERVEREVENT 0x0800 +#define VQ_QUOTA 0x1000 +#define VQ_NEARLOWDISK 0x2000 +#define VQ_DESIRED_DISK 0x4000 +#define VQ_FREE_SPACE_CHANGE 0x8000 +#define VQ_FLAG10000 0x10000 +#define VFS_IOATTR_FLAGS_FUA 0x00000001 +#define VFS_IOATTR_FLAGS_UNMAP 0x00000002 +#define VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED 0x00000010 +#define VFS_TBLTHREADSAFE 0x0001 +#define VFS_TBLFSNODELOCK 0x0002 +#define VFS_TBLNOTYPENUM 0x0008 +#define VFS_TBLLOCALVOL 0x0010 +#define VFS_TBL64BITREADY 0x0020 +#define VFS_TBLNATIVEXATTR 0x0040 +#define VFS_TBLDIRLINKS 0x0080 +#define VFS_TBLUNMOUNT_PREFLIGHT 0x0100 +#define VFS_TBLGENERICMNTARGS 0x0200 +#define VFS_TBLREADDIR_EXTENDED 0x0400 +#define VFS_TBLNOMACLABEL 0x1000 +#define VFS_TBLVNOP_PAGEINV2 0x2000 +#define VFS_TBLVNOP_PAGEOUTV2 0x4000 +#define VFS_TBLVNOP_NOUPDATEID_RENAME 0x8000 +#define VFS_TBLVNOP_SECLUDE_RENAME 0x10000 +#define VFS_TBLCANMOUNTROOT 0x20000 +#define VFSIOC_MOUNT_BYROLE_has_recovery 1 +#define VFS_RETURNED 0 +#define VFS_RETURNED_DONE 1 +#define VFS_CLAIMED 2 +#define VFS_CLAIMED_DONE 3 +#define VFS_USER_EVENT 0 +#define VFS_KERNEL_EVENT 1 +#define LK_NOWAIT 1 +#define NFSV4_MAX_FH_SIZE 128 +#define NFSV3_MAX_FH_SIZE 64 +#define NFSV2_MAX_FH_SIZE 32 +#define CRYPTEX_AUTH_STRUCT_VERSION 1 +#define EV_FD 1 +#define EV_RE 1 +#define EV_WR 2 +#define EV_EX 4 +#define EV_RM 8 +#define EV_MASK 0xf +#define EV_RBYTES 0x100 +#define EV_WBYTES 0x200 +#define EV_RCLOSED 0x400 +#define EV_RCONN 0x800 +#define EV_WCLOSED 0x1000 +#define EV_WCONN 0x2000 +#define EV_OOB 0x4000 +#define EV_FIN 0x8000 +#define EV_RESET 0x10000 +#define EV_TIMEOUT 0x20000 +#define EV_DMASK 0xffffff00 +#define KDEBUG_LEVEL_NONE 0 +#define KDEBUG_LEVEL_IST 1 +#define KDEBUG_LEVEL_STANDARD 2 +#define KDEBUG_LEVEL_FULL 3 +#define KDBG_FLAG_FILTERED 0x01 +#define KDBG_FLAG_NOPROCFILT 0x02 +#define __DARWIN_NULL 0 +#define UBC_PUSHDIRTY 0x01 +#define UBC_PUSHALL 0x02 +#define UBC_INVALIDATE 0x04 +#define UBC_SYNC 0x08 +#define KAUTH_NTSID_MAX_AUTHORITIES 16 +#define KAUTH_EXTLOOKUP_SUCCESS 0 +#define KAUTH_EXTLOOKUP_BADRQ 1 +#define KAUTH_EXTLOOKUP_FAILURE 2 +#define KAUTH_EXTLOOKUP_FATAL 3 +#define KAUTH_EXTLOOKUP_INPROG 100 +#define KAUTH_ACE_KINDMASK 0xf +#define KAUTH_ACE_PERMIT 1 +#define KAUTH_ACE_DENY 2 +#define KAUTH_ACE_AUDIT 3 +#define KAUTH_ACE_ALARM 4 +#define KAUTH_ACL_MAX_ENTRIES 128 +#define KAUTH_FILESEC_MAGIC 0x012cc16d +#define KAUTH_ENDIAN_HOST 0x00000001 +#define KAUTH_ENDIAN_DISK 0x00000002 +#define KAUTH_GENERIC_ISSUSER 1 +#define KAUTH_PROCESS_CANSIGNAL 1 +#define KAUTH_PROCESS_CANTRACE 2 +#define KAUTH_FILEOP_OPEN 1 +#define KAUTH_FILEOP_CLOSE 2 +#define KAUTH_FILEOP_RENAME 3 +#define KAUTH_FILEOP_EXCHANGE 4 +#define KAUTH_FILEOP_LINK 5 +#define KAUTH_FILEOP_EXEC 6 +#define KAUTH_FILEOP_DELETE 7 +#define KAUTH_FILEOP_WILL_RENAME 8 +#define DBG_PPT 36 +#define DBG_PERFCTRL 39 +#define DBG_CLPC 50 +#define DBG_MUSE 52 +#define DBG_ANS 128 +#define DBG_SIO 129 +#define DBG_SEP 130 +#define DBG_ISP 131 +#define DBG_OSCAR 132 +#define DBG_EMBEDDEDGFX 133 +#define DBG_PMP 134 +#define DBG_RTKIT 135 +#define DBG_DCP 136 +#define DBG_KMP 137 +#define DBG_SKYWALK_ALWAYSON 0x10 +#define DBG_SKYWALK_FLOWSWITCH 0x11 +#define DBG_SKYWALK_NETIF 0x12 +#define DBG_SKYWALK_CHANNEL 0x13 +#define DBG_SKYWALK_PACKET 0x14 +#define DBG_AQM_ALWAYSON 0x30 +#define DBG_AQM_STATS 0x31 +#define PPT_TEST 0x01 +#define PPT_JETSAM_HIWAT 0x02 +#define PPT_JETSAM_TOPPROC 0x03 +#define DBG_SEC_SSMA 0x02 +#define KDBG_CPU_SHIFT 56 +#define KDBG_INIT 0x01 +#define KDBG_FREERUN 0x04 +#define KDBG_CPUMAP_IS_IOP 0x1 +#define KDEBUG_COMMPAGE_ENABLE_TRACE 0x1 +#define KDEBUG_COMMPAGE_ENABLE_TYPEFILTER 0x2 +#define KDEBUG_COMMPAGE_CONTINUOUS 0x4 +#define KDBG_LOCKINIT 0x0080 +#define KDBG_CLASSTYPE 0x10000 +#define KDBG_SUBCLSTYPE 0x20000 +#define KDBG_RANGETYPE 0x40000 +#define KDBG_TYPENONE 0x80000 +#define KDBG_CKTYPES 0xF0000 +#define RAW_VERSION0 0x55aa0000 +#define RAW_VERSION1 0x55aa0101 +#define RAW_VERSION2 0x55aa0200 +#define kEnTrCompKernel 2 +#define kEnTrActKernSocket 1 +#define kEnTrActKernSockRead 2 +#define kEnTrActKernSockWrite 3 +#define kEnTrActKernPoll 10 +#define kEnTrActKernSelect 11 +#define kEnTrActKernKQWait 12 +#define kEnTrEvUnblocked 256 +#define kEnTrFlagNonBlocking 0x1 +#define kEnTrFlagNoWork 0x2 +#define ENTR_SHOULDTRACE 0 +#define SYS_syscall 0 +#define SYS_exit 1 +#define SYS_fork 2 +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_wait4 7 +#define SYS_link 9 +#define SYS_unlink 10 +#define SYS_chdir 12 +#define SYS_fchdir 13 +#define SYS_mknod 14 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_getfsstat 18 +#define SYS_getpid 20 +#define SYS_setuid 23 +#define SYS_getuid 24 +#define SYS_geteuid 25 +#define SYS_ptrace 26 +#define SYS_recvmsg 27 +#define SYS_sendmsg 28 +#define SYS_recvfrom 29 +#define SYS_accept 30 +#define SYS_getpeername 31 +#define SYS_getsockname 32 +#define SYS_access 33 +#define SYS_chflags 34 +#define SYS_fchflags 35 +#define SYS_sync 36 +#define SYS_kill 37 +#define SYS_crossarch_trap 38 +#define SYS_getppid 39 +#define SYS_dup 41 +#define SYS_pipe 42 +#define SYS_getegid 43 +#define SYS_sigaction 46 +#define SYS_getgid 47 +#define SYS_sigprocmask 48 +#define SYS_getlogin 49 +#define SYS_setlogin 50 +#define SYS_acct 51 +#define SYS_sigpending 52 +#define SYS_sigaltstack 53 +#define SYS_ioctl 54 +#define SYS_reboot 55 +#define SYS_revoke 56 +#define SYS_symlink 57 +#define SYS_readlink 58 +#define SYS_execve 59 +#define SYS_umask 60 +#define SYS_chroot 61 +#define SYS_msync 65 +#define SYS_vfork 66 +#define SYS_munmap 73 +#define SYS_mprotect 74 +#define SYS_madvise 75 +#define SYS_mincore 78 +#define SYS_getgroups 79 +#define SYS_setgroups 80 +#define SYS_getpgrp 81 +#define SYS_setpgid 82 +#define SYS_setitimer 83 +#define SYS_swapon 85 +#define SYS_getitimer 86 +#define SYS_getdtablesize 89 +#define SYS_dup2 90 +#define SYS_fcntl 92 +#define SYS_select 93 +#define SYS_fsync 95 +#define SYS_setpriority 96 +#define SYS_socket 97 +#define SYS_connect 98 +#define SYS_getpriority 100 +#define SYS_bind 104 +#define SYS_setsockopt 105 +#define SYS_listen 106 +#define SYS_sigsuspend 111 +#define SYS_gettimeofday 116 +#define SYS_getrusage 117 +#define SYS_getsockopt 118 +#define SYS_readv 120 +#define SYS_writev 121 +#define SYS_settimeofday 122 +#define SYS_fchown 123 +#define SYS_fchmod 124 +#define SYS_setreuid 126 +#define SYS_setregid 127 +#define SYS_rename 128 +#define SYS_flock 131 +#define SYS_mkfifo 132 +#define SYS_sendto 133 +#define SYS_shutdown 134 +#define SYS_socketpair 135 +#define SYS_mkdir 136 +#define SYS_rmdir 137 +#define SYS_utimes 138 +#define SYS_futimes 139 +#define SYS_adjtime 140 +#define SYS_gethostuuid 142 +#define SYS_setsid 147 +#define SYS_getpgid 151 +#define SYS_setprivexec 152 +#define SYS_pread 153 +#define SYS_pwrite 154 +#define SYS_nfssvc 155 +#define SYS_statfs 157 +#define SYS_fstatfs 158 +#define SYS_unmount 159 +#define SYS_getfh 161 +#define SYS_quotactl 165 +#define SYS_mount 167 +#define SYS_csops 169 +#define SYS_csops_audittoken 170 +#define SYS_waitid 173 +#define SYS_kdebug_typefilter 177 +#define SYS_kdebug_trace_string 178 +#define SYS_kdebug_trace64 179 +#define SYS_kdebug_trace 180 +#define SYS_setgid 181 +#define SYS_setegid 182 +#define SYS_seteuid 183 +#define SYS_sigreturn 184 +#define SYS_panic_with_data 185 +#define SYS_thread_selfcounts 186 +#define SYS_fdatasync 187 +#define SYS_stat 188 +#define SYS_fstat 189 +#define SYS_lstat 190 +#define SYS_pathconf 191 +#define SYS_fpathconf 192 +#define SYS_getrlimit 194 +#define SYS_setrlimit 195 +#define SYS_getdirentries 196 +#define SYS_mmap 197 +#define SYS_lseek 199 +#define SYS_truncate 200 +#define SYS_ftruncate 201 +#define SYS_sysctl 202 +#define SYS_mlock 203 +#define SYS_munlock 204 +#define SYS_undelete 205 +#define SYS_open_dprotected_np 216 +#define SYS_fsgetpath_ext 217 +#define SYS_openat_dprotected_np 218 +#define SYS_getattrlist 220 +#define SYS_setattrlist 221 +#define SYS_getdirentriesattr 222 +#define SYS_exchangedata 223 +#define SYS_searchfs 225 +#define SYS_delete 226 +#define SYS_copyfile 227 +#define SYS_fgetattrlist 228 +#define SYS_fsetattrlist 229 +#define SYS_poll 230 +#define SYS_getxattr 234 +#define SYS_fgetxattr 235 +#define SYS_setxattr 236 +#define SYS_fsetxattr 237 +#define SYS_removexattr 238 +#define SYS_fremovexattr 239 +#define SYS_listxattr 240 +#define SYS_flistxattr 241 +#define SYS_fsctl 242 +#define SYS_initgroups 243 +#define SYS_posix_spawn 244 +#define SYS_ffsctl 245 +#define SYS_fhopen 248 +#define SYS_minherit 250 +#define SYS_semsys 251 +#define SYS_msgsys 252 +#define SYS_shmsys 253 +#define SYS_semctl 254 +#define SYS_semget 255 +#define SYS_semop 256 +#define SYS_msgctl 258 +#define SYS_msgget 259 +#define SYS_msgsnd 260 +#define SYS_msgrcv 261 +#define SYS_shmat 262 +#define SYS_shmctl 263 +#define SYS_shmdt 264 +#define SYS_shmget 265 +#define SYS_shm_open 266 +#define SYS_shm_unlink 267 +#define SYS_sem_open 268 +#define SYS_sem_close 269 +#define SYS_sem_unlink 270 +#define SYS_sem_wait 271 +#define SYS_sem_trywait 272 +#define SYS_sem_post 273 +#define SYS_sysctlbyname 274 +#define SYS_open_extended 277 +#define SYS_umask_extended 278 +#define SYS_stat_extended 279 +#define SYS_lstat_extended 280 +#define SYS_fstat_extended 281 +#define SYS_chmod_extended 282 +#define SYS_fchmod_extended 283 +#define SYS_access_extended 284 +#define SYS_settid 285 +#define SYS_gettid 286 +#define SYS_setsgroups 287 +#define SYS_getsgroups 288 +#define SYS_setwgroups 289 +#define SYS_getwgroups 290 +#define SYS_mkfifo_extended 291 +#define SYS_mkdir_extended 292 +#define SYS_identitysvc 293 +#define SYS_shared_region_check_np 294 +#define SYS_vm_pressure_monitor 296 +#define SYS_psynch_rw_longrdlock 297 +#define SYS_psynch_rw_yieldwrlock 298 +#define SYS_psynch_rw_downgrade 299 +#define SYS_psynch_rw_upgrade 300 +#define SYS_psynch_mutexwait 301 +#define SYS_psynch_mutexdrop 302 +#define SYS_psynch_cvbroad 303 +#define SYS_psynch_cvsignal 304 +#define SYS_psynch_cvwait 305 +#define SYS_psynch_rw_rdlock 306 +#define SYS_psynch_rw_wrlock 307 +#define SYS_psynch_rw_unlock 308 +#define SYS_psynch_rw_unlock2 309 +#define SYS_getsid 310 +#define SYS_settid_with_pid 311 +#define SYS_psynch_cvclrprepost 312 +#define SYS_aio_fsync 313 +#define SYS_aio_return 314 +#define SYS_aio_suspend 315 +#define SYS_aio_cancel 316 +#define SYS_aio_error 317 +#define SYS_aio_read 318 +#define SYS_aio_write 319 +#define SYS_lio_listio 320 +#define SYS_iopolicysys 322 +#define SYS_process_policy 323 +#define SYS_mlockall 324 +#define SYS_munlockall 325 +#define SYS_issetugid 327 +#define SYS___pthread_kill 328 +#define SYS___pthread_sigmask 329 +#define SYS___sigwait 330 +#define SYS___disable_threadsignal 331 +#define SYS___pthread_markcancel 332 +#define SYS___pthread_canceled 333 +#define SYS___semwait_signal 334 +#define SYS_proc_info 336 +#define SYS_sendfile 337 +#define SYS_stat64 338 +#define SYS_fstat64 339 +#define SYS_lstat64 340 +#define SYS_stat64_extended 341 +#define SYS_lstat64_extended 342 +#define SYS_fstat64_extended 343 +#define SYS_getdirentries64 344 +#define SYS_statfs64 345 +#define SYS_fstatfs64 346 +#define SYS_getfsstat64 347 +#define SYS___pthread_chdir 348 +#define SYS___pthread_fchdir 349 +#define SYS_audit 350 +#define SYS_auditon 351 +#define SYS_getauid 353 +#define SYS_setauid 354 +#define SYS_getaudit_addr 357 +#define SYS_setaudit_addr 358 +#define SYS_auditctl 359 +#define SYS_bsdthread_create 360 +#define SYS_bsdthread_terminate 361 +#define SYS_kqueue 362 +#define SYS_kevent 363 +#define SYS_lchown 364 +#define SYS_bsdthread_register 366 +#define SYS_workq_open 367 +#define SYS_workq_kernreturn 368 +#define SYS_kevent64 369 +#define SYS_thread_selfid 372 +#define SYS_ledger 373 +#define SYS_kevent_qos 374 +#define SYS_kevent_id 375 +#define SYS___mac_execve 380 +#define SYS___mac_syscall 381 +#define SYS___mac_get_file 382 +#define SYS___mac_set_file 383 +#define SYS___mac_get_link 384 +#define SYS___mac_set_link 385 +#define SYS___mac_get_proc 386 +#define SYS___mac_set_proc 387 +#define SYS___mac_get_fd 388 +#define SYS___mac_set_fd 389 +#define SYS___mac_get_pid 390 +#define SYS_pselect 394 +#define SYS_pselect_nocancel 395 +#define SYS_read_nocancel 396 +#define SYS_write_nocancel 397 +#define SYS_open_nocancel 398 +#define SYS_close_nocancel 399 +#define SYS_wait4_nocancel 400 +#define SYS_recvmsg_nocancel 401 +#define SYS_sendmsg_nocancel 402 +#define SYS_recvfrom_nocancel 403 +#define SYS_accept_nocancel 404 +#define SYS_msync_nocancel 405 +#define SYS_fcntl_nocancel 406 +#define SYS_select_nocancel 407 +#define SYS_fsync_nocancel 408 +#define SYS_connect_nocancel 409 +#define SYS_sigsuspend_nocancel 410 +#define SYS_readv_nocancel 411 +#define SYS_writev_nocancel 412 +#define SYS_sendto_nocancel 413 +#define SYS_pread_nocancel 414 +#define SYS_pwrite_nocancel 415 +#define SYS_waitid_nocancel 416 +#define SYS_poll_nocancel 417 +#define SYS_msgsnd_nocancel 418 +#define SYS_msgrcv_nocancel 419 +#define SYS_sem_wait_nocancel 420 +#define SYS_aio_suspend_nocancel 421 +#define SYS___sigwait_nocancel 422 +#define SYS___semwait_signal_nocancel 423 +#define SYS___mac_mount 424 +#define SYS___mac_get_mount 425 +#define SYS___mac_getfsstat 426 +#define SYS_fsgetpath 427 +#define SYS_audit_session_self 428 +#define SYS_audit_session_join 429 +#define SYS_fileport_makeport 430 +#define SYS_fileport_makefd 431 +#define SYS_audit_session_port 432 +#define SYS_pid_suspend 433 +#define SYS_pid_resume 434 +#define SYS_pid_hibernate 435 +#define SYS_pid_shutdown_sockets 436 +#define SYS_kas_info 439 +#define SYS_memorystatus_control 440 +#define SYS_guarded_open_np 441 +#define SYS_guarded_close_np 442 +#define SYS_guarded_kqueue_np 443 +#define SYS_change_fdguard_np 444 +#define SYS_usrctl 445 +#define SYS_proc_rlimit_control 446 +#define SYS_connectx 447 +#define SYS_disconnectx 448 +#define SYS_peeloff 449 +#define SYS_socket_delegate 450 +#define SYS_telemetry 451 +#define SYS_proc_uuid_policy 452 +#define SYS_memorystatus_get_level 453 +#define SYS_system_override 454 +#define SYS_vfs_purge 455 +#define SYS_sfi_ctl 456 +#define SYS_sfi_pidctl 457 +#define SYS_coalition 458 +#define SYS_coalition_info 459 +#define SYS_necp_match_policy 460 +#define SYS_getattrlistbulk 461 +#define SYS_clonefileat 462 +#define SYS_openat 463 +#define SYS_openat_nocancel 464 +#define SYS_renameat 465 +#define SYS_faccessat 466 +#define SYS_fchmodat 467 +#define SYS_fchownat 468 +#define SYS_fstatat 469 +#define SYS_fstatat64 470 +#define SYS_linkat 471 +#define SYS_unlinkat 472 +#define SYS_readlinkat 473 +#define SYS_symlinkat 474 +#define SYS_mkdirat 475 +#define SYS_getattrlistat 476 +#define SYS_proc_trace_log 477 +#define SYS_bsdthread_ctl 478 +#define SYS_openbyid_np 479 +#define SYS_recvmsg_x 480 +#define SYS_sendmsg_x 481 +#define SYS_thread_selfusage 482 +#define SYS_csrctl 483 +#define SYS_guarded_open_dprotected_np 484 +#define SYS_guarded_write_np 485 +#define SYS_guarded_pwrite_np 486 +#define SYS_guarded_writev_np 487 +#define SYS_renameatx_np 488 +#define SYS_mremap_encrypted 489 +#define SYS_netagent_trigger 490 +#define SYS_stack_snapshot_with_config 491 +#define SYS_microstackshot 492 +#define SYS_grab_pgo_data 493 +#define SYS_persona 494 +#define SYS_mach_eventlink_signal 496 +#define SYS_mach_eventlink_wait_until 497 +#define SYS_mach_eventlink_signal_wait_until 498 +#define SYS_work_interval_ctl 499 +#define SYS_getentropy 500 +#define SYS_necp_open 501 +#define SYS_necp_client_action 502 +#define SYS___nexus_open 503 +#define SYS___nexus_register 504 +#define SYS___nexus_deregister 505 +#define SYS___nexus_create 506 +#define SYS___nexus_destroy 507 +#define SYS___nexus_get_opt 508 +#define SYS___nexus_set_opt 509 +#define SYS___channel_open 510 +#define SYS___channel_get_info 511 +#define SYS___channel_sync 512 +#define SYS___channel_get_opt 513 +#define SYS___channel_set_opt 514 +#define SYS_ulock_wait 515 +#define SYS_ulock_wake 516 +#define SYS_fclonefileat 517 +#define SYS_fs_snapshot 518 +#define SYS_register_uexc_handler 519 +#define SYS_terminate_with_payload 520 +#define SYS_abort_with_payload 521 +#define SYS_necp_session_open 522 +#define SYS_necp_session_action 523 +#define SYS_setattrlistat 524 +#define SYS_net_qos_guideline 525 +#define SYS_fmount 526 +#define SYS_ntp_adjtime 527 +#define SYS_ntp_gettime 528 +#define SYS_os_fault_with_payload 529 +#define SYS_kqueue_workloop_ctl 530 +#define SYS___mach_bridge_remote_time 531 +#define SYS_coalition_ledger 532 +#define SYS_log_data 533 +#define SYS_memorystatus_available_memory 534 +#define SYS_objc_bp_assist_cfg_np 535 +#define SYS_shared_region_map_and_slide_2_np 536 +#define SYS_pivot_root 537 +#define SYS_task_inspect_for_pid 538 +#define SYS_task_read_for_pid 539 +#define SYS_preadv 540 +#define SYS_pwritev 541 +#define SYS_preadv_nocancel 542 +#define SYS_pwritev_nocancel 543 +#define SYS_ulock_wait2 544 +#define SYS_proc_info_extended_id 545 +#define SYS_tracker_action 546 +#define SYS_debug_syscall_reject 547 +#define SYS_debug_syscall_reject_config 548 +#define SYS_graftdmg 549 +#define SYS_map_with_linking_np 550 +#define SYS_freadlink 551 +#define SYS_record_system_event 552 +#define SYS_mkfifoat 553 +#define SYS_mknodat 554 +#define SYS_ungraftdmg 555 +#define SYS_MAXSYSCALL 556 +#define SYS_invalid 63 +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SO_DEBUG 0x0001 +#define SO_ACCEPTCONN 0x0002 +#define SO_REUSEADDR 0x0004 +#define SO_KEEPALIVE 0x0008 +#define SO_DONTROUTE 0x0010 +#define SO_BROADCAST 0x0020 +#define SO_USELOOPBACK 0x0040 +#define SO_LINGER 0x1080 +#define SO_LINGER_SEC 0x1080 +#define SO_OOBINLINE 0x0100 +#define SO_REUSEPORT 0x0200 +#define SO_TIMESTAMP 0x0400 +#define SO_TIMESTAMP_MONOTONIC 0x0800 +#define SO_ACCEPTFILTER 0x1000 +#define SO_DONTTRUNC 0x2000 +#define SO_WANTMORE 0x4000 +#define SO_WANTOOBFLAG 0x8000 +#define SO_SNDBUF 0x1001 +#define SO_RCVBUF 0x1002 +#define SO_SNDLOWAT 0x1003 +#define SO_RCVLOWAT 0x1004 +#define SO_SNDTIMEO 0x1005 +#define SO_RCVTIMEO 0x1006 +#define SO_ERROR 0x1007 +#define SO_TYPE 0x1008 +#define SO_LABEL 0x1010 +#define SO_PEERLABEL 0x1011 +#define SO_NREAD 0x1020 +#define SO_NKE 0x1021 +#define SO_NOSIGPIPE 0x1022 +#define SO_NOADDRERR 0x1023 +#define SO_NWRITE 0x1024 +#define SO_REUSESHAREUID 0x1025 +#define SO_NOTIFYCONFLICT 0x1026 +#define SO_UPCALLCLOSEWAIT 0x1027 +#define SO_RANDOMPORT 0x1082 +#define SO_NP_EXTENSIONS 0x1083 +#define SO_NUMRCVPKT 0x1112 +#define SO_NET_SERVICE_TYPE 0x1116 +#define SO_NETSVC_MARKING_LEVEL 0x1119 +#define SO_RESOLVER_SIGNATURE 0x1131 +#define NET_SERVICE_TYPE_BE 0 +#define NET_SERVICE_TYPE_BK 1 +#define NET_SERVICE_TYPE_SIG 2 +#define NET_SERVICE_TYPE_VI 3 +#define NET_SERVICE_TYPE_VO 4 +#define NET_SERVICE_TYPE_RV 5 +#define NET_SERVICE_TYPE_AV 6 +#define NET_SERVICE_TYPE_OAM 7 +#define NET_SERVICE_TYPE_RD 8 +#define NETSVC_MRKNG_UNKNOWN 0 +#define NETSVC_MRKNG_LVL_L2 1 +#define NETSVC_MRKNG_LVL_L3L2_ALL 2 +#define NETSVC_MRKNG_LVL_L3L2_BK 3 +#define SAE_ASSOCID_ANY 0 +#define SAE_CONNID_ANY 0 +#define CONNECT_RESUME_ON_READ_WRITE 0x1 +#define CONNECT_DATA_IDEMPOTENT 0x2 +#define CONNECT_DATA_AUTHENTICATED 0x4 +#define SONPX_SETOPTSHUT 0x000000001 +#define SOL_SOCKET 0xffff +#define AF_UNSPEC 0 +#define AF_UNIX 1 +#define AF_INET 2 +#define AF_IMPLINK 3 +#define AF_PUP 4 +#define AF_CHAOS 5 +#define AF_NS 6 +#define AF_ISO 7 +#define AF_ECMA 8 +#define AF_DATAKIT 9 +#define AF_CCITT 10 +#define AF_SNA 11 +#define AF_DECnet 12 +#define AF_DLI 13 +#define AF_LAT 14 +#define AF_HYLINK 15 +#define AF_APPLETALK 16 +#define AF_ROUTE 17 +#define AF_LINK 18 +#define pseudo_AF_XTP 19 +#define AF_COIP 20 +#define AF_CNT 21 +#define pseudo_AF_RTIP 22 +#define AF_IPX 23 +#define AF_SIP 24 +#define pseudo_AF_PIP 25 +#define AF_NDRV 27 +#define AF_ISDN 28 +#define pseudo_AF_KEY 29 +#define AF_INET6 30 +#define AF_NATM 31 +#define AF_SYSTEM 32 +#define AF_NETBIOS 33 +#define AF_PPP 34 +#define pseudo_AF_HDRCMPLT 35 +#define AF_RESERVED_36 36 +#define AF_IEEE80211 37 +#define AF_UTUN 38 +#define AF_VSOCK 40 +#define AF_MAX 41 +#define SOCK_MAXADDRLEN 255 +#define _SS_MAXSIZE 128 +#define NET_RT_DUMP 1 +#define NET_RT_FLAGS 2 +#define NET_RT_IFLIST 3 +#define NET_RT_STAT 4 +#define NET_RT_TRASH 5 +#define NET_RT_IFLIST2 6 +#define NET_RT_DUMP2 7 +#define NET_RT_FLAGS_PRIV 10 +#define NET_RT_MAXID 11 +#define SOMAXCONN 128 +#define MSG_OOB 0x1 +#define MSG_PEEK 0x2 +#define MSG_DONTROUTE 0x4 +#define MSG_EOR 0x8 +#define MSG_TRUNC 0x10 +#define MSG_CTRUNC 0x20 +#define MSG_WAITALL 0x40 +#define MSG_DONTWAIT 0x80 +#define MSG_EOF 0x100 +#define MSG_WAITSTREAM 0x200 +#define MSG_FLUSH 0x400 +#define MSG_HOLD 0x800 +#define MSG_SEND 0x1000 +#define MSG_HAVEMORE 0x2000 +#define MSG_RCVMORE 0x4000 +#define MSG_NEEDSA 0x10000 +#define MSG_NOSIGNAL 0x80000 +#define MSG_USEUPCALL 0x80000000 +#define CMGROUP_MAX 16 +#define SCM_RIGHTS 0x01 +#define SCM_TIMESTAMP 0x02 +#define SCM_CREDS 0x03 +#define SCM_TIMESTAMP_MONOTONIC 0x04 +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 +#define SBUF_FIXEDLEN 0x00000000 +#define SBUF_AUTOEXTEND 0x00000001 +#define SBUF_USRFLAGMSK 0x0000ffff +#define SBUF_DYNAMIC 0x00010000 +#define SBUF_FINISHED 0x00020000 +#define SBUF_OVERFLOWED 0x00040000 +#define SBUF_DYNSTRUCT 0x00080000 +#define SYSPROTO_EVENT 1 +#define SYSPROTO_CONTROL 2 +#define AF_SYS_CONTROL 2 +#define SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED 0x00000001 +#define SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER 0x00000002 +#define SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT 0x00000004 +#define NS_GETRAWENCRYPTED 0x00000001 diff --git a/pwnlib/data/includes/darwin/amd64.h b/pwnlib/data/includes/darwin/amd64.h new file mode 100644 index 000000000..ee9411473 --- /dev/null +++ b/pwnlib/data/includes/darwin/amd64.h @@ -0,0 +1,3230 @@ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 +#define DST_NONE 0 +#define DST_USA 1 +#define DST_AUST 2 +#define DST_WET 3 +#define DST_MET 4 +#define DST_EET 5 +#define DST_CAN 6 +#define CHILD_MAX 266 +#define LINK_MAX 32767 +#define MAX_CANON 1024 +#define MAX_INPUT 1024 +#define NAME_MAX 255 +#define NGROUPS_MAX 16 +#define OPEN_MAX 10240 +#define PATH_MAX 1024 +#define PIPE_BUF 512 +#define BC_BASE_MAX 99 +#define BC_DIM_MAX 2048 +#define BC_SCALE_MAX 99 +#define BC_STRING_MAX 1000 +#define CHARCLASS_NAME_MAX 14 +#define COLL_WEIGHTS_MAX 2 +#define EQUIV_CLASS_MAX 2 +#define EXPR_NEST_MAX 32 +#define LINE_MAX 2048 +#define RE_DUP_MAX 255 +#define NZERO 0 +#define GETNCNT 3 +#define GETPID 4 +#define GETVAL 5 +#define GETALL 6 +#define GETZCNT 7 +#define SETVAL 8 +#define SETALL 9 +#define SEM_UNDO 0010000 +#define SEM_A 00200 +#define SEM_R 00400 +#define PSEMNAMLEN 31 +#define PSEM_NONE 1 +#define PSEM_DEFINED 2 +#define PSEM_ALLOCATED 4 +#define PSEM_MAPPED 8 +#define PSEM_INUSE 0x10 +#define PSEM_REMOVED 0x20 +#define PSEM_INCREATE 0x40 +#define PSEM_INDELETE 0x80 +#define FSOPT_NOFOLLOW 0x00000001 +#define FSOPT_NOINMEMUPDATE 0x00000002 +#define FSOPT_REPORT_FULLSIZE 0x00000004 +#define FSOPT_PACK_INVAL_ATTRS 0x00000008 +#define FSOPT_ATTR_CMN_EXTENDED 0x00000020 +#define FSOPT_RETURN_REALDEV 0x00000200 +#define FSOPT_NOFOLLOW_ANY 0x00000800 +#define SEARCHFS_MAX_SEARCHPARMS 4096 +#define ATTR_BIT_MAP_COUNT 5 +#define VOL_CAPABILITIES_FORMAT 0 +#define VOL_CAPABILITIES_INTERFACES 1 +#define VOL_CAPABILITIES_RESERVED1 2 +#define VOL_CAPABILITIES_RESERVED2 3 +#define ATTR_MAX_BUFFER 8192 +#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001 +#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002 +#define VOL_CAP_FMT_HARDLINKS 0x00000004 +#define VOL_CAP_FMT_JOURNAL 0x00000008 +#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010 +#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020 +#define VOL_CAP_FMT_SPARSE_FILES 0x00000040 +#define VOL_CAP_FMT_ZERO_RUNS 0x00000080 +#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100 +#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200 +#define VOL_CAP_FMT_FAST_STATFS 0x00000400 +#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800 +#define VOL_CAP_FMT_OPENDENYMODES 0x00001000 +#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000 +#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000 +#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000 +#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000 +#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000 +#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000 +#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000 +#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000 +#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000 +#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000 +#define VOL_CAP_FMT_SHARED_SPACE 0x00800000 +#define VOL_CAP_FMT_VOL_GROUPS 0x01000000 +#define VOL_CAP_FMT_SEALED 0x02000000 +#define VOL_CAP_INT_SEARCHFS 0x00000001 +#define VOL_CAP_INT_ATTRLIST 0x00000002 +#define VOL_CAP_INT_NFSEXPORT 0x00000004 +#define VOL_CAP_INT_READDIRATTR 0x00000008 +#define VOL_CAP_INT_EXCHANGEDATA 0x00000010 +#define VOL_CAP_INT_COPYFILE 0x00000020 +#define VOL_CAP_INT_ALLOCATE 0x00000040 +#define VOL_CAP_INT_VOL_RENAME 0x00000080 +#define VOL_CAP_INT_ADVLOCK 0x00000100 +#define VOL_CAP_INT_FLOCK 0x00000200 +#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400 +#define VOL_CAP_INT_USERACCESS 0x00000800 +#define VOL_CAP_INT_MANLOCK 0x00001000 +#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000 +#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000 +#define VOL_CAP_INT_CLONE 0x00010000 +#define VOL_CAP_INT_SNAPSHOT 0x00020000 +#define VOL_CAP_INT_RENAME_SWAP 0x00040000 +#define VOL_CAP_INT_RENAME_EXCL 0x00080000 +#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 +#define VOL_CAP_INT_RENAME_SECLUDE 0x00200000 +#define ATTR_CMN_NAME 0x00000001 +#define ATTR_CMN_DEVID 0x00000002 +#define ATTR_CMN_FSID 0x00000004 +#define ATTR_CMN_OBJTYPE 0x00000008 +#define ATTR_CMN_OBJTAG 0x00000010 +#define ATTR_CMN_OBJID 0x00000020 +#define ATTR_CMN_OBJPERMANENTID 0x00000040 +#define ATTR_CMN_PAROBJID 0x00000080 +#define ATTR_CMN_SCRIPT 0x00000100 +#define ATTR_CMN_CRTIME 0x00000200 +#define ATTR_CMN_MODTIME 0x00000400 +#define ATTR_CMN_CHGTIME 0x00000800 +#define ATTR_CMN_ACCTIME 0x00001000 +#define ATTR_CMN_BKUPTIME 0x00002000 +#define ATTR_CMN_FNDRINFO 0x00004000 +#define ATTR_CMN_OWNERID 0x00008000 +#define ATTR_CMN_GRPID 0x00010000 +#define ATTR_CMN_ACCESSMASK 0x00020000 +#define ATTR_CMN_FLAGS 0x00040000 +#define ATTR_CMN_GEN_COUNT 0x00080000 +#define ATTR_CMN_DOCUMENT_ID 0x00100000 +#define ATTR_CMN_USERACCESS 0x00200000 +#define ATTR_CMN_EXTENDED_SECURITY 0x00400000 +#define ATTR_CMN_UUID 0x00800000 +#define ATTR_CMN_GRPUUID 0x01000000 +#define ATTR_CMN_FILEID 0x02000000 +#define ATTR_CMN_PARENTID 0x04000000 +#define ATTR_CMN_FULLPATH 0x08000000 +#define ATTR_CMN_ADDEDTIME 0x10000000 +#define ATTR_CMN_ERROR 0x20000000 +#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000 +#define ATTR_CMN_RETURNED_ATTRS 0x80000000 +#define ATTR_CMN_VALIDMASK 0xFFFFFFFF +#define ATTR_CMN_SETMASK 0x51C7FF00 +#define ATTR_CMN_VOLSETMASK 0x00006700 +#define ATTR_VOL_FSTYPE 0x00000001 +#define ATTR_VOL_SIGNATURE 0x00000002 +#define ATTR_VOL_SIZE 0x00000004 +#define ATTR_VOL_SPACEFREE 0x00000008 +#define ATTR_VOL_SPACEAVAIL 0x00000010 +#define ATTR_VOL_MINALLOCATION 0x00000020 +#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040 +#define ATTR_VOL_IOBLOCKSIZE 0x00000080 +#define ATTR_VOL_OBJCOUNT 0x00000100 +#define ATTR_VOL_FILECOUNT 0x00000200 +#define ATTR_VOL_DIRCOUNT 0x00000400 +#define ATTR_VOL_MAXOBJCOUNT 0x00000800 +#define ATTR_VOL_MOUNTPOINT 0x00001000 +#define ATTR_VOL_NAME 0x00002000 +#define ATTR_VOL_MOUNTFLAGS 0x00004000 +#define ATTR_VOL_MOUNTEDDEVICE 0x00008000 +#define ATTR_VOL_ENCODINGSUSED 0x00010000 +#define ATTR_VOL_CAPABILITIES 0x00020000 +#define ATTR_VOL_UUID 0x00040000 +#define ATTR_VOL_FSTYPENAME 0x00100000 +#define ATTR_VOL_FSSUBTYPE 0x00200000 +#define ATTR_VOL_SPACEUSED 0x00800000 +#define ATTR_VOL_QUOTA_SIZE 0x10000000 +#define ATTR_VOL_RESERVED_SIZE 0x20000000 +#define ATTR_VOL_ATTRIBUTES 0x40000000 +#define ATTR_VOL_INFO 0x80000000 +#define ATTR_VOL_VALIDMASK 0xF0B7FFFF +#define ATTR_VOL_SETMASK 0x80002000 +#define ATTR_DIR_LINKCOUNT 0x00000001 +#define ATTR_DIR_ENTRYCOUNT 0x00000002 +#define ATTR_DIR_MOUNTSTATUS 0x00000004 +#define ATTR_DIR_ALLOCSIZE 0x00000008 +#define ATTR_DIR_IOBLOCKSIZE 0x00000010 +#define ATTR_DIR_DATALENGTH 0x00000020 +#define DIR_MNTSTATUS_MNTPOINT 0x00000001 +#define DIR_MNTSTATUS_TRIGGER 0x00000002 +#define ATTR_DIR_VALIDMASK 0x0000003f +#define ATTR_DIR_SETMASK 0x00000000 +#define ATTR_FILE_LINKCOUNT 0x00000001 +#define ATTR_FILE_TOTALSIZE 0x00000002 +#define ATTR_FILE_ALLOCSIZE 0x00000004 +#define ATTR_FILE_IOBLOCKSIZE 0x00000008 +#define ATTR_FILE_DEVTYPE 0x00000020 +#define ATTR_FILE_FORKCOUNT 0x00000080 +#define ATTR_FILE_FORKLIST 0x00000100 +#define ATTR_FILE_DATALENGTH 0x00000200 +#define ATTR_FILE_DATAALLOCSIZE 0x00000400 +#define ATTR_FILE_RSRCLENGTH 0x00001000 +#define ATTR_FILE_RSRCALLOCSIZE 0x00002000 +#define ATTR_FILE_VALIDMASK 0x000037FF +#define ATTR_FILE_SETMASK 0x00000020 +#define ATTR_CMNEXT_RELPATH 0x00000004 +#define ATTR_CMNEXT_PRIVATESIZE 0x00000008 +#define ATTR_CMNEXT_LINKID 0x00000010 +#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020 +#define ATTR_CMNEXT_REALDEVID 0x00000040 +#define ATTR_CMNEXT_REALFSID 0x00000080 +#define ATTR_CMNEXT_CLONEID 0x00000100 +#define ATTR_CMNEXT_EXT_FLAGS 0x00000200 +#define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400 +#define ATTR_CMNEXT_ATTRIBUTION_TAG 0x00000800 +#define ATTR_CMNEXT_CLONE_REFCNT 0x00001000 +#define ATTR_CMNEXT_VALIDMASK 0x00001ffc +#define ATTR_CMNEXT_SETMASK 0x00000000 +#define ATTR_FORK_TOTALSIZE 0x00000001 +#define ATTR_FORK_ALLOCSIZE 0x00000002 +#define ATTR_FORK_RESERVED 0xffffffff +#define ATTR_FORK_VALIDMASK 0x00000003 +#define ATTR_FORK_SETMASK 0x00000000 +#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 +#define ATTR_CMN_NAMEDATTRLIST 0x00100000 +#define ATTR_FILE_CLUMPSIZE 0x00000010 +#define ATTR_FILE_FILETYPE 0x00000040 +#define ATTR_FILE_DATAEXTENTS 0x00000800 +#define ATTR_FILE_RSRCEXTENTS 0x00004000 +#define SRCHFS_START 0x00000001 +#define SRCHFS_MATCHPARTIALNAMES 0x00000002 +#define SRCHFS_MATCHDIRS 0x00000004 +#define SRCHFS_MATCHFILES 0x00000008 +#define SRCHFS_SKIPLINKS 0x00000010 +#define SRCHFS_SKIPINVISIBLE 0x00000020 +#define SRCHFS_SKIPPACKAGES 0x00000040 +#define SRCHFS_SKIPINAPPROPRIATE 0x00000080 +#define SRCHFS_NEGATEPARAMS 0x80000000 +#define SRCHFS_VALIDOPTIONSMASK 0x800000FF +#define KEV_ANY_VENDOR 0 +#define KEV_ANY_CLASS 0 +#define KEV_ANY_SUBCLASS 0 +#define KEV_VENDOR_APPLE 1 +#define KEV_NETWORK_CLASS 1 +#define KEV_IOKIT_CLASS 2 +#define KEV_SYSTEM_CLASS 3 +#define KEV_APPLESHARE_CLASS 4 +#define KEV_FIREWALL_CLASS 5 +#define KEV_IEEE80211_CLASS 6 +#define KEV_NKE_CLASS 7 +#define KEV_NKE_ALF_SUBCLASS 1 +#define KEV_NKE_ALF_STATE_CHANGED 1 +#define XNU_KERN_EVENT_DATA_SIZE 1 +#define KEV_VENDOR_CODE_MAX_STR_LEN 200 +#define N_KEV_VECTORS 5 +#define M_WAITOK 0x0000 +#define M_NOWAIT 0x0001 +#define M_ZERO 0x0004 +#define M_NULL 0x0008 +#define M_PCB 4 +#define M_RTABLE 5 +#define M_IFADDR 9 +#define M_SONAME 11 +#define M_LOCKF 40 +#define M_TEMP 80 +#define M_UDFNODE 84 +#define M_UDFMNT 85 +#define M_KAUTH 100 +#define HAVE_VT_LOCKERFS 1 +#define VNODE_READ 0x01 +#define VNODE_WRITE 0x02 +#define VNODE_BLOCKMAP_NO_TRACK 0x04 +#define VNODE_CLUSTER_VERIFY 0x08 +#define PREALLOCATE 0x00000001 +#define ALLOCATECONTIG 0x00000002 +#define ALLOCATEALL 0x00000004 +#define ALLOCATEPERSIST 0x00000008 +#define ALLOCATEFROMPEOF 0x00000010 +#define ALLOCATEFROMVOL 0x00000020 +#define IO_UNIT 0x0001 +#define IO_APPEND 0x0002 +#define IO_SYNC 0x0004 +#define IO_NODELOCKED 0x0008 +#define IO_NDELAY 0x0010 +#define IO_NOZEROFILL 0x0020 +#define IO_TAILZEROFILL 0x0040 +#define IO_HEADZEROFILL 0x0080 +#define IO_NOZEROVALID 0x0100 +#define IO_NOZERODIRTY 0x0200 +#define IO_CLOSE 0x0400 +#define IO_NOCACHE 0x0800 +#define IO_RAOFF 0x1000 +#define IO_DEFWRITE 0x2000 +#define IO_PASSIVE 0x4000 +#define IO_NOAUTH 0x8000 +#define IO_NODIRECT 0x10000 +#define IO_ENCRYPTED 0x20000 +#define IO_RETURN_ON_THROTTLE 0x40000 +#define IO_SINGLE_WRITER 0x80000 +#define IO_SYSCALL_DISPATCH 0x100000 +#define IO_SWAP_DISPATCH 0x200000 +#define IO_SKIP_ENCRYPTION 0x400000 +#define IO_EVTONLY 0x800000 +#define LOOKUP 0 +#define CREATE 1 +#define DELETE 2 +#define RENAME 3 +#define OPMASK 3 +#define FOLLOW 0x00000040 +#define ISDOTDOT 0x00002000 +#define MAKEENTRY 0x00004000 +#define ISLASTCN 0x00008000 +#define VNFS_NOCACHE 0x01 +#define VNFS_CANTCACHE 0x02 +#define VNFS_ADDFSREF 0x04 +#define VNCREATE_FLAVOR 0 +#define VA_UTIMES_NULL 0x010000 +#define VA_EXCLUSIVE 0x020000 +#define VA_NOINHERIT 0x040000 +#define VA_NOAUTH 0x080000 +#define VA_64BITOBJIDS 0x100000 +#define VA_REALFSID 0x200000 +#define VA_USEFSID 0x400000 +#define VA_FILESEC_ACL 0x800000 +#define VSUID 0x800 +#define VSGID 0x400 +#define VSVTX 0x200 +#define VREAD 0x100 +#define VWRITE 0x080 +#define VEXEC 0x040 +#define SKIPSYSTEM 0x0001 +#define FORCECLOSE 0x0002 +#define WRITECLOSE 0x0004 +#define SKIPSWAP 0x0008 +#define SKIPROOT 0x0010 +#define DOCLOSE 0x0008 +#define V_SAVE 0x0001 +#define V_SAVEMETA 0x0002 +#define REVOKEALL 0x0001 +#define VNODE_REMOVE_NODELETEBUSY 0x0001 +#define VNODE_REMOVE_SKIP_NAMESPACE_EVENT 0x0002 +#define VNODE_REMOVE_NO_AUDIT_PATH 0x0004 +#define VNODE_REMOVE_DATALESS_DIR 0x0008 +#define VNODE_READDIR_EXTENDED 0x0001 +#define VNODE_READDIR_REQSEEKOFF 0x0002 +#define VNODE_READDIR_SEEKOFF32 0x0004 +#define VNODE_READDIR_NAMEMAX 0x0008 +#define VNODE_CLONEFILE_DEFAULT 0x0000 +#define VNODE_CLONEFILE_NOOWNERCOPY 0x0001 +#define VNODE_ASYNC_THROTTLE 15 +#define VNODE_UPDATE_PARENT 0x01 +#define VNODE_UPDATE_NAME 0x02 +#define VNODE_UPDATE_CACHE 0x04 +#define VNODE_UPDATE_PURGE 0x08 +#define VNODE_LOOKUP_NOFOLLOW 0x01 +#define VNODE_LOOKUP_NOCROSSMOUNT 0x02 +#define VNODE_LOOKUP_CROSSMOUNTNOWAIT 0x04 +#define VNODE_RELOAD 0x01 +#define VNODE_WAIT 0x02 +#define VNODE_WRITEABLE 0x04 +#define VNODE_WITHID 0x08 +#define VNODE_NOLOCK_INTERNAL 0x10 +#define VNODE_NODEAD 0x20 +#define VNODE_NOSUSPEND 0x40 +#define VNODE_ITERATE_ALL 0x80 +#define VNODE_ITERATE_ACTIVE 0x100 +#define VNODE_ITERATE_INACTIVE 0x200 +#define VNODE_RETURNED 0 +#define VNODE_RETURNED_DONE 1 +#define VNODE_CLAIMED 2 +#define VNODE_CLAIMED_DONE 3 +#define IOCS_BUFFER_NUM_SIZE_BUCKETS 10 +#define IOCS_BUFFER_MAX_BUCKET 9 +#define IOCS_BUFFER_NUM_COMPRESSION_BUCKETS 7 +#define IOCS_BLOCK_NUM_SIZE_BUCKETS 16 +#define IOCS_SBE_PATH_LEN 128 +#define IOCS_PATH_START_BYTES_TO_COPY 108 +#define IOCS_PATH_END_BYTES_TO_COPY 20 +#define IOCS_SYSCTL_LIVE 0x00000001 +#define IOCS_SYSCTL_STORE_BUFFER_RD_ONLY 0x00000002 +#define IOCS_SYSCTL_STORE_BUFFER_MARK 0x00000004 +#define TANDEM 0x00000001 +#define CBREAK 0x00000002 +#define LCASE 0x00000004 +#define ECHO 0x00000008 +#define CRMOD 0x00000010 +#define RAW 0x00000020 +#define ODDP 0x00000040 +#define EVENP 0x00000080 +#define ANYP 0x000000c0 +#define NLDELAY 0x00000300 +#define TBDELAY 0x00000c00 +#define XTABS 0x00000c00 +#define CRDELAY 0x00003000 +#define VTDELAY 0x00004000 +#define BSDELAY 0x00008000 +#define NL0 0x00000000 +#define NL1 0x00000100 +#define NL2 0x00000200 +#define NL3 0x00000300 +#define TAB0 0x00000000 +#define TAB1 0x00000400 +#define TAB2 0x00000800 +#define CR0 0x00000000 +#define CR1 0x00001000 +#define CR2 0x00002000 +#define CR3 0x00003000 +#define FF0 0x00000000 +#define FF1 0x00004000 +#define BS0 0x00000000 +#define BS1 0x00008000 +#define CRTBS 0x00010000 +#define PRTERA 0x00020000 +#define CRTERA 0x00040000 +#define TILDE 0x00080000 +#define MDMBUF 0x00100000 +#define LITOUT 0x00200000 +#define TOSTOP 0x00400000 +#define FLUSHO 0x00800000 +#define NOHANG 0x01000000 +#define L001000 0x02000000 +#define CRTKIL 0x04000000 +#define PASS8 0x08000000 +#define CTLECH 0x10000000 +#define PENDIN 0x20000000 +#define DECCTQ 0x40000000 +#define NOFLSH 0x80000000 +#define OTTYDISC 0 +#define NETLDISC 1 +#define NTTYDISC 2 +#define LOCKLEAF 0x0004 +#define LOCKPARENT 0x0008 +#define WANTPARENT 0x0010 +#define UIO_MAXIOV 1024 +#define UIO_SMALLIOV 8 +#define EVFILT_SYSCOUNT 17 +#define KEVENT_FLAG_NONE 0x000000 +#define KEVENT_FLAG_IMMEDIATE 0x000001 +#define KEVENT_FLAG_ERROR_EVENTS 0x000002 +#define EV_ADD 0x0001 +#define EV_DELETE 0x0002 +#define EV_ENABLE 0x0004 +#define EV_DISABLE 0x0008 +#define EV_ONESHOT 0x0010 +#define EV_CLEAR 0x0020 +#define EV_RECEIPT 0x0040 +#define EV_DISPATCH 0x0080 +#define EV_UDATA_SPECIFIC 0x0100 +#define EV_VANISHED 0x0200 +#define EV_SYSFLAGS 0xF000 +#define EV_FLAG0 0x1000 +#define EV_FLAG1 0x2000 +#define EV_EOF 0x8000 +#define EV_ERROR 0x4000 +#define NOTE_TRIGGER 0x01000000 +#define NOTE_FFNOP 0x00000000 +#define NOTE_FFAND 0x40000000 +#define NOTE_FFOR 0x80000000 +#define NOTE_FFCOPY 0xc0000000 +#define NOTE_FFCTRLMASK 0xc0000000 +#define NOTE_FFLAGSMASK 0x00ffffff +#define NOTE_LOWAT 0x00000001 +#define NOTE_OOB 0x00000002 +#define NOTE_DELETE 0x00000001 +#define NOTE_WRITE 0x00000002 +#define NOTE_EXTEND 0x00000004 +#define NOTE_ATTRIB 0x00000008 +#define NOTE_LINK 0x00000010 +#define NOTE_RENAME 0x00000020 +#define NOTE_REVOKE 0x00000040 +#define NOTE_NONE 0x00000080 +#define NOTE_FUNLOCK 0x00000100 +#define NOTE_LEASE_DOWNGRADE 0x00000200 +#define NOTE_LEASE_RELEASE 0x00000400 +#define NOTE_EXIT 0x80000000 +#define NOTE_FORK 0x40000000 +#define NOTE_EXEC 0x20000000 +#define NOTE_SIGNAL 0x08000000 +#define NOTE_EXITSTATUS 0x04000000 +#define NOTE_EXIT_DETAIL 0x02000000 +#define NOTE_PDATAMASK 0x000fffff +#define NOTE_EXIT_DETAIL_MASK 0x00070000 +#define NOTE_EXIT_DECRYPTFAIL 0x00010000 +#define NOTE_EXIT_MEMORY 0x00020000 +#define NOTE_EXIT_CSERROR 0x00040000 +#define NOTE_VM_PRESSURE 0x80000000 +#define NOTE_VM_PRESSURE_TERMINATE 0x40000000 +#define NOTE_VM_PRESSURE_SUDDEN_TERMINATE 0x20000000 +#define NOTE_VM_ERROR 0x10000000 +#define NOTE_SECONDS 0x00000001 +#define NOTE_USECONDS 0x00000002 +#define NOTE_NSECONDS 0x00000004 +#define NOTE_ABSOLUTE 0x00000008 +#define NOTE_LEEWAY 0x00000010 +#define NOTE_CRITICAL 0x00000020 +#define NOTE_BACKGROUND 0x00000040 +#define NOTE_MACH_CONTINUOUS_TIME 0x00000080 +#define NOTE_MACHTIME 0x00000100 +#define NOTE_TRACK 0x00000001 +#define NOTE_TRACKERR 0x00000002 +#define NOTE_CHILD 0x00000004 +#define VMADDR_CID_HYPERVISOR 0 +#define VMADDR_CID_RESERVED 1 +#define VMADDR_CID_HOST 2 +#define IMG_SHSIZE 512 +#define IMGPF_NONE 0x00000000 +#define IMGPF_INTERPRET 0x00000001 +#define IMGPF_RESERVED 0x00000002 +#define IMGPF_WAS_64BIT_ADDR 0x00000004 +#define IMGPF_IS_64BIT_ADDR 0x00000008 +#define IMGPF_SPAWN 0x00000010 +#define IMGPF_DISABLE_ASLR 0x00000020 +#define IMGPF_ALLOW_DATA_EXEC 0x00000040 +#define IMGPF_EXEC 0x00000100 +#define IMGPF_HIGH_BITS_ASLR 0x00000200 +#define IMGPF_IS_64BIT_DATA 0x00000400 +#define IMGPF_DRIVER 0x00000800 +#define IMGPF_RESLIDE 0x00001000 +#define IMGPF_PLUGIN_HOST_DISABLE_A_KEYS 0x00002000 +#define IMGPF_HW_TPRO 0x00004000 +#define IMGPF_ROSETTA 0x10000000 +#define IMGPF_ALT_ROSETTA 0x20000000 +#define IMGPF_NOJOP 0x80000000 +#define IMGPF_SB_DEFAULT 0 +#define IMGPF_SB_TRUE 1 +#define IMGPF_SB_FALSE 2 +#define _POSIX_THREAD_KEYS_MAX 128 +#define F_OK 0 +#define ACCESSX_MAX_DESCRIPTORS 100 +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_CHOWN_RESTRICTED 7 +#define _PC_NO_TRUNC 8 +#define _PC_VDISABLE 9 +#define _PC_NAME_CHARS_MAX 10 +#define _PC_CASE_SENSITIVE 11 +#define _PC_CASE_PRESERVING 12 +#define _PC_EXTENDED_SECURITY_NP 13 +#define _PC_AUTH_OPAQUE_NP 14 +#define _PC_2_SYMLINKS 15 +#define _PC_ALLOC_SIZE_MIN 16 +#define _PC_ASYNC_IO 17 +#define _PC_FILESIZEBITS 18 +#define _PC_PRIO_IO 19 +#define _PC_REC_INCR_XFER_SIZE 20 +#define _PC_REC_MAX_XFER_SIZE 21 +#define _PC_REC_MIN_XFER_SIZE 22 +#define _PC_REC_XFER_ALIGN 23 +#define _PC_SYMLINK_MAX 24 +#define _PC_SYNC_IO 25 +#define _PC_XATTR_SIZE_BITS 26 +#define _PC_MIN_HOLE_SIZE 27 +#define _CS_PATH 1 +#define _SYS_CONF_H_ 1 +#define D_TAPE 1 +#define D_DISK 2 +#define D_TTY 3 +#define WNOHANG 0x00000001 +#define WUNTRACED 0x00000002 +#define WCOREFLAG 00200 +#define _WSTOPPED 00177 +#define WEXITED 0x00000004 +#define WSTOPPED 0x00000008 +#define WCONTINUED 0x00000010 +#define WNOWAIT 0x00000020 +#define WAIT_MYPGRP 0 +#define PRIO_DARWIN_GAME_MODE 7 +#define PRIO_DARWIN_GAME_MODE_OFF 0x0 +#define PRIO_DARWIN_GAME_MODE_ON 0x1 +#define IPC_CREAT 0001000 +#define IPC_EXCL 0002000 +#define IPC_NOWAIT 0004000 +#define IPC_RMID 0 +#define IPC_SET 1 +#define IPC_STAT 2 +#define IPC_R 0000400 +#define IPC_W 0000200 +#define IPC_M 0010000 +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_ACCMODE 0x0003 +#define FREAD 0x00000001 +#define FWRITE 0x00000002 +#define O_NONBLOCK 0x00000004 +#define O_APPEND 0x00000008 +#define O_SHLOCK 0x00000010 +#define O_EXLOCK 0x00000020 +#define O_ASYNC 0x00000040 +#define O_NOFOLLOW 0x00000100 +#define O_CREAT 0x00000200 +#define O_TRUNC 0x00000400 +#define O_EXCL 0x00000800 +#define FMARK 0x00001000 +#define FDEFER 0x00002000 +#define FWASLOCKED 0x00004000 +#define O_EVTONLY 0x00008000 +#define FWASWRITTEN 0x00010000 +#define O_NOCTTY 0x00020000 +#define FNOCACHE 0x00040000 +#define FNORDAHEAD 0x00080000 +#define O_DIRECTORY 0x00100000 +#define O_SYMLINK 0x00200000 +#define FNODIRECT 0x00800000 +#define O_CLOEXEC 0x01000000 +#define FENCRYPTED 0x02000000 +#define FSINGLE_WRITER 0x04000000 +#define O_CLOFORK 0x08000000 +#define FUNENCRYPTED 0x10000000 +#define O_NOFOLLOW_ANY 0x20000000 +#define O_EXEC 0x40000000 +#define AT_EACCESS 0x0010 +#define AT_SYMLINK_NOFOLLOW 0x0020 +#define AT_SYMLINK_FOLLOW 0x0040 +#define AT_REMOVEDIR 0x0080 +#define AT_REALDEV 0x0200 +#define AT_FDONLY 0x0400 +#define AT_SYMLINK_NOFOLLOW_ANY 0x0800 +#define O_DP_GETRAWENCRYPTED 0x0001 +#define O_DP_GETRAWUNENCRYPTED 0x0002 +#define O_DP_AUTHENTICATE 0x0004 +#define CPF_OVERWRITE 0x0001 +#define CPF_IGNORE_MODE 0x0002 +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#define F_GETOWN 5 +#define F_SETOWN 6 +#define F_GETLK 7 +#define F_SETLK 8 +#define F_SETLKW 9 +#define F_SETLKWTIMEOUT 10 +#define F_FLUSH_DATA 40 +#define F_CHKCLEAN 41 +#define F_PREALLOCATE 42 +#define F_SETSIZE 43 +#define F_RDADVISE 44 +#define F_RDAHEAD 45 +#define F_NOCACHE 48 +#define F_LOG2PHYS 49 +#define F_GETPATH 50 +#define F_FULLFSYNC 51 +#define F_PATHPKG_CHECK 52 +#define F_FREEZE_FS 53 +#define F_THAW_FS 54 +#define F_GLOBAL_NOCACHE 55 +#define F_ADDSIGS 59 +#define F_ADDFILESIGS 61 +#define F_NODIRECT 62 +#define F_GETPROTECTIONCLASS 63 +#define F_SETPROTECTIONCLASS 64 +#define F_LOG2PHYS_EXT 65 +#define F_GETLKPID 66 +#define F_SETBACKINGSTORE 70 +#define F_GETPATH_MTMINFO 71 +#define F_GETCODEDIR 72 +#define F_SETNOSIGPIPE 73 +#define F_GETNOSIGPIPE 74 +#define F_TRANSCODEKEY 75 +#define F_SINGLE_WRITER 76 +#define F_GETPROTECTIONLEVEL 77 +#define F_FINDSIGS 78 +#define F_ADDFILESIGS_FOR_DYLD_SIM 83 +#define F_BARRIERFSYNC 85 +#define F_OFD_SETLK 90 +#define F_OFD_SETLKW 91 +#define F_OFD_GETLK 92 +#define F_OFD_SETLKWTIMEOUT 93 +#define F_ADDFILESIGS_RETURN 97 +#define F_CHECK_LV 98 +#define F_PUNCHHOLE 99 +#define F_TRIM_ACTIVE_FILE 100 +#define F_SPECULATIVE_READ 101 +#define F_GETPATH_NOFIRMLINK 102 +#define F_ADDFILESIGS_INFO 103 +#define F_ADDFILESUPPL 104 +#define F_GETSIGSINFO 105 +#define F_SETLEASE 106 +#define F_GETLEASE 107 +#define F_TRANSFEREXTENTS 110 +#define F_ATTRIBUTION_TAG 111 +#define FCNTL_FS_SPECIFIC_BASE 0x00010000 +#define F_DUPFD_CLOEXEC 67 +#define FD_CLOEXEC 1 +#define F_RDLCK 1 +#define F_UNLCK 2 +#define F_WRLCK 3 +#define F_WAIT 0x010 +#define F_FLOCK 0x020 +#define F_POSIX 0x040 +#define F_PROV 0x080 +#define F_WAKE1_SAFE 0x100 +#define F_ABORT 0x200 +#define F_OFD_LOCK 0x400 +#define F_TRANSFER 0x800 +#define F_CONFINED 0x1000 +#define F_ALLOCATECONTIG 0x00000002 +#define F_ALLOCATEALL 0x00000004 +#define F_ALLOCATEPERSIST 0x00000008 +#define F_PEOFPOSMODE 3 +#define F_VOLPOSMODE 4 +#define USER_FSIGNATURES_CDHASH_LEN 20 +#define GETSIGSINFO_PLATFORM_BINARY 1 +#define LOCK_SH 0x01 +#define LOCK_EX 0x02 +#define LOCK_NB 0x04 +#define LOCK_UN 0x08 +#define ATTRIBUTION_NAME_MAX 255 +#define F_CREATE_TAG 0x00000001 +#define F_DELETE_TAG 0x00000002 +#define F_QUERY_TAG 0x00000004 +#define O_POPUP 0x80000000 +#define O_ALERT 0x20000000 +#define S_BLKSIZE 512 +#define UF_SETTABLE 0x0000ffff +#define UF_NODUMP 0x00000001 +#define UF_IMMUTABLE 0x00000002 +#define UF_APPEND 0x00000004 +#define UF_OPAQUE 0x00000008 +#define UF_COMPRESSED 0x00000020 +#define UF_TRACKED 0x00000040 +#define UF_DATAVAULT 0x00000080 +#define UF_HIDDEN 0x00008000 +#define SF_SUPPORTED 0x009f0000 +#define SF_SETTABLE 0x3fff0000 +#define SF_SYNTHETIC 0xc0000000 +#define SF_ARCHIVED 0x00010000 +#define SF_IMMUTABLE 0x00020000 +#define SF_APPEND 0x00040000 +#define SF_RESTRICTED 0x00080000 +#define SF_NOUNLINK 0x00100000 +#define SF_FIRMLINK 0x00800000 +#define SF_DATALESS 0x40000000 +#define EF_MAY_SHARE_BLOCKS 0x00000001 +#define EF_NO_XATTRS 0x00000002 +#define EF_IS_SYNC_ROOT 0x00000004 +#define EF_IS_PURGEABLE 0x00000008 +#define EF_IS_SPARSE 0x00000010 +#define EF_IS_SYNTHETIC 0x00000020 +#define EF_SHARES_ALL_BLOCKS 0x00000040 +#define MBUF_COPYALL 1000000000 +#define __DARWIN_NSIG 32 +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGPOLL 7 +#define SIGEMT 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGBUS 10 +#define SIGSEGV 11 +#define SIGSYS 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGURG 16 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGIO 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGINFO 29 +#define SIGUSR1 30 +#define SIGUSR2 31 +#define SIGEV_NONE 0 +#define SIGEV_SIGNAL 1 +#define SIGEV_THREAD 3 +#define ILL_NOOP 0 +#define ILL_ILLOPC 1 +#define ILL_ILLTRP 2 +#define ILL_PRVOPC 3 +#define ILL_ILLOPN 4 +#define ILL_ILLADR 5 +#define ILL_PRVREG 6 +#define ILL_COPROC 7 +#define ILL_BADSTK 8 +#define FPE_NOOP 0 +#define FPE_FLTDIV 1 +#define FPE_FLTOVF 2 +#define FPE_FLTUND 3 +#define FPE_FLTRES 4 +#define FPE_FLTINV 5 +#define FPE_FLTSUB 6 +#define FPE_INTDIV 7 +#define FPE_INTOVF 8 +#define SEGV_NOOP 0 +#define SEGV_MAPERR 1 +#define SEGV_ACCERR 2 +#define BUS_NOOP 0 +#define BUS_ADRALN 1 +#define BUS_ADRERR 2 +#define BUS_OBJERR 3 +#define TRAP_BRKPT 1 +#define TRAP_TRACE 2 +#define CLD_NOOP 0 +#define CLD_EXITED 1 +#define CLD_KILLED 2 +#define CLD_DUMPED 3 +#define CLD_TRAPPED 4 +#define CLD_STOPPED 5 +#define CLD_CONTINUED 6 +#define POLL_IN 1 +#define POLL_OUT 2 +#define POLL_MSG 3 +#define POLL_ERR 4 +#define POLL_PRI 5 +#define POLL_HUP 6 +#define SA_ONSTACK 0x0001 +#define SA_RESTART 0x0002 +#define SA_RESETHAND 0x0004 +#define SA_NOCLDSTOP 0x0008 +#define SA_NODEFER 0x0010 +#define SA_NOCLDWAIT 0x0020 +#define SA_SIGINFO 0x0040 +#define SA_USERTRAMP 0x0100 +#define SA_64REGSET 0x0200 +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 +#define SI_USER 0x10001 +#define SI_QUEUE 0x10002 +#define SI_TIMER 0x10003 +#define SI_ASYNCIO 0x10004 +#define SI_MESGQ 0x10005 +#define SS_ONSTACK 0x0001 +#define SS_DISABLE 0x0004 +#define MINSIGSTKSZ 32768 +#define SIGSTKSZ 131072 +#define __DARWIN_MAXNAMLEN 255 +#define __DARWIN_MAXPATHLEN 1024 +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 +#define POSIX_SPAWN_RESETIDS 0x0001 +#define POSIX_SPAWN_SETPGROUP 0x0002 +#define POSIX_SPAWN_SETSIGDEF 0x0004 +#define POSIX_SPAWN_SETSIGMASK 0x0008 +#define POSIX_SPAWN_SETSCHEDPARAM 0x0010 +#define POSIX_SPAWN_SETSCHEDULER 0x0020 +#define POSIX_SPAWN_SETEXEC 0x0040 +#define POSIX_SPAWN_START_SUSPENDED 0x0080 +#define POSIX_SPAWN_SETSID 0x0400 +#define POSIX_SPAWN_CLOEXEC_DEFAULT 0x4000 +#define _POSIX_SPAWN_RESLIDE 0x0800 +#define POSIX_SPAWN_PCONTROL_NONE 0x0000 +#define POSIX_SPAWN_PCONTROL_THROTTLE 0x0001 +#define POSIX_SPAWN_PCONTROL_SUSPEND 0x0002 +#define POSIX_SPAWN_PCONTROL_KILL 0x0003 +#define POSIX_SPAWN_PANIC_ON_CRASH 0x1 +#define POSIX_SPAWN_PANIC_ON_NON_ZERO_EXIT 0x2 +#define POSIX_SPAWN_PANIC_ON_EXIT 0x4 +#define POSIX_SPAWN_PANIC_ON_SPAWN_FAIL 0x8 +#define PROT_NONE 0x00 +#define PROT_READ 0x01 +#define PROT_WRITE 0x02 +#define PROT_EXEC 0x04 +#define MAP_SHARED 0x0001 +#define MAP_PRIVATE 0x0002 +#define MAP_FIXED 0x0010 +#define MAP_RENAME 0x0020 +#define MAP_NORESERVE 0x0040 +#define MAP_RESERVED0080 0x0080 +#define MAP_NOEXTEND 0x0100 +#define MAP_HASSEMAPHORE 0x0200 +#define MAP_NOCACHE 0x0400 +#define MAP_JIT 0x0800 +#define MAP_FILE 0x0000 +#define MAP_ANON 0x1000 +#define MAP_RESILIENT_CODESIGN 0x2000 +#define MAP_RESILIENT_MEDIA 0x4000 +#define MAP_32BIT 0x8000 +#define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000 +#define MAP_UNIX03 0x40000 +#define MAP_TPRO 0x80000 +#define MCL_CURRENT 0x0001 +#define MCL_FUTURE 0x0002 +#define MS_ASYNC 0x0001 +#define MS_INVALIDATE 0x0002 +#define MS_SYNC 0x0010 +#define MS_KILLPAGES 0x0004 +#define MS_DEACTIVATE 0x0008 +#define POSIX_MADV_NORMAL 0 +#define POSIX_MADV_RANDOM 1 +#define POSIX_MADV_SEQUENTIAL 2 +#define POSIX_MADV_WILLNEED 3 +#define POSIX_MADV_DONTNEED 4 +#define MADV_FREE 5 +#define MADV_ZERO_WIRED_PAGES 6 +#define MADV_FREE_REUSABLE 7 +#define MADV_FREE_REUSE 8 +#define MADV_CAN_REUSE 9 +#define MADV_PAGEOUT 10 +#define MINCORE_INCORE 0x1 +#define MINCORE_REFERENCED 0x2 +#define MINCORE_MODIFIED 0x4 +#define MINCORE_REFERENCED_OTHER 0x8 +#define MINCORE_MODIFIED_OTHER 0x10 +#define MINCORE_PAGED_OUT 0x20 +#define MINCORE_COPIED 0x40 +#define MINCORE_ANONYMOUS 0x80 +#define B_WRITE 0x00000000 +#define B_READ 0x00000001 +#define B_ASYNC 0x00000002 +#define B_NOCACHE 0x00000004 +#define B_DELWRI 0x00000008 +#define B_LOCKED 0x00000010 +#define B_PHYS 0x00000020 +#define B_CLUSTER 0x00000040 +#define B_PAGEIO 0x00000080 +#define B_META 0x00000100 +#define B_RAW 0x00000200 +#define B_FUA 0x00000400 +#define B_PASSIVE 0x00000800 +#define B_IOSTREAMING 0x00001000 +#define B_THROTTLED_IO 0x00002000 +#define B_ENCRYPTED_IO 0x00004000 +#define B_STATICCONTENT 0x00008000 +#define BUF_WAIT 0x01 +#define BUF_WRITE_DATA 0x0001 +#define BUF_SKIP_META 0x0002 +#define BUF_INVALIDATE_LOCKED 0x0004 +#define BUF_SKIP_NONLOCKED 0x01 +#define BUF_SKIP_LOCKED 0x02 +#define BUF_SCAN_CLEAN 0x04 +#define BUF_SCAN_DIRTY 0x08 +#define BUF_NOTIFY_BUSY 0x10 +#define BUF_RETURNED 0 +#define BUF_RETURNED_DONE 1 +#define BUF_CLAIMED 2 +#define BUF_CLAIMED_DONE 3 +#define BLK_READ 0x01 +#define BLK_WRITE 0x02 +#define BLK_META 0x10 +#define BLK_ONLYVALID 0x80000000 +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 +#define LOG_PRIMASK 0x07 +#define INTERNAL_NOPRI 0x10 +#define LOG_NFACILITIES 25 +#define LOG_FACMASK 0x03f8 +#define LOG_PID 0x01 +#define LOG_CONS 0x02 +#define LOG_ODELAY 0x04 +#define LOG_NDELAY 0x08 +#define LOG_NOWAIT 0x10 +#define LOG_PERROR 0x20 +#define CRF_NOMEMBERD 0x00000001 +#define CRF_MAC_ENFORCE 0x00000002 +#define XUCRED_VERSION 0 +#define DK_FEATURE_BARRIER 0x00000002 +#define DK_FEATURE_PRIORITY 0x00000004 +#define DK_FEATURE_UNMAP 0x00000010 +#define DK_SYNCHRONIZE_OPTION_BARRIER 0x00000002 +#define DK_CORESTORAGE_PIN_YOUR_METADATA 0x00000001 +#define DK_CORESTORAGE_ENABLE_HOTFILES 0x00000002 +#define DK_CORESTORAGE_PIN_YOUR_SWAPFILE 0x00000004 +#define DK_PROVISION_TYPE_MAPPED 0x00 +#define DK_PROVISION_TYPE_DEALLOCATED 0x01 +#define DK_PROVISION_TYPE_ANCHORED 0x02 +#define DK_LOCATION_INTERNAL 0x00000000 +#define DK_LOCATION_EXTERNAL 0x00000001 +#define DK_FEATURE_FORCE_UNIT_ACCESS 0x00000001 +#define DK_ENCRYPTION_TYPE_AES_CBC 1 +#define DK_ENCRYPTION_TYPE_AES_XEX 2 +#define DK_ENCRYPTION_TYPE_AES_XTS 3 +#define DK_TIER_MASK 0xC0 +#define DK_TIER_SHIFT 6 +#define SOL_LOCAL 0 +#define LOCAL_PEERCRED 0x001 +#define LOCAL_PEERPID 0x002 +#define LOCAL_PEEREPID 0x003 +#define LOCAL_PEERUUID 0x004 +#define LOCAL_PEEREUUID 0x005 +#define LOCAL_PEERTOKEN 0x006 +#define _SYS_TIMEX_H_ 1 +#define NTP_API 4 +#define MINSEC 256 +#define MAXSEC 2048 +#define MAXTC 10 +#define MOD_OFFSET 0x0001 +#define MOD_FREQUENCY 0x0002 +#define MOD_MAXERROR 0x0004 +#define MOD_ESTERROR 0x0008 +#define MOD_STATUS 0x0010 +#define MOD_TIMECONST 0x0020 +#define MOD_PPSMAX 0x0040 +#define MOD_TAI 0x0080 +#define MOD_MICRO 0x1000 +#define MOD_NANO 0x2000 +#define MOD_CLKB 0x4000 +#define MOD_CLKA 0x8000 +#define STA_PLL 0x0001 +#define STA_PPSFREQ 0x0002 +#define STA_PPSTIME 0x0004 +#define STA_FLL 0x0008 +#define STA_INS 0x0010 +#define STA_DEL 0x0020 +#define STA_UNSYNC 0x0040 +#define STA_FREQHOLD 0x0080 +#define STA_PPSSIGNAL 0x0100 +#define STA_PPSJITTER 0x0200 +#define STA_PPSWANDER 0x0400 +#define STA_PPSERROR 0x0800 +#define STA_CLOCKERR 0x1000 +#define STA_NANO 0x2000 +#define STA_MODE 0x4000 +#define STA_CLK 0x8000 +#define TIME_OK 0 +#define TIME_INS 1 +#define TIME_DEL 2 +#define TIME_OOP 3 +#define TIME_WAIT 4 +#define TIME_ERROR 5 +#define MT_FREE 0 +#define MT_DATA 1 +#define MT_HEADER 2 +#define MT_SOCKET 3 +#define MT_PCB 4 +#define MT_RTABLE 5 +#define MT_HTABLE 6 +#define MT_ATABLE 7 +#define MT_SONAME 8 +#define MT_SOOPTS 10 +#define MT_FTABLE 11 +#define MT_RIGHTS 12 +#define MT_IFADDR 13 +#define MT_CONTROL 14 +#define MT_OOBDATA 15 +#define MT_TAG 16 +#define MT_MAX 32 +#define MAX_MBUF_CNAME 15 +#define MCS_DISABLED 0 +#define MCS_ONLINE 1 +#define MCS_PURGING 2 +#define MCS_OFFLINE 3 +#define MSG_NOERROR 0010000 +#define MSGSSZ 8 +#define MSGSEG 2048 +#define MSGMNB 2048 +#define MSGMNI 40 +#define MSGTQL 40 +#define MSG_LOCKED 001000 +#define DBG_MACH 1 +#define DBG_NETWORK 2 +#define DBG_FSYSTEM 3 +#define DBG_BSD 4 +#define DBG_IOKIT 5 +#define DBG_DRIVERS 6 +#define DBG_TRACE 7 +#define DBG_DLIL 8 +#define DBG_PTHREAD 9 +#define DBG_CORESTORAGE 10 +#define DBG_CG 11 +#define DBG_MONOTONIC 12 +#define DBG_MISC 20 +#define DBG_SECURITY 30 +#define DBG_DYLD 31 +#define DBG_QT 32 +#define DBG_APPS 33 +#define DBG_LAUNCHD 34 +#define DBG_SILICON 35 +#define DBG_PERF 37 +#define DBG_IMPORTANCE 38 +#define DBG_BANK 40 +#define DBG_XPC 41 +#define DBG_ATM 42 +#define DBG_ARIADNE 43 +#define DBG_DAEMON 44 +#define DBG_ENERGYTRACE 45 +#define DBG_DISPATCH 46 +#define DBG_IMG 49 +#define DBG_UMALLOC 51 +#define DBG_TURNSTILE 53 +#define DBG_AUDIO 54 +#define DBG_MIG 255 +#define DBG_MACH_EXCP_KTRAP_x86 0x02 +#define DBG_MACH_EXCP_DFLT 0x03 +#define DBG_MACH_EXCP_SYNC_ARM 0x03 +#define DBG_MACH_EXCP_IFLT 0x04 +#define DBG_MACH_EXCP_SERR_ARM 0x04 +#define DBG_MACH_EXCP_INTR 0x05 +#define DBG_MACH_EXCP_ALNG 0x06 +#define DBG_MACH_EXCP_UTRAP_x86 0x07 +#define DBG_MACH_EXCP_FP 0x08 +#define DBG_MACH_EXCP_DECI 0x09 +#define DBG_MACH_CHUD 0x0A +#define DBG_MACH_SIGNPOST 0x0A +#define DBG_MACH_EXCP_SC 0x0C +#define DBG_MACH_EXCP_TRACE 0x0D +#define DBG_MACH_EXCP_EMUL 0x0E +#define DBG_MACH_IHDLR 0x10 +#define DBG_MACH_IPC 0x20 +#define DBG_MACH_RESOURCE 0x25 +#define DBG_MACH_VM 0x30 +#define DBG_MACH_LEAKS 0x31 +#define DBG_MACH_WORKINGSET 0x32 +#define DBG_MACH_SCHED 0x40 +#define DBG_MACH_MSGID_INVALID 0x50 +#define DBG_MACH_LOCKS 0x60 +#define DBG_MACH_PMAP 0x70 +#define DBG_MACH_CLOCK 0x80 +#define DBG_MACH_MP 0x90 +#define DBG_MACH_VM_PRESSURE 0xA0 +#define DBG_MACH_STACKSHOT 0xA1 +#define DBG_MACH_SFI 0xA2 +#define DBG_MACH_ENERGY_PERF 0xA3 +#define DBG_MACH_SYSDIAGNOSE 0xA4 +#define DBG_MACH_ZALLOC 0xA5 +#define DBG_MACH_THREAD_GROUP 0xA6 +#define DBG_MACH_COALITION 0xA7 +#define DBG_MACH_SHAREDREGION 0xA8 +#define DBG_MACH_SCHED_CLUTCH 0xA9 +#define DBG_MACH_IO 0xAA +#define DBG_MACH_WORKGROUP 0xAB +#define DBG_MACH_HV 0xAC +#define DBG_MACH_KCOV 0xAD +#define DBG_MACH_MACHDEP_EXCP_SC_x86 0xAE +#define DBG_MACH_MACHDEP_EXCP_SC_ARM 0xAF +#define DBC_MACH_IO_MMIO_READ 0x1 +#define DBC_MACH_IO_MMIO_WRITE 0x2 +#define DBC_MACH_IO_PHYS_READ 0x3 +#define DBC_MACH_IO_PHYS_WRITE 0x4 +#define DBC_MACH_IO_PORTIO_READ 0x5 +#define DBC_MACH_IO_PORTIO_WRITE 0x6 +#define DBG_INTR_TYPE_UNKNOWN 0x0 +#define DBG_INTR_TYPE_IPI 0x1 +#define DBG_INTR_TYPE_TIMER 0x2 +#define DBG_INTR_TYPE_OTHER 0x3 +#define DBG_INTR_TYPE_PMI 0x4 +#define DBG_INTR_TYPE_RSVD1 0x5 +#define MACH_SCHED 0x0 +#define MACH_STACK_ATTACH 0x1 +#define MACH_STACK_HANDOFF 0x2 +#define MACH_CALL_CONT 0x3 +#define MACH_CALLOUT 0x4 +#define MACH_STACK_DETACH 0x5 +#define MACH_MAKE_RUNNABLE 0x6 +#define MACH_PROMOTE 0x7 +#define MACH_DEMOTE 0x8 +#define MACH_IDLE 0x9 +#define MACH_STACK_DEPTH 0xa +#define MACH_MOVED 0xb +#define MACH_PSET_LOAD_AVERAGE 0xc +#define MACH_AMP_DEBUG 0xd +#define MACH_FAILSAFE 0xe +#define MACH_BLOCK 0xf +#define MACH_WAIT 0x10 +#define MACH_GET_URGENCY 0x14 +#define MACH_URGENCY 0x15 +#define MACH_REDISPATCH 0x16 +#define MACH_REMOTE_AST 0x17 +#define MACH_SCHED_CHOOSE_PROCESSOR 0x18 +#define MACH_DEEP_IDLE 0x19 +#define MACH_CPU_THROTTLE_DISABLE 0x1b +#define MACH_RW_PROMOTE 0x1c +#define MACH_RW_DEMOTE 0x1d +#define MACH_SCHED_MAINTENANCE 0x1f +#define MACH_DISPATCH 0x20 +#define MACH_QUANTUM_HANDOFF 0x21 +#define MACH_MULTIQ_DEQUEUE 0x22 +#define MACH_SCHED_THREAD_SWITCH 0x23 +#define MACH_SCHED_SMT_BALANCE 0x24 +#define MACH_REMOTE_DEFERRED_AST 0x25 +#define MACH_REMOTE_CANCEL_AST 0x26 +#define MACH_SCHED_CHANGE_PRIORITY 0x27 +#define MACH_SCHED_UPDATE_REC_CORES 0x28 +#define MACH_STACK_WAIT 0x29 +#define MACH_THREAD_BIND 0x2a +#define MACH_WAITQ_PROMOTE 0x2b +#define MACH_WAITQ_DEMOTE 0x2c +#define MACH_SCHED_LOAD 0x2d +#define MACH_REC_CORES_FAILSAFE 0x2e +#define MACH_SCHED_QUANTUM_EXPIRED 0x2f +#define MACH_EXEC_PROMOTE 0x30 +#define MACH_EXEC_DEMOTE 0x31 +#define MACH_AMP_SIGNAL_SPILL 0x32 +#define MACH_AMP_STEAL 0x33 +#define MACH_SCHED_LOAD_EFFECTIVE 0x34 +#define MACH_QUIESCENT_COUNTER 0x38 +#define MACH_TURNSTILE_USER_CHANGE 0x39 +#define MACH_AMP_RECOMMENDATION_CHANGE 0x3a +#define MACH_AMP_PERFCTL_POLICY_CHANGE 0x3b +#define MACH_TURNSTILE_KERNEL_CHANGE 0x40 +#define MACH_SCHED_WI_AUTO_JOIN 0x41 +#define MACH_SCHED_WI_DEFERRED_FINISH 0x42 +#define MACH_SET_RT_DEADLINE 0x43 +#define MACH_CANCEL_RT_DEADLINE 0x44 +#define MACH_RT_SIGNAL_SPILL 0x45 +#define MACH_RT_STEAL 0x46 +#define MACH_PENDING_AST_URGENT 0x47 +#define MACH_SCHED_THREAD_SELECT 0x48 +#define MACH_SCHED_NEXT_PROCESSOR 0x49 +#define MACH_PSET_AVG_EXEC_TIME 0x50 +#define MACH_SUSPEND_USERSPACE 0x51 +#define MACH_PREEMPTION_EXPIRED 0x52 +#define MACH_FLOOR_PROMOTE 0x53 +#define MACH_FLOOR_DEMOTE 0x54 +#define MACH_INT_MASKED_EXPIRED 0x55 +#define MACH_INT_HANDLED_EXPIRED 0x56 +#define MACH_UPDATE_POWERED_CORES 0x58 +#define MACH_MODE_DEMOTE_THROTTLED 0x59 +#define MACH_MODE_DEMOTE_FAILSAFE 0x5a +#define MACH_MODE_DEMOTE_RT_DISALLOWED 0x5b +#define MACH_MODE_UNDEMOTE_THROTTLED 0x5c +#define MACH_MODE_UNDEMOTE_FAILSAFE 0x5d +#define MACH_MODE_UNDEMOTE_RT_DISALLOWED 0x5e +#define MACH_INT_MASKED_RESET 0x5f +#define MACH_RT_DISALLOWED_WORK_INTERVAL 0x60 +#define MACH_SCHED_WI_EXTERNAL_WAKEUP 0x61 +#define MACH_SCHED_AST_CHECK 0x62 +#define MACH_SCHED_PREEMPT_TIMER_ACTIVE 0x63 +#define MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE 0x0 +#define MACH_SCHED_CLUTCH_TG_BUCKET_STATE 0x1 +#define MACH_SCHED_CLUTCH_THREAD_SELECT 0x2 +#define MACH_SCHED_CLUTCH_THREAD_STATE 0x3 +#define MACH_SCHED_CLUTCH_TG_BUCKET_PRI 0x4 +#define MACH_SCHED_EDGE_CLUSTER_OVERLOAD 0x5 +#define MACH_SCHED_EDGE_STEAL 0x6 +#define MACH_SCHED_EDGE_REBAL_RUNNABLE 0x7 +#define MACH_SCHED_EDGE_REBAL_RUNNING 0x8 +#define MACH_SCHED_EDGE_SHOULD_YIELD 0x9 +#define MACH_SCHED_CLUTCH_THR_COUNT 0xa +#define MACH_SCHED_EDGE_LOAD_AVG 0xb +#define MACH_SCHED_EDGE_CLUSTER_SHARED_LOAD 0xc +#define MACH_SCHED_EDGE_RSRC_HEAVY_THREAD 0xd +#define MACH_SCHED_EDGE_SHARED_RSRC_MIGRATE 0xe +#define WORKGROUP_INTERVAL_CREATE 0x0 +#define WORKGROUP_INTERVAL_DESTROY 0x1 +#define WORKGROUP_INTERVAL_CHANGE 0x2 +#define WORKGROUP_INTERVAL_START 0x3 +#define WORKGROUP_INTERVAL_UPDATE 0x4 +#define WORKGROUP_INTERVAL_FINISH 0x5 +#define WORKGROUP_INTERVAL_SET_WORKLOAD_ID 0x6 +#define WORKGROUP_INTERVAL_SET_WORKLOAD_ID_NAME 0x7 +#define KCOV_STKSZ_THRESHOLD_ABOVE 0x0 +#define KCOV_STKSZ_THRESHOLD_BELOW 0x1 +#define MACH_MULTIQ_BOUND 1 +#define MACH_MULTIQ_GROUP 2 +#define MACH_MULTIQ_GLOBAL 3 +#define DBG_ZERO_FILL_FAULT 1 +#define DBG_PAGEIN_FAULT 2 +#define DBG_COW_FAULT 3 +#define DBG_CACHE_HIT_FAULT 4 +#define DBG_NZF_PAGE_FAULT 5 +#define DBG_GUARD_FAULT 6 +#define DBG_PAGEINV_FAULT 7 +#define DBG_PAGEIND_FAULT 8 +#define DBG_COMPRESSOR_FAULT 9 +#define DBG_COMPRESSOR_SWAPIN_FAULT 10 +#define DBG_COR_FAULT 11 +#define MACH_TASK_SUSPEND 0x0 +#define MACH_TASK_RESUME 0x1 +#define MACH_THREAD_SET_VOUCHER 0x2 +#define MACH_IPC_MSG_SEND 0x3 +#define MACH_IPC_MSG_RECV 0x4 +#define MACH_IPC_MSG_RECV_VOUCHER_REFUSED 0x5 +#define MACH_IPC_KMSG_FREE 0x6 +#define MACH_IPC_VOUCHER_CREATE 0x7 +#define MACH_IPC_VOUCHER_CREATE_ATTR_DATA 0x8 +#define MACH_IPC_VOUCHER_DESTROY 0x9 +#define MACH_IPC_KMSG_INFO 0xa +#define MACH_IPC_KMSG_LINK 0xb +#define MACH_IPC_PORT_ENTRY_MODIFY 0xc +#define MACH_IPC_DESTROY_GUARDED_DESC 0xd +#define MACH_THREAD_GROUP_NEW 0x0 +#define MACH_THREAD_GROUP_FREE 0x1 +#define MACH_THREAD_GROUP_SET 0x2 +#define MACH_THREAD_GROUP_NAME 0x3 +#define MACH_THREAD_GROUP_NAME_FREE 0x4 +#define MACH_THREAD_GROUP_FLAGS 0x5 +#define MACH_THREAD_GROUP_BLOCK 0x6 +#define MACH_THREAD_GROUP_PREADOPT 0x7 +#define MACH_THREAD_GROUP_PREADOPT_NEXTTIME 0x8 +#define MACH_THREAD_GROUP_PREADOPT_CLEAR 0x9 +#define MACH_THREAD_GROUP_PREADOPT_NA 0xa +#define MACH_COALITION_NEW 0x0 +#define MACH_COALITION_FREE 0x1 +#define MACH_COALITION_ADOPT 0x2 +#define MACH_COALITION_REMOVE 0x3 +#define MACH_COALITION_THREAD_GROUP_SET 0x4 +#define PMAP__CREATE 0x0 +#define PMAP__DESTROY 0x1 +#define PMAP__PROTECT 0x2 +#define PMAP__PAGE_PROTECT 0x3 +#define PMAP__ENTER 0x4 +#define PMAP__REMOVE 0x5 +#define PMAP__NEST 0x6 +#define PMAP__UNNEST 0x7 +#define PMAP__FLUSH_TLBS 0x8 +#define PMAP__UPDATE_INTERRUPT 0x9 +#define PMAP__ATTRIBUTE_CLEAR 0xa +#define PMAP__REUSABLE 0xb +#define PMAP__QUERY_RESIDENT 0xc +#define PMAP__FLUSH_KERN_TLBS 0xd +#define PMAP__FLUSH_DELAYED_TLBS 0xe +#define PMAP__FLUSH_TLBS_TO 0xf +#define PMAP__FLUSH_EPT 0x10 +#define PMAP__FAST_FAULT 0x11 +#define PMAP__SWITCH 0x12 +#define PMAP__TTE 0x13 +#define PMAP__SWITCH_USER_TTB 0x14 +#define PMAP__UPDATE_CACHING 0x15 +#define PMAP__ATTRIBUTE_CLEAR_RANGE 0x16 +#define PMAP__CLEAR_USER_TTB 0x17 +#define PMAP__IOMMU_INIT 0x18 +#define PMAP__IOMMU_IOVMALLOC 0x19 +#define PMAP__IOMMU_IOVMFREE 0x1a +#define PMAP__IOMMU_MAP 0x1b +#define PMAP__IOMMU_UNMAP 0x1c +#define PMAP__IOMMU_IOCTL 0x1d +#define PMAP__IOMMU_GRANT_PAGE 0x1e +#define PMAP__BATCH_UPDATE_CACHING 0x1f +#define PMAP__COLLECT_CACHE_OPS 0x20 +#define MACH_EPOCH_CHANGE 0x0 +#define MACH_BRIDGE_RCV_TS 0x1 +#define MACH_BRIDGE_REMOTE_TIME 0x2 +#define MACH_BRIDGE_RESET_TS 0x3 +#define MACH_BRIDGE_TS_PARAMS 0x4 +#define MACH_BRIDGE_SKIP_TS 0x5 +#define MACH_BRIDGE_TS_MISMATCH 0x6 +#define MACH_BRIDGE_OBSV_RATE 0x7 +#define MICROSTACKSHOT_RECORD 0x0 +#define MICROSTACKSHOT_GATHER 0x1 +#define STACKSHOT_RECORD 0x2 +#define STACKSHOT_RECORD_SHORT 0x3 +#define STACKSHOT_KERN_RECORD 0x4 +#define SYSDIAGNOSE_NOTIFY_USER 0x0 +#define SYSDIAGNOSE_FULL 0x1 +#define SYSDIAGNOSE_STACKSHOT 0x2 +#define SYSDIAGNOSE_TAILSPIN 0x3 +#define SFI_SET_WINDOW 0x0 +#define SFI_CANCEL_WINDOW 0x1 +#define SFI_SET_CLASS_OFFTIME 0x2 +#define SFI_CANCEL_CLASS_OFFTIME 0x3 +#define SFI_THREAD_DEFER 0x4 +#define SFI_OFF_TIMER 0x5 +#define SFI_ON_TIMER 0x6 +#define SFI_WAIT_CANCELED 0x7 +#define SFI_PID_SET_MANAGED 0x8 +#define SFI_PID_CLEAR_MANAGED 0x9 +#define SFI_GLOBAL_DEFER 0xa +#define ZALLOC_ZCRAM 0x0 +#define RMON_ENABLE_CPUUSAGE_MONITOR 0x001 +#define RMON_CPUUSAGE_VIOLATED 0x002 +#define RMON_CPUUSAGE_SUSPENDED 0x003 +#define RMON_CPUUSAGE_VIOLATED_K32A 0x004 +#define RMON_CPUUSAGE_VIOLATED_K32B 0x005 +#define RMON_CPUUSAGE_RESUMED 0x006 +#define RMON_DISABLE_CPUUSAGE_MONITOR 0x00f +#define RMON_ENABLE_CPUWAKES_MONITOR 0x011 +#define RMON_CPUWAKES_VIOLATED 0x012 +#define RMON_CPUWAKES_VIOLATED_K32A 0x014 +#define RMON_CPUWAKES_VIOLATED_K32B 0x015 +#define RMON_DISABLE_CPUWAKES_MONITOR 0x01f +#define RMON_ENABLE_IO_MONITOR 0x021 +#define RMON_LOGWRITES_VIOLATED 0x022 +#define RMON_PHYSWRITES_VIOLATED 0x023 +#define RMON_LOGWRITES_VIOLATED_K32A 0x024 +#define RMON_LOGWRITES_VIOLATED_K32B 0x025 +#define RMON_DISABLE_IO_MONITOR 0x02f +#define HV_X86_ENTER 0x00 +#define HV_X86_ENTER_ERROR 0x01 +#define HV_X86_TRAP_TASK 0x02 +#define HV_X86_TRAP_THREAD 0x03 +#define HV_X86_INTERRUPT_INJECT 0x04 +#define HV_X86_INTERRUPT_RECV 0x05 +#define HV_X86_INTERRUPT_SEND 0x06 +#define HV_X86_IPI_SEND 0x07 +#define HV_X86_NMI_INJECT 0x08 +#define HV_X86_NMI_SEND 0x09 +#define HV_X86_LSC_HIT 0x0a +#define HV_X86_LSC_INSERT 0x0b +#define HV_X86_LSC_INSERT_IMM32 0x0c +#define HV_X86_LSC_INVALID 0x0d +#define HV_X86_LSC_INVALIDATE 0x0e +#define HV_X86_LSC_MISS 0x0f +#define HV_X86_TIMER_CANCEL 0x10 +#define HV_X86_TIMER_FIRE 0x11 +#define HV_X86_TIMER_SCHEDULE 0x12 +#define HV_X86_APIC_ACCESS_EXIT 0x13 +#define HV_X86_APIC_WRITE_EXIT 0x14 +#define HV_X86_EPT_VIOLATION_EXIT 0x15 +#define HV_X86_EXC_NMI_EXIT 0x16 +#define HV_X86_HLT_EXIT 0x17 +#define HV_X86_IO_EXIT 0x18 +#define HV_X86_IRQ_EXIT 0x19 +#define HV_X86_IRQ_WND_EXIT 0x1a +#define HV_X86_MOV_DR_EXIT 0x1b +#define HV_X86_NMI_WND_EXIT 0x1c +#define HV_X86_RDMSR_EXIT 0x1d +#define HV_X86_RDPMC_EXIT 0x1e +#define HV_X86_TPR_THRESHOLD_EXIT 0x1f +#define HV_X86_VMX_TIMER_EXPIRED_EXIT 0x20 +#define HV_X86_WRMSR_EXIT 0x21 +#define HV_X86_VCPU_READ_APIC_TRAP 0x22 +#define HV_X86_VCPU_READ_VMCS_TRAP 0x23 +#define HV_X86_VCPU_RUN_TRAP 0x24 +#define HV_X86_VCPU_RUN_UNTIL_TRAP 0x25 +#define HV_X86_VCPU_WRITE_APIC_TRAP 0x26 +#define HV_X86_VM_ADDRSPACE_CREATE_TRAP 0x27 +#define HV_X86_VM_ADDRSPACE_DESTROY_TRAP 0x28 +#define HV_X86_VM_INTR_MSI_TRAP 0x29 +#define HV_X86_VM_MAP_TRAP 0x2a +#define HV_X86_VM_PROTECT_TRAP 0x2b +#define HV_X86_VM_UNMAP_TRAP 0x2c +#define HV_X86_TSC_OFFSET_SET 0x2d +#define DBG_NETIP 1 +#define DBG_NETARP 2 +#define DBG_NETUDP 3 +#define DBG_NETTCP 4 +#define DBG_NETICMP 5 +#define DBG_NETIGMP 6 +#define DBG_NETRIP 7 +#define DBG_NETOSPF 8 +#define DBG_NETISIS 9 +#define DBG_NETSNMP 10 +#define DBG_NETSOCK 11 +#define DBG_NETAARP 100 +#define DBG_NETDDP 101 +#define DBG_NETNBP 102 +#define DBG_NETZIP 103 +#define DBG_NETADSP 104 +#define DBG_NETATP 105 +#define DBG_NETASP 106 +#define DBG_NETAFP 107 +#define DBG_NETRTMP 108 +#define DBG_NETAURP 109 +#define DBG_NETIPSEC 128 +#define DBG_NETVMNET 129 +#define DBG_IOINTC 0 +#define DBG_IOWORKLOOP 1 +#define DBG_IOINTES 2 +#define DBG_IOCLKES 3 +#define DBG_IOCMDQ 4 +#define DBG_IOMCURS 5 +#define DBG_IOMDESC 6 +#define DBG_IOPOWER 7 +#define DBG_IOSERVICE 8 +#define DBG_IOREGISTRY 9 +#define DBG_IOPORT 10 +#define DBG_IOSTORAGE 32 +#define DBG_IONETWORK 33 +#define DBG_IOKEYBOARD 34 +#define DBG_IOHID 35 +#define DBG_IOAUDIO 36 +#define DBG_IOSERIAL 37 +#define DBG_IOTTY 38 +#define DBG_IOSAM 39 +#define DBG_IOPARALLELATA 40 +#define DBG_IOPARALLELSCSI 41 +#define DBG_IOSATA 42 +#define DBG_IOSAS 43 +#define DBG_IOFIBRECHANNEL 44 +#define DBG_IOUSB 45 +#define DBG_IOBLUETOOTH 46 +#define DBG_IOFIREWIRE 47 +#define DBG_IOINFINIBAND 48 +#define DBG_IOCPUPM 49 +#define DBG_IOGRAPHICS 50 +#define DBG_HIBERNATE 51 +#define DBG_IOTHUNDERBOLT 52 +#define DBG_BOOTER 53 +#define DBG_IOAUDIO2 54 +#define DBG_IOAFK 55 +#define DBG_IOSURFACEPA 64 +#define DBG_IOMDPA 65 +#define DBG_IODARTPA 66 +#define DBG_DRVSTORAGE 1 +#define DBG_DRVNETWORK 2 +#define DBG_DRVKEYBOARD 3 +#define DBG_DRVHID 4 +#define DBG_DRVAUDIO 5 +#define DBG_DRVSERIAL 7 +#define DBG_DRVSAM 8 +#define DBG_DRVPARALLELATA 9 +#define DBG_DRVPARALLELSCSI 10 +#define DBG_DRVSATA 11 +#define DBG_DRVSAS 12 +#define DBG_DRVFIBRECHANNEL 13 +#define DBG_DRVUSB 14 +#define DBG_DRVBLUETOOTH 15 +#define DBG_DRVFIREWIRE 16 +#define DBG_DRVINFINIBAND 17 +#define DBG_DRVGRAPHICS 18 +#define DBG_DRVSD 19 +#define DBG_DRVNAND 20 +#define DBG_SSD 21 +#define DBG_DRVSPI 22 +#define DBG_DRVWLAN_802_11 23 +#define DBG_DRVSSM 24 +#define DBG_DRVSMC 25 +#define DBG_DRVMACEFIMANAGER 26 +#define DBG_DRVANE 27 +#define DBG_DRVETHERNET 28 +#define DBG_DRVMCC 29 +#define DBG_DRVACCESSORY 30 +#define DBG_SOCDIAGS 31 +#define DBG_DRVVIRTIO 32 +#define DBG_DRVCELLULAR 33 +#define DBG_DRVSPMI 34 +#define DBG_DLIL_STATIC 1 +#define DBG_DLIL_PR_MOD 2 +#define DBG_DLIL_IF_MOD 3 +#define DBG_DLIL_PR_FLT 4 +#define DBG_DLIL_IF_FLT 5 +#define DBG_FSRW 0x1 +#define DBG_DKRW 0x2 +#define DBG_FSVN 0x3 +#define DBG_FSLOOOKUP 0x4 +#define DBG_JOURNAL 0x5 +#define DBG_IOCTL 0x6 +#define DBG_BOOTCACHE 0x7 +#define DBG_HFS 0x8 +#define DBG_APFS 0x9 +#define DBG_SMB 0xA +#define DBG_MOUNT 0xB +#define DBG_EXFAT 0xE +#define DBG_MSDOS 0xF +#define DBG_ACFS 0x10 +#define DBG_THROTTLE 0x11 +#define DBG_DECMP 0x12 +#define DBG_VFS 0x13 +#define DBG_LIVEFS 0x14 +#define DBG_NFS 0x15 +#define DBG_CONTENT_PROT 0xCF +#define DBG_HFS_UPDATE_ACCTIME 0x01 +#define DBG_HFS_UPDATE_MODTIME 0x02 +#define DBG_HFS_UPDATE_CHGTIME 0x04 +#define DBG_HFS_UPDATE_MODIFIED 0x08 +#define DBG_HFS_UPDATE_FORCE 0x10 +#define DBG_HFS_UPDATE_DATEADDED 0x20 +#define DBG_HFS_UPDATE_MINOR 0x40 +#define DBG_HFS_UPDATE_SKIPPED 0x80 +#define DBG_VFS_IO_COMPRESSION_STATS 0x1000 +#define DBG_BSD_PROC 0x01 +#define DBG_BSD_MEMSTAT 0x02 +#define DBG_BSD_KEVENT 0x03 +#define DBG_BSD_EXCP_SC 0x0C +#define DBG_BSD_AIO 0x0D +#define DBG_BSD_SC_EXTENDED_INFO 0x0E +#define DBG_BSD_SC_EXTENDED_INFO2 0x0F +#define DBG_BSD_KDEBUG_TEST 0xFF +#define BSD_PROC_EXIT 1 +#define BSD_PROC_FRCEXIT 2 +#define BSD_PROC_EXEC 3 +#define BSD_PROC_EXITREASON_CREATE 4 +#define BSD_PROC_EXITREASON_COMMIT 5 +#define BSD_MEMSTAT_SCAN 1 +#define BSD_MEMSTAT_JETSAM 2 +#define BSD_MEMSTAT_JETSAM_HIWAT 3 +#define BSD_MEMSTAT_FREEZE 4 +#define BSD_MEMSTAT_FREEZE_SCAN 5 +#define BSD_MEMSTAT_UPDATE 6 +#define BSD_MEMSTAT_IDLE_DEMOTE 7 +#define BSD_MEMSTAT_CLEAR_ERRORS 8 +#define BSD_MEMSTAT_DIRTY_TRACK 9 +#define BSD_MEMSTAT_DIRTY_SET 10 +#define BSD_MEMSTAT_DIRTY_CLEAR 11 +#define BSD_MEMSTAT_FAST_JETSAM 15 +#define BSD_MEMSTAT_COMPACTOR_RUN 16 +#define BSD_MEMSTAT_FREEZE_DISABLE 17 +#define BSD_MEMSTAT_RELAUNCH_FLAGS 18 +#define BSD_KEVENT_KQ_PROCESS_BEGIN 1 +#define BSD_KEVENT_KQ_PROCESS_END 2 +#define BSD_KEVENT_KQWQ_PROCESS_BEGIN 3 +#define BSD_KEVENT_KQWQ_PROCESS_END 4 +#define BSD_KEVENT_KQWQ_BIND 5 +#define BSD_KEVENT_KQWQ_UNBIND 6 +#define BSD_KEVENT_KQWQ_THREQUEST 7 +#define BSD_KEVENT_KQWL_PROCESS_BEGIN 8 +#define BSD_KEVENT_KQWL_PROCESS_END 9 +#define BSD_KEVENT_KQWL_THREQUEST 10 +#define BSD_KEVENT_KQWL_THADJUST 11 +#define BSD_KEVENT_KQ_REGISTER 12 +#define BSD_KEVENT_KQWQ_REGISTER 13 +#define BSD_KEVENT_KQWL_REGISTER 14 +#define BSD_KEVENT_KNOTE_ACTIVATE 15 +#define BSD_KEVENT_KQ_PROCESS 16 +#define BSD_KEVENT_KQWQ_PROCESS 17 +#define BSD_KEVENT_KQWL_PROCESS 18 +#define BSD_KEVENT_KQWL_BIND 19 +#define BSD_KEVENT_KQWL_UNBIND 20 +#define BSD_KEVENT_KNOTE_ENABLE 21 +#define BSD_KEVENT_KNOTE_VANISHED 22 +#define DBG_TRACE_DATA 0 +#define DBG_TRACE_STRING 1 +#define DBG_TRACE_INFO 2 +#define DBG_CS_IO 0 +#define DBG_SEC_KERNEL 0 +#define DBG_SEC_SANDBOX 1 +#define DBG_MT_INSTRS_CYCLES 1 +#define DBG_MT_DEBUG 2 +#define DBG_MT_RESOURCES_PROC_EXIT 3 +#define DBG_MT_RESOURCES_THR_EXIT 4 +#define DBG_MT_INSTRS_CYCLES_ON_CPU 5 +#define DBG_MT_TMPTH 0xfe +#define DBG_MT_TMPCPU 0xff +#define DBG_MISC_COREBRIGHTNESS 0x01 +#define DBG_MISC_VIDEOENG 0x02 +#define DBG_EVENT 0x10 +#define DBG_MISC_INSTRUMENTS 0x11 +#define DBG_MISC_INSTRUMENTSBT 0x12 +#define DBG_MISC_RUNLOOP_DETAILS 0x13 +#define DBG_MISC_RUNLOOP_BUSY 0x14 +#define DBG_MISC_LAYOUT 0x1a +#define DBG_BUFFER 0x20 +#define DKIO_DONE 0x01 +#define DKIO_READ 0x02 +#define DKIO_ASYNC 0x04 +#define DKIO_META 0x08 +#define DKIO_PAGING 0x10 +#define DKIO_THROTTLE 0x20 +#define DKIO_PASSIVE 0x40 +#define DKIO_NOCACHE 0x80 +#define DKIO_TIER_MASK 0xF00 +#define DKIO_TIER_SHIFT 8 +#define DKIO_TIER_UPGRADE 0x1000 +#define DBG_APP_LOGINWINDOW 0x03 +#define DBG_APP_AUDIO 0x04 +#define DBG_APP_SYSTEMUI 0x05 +#define DBG_APP_SIGNPOST 0x0A +#define DBG_APP_TAL 0x0B +#define DBG_APP_APPKIT 0x0C +#define DBG_APP_UIKIT 0x0D +#define DBG_APP_DFR 0x0E +#define DBG_APP_LAYOUT 0x0F +#define DBG_APP_COREDATA 0x10 +#define DBG_APP_RUNLOOP_BASIC 0x11 +#define DBG_APP_RUNLOOP_ADVANCED 0x12 +#define DBG_APP_SAMBA 0x80 +#define DBG_APP_EOSSUPPORT 0x81 +#define DBG_APP_MACEFIMANAGER 0x82 +#define DBG_APP_ENTERPRISE 0x83 +#define OPEN_THROTTLE_WINDOW 0x1 +#define PROCESS_THROTTLED 0x2 +#define IO_THROTTLE_DISABLE 0x3 +#define IO_TIER_UPL_MISMATCH 0x4 +#define IMP_ASSERTION 0x10 +#define IMP_BOOST 0x11 +#define IMP_MSG 0x12 +#define IMP_WATCHPORT 0x13 +#define IMP_TASK_SUPPRESSION 0x17 +#define IMP_TASK_APPTYPE 0x18 +#define IMP_UPDATE 0x19 +#define IMP_USYNCH_QOS_OVERRIDE 0x1A +#define IMP_DONOR_CHANGE 0x1B +#define IMP_MAIN_THREAD_QOS 0x1C +#define IMP_SYNC_IPC_QOS 0x1D +#define IMP_TASK_POLICY_DARWIN_BG 0x21 +#define IMP_TASK_POLICY_IOPOL 0x22 +#define IMP_TASK_POLICY_IO 0x23 +#define IMP_TASK_POLICY_PASSIVE_IO 0x24 +#define IMP_TASK_POLICY_DARWIN_BG_IOPOL 0x27 +#define IMP_TASK_POLICY_BOOST 0x29 +#define IMP_TASK_POLICY_ROLE 0x2A +#define IMP_TASK_POLICY_TERMINATED 0x2C +#define IMP_TASK_POLICY_NEW_SOCKETS_BG 0x2D +#define IMP_TASK_POLICY_SUP_ACTIVE 0x2E +#define IMP_TASK_POLICY_LATENCY_QOS 0x2F +#define IMP_TASK_POLICY_THROUGH_QOS 0x30 +#define IMP_TASK_POLICY_WATCHERS_BG 0x31 +#define IMP_TASK_POLICY_SFI_MANAGED 0x34 +#define IMP_TASK_POLICY_ALL_SOCKETS_BG 0x37 +#define IMP_TASK_POLICY_BASE_LATENCY_AND_THROUGHPUT_QOS 0x39 +#define IMP_TASK_POLICY_OVERRIDE_LATENCY_AND_THROUGHPUT_QOS 0x3A +#define IMP_TASK_POLICY_PIDBIND_BG 0x32 +#define IMP_TASK_POLICY_QOS_OVERRIDE 0x36 +#define IMP_TASK_POLICY_QOS_AND_RELPRIO 0x38 +#define IMP_TASK_POLICY_QOS_WORKQ_OVERRIDE 0x3B +#define IMP_TASK_POLICY_QOS_PROMOTE 0x3C +#define IMP_TASK_POLICY_QOS_KEVENT_OVERRIDE 0x3D +#define IMP_TASK_POLICY_QOS_SERVICER_OVERRIDE 0x3E +#define IMP_TASK_POLICY_IOTIER_KEVENT_OVERRIDE 0x3F +#define IMP_TASK_POLICY_WI_DRIVEN 0x40 +#define IMP_HOLD 0x2 +#define IMP_DROP 0x4 +#define IMP_EXTERN 0x8 +#define IMP_BOOSTED 0x1 +#define IMP_UNBOOSTED 0x2 +#define IMP_MSG_SEND 0x1 +#define IMP_MSG_DELV 0x2 +#define IMP_UPDATE_TASK_CREATE 0x1 +#define IMP_USYNCH_ADD_OVERRIDE 0x0 +#define IMP_USYNCH_REMOVE_OVERRIDE 0x1 +#define IMP_DONOR_UPDATE_LIVE_DONOR_STATE 0x0 +#define IMP_DONOR_INIT_DONOR_STATE 0x1 +#define IMP_SYNC_IPC_QOS_APPLIED 0x0 +#define IMP_SYNC_IPC_QOS_REMOVED 0x1 +#define IMP_SYNC_IPC_QOS_OVERFLOW 0x2 +#define IMP_SYNC_IPC_QOS_UNDERFLOW 0x3 +#define TURNSTILE_HEAP_OPERATIONS 0x10 +#define TURNSTILE_PRIORITY_OPERATIONS 0x20 +#define TURNSTILE_FREELIST_OPERATIONS 0x30 +#define THREAD_ADDED_TO_TURNSTILE_WAITQ 0x1 +#define THREAD_REMOVED_FROM_TURNSTILE_WAITQ 0x2 +#define THREAD_MOVED_IN_TURNSTILE_WAITQ 0x3 +#define TURNSTILE_ADDED_TO_TURNSTILE_HEAP 0x4 +#define TURNSTILE_REMOVED_FROM_TURNSTILE_HEAP 0x5 +#define TURNSTILE_MOVED_IN_TURNSTILE_HEAP 0x6 +#define TURNSTILE_ADDED_TO_THREAD_HEAP 0x7 +#define TURNSTILE_REMOVED_FROM_THREAD_HEAP 0x8 +#define TURNSTILE_MOVED_IN_THREAD_HEAP 0x9 +#define TURNSTILE_UPDATE_STOPPED_BY_LIMIT 0xa +#define THREAD_NOT_WAITING_ON_TURNSTILE 0xb +#define TURNSTILE_PRIORITY_CHANGE 0x1 +#define THREAD_USER_PROMOTION_CHANGE 0x2 +#define TURNSTILE_PREPARE 0x1 +#define TURNSTILE_COMPLETE 0x2 +#define BANK_ACCOUNT_INFO 0x10 +#define BANK_TASK_INFO 0x11 +#define ATM_SUBAID_INFO 0x10 +#define ATM_GETVALUE_INFO 0x20 +#define ATM_UNREGISTER_INFO 0x30 +#define BANK_SETTLE_CPU_TIME 0x1 +#define BANK_SECURE_ORIGINATOR_CHANGED 0x2 +#define BANK_SETTLE_ENERGY 0x3 +#define ATM_MIN_CALLED 0x1 +#define ATM_LINK_LIST_TRIM 0x2 +#define ATM_VALUE_REPLACED 0x1 +#define ATM_VALUE_ADDED 0x2 +#define ATM_VALUE_UNREGISTERED 0x1 +#define ATM_VALUE_DIFF_MAILBOX 0x2 +#define DBG_DAEMON_COREDUET 0x1 +#define DBG_DAEMON_POWERD 0x2 +#define DBG_UMALLOC_EXTERNAL 0x1 +#define DBG_UMALLOC_INTERNAL 0x2 +#define BSD 199506 +#define BSD4_3 1 +#define BSD4_4 1 +#define NeXTBSD 1995064 +#define NeXTBSD4_0 0 +#define MAXCOMLEN 16 +#define MAXINTERP 64 +#define MAXLOGNAME 255 +#define NOFILE 256 +#define NOGROUP 65535 +#define MAXHOSTNAMELEN 256 +#define MAXDOMNAMELEN 256 +#define PSWP 0 +#define PVM 4 +#define PINOD 8 +#define PRIBIO 16 +#define PVFS 20 +#define PZERO 22 +#define PSOCK 24 +#define PWAIT 32 +#define PLOCK 36 +#define PPAUSE 40 +#define PUSER 50 +#define MAXPRI 127 +#define PRIMASK 0x0ff +#define PCATCH 0x100 +#define PTTYBLOCK 0x200 +#define PDROP 0x400 +#define PSPIN 0x800 +#define CMASK 0022 +#define CBLOCK 64 +#define MAXFRAG 8 +#define MAXSYMLINKS 32 +#define FSHIFT 11 +#define LF_NOT_BOOSTED 0 +#define LF_BOOSTED 1 +#define PSHMNAMLEN 31 +#define SHM_RDONLY 0010000 +#define SHM_RND 0020000 +#define SHMLBA 4096 +#define TIOCM_LE 00001 +#define TIOCM_DTR 00002 +#define TIOCM_RTS 00004 +#define TIOCM_ST 00010 +#define TIOCM_SR 00020 +#define TIOCM_CTS 00040 +#define TIOCM_CAR 00100 +#define TIOCM_RNG 00200 +#define TIOCM_DSR 00400 +#define TIOCPKT_DATA 0x00 +#define TIOCPKT_FLUSHREAD 0x01 +#define TIOCPKT_FLUSHWRITE 0x02 +#define TIOCPKT_STOP 0x04 +#define TIOCPKT_START 0x08 +#define TIOCPKT_NOSTOP 0x10 +#define TIOCPKT_DOSTOP 0x20 +#define TIOCPKT_IOCTL 0x40 +#define TTYDISC 0 +#define TABLDISC 3 +#define SLIPDISC 4 +#define PPPDISC 5 +#define CTL_MAXNAME 12 +#define CTLTYPE 0xf +#define CTLTYPE_NODE 1 +#define CTLTYPE_INT 2 +#define CTLTYPE_STRING 3 +#define CTLTYPE_QUAD 4 +#define CTLTYPE_OPAQUE 5 +#define CTLFLAG_RD 0x80000000 +#define CTLFLAG_WR 0x40000000 +#define CTLFLAG_NOLOCK 0x20000000 +#define CTLFLAG_ANYBODY 0x10000000 +#define CTLFLAG_SECURE 0x08000000 +#define CTLFLAG_MASKED 0x04000000 +#define CTLFLAG_NOAUTO 0x02000000 +#define CTLFLAG_KERN 0x01000000 +#define CTLFLAG_LOCKED 0x00800000 +#define CTLFLAG_OID2 0x00400000 +#define CTLFLAG_EXPERIMENT 0x00100000 +#define OID_AUTO_START 100 +#define SYSCTL_OID_VERSION 1 +#define SYSCTL_SKMEM 1 +#define CTL_UNSPEC 0 +#define CTL_KERN 1 +#define CTL_VM 2 +#define CTL_VFS 3 +#define CTL_NET 4 +#define CTL_DEBUG 5 +#define CTL_HW 6 +#define CTL_MACHDEP 7 +#define CTL_USER 8 +#define CTL_MAXID 9 +#define KERN_OSTYPE 1 +#define KERN_OSRELEASE 2 +#define KERN_OSREV 3 +#define KERN_VERSION 4 +#define KERN_MAXVNODES 5 +#define KERN_MAXPROC 6 +#define KERN_MAXFILES 7 +#define KERN_ARGMAX 8 +#define KERN_SECURELVL 9 +#define KERN_HOSTNAME 10 +#define KERN_HOSTID 11 +#define KERN_CLOCKRATE 12 +#define KERN_VNODE 13 +#define KERN_PROC 14 +#define KERN_FILE 15 +#define KERN_PROF 16 +#define KERN_POSIX1 17 +#define KERN_NGROUPS 18 +#define KERN_JOB_CONTROL 19 +#define KERN_SAVED_IDS 20 +#define KERN_BOOTTIME 21 +#define KERN_NISDOMAINNAME 22 +#define KERN_MAXPARTITIONS 23 +#define KERN_KDEBUG 24 +#define KERN_UPDATEINTERVAL 25 +#define KERN_OSRELDATE 26 +#define KERN_NTP_PLL 27 +#define KERN_BOOTFILE 28 +#define KERN_MAXFILESPERPROC 29 +#define KERN_MAXPROCPERUID 30 +#define KERN_DUMPDEV 31 +#define KERN_IPC 32 +#define KERN_DUMMY 33 +#define KERN_PS_STRINGS 34 +#define KERN_USRSTACK32 35 +#define KERN_LOGSIGEXIT 36 +#define KERN_SYMFILE 37 +#define KERN_PROCARGS 38 +#define KERN_NETBOOT 40 +#define KERN_SYSV 42 +#define KERN_AFFINITY 43 +#define KERN_TRANSLATE 44 +#define KERN_EXEC 45 +#define KERN_AIOMAX 46 +#define KERN_AIOPROCMAX 47 +#define KERN_AIOTHREADS 48 +#define KERN_PROCARGS2 49 +#define KERN_COREFILE 50 +#define KERN_COREDUMP 51 +#define KERN_SUGID_COREDUMP 52 +#define KERN_PROCDELAYTERM 53 +#define KERN_SHREG_PRIVATIZABLE 54 +#define KERN_LOW_PRI_WINDOW 56 +#define KERN_LOW_PRI_DELAY 57 +#define KERN_POSIX 58 +#define KERN_USRSTACK64 59 +#define KERN_NX_PROTECTION 60 +#define KERN_TFP 61 +#define KERN_PROCNAME 62 +#define KERN_THALTSTACK 63 +#define KERN_SPECULATIVE_READS 64 +#define KERN_OSVERSION 65 +#define KERN_SAFEBOOT 66 +#define KERN_RAGEVNODE 68 +#define KERN_TTY 69 +#define KERN_CHECKOPENEVT 70 +#define KERN_THREADNAME 71 +#define KERN_MAXID 72 +#define KERN_RAGE_PROC 1 +#define KERN_RAGE_THREAD 2 +#define KERN_UNRAGE_PROC 3 +#define KERN_UNRAGE_THREAD 4 +#define KERN_OPENEVT_PROC 1 +#define KERN_UNOPENEVT_PROC 2 +#define KERN_TFP_POLICY 1 +#define KERN_TFP_POLICY_DENY 0 +#define KERN_TFP_POLICY_DEFAULT 2 +#define KERN_KDEFLAGS 1 +#define KERN_KDDFLAGS 2 +#define KERN_KDENABLE 3 +#define KERN_KDSETBUF 4 +#define KERN_KDGETBUF 5 +#define KERN_KDSETUP 6 +#define KERN_KDREMOVE 7 +#define KERN_KDSETREG 8 +#define KERN_KDGETREG 9 +#define KERN_KDREADTR 10 +#define KERN_KDPIDTR 11 +#define KERN_KDTHRMAP 12 +#define KERN_KDPIDEX 14 +#define KERN_KDSETRTCDEC 15 +#define KERN_KDGETENTROPY 16 +#define KERN_KDWRITETR 17 +#define KERN_KDWRITEMAP 18 +#define KERN_KDTEST 19 +#define KERN_KDREADCURTHRMAP 21 +#define KERN_KDSET_TYPEFILTER 22 +#define KERN_KDBUFWAIT 23 +#define KERN_KDCPUMAP 24 +#define KERN_KDCPUMAP_EXT 25 +#define KERN_KDSET_EDM 26 +#define KERN_KDGET_EDM 27 +#define KERN_KDWRITETR_V3 28 +#define KERN_PROC_ALL 0 +#define KERN_PROC_PID 1 +#define KERN_PROC_PGRP 2 +#define KERN_PROC_SESSION 3 +#define KERN_PROC_TTY 4 +#define KERN_PROC_UID 5 +#define KERN_PROC_RUID 6 +#define KERN_PROC_LCID 7 +#define KERN_VFSNSPACE_HANDLE_PROC 1 +#define KERN_VFSNSPACE_UNHANDLE_PROC 2 +#define KIPC_MAXSOCKBUF 1 +#define KIPC_SOCKBUF_WASTE 2 +#define KIPC_SOMAXCONN 3 +#define KIPC_MAX_LINKHDR 4 +#define KIPC_MAX_PROTOHDR 5 +#define KIPC_MAX_HDR 6 +#define KIPC_MAX_DATALEN 7 +#define KIPC_MBSTAT 8 +#define KIPC_NMBCLUSTERS 9 +#define KIPC_SOQLIMITCOMPAT 10 +#define VM_METER 1 +#define VM_LOADAVG 2 +#define VM_MACHFACTOR 4 +#define VM_SWAPUSAGE 5 +#define VM_MAXID 6 +#define LSCALE 1000 +#define HW_MACHINE 1 +#define HW_MODEL 2 +#define HW_NCPU 3 +#define HW_BYTEORDER 4 +#define HW_PHYSMEM 5 +#define HW_USERMEM 6 +#define HW_PAGESIZE 7 +#define HW_DISKNAMES 8 +#define HW_DISKSTATS 9 +#define HW_EPOCH 10 +#define HW_FLOATINGPT 11 +#define HW_MACHINE_ARCH 12 +#define HW_VECTORUNIT 13 +#define HW_BUS_FREQ 14 +#define HW_CPU_FREQ 15 +#define HW_CACHELINE 16 +#define HW_L1ICACHESIZE 17 +#define HW_L1DCACHESIZE 18 +#define HW_L2SETTINGS 19 +#define HW_L2CACHESIZE 20 +#define HW_L3SETTINGS 21 +#define HW_L3CACHESIZE 22 +#define HW_TB_FREQ 23 +#define HW_MEMSIZE 24 +#define HW_AVAILCPU 25 +#define HW_TARGET 26 +#define HW_PRODUCT 27 +#define HW_MAXID 28 +#define USER_CS_PATH 1 +#define USER_BC_BASE_MAX 2 +#define USER_BC_DIM_MAX 3 +#define USER_BC_SCALE_MAX 4 +#define USER_BC_STRING_MAX 5 +#define USER_COLL_WEIGHTS_MAX 6 +#define USER_EXPR_NEST_MAX 7 +#define USER_LINE_MAX 8 +#define USER_RE_DUP_MAX 9 +#define USER_POSIX2_VERSION 10 +#define USER_POSIX2_C_BIND 11 +#define USER_POSIX2_C_DEV 12 +#define USER_POSIX2_CHAR_TERM 13 +#define USER_POSIX2_FORT_DEV 14 +#define USER_POSIX2_FORT_RUN 15 +#define USER_POSIX2_LOCALEDEF 16 +#define USER_POSIX2_SW_DEV 17 +#define USER_POSIX2_UPE 18 +#define USER_STREAM_MAX 19 +#define USER_TZNAME_MAX 20 +#define USER_MAXID 21 +#define CTL_DEBUG_NAME 0 +#define CTL_DEBUG_VALUE 1 +#define CTL_DEBUG_MAXID 20 +#define UTF_REVERSE_ENDIAN 0x0001 +#define UTF_NO_NULL_TERM 0x0002 +#define UTF_DECOMPOSED 0x0004 +#define UTF_PRECOMPOSED 0x0008 +#define UTF_ESCAPE_ILLEGAL 0x0010 +#define UTF_SFM_CONVERSIONS 0x0020 +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 +#define PRIO_DARWIN_THREAD 3 +#define PRIO_DARWIN_PROCESS 4 +#define PRIO_MAX 20 +#define PRIO_DARWIN_BG 0x1000 +#define PRIO_DARWIN_NONUI 0x1001 +#define RUSAGE_SELF 0 +#define RUSAGE_INFO_V0 0 +#define RUSAGE_INFO_V1 1 +#define RUSAGE_INFO_V2 2 +#define RUSAGE_INFO_V3 3 +#define RUSAGE_INFO_V4 4 +#define RUSAGE_INFO_V5 5 +#define RUSAGE_INFO_V6 6 +#define RU_PROC_RUNS_RESLIDE 0x00000001 +#define RLIMIT_CPU 0 +#define RLIMIT_FSIZE 1 +#define RLIMIT_DATA 2 +#define RLIMIT_STACK 3 +#define RLIMIT_CORE 4 +#define RLIMIT_AS 5 +#define RLIMIT_MEMLOCK 6 +#define RLIMIT_NPROC 7 +#define RLIMIT_NOFILE 8 +#define RLIM_NLIMITS 9 +#define _RLIMIT_POSIX_FLAG 0x1000 +#define RLIMIT_WAKEUPS_MONITOR 0x1 +#define RLIMIT_CPU_USAGE_MONITOR 0x2 +#define RLIMIT_THREAD_CPULIMITS 0x3 +#define RLIMIT_FOOTPRINT_INTERVAL 0x4 +#define WAKEMON_ENABLE 0x01 +#define WAKEMON_DISABLE 0x02 +#define WAKEMON_GET_PARAMS 0x04 +#define WAKEMON_SET_DEFAULTS 0x08 +#define WAKEMON_MAKE_FATAL 0x10 +#define CPUMON_MAKE_FATAL 0x1000 +#define FOOTPRINT_INTERVAL_RESET 0x1 +#define IOPOL_TYPE_DISK 0 +#define IOPOL_TYPE_VFS_ATIME_UPDATES 2 +#define IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES 3 +#define IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME 4 +#define IOPOL_TYPE_VFS_TRIGGER_RESOLVE 5 +#define IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION 6 +#define IOPOL_TYPE_VFS_IGNORE_PERMISSIONS 7 +#define IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE 8 +#define IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES 9 +#define IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY 10 +#define IOPOL_SCOPE_PROCESS 0 +#define IOPOL_SCOPE_THREAD 1 +#define IOPOL_SCOPE_DARWIN_BG 2 +#define IOPOL_DEFAULT 0 +#define IOPOL_IMPORTANT 1 +#define IOPOL_PASSIVE 2 +#define IOPOL_THROTTLE 3 +#define IOPOL_UTILITY 4 +#define IOPOL_STANDARD 5 +#define IOPOL_ATIME_UPDATES_DEFAULT 0 +#define IOPOL_ATIME_UPDATES_OFF 1 +#define IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT 0 +#define IOPOL_MATERIALIZE_DATALESS_FILES_OFF 1 +#define IOPOL_MATERIALIZE_DATALESS_FILES_ON 2 +#define IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT 0 +#define IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME 1 +#define IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT 0 +#define IOPOL_VFS_TRIGGER_RESOLVE_OFF 1 +#define IOPOL_VFS_CONTENT_PROTECTION_DEFAULT 0 +#define IOPOL_VFS_CONTENT_PROTECTION_IGNORE 1 +#define IOPOL_VFS_IGNORE_PERMISSIONS_OFF 0 +#define IOPOL_VFS_IGNORE_PERMISSIONS_ON 1 +#define IOPOL_VFS_SKIP_MTIME_UPDATE_OFF 0 +#define IOPOL_VFS_SKIP_MTIME_UPDATE_ON 1 +#define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF 0 +#define IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON 1 +#define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT 0 +#define IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON 1 +#define IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT 0 +#define IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON 1 +#define IOCPARM_MASK 0x1fff +#define XATTR_NOFOLLOW 0x0001 +#define XATTR_CREATE 0x0002 +#define XATTR_REPLACE 0x0004 +#define XATTR_NOSECURITY 0x0008 +#define XATTR_NODEFAULT 0x0010 +#define XATTR_SHOWCOMPRESSION 0x0020 +#define XATTR_MAXNAMELEN 127 +#define PR_SLOWHZ 2 +#define PRC_IFDOWN 0 +#define PRC_ROUTEDEAD 1 +#define PRC_IFUP 2 +#define PRC_QUENCH2 3 +#define PRC_QUENCH 4 +#define PRC_MSGSIZE 5 +#define PRC_HOSTDEAD 6 +#define PRC_HOSTUNREACH 7 +#define PRC_UNREACH_NET 8 +#define PRC_UNREACH_HOST 9 +#define PRC_UNREACH_PROTOCOL 10 +#define PRC_UNREACH_PORT 11 +#define PRC_UNREACH_SRCFAIL 13 +#define PRC_REDIRECT_NET 14 +#define PRC_REDIRECT_HOST 15 +#define PRC_REDIRECT_TOSNET 16 +#define PRC_REDIRECT_TOSHOST 17 +#define PRC_TIMXCEED_INTRANS 18 +#define PRC_TIMXCEED_REASS 19 +#define PRC_PARAMPROB 20 +#define PRC_UNREACH_ADMIN_PROHIB 21 +#define PRC_NCMDS 22 +#define KEV_CTL_SUBCLASS 2 +#define KEV_CTL_REGISTERED 1 +#define KEV_CTL_DEREGISTERED 2 +#define MAX_KCTL_NAME 96 +#define CTL_FLAG_PRIVILEGED 0x1 +#define CTL_FLAG_REG_ID_UNIT 0x2 +#define CTL_FLAG_REG_SOCK_STREAM 0x4 +#define CTL_DATA_NOWAKEUP 0x1 +#define CTL_DATA_EOR 0x2 +#define __DARWIN_ONLY_64_BIT_INO_T 0 +#define __DARWIN_ONLY_UNIX_CONFORMANCE 0 +#define __DARWIN_ONLY_VERS_1050 0 +#define __STDC_WANT_LIB_EXT1__ 1 +#define __DARWIN_NO_LONG_LONG 0 +#define _DARWIN_FEATURE_64_BIT_INODE 1 +#define _DARWIN_FEATURE_ONLY_64_BIT_INODE 1 +#define _DARWIN_FEATURE_ONLY_VERS_1050 1 +#define _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE 1 +#define _DARWIN_FEATURE_UNIX_CONFORMANCE 3 +#define __has_ptrcheck 0 +#define MAXMAXPARTITIONS 22 +#define NDDATA 5 +#define NSPARE 5 +#define DTYPE_SMD 1 +#define DTYPE_MSCP 2 +#define DTYPE_DEC 3 +#define DTYPE_SCSI 4 +#define DTYPE_ESDI 5 +#define DTYPE_ST506 6 +#define DTYPE_HPIB 7 +#define DTYPE_HPFL 8 +#define DTYPE_FLOPPY 10 +#define FS_UNUSED 0 +#define FS_SWAP 1 +#define FS_V6 2 +#define FS_V7 3 +#define FS_SYSV 4 +#define FS_V71K 5 +#define FS_V8 6 +#define FS_BSDFFS 7 +#define FS_MSDOS 8 +#define FS_BSDLFS 9 +#define FS_OTHER 10 +#define FS_HPFS 11 +#define FS_ISO9660 12 +#define FS_BOOT 13 +#define FS_ADOS 14 +#define FS_HFS 15 +#define D_REMOVABLE 0x01 +#define D_ECC 0x02 +#define D_BADSECT 0x04 +#define D_RAMDISK 0x08 +#define D_CHAIN 0x10 +#define D_SSE 0x1 +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EDEADLK 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EAGAIN 35 +#define EINPROGRESS 36 +#define EALREADY 37 +#define ENOTSOCK 38 +#define EDESTADDRREQ 39 +#define EMSGSIZE 40 +#define EPROTOTYPE 41 +#define ENOPROTOOPT 42 +#define EPROTONOSUPPORT 43 +#define ESOCKTNOSUPPORT 44 +#define ENOTSUP 45 +#define EPFNOSUPPORT 46 +#define EAFNOSUPPORT 47 +#define EADDRINUSE 48 +#define EADDRNOTAVAIL 49 +#define ENETDOWN 50 +#define ENETUNREACH 51 +#define ENETRESET 52 +#define ECONNABORTED 53 +#define ECONNRESET 54 +#define ENOBUFS 55 +#define EISCONN 56 +#define ENOTCONN 57 +#define ESHUTDOWN 58 +#define ETOOMANYREFS 59 +#define ETIMEDOUT 60 +#define ECONNREFUSED 61 +#define ELOOP 62 +#define ENAMETOOLONG 63 +#define EHOSTDOWN 64 +#define EHOSTUNREACH 65 +#define ENOTEMPTY 66 +#define EPROCLIM 67 +#define EUSERS 68 +#define EDQUOT 69 +#define ESTALE 70 +#define EREMOTE 71 +#define EBADRPC 72 +#define ERPCMISMATCH 73 +#define EPROGUNAVAIL 74 +#define EPROGMISMATCH 75 +#define EPROCUNAVAIL 76 +#define ENOLCK 77 +#define ENOSYS 78 +#define EFTYPE 79 +#define EAUTH 80 +#define ENEEDAUTH 81 +#define EPWROFF 82 +#define EDEVERR 83 +#define EOVERFLOW 84 +#define EBADEXEC 85 +#define EBADARCH 86 +#define ESHLIBVERS 87 +#define EBADMACHO 88 +#define ECANCELED 89 +#define EIDRM 90 +#define ENOMSG 91 +#define EILSEQ 92 +#define ENOATTR 93 +#define EBADMSG 94 +#define EMULTIHOP 95 +#define ENODATA 96 +#define ENOLINK 97 +#define ENOSR 98 +#define ENOSTR 99 +#define EPROTO 100 +#define ETIME 101 +#define EOPNOTSUPP 102 +#define ENOPOLICY 103 +#define ENOTRECOVERABLE 104 +#define EOWNERDEAD 105 +#define EQFULL 106 +#define ELAST 106 +#define VEOF 0 +#define VEOL 1 +#define VEOL2 2 +#define VERASE 3 +#define VWERASE 4 +#define VKILL 5 +#define VREPRINT 6 +#define VINTR 8 +#define VQUIT 9 +#define VSUSP 10 +#define VDSUSP 11 +#define VSTART 12 +#define VSTOP 13 +#define VLNEXT 14 +#define VDISCARD 15 +#define VMIN 16 +#define VTIME 17 +#define VSTATUS 18 +#define NCCS 20 +#define IGNBRK 0x00000001 +#define BRKINT 0x00000002 +#define IGNPAR 0x00000004 +#define PARMRK 0x00000008 +#define INPCK 0x00000010 +#define ISTRIP 0x00000020 +#define INLCR 0x00000040 +#define IGNCR 0x00000080 +#define ICRNL 0x00000100 +#define IXON 0x00000200 +#define IXOFF 0x00000400 +#define IXANY 0x00000800 +#define IMAXBEL 0x00002000 +#define IUTF8 0x00004000 +#define OPOST 0x00000001 +#define ONLCR 0x00000002 +#define OXTABS 0x00000004 +#define ONOEOT 0x00000008 +#define OCRNL 0x00000010 +#define ONOCR 0x00000020 +#define ONLRET 0x00000040 +#define OFILL 0x00000080 +#define NLDLY 0x00000300 +#define TABDLY 0x00000c04 +#define CRDLY 0x00003000 +#define FFDLY 0x00004000 +#define BSDLY 0x00008000 +#define VTDLY 0x00010000 +#define OFDEL 0x00020000 +#define TAB3 0x00000004 +#define VT0 0x00000000 +#define VT1 0x00010000 +#define CIGNORE 0x00000001 +#define CSIZE 0x00000300 +#define CS5 0x00000000 +#define CS6 0x00000100 +#define CS7 0x00000200 +#define CS8 0x00000300 +#define CSTOPB 0x00000400 +#define CREAD 0x00000800 +#define PARENB 0x00001000 +#define PARODD 0x00002000 +#define HUPCL 0x00004000 +#define CLOCAL 0x00008000 +#define CCTS_OFLOW 0x00010000 +#define CRTS_IFLOW 0x00020000 +#define CDTR_IFLOW 0x00040000 +#define CDSR_OFLOW 0x00080000 +#define CCAR_OFLOW 0x00100000 +#define ECHOKE 0x00000001 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define ECHOPRT 0x00000020 +#define ECHOCTL 0x00000040 +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#define ALTWERASE 0x00000200 +#define IEXTEN 0x00000400 +#define EXTPROC 0x00000800 +#define NOKERNINFO 0x02000000 +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 +#define TCSASOFT 0x10 +#define B0 0 +#define B50 50 +#define B75 75 +#define B110 110 +#define B134 134 +#define B150 150 +#define B200 200 +#define B300 300 +#define B600 600 +#define B1200 1200 +#define B1800 1800 +#define B2400 2400 +#define B4800 4800 +#define B9600 9600 +#define B19200 19200 +#define B38400 38400 +#define B7200 7200 +#define B14400 14400 +#define B28800 28800 +#define B57600 57600 +#define B76800 76800 +#define B115200 115200 +#define B230400 230400 +#define EXTA 19200 +#define EXTB 38400 +#define RENAME_SECLUDE 0x00000001 +#define RENAME_SWAP 0x00000002 +#define RENAME_EXCL 0x00000004 +#define RENAME_RESERVED1 0x00000008 +#define RENAME_NOFOLLOW_ANY 0x00000010 +#define MFSNAMELEN 15 +#define MFSTYPENAMELEN 16 +#define MNAMELEN 90 +#define MNT_EXT_ROOT_DATA_VOL 0x00000001 +#define MNT_EXT_FSKIT 0x00000002 +#define MNT_RDONLY 0x00000001 +#define MNT_SYNCHRONOUS 0x00000002 +#define MNT_NOEXEC 0x00000004 +#define MNT_NOSUID 0x00000008 +#define MNT_NODEV 0x00000010 +#define MNT_UNION 0x00000020 +#define MNT_ASYNC 0x00000040 +#define MNT_CPROTECT 0x00000080 +#define MNT_EXPORTED 0x00000100 +#define MNT_REMOVABLE 0x00000200 +#define MNT_QUARANTINE 0x00000400 +#define MNT_LOCAL 0x00001000 +#define MNT_QUOTA 0x00002000 +#define MNT_ROOTFS 0x00004000 +#define MNT_DOVOLFS 0x00008000 +#define MNT_DONTBROWSE 0x00100000 +#define MNT_IGNORE_OWNERSHIP 0x00200000 +#define MNT_AUTOMOUNTED 0x00400000 +#define MNT_JOURNALED 0x00800000 +#define MNT_NOUSERXATTR 0x01000000 +#define MNT_DEFWRITE 0x02000000 +#define MNT_MULTILABEL 0x04000000 +#define MNT_NOFOLLOW 0x08000000 +#define MNT_NOATIME 0x10000000 +#define MNT_SNAPSHOT 0x40000000 +#define MNT_STRICTATIME 0x80000000 +#define MNT_UPDATE 0x00010000 +#define MNT_NOBLOCK 0x00020000 +#define MNT_RELOAD 0x00040000 +#define MNT_FORCE 0x00080000 +#define VFS_GENERIC 0 +#define VFS_NUMMNTOPS 1 +#define VFS_MAXTYPENUM 1 +#define VFS_CONF 2 +#define MNT_WAIT 1 +#define MNT_NOWAIT 2 +#define MNT_DWAIT 4 +#define MNT_VOLUME 8 +#define VFS_CTL_VERS1 0x01 +#define VFS_CTL_OSTATFS 0x00010001 +#define VFS_CTL_UMOUNT 0x00010002 +#define VFS_CTL_QUERY 0x00010003 +#define VFS_CTL_NEWADDR 0x00010004 +#define VFS_CTL_TIMEO 0x00010005 +#define VFS_CTL_NOLOCKS 0x00010006 +#define VFS_CTL_SADDR 0x00010007 +#define VFS_CTL_DISC 0x00010008 +#define VFS_CTL_SERVERINFO 0x00010009 +#define VFS_CTL_NSTATUS 0x0001000A +#define VFS_CTL_STATFS64 0x0001000B +#define VQ_NOTRESP 0x0001 +#define VQ_NEEDAUTH 0x0002 +#define VQ_LOWDISK 0x0004 +#define VQ_MOUNT 0x0008 +#define VQ_UNMOUNT 0x0010 +#define VQ_DEAD 0x0020 +#define VQ_ASSIST 0x0040 +#define VQ_NOTRESPLOCK 0x0080 +#define VQ_UPDATE 0x0100 +#define VQ_VERYLOWDISK 0x0200 +#define VQ_SYNCEVENT 0x0400 +#define VQ_SERVEREVENT 0x0800 +#define VQ_QUOTA 0x1000 +#define VQ_NEARLOWDISK 0x2000 +#define VQ_DESIRED_DISK 0x4000 +#define VQ_FREE_SPACE_CHANGE 0x8000 +#define VQ_FLAG10000 0x10000 +#define VFS_IOATTR_FLAGS_FUA 0x00000001 +#define VFS_IOATTR_FLAGS_UNMAP 0x00000002 +#define VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED 0x00000010 +#define VFS_TBLTHREADSAFE 0x0001 +#define VFS_TBLFSNODELOCK 0x0002 +#define VFS_TBLNOTYPENUM 0x0008 +#define VFS_TBLLOCALVOL 0x0010 +#define VFS_TBL64BITREADY 0x0020 +#define VFS_TBLNATIVEXATTR 0x0040 +#define VFS_TBLDIRLINKS 0x0080 +#define VFS_TBLUNMOUNT_PREFLIGHT 0x0100 +#define VFS_TBLGENERICMNTARGS 0x0200 +#define VFS_TBLREADDIR_EXTENDED 0x0400 +#define VFS_TBLNOMACLABEL 0x1000 +#define VFS_TBLVNOP_PAGEINV2 0x2000 +#define VFS_TBLVNOP_PAGEOUTV2 0x4000 +#define VFS_TBLVNOP_NOUPDATEID_RENAME 0x8000 +#define VFS_TBLVNOP_SECLUDE_RENAME 0x10000 +#define VFS_TBLCANMOUNTROOT 0x20000 +#define VFSIOC_MOUNT_BYROLE_has_recovery 1 +#define VFS_RETURNED 0 +#define VFS_RETURNED_DONE 1 +#define VFS_CLAIMED 2 +#define VFS_CLAIMED_DONE 3 +#define VFS_USER_EVENT 0 +#define VFS_KERNEL_EVENT 1 +#define LK_NOWAIT 1 +#define NFSV4_MAX_FH_SIZE 128 +#define NFSV3_MAX_FH_SIZE 64 +#define NFSV2_MAX_FH_SIZE 32 +#define CRYPTEX_AUTH_STRUCT_VERSION 1 +#define EV_FD 1 +#define EV_RE 1 +#define EV_WR 2 +#define EV_EX 4 +#define EV_RM 8 +#define EV_MASK 0xf +#define EV_RBYTES 0x100 +#define EV_WBYTES 0x200 +#define EV_RCLOSED 0x400 +#define EV_RCONN 0x800 +#define EV_WCLOSED 0x1000 +#define EV_WCONN 0x2000 +#define EV_OOB 0x4000 +#define EV_FIN 0x8000 +#define EV_RESET 0x10000 +#define EV_TIMEOUT 0x20000 +#define EV_DMASK 0xffffff00 +#define KDEBUG_LEVEL_NONE 0 +#define KDEBUG_LEVEL_IST 1 +#define KDEBUG_LEVEL_STANDARD 2 +#define KDEBUG_LEVEL_FULL 3 +#define KDBG_FLAG_FILTERED 0x01 +#define KDBG_FLAG_NOPROCFILT 0x02 +#define __DARWIN_NULL 0 +#define UBC_PUSHDIRTY 0x01 +#define UBC_PUSHALL 0x02 +#define UBC_INVALIDATE 0x04 +#define UBC_SYNC 0x08 +#define KAUTH_NTSID_MAX_AUTHORITIES 16 +#define KAUTH_EXTLOOKUP_SUCCESS 0 +#define KAUTH_EXTLOOKUP_BADRQ 1 +#define KAUTH_EXTLOOKUP_FAILURE 2 +#define KAUTH_EXTLOOKUP_FATAL 3 +#define KAUTH_EXTLOOKUP_INPROG 100 +#define KAUTH_ACE_KINDMASK 0xf +#define KAUTH_ACE_PERMIT 1 +#define KAUTH_ACE_DENY 2 +#define KAUTH_ACE_AUDIT 3 +#define KAUTH_ACE_ALARM 4 +#define KAUTH_ACL_MAX_ENTRIES 128 +#define KAUTH_FILESEC_MAGIC 0x012cc16d +#define KAUTH_ENDIAN_HOST 0x00000001 +#define KAUTH_ENDIAN_DISK 0x00000002 +#define KAUTH_GENERIC_ISSUSER 1 +#define KAUTH_PROCESS_CANSIGNAL 1 +#define KAUTH_PROCESS_CANTRACE 2 +#define KAUTH_FILEOP_OPEN 1 +#define KAUTH_FILEOP_CLOSE 2 +#define KAUTH_FILEOP_RENAME 3 +#define KAUTH_FILEOP_EXCHANGE 4 +#define KAUTH_FILEOP_LINK 5 +#define KAUTH_FILEOP_EXEC 6 +#define KAUTH_FILEOP_DELETE 7 +#define KAUTH_FILEOP_WILL_RENAME 8 +#define DBG_PPT 36 +#define DBG_PERFCTRL 39 +#define DBG_CLPC 50 +#define DBG_MUSE 52 +#define DBG_ANS 128 +#define DBG_SIO 129 +#define DBG_SEP 130 +#define DBG_ISP 131 +#define DBG_OSCAR 132 +#define DBG_EMBEDDEDGFX 133 +#define DBG_PMP 134 +#define DBG_RTKIT 135 +#define DBG_DCP 136 +#define DBG_KMP 137 +#define DBG_SKYWALK_ALWAYSON 0x10 +#define DBG_SKYWALK_FLOWSWITCH 0x11 +#define DBG_SKYWALK_NETIF 0x12 +#define DBG_SKYWALK_CHANNEL 0x13 +#define DBG_SKYWALK_PACKET 0x14 +#define DBG_AQM_ALWAYSON 0x30 +#define DBG_AQM_STATS 0x31 +#define PPT_TEST 0x01 +#define PPT_JETSAM_HIWAT 0x02 +#define PPT_JETSAM_TOPPROC 0x03 +#define DBG_SEC_SSMA 0x02 +#define KDBG_CPU_SHIFT 56 +#define KDBG_INIT 0x01 +#define KDBG_FREERUN 0x04 +#define KDBG_CPUMAP_IS_IOP 0x1 +#define KDEBUG_COMMPAGE_ENABLE_TRACE 0x1 +#define KDEBUG_COMMPAGE_ENABLE_TYPEFILTER 0x2 +#define KDEBUG_COMMPAGE_CONTINUOUS 0x4 +#define KDBG_LOCKINIT 0x0080 +#define KDBG_CLASSTYPE 0x10000 +#define KDBG_SUBCLSTYPE 0x20000 +#define KDBG_RANGETYPE 0x40000 +#define KDBG_TYPENONE 0x80000 +#define KDBG_CKTYPES 0xF0000 +#define RAW_VERSION0 0x55aa0000 +#define RAW_VERSION1 0x55aa0101 +#define RAW_VERSION2 0x55aa0200 +#define kEnTrCompKernel 2 +#define kEnTrActKernSocket 1 +#define kEnTrActKernSockRead 2 +#define kEnTrActKernSockWrite 3 +#define kEnTrActKernPoll 10 +#define kEnTrActKernSelect 11 +#define kEnTrActKernKQWait 12 +#define kEnTrEvUnblocked 256 +#define kEnTrFlagNonBlocking 0x1 +#define kEnTrFlagNoWork 0x2 +#define ENTR_SHOULDTRACE 0 +#define SYS_syscall 0 + 0x2000000 +#define SYS_exit 1 + 0x2000000 +#define SYS_fork 2 + 0x2000000 +#define SYS_read 3 + 0x2000000 +#define SYS_write 4 + 0x2000000 +#define SYS_open 5 + 0x2000000 +#define SYS_close 6 + 0x2000000 +#define SYS_wait4 7 + 0x2000000 +#define SYS_link 9 + 0x2000000 +#define SYS_unlink 10 + 0x2000000 +#define SYS_chdir 12 + 0x2000000 +#define SYS_fchdir 13 + 0x2000000 +#define SYS_mknod 14 + 0x2000000 +#define SYS_chmod 15 + 0x2000000 +#define SYS_chown 16 + 0x2000000 +#define SYS_getfsstat 18 + 0x2000000 +#define SYS_getpid 20 + 0x2000000 +#define SYS_setuid 23 + 0x2000000 +#define SYS_getuid 24 + 0x2000000 +#define SYS_geteuid 25 + 0x2000000 +#define SYS_ptrace 26 + 0x2000000 +#define SYS_recvmsg 27 + 0x2000000 +#define SYS_sendmsg 28 + 0x2000000 +#define SYS_recvfrom 29 + 0x2000000 +#define SYS_accept 30 + 0x2000000 +#define SYS_getpeername 31 + 0x2000000 +#define SYS_getsockname 32 + 0x2000000 +#define SYS_access 33 + 0x2000000 +#define SYS_chflags 34 + 0x2000000 +#define SYS_fchflags 35 + 0x2000000 +#define SYS_sync 36 + 0x2000000 +#define SYS_kill 37 + 0x2000000 +#define SYS_crossarch_trap 38 + 0x2000000 +#define SYS_getppid 39 + 0x2000000 +#define SYS_dup 41 + 0x2000000 +#define SYS_pipe 42 + 0x2000000 +#define SYS_getegid 43 + 0x2000000 +#define SYS_sigaction 46 + 0x2000000 +#define SYS_getgid 47 + 0x2000000 +#define SYS_sigprocmask 48 + 0x2000000 +#define SYS_getlogin 49 + 0x2000000 +#define SYS_setlogin 50 + 0x2000000 +#define SYS_acct 51 + 0x2000000 +#define SYS_sigpending 52 + 0x2000000 +#define SYS_sigaltstack 53 + 0x2000000 +#define SYS_ioctl 54 + 0x2000000 +#define SYS_reboot 55 + 0x2000000 +#define SYS_revoke 56 + 0x2000000 +#define SYS_symlink 57 + 0x2000000 +#define SYS_readlink 58 + 0x2000000 +#define SYS_execve 59 + 0x2000000 +#define SYS_umask 60 + 0x2000000 +#define SYS_chroot 61 + 0x2000000 +#define SYS_msync 65 + 0x2000000 +#define SYS_vfork 66 + 0x2000000 +#define SYS_munmap 73 + 0x2000000 +#define SYS_mprotect 74 + 0x2000000 +#define SYS_madvise 75 + 0x2000000 +#define SYS_mincore 78 + 0x2000000 +#define SYS_getgroups 79 + 0x2000000 +#define SYS_setgroups 80 + 0x2000000 +#define SYS_getpgrp 81 + 0x2000000 +#define SYS_setpgid 82 + 0x2000000 +#define SYS_setitimer 83 + 0x2000000 +#define SYS_swapon 85 + 0x2000000 +#define SYS_getitimer 86 + 0x2000000 +#define SYS_getdtablesize 89 + 0x2000000 +#define SYS_dup2 90 + 0x2000000 +#define SYS_fcntl 92 + 0x2000000 +#define SYS_select 93 + 0x2000000 +#define SYS_fsync 95 + 0x2000000 +#define SYS_setpriority 96 + 0x2000000 +#define SYS_socket 97 + 0x2000000 +#define SYS_connect 98 + 0x2000000 +#define SYS_getpriority 100 + 0x2000000 +#define SYS_bind 104 + 0x2000000 +#define SYS_setsockopt 105 + 0x2000000 +#define SYS_listen 106 + 0x2000000 +#define SYS_sigsuspend 111 + 0x2000000 +#define SYS_gettimeofday 116 + 0x2000000 +#define SYS_getrusage 117 + 0x2000000 +#define SYS_getsockopt 118 + 0x2000000 +#define SYS_readv 120 + 0x2000000 +#define SYS_writev 121 + 0x2000000 +#define SYS_settimeofday 122 + 0x2000000 +#define SYS_fchown 123 + 0x2000000 +#define SYS_fchmod 124 + 0x2000000 +#define SYS_setreuid 126 + 0x2000000 +#define SYS_setregid 127 + 0x2000000 +#define SYS_rename 128 + 0x2000000 +#define SYS_flock 131 + 0x2000000 +#define SYS_mkfifo 132 + 0x2000000 +#define SYS_sendto 133 + 0x2000000 +#define SYS_shutdown 134 + 0x2000000 +#define SYS_socketpair 135 + 0x2000000 +#define SYS_mkdir 136 + 0x2000000 +#define SYS_rmdir 137 + 0x2000000 +#define SYS_utimes 138 + 0x2000000 +#define SYS_futimes 139 + 0x2000000 +#define SYS_adjtime 140 + 0x2000000 +#define SYS_gethostuuid 142 + 0x2000000 +#define SYS_setsid 147 + 0x2000000 +#define SYS_getpgid 151 + 0x2000000 +#define SYS_setprivexec 152 + 0x2000000 +#define SYS_pread 153 + 0x2000000 +#define SYS_pwrite 154 + 0x2000000 +#define SYS_nfssvc 155 + 0x2000000 +#define SYS_statfs 157 + 0x2000000 +#define SYS_fstatfs 158 + 0x2000000 +#define SYS_unmount 159 + 0x2000000 +#define SYS_getfh 161 + 0x2000000 +#define SYS_quotactl 165 + 0x2000000 +#define SYS_mount 167 + 0x2000000 +#define SYS_csops 169 + 0x2000000 +#define SYS_csops_audittoken 170 + 0x2000000 +#define SYS_waitid 173 + 0x2000000 +#define SYS_kdebug_typefilter 177 + 0x2000000 +#define SYS_kdebug_trace_string 178 + 0x2000000 +#define SYS_kdebug_trace64 179 + 0x2000000 +#define SYS_kdebug_trace 180 + 0x2000000 +#define SYS_setgid 181 + 0x2000000 +#define SYS_setegid 182 + 0x2000000 +#define SYS_seteuid 183 + 0x2000000 +#define SYS_sigreturn 184 + 0x2000000 +#define SYS_panic_with_data 185 + 0x2000000 +#define SYS_thread_selfcounts 186 + 0x2000000 +#define SYS_fdatasync 187 + 0x2000000 +#define SYS_stat 188 + 0x2000000 +#define SYS_fstat 189 + 0x2000000 +#define SYS_lstat 190 + 0x2000000 +#define SYS_pathconf 191 + 0x2000000 +#define SYS_fpathconf 192 + 0x2000000 +#define SYS_getrlimit 194 + 0x2000000 +#define SYS_setrlimit 195 + 0x2000000 +#define SYS_getdirentries 196 + 0x2000000 +#define SYS_mmap 197 + 0x2000000 +#define SYS_lseek 199 + 0x2000000 +#define SYS_truncate 200 + 0x2000000 +#define SYS_ftruncate 201 + 0x2000000 +#define SYS_sysctl 202 + 0x2000000 +#define SYS_mlock 203 + 0x2000000 +#define SYS_munlock 204 + 0x2000000 +#define SYS_undelete 205 + 0x2000000 +#define SYS_open_dprotected_np 216 + 0x2000000 +#define SYS_fsgetpath_ext 217 + 0x2000000 +#define SYS_openat_dprotected_np 218 + 0x2000000 +#define SYS_getattrlist 220 + 0x2000000 +#define SYS_setattrlist 221 + 0x2000000 +#define SYS_getdirentriesattr 222 + 0x2000000 +#define SYS_exchangedata 223 + 0x2000000 +#define SYS_searchfs 225 + 0x2000000 +#define SYS_delete 226 + 0x2000000 +#define SYS_copyfile 227 + 0x2000000 +#define SYS_fgetattrlist 228 + 0x2000000 +#define SYS_fsetattrlist 229 + 0x2000000 +#define SYS_poll 230 + 0x2000000 +#define SYS_getxattr 234 + 0x2000000 +#define SYS_fgetxattr 235 + 0x2000000 +#define SYS_setxattr 236 + 0x2000000 +#define SYS_fsetxattr 237 + 0x2000000 +#define SYS_removexattr 238 + 0x2000000 +#define SYS_fremovexattr 239 + 0x2000000 +#define SYS_listxattr 240 + 0x2000000 +#define SYS_flistxattr 241 + 0x2000000 +#define SYS_fsctl 242 + 0x2000000 +#define SYS_initgroups 243 + 0x2000000 +#define SYS_posix_spawn 244 + 0x2000000 +#define SYS_ffsctl 245 + 0x2000000 +#define SYS_fhopen 248 + 0x2000000 +#define SYS_minherit 250 + 0x2000000 +#define SYS_semsys 251 + 0x2000000 +#define SYS_msgsys 252 + 0x2000000 +#define SYS_shmsys 253 + 0x2000000 +#define SYS_semctl 254 + 0x2000000 +#define SYS_semget 255 + 0x2000000 +#define SYS_semop 256 + 0x2000000 +#define SYS_msgctl 258 + 0x2000000 +#define SYS_msgget 259 + 0x2000000 +#define SYS_msgsnd 260 + 0x2000000 +#define SYS_msgrcv 261 + 0x2000000 +#define SYS_shmat 262 + 0x2000000 +#define SYS_shmctl 263 + 0x2000000 +#define SYS_shmdt 264 + 0x2000000 +#define SYS_shmget 265 + 0x2000000 +#define SYS_shm_open 266 + 0x2000000 +#define SYS_shm_unlink 267 + 0x2000000 +#define SYS_sem_open 268 + 0x2000000 +#define SYS_sem_close 269 + 0x2000000 +#define SYS_sem_unlink 270 + 0x2000000 +#define SYS_sem_wait 271 + 0x2000000 +#define SYS_sem_trywait 272 + 0x2000000 +#define SYS_sem_post 273 + 0x2000000 +#define SYS_sysctlbyname 274 + 0x2000000 +#define SYS_open_extended 277 + 0x2000000 +#define SYS_umask_extended 278 + 0x2000000 +#define SYS_stat_extended 279 + 0x2000000 +#define SYS_lstat_extended 280 + 0x2000000 +#define SYS_fstat_extended 281 + 0x2000000 +#define SYS_chmod_extended 282 + 0x2000000 +#define SYS_fchmod_extended 283 + 0x2000000 +#define SYS_access_extended 284 + 0x2000000 +#define SYS_settid 285 + 0x2000000 +#define SYS_gettid 286 + 0x2000000 +#define SYS_setsgroups 287 + 0x2000000 +#define SYS_getsgroups 288 + 0x2000000 +#define SYS_setwgroups 289 + 0x2000000 +#define SYS_getwgroups 290 + 0x2000000 +#define SYS_mkfifo_extended 291 + 0x2000000 +#define SYS_mkdir_extended 292 + 0x2000000 +#define SYS_identitysvc 293 + 0x2000000 +#define SYS_shared_region_check_np 294 + 0x2000000 +#define SYS_vm_pressure_monitor 296 + 0x2000000 +#define SYS_psynch_rw_longrdlock 297 + 0x2000000 +#define SYS_psynch_rw_yieldwrlock 298 + 0x2000000 +#define SYS_psynch_rw_downgrade 299 + 0x2000000 +#define SYS_psynch_rw_upgrade 300 + 0x2000000 +#define SYS_psynch_mutexwait 301 + 0x2000000 +#define SYS_psynch_mutexdrop 302 + 0x2000000 +#define SYS_psynch_cvbroad 303 + 0x2000000 +#define SYS_psynch_cvsignal 304 + 0x2000000 +#define SYS_psynch_cvwait 305 + 0x2000000 +#define SYS_psynch_rw_rdlock 306 + 0x2000000 +#define SYS_psynch_rw_wrlock 307 + 0x2000000 +#define SYS_psynch_rw_unlock 308 + 0x2000000 +#define SYS_psynch_rw_unlock2 309 + 0x2000000 +#define SYS_getsid 310 + 0x2000000 +#define SYS_settid_with_pid 311 + 0x2000000 +#define SYS_psynch_cvclrprepost 312 + 0x2000000 +#define SYS_aio_fsync 313 + 0x2000000 +#define SYS_aio_return 314 + 0x2000000 +#define SYS_aio_suspend 315 + 0x2000000 +#define SYS_aio_cancel 316 + 0x2000000 +#define SYS_aio_error 317 + 0x2000000 +#define SYS_aio_read 318 + 0x2000000 +#define SYS_aio_write 319 + 0x2000000 +#define SYS_lio_listio 320 + 0x2000000 +#define SYS_iopolicysys 322 + 0x2000000 +#define SYS_process_policy 323 + 0x2000000 +#define SYS_mlockall 324 + 0x2000000 +#define SYS_munlockall 325 + 0x2000000 +#define SYS_issetugid 327 + 0x2000000 +#define SYS___pthread_kill 328 + 0x2000000 +#define SYS___pthread_sigmask 329 + 0x2000000 +#define SYS___sigwait 330 + 0x2000000 +#define SYS___disable_threadsignal 331 + 0x2000000 +#define SYS___pthread_markcancel 332 + 0x2000000 +#define SYS___pthread_canceled 333 + 0x2000000 +#define SYS___semwait_signal 334 + 0x2000000 +#define SYS_proc_info 336 + 0x2000000 +#define SYS_sendfile 337 + 0x2000000 +#define SYS_stat64 338 + 0x2000000 +#define SYS_fstat64 339 + 0x2000000 +#define SYS_lstat64 340 + 0x2000000 +#define SYS_stat64_extended 341 + 0x2000000 +#define SYS_lstat64_extended 342 + 0x2000000 +#define SYS_fstat64_extended 343 + 0x2000000 +#define SYS_getdirentries64 344 + 0x2000000 +#define SYS_statfs64 345 + 0x2000000 +#define SYS_fstatfs64 346 + 0x2000000 +#define SYS_getfsstat64 347 + 0x2000000 +#define SYS___pthread_chdir 348 + 0x2000000 +#define SYS___pthread_fchdir 349 + 0x2000000 +#define SYS_audit 350 + 0x2000000 +#define SYS_auditon 351 + 0x2000000 +#define SYS_getauid 353 + 0x2000000 +#define SYS_setauid 354 + 0x2000000 +#define SYS_getaudit_addr 357 + 0x2000000 +#define SYS_setaudit_addr 358 + 0x2000000 +#define SYS_auditctl 359 + 0x2000000 +#define SYS_bsdthread_create 360 + 0x2000000 +#define SYS_bsdthread_terminate 361 + 0x2000000 +#define SYS_kqueue 362 + 0x2000000 +#define SYS_kevent 363 + 0x2000000 +#define SYS_lchown 364 + 0x2000000 +#define SYS_bsdthread_register 366 + 0x2000000 +#define SYS_workq_open 367 + 0x2000000 +#define SYS_workq_kernreturn 368 + 0x2000000 +#define SYS_kevent64 369 + 0x2000000 +#define SYS_thread_selfid 372 + 0x2000000 +#define SYS_ledger 373 + 0x2000000 +#define SYS_kevent_qos 374 + 0x2000000 +#define SYS_kevent_id 375 + 0x2000000 +#define SYS___mac_execve 380 + 0x2000000 +#define SYS___mac_syscall 381 + 0x2000000 +#define SYS___mac_get_file 382 + 0x2000000 +#define SYS___mac_set_file 383 + 0x2000000 +#define SYS___mac_get_link 384 + 0x2000000 +#define SYS___mac_set_link 385 + 0x2000000 +#define SYS___mac_get_proc 386 + 0x2000000 +#define SYS___mac_set_proc 387 + 0x2000000 +#define SYS___mac_get_fd 388 + 0x2000000 +#define SYS___mac_set_fd 389 + 0x2000000 +#define SYS___mac_get_pid 390 + 0x2000000 +#define SYS_pselect 394 + 0x2000000 +#define SYS_pselect_nocancel 395 + 0x2000000 +#define SYS_read_nocancel 396 + 0x2000000 +#define SYS_write_nocancel 397 + 0x2000000 +#define SYS_open_nocancel 398 + 0x2000000 +#define SYS_close_nocancel 399 + 0x2000000 +#define SYS_wait4_nocancel 400 + 0x2000000 +#define SYS_recvmsg_nocancel 401 + 0x2000000 +#define SYS_sendmsg_nocancel 402 + 0x2000000 +#define SYS_recvfrom_nocancel 403 + 0x2000000 +#define SYS_accept_nocancel 404 + 0x2000000 +#define SYS_msync_nocancel 405 + 0x2000000 +#define SYS_fcntl_nocancel 406 + 0x2000000 +#define SYS_select_nocancel 407 + 0x2000000 +#define SYS_fsync_nocancel 408 + 0x2000000 +#define SYS_connect_nocancel 409 + 0x2000000 +#define SYS_sigsuspend_nocancel 410 + 0x2000000 +#define SYS_readv_nocancel 411 + 0x2000000 +#define SYS_writev_nocancel 412 + 0x2000000 +#define SYS_sendto_nocancel 413 + 0x2000000 +#define SYS_pread_nocancel 414 + 0x2000000 +#define SYS_pwrite_nocancel 415 + 0x2000000 +#define SYS_waitid_nocancel 416 + 0x2000000 +#define SYS_poll_nocancel 417 + 0x2000000 +#define SYS_msgsnd_nocancel 418 + 0x2000000 +#define SYS_msgrcv_nocancel 419 + 0x2000000 +#define SYS_sem_wait_nocancel 420 + 0x2000000 +#define SYS_aio_suspend_nocancel 421 + 0x2000000 +#define SYS___sigwait_nocancel 422 + 0x2000000 +#define SYS___semwait_signal_nocancel 423 + 0x2000000 +#define SYS___mac_mount 424 + 0x2000000 +#define SYS___mac_get_mount 425 + 0x2000000 +#define SYS___mac_getfsstat 426 + 0x2000000 +#define SYS_fsgetpath 427 + 0x2000000 +#define SYS_audit_session_self 428 + 0x2000000 +#define SYS_audit_session_join 429 + 0x2000000 +#define SYS_fileport_makeport 430 + 0x2000000 +#define SYS_fileport_makefd 431 + 0x2000000 +#define SYS_audit_session_port 432 + 0x2000000 +#define SYS_pid_suspend 433 + 0x2000000 +#define SYS_pid_resume 434 + 0x2000000 +#define SYS_pid_hibernate 435 + 0x2000000 +#define SYS_pid_shutdown_sockets 436 + 0x2000000 +#define SYS_kas_info 439 + 0x2000000 +#define SYS_memorystatus_control 440 + 0x2000000 +#define SYS_guarded_open_np 441 + 0x2000000 +#define SYS_guarded_close_np 442 + 0x2000000 +#define SYS_guarded_kqueue_np 443 + 0x2000000 +#define SYS_change_fdguard_np 444 + 0x2000000 +#define SYS_usrctl 445 + 0x2000000 +#define SYS_proc_rlimit_control 446 + 0x2000000 +#define SYS_connectx 447 + 0x2000000 +#define SYS_disconnectx 448 + 0x2000000 +#define SYS_peeloff 449 + 0x2000000 +#define SYS_socket_delegate 450 + 0x2000000 +#define SYS_telemetry 451 + 0x2000000 +#define SYS_proc_uuid_policy 452 + 0x2000000 +#define SYS_memorystatus_get_level 453 + 0x2000000 +#define SYS_system_override 454 + 0x2000000 +#define SYS_vfs_purge 455 + 0x2000000 +#define SYS_sfi_ctl 456 + 0x2000000 +#define SYS_sfi_pidctl 457 + 0x2000000 +#define SYS_coalition 458 + 0x2000000 +#define SYS_coalition_info 459 + 0x2000000 +#define SYS_necp_match_policy 460 + 0x2000000 +#define SYS_getattrlistbulk 461 + 0x2000000 +#define SYS_clonefileat 462 + 0x2000000 +#define SYS_openat 463 + 0x2000000 +#define SYS_openat_nocancel 464 + 0x2000000 +#define SYS_renameat 465 + 0x2000000 +#define SYS_faccessat 466 + 0x2000000 +#define SYS_fchmodat 467 + 0x2000000 +#define SYS_fchownat 468 + 0x2000000 +#define SYS_fstatat 469 + 0x2000000 +#define SYS_fstatat64 470 + 0x2000000 +#define SYS_linkat 471 + 0x2000000 +#define SYS_unlinkat 472 + 0x2000000 +#define SYS_readlinkat 473 + 0x2000000 +#define SYS_symlinkat 474 + 0x2000000 +#define SYS_mkdirat 475 + 0x2000000 +#define SYS_getattrlistat 476 + 0x2000000 +#define SYS_proc_trace_log 477 + 0x2000000 +#define SYS_bsdthread_ctl 478 + 0x2000000 +#define SYS_openbyid_np 479 + 0x2000000 +#define SYS_recvmsg_x 480 + 0x2000000 +#define SYS_sendmsg_x 481 + 0x2000000 +#define SYS_thread_selfusage 482 + 0x2000000 +#define SYS_csrctl 483 + 0x2000000 +#define SYS_guarded_open_dprotected_np 484 + 0x2000000 +#define SYS_guarded_write_np 485 + 0x2000000 +#define SYS_guarded_pwrite_np 486 + 0x2000000 +#define SYS_guarded_writev_np 487 + 0x2000000 +#define SYS_renameatx_np 488 + 0x2000000 +#define SYS_mremap_encrypted 489 + 0x2000000 +#define SYS_netagent_trigger 490 + 0x2000000 +#define SYS_stack_snapshot_with_config 491 + 0x2000000 +#define SYS_microstackshot 492 + 0x2000000 +#define SYS_grab_pgo_data 493 + 0x2000000 +#define SYS_persona 494 + 0x2000000 +#define SYS_mach_eventlink_signal 496 + 0x2000000 +#define SYS_mach_eventlink_wait_until 497 + 0x2000000 +#define SYS_mach_eventlink_signal_wait_until 498 + 0x2000000 +#define SYS_work_interval_ctl 499 + 0x2000000 +#define SYS_getentropy 500 + 0x2000000 +#define SYS_necp_open 501 + 0x2000000 +#define SYS_necp_client_action 502 + 0x2000000 +#define SYS___nexus_open 503 + 0x2000000 +#define SYS___nexus_register 504 + 0x2000000 +#define SYS___nexus_deregister 505 + 0x2000000 +#define SYS___nexus_create 506 + 0x2000000 +#define SYS___nexus_destroy 507 + 0x2000000 +#define SYS___nexus_get_opt 508 + 0x2000000 +#define SYS___nexus_set_opt 509 + 0x2000000 +#define SYS___channel_open 510 + 0x2000000 +#define SYS___channel_get_info 511 + 0x2000000 +#define SYS___channel_sync 512 + 0x2000000 +#define SYS___channel_get_opt 513 + 0x2000000 +#define SYS___channel_set_opt 514 + 0x2000000 +#define SYS_ulock_wait 515 + 0x2000000 +#define SYS_ulock_wake 516 + 0x2000000 +#define SYS_fclonefileat 517 + 0x2000000 +#define SYS_fs_snapshot 518 + 0x2000000 +#define SYS_register_uexc_handler 519 + 0x2000000 +#define SYS_terminate_with_payload 520 + 0x2000000 +#define SYS_abort_with_payload 521 + 0x2000000 +#define SYS_necp_session_open 522 + 0x2000000 +#define SYS_necp_session_action 523 + 0x2000000 +#define SYS_setattrlistat 524 + 0x2000000 +#define SYS_net_qos_guideline 525 + 0x2000000 +#define SYS_fmount 526 + 0x2000000 +#define SYS_ntp_adjtime 527 + 0x2000000 +#define SYS_ntp_gettime 528 + 0x2000000 +#define SYS_os_fault_with_payload 529 + 0x2000000 +#define SYS_kqueue_workloop_ctl 530 + 0x2000000 +#define SYS___mach_bridge_remote_time 531 + 0x2000000 +#define SYS_coalition_ledger 532 + 0x2000000 +#define SYS_log_data 533 + 0x2000000 +#define SYS_memorystatus_available_memory 534 + 0x2000000 +#define SYS_objc_bp_assist_cfg_np 535 + 0x2000000 +#define SYS_shared_region_map_and_slide_2_np 536 + 0x2000000 +#define SYS_pivot_root 537 + 0x2000000 +#define SYS_task_inspect_for_pid 538 + 0x2000000 +#define SYS_task_read_for_pid 539 + 0x2000000 +#define SYS_preadv 540 + 0x2000000 +#define SYS_pwritev 541 + 0x2000000 +#define SYS_preadv_nocancel 542 + 0x2000000 +#define SYS_pwritev_nocancel 543 + 0x2000000 +#define SYS_ulock_wait2 544 + 0x2000000 +#define SYS_proc_info_extended_id 545 + 0x2000000 +#define SYS_tracker_action 546 + 0x2000000 +#define SYS_debug_syscall_reject 547 + 0x2000000 +#define SYS_debug_syscall_reject_config 548 + 0x2000000 +#define SYS_graftdmg 549 + 0x2000000 +#define SYS_map_with_linking_np 550 + 0x2000000 +#define SYS_freadlink 551 + 0x2000000 +#define SYS_record_system_event 552 + 0x2000000 +#define SYS_mkfifoat 553 + 0x2000000 +#define SYS_mknodat 554 + 0x2000000 +#define SYS_ungraftdmg 555 + 0x2000000 +#define SYS_MAXSYSCALL 556 + 0x2000000 +#define SYS_invalid 63 + 0x2000000 +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SO_DEBUG 0x0001 +#define SO_ACCEPTCONN 0x0002 +#define SO_REUSEADDR 0x0004 +#define SO_KEEPALIVE 0x0008 +#define SO_DONTROUTE 0x0010 +#define SO_BROADCAST 0x0020 +#define SO_USELOOPBACK 0x0040 +#define SO_LINGER 0x1080 +#define SO_LINGER_SEC 0x1080 +#define SO_OOBINLINE 0x0100 +#define SO_REUSEPORT 0x0200 +#define SO_TIMESTAMP 0x0400 +#define SO_TIMESTAMP_MONOTONIC 0x0800 +#define SO_ACCEPTFILTER 0x1000 +#define SO_DONTTRUNC 0x2000 +#define SO_WANTMORE 0x4000 +#define SO_WANTOOBFLAG 0x8000 +#define SO_SNDBUF 0x1001 +#define SO_RCVBUF 0x1002 +#define SO_SNDLOWAT 0x1003 +#define SO_RCVLOWAT 0x1004 +#define SO_SNDTIMEO 0x1005 +#define SO_RCVTIMEO 0x1006 +#define SO_ERROR 0x1007 +#define SO_TYPE 0x1008 +#define SO_LABEL 0x1010 +#define SO_PEERLABEL 0x1011 +#define SO_NREAD 0x1020 +#define SO_NKE 0x1021 +#define SO_NOSIGPIPE 0x1022 +#define SO_NOADDRERR 0x1023 +#define SO_NWRITE 0x1024 +#define SO_REUSESHAREUID 0x1025 +#define SO_NOTIFYCONFLICT 0x1026 +#define SO_UPCALLCLOSEWAIT 0x1027 +#define SO_RANDOMPORT 0x1082 +#define SO_NP_EXTENSIONS 0x1083 +#define SO_NUMRCVPKT 0x1112 +#define SO_NET_SERVICE_TYPE 0x1116 +#define SO_NETSVC_MARKING_LEVEL 0x1119 +#define SO_RESOLVER_SIGNATURE 0x1131 +#define NET_SERVICE_TYPE_BE 0 +#define NET_SERVICE_TYPE_BK 1 +#define NET_SERVICE_TYPE_SIG 2 +#define NET_SERVICE_TYPE_VI 3 +#define NET_SERVICE_TYPE_VO 4 +#define NET_SERVICE_TYPE_RV 5 +#define NET_SERVICE_TYPE_AV 6 +#define NET_SERVICE_TYPE_OAM 7 +#define NET_SERVICE_TYPE_RD 8 +#define NETSVC_MRKNG_UNKNOWN 0 +#define NETSVC_MRKNG_LVL_L2 1 +#define NETSVC_MRKNG_LVL_L3L2_ALL 2 +#define NETSVC_MRKNG_LVL_L3L2_BK 3 +#define SAE_ASSOCID_ANY 0 +#define SAE_CONNID_ANY 0 +#define CONNECT_RESUME_ON_READ_WRITE 0x1 +#define CONNECT_DATA_IDEMPOTENT 0x2 +#define CONNECT_DATA_AUTHENTICATED 0x4 +#define SONPX_SETOPTSHUT 0x000000001 +#define SOL_SOCKET 0xffff +#define AF_UNSPEC 0 +#define AF_UNIX 1 +#define AF_INET 2 +#define AF_IMPLINK 3 +#define AF_PUP 4 +#define AF_CHAOS 5 +#define AF_NS 6 +#define AF_ISO 7 +#define AF_ECMA 8 +#define AF_DATAKIT 9 +#define AF_CCITT 10 +#define AF_SNA 11 +#define AF_DECnet 12 +#define AF_DLI 13 +#define AF_LAT 14 +#define AF_HYLINK 15 +#define AF_APPLETALK 16 +#define AF_ROUTE 17 +#define AF_LINK 18 +#define pseudo_AF_XTP 19 +#define AF_COIP 20 +#define AF_CNT 21 +#define pseudo_AF_RTIP 22 +#define AF_IPX 23 +#define AF_SIP 24 +#define pseudo_AF_PIP 25 +#define AF_NDRV 27 +#define AF_ISDN 28 +#define pseudo_AF_KEY 29 +#define AF_INET6 30 +#define AF_NATM 31 +#define AF_SYSTEM 32 +#define AF_NETBIOS 33 +#define AF_PPP 34 +#define pseudo_AF_HDRCMPLT 35 +#define AF_RESERVED_36 36 +#define AF_IEEE80211 37 +#define AF_UTUN 38 +#define AF_VSOCK 40 +#define AF_MAX 41 +#define SOCK_MAXADDRLEN 255 +#define _SS_MAXSIZE 128 +#define NET_RT_DUMP 1 +#define NET_RT_FLAGS 2 +#define NET_RT_IFLIST 3 +#define NET_RT_STAT 4 +#define NET_RT_TRASH 5 +#define NET_RT_IFLIST2 6 +#define NET_RT_DUMP2 7 +#define NET_RT_FLAGS_PRIV 10 +#define NET_RT_MAXID 11 +#define SOMAXCONN 128 +#define MSG_OOB 0x1 +#define MSG_PEEK 0x2 +#define MSG_DONTROUTE 0x4 +#define MSG_EOR 0x8 +#define MSG_TRUNC 0x10 +#define MSG_CTRUNC 0x20 +#define MSG_WAITALL 0x40 +#define MSG_DONTWAIT 0x80 +#define MSG_EOF 0x100 +#define MSG_WAITSTREAM 0x200 +#define MSG_FLUSH 0x400 +#define MSG_HOLD 0x800 +#define MSG_SEND 0x1000 +#define MSG_HAVEMORE 0x2000 +#define MSG_RCVMORE 0x4000 +#define MSG_NEEDSA 0x10000 +#define MSG_NOSIGNAL 0x80000 +#define MSG_USEUPCALL 0x80000000 +#define CMGROUP_MAX 16 +#define SCM_RIGHTS 0x01 +#define SCM_TIMESTAMP 0x02 +#define SCM_CREDS 0x03 +#define SCM_TIMESTAMP_MONOTONIC 0x04 +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 +#define SBUF_FIXEDLEN 0x00000000 +#define SBUF_AUTOEXTEND 0x00000001 +#define SBUF_USRFLAGMSK 0x0000ffff +#define SBUF_DYNAMIC 0x00010000 +#define SBUF_FINISHED 0x00020000 +#define SBUF_OVERFLOWED 0x00040000 +#define SBUF_DYNSTRUCT 0x00080000 +#define SYSPROTO_EVENT 1 +#define SYSPROTO_CONTROL 2 +#define AF_SYS_CONTROL 2 +#define SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED 0x00000001 +#define SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER 0x00000002 +#define SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT 0x00000004 +#define NS_GETRAWENCRYPTED 0x00000001 From 15748d082dc00c85c96952ab6022b06e2a05c5e6 Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 18:34:26 +0100 Subject: [PATCH 043/107] fix aarch64: mov, pushstr, pushstr_array fixes: - https://github.com/Gallopsled/pwntools/issues/2160 - https://github.com/Gallopsled/pwntools/issues/2284 --- pwnlib/shellcraft/templates/aarch64/mov.asm | 7 ++++--- .../shellcraft/templates/aarch64/pushstr.asm | 2 ++ .../templates/aarch64/pushstr_array.asm | 21 +++++++++++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/pwnlib/shellcraft/templates/aarch64/mov.asm b/pwnlib/shellcraft/templates/aarch64/mov.asm index 5c0165780..c6f4d93dc 100644 --- a/pwnlib/shellcraft/templates/aarch64/mov.asm +++ b/pwnlib/shellcraft/templates/aarch64/mov.asm @@ -80,14 +80,15 @@ xor = None %if not isinstance(src, six.integer_types): mov ${dst}, ${src} %else: + %if src & 0xffff == 0: + mov ${dst}, xzr + %endif %if src == 0: mov ${dst}, xzr - %elif src & 0xffff == 0: - eor ${dst}, ${dst}, ${dst} %elif src & 0xffff == src: mov ${dst}, #${src} %else: - /* Set ${dst} = ${src} = ${pretty(src)} */ + /* Set ${dst} = ${src} = ${pretty(src, False)} */ %if src & 0x000000000000ffff: mov ${dst}, #${(src >> 0x00) & 0xffff} %endif diff --git a/pwnlib/shellcraft/templates/aarch64/pushstr.asm b/pwnlib/shellcraft/templates/aarch64/pushstr.asm index 34872dce4..c5cf0e15d 100644 --- a/pwnlib/shellcraft/templates/aarch64/pushstr.asm +++ b/pwnlib/shellcraft/templates/aarch64/pushstr.asm @@ -37,6 +37,8 @@ if append_null and not string.endswith(b'\x00'): string += b'\x00' pretty_string = pretty or shellcraft.pretty(string) +if len(pretty_string) > 1000: + pretty_string = pretty_string[:1000] + '...' while len(string) % 8: string += b'\x00' diff --git a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm index 86bf58f19..cc70568d4 100644 --- a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm +++ b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm @@ -39,20 +39,33 @@ string = b''.join(array) # which seems like a safe maximum. if len(array) * 8 > 4095: raise Exception("Array size is too large (%i), max=4095" % len(array)) + +need_fix_alligment = len(array) % 2 == 1 %>\ /* push argument array ${shellcraft.pretty(array, False)} */ ${shellcraft.pushstr(string, register1=register1, register2=register2)} /* push null terminator */ - ${shellcraft.mov(register1, 0)} - str ${register1}, [sp, #-8]! + ${shellcraft.mov(register2, 0)} + str ${register2}, [sp, #-16]! /* push pointers onto the stack */ %for i, value in enumerate(reversed(array)): - ${shellcraft.mov(register1, (i+1)*8 + string.index(value))} + ${shellcraft.mov(register1, 8 + ((i+1)*8 + string.index(value)))} add ${register1}, sp, ${register1} - str ${register1}, [sp, #-8]! /* ${pretty(array[-i], False)} */ + %if i % 2 == 0: + str ${register2}, [sp, #-16]! /* allocate zeros */ + str ${register1}, [sp, #8]! + %else: + sub sp, sp, #8 + str ${register1}, [sp, #0]! + %endif %endfor /* set ${reg} to the current top of the stack */ ${shellcraft.mov(reg,'sp')} + + %if need_fix_alligment: + /* fix alligment */ + sub sp, sp, #8 + %endif From 976f7cc1752b6cd209e7c41bb72a508f478b873d Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 18:37:38 +0100 Subject: [PATCH 044/107] revert "powerpc64" typo --- pwnlib/abi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwnlib/abi.py b/pwnlib/abi.py index 4b2168e49..9b5976cfb 100644 --- a/pwnlib/abi.py +++ b/pwnlib/abi.py @@ -57,7 +57,7 @@ def default(): (32, 'thumb', 'freebsd'): freebsd_arm, (32, 'mips', 'freebsd'): freebsd_mips, (32, 'powerpc', 'freebsd'): freebsd_ppc, - (64, 'powerpc64', 'freebsd'): freebsd_ppc64, + (64, 'powerpc', 'freebsd'): freebsd_ppc64, (32, 'i386', 'windows'): windows_i386, (64, 'amd64', 'windows'): windows_amd64, (64, 'amd64', 'darwin'): darwin_amd64, @@ -90,7 +90,7 @@ def syscall(): (32, 'mips', 'freebsd'): freebsd_mips_syscall, (64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall, (32, 'powerpc', 'freebsd'): freebsd_ppc_syscall, - (64, 'powerpc64', 'freebsd'): freebsd_ppc64_syscall, + (64, 'powerpc', 'freebsd'): freebsd_ppc64_syscall, (64, 'amd64', 'darwin'): darwin_amd64_syscall, (64, 'aarch64', 'darwin'): darwin_aarch64_syscall, }[(context.bits, context.arch, context.os)] From bc6228e8bc9d70cb2f74dd17147a55125274de40 Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 18:56:14 +0100 Subject: [PATCH 045/107] fix freebsd amd64 syscall arguments --- pwnlib/abi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/abi.py b/pwnlib/abi.py index 9b5976cfb..1ba669b0e 100644 --- a/pwnlib/abi.py +++ b/pwnlib/abi.py @@ -193,7 +193,7 @@ class SigreturnABI(SyscallABI): freebsd_ppc64 = sysv_ppc64 freebsd_i386_syscall = SyscallABI('esp', ['eax'], 4, 0) -freebsd_amd64_syscall = SyscallABI('rsp', ['rax','rdi','rsi','rdx','rcx','r8','r9'], 8, 0) +freebsd_amd64_syscall = SyscallABI('rsp', ['rax','rdi','rsi','rdx','r10','r8','r9'], 8, 0) freebsd_arm_syscall = SyscallABI('sp', ['r7', 'r0', 'r1', 'r2', 'r3'], 8, 0) freebsd_aarch64_syscall = SyscallABI('sp', ['x8', 'x0', 'x1', 'x2', 'x3'], 16, 0) freebsd_mips_syscall = SyscallABI('$sp', ['$v0','$a0','$a1','$a2','$a3'], 4, 0) From a814be26044aebf76f0b8a40fc8a819d949aad6b Mon Sep 17 00:00:00 2001 From: psondej Date: Wed, 3 Jan 2024 19:40:05 +0100 Subject: [PATCH 046/107] refactor aarch64 pushstr_array, use "xzr" reg --- pwnlib/shellcraft/templates/aarch64/pushstr_array.asm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm index cc70568d4..b28458765 100644 --- a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm +++ b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm @@ -46,15 +46,14 @@ need_fix_alligment = len(array) % 2 == 1 ${shellcraft.pushstr(string, register1=register1, register2=register2)} /* push null terminator */ - ${shellcraft.mov(register2, 0)} - str ${register2}, [sp, #-16]! + str xzr, [sp, #-16]! /* push pointers onto the stack */ %for i, value in enumerate(reversed(array)): - ${shellcraft.mov(register1, 8 + ((i+1)*8 + string.index(value)))} + ${shellcraft.mov(register1, (i+2)*8 + string.index(value))} add ${register1}, sp, ${register1} %if i % 2 == 0: - str ${register2}, [sp, #-16]! /* allocate zeros */ + str xzr, [sp, #-16]! /* allocate zeros */ str ${register1}, [sp, #8]! %else: sub sp, sp, #8 From ad6ef0e3726e997e6b875463a65efc857a7b81a8 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Wed, 3 Jan 2024 21:25:42 +0100 Subject: [PATCH 047/107] Update pwnlib/shellcraft/templates/aarch64/mov.asm --- pwnlib/shellcraft/templates/aarch64/mov.asm | 1 - 1 file changed, 1 deletion(-) diff --git a/pwnlib/shellcraft/templates/aarch64/mov.asm b/pwnlib/shellcraft/templates/aarch64/mov.asm index c6f4d93dc..21a6b9d2c 100644 --- a/pwnlib/shellcraft/templates/aarch64/mov.asm +++ b/pwnlib/shellcraft/templates/aarch64/mov.asm @@ -84,7 +84,6 @@ xor = None mov ${dst}, xzr %endif %if src == 0: - mov ${dst}, xzr %elif src & 0xffff == src: mov ${dst}, #${src} %else: From 0339b46450f8833be3a248e2c22d6cd34a26576d Mon Sep 17 00:00:00 2001 From: Arusekk Date: Wed, 3 Jan 2024 21:26:12 +0100 Subject: [PATCH 048/107] Update pwnlib/elf/corefile.py --- pwnlib/elf/corefile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pwnlib/elf/corefile.py b/pwnlib/elf/corefile.py index ccacaf0b0..02ac36ebf 100644 --- a/pwnlib/elf/corefile.py +++ b/pwnlib/elf/corefile.py @@ -72,7 +72,6 @@ import socket import subprocess import tempfile -import sys from io import BytesIO, StringIO From 000ca1f637026086364ed46a0665c8ffc7fb92d7 Mon Sep 17 00:00:00 2001 From: vsyl <113261590+vsyl@users.noreply.github.com> Date: Sat, 13 Jan 2024 17:47:51 +0100 Subject: [PATCH 049/107] Fix unhex for odd length bytes (#2333) * Fix unhex for odd length bytes * Update pwnlib/util/fiddling.py --------- Co-authored-by: Arusekk --- pwnlib/util/fiddling.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pwnlib/util/fiddling.py b/pwnlib/util/fiddling.py index 29d8e8432..92e8ddc87 100644 --- a/pwnlib/util/fiddling.py +++ b/pwnlib/util/fiddling.py @@ -37,10 +37,15 @@ def unhex(s): b'test' >>> unhex("F\n") b'\x0f' + >>> unhex(bytearray(b" F ")) + b'\x0f' """ s = s.strip() if len(s) % 2 != 0: - s = '0' + s + if isinstance(s, (bytes, bytearray)): + s = b'0' + s + else: + s = '0' + s return binascii.unhexlify(s) def enhex(x): From 5805f5e9d787fdf29ef7f2f5347f284b44c3bd34 Mon Sep 17 00:00:00 2001 From: vsyl <113261590+vsyl@users.noreply.github.com> Date: Wed, 17 Jan 2024 21:44:52 +0100 Subject: [PATCH 050/107] Speed up disasm with color (#2334) * Speed up disasm with color * Update CHANGELOG --------- Co-authored-by: Peace-Maker --- CHANGELOG.md | 2 ++ pwnlib/asm.py | 2 ++ pwnlib/commandline/disasm.py | 37 ++++++++++++++++++++++++++---------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf8ed4ce4..51cfab80a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned - [#2279][2279] Make `pwn template` always set context.binary - [#2310][2310] Add support to start a process on Windows +- [#2334][2334] Speed up disasm commandline tool with colored output [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -91,6 +92,7 @@ The table below shows which release corresponds to each branch, and what date th [2308]: https://github.com/Gallopsled/pwntools/pull/2308 [2279]: https://github.com/Gallopsled/pwntools/pull/2279 [2310]: https://github.com/Gallopsled/pwntools/pull/2310 +[2334]: https://github.com/Gallopsled/pwntools/pull/2334 ## 4.12.0 (`beta`) diff --git a/pwnlib/asm.py b/pwnlib/asm.py index b37d39c8a..5103032e9 100644 --- a/pwnlib/asm.py +++ b/pwnlib/asm.py @@ -860,6 +860,8 @@ def disasm(data, vma = 0, byte = True, offset = True, instructions = True): lines = [] + + # Note: those patterns are also used in pwnlib/commandline/disasm.py pattern = '^( *[0-9a-f]+: *)', '((?:[0-9a-f]+ )+ *)', '(.*)' if not byte: pattern = pattern[::2] diff --git a/pwnlib/commandline/disasm.py b/pwnlib/commandline/disasm.py index 4c4535594..b304393d2 100644 --- a/pwnlib/commandline/disasm.py +++ b/pwnlib/commandline/disasm.py @@ -3,6 +3,7 @@ from __future__ import print_function import argparse +import re import string import sys @@ -76,18 +77,34 @@ def main(args): from pygments.formatters import TerminalFormatter from pwnlib.lexer import PwntoolsLexer - offsets = disasm(dat, vma=safeeval.const(args.address), instructions=False, byte=False) - bytes = disasm(dat, vma=safeeval.const(args.address), instructions=False, offset=False) - instrs = disasm(dat, vma=safeeval.const(args.address), byte=False, offset=False) - # instrs = highlight(instrs, PwntoolsLexer(), TerminalFormatter()) + dis = disasm(dat, vma=safeeval.const(args.address)) - highlight_bytes = lambda t: ''.join(map(lambda x: x.replace('00', text.red('00')).replace('0a', text.red('0a')), group(2, t))) - for o,b,i in zip(*map(str.splitlines, (offsets, bytes, instrs))): - b = ' '.join(highlight_bytes(bb) for bb in b.split(' ')) - i = highlight(i.strip(), PwntoolsLexer(), TerminalFormatter()).strip() - i = i.replace(',',', ') + # Note: those patterns are copied from disasm function + pattern = '^( *[0-9a-f]+: *)((?:[0-9a-f]+ )+ *)(.*)' + lines = [] + for line in dis.splitlines(): + match = re.search(pattern, line) + if not match: + # Append as one element tuple + lines.append((line,)) + continue + + groups = match.groups() + o, b, i = groups + + lines.append((o, b, i)) - print(o,b,i) + + highlight_bytes = lambda t: ''.join(map(lambda x: x.replace('00', text.red('00')).replace('0a', text.red('0a')), group(2, t))) + for line in lines: + if len(line) == 3: + o, b, i = line + b = ' '.join(highlight_bytes(bb) for bb in b.split(' ')) + i = highlight(i.strip(), PwntoolsLexer(), TerminalFormatter()).strip() + i = i.replace(',',', ') + print(o,b,i) + else: + print(line[0]) return print(disasm(dat, vma=safeeval.const(args.address))) From 7b78334ac406b89dff75158f67fadc1a7ccc3e5e Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Wed, 17 Jan 2024 21:57:38 +0100 Subject: [PATCH 051/107] Android: Install emulator in CI --- travis/setup_avd_fast.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/setup_avd_fast.sh b/travis/setup_avd_fast.sh index f55ea59d8..01cd9c4c0 100644 --- a/travis/setup_avd_fast.sh +++ b/travis/setup_avd_fast.sh @@ -14,7 +14,7 @@ ANDROIDV=android-24 # Create our emulator Android Virtual Device (AVD) # --snapshot flag is deprecated, see bitrise-steplib/steps-create-android-emulator#18 export PATH=$PATH:"$ANDROID_HOME"/cmdline-tools/latest/bin:"$ANDROID_HOME"/platform-tools -yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;default;$ANDROID_ABI" +yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;default;$ANDROID_ABI" "emulator" "platform-tools" "platforms;$ANDROIDV" yes | sdkmanager --sdk_root="$ANDROID_HOME" --licenses echo no | avdmanager --silent create avd --name android-$ANDROID_ABI --force --package "system-images;$ANDROIDV;default;$ANDROID_ABI" From d42784446518a9e3796573d9564f9d2f9728ceae Mon Sep 17 00:00:00 2001 From: peace-maker Date: Thu, 18 Jan 2024 00:57:43 +0100 Subject: [PATCH 052/107] Lookup using $PATHEXT file extensions in `which` on Windows (#2328) * Lookup process executable using PATHEXT file extensions Windows uses some file extensions to determine which file to run when given a non-existing file. This allows to run `calc` instead of `calc.exe`. * Try PATHEXT in `which` directly * Update CHANGELOG --- CHANGELOG.md | 2 ++ pwnlib/tubes/process.py | 8 ++++++-- pwnlib/util/misc.py | 40 +++++++++++++++++++++++++--------------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51cfab80a..b0391041f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2279][2279] Make `pwn template` always set context.binary - [#2310][2310] Add support to start a process on Windows - [#2334][2334] Speed up disasm commandline tool with colored output +- [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -93,6 +94,7 @@ The table below shows which release corresponds to each branch, and what date th [2279]: https://github.com/Gallopsled/pwntools/pull/2279 [2310]: https://github.com/Gallopsled/pwntools/pull/2310 [2334]: https://github.com/Gallopsled/pwntools/pull/2334 +[2328]: https://github.com/Gallopsled/pwntools/pull/2328 ## 4.12.0 (`beta`) diff --git a/pwnlib/tubes/process.py b/pwnlib/tubes/process.py index af9879bd9..e5f143e75 100644 --- a/pwnlib/tubes/process.py +++ b/pwnlib/tubes/process.py @@ -33,7 +33,7 @@ from pwnlib.util.misc import parse_ldd_output from pwnlib.util.misc import which from pwnlib.util.misc import normalize_argv_env -from pwnlib.util.packing import _need_bytes +from pwnlib.util.packing import _decode log = getLogger(__name__) @@ -558,7 +558,11 @@ def _validate(self, cwd, executable, argv, env): argv, env = normalize_argv_env(argv, env, self, 4) if env: - env = {bytes(k): bytes(v) for k, v in env} + if sys.platform == 'win32': + # Windows requires that all environment variables be strings + env = {_decode(k): _decode(v) for k, v in env} + else: + env = {bytes(k): bytes(v) for k, v in env} if argv: argv = list(map(bytes, argv)) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 2ca9f31a5..691539471 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -139,6 +139,7 @@ def which(name, all = False, path=None): Works as the system command ``which``; searches $PATH for ``name`` and returns a full path if found. + Tries all of the file extensions in $PATHEXT on Windows too. If `all` is :const:`True` the set of all found locations is returned, else the first occurrence or :const:`None` is returned. @@ -160,26 +161,35 @@ def which(name, all = False, path=None): if os.path.sep in name: return name - isroot = False if sys.platform == 'win32' else (os.getuid() == 0) + if sys.platform == 'win32': + pathexts = os.environ.get('PATHEXT', '').split(os.pathsep) + isroot = False + else: + pathexts = [] + isroot = os.getuid() == 0 + pathexts = [''] + pathexts out = set() try: path = path or os.environ['PATH'] except KeyError: log.exception('Environment variable $PATH is not set') - for p in path.split(os.pathsep): - p = os.path.join(p, name) - if os.access(p, os.X_OK): - st = os.stat(p) - if not stat.S_ISREG(st.st_mode): - continue - # work around this issue: https://bugs.python.org/issue9311 - if isroot and not \ - st.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH): - continue - if all: - out.add(p) - else: - return p + for path_part in path.split(os.pathsep): + for ext in pathexts: + nameext = name + ext + p = os.path.join(path_part, nameext) + if os.access(p, os.X_OK): + st = os.stat(p) + if not stat.S_ISREG(st.st_mode): + continue + # work around this issue: https://bugs.python.org/issue9311 + if isroot and not \ + st.st_mode & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH): + continue + if all: + out.add(p) + break + else: + return p if all: return out else: From ea22cc8cefbb4d7468c7a2803582fec79b4f4b7b Mon Sep 17 00:00:00 2001 From: Arusekk Date: Sat, 20 Jan 2024 22:39:34 +0100 Subject: [PATCH 053/107] shellcraft.amd64.mov: fix logic --- pwnlib/shellcraft/templates/aarch64/mov.asm | 78 +++++++++++---------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/pwnlib/shellcraft/templates/aarch64/mov.asm b/pwnlib/shellcraft/templates/aarch64/mov.asm index 21a6b9d2c..524e11924 100644 --- a/pwnlib/shellcraft/templates/aarch64/mov.asm +++ b/pwnlib/shellcraft/templates/aarch64/mov.asm @@ -46,35 +46,40 @@ if dst not in regs: if not src in regs: src = SC.eval(src) -mov_x0_x15 = False -xor = None +mov_x15 = None +xor = None -# if isinstance(src, six.integer_types): -# # Moving an immediate into x0 emits a null byte. -# # Moving a register into x0 does not. -# # Use x15 as a scratch register. -# if dst == 'x0': -# mov_x0_x15 = True -# dst = 'x15' -# -# packed = pack(src) -# words = group(2, packed) -# xor = ['\x00\x00'] * 4 -# okay = False -# -# for i, word in enumerate(list(words)): -# # If an entire word is zero, we can work around it. -# # However, if any of the individual bytes are '\n', or only -# # one of the bytes is a zero, we must do an XOR. -# if '\n' not in word or word == '\x00\x00' or '\x00' not in word: -# continue -# -# a, b = xor_pair(word) -# words[i] = a -# xor[i] = b -# -# src = unpack(''.join(words)) -# xor = unpack(''.join(xor)) + +if isinstance(src, six.integer_types): + lobits = dst not in ('x0', 'x10') + packed = pack(src) + words = group(2, packed) + xor = [b'\x00\x00'] * 4 + + for i, word in enumerate(list(words)): + # If an entire word is zero, we can work around it. + # However, if any of the individual bytes are '\n', or only + # one of the bytes is a zero, we must do an XOR. + if word == b'\x00\x00': continue + + w = p16((u16(word) & 0x7ff) << 5 | lobits) + if b'\n' not in w and b'\x00' not in w: + if u16(word) & 7 == 0 and not lobits: + mov_x15 = dst + dst = 'x15' + lobits = 15 + continue + + a, b = xor_pair(word) + words[i] = a + xor[i] = b + if dst == 'x0': + mov_x15 = dst + dst = 'x15' + lobits = 15 + + src = unpack(b''.join(words)) + xor = unpack(b''.join(xor)) %> %if not isinstance(src, six.integer_types): @@ -83,8 +88,7 @@ xor = None %if src & 0xffff == 0: mov ${dst}, xzr %endif - %if src == 0: - %elif src & 0xffff == src: + %if src & 0xffff == src != 0: mov ${dst}, #${src} %else: /* Set ${dst} = ${src} = ${pretty(src, False)} */ @@ -100,12 +104,12 @@ xor = None %if src & 0xffff000000000000: movk ${dst}, #${(src >> 0x30) & 0xffff}, lsl #0x30 %endif - %if xor: - ${SC.mov('x14', xor)} - eor ${dst}, ${dst}, x14 - %endif - %if mov_x0_x15: - ${SC.mov('x0','x15')} - %endif + %endif + %if xor: + ${SC.mov('x14', xor)} + eor ${dst}, ${dst}, x14 + %endif + %if mov_x15: + ${SC.mov(mov_x15,'x15')} %endif %endif From b5253fa510abb050f3773da7bdfde88b6d97e19b Mon Sep 17 00:00:00 2001 From: Arusekk Date: Sun, 21 Jan 2024 04:58:30 +0100 Subject: [PATCH 054/107] shellcraft.amd64.mov: fix logic once again --- .../templates/aarch64/linux/syscall.asm | 8 ++--- pwnlib/shellcraft/templates/aarch64/mov.asm | 30 ++++++++++++------- pwnlib/shellcraft/templates/aarch64/push.asm | 6 ++-- .../shellcraft/templates/aarch64/setregs.asm | 4 +-- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm b/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm index 9269bc1c7..9fceb1afd 100644 --- a/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm @@ -13,11 +13,11 @@ Any of the arguments can be expressions to be evaluated by :func:`pwnlib.constan Example: - >>> print(shellcraft.aarch64.linux.syscall(11, 1, 'sp', 2, 0).rstrip()) - /* call syscall(0xb, 1, 'sp', 2, 0) */ - mov x0, #1 + >>> print(shellcraft.aarch64.linux.syscall(11, 9, 'sp', 8, 0).rstrip()) + /* call syscall(0xb, 9, 'sp', 8, 0) */ + mov x0, #9 mov x1, sp - mov x2, #2 + mov x2, #8 mov x3, xzr mov x8, #11 svc 0 diff --git a/pwnlib/shellcraft/templates/aarch64/mov.asm b/pwnlib/shellcraft/templates/aarch64/mov.asm index 524e11924..3dc595246 100644 --- a/pwnlib/shellcraft/templates/aarch64/mov.asm +++ b/pwnlib/shellcraft/templates/aarch64/mov.asm @@ -28,12 +28,12 @@ Examples: mov x0, x1 >>> print(shellcraft.mov('x0','0').rstrip()) mov x0, xzr - >>> print(shellcraft.mov('x0', 5).rstrip()) - mov x0, #5 - >>> print(shellcraft.mov('x0', 0x34532).rstrip()) - /* Set x0 = 214322 = 0x34532 */ + >>> print(shellcraft.mov('x0', 9).rstrip()) + mov x0, #9 + >>> print(shellcraft.mov('x0', 0x94532).rstrip()) + /* Set x0 = 607538 = 0x94532 */ mov x0, #17714 - movk x0, #3, lsl #16 + movk x0, #9, lsl #16 Args: dest (str): The destination register. @@ -78,22 +78,30 @@ if isinstance(src, six.integer_types): dst = 'x15' lobits = 15 - src = unpack(b''.join(words)) xor = unpack(b''.join(xor)) + if xor: + src = unpack(b''.join(words)) + +tmp = 'x14' +if dst == 'x14': + tmp = 'x15' +if dst == 'x15': + tmp = 'x12' %> %if not isinstance(src, six.integer_types): mov ${dst}, ${src} %else: - %if src & 0xffff == 0: + %if src == 0: mov ${dst}, xzr - %endif - %if src & 0xffff == src != 0: + %elif src & 0xffff == src: mov ${dst}, #${src} %else: /* Set ${dst} = ${src} = ${pretty(src, False)} */ %if src & 0x000000000000ffff: mov ${dst}, #${(src >> 0x00) & 0xffff} + %else: + mov ${dst}, xzr %endif %if src & 0x00000000ffff0000: movk ${dst}, #${(src >> 0x10) & 0xffff}, lsl #16 @@ -106,8 +114,8 @@ if isinstance(src, six.integer_types): %endif %endif %if xor: - ${SC.mov('x14', xor)} - eor ${dst}, ${dst}, x14 + ${SC.mov(tmp, xor)} + eor ${dst}, ${dst}, ${tmp} %endif %if mov_x15: ${SC.mov(mov_x15,'x15')} diff --git a/pwnlib/shellcraft/templates/aarch64/push.asm b/pwnlib/shellcraft/templates/aarch64/push.asm index b0c6ef73a..43b8323bb 100644 --- a/pwnlib/shellcraft/templates/aarch64/push.asm +++ b/pwnlib/shellcraft/templates/aarch64/push.asm @@ -28,9 +28,9 @@ Example: /* push 0 */ mov x14, xzr str x14, [sp, #-16]! - >>> print(pwnlib.shellcraft.push(1).rstrip()) - /* push 1 */ - mov x14, #1 + >>> print(pwnlib.shellcraft.push(9).rstrip()) + /* push 9 */ + mov x14, #9 str x14, [sp, #-16]! >>> print(pwnlib.shellcraft.push(256).rstrip()) /* push 0x100 */ diff --git a/pwnlib/shellcraft/templates/aarch64/setregs.asm b/pwnlib/shellcraft/templates/aarch64/setregs.asm index 78732bf34..aaaa08ff2 100644 --- a/pwnlib/shellcraft/templates/aarch64/setregs.asm +++ b/pwnlib/shellcraft/templates/aarch64/setregs.asm @@ -13,8 +13,8 @@ Args: Example: - >>> print(shellcraft.setregs({'x0':1, 'x2':'x3'}).rstrip()) - mov x0, #1 + >>> print(shellcraft.setregs({'x0':9, 'x2':'x3'}).rstrip()) + mov x0, #9 mov x2, x3 >>> print(shellcraft.setregs({'x0':'x1', 'x1':'x0', 'x2':'x3'}).rstrip()) mov x2, x3 From 14309dc111506d9e2f1f6a05ea19f5a1eec3061e Mon Sep 17 00:00:00 2001 From: Arusekk Date: Sun, 21 Jan 2024 12:14:53 +0100 Subject: [PATCH 055/107] elf.maps: Update hardcoded shellcodes --- pwnlib/elf/maps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/elf/maps.py b/pwnlib/elf/maps.py index 2f133a821..e5dce4231 100644 --- a/pwnlib/elf/maps.py +++ b/pwnlib/elf/maps.py @@ -22,6 +22,6 @@ '726f093c2f702935f0ffa9af7365093c632f2935f4ffa9af2f6d093c6c662935f8ffa9af8cff193c9e8f393727482003fcffa9aff0ffbd272020a003ffff0528ffbf192427302003a50f02340c01010122e8a603fcffa2affcffa48f2028a003a30f02340c010101feff1924272020032028a003fcffa2affcffa68fa40f02340c010101' 'ffff0428a10f02340c010101', 'aarch64': - 'ee058ed24eeeadf26eecc5f26eaeecf28fcd8cd2efa5adf22f0ccef26f0ee0f2ee3fbfa980f39fd2e0ffbff2e0ffdff2e0fffff2e1030091e2031faa080780d2010000d4020088d2ff6322cbe1030091e80780d2010000d4e20300aa200080d2e1030091080880d2010000d4' + 'ee058ed24eeeadf26eecc5f26eaeecf28fcd8cd2efa5adf22f0ccef26f0ee0f2ee3fbfa980f39fd2e0ffbff2e0ffdff2e0fffff2e1030091e2031faa080780d2010000d4222080d22e2088d242000ecaff6322cbe1030091e80780d2010000d4e20300aa4f2080d26c2080d2ef010ccae0030faae1030091080880d2010000d4' 'e0031faaa80b80d2010000d4', } From 6dc1c2f72f6cad9a02b7c6a128f00129d5cc09e4 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 21 Jan 2024 18:22:09 +0100 Subject: [PATCH 056/107] Explicitly define p64/u64 functions for IDE support (#2189) * Explicitly define p64/u64 functions for IDE support Instead of dynamically generating the packing and unpacking helper functions using `setattr(module, name, routine)` at runtime, unroll the loop and explicitly declare all 8 helpers. This allows IDEs to know about the function statically without running the code. Fixes #1657 * Update CHANGELOG * Fix u16 comment --- CHANGELOG.md | 2 + pwnlib/util/packing.py | 163 +++++++++++++++++++++++++++++++++++------ 2 files changed, 141 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0391041f..40c98bbd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2310][2310] Add support to start a process on Windows - [#2334][2334] Speed up disasm commandline tool with colored output - [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows +- [#2189][2189] Explicitly define p64/u64 functions for IDE support [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -95,6 +96,7 @@ The table below shows which release corresponds to each branch, and what date th [2310]: https://github.com/Gallopsled/pwntools/pull/2310 [2334]: https://github.com/Gallopsled/pwntools/pull/2334 [2328]: https://github.com/Gallopsled/pwntools/pull/2328 +[2189]: https://github.com/Gallopsled/pwntools/pull/2189 ## 4.12.0 (`beta`) diff --git a/pwnlib/util/packing.py b/pwnlib/util/packing.py index 15dcddca1..83209e088 100644 --- a/pwnlib/util/packing.py +++ b/pwnlib/util/packing.py @@ -296,12 +296,7 @@ def unpack_many(data, word_size = None): ends = ['b','l'] signs = ['s','u'] -return_types = {'p': 'bytes', 'u': 'int'} op_verbs = {'p': 'pack', 'u': 'unpack'} -arg_doc = {'p': 'number (int): Number to convert', - 'u': 'data (bytes): Byte string to convert'} -rv_doc = {'p': 'The packed number as a byte string', - 'u': 'The unpacked number'} def make_single(op,size,end,sign): @@ -334,46 +329,166 @@ def routine(data, stacklevel=None): # # Make normal user-oriented packers, e.g. p8 # -def make_multi(op, size): +def _do_packing(op, size, number): name = "%s%s" % (op,size) + mod = sys.modules[__name__] ls = getattr(mod, "_%sls" % (name)) lu = getattr(mod, "_%slu" % (name)) bs = getattr(mod, "_%sbs" % (name)) bu = getattr(mod, "_%sbu" % (name)) - @LocalNoarchContext - def routine(number): - endian = context.endian - signed = context.signed - return {("little", True ): ls, - ("little", False): lu, - ("big", True ): bs, - ("big", False): bu}[endian, signed](number, 3) + endian = context.endian + signed = context.signed + return {("little", True ): ls, + ("little", False): lu, + ("big", True ): bs, + ("big", False): bu}[endian, signed](number, 3) - routine.__name__ = name - routine.__doc__ = """%s%s(number, sign, endian, ...) -> %s +@LocalNoarchContext +def p8(number, endianness = None, sign = None, **kwargs): + """p8(number, endianness, sign, ...) -> bytes - %ss an %s-bit integer + Packs an 8-bit integer Arguments: - %s + number (int): Number to convert endianness (str): Endianness of the converted integer ("little"/"big") sign (str): Signedness of the converted integer ("unsigned"/"signed") kwargs (dict): Arguments passed to context.local(), such as ``endian`` or ``signed``. Returns: - %s - """ % (op, size, return_types[op], op_verbs[op].title(), size, arg_doc[op], rv_doc[op]) + The packed number as a byte string + """ + return _do_packing('p', 8, number) - return name, routine +@LocalNoarchContext +def p16(number, endianness = None, sign = None, **kwargs): + """p16(number, endianness, sign, ...) -> bytes + Packs an 16-bit integer -for op,size in iters.product(ops, sizes): - name, routine = make_multi(op,size) - setattr(mod, name, routine) + Arguments: + number (int): Number to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The packed number as a byte string + """ + return _do_packing('p', 16, number) + +@LocalNoarchContext +def p32(number, endianness = None, sign = None, **kwargs): + """p32(number, endianness, sign, ...) -> bytes + + Packs an 32-bit integer + + Arguments: + number (int): Number to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The packed number as a byte string + """ + return _do_packing('p', 32, number) + +@LocalNoarchContext +def p64(number, endianness = None, sign = None, **kwargs): + """p64(number, endianness, sign, ...) -> bytes + + Packs an 64-bit integer + + Arguments: + number (int): Number to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The packed number as a byte string + """ + return _do_packing('p', 64, number) + +@LocalNoarchContext +def u8(data, endianness = None, sign = None, **kwargs): + """u8(data, endianness, sign, ...) -> int + + Unpacks an 8-bit integer + + Arguments: + data (bytes): Byte string to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The unpacked number + """ + return _do_packing('u', 8, data) + +@LocalNoarchContext +def u16(data, endianness = None, sign = None, **kwargs): + """u16(data, endianness, sign, ...) -> int + + Unpacks an 16-bit integer + + Arguments: + data (bytes): Byte string to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The unpacked number + """ + return _do_packing('u', 16, data) + +@LocalNoarchContext +def u32(data, endianness = None, sign = None, **kwargs): + """u32(data, endianness, sign, ...) -> int + + Unpacks an 32-bit integer + + Arguments: + data (bytes): Byte string to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The unpacked number + """ + return _do_packing('u', 32, data) + +@LocalNoarchContext +def u64(data, endianness = None, sign = None, **kwargs): + """u64(data, endianness, sign, ...) -> int + + Unpacks an 64-bit integer + + Arguments: + data (bytes): Byte string to convert + endianness (str): Endianness of the converted integer ("little"/"big") + sign (str): Signedness of the converted integer ("unsigned"/"signed") + kwargs (dict): Arguments passed to context.local(), such as + ``endian`` or ``signed``. + + Returns: + The unpacked number + """ + return _do_packing('u', 64, data) def make_packer(word_size = None, sign = None, **kwargs): """make_packer(word_size = None, endianness = None, sign = None) -> number → str From f6bee59b4689f8161b20ce98d0bc9661fd2e3567 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Mon, 22 Jan 2024 07:29:43 +0100 Subject: [PATCH 057/107] elf.maps: Less nullbytes + update hardcoded shellcodes --- pwnlib/elf/maps.py | 2 +- pwnlib/shellcraft/templates/aarch64/linux/syscall.asm | 4 ++-- pwnlib/shellcraft/templates/aarch64/mov.asm | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pwnlib/elf/maps.py b/pwnlib/elf/maps.py index e5dce4231..b57a56151 100644 --- a/pwnlib/elf/maps.py +++ b/pwnlib/elf/maps.py @@ -22,6 +22,6 @@ '726f093c2f702935f0ffa9af7365093c632f2935f4ffa9af2f6d093c6c662935f8ffa9af8cff193c9e8f393727482003fcffa9aff0ffbd272020a003ffff0528ffbf192427302003a50f02340c01010122e8a603fcffa2affcffa48f2028a003a30f02340c010101feff1924272020032028a003fcffa2affcffa68fa40f02340c010101' 'ffff0428a10f02340c010101', 'aarch64': - 'ee058ed24eeeadf26eecc5f26eaeecf28fcd8cd2efa5adf22f0ccef26f0ee0f2ee3fbfa980f39fd2e0ffbff2e0ffdff2e0fffff2e1030091e2031faa080780d2010000d4222080d22e2088d242000ecaff6322cbe1030091e80780d2010000d4e20300aa4f2080d26c2080d2ef010ccae0030faae1030091080880d2010000d4' + 'ee058ed24eeeadf26eecc5f26eaeecf28fcd8cd2efa5adf22f0ccef26f0ee0f2ee3fbfa980f39fd2e0ffbff2e0ffdff2e0fffff2e1633f8be2031faa080780d2010000d4222080d22e2088d2c20102caff6322cbe1633f8be80780d2010000d402041f8b4f2080d26c2080d28f010fcae0030faae1633f8b080880d2010000d4' 'e0031faaa80b80d2010000d4', } diff --git a/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm b/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm index 9fceb1afd..b0acc3068 100644 --- a/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm @@ -16,7 +16,7 @@ Example: >>> print(shellcraft.aarch64.linux.syscall(11, 9, 'sp', 8, 0).rstrip()) /* call syscall(0xb, 9, 'sp', 8, 0) */ mov x0, #9 - mov x1, sp + add x1, sp, xzr mov x2, #8 mov x3, xzr mov x8, #11 @@ -39,7 +39,7 @@ Example: movk x15, #27750, lsl #16 movk x15, #26465, lsl #0x20 stp x14, x15, [sp, #-16]! - mov x1, sp + add x1, sp, xzr /* Set x0 = -2 = -2 */ mov x0, #65534 movk x0, #65535, lsl #16 diff --git a/pwnlib/shellcraft/templates/aarch64/mov.asm b/pwnlib/shellcraft/templates/aarch64/mov.asm index 3dc595246..06a3609e0 100644 --- a/pwnlib/shellcraft/templates/aarch64/mov.asm +++ b/pwnlib/shellcraft/templates/aarch64/mov.asm @@ -89,7 +89,11 @@ if dst == 'x15': tmp = 'x12' %> -%if not isinstance(src, six.integer_types): +%if src == 'sp': + add ${dst}, ${src}, xzr +%elif src == 'x0': + add ${dst}, ${src}, xzr, lsl #1 +%elif not isinstance(src, six.integer_types): mov ${dst}, ${src} %else: %if src == 0: @@ -115,9 +119,9 @@ if dst == 'x15': %endif %if xor: ${SC.mov(tmp, xor)} - eor ${dst}, ${dst}, ${tmp} + eor ${dst}, ${tmp}, ${dst} %endif %if mov_x15: - ${SC.mov(mov_x15,'x15')} + mov ${mov_x15}, x15 %endif %endif From 4e11ee7d9937e533f9e4a23fb7342c37f725904e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:17:27 +0000 Subject: [PATCH 058/107] Bump actions/cache from 3 to 4 (#2337) --- .github/workflows/android.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/pylint.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 6cbbb7e3b..d8e64c172 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - name: Cache for pip - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-pip with: path: ~/.cache/pip diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ddf7e1aa..f21ceb38f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: git log --oneline --graph -10 - name: Cache for pip - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-pip with: path: ~/.cache/pip diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9cc95fd00..d41f05912 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Cache for pip - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-pip with: path: ~/.cache/pip diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index a76794b0a..c65003023 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Cache for pip - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-pip with: path: ~/.cache/pip From cb3fda4a7e8e3869cc2ecc581f4d620e2182de0b Mon Sep 17 00:00:00 2001 From: teddav Date: Tue, 23 Jan 2024 00:24:58 +0100 Subject: [PATCH 059/107] fix: follow symlink for libs() on ssh connection (#2338) --- pwnlib/tubes/ssh.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 1d2a2e48e..408497fe0 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -324,6 +324,7 @@ def libs(self): for lib in maps: remote_path = lib.split(self.parent.host)[-1] + remote_path = self.parent.readlink('-f', remote_path).decode() for line in maps_raw.splitlines(): if line.endswith(remote_path): address = line.split('-')[0] From 171d9dfb3979c156d9d962dc8987f083178a5200 Mon Sep 17 00:00:00 2001 From: Nils1729 <45318774+Nils1729@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:20:31 +0100 Subject: [PATCH 060/107] Fix: Allow setting attributes on gdb Breakpoints (#2339) * fix: Allow setting attributes on gdb Breakpoints * Update CHANGELOG * Add __getattr__ accidentally deleted from FinishBreakpoint --- CHANGELOG.md | 2 ++ pwnlib/gdb.py | 37 +++++++++++++++++++++++++++---------- pwnlib/gdb_api_bridge.py | 1 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40c98bbd6..08e1257eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2334][2334] Speed up disasm commandline tool with colored output - [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows - [#2189][2189] Explicitly define p64/u64 functions for IDE support +- [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -97,6 +98,7 @@ The table below shows which release corresponds to each branch, and what date th [2334]: https://github.com/Gallopsled/pwntools/pull/2334 [2328]: https://github.com/Gallopsled/pwntools/pull/2328 [2189]: https://github.com/Gallopsled/pwntools/pull/2189 +[2339]: https://github.com/Gallopsled/pwntools/pull/2339 ## 4.12.0 (`beta`) diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index df2599669..da9686934 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -652,7 +652,10 @@ def __init__(self, conn, *args, **kwargs): """ # Creates a real breakpoint and connects it with this mirror self.conn = conn - self.server_breakpoint = conn.root.set_breakpoint( + self.server_breakpoint = self._server_set_breakpoint(*args, **kwargs) + + def _server_set_breakpoint(self, *args, **kwargs): + return self.conn.root.set_breakpoint( self, hasattr(self, 'stop'), *args, **kwargs) def __getattr__(self, item): @@ -670,25 +673,43 @@ def __getattr__(self, item): raise AttributeError() return getattr(self.server_breakpoint, item) + def __setattr__(self, name, value): + """Set attributes of the real breakpoint.""" + if name in ( + 'enabled', + 'silent', + 'thread', + 'task', + 'ignore_count', + 'hit_count' + 'condition', + 'commands', + ): + return setattr(self.server_breakpoint, name, value) + return super().__setattr__(name, value) + def exposed_stop(self): # Handle stop() call from the server. return self.stop() -class FinishBreakpoint: +class FinishBreakpoint(Breakpoint): """Mirror of ``gdb.FinishBreakpoint`` class. See https://sourceware.org/gdb/onlinedocs/gdb/Finish-Breakpoints-in-Python.html for more information. """ - def __init__(self, conn, *args, **kwargs): + def __init__(self, *args, **kwargs): """Do not create instances of this class directly. Use ``pwnlib.gdb.Gdb.FinishBreakpoint`` instead. """ - # Creates a real finish breakpoint and connects it with this mirror - self.conn = conn - self.server_breakpoint = conn.root.set_finish_breakpoint( + # See https://github.com/pylint-dev/pylint/issues/4228 + # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + def _server_set_breakpoint(self, *args, **kwargs): + return self.conn.root.set_finish_breakpoint( self, hasattr(self, 'stop'), hasattr(self, 'out_of_scope'), *args, **kwargs) @@ -708,10 +729,6 @@ def __getattr__(self, item): raise AttributeError() return getattr(self.server_breakpoint, item) - def exposed_stop(self): - # Handle stop() call from the server. - return self.stop() - def exposed_out_of_scope(self): # Handle out_of_scope() call from the server. return self.out_of_scope() diff --git a/pwnlib/gdb_api_bridge.py b/pwnlib/gdb_api_bridge.py index 05f209e61..b46231496 100644 --- a/pwnlib/gdb_api_bridge.py +++ b/pwnlib/gdb_api_bridge.py @@ -110,5 +110,6 @@ def exposed_quit(self): socket_path=socket_path, protocol_config={ 'allow_all_attrs': True, + 'allow_setattr': True, }, ).start) From e466f5c2a6e60607a38979e37aad780a820a61d3 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 30 Jan 2024 11:08:57 +0100 Subject: [PATCH 061/107] Make sure TERM_PROGRAM points to a valid program (#2329) Visual Studio Code sets the $TERM_PROGRAM environment variable to `"vscode"` in its terminal pane, but doesn't support opening new panes from the command line and there is no "vscode" binary. Make sure the target binary exists before trying to launch it. --- pwnlib/util/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 691539471..22dff501a 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -307,7 +307,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr elif 'STY' in os.environ and which('screen'): terminal = 'screen' args = ['-t','pwntools-gdb','bash','-c'] - elif 'TERM_PROGRAM' in os.environ: + elif 'TERM_PROGRAM' in os.environ and which(os.environ['TERM_PROGRAM']): terminal = os.environ['TERM_PROGRAM'] args = [] elif 'DISPLAY' in os.environ and which('x-terminal-emulator'): From 993f590ac2efcccff669fbdc088c24db1984d429 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 30 Jan 2024 11:29:31 +0100 Subject: [PATCH 062/107] Retry failed lookups after one week in libcdb (#2323) * Retry failed lookups after one week in libcdb The libc databases might be updated to include the searched version, so a request that failed once might work in the future. Refs #983 * Update CHANGELOG --- CHANGELOG.md | 2 ++ pwnlib/libcdb.py | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08e1257eb..3bcdbd48e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows - [#2189][2189] Explicitly define p64/u64 functions for IDE support - [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints +- [#2323][2323] Retry failed lookups after one week in libcdb [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -99,6 +100,7 @@ The table below shows which release corresponds to each branch, and what date th [2328]: https://github.com/Gallopsled/pwntools/pull/2328 [2189]: https://github.com/Gallopsled/pwntools/pull/2189 [2339]: https://github.com/Gallopsled/pwntools/pull/2339 +[2323]: https://github.com/Gallopsled/pwntools/pull/2323 ## 4.12.0 (`beta`) diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 0fb186b7f..142c95d23 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -5,6 +5,7 @@ from __future__ import division import os +import time import six import tempfile @@ -29,6 +30,9 @@ urls = os.environ['DEBUGINFOD_URLS'].split(' ') DEBUGINFOD_SERVERS = urls + DEBUGINFOD_SERVERS +# Retry failed lookups after some time +NEGATIVE_CACHE_EXPIRY = 60 * 60 * 24 * 7 # 1 week + # https://gitlab.com/libcdb/libcdb wasn't updated after 2019, # but still is a massive database of older libc binaries. def provider_libcdb(hex_encoded_id, hash_type): @@ -109,6 +113,10 @@ def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True): cache, cache_valid = _check_elf_cache('libcdb', hex_encoded_id, hash_type) if cache_valid: return cache + + # We searched for this buildid before, but didn't find anything. + if cache is None: + return None # Run through all available libc database providers to see if we have a match. for provider in PROVIDERS: @@ -141,6 +149,10 @@ def _search_debuginfo_by_hash(base_url, hex_encoded_id): cache, cache_valid = _check_elf_cache('libcdb_dbg', hex_encoded_id, 'build_id') if cache_valid: return cache + + # We searched for this buildid before, but didn't find anything. + if cache is None: + return None # Try to find separate debuginfo. url = '/buildid/{}/debuginfo'.format(hex_encoded_id) @@ -191,8 +203,11 @@ def _check_elf_cache(cache_type, hex_encoded_id, hash_type): data = read(cache) if not data.startswith(b'\x7FELF'): - log.info_once("Skipping unavailable ELF %s", hex_encoded_id) - return cache, False + # Retry failed lookups after some time + if time.time() > os.path.getmtime(cache) + NEGATIVE_CACHE_EXPIRY: + return cache, False + log.info_once("Skipping invalid cached ELF %s", hex_encoded_id) + return None, False log.info_once("Using cached data from %r", cache) return cache, True From 27bc31e978c1bf27d96236e878f5d403a201a3ad Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 30 Jan 2024 12:20:20 +0100 Subject: [PATCH 063/107] Match against local system libc first in libcdb (#2325) * Match against local system libc first in libcdb Don't do any requests if the libc currently in use on the system running the exploit matches already. This is a small short circuit optimization when the remote target uses the same libc as the local one. This looks at the libc loaded by the local shell binary. This appears more dynamic than hardcoding library paths. Refs #983 * Update CHANGELOG * Handle missing SHELL envvar * Fix hash lookup --- CHANGELOG.md | 2 ++ pwnlib/libcdb.py | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bcdbd48e..5d39a0c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2189][2189] Explicitly define p64/u64 functions for IDE support - [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints - [#2323][2323] Retry failed lookups after one week in libcdb +- [#2325][2325] Match against local system libc first in libcdb [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -101,6 +102,7 @@ The table below shows which release corresponds to each branch, and what date th [2189]: https://github.com/Gallopsled/pwntools/pull/2189 [2339]: https://github.com/Gallopsled/pwntools/pull/2339 [2323]: https://github.com/Gallopsled/pwntools/pull/2323 +[2325]: https://github.com/Gallopsled/pwntools/pull/2325 ## 4.12.0 (`beta`) diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 142c95d23..4955af3f3 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -14,6 +14,7 @@ from pwnlib.log import getLogger from pwnlib.tubes.process import process from pwnlib.util.fiddling import enhex +from pwnlib.util.hashes import sha1filehex, sha256filehex, md5filehex from pwnlib.util.misc import read from pwnlib.util.misc import which from pwnlib.util.misc import write @@ -21,7 +22,12 @@ log = getLogger(__name__) -HASHES = ['build_id', 'sha1', 'sha256', 'md5'] +HASHES = { + 'build_id': lambda path: enhex(ELF(path, checksec=False).buildid or b''), + 'sha1': sha1filehex, + 'sha256': sha256filehex, + 'md5': md5filehex, +} DEBUGINFOD_SERVERS = [ 'https://debuginfod.elfutils.org/', ] @@ -104,7 +110,23 @@ def provider_libc_rip(hex_encoded_id, hash_type): return None return data -PROVIDERS = [provider_libcdb, provider_libc_rip] +# Check if the local system libc matches the requested hash. +def provider_local_system(hex_encoded_id, hash_type): + if hash_type == 'id': + return None + shell_path = os.environ.get('SHELL', None) or '/bin/sh' + if not os.path.exists(shell_path): + log.debug('Shell path %r does not exist. Skipping local system libc matching.', shell_path) + return None + local_libc = ELF(shell_path, checksec=False).libc + if not local_libc: + log.debug('Cannot lookup libc from shell %r. Skipping local system libc matching.', shell_path) + return None + if HASHES[hash_type](local_libc.path) == hex_encoded_id: + return local_libc.data + return None + +PROVIDERS = [provider_local_system, provider_libcdb, provider_libc_rip] def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True): assert hash_type in HASHES, hash_type From bf7abc054a7ae4e82f4d36607f761f5bba7ddcc0 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Tue, 30 Jan 2024 12:40:28 +0100 Subject: [PATCH 064/107] Add `ELF.stripped` and `ELF.debuginfo` properties (#2336) * Add `ELF.stripped` and `ELF.debuginfo` Show status in checksec output too. * Update CHANGELOG * Show stripped and debuginfo status in red in checksec --- CHANGELOG.md | 2 ++ pwnlib/elf/elf.py | 52 +++++++++++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d39a0c09..090209565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints - [#2323][2323] Retry failed lookups after one week in libcdb - [#2325][2325] Match against local system libc first in libcdb +- [#2336][2336] Add `ELF.stripped` and `ELF.debuginfo` properties [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -103,6 +104,7 @@ The table below shows which release corresponds to each branch, and what date th [2339]: https://github.com/Gallopsled/pwntools/pull/2339 [2323]: https://github.com/Gallopsled/pwntools/pull/2323 [2325]: https://github.com/Gallopsled/pwntools/pull/2325 +[2336]: https://github.com/Gallopsled/pwntools/pull/2336 ## 4.12.0 (`beta`) diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index 4751975b3..4bc59bda3 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -448,7 +448,7 @@ def debug(self, argv=[], *a, **kw): def _describe(self, *a, **kw): log.info_once( - '%s\n%-10s%s-%s-%s\n%s', + '%s\n%-12s%s-%s-%s\n%s', repr(self.path), 'Arch:', self.arch, @@ -2002,6 +2002,16 @@ def packed(self): """:class:`bool`: Whether the current binary is packed with UPX.""" return b'UPX!' in self.get_data()[:0xFF] + @property + def stripped(self): + """:class:`bool`: Whether the current binary has been stripped of symbols""" + return not any(section['sh_type'] == 'SHT_SYMTAB' for section in self.iter_sections()) + + @property + def debuginfo(self): + """:class:`bool`: Whether the current binary has debug information""" + return self.get_section_by_name('.debug_info') is not None + @property def pie(self): """:class:`bool`: Whether the current binary is position-independent.""" @@ -2045,26 +2055,26 @@ def checksec(self, banner=True, color=True): # Kernel version? if self.version and self.version != (0,): - res.append('Version:'.ljust(10) + '.'.join(map(str, self.version))) + res.append('Version:'.ljust(12) + '.'.join(map(str, self.version))) if self.build: - res.append('Build:'.ljust(10) + self.build) + res.append('Build:'.ljust(12) + self.build) res.extend([ - "RELRO:".ljust(10) + { + "RELRO:".ljust(12) + { 'Full': green("Full RELRO"), 'Partial': yellow("Partial RELRO"), None: red("No RELRO") }[self.relro], - "Stack:".ljust(10) + { + "Stack:".ljust(12) + { True: green("Canary found"), False: red("No canary found") }[self.canary], - "NX:".ljust(10) + { + "NX:".ljust(12) + { True: green("NX enabled"), False: red("NX disabled"), None: yellow("NX unknown - GNU_STACK missing"), }[self.nx], - "PIE:".ljust(10) + { + "PIE:".ljust(12) + { True: green("PIE enabled"), False: red("No PIE (%#x)" % self.address) }[self.pie], @@ -2072,41 +2082,47 @@ def checksec(self, banner=True, color=True): # Execstack may be a thing, even with NX enabled, because of glibc if self.execstack and self.nx is not False: - res.append("Stack:".ljust(10) + red("Executable")) + res.append("Stack:".ljust(12) + red("Executable")) # Are there any RWX areas in the binary? # # This will occur if NX is disabled and *any* area is # RW, or can expressly occur. if self.rwx_segments or (not self.nx and self.writable_segments): - res += [ "RWX:".ljust(10) + red("Has RWX segments") ] + res += [ "RWX:".ljust(12) + red("Has RWX segments") ] if self.rpath: - res += [ "RPATH:".ljust(10) + red(repr(self.rpath)) ] + res += [ "RPATH:".ljust(12) + red(repr(self.rpath)) ] if self.runpath: - res += [ "RUNPATH:".ljust(10) + red(repr(self.runpath)) ] + res += [ "RUNPATH:".ljust(12) + red(repr(self.runpath)) ] if self.packed: - res.append('Packer:'.ljust(10) + red("Packed with UPX")) + res.append('Packer:'.ljust(12) + red("Packed with UPX")) if self.fortify: - res.append("FORTIFY:".ljust(10) + green("Enabled")) + res.append("FORTIFY:".ljust(12) + green("Enabled")) if self.asan: - res.append("ASAN:".ljust(10) + green("Enabled")) + res.append("ASAN:".ljust(12) + green("Enabled")) if self.msan: - res.append("MSAN:".ljust(10) + green("Enabled")) + res.append("MSAN:".ljust(12) + green("Enabled")) if self.ubsan: - res.append("UBSAN:".ljust(10) + green("Enabled")) + res.append("UBSAN:".ljust(12) + green("Enabled")) if self.shadowstack: - res.append("SHSTK:".ljust(10) + green("Enabled")) + res.append("SHSTK:".ljust(12) + green("Enabled")) if self.ibt: - res.append("IBT:".ljust(10) + green("Enabled")) + res.append("IBT:".ljust(12) + green("Enabled")) + + if not self.stripped: + res.append("Stripped:".ljust(12) + red("No")) + + if self.debuginfo: + res.append("Debuginfo:".ljust(12) + red("Yes")) # Check for Linux configuration, it must contain more than # just the version. From e78fb02b9ed6e0e5bf711699bd079582688ab7c1 Mon Sep 17 00:00:00 2001 From: psondej Date: Sun, 4 Feb 2024 03:14:45 +0100 Subject: [PATCH 065/107] -macosx_version_min has been renamed to -macos_version_min --- pwnlib/asm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/asm.py b/pwnlib/asm.py index 814621bcc..1852fedc1 100644 --- a/pwnlib/asm.py +++ b/pwnlib/asm.py @@ -701,7 +701,7 @@ def make_macho(data, is_shellcode=False): '/usr/bin/ld', ] ldflags = [ - '-macosx_version_min', '11.0', + '-macos_version_min', '11.0', '-l', 'System', '-e', '_start', '-L', '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib', From 954d54665f8aabd8333dc15cc2bb4c57036d9b87 Mon Sep 17 00:00:00 2001 From: psondej Date: Sun, 4 Feb 2024 16:22:02 +0100 Subject: [PATCH 066/107] #2161 Add basic support for darwin shellcraft/asm/disasm/run_shellcode/run_assembly --- CHANGELOG.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf8ed4ce4..b00c6e593 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,17 @@ The table below shows which release corresponds to each branch, and what date th - [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned - [#2279][2279] Make `pwn template` always set context.binary - [#2310][2310] Add support to start a process on Windows +- [#2334][2334] Speed up disasm commandline tool with colored output +- [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows +- [#2189][2189] Explicitly define p64/u64 functions for IDE support +- [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints +- [#2323][2323] Retry failed lookups after one week in libcdb +- [#2325][2325] Match against local system libc first in libcdb +- [#2336][2336] Add `ELF.stripped` and `ELF.debuginfo` properties +- [#2161][2161] Add basic support for darwin shellcraft/asm/disasm/run_shellcode/run_assembly +- [#2161][2161] Fix freebsd amd64 SyscallABI +- [#2160][2161] Fix invalid shellcraft.mov on arm64 +- [#2284][2161] Fix invalid shellcraft.pushstr_array on arm64 [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -91,6 +102,14 @@ The table below shows which release corresponds to each branch, and what date th [2308]: https://github.com/Gallopsled/pwntools/pull/2308 [2279]: https://github.com/Gallopsled/pwntools/pull/2279 [2310]: https://github.com/Gallopsled/pwntools/pull/2310 +[2334]: https://github.com/Gallopsled/pwntools/pull/2334 +[2328]: https://github.com/Gallopsled/pwntools/pull/2328 +[2189]: https://github.com/Gallopsled/pwntools/pull/2189 +[2339]: https://github.com/Gallopsled/pwntools/pull/2339 +[2323]: https://github.com/Gallopsled/pwntools/pull/2323 +[2325]: https://github.com/Gallopsled/pwntools/pull/2325 +[2336]: https://github.com/Gallopsled/pwntools/pull/2336 +[2161]: https://github.com/Gallopsled/pwntools/pull/2161 ## 4.12.0 (`beta`) @@ -1091,4 +1110,4 @@ are mentioned here. - Added a lots of shellcodes - Stuff we forgot - Lots of documentation fixes -- Lots of bugfixes +- Lots of bugfixes \ No newline at end of file From 3fbd21a6e419078dd136ae99c4b8fb828b612b68 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Thu, 8 Feb 2024 10:15:29 +0100 Subject: [PATCH 067/107] checksec.py: import ELF instead of * (#2346) --- pwnlib/commandline/checksec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/commandline/checksec.py b/pwnlib/commandline/checksec.py index 5dcea5e38..1d61ad2b2 100644 --- a/pwnlib/commandline/checksec.py +++ b/pwnlib/commandline/checksec.py @@ -4,7 +4,7 @@ import argparse import sys -from pwn import * +from pwnlib.elf import ELF from pwnlib.commandline import common parser = common.parser_commands.add_parser( From 604b98c035e918ad715e06281084ffb96e4fb1ee Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Thu, 8 Feb 2024 10:17:47 +0100 Subject: [PATCH 068/107] Fix pwn constgrep when it matches a non-constant type (Fixes #2344) (#2345) * Fix pwn constgrep when it matches a non-constant type This commit fixes the following issue: ``` root@pwndbg:~# pwn constgrep a Traceback (most recent call last): File "/usr/local/bin/pwn", line 8, in sys.exit(main()) File "/usr/local/lib/python3.10/dist-packages/pwnlib/commandline/main.py", line 58, in main commands[args.command](args) File "/usr/local/lib/python3.10/dist-packages/pwnlib/commandline/constgrep.py", line 110, in main for _, k in sorted(out): TypeError: '<' not supported between instances of 'Constant' and 'type' ``` Note that it was caused because of the following type object being matched and fetched from the module object: ``` ipdb> out[25:27] [(Constant('CS', 0xd), 'CS'), (, 'Constant')] ipdb> sorted(out[24:27]) *** TypeError: '<' not supported between instances of 'type' and 'Constant' ``` * Add test for `pwn constgrep C` to the CI * Add changelog entry --- .github/workflows/ci.yml | 1 + CHANGELOG.md | 2 ++ pwnlib/commandline/constgrep.py | 8 ++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f21ceb38f..186f1b9a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -172,6 +172,7 @@ jobs: pwn constgrep -c freebsd -m ^PROT_ '3 + 4' pwn constgrep ^MAP_ 0 pwn constgrep -e O_RDWR + pwn constgrep C pwn libcdb file /lib/x86_64-linux-gnu/libc.so.6 pwn libcdb lookup puts 5f0 __libc_start_main_ret d0a diff --git a/CHANGELOG.md b/CHANGELOG.md index b00c6e593..cd39c6c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,6 +91,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2161][2161] Fix freebsd amd64 SyscallABI - [#2160][2161] Fix invalid shellcraft.mov on arm64 - [#2284][2161] Fix invalid shellcraft.pushstr_array on arm64 +- [#2345][2345] Fix pwn constgrep when it matches a non-constant type [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -110,6 +111,7 @@ The table below shows which release corresponds to each branch, and what date th [2325]: https://github.com/Gallopsled/pwntools/pull/2325 [2336]: https://github.com/Gallopsled/pwntools/pull/2336 [2161]: https://github.com/Gallopsled/pwntools/pull/2161 +[2345]: https://github.com/Gallopsled/pwntools/pull/2345 ## 4.12.0 (`beta`) diff --git a/pwnlib/commandline/constgrep.py b/pwnlib/commandline/constgrep.py index bac138d72..d9341f5c4 100644 --- a/pwnlib/commandline/constgrep.py +++ b/pwnlib/commandline/constgrep.py @@ -91,9 +91,13 @@ def main(args): if not matcher.search(k): continue + # Check if the value has proper type + val = getattr(mod, k) + if not isinstance(val, pwnlib.constants.constant.Constant): + continue + # Check the constant if constant is not None: - val = getattr(mod, k) if args.mask_mode: if constant & val != val: continue @@ -102,7 +106,7 @@ def main(args): continue # Append it - out.append((getattr(mod, k), k)) + out.append((val, k)) maxlen = max(len(k), maxlen) # Output all matching constants From 73f2a31d8bfbc38da4ffbbefa857d98e69c26d37 Mon Sep 17 00:00:00 2001 From: teddav Date: Thu, 8 Feb 2024 10:22:15 +0100 Subject: [PATCH 069/107] fix: split current iterm window during gdb.debug process (#2341) * fix: split current iterm window during gdb.debug process * add change to changelog * escape cmd before writing osascript file * use the previously sanitized command to run the osascript --------- Co-authored-by: peace-maker --- CHANGELOG.md | 4 ++++ pwnlib/util/misc.py | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd39c6c3c..2a0ce6c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,8 @@ The table below shows which release corresponds to each branch, and what date th - [#2160][2161] Fix invalid shellcraft.mov on arm64 - [#2284][2161] Fix invalid shellcraft.pushstr_array on arm64 - [#2345][2345] Fix pwn constgrep when it matches a non-constant type +- [#2338][2338] Fix: follow symlink for libs on ssh connection +- [#2341][2341] Launch GDB correctly in iTerm on Mac [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -112,6 +114,8 @@ The table below shows which release corresponds to each branch, and what date th [2336]: https://github.com/Gallopsled/pwntools/pull/2336 [2161]: https://github.com/Gallopsled/pwntools/pull/2161 [2345]: https://github.com/Gallopsled/pwntools/pull/2345 +[2338]: https://github.com/Gallopsled/pwntools/pull/2338 +[2341]: https://github.com/Gallopsled/pwntools/pull/2341 ## 4.12.0 (`beta`) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 22dff501a..188be3457 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -307,6 +307,10 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr elif 'STY' in os.environ and which('screen'): terminal = 'screen' args = ['-t','pwntools-gdb','bash','-c'] + elif 'TERM_PROGRAM' in os.environ and os.environ['TERM_PROGRAM'] == "iTerm.app" and which('osascript'): + # if we're on a mac, and using iTerm + terminal = "osascript" + args = [] elif 'TERM_PROGRAM' in os.environ and which(os.environ['TERM_PROGRAM']): terminal = os.environ['TERM_PROGRAM'] args = [] @@ -366,7 +370,6 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr args.extend(['wsl.exe', '-d', distro_name, 'bash', '-c']) else: args.extend(['bash.exe', '-c']) - if not terminal: log.error('Could not find a terminal binary to use. Set context.terminal to your terminal.') @@ -410,6 +413,26 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr argv += [tmp.name] + # if we're on a Mac and use iTerm, we use `osascript` to split the current window + # `command` was sanitized on the previous step. It is now either a string, or was written to a tmp file + # we run the command, which is now `argv[-1]` + if terminal == 'osascript': + osa_script = f""" +tell application "iTerm" + tell current session of current window + set newSession to (split horizontally with default profile) + end tell + tell newSession + write text "{argv[-1]}" + end tell +end tell +""" + with tempfile.NamedTemporaryFile(delete=False, mode='wt+') as tmp: + tmp.write(osa_script.lstrip()) + tmp.flush() + os.chmod(tmp.name, 0o700) + argv = [which(terminal), tmp.name] + log.debug("Launching a new terminal: %r" % argv) stdin = stdout = stderr = open(os.devnull, 'r+b') From a2b6771fe6bcef52b948a7e9d5da6d643441d0d7 Mon Sep 17 00:00:00 2001 From: Stefan Stefanov Date: Thu, 8 Feb 2024 11:24:51 +0200 Subject: [PATCH 070/107] Improved DynELF address resolutions and symbol lookups (#2335) * Optimized dynelf when using an ELF object * Fixed minor bugs, added a new way to lookup symbols Improved _rel_lookup and added Elf64_Rel datatype Added support for _rel_lookup in x86 binaries * Spelling fix * Converted prints to python2 style + changelog entry * Fixed a bug with real leaker not being resotred --------- Co-authored-by: Bl4ckC4t --- CHANGELOG.md | 2 + pwnlib/dynelf.py | 184 +++++++++++++++++++++++++++++----------- pwnlib/elf/datatypes.py | 9 ++ 3 files changed, 147 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a0ce6c88..54ffc9144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned - [#2279][2279] Make `pwn template` always set context.binary - [#2310][2310] Add support to start a process on Windows +- [#2335][2335] Add lookup optimizations in DynELF - [#2334][2334] Speed up disasm commandline tool with colored output - [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows - [#2189][2189] Explicitly define p64/u64 functions for IDE support @@ -105,6 +106,7 @@ The table below shows which release corresponds to each branch, and what date th [2308]: https://github.com/Gallopsled/pwntools/pull/2308 [2279]: https://github.com/Gallopsled/pwntools/pull/2279 [2310]: https://github.com/Gallopsled/pwntools/pull/2310 +[2335]: https://github.com/Gallopsled/pwntools/pull/2335 [2334]: https://github.com/Gallopsled/pwntools/pull/2334 [2328]: https://github.com/Gallopsled/pwntools/pull/2328 [2189]: https://github.com/Gallopsled/pwntools/pull/2189 diff --git a/pwnlib/dynelf.py b/pwnlib/dynelf.py index 579a26a0c..5c3948937 100644 --- a/pwnlib/dynelf.py +++ b/pwnlib/dynelf.py @@ -165,6 +165,18 @@ def __init__(self, leak, pointer=None, elf=None, libcdb=True): self._waitfor = None self._bases = {} self._dynamic = None + self.elf = None + + if elf: + path = elf + if isinstance(elf, ELF): + path = elf.path + + # Load a fresh copy of the ELF + with context.local(log_level='error'): + w = self.waitfor("Loading from %r" % path) + self.elf = ELF(path) + w.success("[LOADED]") if not (pointer or (elf and elf.address)): log.error("Must specify either a pointer into a module and/or an ELF file with a valid base address") @@ -177,12 +189,15 @@ def __init__(self, leak, pointer=None, elf=None, libcdb=True): if not elf: log.warn_once("No ELF provided. Leaking is much faster if you have a copy of the ELF being leaked.") - self.elf = elf self.leak = leak self.libbase = self._find_base(pointer or elf.address) if elf: - self._find_linkmap_assisted(elf) + self._elftype = self.elf.elftype + self._elfclass = self.elf.elfclass + self.elf.address = self.libbase + self._dynamic = self.elf.get_section_by_name('.dynamic').header.sh_addr + self._dynamic = self._make_absolute_ptr(self._dynamic) @classmethod def for_one_lib_only(cls, leak, ptr): @@ -241,49 +256,6 @@ def dynamic(self): self._dynamic = self._find_dynamic_phdr() return self._dynamic - def _find_linkmap_assisted(self, path): - """Uses an ELF file to assist in finding the link_map. - """ - if isinstance(path, ELF): - path = path.path - - # Load a fresh copy of the ELF - with context.local(log_level='error'): - elf = ELF(path) - elf.address = self.libbase - - w = self.waitfor("Loading from %r" % elf.path) - - # Save our real leaker - real_leak = self.leak - - # Create a fake leaker which just leaks out of the 'loaded' ELF - # However, we may load things which are outside of the ELF (e.g. - # the linkmap or GOT) so we need to fall back on the real leak. - @MemLeak - def fake_leak(address): - try: - return elf.read(address, 4) - except ValueError: - return real_leak.b(address) - - # Save off our real leaker, use the fake leaker - self.leak = fake_leak - - # Get useful pointers for resolving the linkmap faster - w.status("Searching for DT_PLTGOT") - pltgot = self._find_dt(constants.DT_PLTGOT) - - w.status("Searching for DT_DEBUG") - debug = self._find_dt(constants.DT_DEBUG) - - # Restore the real leaker - self.leak = real_leak - - # Find the linkmap using the helper pointers - self._find_linkmap(pltgot, debug) - self.success('Done') - def _find_base(self, ptr): page_size = 0x1000 page_mask = ~(page_size - 1) @@ -380,6 +352,27 @@ def _find_dynamic_phdr(self): return dynamic + def _find_dt_optimized(self, name): + """ + Find an entry in the DYNAMIC array through an ELF + + Arguments: + name(str): Name of the tag to find ('DT_DEBUG', 'DT_PLTGOT', ...) + + Returns: + Pointer to the data described by the specified entry. + """ + if not self.elf: + return None + + ptr = self.elf.dynamic_value_by_tag(name) + if ptr: + ptr = self._make_absolute_ptr(ptr) + self.success("Found %s at %#x" % (name, ptr)) + return ptr + return None + + def _find_dt(self, tag): """ Find an entry in the DYNAMIC array. @@ -390,11 +383,16 @@ def _find_dt(self, tag): Returns: Pointer to the data described by the specified entry. """ - leak = self.leak base = self.libbase dynamic = self.dynamic + leak = self.leak name = next(k for k,v in ENUM_D_TAG.items() if v == tag) + # Read directly from the ELF if possible + ptr = self._find_dt_optimized(name) + if ptr: + return ptr + Dyn = {32: elf.Elf32_Dyn, 64: elf.Elf64_Dyn} [self.elfclass] # Found the _DYNAMIC program header, now find PLTGOT entry in it @@ -407,10 +405,10 @@ def _find_dt(self, tag): self.failure("Could not find tag %s" % name) return None - self.status("Found %s at %#x" % (name, dynamic)) ptr = leak.field(dynamic, Dyn.d_ptr) ptr = self._make_absolute_ptr(ptr) + self.status("Found %s at %#x" % (name, ptr)) return ptr @@ -599,6 +597,10 @@ def bases(self): Return a dictionary mapping library path to its base address. ''' if not self._bases: + if self.link_map is None: + self.failure("Cannot determine bases without linkmap") + return {} + leak = self.leak LinkMap = {32: elf.Elf32_Link_Map, 64: elf.Elf64_Link_Map}[self.elfclass] @@ -666,6 +668,62 @@ def _dynamic_load_dynelf(self, libname): lib._waitfor = self._waitfor return lib + def _rel_lookup(self, symb, strtab=None, symtab=None, jmprel=None): + """Performs slower symbol lookup using DT_JMPREL(.rela.plt)""" + leak = self.leak + elf_obj = self.elf + symb_name = symb.decode() + + # If elf is available look for the symbol in it + if elf_obj and symb_name in elf_obj.symbols: + self.success("Symbol '%s' found in ELF!" % symb_name) + return elf_obj.symbols[symb_name] + + log.warning("Looking up symbol through DT_JMPREL. This might be slower...") + + + strtab = strtab or self._find_dt(constants.DT_STRTAB) + symtab = symtab or self._find_dt(constants.DT_SYMTAB) + jmprel = jmprel or self._find_dt(constants.DT_JMPREL) # .rela.plt + + strtab = self._make_absolute_ptr(strtab) + symtab = self._make_absolute_ptr(symtab) + jmprel = self._make_absolute_ptr(jmprel) + + w = self.waitfor("Looking for %s in .rel.plt" % symb) + # We look for the symbol by iterating through each Elf64_Rel entry. + # For each Elf64_Rel, get the Elf64_Sym for that entry + # Then compare the Elf64_Sym.st_name with the symbol name + + Rel = {32: elf.Elf32_Rel, 64: elf.Elf64_Rel}[self.elfclass] + Sym = {32: elf.Elf32_Sym, 64: elf.Elf64_Sym}[self.elfclass] + + rel_addr = jmprel + rel_entry = None + while True: + rel_entry = leak.struct(rel_addr, Rel) + + # We ran out of entries in DT_JMPREL + if rel_entry.r_offset == 0: + return None + + sym_idx = rel_entry.r_info >> 32 # might be different for 32-bit + sym_entry_address = symtab + ( sym_idx * sizeof(Sym) ) + sym_str_off = leak.field(sym_entry_address, Sym.st_name) + symb_str = leak.s(strtab+sym_str_off) + + if symb_str == symb: + w.success("Found matching Elf64_Rel entry!") + break + + rel_addr += sizeof(Rel) + + symbol_address = self._make_absolute_ptr(rel_entry.r_offset) + + return symbol_address + + + def _lookup(self, symb): """Performs the actual symbol lookup within one ELF file.""" leak = self.leak @@ -698,9 +756,39 @@ def _lookup(self, symb): # # Perform the hash lookup # + + # Save off our real leaker in case we use the fake leaker + real_leak = self.leak + if self.elf: + + # Create a fake leaker which just leaks out of the 'loaded' ELF + # However, we may load things which are outside of the ELF (e.g. + # the linkmap or GOT) so we need to fall back on the real leak. + @MemLeak + def fake_leak(address): + try: + return self.elf.read(address, 4) + except ValueError: + return real_leak.b(address) + # Use fake leaker since ELF is available + self.leak = fake_leak + routine = {'sysv': self._resolve_symbol_sysv, 'gnu': self._resolve_symbol_gnu}[hshtype] - return routine(self.libbase, symb, hshtab, strtab, symtab) + resolved_addr = routine(self.libbase, symb, hshtab, strtab, symtab) + + if resolved_addr: + # Restore the original leaker + self.leak = real_leak + return resolved_addr + + # if symbol not found in GNU_Hash, try looking in JMPREL + resolved_addr = self._rel_lookup(symb, strtab, symtab) + + # Restore the original leaker + self.leak = real_leak + + return resolved_addr def _resolve_symbol_sysv(self, libbase, symb, hshtab, strtab, symtab): """ diff --git a/pwnlib/elf/datatypes.py b/pwnlib/elf/datatypes.py index 0dffaf7f5..dc447d346 100644 --- a/pwnlib/elf/datatypes.py +++ b/pwnlib/elf/datatypes.py @@ -399,6 +399,15 @@ class Elf64_Sym(ctypes.Structure): ("st_value", Elf64_Addr), ("st_size", Elf64_Xword),] +class Elf64_Rel(ctypes.Structure): + _fields_ = [("r_offset", Elf64_Addr), + ("r_info", Elf64_Xword), + ("r_addend", Elf64_Sxword),] + +class Elf32_Rel(ctypes.Structure): + _fields_ = [("r_offset", Elf32_Addr), + ("r_info", Elf32_Word),] + class Elf32_Link_Map(ctypes.Structure): _fields_ = [("l_addr", Elf32_Addr), ("l_name", Elf32_Addr), From 545d8f748a78a33eb95de28542fedc960f1806a5 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 8 Feb 2024 10:41:16 +0100 Subject: [PATCH 071/107] Remove f-string for Python 2 --- pwnlib/util/misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 188be3457..d0780ed6e 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -417,16 +417,16 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr # `command` was sanitized on the previous step. It is now either a string, or was written to a tmp file # we run the command, which is now `argv[-1]` if terminal == 'osascript': - osa_script = f""" + osa_script = """ tell application "iTerm" tell current session of current window set newSession to (split horizontally with default profile) end tell tell newSession - write text "{argv[-1]}" + write text "{}" end tell end tell -""" +""".format(argv[-1]) with tempfile.NamedTemporaryFile(delete=False, mode='wt+') as tmp: tmp.write(osa_script.lstrip()) tmp.flush() From f5a119ffe539c23cb74254269f990c3fd5b59e9a Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Fri, 9 Feb 2024 10:56:14 +0100 Subject: [PATCH 072/107] Fix checksec commandline wrapper invocation --- pwnlib/commandline/checksec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnlib/commandline/checksec.py b/pwnlib/commandline/checksec.py index 1d61ad2b2..da0d7b49d 100644 --- a/pwnlib/commandline/checksec.py +++ b/pwnlib/commandline/checksec.py @@ -38,4 +38,4 @@ def main(args): e = ELF(f.name) if __name__ == '__main__': - pwnlib.commandline.common.main(__file__) + common.main(__file__) From 47dfc57922baf48cdd60af7174bbc97f65badad4 Mon Sep 17 00:00:00 2001 From: ValekoZ Date: Fri, 9 Feb 2024 16:06:26 +0100 Subject: [PATCH 073/107] Add a `flatten` argument to `ssh.libs` (#2268) * Add a `flatten` argument to `ssh.libs` This option makes us able to avoid getting the file tree of the remote server and just downloads the desired files in the output folder * Update changelog * Add a warning in ssh.libs for duplicate filenames * Add documentation in ssh.libs for duplicate filenames fallback * [ssh.libs] Fix flatten's duplicate check Fix this: https://github.com/Gallopsled/pwntools/pull/2268#discussion_r1325404026 * [ssh.libs] Add better warning for flatten's duplicates Fix this: https://github.com/Gallopsled/pwntools/pull/2268#discussion_r1325405234 * [ssh.libs] Add doctests This commit adds: - The `no_duplicate` binary that depends on - `a/lib.so` - `b/lib2.so` - The `duplicate` binary that depends on - `a/lib.so` - `b/lib.so` Then, the doctest tries to pull the libs from both binaries with different `flatten` values. * [ssh.libs] Add `remote` arg to documentation * [ssh.libs] Remove fallback to unflattened when flatten fails * [ssh.libs] Fix doctests * [ssh.libs] Import pwnlib.data.elf.ssh_libs in pwnlib.data.elf * [ssh.libs] Fix corrupted binaries * [ssh.libs] We actually need to set the cwd since libs paths are relative * [ssh.libs] Fix permission issues for CI * [ssh.libs] Fix doctest * Remove doctest attempts --------- Co-authored-by: peace-maker Co-authored-by: Arusekk Co-authored-by: Peace-Maker --- CHANGELOG.md | 2 ++ pwnlib/tubes/ssh.py | 29 ++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54ffc9144..04b9210c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2345][2345] Fix pwn constgrep when it matches a non-constant type - [#2338][2338] Fix: follow symlink for libs on ssh connection - [#2341][2341] Launch GDB correctly in iTerm on Mac +- [#2268][2268] Add a `flatten` argument to `ssh.libs` [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -118,6 +119,7 @@ The table below shows which release corresponds to each branch, and what date th [2345]: https://github.com/Gallopsled/pwntools/pull/2345 [2338]: https://github.com/Gallopsled/pwntools/pull/2338 [2341]: https://github.com/Gallopsled/pwntools/pull/2341 +[2268]: https://github.com/Gallopsled/pwntools/pull/2268 ## 4.12.0 (`beta`) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 408497fe0..c6f5d500b 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -1810,20 +1810,42 @@ def unlink(self, file): return self.sftp.unlink(file) - def libs(self, remote, directory = None): + def libs(self, remote, directory = None, flatten = False): """Downloads the libraries referred to by a file. This is done by running ldd on the remote server, parsing the output and downloading the relevant files. The directory argument specified where to download the files. This defaults - to './$HOSTNAME' where $HOSTNAME is the hostname of the remote server.""" + to './$HOSTNAME' where $HOSTNAME is the hostname of the remote server. + + Arguments: + remote(str): Remote file path + directory(str): Output directory + flatten(bool): Flatten the file tree if True (defaults to False) and + ignore the remote directory structure. If there are duplicate + filenames, an error will be raised. + """ libs = self._libs_remote(remote) remote = packing._decode(self.readlink('-f',remote).strip()) libs[remote] = 0 + if flatten: + basenames = dict() + + # If there is a duplicate switch to unflattened download + for lib in libs: + name = os.path.basename(lib) + + if name in basenames.values(): + duplicate = [key for key, value in basenames.items() if + value == name][0] + self.error('Duplicate lib name: %r / %4r' % (lib, duplicate)) + + basenames[lib] = name + if directory is None: directory = self.host @@ -1834,7 +1856,8 @@ def libs(self, remote, directory = None): seen = set() for lib, addr in libs.items(): - local = os.path.realpath(os.path.join(directory, '.' + os.path.sep + lib)) + local = os.path.realpath(os.path.join(directory, '.' + os.path.sep \ + + (basenames[lib] if flatten else lib))) if not local.startswith(directory): self.warning('This seems fishy: %r' % lib) continue From 9e4b11adb709873bc48827312a4f423f3ac59820 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Fri, 9 Feb 2024 16:39:12 +0100 Subject: [PATCH 074/107] Fix Unicorn Engine 1GB limit that calls exit: raise OSError instead (Fixes #2343) (#2347) * Fix Unicorn Engine 1GB limit exit(): raise OSError instead (Fixes #2343) This commit fixes #2343: an issue where `pwn checksec ` would fail with a bogus error of: ``` $ pwn checksec /root/x/bin/main Could not allocate dynamic translator buffer ``` This actually comes from Unicorn Engine which tries to allocate a 1GB RWX mapping: ``` root@pwndbg:~# strace -e openat,mmap pwn checksec /root/x/bin/main 2>&1 | tail -n 10 openat(AT_FDCWD, "/usr/lib/python3/dist-packages/mpmath-0.0.0.egg-info/PKG-INFO", O_RDONLY|O_CLOEXEC) = 7 openat(AT_FDCWD, "/usr/local/lib/python3.10/dist-packages/unicorn/lib/libunicorn.so.2", O_RDONLY|O_CLOEXEC) = 7 mmap(NULL, 22447520, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 7, 0) = 0x7f2604f9d000 mmap(0x7f2605339000, 13496320, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x39c000) = 0x7f2605339000 mmap(0x7f2606018000, 3039232, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x107b000) = 0x7f2606018000 mmap(0x7f26062fe000, 1601536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x1360000) = 0x7f26062fe000 mmap(0x7f2606485000, 525728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2606485000 mmap(NULL, 1073741824, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) Could not allocate dynamic translator buffer +++ exited with 1 +++ ``` ...and if it fails, it calls `exit()`. This can be seen in Unicorn Engine code: https://github.com/unicorn-engine/unicorn/blob/56f3bdedb42d26bee1532cc01baf5eaf44a9aa23/qemu/accel/tcg/translate-all.c#L960-L963 This issue has been reported to Unicorn Engine in https://github.com/unicorn-engine/unicorn/issues/1766 but since it hasn't been fixed, this commit applies a workaround for it. * CI: add test for pwn checksec with 500MB limit for UE 1GB limit * Add changelog entry * Update .github/workflows/ci.yml --------- Co-authored-by: peace-maker --- .github/workflows/ci.yml | 1 + CHANGELOG.md | 2 ++ pwnlib/elf/plt.py | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 186f1b9a8..6c4db82a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,6 +164,7 @@ jobs: pwn phd -l 0x3d --color=always /etc/os-release pwn checksec /bin/bash + (ulimit -v 500000 && pwn checksec /bin/bash) pwn errno 2 pwn errno -1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 04b9210c5..e0c06fb53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2338][2338] Fix: follow symlink for libs on ssh connection - [#2341][2341] Launch GDB correctly in iTerm on Mac - [#2268][2268] Add a `flatten` argument to `ssh.libs` +- [#2347][2347] Fix/workaround Unicorn Engine 1GB limit that calls exit() [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -120,6 +121,7 @@ The table below shows which release corresponds to each branch, and what date th [2338]: https://github.com/Gallopsled/pwntools/pull/2338 [2341]: https://github.com/Gallopsled/pwntools/pull/2341 [2268]: https://github.com/Gallopsled/pwntools/pull/2268 +[2347]: https://github.com/Gallopsled/pwntools/pull/2347 ## 4.12.0 (`beta`) diff --git a/pwnlib/elf/plt.py b/pwnlib/elf/plt.py index ff8153d48..9eee5f60c 100644 --- a/pwnlib/elf/plt.py +++ b/pwnlib/elf/plt.py @@ -53,9 +53,30 @@ def emulate_plt_instructions(elf, got, address, data, targets): return rv + +def __ensure_memory_to_run_unicorn(): + """ + Check if there is enough memory to run Unicorn Engine. + Unicorn Engine requires 1GB of memory to run, if there isn't enough memory it calls exit(1). + + This is a bug in Unicorn Engine, see: https://github.com/unicorn-engine/unicorn/issues/1766 + """ + try: + from mmap import mmap, MAP_ANON, MAP_PRIVATE, PROT_EXEC, PROT_READ, PROT_WRITE + + mm = mmap( + -1, 1024 * 1024 * 1024, MAP_PRIVATE | MAP_ANON, PROT_WRITE | PROT_READ | PROT_EXEC + ) + mm.close() + except OSError: + raise OSError("Cannot allocate 1GB memory to run Unicorn Engine") + + def prepare_unicorn_and_context(elf, got, address, data): import unicorn as U + __ensure_memory_to_run_unicorn() + # Instantiate the emulator with the correct arguments for the current # architecutre. arch = { From c049837c541292bc41058c9a270f3b0542de3244 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Wed, 14 Feb 2024 21:08:06 +0100 Subject: [PATCH 075/107] Update docs for running doctests locally --- travis/docker/Makefile | 5 +++-- travis/docker/README.md | 16 ++++++++++++++-- travis/docker/tmux.sh | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/travis/docker/Makefile b/travis/docker/Makefile index 449ef385f..50aa8cf7e 100644 --- a/travis/docker/Makefile +++ b/travis/docker/Makefile @@ -1,13 +1,14 @@ ROOT = $(shell git rev-parse --show-toplevel) $(shell reset) +all: doctest3 + Dockerfile: FORCE cp $(ROOT)/extra/docker/develop/Dockerfile Dockerfile cat Dockerfile.travis >> Dockerfile cp $(ROOT)/extra/docker/develop/10-import.py 10-import.py cp $(ROOT)/extra/docker/develop/ipython_config.py ipython_config.py -all: doctest3 shell bash: image @echo Running interactive shell @@ -30,4 +31,4 @@ image: Dockerfile docker build -t travis . FORCE: -.PHONY: all image doctest bash +.PHONY: all image doctest2 doctest3 bash diff --git a/travis/docker/README.md b/travis/docker/README.md index 739953363..7aae9f7db 100644 --- a/travis/docker/README.md +++ b/travis/docker/README.md @@ -6,7 +6,19 @@ It's pretty simple, just run `make`. All of your changes will be copied into th ```shell $ make -C travis/docker ANDROID=yes -$ make -C travis/docker ANDROID=no TARGET=docs/source/tubes/ssh.rst +$ make -C travis/docker ANDROID=no TARGET=ssh.rst +``` + +By default the Python 3 tests are run. You can choose the Python version using the `doctest2` or `doctest3` target. + +```shell +$ make -C travis/docker ANDROID=no doctest2 +``` + +You can get drop into a tmux session in the container to debug tests using the `shell` or `bash` targets. + +```shell +$ make -C travis/docker shell ``` ## Options @@ -19,7 +31,7 @@ Controls whether or not to run the Android test. The valid options are ``yes`` ### `TARGET` -This is appended to the `sphinx` command line, but generally is useful to sepcify a specific `rst` file to parse (e.g. to only run those tests). +This is appended to the `sphinx` command line, but generally is useful to select a specific `rst` file to parse (e.g. to only run those tests). ## Known Issues diff --git a/travis/docker/tmux.sh b/travis/docker/tmux.sh index 096014220..7fe799da3 100755 --- a/travis/docker/tmux.sh +++ b/travis/docker/tmux.sh @@ -1,2 +1,2 @@ #!/usr/bin/env zsh -exec tmux -u -2 -CC +exec tmux -u -2 From b5e4ff137a05e2013b5d0eef9eea6f8477f18f63 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Wed, 17 Jan 2024 21:57:38 +0100 Subject: [PATCH 076/107] Android: Install emulator in CI and switch to x86_64 platform --- pwnlib/adb/adb.py | 16 +++++++++------- travis/setup_avd_fast.sh | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pwnlib/adb/adb.py b/pwnlib/adb/adb.py index 789546f32..6344b2c5a 100644 --- a/pwnlib/adb/adb.py +++ b/pwnlib/adb/adb.py @@ -66,6 +66,7 @@ from pwnlib.context import LocalContext from pwnlib.context import context from pwnlib.device import Device +from pwnlib.exception import PwnlibException from pwnlib.log import getLogger from pwnlib.protocols.adb import AdbClient from pwnlib.util.packing import _decode @@ -122,7 +123,7 @@ def current_device(any=False): >>> device = adb.current_device(any=True) >>> device # doctest: +ELLIPSIS - AdbDevice(serial='emulator-5554', type='device', port='emulator', product='sdk_...phone_armv7', model='sdk ...phone armv7', device='generic') + AdbDevice(serial='emulator-5554', type='device', port='emulator', product='sdk_...phone_...', model='...', device='generic...') >>> device.port 'emulator' """ @@ -252,13 +253,13 @@ class AdbDevice(Device): >>> device = adb.wait_for_device() >>> device.arch - 'arm' + 'amd64' >>> device.bits - 32 + 64 >>> device.os 'android' >>> device.product # doctest: +ELLIPSIS - 'sdk_...phone_armv7' + 'sdk_...phone_...' >>> device.serial 'emulator-5554' """ @@ -1364,7 +1365,7 @@ def compile(source): >>> filename = adb.compile(temp) >>> sent = adb.push(filename, "/data/local/tmp") >>> adb.process(sent).recvall() # doctest: +ELLIPSIS - b'... /system/bin/linker\n...' + b'... /system/lib64/libc.so\n...' """ ndk_build = misc.which('ndk-build') @@ -1490,8 +1491,9 @@ class Partitions(object): @context.quietfunc def by_name_dir(self): try: - return next(find('/dev/block/platform','by-name')) - except StopIteration: + with context.local(log_level=logging.FATAL): + return next(find('/dev/block/platform','by-name')) + except (StopIteration, PwnlibException): return '/dev/block' @context.quietfunc diff --git a/travis/setup_avd_fast.sh b/travis/setup_avd_fast.sh index 577ddc287..01cd9c4c0 100644 --- a/travis/setup_avd_fast.sh +++ b/travis/setup_avd_fast.sh @@ -8,17 +8,17 @@ set -ex # - arm64-v8a # - x86 # - x86_64 -ANDROID_ABI='armeabi-v7a' +ANDROID_ABI='x86_64' ANDROIDV=android-24 # Create our emulator Android Virtual Device (AVD) # --snapshot flag is deprecated, see bitrise-steplib/steps-create-android-emulator#18 export PATH=$PATH:"$ANDROID_HOME"/cmdline-tools/latest/bin:"$ANDROID_HOME"/platform-tools -yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;default;$ANDROID_ABI" +yes | sdkmanager --sdk_root="$ANDROID_HOME" --install "system-images;$ANDROIDV;default;$ANDROID_ABI" "emulator" "platform-tools" "platforms;$ANDROIDV" yes | sdkmanager --sdk_root="$ANDROID_HOME" --licenses echo no | avdmanager --silent create avd --name android-$ANDROID_ABI --force --package "system-images;$ANDROIDV;default;$ANDROID_ABI" -"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot & +"$ANDROID_HOME"/emulator/emulator -avd android-$ANDROID_ABI -no-window -no-boot-anim -read-only -no-audio -no-window -no-snapshot -gpu off -accel off & adb wait-for-device adb shell id adb shell getprop From 211469251325ec67c8ac139303e7bfb6b66f41f3 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Fri, 16 Feb 2024 23:43:19 +0100 Subject: [PATCH 077/107] Fix readline omitting a trailing \n (#2349) * Fix readline omitting a trailing \n This is a regression from #2129 which was based on a bogus test which mixed `input` and `readline` calls. Only `input` (and `raw_input`) are documented to strip the newline, but `readline` itself should include it. Fixes #2342 * Update CHANGELOG --- CHANGELOG.md | 5 +++++ pwnlib/term/readline.py | 9 +++++---- pwnlib/tubes/tube.py | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f835c23f..977389640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,11 @@ The table below shows which release corresponds to each branch, and what date th [2257]: https://github.com/Gallopsled/pwntools/pull/2257 [2225]: https://github.com/Gallopsled/pwntools/pull/2225 +## 4.11.2 +- [#2349][2349] Fix term.readline omitting a trailing \n + +[2349]: https://github.com/Gallopsled/pwntools/pull/2349 + ## 4.11.1 (`stable`) - [#2271][2271] FIX: Generated shebang with path to python invalid if path contains spaces diff --git a/pwnlib/term/readline.py b/pwnlib/term/readline.py index b60b656de..72082eb89 100644 --- a/pwnlib/term/readline.py +++ b/pwnlib/term/readline.py @@ -5,6 +5,7 @@ import six import sys +import os from pwnlib.term import keyconsts as kc from pwnlib.term import keymap as km @@ -404,7 +405,7 @@ def readline(_size=-1, prompt='', float=True, priority=10): buffer = (buffer_left + buffer_right) if buffer: history.insert(0, buffer) - return force_to_bytes(buffer) + return force_to_bytes(buffer) + b'\n' except KeyboardInterrupt: control_c() finally: @@ -432,7 +433,7 @@ def raw_input(prompt='', float=True): float(bool): If set to `True`, prompt and input will float to the bottom of the screen when `term.term_mode` is enabled. """ - return readline(-1, prompt, float) + return readline(-1, prompt, float).rstrip(os.linesep.encode()) def str_input(prompt='', float=True): r"""str_input(prompt='', float=True) @@ -445,7 +446,7 @@ def str_input(prompt='', float=True): float(bool): If set to `True`, prompt and input will float to the bottom of the screen when `term.term_mode` is enabled. """ - return readline(-1, prompt, float).decode() + return readline(-1, prompt, float).decode().rstrip(os.linesep) def eval_input(prompt='', float=True): """eval_input(prompt='', float=True) @@ -471,7 +472,7 @@ def eval_input(prompt='', float=True): Favorite object? 20 """ from pwnlib.util import safeeval - return safeeval.const(readline(-1, prompt, float)) + return safeeval.const(readline(-1, prompt, float).rstrip(os.linesep.encode())) def init(): global safeeval diff --git a/pwnlib/tubes/tube.py b/pwnlib/tubes/tube.py index 0e5e9dab1..3d1eae975 100644 --- a/pwnlib/tubes/tube.py +++ b/pwnlib/tubes/tube.py @@ -900,8 +900,8 @@ def recv_thread(): while not go.isSet(): if term.term_mode: data = term.readline.readline(prompt = prompt, float = True) - if data: - data += self.newline + if data.endswith(b'\n') and self.newline != b'\n': + data = data[:-1] + self.newline else: stdin = getattr(sys.stdin, 'buffer', sys.stdin) data = stdin.read(1) From d9b3e17b6609343cf0e97c9daaba47926ac7c7b4 Mon Sep 17 00:00:00 2001 From: goreil <90871590+goreil@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:47:56 +0100 Subject: [PATCH 078/107] gdb.debug: exe parameter now respected, allow empty argv (#2233) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bugfix gdb.debug: exe parameter now respected This commit now properly supports the exe parameter in `pwnlib/gdb.py:debug()`, allowing a different argv[0] than the executable. It achieves this by leveraging the gdbsever`--wrapper` argument with a python script that calls execve with the specified args. * Backintegration for python2 * Update Changelog.md * pwnlib gdb.py, try to pass these tests... * Encode script in ssh.process(run=False) for tests * Re-trigger Pull request tests * gdb.py: easier script if argv[0] == exe * gdb.py: Add test case for LD_Preload * Add check that "=" not in misc.normalize_argv_env This check checks prevents the use of "=" in the key of an environment variable, which is generally impossible. * gdb.py Correct handling of LD_ env-variables * Update pwnlib/gdb.py Co-authored-by: peace-maker * gdb.py address comments 1. explicit ctypes.CDLL('libc.so.6'), handle execve failing 2. consistent namedTempFile 3. drop packing._encode() since it's done earlier 4. testcases solve argv-args confusion * gdb.py: Fix Namedtempfile-prefix + Bugfix * Restore prefix for gdbscript * Unify execve wrapper script under one function * gdb.py, Remove leftover script * Fix logging scope and ignore_environ argument --------- Co-authored-by: Youheng Lü <90871590+Youheng-Lue@users.noreply.github.com> Co-authored-by: peace-maker Co-authored-by: peace-maker --- CHANGELOG.md | 2 + pwnlib/gdb.py | 111 ++++++++++++++++++--- pwnlib/tubes/ssh.py | 193 ++--------------------------------- pwnlib/util/misc.py | 238 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 344 insertions(+), 200 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0c06fb53..62647edbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2341][2341] Launch GDB correctly in iTerm on Mac - [#2268][2268] Add a `flatten` argument to `ssh.libs` - [#2347][2347] Fix/workaround Unicorn Engine 1GB limit that calls exit() +- [#2233][2233] Fix gdb.debug: exe parameter now respected, allow empty argv [2242]: https://github.com/Gallopsled/pwntools/pull/2242 [2277]: https://github.com/Gallopsled/pwntools/pull/2277 @@ -122,6 +123,7 @@ The table below shows which release corresponds to each branch, and what date th [2341]: https://github.com/Gallopsled/pwntools/pull/2341 [2268]: https://github.com/Gallopsled/pwntools/pull/2268 [2347]: https://github.com/Gallopsled/pwntools/pull/2347 +[2233]: https://github.com/Gallopsled/pwntools/pull/2233 ## 4.12.0 (`beta`) diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index da9686934..d885ac72f 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -143,6 +143,7 @@ from contextlib import contextmanager import os +import sys import platform import psutil import random @@ -249,7 +250,43 @@ def debug_shellcode(data, gdbscript=None, vma=None, api=False): return debug(tmp_elf, gdbscript=gdbscript, arch=context.arch, api=api) -def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None): +def _execve_script(argv, executable, env, ssh): + """_execve_script(argv, executable, env, ssh) -> str + + Returns the filename of a python script that calls + execve the specified program with the specified arguments. + This script is suitable to call with gdbservers ``--wrapper`` option, + so we have more control over the environment of the debugged process. + + Arguments: + argv(list): List of arguments to pass to the program + executable(bytes): Path to the program to run + env(dict): Environment variables to pass to the program + ssh(ssh): SSH connection to use if we are debugging a remote process + + Returns: + The filename of the created script. + """ + # Make sure args are bytes not bytearray. + argv = [bytes(arg) for arg in argv] + executable = packing._encode(executable) + if ssh: + # ssh.process with run=false creates the script for us + return ssh.process(argv, executable=executable, env=env, run=False) + + script = misc._create_execve_script(argv=argv, executable=executable, env=env, log=log) + script = script.strip() + # Create a temporary file to hold the script + tmp = tempfile.NamedTemporaryFile(mode="w+t",prefix='pwnlib-execve-', suffix='.py', delete=False) + tmp.write(script) + # Make script executable + os.fchmod(tmp.fileno(), 0o755) + log.debug("Created execve wrapper script %s:\n%s", tmp.name, script) + + return tmp.name + + +def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None, python_wrapper_script=None): """_gdbserver_args(pid=None, path=None, args=None, which=None, env=None) -> list Sets up a listening gdbserver, to either connect to the specified @@ -260,6 +297,8 @@ def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None): path(str): Process to launch args(list): List of arguments to provide on the debugger command line which(callaable): Function to find the path of a binary. + env(dict): Environment variables to pass to the program + python_wrapper_script(str): Path to a python script to use with ``--wrapper`` Returns: A list of arguments to invoke gdbserver. @@ -296,13 +335,19 @@ def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None): if pid: gdbserver_args += ['--once', '--attach'] + env_args = [] if env is not None: - env_args = [] for key in tuple(env): + # Special case for LD_ environment variables, so gdbserver + # starts with the native libraries if key.startswith(b'LD_'): # LD_PRELOAD / LD_LIBRARY_PATH etc. env_args.append(b'%s=%s' % (key, env.pop(key))) else: env_args.append(b'%s=%s' % (key, env[key])) + + if python_wrapper_script is not None: + gdbserver_args += ['--wrapper', python_wrapper_script, '--'] + elif env is not None: gdbserver_args += ['--wrapper', which('env'), '-i'] + env_args + ['--'] gdbserver_args += ['localhost:0'] @@ -465,6 +510,24 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io.interactive() # doctest: +SKIP >>> io.close() + + Start a new process with modified argv[0] + >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], executable="/bin/sh") + >>> io.sendline(b"echo $0") + >>> io.recvline() + b'$ \xde\xad\xbe\xef\n' + >>> io.close() + + Demonstrate that LD_PRELOAD is respected + >>> io = process(["grep", "libc.so.6", "/proc/self/maps"]) + >>> real_libc_path = io.recvline().split()[-1] + >>> import shutil + >>> shutil.copy(real_libc_path, "./libc.so.6") # make a copy of libc to demonstrate that it is loaded + >>> io = gdb.debug(["grep", "libc.so.6", "/proc/self/maps"], env={"LD_PRELOAD": "./libc.so.6"}) + >>> io.recvline().split()[-1] + b"./libc.so.6" + >>> os.remove("./libc.so.6") # cleanup + Using GDB Python API: @@ -516,6 +579,20 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= Interact with the process >>> io.interactive() # doctest: +SKIP >>> io.close() + + Using a modified args[0] on a remote process + >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh", ssh=shell) + >>> io.sendline(b"echo $0") + >>> io.recvline() + b'$ \xde\xad\xbe\xef\n' + >>> io.close() + + Using an empty args[0] on a remote process + >>> io = gdb.debug(args=[], gdbscript='continue', exe="/bin/sh", ssh=shell) + >>> io.sendline(b"echo $0") + >>> io.recvline() + b'$ \n' + >>> io.close() """ if isinstance(args, six.integer_types + (tubes.process.process, tubes.ssh.ssh_channel)): log.error("Use gdb.attach() to debug a running process") @@ -536,12 +613,25 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= if env: env = {bytes(k): bytes(v) for k, v in env} + exe = which(packing._decode(exe or args[0])) + if not exe: + log.error("Could not find executable %r" % exe) + if context.noptrace: log.warn_once("Skipping debugger since context.noptrace==True") return runner(args, executable=exe, env=env) if ssh or context.native or (context.os == 'android'): - args = _gdbserver_args(args=args, which=which, env=env) + if len(args) > 0 and which(packing._decode(args[0])) == packing._decode(exe): + args = _gdbserver_args(args=args, which=which, env=env) + + else: + # GDBServer is limited in it's ability to manipulate argv[0] + # but can use the ``--wrapper`` option to execute commands and catches + # ``execve`` calls. + # Therefore, we use a wrapper script to execute the target binary + script = _execve_script(args, executable=exe, env=env, ssh=ssh) + args = _gdbserver_args(args=args, which=which, env=env, python_wrapper_script=script) else: qemu_port = random.randint(1024, 65535) qemu_user = qemu.user_path() @@ -564,10 +654,6 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= if not which(args[0]): log.error("%s is not installed" % args[0]) - if not ssh: - exe = exe or which(orig_args[0]) - if not (exe and os.path.exists(exe)): - log.error("%s does not exist" % exe) # Start gdbserver/qemu # (Note: We override ASLR here for the gdbserver process itself.) @@ -1104,13 +1190,12 @@ def findexe(): gdbscript = pre + (gdbscript or '') if gdbscript: - tmp = tempfile.NamedTemporaryFile(prefix = 'pwn', suffix = '.gdb', - delete = False, mode = 'w+') - log.debug('Wrote gdb script to %r\n%s', tmp.name, gdbscript) - gdbscript = 'shell rm %s\n%s' % (tmp.name, gdbscript) + with tempfile.NamedTemporaryFile(prefix = 'pwnlib-gdbscript-', suffix = '.gdb', + delete = False, mode = 'w+') as tmp: + log.debug('Wrote gdb script to %r\n%s', tmp.name, gdbscript) + gdbscript = 'shell rm %s\n%s' % (tmp.name, gdbscript) - tmp.write(gdbscript) - tmp.close() + tmp.write(gdbscript) cmd += ['-x', tmp.name] log.info('running in new terminal: %s', cmd) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index c6f5d500b..3de8d8832 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -1,7 +1,6 @@ from __future__ import absolute_import from __future__ import division -import inspect import logging import os import re @@ -13,7 +12,6 @@ import tempfile import threading import time -import types from pwnlib import term from pwnlib.context import context, LocalContext @@ -906,192 +904,12 @@ def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, igno b'$ \n' """ - if not argv and not executable: - self.error("Must specify argv or executable") - - aslr = aslr if aslr is not None else context.aslr - - if ignore_environ is None: - ignore_environ = env is not None # compat - - argv, env = misc.normalize_argv_env(argv, env, self) - - if shell: - if len(argv) != 1: - self.error('Cannot provide more than 1 argument if shell=True') - argv = [bytearray(b'/bin/sh'), bytearray(b'-c')] + argv - - executable = executable or argv[0] - cwd = cwd or self.cwd - - # Validate, since failures on the remote side will suck. - if not isinstance(executable, (six.text_type, six.binary_type, bytearray)): - self.error("executable / argv[0] must be a string: %r" % executable) - executable = bytearray(packing._need_bytes(executable, min_wrong=0x80)) - - # Allow passing in sys.stdin/stdout/stderr objects - handles = {sys.stdin: 0, sys.stdout:1, sys.stderr:2} - stdin = handles.get(stdin, stdin) - stdout = handles.get(stdout, stdout) - stderr = handles.get(stderr, stderr) - - # Allow the user to provide a self-contained function to run - def func(): pass - func = preexec_fn or func - func_args = preexec_args - - if not isinstance(func, types.FunctionType): - self.error("preexec_fn must be a function") - - func_name = func.__name__ - if func_name == (lambda: 0).__name__: - self.error("preexec_fn cannot be a lambda") - - func_src = inspect.getsource(func).strip() - setuid = True if setuid is None else bool(setuid) - - script = r""" -#!/usr/bin/env python -import os, sys, ctypes, resource, platform, stat -from collections import OrderedDict -try: - integer_types = int, long -except NameError: - integer_types = int, -exe = bytes(%(executable)r) -argv = [bytes(a) for a in %(argv)r] -env = %(env)r - -os.chdir(%(cwd)r) - -if %(ignore_environ)r: - os.environ.clear() -environ = getattr(os, 'environb', os.environ) - -if env is not None: - env = OrderedDict((bytes(k), bytes(v)) for k,v in env) - environ.update(env) -else: - env = environ - -def is_exe(path): - return os.path.isfile(path) and os.access(path, os.X_OK) - -PATH = environ.get(b'PATH',b'').split(os.pathsep.encode()) - -if os.path.sep.encode() not in exe and not is_exe(exe): - for path in PATH: - test_path = os.path.join(path, exe) - if is_exe(test_path): - exe = test_path - break - -if not is_exe(exe): - sys.stderr.write('3\n') - sys.stderr.write("{!r} is not executable or does not exist in $PATH: {!r}".format(exe,PATH)) - sys.exit(-1) - -if not %(setuid)r: - PR_SET_NO_NEW_PRIVS = 38 - result = ctypes.CDLL('libc.so.6').prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) - - if result != 0: - sys.stdout.write('3\n') - sys.stdout.write("Could not disable setuid: prctl(PR_SET_NO_NEW_PRIVS) failed") - sys.exit(-1) - -try: - PR_SET_PTRACER = 0x59616d61 - PR_SET_PTRACER_ANY = -1 - ctypes.CDLL('libc.so.6').prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0) -except Exception: - pass - -# Determine what UID the process will execute as -# This is used for locating apport core dumps -suid = os.getuid() -sgid = os.getgid() -st = os.stat(exe) -if %(setuid)r: - if (st.st_mode & stat.S_ISUID): - suid = st.st_uid - if (st.st_mode & stat.S_ISGID): - sgid = st.st_gid - -if sys.argv[-1] == 'check': - sys.stdout.write("1\n") - sys.stdout.write(str(os.getpid()) + "\n") - sys.stdout.write(str(os.getuid()) + "\n") - sys.stdout.write(str(os.getgid()) + "\n") - sys.stdout.write(str(suid) + "\n") - sys.stdout.write(str(sgid) + "\n") - getattr(sys.stdout, 'buffer', sys.stdout).write(os.path.realpath(exe) + b'\x00') - sys.stdout.flush() - -for fd, newfd in {0: %(stdin)r, 1: %(stdout)r, 2:%(stderr)r}.items(): - if newfd is None: - os.close(fd) - elif isinstance(newfd, (str, bytes)): - newfd = os.open(newfd, os.O_RDONLY if fd == 0 else (os.O_RDWR|os.O_CREAT)) - os.dup2(newfd, fd) - os.close(newfd) - elif isinstance(newfd, integer_types) and newfd != fd: - os.dup2(fd, newfd) - -if not %(aslr)r: - if platform.system().lower() == 'linux' and %(setuid)r is not True: - ADDR_NO_RANDOMIZE = 0x0040000 - ctypes.CDLL('libc.so.6').personality(ADDR_NO_RANDOMIZE) - - resource.setrlimit(resource.RLIMIT_STACK, (-1, -1)) - -# Attempt to dump ALL core file regions -try: - with open('/proc/self/coredump_filter', 'w') as core_filter: - core_filter.write('0x3f\n') -except Exception: - pass - -# Assume that the user would prefer to have core dumps. -try: - resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) -except Exception: - pass - -%(func_src)s -%(func_name)s(*%(func_args)r) - -""" % locals() - - if len(argv) > 0 and len(argv[0]) > 0: - script += r"os.execve(exe, argv, env) " - - # os.execve does not allow us to pass empty argv[0] - # Therefore we use ctypes to call execve directly - else: - script += r""" -# Transform envp from dict to list -env_list = [key + b"=" + value for key, value in env.items()] - -# ctypes helper to convert a python list to a NULL-terminated C array -def to_carray(py_list): - py_list += [None] # NULL-terminated - return (ctypes.c_char_p * len(py_list))(*py_list) - -c_argv = to_carray(argv) -c_env = to_carray(env_list) - -# Call execve -libc = ctypes.CDLL('libc.so.6') -libc.execve(exe, c_argv, c_env) - -# We should never get here, since we sanitized argv and env, -# but just in case, indicate that something went wrong. -libc.perror(b"execve") -raise OSError("execve failed") -""" % locals() + cwd = cwd or self.cwd + script = misc._create_execve_script(argv=argv, executable=executable, + cwd=cwd, env=env, stdin=stdin, stdout=stdout, stderr=stderr, + ignore_environ=ignore_environ, preexec_fn=preexec_fn, preexec_args=preexec_args, + aslr=aslr, setuid=setuid, shell=shell, log=self) - script = script.strip() self.debug("Created execve script:\n" + script) @@ -1101,6 +919,7 @@ def to_carray(py_list): self.chmod('+x', tmpfile) self.info("Uploading execve script to %r" % tmpfile) + script = packing._encode(script) self.upload_data(script, tmpfile) return tmpfile diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index d0780ed6e..fbd01b951 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -12,6 +12,8 @@ import subprocess import sys import tempfile +import inspect +import types from pwnlib import atexit from pwnlib.context import context @@ -654,3 +656,239 @@ def python_2_bytes_compatible(klass): if '__str__' not in klass.__dict__: klass.__str__ = klass.__bytes__ return klass + +def _create_execve_script(argv=None, executable=None, cwd=None, env=None, ignore_environ=None, + stdin=0, stdout=1, stderr=2, preexec_fn=None, preexec_args=(), aslr=None, setuid=None, + shell=False, log=log): + """ + Creates a python wrapper script that triggers the syscall `execve` directly. + + Arguments: + argv(list): + List of arguments to pass into the process + executable(str): + Path to the executable to run. + If :const:`None`, ``argv[0]`` is used. + cwd(str): + Working directory. If :const:`None`, uses the working directory specified + on :attr:`cwd` or set via :meth:`set_working_directory`. + env(dict): + Environment variables to add to the environment. + ignore_environ(bool): + Ignore default environment. By default use default environment iff env not specified. + stdin(int, str): + If an integer, replace stdin with the numbered file descriptor. + If a string, a open a file with the specified path and replace + stdin with its file descriptor. May also be one of ``sys.stdin``, + ``sys.stdout``, ``sys.stderr``. If :const:`None`, the file descriptor is closed. + stdout(int, str): + See ``stdin``. + stderr(int, str): + See ``stdin``. + preexec_fn(callable): + Function which is executed on the remote side before execve(). + This **MUST** be a self-contained function -- it must perform + all of its own imports, and cannot refer to variables outside + its scope. + preexec_args(object): + Argument passed to ``preexec_fn``. + This **MUST** only consist of native Python objects. + aslr(bool): + See :class:`pwnlib.tubes.process.process` for more information. + setuid(bool): + See :class:`pwnlib.tubes.process.process` for more information. + shell(bool): + Pass the command-line arguments to the shell. + + Returns: + A string containing the python script. + """ + if not argv and not executable: + log.error("Must specify argv or executable") + + aslr = aslr if aslr is not None else context.aslr + + if ignore_environ is None: + ignore_environ = env is not None # compat + + argv, env = normalize_argv_env(argv, env, log) + + if shell: + if len(argv) != 1: + log.error('Cannot provide more than 1 argument if shell=True') + argv = [bytearray(b'/bin/sh'), bytearray(b'-c')] + argv + + executable = executable or argv[0] + cwd = cwd or '.' + + # Validate, since failures on the remote side will suck. + if not isinstance(executable, (six.text_type, six.binary_type, bytearray)): + log.error("executable / argv[0] must be a string: %r" % executable) + executable = bytearray(packing._need_bytes(executable, min_wrong=0x80)) + + # Allow passing in sys.stdin/stdout/stderr objects + handles = {sys.stdin: 0, sys.stdout:1, sys.stderr:2} + stdin = handles.get(stdin, stdin) + stdout = handles.get(stdout, stdout) + stderr = handles.get(stderr, stderr) + + # Allow the user to provide a self-contained function to run + def func(): pass + func = preexec_fn or func + func_args = preexec_args + + if not isinstance(func, types.FunctionType): + log.error("preexec_fn must be a function") + + func_name = func.__name__ + if func_name == (lambda: 0).__name__: + log.error("preexec_fn cannot be a lambda") + + func_src = inspect.getsource(func).strip() + setuid = True if setuid is None else bool(setuid) + + + script = r""" +#!/usr/bin/env python +import os, sys, ctypes, resource, platform, stat +from collections import OrderedDict +try: + integer_types = int, long +except NameError: + integer_types = int, +exe = bytes(%(executable)r) +argv = [bytes(a) for a in %(argv)r] +env = %(env)r + +os.chdir(%(cwd)r) + +if %(ignore_environ)r: + os.environ.clear() + +environ = getattr(os, 'environb', os.environ) + +if env is not None: + env = OrderedDict((bytes(k), bytes(v)) for k,v in env) + environ.update(env) +else: + env = environ + +def is_exe(path): + return os.path.isfile(path) and os.access(path, os.X_OK) + +PATH = environ.get(b'PATH',b'').split(os.pathsep.encode()) + +if os.path.sep.encode() not in exe and not is_exe(exe): + for path in PATH: + test_path = os.path.join(path, exe) + if is_exe(test_path): + exe = test_path + break + +if not is_exe(exe): + sys.stderr.write('3\n') + sys.stderr.write("{!r} is not executable or does not exist in $PATH: {!r}".format(exe,PATH)) + sys.exit(-1) + +if not %(setuid)r: + PR_SET_NO_NEW_PRIVS = 38 + result = ctypes.CDLL('libc.so.6').prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) + + if result != 0: + sys.stdout.write('3\n') + sys.stdout.write("Could not disable setuid: prctl(PR_SET_NO_NEW_PRIVS) failed") + sys.exit(-1) + +try: + PR_SET_PTRACER = 0x59616d61 + PR_SET_PTRACER_ANY = -1 + ctypes.CDLL('libc.so.6').prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0) +except Exception: + pass + +# Determine what UID the process will execute as +# This is used for locating apport core dumps +suid = os.getuid() +sgid = os.getgid() +st = os.stat(exe) +if %(setuid)r: + if (st.st_mode & stat.S_ISUID): + suid = st.st_uid + if (st.st_mode & stat.S_ISGID): + sgid = st.st_gid + +if sys.argv[-1] == 'check': + sys.stdout.write("1\n") + sys.stdout.write(str(os.getpid()) + "\n") + sys.stdout.write(str(os.getuid()) + "\n") + sys.stdout.write(str(os.getgid()) + "\n") + sys.stdout.write(str(suid) + "\n") + sys.stdout.write(str(sgid) + "\n") + getattr(sys.stdout, 'buffer', sys.stdout).write(os.path.realpath(exe) + b'\x00') + sys.stdout.flush() + +for fd, newfd in {0: %(stdin)r, 1: %(stdout)r, 2:%(stderr)r}.items(): + if newfd is None: + os.close(fd) + elif isinstance(newfd, (str, bytes)): + newfd = os.open(newfd, os.O_RDONLY if fd == 0 else (os.O_RDWR|os.O_CREAT)) + os.dup2(newfd, fd) + os.close(newfd) + elif isinstance(newfd, integer_types) and newfd != fd: + os.dup2(fd, newfd) + +if not %(aslr)r: + if platform.system().lower() == 'linux' and %(setuid)r is not True: + ADDR_NO_RANDOMIZE = 0x0040000 + ctypes.CDLL('libc.so.6').personality(ADDR_NO_RANDOMIZE) + + resource.setrlimit(resource.RLIMIT_STACK, (-1, -1)) + +# Attempt to dump ALL core file regions +try: + with open('/proc/self/coredump_filter', 'w') as core_filter: + core_filter.write('0x3f\n') +except Exception: + pass + +# Assume that the user would prefer to have core dumps. +try: + resource.setrlimit(resource.RLIMIT_CORE, (-1, -1)) +except Exception: + pass + +%(func_src)s +%(func_name)s(*%(func_args)r) + +""" % locals() + + if len(argv) > 0 and len(argv[0]) > 0: + script += r"os.execve(exe, argv, env) " + + # os.execve does not allow us to pass empty argv[0] + # Therefore we use ctypes to call execve directly + else: + script += r""" +# Transform envp from dict to list +env_list = [key + b"=" + value for key, value in env.items()] + +# ctypes helper to convert a python list to a NULL-terminated C array +def to_carray(py_list): + py_list += [None] # NULL-terminated + return (ctypes.c_char_p * len(py_list))(*py_list) + +c_argv = to_carray(argv) +c_env = to_carray(env_list) + +# Call execve +libc = ctypes.CDLL('libc.so.6') +libc.execve(exe, c_argv, c_env) + +# We should never get here, since we sanitized argv and env, +# but just in case, indicate that something went wrong. +libc.perror(b"execve") +raise OSError("execve failed") +""" % locals() + script = script.strip() + + return script From eb0043afc620444f03d1d4eec331ad2396db9bc7 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Mon, 19 Feb 2024 12:25:20 +0100 Subject: [PATCH 079/107] Enable UI tests on dev branch again (#2353) They might be more stable now after the term changes. Ref #1647 --- docs/source/conf.py | 1 - pwnlib/ui.py | 30 +----------------------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index ee537d0db..c2fbb9e3c 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -97,7 +97,6 @@ def __setattr__(self, name, value): github_actions = os.environ.get('USER') == 'runner' travis_ci = os.environ.get('USER') == 'travis' local_doctest = os.environ.get('USER') == 'pwntools' -branch_dev = os.environ.get('GITHUB_BASE_REF') == 'dev' skip_android = True ''' diff --git a/pwnlib/ui.py b/pwnlib/ui.py index f03491cdd..bb80b524e 100644 --- a/pwnlib/ui.py +++ b/pwnlib/ui.py @@ -61,10 +61,6 @@ def yesno(prompt, default=None): `True` if the answer was "yes", `False` if "no" Examples: - - .. doctest:: - :skipif: branch_dev - >>> yesno("A number:", 20) Traceback (most recent call last): ... @@ -83,10 +79,6 @@ def yesno(prompt, default=None): [?] is it good 3 [yes/No] False Tests: - - .. doctest:: - :skipif: branch_dev - >>> p = testpwnproc("print(yesno('is it ok??'))") >>> b"is it ok" in p.recvuntil(b"??") True @@ -148,20 +140,12 @@ def options(prompt, opts, default = None): The users choice in the form of an integer. Examples: - - .. doctest:: - :skipif: branch_dev - >>> options("Select a color", ("red", "green", "blue"), "green") Traceback (most recent call last): ... ValueError: options(): default must be a number or None Tests: - - .. doctest:: - :skipif: branch_dev - >>> p = testpwnproc("print(options('select a color', ('red', 'green', 'blue')))") >>> p.sendline(b"\33[C\33[A\33[A\33[B\33[1;5A\33[1;5B 0310") >>> _ = p.recvall() @@ -272,10 +256,6 @@ def pause(n=None): r"""Waits for either user input or a specific number of seconds. Examples: - - .. doctest:: - :skipif: branch_dev - >>> with context.local(log_level="INFO"): ... pause(1) [x] Waiting @@ -287,10 +267,6 @@ def pause(n=None): ValueError: pause(): n must be a number or None Tests: - - .. doctest:: - :skipif: branch_dev - >>> saved_stdin = sys.stdin >>> try: ... sys.stdin = io.TextIOWrapper(io.BytesIO(b"\n")) @@ -335,11 +311,7 @@ def more(text): Returns: :const:`None` - Tests: - - .. doctest:: - :skipif: branch_dev - + Tests: >>> more("text") text >>> p = testpwnproc("more('text\\n' * (term.height + 2))") From 1b47ae1c202a7164118001dd0ebb8ed5142914f2 Mon Sep 17 00:00:00 2001 From: erikleffler Date: Tue, 20 Feb 2024 18:28:20 +0000 Subject: [PATCH 080/107] Add RETURN_CONST as an allowed _const_code in safeeval (#2352) * better error message when process creation fails in ssh.process * add RETURN_CONST as an allowed _const_code in safeeval * fix lint * add to changelog * fix changelog * add couldn't find python warning * Deduplicate error message code --------- Co-authored-by: Peace-Maker --- CHANGELOG.md | 2 ++ pwnlib/tubes/ssh.py | 16 ++++++++++------ pwnlib/util/safeeval.py | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 977389640..d19a6fc8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,8 +92,10 @@ The table below shows which release corresponds to each branch, and what date th ## 4.11.2 - [#2349][2349] Fix term.readline omitting a trailing \n +- [#2352][2352] add `RETURN_CONST` as an allowed `_const_code` in safeeval [2349]: https://github.com/Gallopsled/pwntools/pull/2349 +[2352]: https://github.com/Gallopsled/pwntools/pull/2352 ## 4.11.1 (`stable`) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index adda422ff..b15677cd2 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -1074,15 +1074,19 @@ def is_exe(path): python = ssh_process(self, script, tty=True, cwd=cwd, raw=True, level=self.level, timeout=timeout) try: - python.recvline_contains(b'PWNTOOLS') # Magic flag so that any sh/bash initialization errors are swallowed - python.recvline() # Python interpreter that was selected + python.recvline_contains(b'PWNTOOLS') # Magic flag so that any sh/bash initialization errors are swallowed + try: + if b'python' not in python.recvline(): # Python interpreter that was selected + raise ValueError("Python not found on remote host") + except (EOFError, ValueError): + self.warn_once('Could not find a Python interpreter on %s\n' % self.host + + "Use ssh.system() instead of ssh.process()\n") + h.failure("Process creation failed") + return None + result = safeeval.const(python.recvline()) # Status flag from the Python script except (EOFError, ValueError): h.failure("Process creation failed") - self.warn_once('Could not find a Python interpreter on %s\n' % self.host - + "Use ssh.run() instead of ssh.process()\n" - "The original error message:\n" - + python.recvall().decode()) return None # If an error occurred, try to grab as much output diff --git a/pwnlib/util/safeeval.py b/pwnlib/util/safeeval.py index 47ed37ffc..b78ab1fd5 100644 --- a/pwnlib/util/safeeval.py +++ b/pwnlib/util/safeeval.py @@ -6,7 +6,7 @@ 'BUILD_CONST_KEY_MAP', 'BUILD_STRING', 'LOAD_CONST','RETURN_VALUE','STORE_SUBSCR', 'STORE_MAP', 'LIST_TO_TUPLE', 'LIST_EXTEND', 'SET_UPDATE', 'DICT_UPDATE', 'DICT_MERGE', - 'COPY', 'RESUME', + 'COPY', 'RESUME', 'RETURN_CONST' ] _expr_codes = _const_codes + [ From c17f835b3ee3e817f109e3dc371363560bc66fa9 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Wed, 21 Feb 2024 15:21:57 +0100 Subject: [PATCH 081/107] pwn template: Don't search for challenge binary when already given (#2354) --- pwnlib/commandline/template.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pwnlib/commandline/template.py b/pwnlib/commandline/template.py index 6e5f74655..5cd6c7341 100644 --- a/pwnlib/commandline/template.py +++ b/pwnlib/commandline/template.py @@ -47,10 +47,11 @@ def detect_missing_binaries(args): else: if os.access(filename, os.X_OK): other_files.append(filename) - if len(other_files) == 1: - exe = other_files[0] - elif len(other_files) > 1: - log.warning("Failed to find challenge binary. There are multiple binaries in the current directory: %s", other_files) + if not exe: + if len(other_files) == 1: + exe = other_files[0] + elif len(other_files) > 1: + log.warning("Failed to find challenge binary. There are multiple binaries in the current directory: %s", other_files) if exe != args.exe: log.success("Found challenge binary %r", exe) From 2b7ec5e77a8f527b4d26d6a305a307d3d50bd1df Mon Sep 17 00:00:00 2001 From: peace-maker Date: Thu, 22 Feb 2024 18:30:23 +0100 Subject: [PATCH 082/107] Fix gdb and other doctests (#2355) * Fix gdb.debug doctests * Accept bytes in ssh.which But still return a `str` return for backwards-compatibility. * CI: Make rpyc visible in gdb's python * Fix not running all doctests They appear to have to be a free standing block of `>>>` with an empty line above. * Remove unnecessary text type check in ssh.which --- .github/workflows/ci.yml | 4 ++ docs/source/conf.py | 2 + docs/source/index.rst | 1 - docs/source/install.rst | 10 ++--- pwnlib/context/__init__.py | 1 + pwnlib/elf/elf.py | 3 ++ pwnlib/fmtstr.py | 14 +++++++ pwnlib/gdb.py | 40 +++++++++++-------- pwnlib/libcdb.py | 7 ++++ pwnlib/rop/rop.py | 1 + .../templates/aarch64/pushstr_array.asm | 1 + pwnlib/shellcraft/templates/arm/ret.asm | 1 + pwnlib/shellcraft/templates/i386/xor.asm | 1 + .../templates/thumb/linux/findpeer.asm | 1 + .../templates/thumb/linux/listen.asm | 1 + pwnlib/tubes/ssh.py | 20 ++++++++-- pwnlib/ui.py | 10 ++++- pwnlib/useragents.py | 1 + pwnlib/util/crc/__init__.py | 4 ++ pwnlib/util/cyclic.py | 1 + pwnlib/util/fiddling.py | 3 ++ pwnlib/util/iters.py | 27 +++++++++++++ pwnlib/util/lists.py | 6 +++ pwnlib/util/misc.py | 7 ++++ pwnlib/util/net.py | 2 + pwnlib/util/packing.py | 6 +++ pwnlib/util/proc.py | 13 ++++++ 27 files changed, 159 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c4db82a9..5e0d5bda2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,6 +112,10 @@ jobs: - name: Coverage doctests run: | + # Python version installed using setup-python interferes with gdb's python + # by setting LD_LIBRARY_PATH and gdb's python becoming unable to load built-in modules + # like _socket. This is a workaround. + unset LD_LIBRARY_PATH PWNLIB_NOTERM=1 python -bb -m coverage run -m sphinx -b doctest docs/source docs/build/doctest - name: Coverage running examples diff --git a/docs/source/conf.py b/docs/source/conf.py index c2fbb9e3c..6d72a01af 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -71,6 +71,7 @@ def filter(self, record): import sys, os os.environ['PWNLIB_NOTERM'] = '1' os.environ['PWNLIB_RANDOMIZE'] = '0' +import six import pwnlib.update import pwnlib.util.fiddling import logging @@ -98,6 +99,7 @@ def __setattr__(self, name, value): travis_ci = os.environ.get('USER') == 'travis' local_doctest = os.environ.get('USER') == 'pwntools' skip_android = True +is_python2 = six.PY2 ''' autoclass_content = 'both' diff --git a/docs/source/index.rst b/docs/source/index.rst index bc2f2b3e2..596cf738a 100755 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -82,7 +82,6 @@ Each of the ``pwntools`` modules is documented here. :hidden: testexample - rop/call .. only:: not dash diff --git a/docs/source/install.rst b/docs/source/install.rst index 428121195..d63e67523 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -51,13 +51,11 @@ Command-Line Tools When installed with ``sudo`` the above commands will install Pwntools' command-line tools to somewhere like ``/usr/bin``. -However, if you run as an unprivileged user, you may see a warning message that looks like this: +However, if you run as an unprivileged user, you may see a warning message that looks like this:: -.. code-block:: - - WARNING: The scripts asm, checksec, common, constgrep, cyclic, debug, disablenx, disasm, - elfdiff, elfpatch, errno, hex, main, phd, pwn, pwnstrip, scramble, shellcraft, template, - unhex, update and version are installed in '/home/user/.local/bin' which is not on PATH. + WARNING: The scripts asm, checksec, common, constgrep, cyclic, debug, disablenx, disasm, + elfdiff, elfpatch, errno, hex, main, phd, pwn, pwnstrip, scramble, shellcraft, template, + unhex, update and version are installed in '/home/user/.local/bin' which is not on PATH. Follow the instructions listed and add ``~/.local/bin`` to your ``$PATH`` environment variable. diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 4788afd59..6b3f636b7 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -830,6 +830,7 @@ def bits(self, bits): The default value is ``32``, but changes according to :attr:`arch`. Examples: + >>> context.clear() >>> context.bits == 32 True diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index 4bc59bda3..acb0a2d7a 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -1346,6 +1346,7 @@ def vaddr_to_offset(self, address): or :const:`None`. Examples: + >>> bash = ELF(which('bash')) >>> bash.vaddr_to_offset(bash.address) 0 @@ -1496,6 +1497,7 @@ def write(self, address, data): that it stays in the same segment. Examples: + >>> bash = ELF(which('bash')) >>> bash.read(bash.address+1, 3) b'ELF' @@ -2387,6 +2389,7 @@ def set_interpreter(exepath, interpreter_path): A new ELF instance is returned after patching the binary with the external ``patchelf`` tool. Example: + >>> tmpdir = tempfile.mkdtemp() >>> ls_path = os.path.join(tmpdir, 'ls') >>> _ = shutil.copy(which('ls'), ls_path) diff --git a/pwnlib/fmtstr.py b/pwnlib/fmtstr.py index fa765e048..2b8508806 100644 --- a/pwnlib/fmtstr.py +++ b/pwnlib/fmtstr.py @@ -129,6 +129,7 @@ def normalize_writes(writes): such that all values are raw bytes and consecutive writes are merged to a single key. Examples: + >>> context.clear(endian="little", bits=32) >>> normalize_writes({0x0: [p32(0xdeadbeef)], 0x4: p32(0xf00dface), 0x10: 0x41414141}) [(0, b'\xef\xbe\xad\xde\xce\xfa\r\xf0'), (16, b'AAAA')] @@ -215,6 +216,7 @@ def compute_padding(self, counter): given the current format string write counter (how many bytes have been written until now). Examples: + >>> hex(pwnlib.fmtstr.AtomWrite(0x0, 0x2, 0x2345).compute_padding(0x1111)) '0x1234' >>> hex(pwnlib.fmtstr.AtomWrite(0x0, 0x2, 0xaa00).compute_padding(0xaabb)) @@ -246,6 +248,7 @@ def union(self, other): Combine adjacent writes into a single write. Example: + >>> context.clear(endian = "little") >>> pwnlib.fmtstr.AtomWrite(0x0, 0x1, 0x1, 0xff).union(pwnlib.fmtstr.AtomWrite(0x1, 0x1, 0x2, 0x77)) AtomWrite(start=0, size=2, integer=0x201, mask=0x77ff) @@ -285,11 +288,13 @@ def make_atoms_simple(address, data, badbytes=frozenset()): This function is simple and does not try to minimize the number of atoms. For example, if there are no bad bytes, it simply returns one atom for each byte: + >>> pwnlib.fmtstr.make_atoms_simple(0x0, b"abc", set()) [AtomWrite(start=0, size=1, integer=0x61, mask=0xff), AtomWrite(start=1, size=1, integer=0x62, mask=0xff), AtomWrite(start=2, size=1, integer=0x63, mask=0xff)] If there are bad bytes, it will try to bypass by skipping addresses containing bad bytes, otherwise a RuntimeError will be raised: + >>> pwnlib.fmtstr.make_atoms_simple(0x61, b'abc', b'\x62') [AtomWrite(start=97, size=2, integer=0x6261, mask=0xffff), AtomWrite(start=99, size=1, integer=0x63, mask=0xff)] >>> pwnlib.fmtstr.make_atoms_simple(0x61, b'a'*0x10, b'\x62\x63\x64\x65\x66\x67\x68') @@ -325,6 +330,7 @@ def merge_atoms_writesize(atoms, maxsize): This function simply merges adjacent atoms as long as the merged atom's size is not larger than ``maxsize``. Examples: + >>> from pwnlib.fmtstr import * >>> merge_atoms_writesize([AtomWrite(0, 1, 1), AtomWrite(1, 1, 1), AtomWrite(2, 1, 2)], 2) [AtomWrite(start=0, size=2, integer=0x101, mask=0xffff), AtomWrite(start=2, size=1, integer=0x2, mask=0xff)] @@ -364,6 +370,7 @@ def find_min_hamming_in_range_step(prev, step, carry, strict): A tuple (score, value, mask) where score equals the number of matching bytes between the returned value and target. Examples: + >>> initial = {(0,0): (0,0,0), (0,1): None, (1,0): None, (1,1): None} >>> pwnlib.fmtstr.find_min_hamming_in_range_step(initial, (0, 0xFF, 0x1), 0, 0) (1, 1, 255) @@ -419,6 +426,7 @@ def find_min_hamming_in_range(maxbytes, lower, upper, target): target(int): the target value that should be approximated Examples: + >>> pp = lambda svm: (svm[0], hex(svm[1]), hex(svm[2])) >>> pp(pwnlib.fmtstr.find_min_hamming_in_range(1, 0x0, 0x100, 0xaa)) (1, '0xaa', '0xff') @@ -470,6 +478,7 @@ def merge_atoms_overlapping(atoms, sz, szmax, numbwritten, overflows): overflows(int): how many extra overflows (of size sz) to tolerate to reduce the number of atoms Examples: + >>> from pwnlib.fmtstr import * >>> merge_atoms_overlapping([AtomWrite(0, 1, 1), AtomWrite(1, 1, 1)], 2, 8, 0, 1) [AtomWrite(start=0, size=2, integer=0x101, mask=0xffff)] @@ -557,6 +566,7 @@ def overlapping_atoms(atoms): Finds pairs of atoms that write to the same address. Basic examples: + >>> from pwnlib.fmtstr import * >>> list(overlapping_atoms([AtomWrite(0, 2, 0), AtomWrite(2, 10, 1)])) # no overlaps [] @@ -564,6 +574,7 @@ def overlapping_atoms(atoms): [(AtomWrite(start=0, size=2, integer=0x0, mask=0xffff), AtomWrite(start=1, size=2, integer=0x1, mask=0xffff))] When there are transitive overlaps, only the largest overlap is returned. For example: + >>> list(overlapping_atoms([AtomWrite(0, 3, 0), AtomWrite(1, 4, 1), AtomWrite(2, 4, 1)])) [(AtomWrite(start=0, size=3, integer=0x0, mask=0xffffff), AtomWrite(start=1, size=4, integer=0x1, mask=0xffffffff)), (AtomWrite(start=1, size=4, integer=0x1, mask=0xffffffff), AtomWrite(start=2, size=4, integer=0x1, mask=0xffffffff))] @@ -629,6 +640,7 @@ def sort_atoms(atoms, numbwritten): numbwritten(int): the value at which the counter starts Examples: + >>> from pwnlib.fmtstr import * >>> sort_atoms([AtomWrite(0, 1, 0xff), AtomWrite(1, 1, 0xfe)], 0) # the example described above [AtomWrite(start=1, size=1, integer=0xfe, mask=0xff), AtomWrite(start=0, size=1, integer=0xff, mask=0xff)] @@ -694,6 +706,7 @@ def make_payload_dollar(data_offset, atoms, numbwritten=0, countersize=4, no_dol no_dollars(bool) : flag to generete the payload with or w/o $ notation Examples: + >>> pwnlib.fmtstr.make_payload_dollar(1, [pwnlib.fmtstr.AtomWrite(0x0, 0x1, 0xff)]) (b'%255c%1$hhn', b'\x00\x00\x00\x00') ''' @@ -840,6 +853,7 @@ def fmtstr_payload(offset, writes, numbwritten=0, write_size='byte', write_size_ The payload in order to do needed writes Examples: + >>> context.clear(arch = 'amd64') >>> fmtstr_payload(1, {0x0: 0x1337babe}, write_size='int') b'%322419390c%4$llnaaaabaa\x00\x00\x00\x00\x00\x00\x00\x00' diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index d885ac72f..730635ff4 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -141,14 +141,11 @@ from __future__ import absolute_import from __future__ import division -from contextlib import contextmanager import os -import sys import platform import psutil import random import re -import shlex import six import six.moves import socket @@ -512,27 +509,30 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io.close() Start a new process with modified argv[0] - >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], executable="/bin/sh") + + >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh") >>> io.sendline(b"echo $0") >>> io.recvline() - b'$ \xde\xad\xbe\xef\n' + b'\xde\xad\xbe\xef\n' >>> io.close() Demonstrate that LD_PRELOAD is respected + >>> io = process(["grep", "libc.so.6", "/proc/self/maps"]) >>> real_libc_path = io.recvline().split()[-1] + >>> io.close() >>> import shutil - >>> shutil.copy(real_libc_path, "./libc.so.6") # make a copy of libc to demonstrate that it is loaded - >>> io = gdb.debug(["grep", "libc.so.6", "/proc/self/maps"], env={"LD_PRELOAD": "./libc.so.6"}) - >>> io.recvline().split()[-1] - b"./libc.so.6" - >>> os.remove("./libc.so.6") # cleanup + >>> local_path = shutil.copy(real_libc_path, "./local-libc.so") # make a copy of libc to demonstrate that it is loaded + >>> io = gdb.debug(["grep", "local-libc.so", "/proc/self/maps"], gdbscript="continue", env={"LD_PRELOAD": "./local-libc.so"}) + >>> io.recvline().split()[-1] # doctest: +ELLIPSIS + b'.../local-libc.so' + >>> os.remove("./local-libc.so") # cleanup Using GDB Python API: - .. doctest - :skipif: six.PY2 + .. doctest:: + :skipif: is_python2 Debug a new process @@ -577,18 +577,21 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io.sendline(b"echo hello") Interact with the process + >>> io.interactive() # doctest: +SKIP >>> io.close() Using a modified args[0] on a remote process - >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh", ssh=shell) + + >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh", ssh=shell) >>> io.sendline(b"echo $0") >>> io.recvline() b'$ \xde\xad\xbe\xef\n' >>> io.close() Using an empty args[0] on a remote process - >>> io = gdb.debug(args=[], gdbscript='continue', exe="/bin/sh", ssh=shell) + + >>> io = gdb.debug(args=[], gdbscript='continue', exe="/bin/sh", ssh=shell) >>> io.sendline(b"echo $0") >>> io.recvline() b'$ \n' @@ -681,7 +684,10 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= garbage = gdbserver.recvline(timeout=1) # Some versions of gdbserver output an additional message - garbage2 = gdbserver.recvline_startswith(b"Remote debugging from host ", timeout=2) + try: + garbage2 = gdbserver.recvline_startswith(b"Remote debugging from host ", timeout=2) + except EOFError: + pass return gdbserver @@ -944,8 +950,8 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr Using GDB Python API: - .. doctest - :skipif: six.PY2 + .. doctest:: + :skipif: is_python2 >>> io = process('bash') diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 4955af3f3..885a0eea2 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -249,6 +249,7 @@ def unstrip_libc(filename): :const:`True` if binary was unstripped, :const:`False` otherwise. Examples: + >>> filename = search_by_build_id('69389d485a9793dbe873f0ea2c93e02efaa9aa3d', unstrip=False) >>> libc = ELF(filename) >>> 'main_arena' in libc.symbols @@ -432,6 +433,7 @@ def download_libraries(libc_path, unstrip=True): The path to the cached directory containing the downloaded libraries. Example: + >>> libc_path = ELF(which('ls'), checksec=False).libc.path >>> lib_path = download_libraries(libc_path) >>> lib_path is not None @@ -545,6 +547,7 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as is returned instead. Examples: + >>> filename = search_by_symbol_offsets({'puts': 0x420, 'printf': 0xc90}, select_index=1) >>> libc = ELF(filename) >>> libc.sym.system == 0x52290 @@ -597,6 +600,7 @@ def search_by_build_id(hex_encoded_id, unstrip=True): Path to the downloaded library on disk, or :const:`None`. Examples: + >>> filename = search_by_build_id('fe136e485814fee2268cf19e5c124ed0f73f4400') >>> hex(ELF(filename).symbols.read) '0xda260' @@ -622,6 +626,7 @@ def search_by_md5(hex_encoded_id, unstrip=True): Path to the downloaded library on disk, or :const:`None`. Examples: + >>> filename = search_by_md5('7a71dafb87606f360043dcd638e411bd') >>> hex(ELF(filename).symbols.read) '0xda260' @@ -647,6 +652,7 @@ def search_by_sha1(hex_encoded_id, unstrip=True): Path to the downloaded library on disk, or :const:`None`. Examples: + >>> filename = search_by_sha1('34471e355a5e71400b9d65e78d2cd6ce7fc49de5') >>> hex(ELF(filename).symbols.read) '0xda260' @@ -673,6 +679,7 @@ def search_by_sha256(hex_encoded_id, unstrip=True): Path to the downloaded library on disk, or :const:`None`. Examples: + >>> filename = search_by_sha256('5e877a8272da934812d2d1f9ee94f73c77c790cbc5d8251f5322389fc9667f21') >>> hex(ELF(filename).symbols.read) '0xda260' diff --git a/pwnlib/rop/rop.py b/pwnlib/rop/rop.py index 6a57a60d1..4505962d7 100644 --- a/pwnlib/rop/rop.py +++ b/pwnlib/rop/rop.py @@ -1499,6 +1499,7 @@ def ret2csu(self, edi=Padding('edi'), rsi=Padding('rsi'), .dynamic section. .got.plt entries are a good target. Required for PIE binaries. Test: + >>> context.clear(binary=pwnlib.data.elf.ret2dlresolve.get("amd64")) >>> r = ROP(context.binary) >>> r.ret2csu(1, 2, 3, 4, 5, 6, 7, 8, 9) diff --git a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm index b28458765..7b5ed7302 100644 --- a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm +++ b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm @@ -17,6 +17,7 @@ Arguments: ends with exactly one NULL byte. Example: + >>> assembly = shellcraft.execve("/bin/sh", ["sh", "-c", "echo Hello string $WORLD"], {"WORLD": "World!"}) >>> ELF.from_assembly(assembly).process().recvall() b'Hello string World!\n' diff --git a/pwnlib/shellcraft/templates/arm/ret.asm b/pwnlib/shellcraft/templates/arm/ret.asm index 8d87c26c1..71c27597c 100644 --- a/pwnlib/shellcraft/templates/arm/ret.asm +++ b/pwnlib/shellcraft/templates/arm/ret.asm @@ -5,6 +5,7 @@ Args: return_value: Value to return Examples: + >>> with context.local(arch='arm'): ... print(enhex(asm(shellcraft.ret()))) ... print(enhex(asm(shellcraft.ret(0)))) diff --git a/pwnlib/shellcraft/templates/i386/xor.asm b/pwnlib/shellcraft/templates/i386/xor.asm index 02d6e7d37..462b133fc 100644 --- a/pwnlib/shellcraft/templates/i386/xor.asm +++ b/pwnlib/shellcraft/templates/i386/xor.asm @@ -19,6 +19,7 @@ Args: the number of bytes to XOR. Example: + >>> sc = shellcraft.read(0, 'esp', 32) >>> sc += shellcraft.xor(0xdeadbeef, 'esp', 32) >>> sc += shellcraft.write(1, 'esp', 32) diff --git a/pwnlib/shellcraft/templates/thumb/linux/findpeer.asm b/pwnlib/shellcraft/templates/thumb/linux/findpeer.asm index 29a92de4c..3e76de02b 100644 --- a/pwnlib/shellcraft/templates/thumb/linux/findpeer.asm +++ b/pwnlib/shellcraft/templates/thumb/linux/findpeer.asm @@ -8,6 +8,7 @@ against the peer port. Resulting socket is left in r6. Example: + >>> enhex(asm(shellcraft.findpeer(1337))) '6ff00006ee4606f101064ff001074fea072707f11f07f54630461fb401a96a4601df0130efdd01994fea11414ff039024fea022202f105029142e4d1' diff --git a/pwnlib/shellcraft/templates/thumb/linux/listen.asm b/pwnlib/shellcraft/templates/thumb/linux/listen.asm index 40b2298cb..a040b5518 100644 --- a/pwnlib/shellcraft/templates/thumb/linux/listen.asm +++ b/pwnlib/shellcraft/templates/thumb/linux/listen.asm @@ -8,6 +8,7 @@ Port is the TCP port to listen on, network is either 'ipv4' or 'ipv6'. Example: + >>> enhex(asm(shellcraft.listen(1337, 'ipv4'))) '4ff001074fea072707f119074ff002004ff0010182ea020201df0646004901e00200053906b469464ff0100207f1010701df30464ff0010107f1020701df304681ea010182ea020207f1010701df0646' diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 3de8d8832..ec4b21a1f 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -340,6 +340,7 @@ def libc(self): automatically. Examples: + >>> s = ssh(host='example.pwnme') >>> p = s.process('true') >>> p.libc # doctest: +ELLIPSIS @@ -383,6 +384,7 @@ def getenv(self, variable, **kwargs): r"""Retrieve the address of an environment variable in the remote process. Examples: + >>> s = ssh(host='example.pwnme') >>> p = s.process(['python', '-c', 'import time; time.sleep(10)']) >>> hex(p.getenv('PATH')) # doctest: +ELLIPSIS @@ -751,6 +753,7 @@ def shell(self, shell = None, tty = True, timeout = Timeout.default): Return a :class:`pwnlib.tubes.ssh.ssh_channel` object. Examples: + >>> s = ssh(host='example.pwnme') >>> sh = s.shell('/bin/sh') >>> sh.sendline(b'echo Hello; exit') @@ -829,6 +832,7 @@ def process(self, argv=None, executable=None, tty=True, cwd=None, env=None, igno Requires Python on the remote server. Examples: + >>> s = ssh(host='example.pwnme') >>> sh = s.process('/bin/sh', env={'PS1':''}) >>> sh.sendline(b'echo Hello; exit') @@ -1007,12 +1011,14 @@ def which(self, program): if os.path.sep in program: return program - result = self.run('export PATH=$PATH:$PWD; command -v %s' % program).recvall().strip().decode() + program = packing._encode(program) - if ('/%s' % program) not in result: + result = self.system(b'export PATH=$PATH:$PWD; command -v ' + program).recvall().strip() + + if (b'/' + program) not in result: return None - return result + return packing._decode(result) def system(self, process, tty = True, cwd = None, env = None, timeout = None, raw = True, wd = None): r"""system(process, tty = True, cwd = None, env = None, timeout = Timeout.default, raw = True) -> ssh_channel @@ -1026,6 +1032,7 @@ def system(self, process, tty = True, cwd = None, env = None, timeout = None, ra Return a :class:`pwnlib.tubes.ssh.ssh_channel` object. Examples: + >>> s = ssh(host='example.pwnme') >>> py = s.system('python3 -i') >>> _ = py.recvuntil(b'>>> ') @@ -1095,6 +1102,7 @@ def run_to_end(self, process, tty = False, cwd = None, env = None, wd = None): a TTY on the remote server. Examples: + >>> s = ssh(host='example.pwnme') >>> print(s.run_to_end('echo Hello; exit 17')) (b'Hello\n', 17) @@ -1121,6 +1129,7 @@ def connect_remote(self, host, port, timeout = Timeout.default): Returns a :class:`pwnlib.tubes.ssh.ssh_connecter` object. Examples: + >>> from pwn import * >>> l = listen() >>> s = ssh(host='example.pwnme') @@ -1368,6 +1377,7 @@ def download_data(self, remote, fingerprint=True): Examples: + >>> with open('/tmp/bar','w+') as f: ... _ = f.write('Hello, world') >>> s = ssh(host='example.pwnme', @@ -1395,6 +1405,7 @@ def download_file(self, remote, local = None): local(str): The local filename to save it to. Default is to infer it from the remote filename. Examples: + >>> with open('/tmp/foobar','w+') as f: ... _ = f.write('Hello, world') >>> s = ssh(host='example.pwnme', @@ -1472,6 +1483,7 @@ def upload_data(self, data, remote): remote(str): The filename to upload it to. Example: + >>> s = ssh(host='example.pwnme') >>> s.upload_data(b'Hello, world', '/tmp/upload_foo') >>> print(open('/tmp/upload_foo').read()) @@ -1594,6 +1606,7 @@ def download(self, file_or_directory, local=None): Examples: + >>> with open('/tmp/foobar','w+') as f: ... _ = f.write('Hello, world') >>> s = ssh(host='example.pwnme', @@ -1734,6 +1747,7 @@ def set_working_directory(self, wd = None, symlink = False): that all files in the "old" working directory should be symlinked. Examples: + >>> s = ssh(host='example.pwnme') >>> cwd = s.set_working_directory() >>> s.ls() diff --git a/pwnlib/ui.py b/pwnlib/ui.py index bb80b524e..95f89ad27 100644 --- a/pwnlib/ui.py +++ b/pwnlib/ui.py @@ -9,7 +9,6 @@ import subprocess import sys import time -import types from pwnlib import term from pwnlib.log import getLogger @@ -61,6 +60,7 @@ def yesno(prompt, default=None): `True` if the answer was "yes", `False` if "no" Examples: + >>> yesno("A number:", 20) Traceback (most recent call last): ... @@ -79,6 +79,7 @@ def yesno(prompt, default=None): [?] is it good 3 [yes/No] False Tests: + >>> p = testpwnproc("print(yesno('is it ok??'))") >>> b"is it ok" in p.recvuntil(b"??") True @@ -140,12 +141,14 @@ def options(prompt, opts, default = None): The users choice in the form of an integer. Examples: + >>> options("Select a color", ("red", "green", "blue"), "green") Traceback (most recent call last): ... ValueError: options(): default must be a number or None Tests: + >>> p = testpwnproc("print(options('select a color', ('red', 'green', 'blue')))") >>> p.sendline(b"\33[C\33[A\33[A\33[B\33[1;5A\33[1;5B 0310") >>> _ = p.recvall() @@ -256,6 +259,7 @@ def pause(n=None): r"""Waits for either user input or a specific number of seconds. Examples: + >>> with context.local(log_level="INFO"): ... pause(1) [x] Waiting @@ -267,6 +271,7 @@ def pause(n=None): ValueError: pause(): n must be a number or None Tests: + >>> saved_stdin = sys.stdin >>> try: ... sys.stdin = io.TextIOWrapper(io.BytesIO(b"\n")) @@ -311,7 +316,8 @@ def more(text): Returns: :const:`None` - Tests: + Tests: + >>> more("text") text >>> p = testpwnproc("more('text\\n' * (term.height + 2))") diff --git a/pwnlib/useragents.py b/pwnlib/useragents.py index ad93fdc86..d8c12f713 100644 --- a/pwnlib/useragents.py +++ b/pwnlib/useragents.py @@ -34,6 +34,7 @@ def getall(): A set of user agent strings. Examples: + >>> 'libcurl-agent/1.0' in getall() True >>> 'wget' in getall() diff --git a/pwnlib/util/crc/__init__.py b/pwnlib/util/crc/__init__.py index 56877e698..f4271b23f 100644 --- a/pwnlib/util/crc/__init__.py +++ b/pwnlib/util/crc/__init__.py @@ -12,6 +12,7 @@ An obvious optimization would be to actually generate some lookup-tables. This doctest is to ensure that the known data are accurate: + >>> known = sys.modules['pwnlib.util.crc.known'] >>> known.all_crcs == known.generate() True @@ -338,6 +339,7 @@ def inner(data): data(str): The data to checksum. Example: + >>> print(%s(b'123456789')) %d """ % (name, name, polynom, width, init, refin, refout, xorout, extra_doc, name, check) @@ -354,6 +356,7 @@ def cksum(data): data(str): The data to checksum. Example: + >>> print(cksum(b'123456789')) 930766865 """ @@ -371,6 +374,7 @@ def find_crc_function(data, checksum): data(str): Data for which the checksum is known. Example: + >>> find_crc_function(b'test', 46197) [] """ diff --git a/pwnlib/util/cyclic.py b/pwnlib/util/cyclic.py index 2fb8cd4ad..316b70ec5 100644 --- a/pwnlib/util/cyclic.py +++ b/pwnlib/util/cyclic.py @@ -298,6 +298,7 @@ def cyclic_metasploit(length = None, sets = None): sets: List of strings to generate the sequence over. Example: + >>> cyclic_metasploit(32) b'Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab' >>> cyclic_metasploit(sets = [b"AB",b"ab",b"12"]) diff --git a/pwnlib/util/fiddling.py b/pwnlib/util/fiddling.py index 92e8ddc87..2b7ec7296 100644 --- a/pwnlib/util/fiddling.py +++ b/pwnlib/util/fiddling.py @@ -193,6 +193,7 @@ def unbits(s, endian = 'big'): A string of the decoded bits. Example: + >>> unbits([1]) b'\\x80' >>> unbits([1], endian = 'little') @@ -233,6 +234,7 @@ def bitswap(s): Reverses the bits in every byte of a given string. Example: + >>> bitswap(b"1234") b'\\x8cL\\xcc,' """ @@ -254,6 +256,7 @@ def bitswap_int(n, width): width (int): The width of the integer Examples: + >>> hex(bitswap_int(0x1234, 8)) '0x2c' >>> hex(bitswap_int(0x1234, 16)) diff --git a/pwnlib/util/iters.py b/pwnlib/util/iters.py index b2b073251..d037fe921 100644 --- a/pwnlib/util/iters.py +++ b/pwnlib/util/iters.py @@ -84,6 +84,7 @@ def take(n, iterable): `n` elements in `iterable` they will all be returned. Examples: + >>> take(2, range(10)) [0, 1] >>> i = count() @@ -107,6 +108,7 @@ def tabulate(func, start = 0): An iterator with the elements ``func(start), func(start + 1), ...``. Examples: + >>> take(2, tabulate(str)) ['0', '1'] >>> take(5, tabulate(lambda x: x**2, start = 1)) @@ -128,6 +130,7 @@ def consume(n, iterator): :const:`None`. Examples: + >>> i = count() >>> consume(5, i) >>> next(i) @@ -168,6 +171,7 @@ def nth(n, iterable, default = None): few elements. Examples: + >>> nth(2, [0, 1, 2, 3]) 2 >>> nth(2, [0, 1], 42) @@ -195,6 +199,7 @@ def quantify(iterable, pred = bool): :const:`True`. Examples: + >>> quantify([1, 2, 3, 4], lambda x: x % 2 == 0) 2 >>> quantify(['1', 'two', '3', '42'], str.isdigit) @@ -217,6 +222,7 @@ def pad(iterable, value = None): `value` indefinitely. Examples: + >>> take(3, pad([1, 2])) [1, 2, None] >>> i = pad(iter([1, 2, 3]), 42) @@ -243,6 +249,7 @@ def cyclen(n, iterable): times. Examples: + >>> take(4, cyclen(2, [1, 2])) [1, 2, 1, 2] >>> list(cyclen(10, [])) @@ -263,6 +270,7 @@ def dotproduct(x, y): The dot product of `x` and `y`, i.e.: ``x[0] * y[0] + x[1] * y[1] + ...``. Example: + >>> dotproduct([1, 2, 3], [4, 5, 6]) ... # 1 * 4 + 2 * 5 + 3 * 6 == 32 32 @@ -284,6 +292,7 @@ def flatten(xss): `xss`. Examples: + >>> list(flatten([[1, 2], [3, 4]])) [1, 2, 3, 4] >>> take(6, flatten([[43, 42], [41, 40], count()])) @@ -309,6 +318,7 @@ def repeat_func(func, *args, **kwargs): **kwargs)`` repeatedly. Examples: + >>> def f(x): ... x[0] += 1 ... return x[0] @@ -346,6 +356,7 @@ def pairwise(iterable): `iterable`. Examples: + >>> list(pairwise([1, 2, 3, 4])) [(1, 2), (2, 3), (3, 4)] >>> i = starmap(operator.add, pairwise(count())) @@ -372,6 +383,7 @@ def group(n, iterable, fill_value = None): An iterator whoose elements are `n`-tuples of the elements of `iterable`. Examples: + >>> list(group(2, range(5))) [(0, 1), (2, 3), (4, None)] >>> take(3, group(2, count())) @@ -395,6 +407,7 @@ def roundrobin(*iterables): fashion. Examples: + >>> ''.join(roundrobin('ABC', 'D', 'EF')) 'ADEBFC' >>> ''.join(take(10, roundrobin('ABC', 'DE', repeat('x')))) @@ -424,6 +437,7 @@ def powerset(iterable, include_empty = True): The powerset of `iterable` as an interator of tuples. Examples: + >>> list(powerset(range(3))) [(), (0,), (1,), (2,), (0, 1), (0, 2), (1, 2), (0, 1, 2)] >>> list(powerset(range(2), include_empty = False)) @@ -452,6 +466,7 @@ def unique_everseen(iterable, key = None): An iterator of the unique elements in `iterable`. Examples: + >>> ''.join(unique_everseen('AAAABBBCCDAABBB')) 'ABCD' >>> ''.join(unique_everseen('ABBCcAD', str.lower)) @@ -487,6 +502,7 @@ def unique_justseen(iterable, key = None): An iterator of the unique elements in `iterable`. Examples: + >>> ''.join(unique_justseen('AAAABBBCCDAABBB')) 'ABCDAB' >>> ''.join(unique_justseen('ABBCcAD', str.lower)) @@ -512,6 +528,7 @@ def unique_window(iterable, window, key = None): An iterator of the unique elements in `iterable`. Examples: + >>> ''.join(unique_window('AAAABBBCCDAABBB', 6)) 'ABCDA' >>> ''.join(unique_window('ABBCcAD', 5, str.lower)) @@ -550,6 +567,7 @@ def iter_except(func, exception): exception matching `exception` is raised. Examples: + >>> s = {1, 2, 3} >>> i = iter_except(s.pop, KeyError) >>> next(i) @@ -580,6 +598,7 @@ def random_product(*args, **kwargs): A random element from ``itertools.product(*args, repeat = repeat)``. Examples: + >>> args = (range(2), range(2)) >>> random_product(*args) in {(0, 0), (0, 1), (1, 0), (1, 1)} True @@ -607,6 +626,7 @@ def random_permutation(iterable, r = None): A random element from ``itertools.permutations(iterable, r = r)``. Examples: + >>> random_permutation(range(2)) in {(0, 1), (1, 0)} True >>> random_permutation(range(10), r = 2) in permutations(range(10), r = 2) @@ -627,6 +647,7 @@ def random_combination(iterable, r): A random element from ``itertools.combinations(iterable, r = r)``. Examples: + >>> random_combination(range(2), 2) (0, 1) >>> random_combination(range(10), r = 2) in combinations(range(10), r = 2) @@ -649,6 +670,7 @@ def random_combination_with_replacement(iterable, r): r = r)``. Examples: + >>> cs = {(0, 0), (0, 1), (1, 1)} >>> random_combination_with_replacement(range(2), 2) in cs True @@ -675,6 +697,7 @@ def lookahead(n, iterable): The element in `iterable` at index `n`. Examples: + >>> i = count() >>> lookahead(4, i) 4 @@ -706,6 +729,7 @@ def lexicographic(alphabet): order. Example: + >>> take(8, map(lambda x: ''.join(x), lexicographic('01'))) ['', '0', '1', '00', '01', '10', '11', '000'] """ @@ -726,6 +750,7 @@ def chained(func): values from ``func(*args, **kwargs)``. Example: + >>> @chained ... def g(): ... for x in count(): @@ -771,6 +796,7 @@ def bruteforce(func, alphabet, length, method = 'upto', start = None, databag = if the search space was exhausted. Example: + >>> bruteforce(lambda x: x == 'yes', string.ascii_lowercase, length=5) 'yes' """ @@ -861,6 +887,7 @@ def mbruteforce(func, alphabet, length, method = 'upto', start = None, threads = threads: Amount of threads to spawn, default is the amount of cores. Example: + >>> mbruteforce(lambda x: x == 'hello', string.ascii_lowercase, length = 10) 'hello' >>> mbruteforce(lambda x: x == 'hello', 'hlo', 5, 'downfrom') is None diff --git a/pwnlib/util/lists.py b/pwnlib/util/lists.py index 36355224d..4d200f8e7 100644 --- a/pwnlib/util/lists.py +++ b/pwnlib/util/lists.py @@ -22,6 +22,7 @@ def partition(lst, f, save_keys = False): returned instead of just the values Example: + >>> partition([1,2,3,4,5], lambda x: x&1) [[1, 3, 5], [2, 4]] >>> partition([1,2,3,4,5], lambda x: x%3, save_keys=True) @@ -55,6 +56,7 @@ def group(n, lst, underfull_action = 'ignore', fill_value = None): A list containing the grouped values. Example: + >>> group(3, "ABCDEFG") ['ABC', 'DEF', 'G'] >>> group(3, 'ABCDEFG', 'drop') @@ -119,6 +121,7 @@ def concat_all(*args): Concats all the arguments together. Example: + >>> concat_all(0, [1, (2, 3)], [([[4, 5, 6]])]) [0, 1, 2, 3, 4, 5, 6] """ @@ -139,6 +142,7 @@ def ordlist(s): Turns a string into a list of the corresponding ascii values. Example: + >>> ordlist("hello") [104, 101, 108, 108, 111] """ @@ -150,6 +154,7 @@ def unordlist(cs): Takes a list of ascii values and returns the corresponding string. Example: + >>> unordlist([104, 101, 108, 108, 111]) 'hello' """ @@ -162,6 +167,7 @@ def findall(haystack, needle): Knuth-Morris-Pratt algorithm. Example: + >>> foo = findall([1,2,3,4,4,3,4,2,1], 4) >>> next(foo) 3 diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index fbd01b951..d1622154e 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -30,6 +30,7 @@ def align(alignment, x): Rounds `x` up to nearest multiple of the `alignment`. Example: + >>> [align(5, n) for n in range(15)] [0, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 15, 15, 15, 15] """ @@ -42,6 +43,7 @@ def align_down(alignment, x): Rounds `x` down to nearest multiple of the `alignment`. Example: + >>> [align_down(5, n) for n in range(15)] [0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10] """ @@ -54,6 +56,7 @@ def binary_ip(host): Resolve host and return IP as four byte string. Example: + >>> binary_ip("127.0.0.1") b'\\x7f\\x00\\x00\\x01' """ @@ -71,6 +74,7 @@ def size(n, abbrev = 'B', si = False): abbrev(str): String appended to the size, defaults to ``'B'``. Example: + >>> size(451) '451B' >>> size(1000) @@ -116,6 +120,7 @@ def read(path, count=-1, skip=0): Open file, return content. Examples: + >>> read('/proc/self/exe')[:4] b'\x7fELF' """ @@ -481,6 +486,7 @@ def parse_ldd_output(output): output(str): The output to parse Example: + >>> sorted(parse_ldd_output(''' ... linux-vdso.so.1 => (0x00007fffbf5fe000) ... libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fe28117f000) @@ -545,6 +551,7 @@ def register_sizes(regs, in_sizes): Used in i386/AMD64 shellcode, e.g. the mov-shellcode. Example: + >>> regs = [['eax', 'ax', 'al', 'ah'],['ebx', 'bx', 'bl', 'bh'], ... ['ecx', 'cx', 'cl', 'ch'], ... ['edx', 'dx', 'dl', 'dh'], diff --git a/pwnlib/util/net.py b/pwnlib/util/net.py index fcb0a44a8..fab1dacbb 100644 --- a/pwnlib/util/net.py +++ b/pwnlib/util/net.py @@ -166,6 +166,7 @@ def interfaces4(all = False): IPv4 addresses. Examples: + >>> interfaces4(all=True) # doctest: +ELLIPSIS {...'127.0.0.1'...} """ @@ -191,6 +192,7 @@ def interfaces6(all = False): IPv6 addresses. Examples: + >>> interfaces6() # doctest: +ELLIPSIS {...'::1'...} """ diff --git a/pwnlib/util/packing.py b/pwnlib/util/packing.py index 83209e088..3503bd937 100644 --- a/pwnlib/util/packing.py +++ b/pwnlib/util/packing.py @@ -76,6 +76,7 @@ def pack(number, word_size = None, endianness = None, sign = None, **kwargs): The packed number as a string. Examples: + >>> pack(0x414243, 24, 'big', True) b'ABC' >>> pack(0x414243, 24, 'little', True) @@ -189,6 +190,7 @@ def unpack(data, word_size = None): The unpacked number. Examples: + >>> hex(unpack(b'\xaa\x55', 16, endian='little', sign=False)) '0x55aa' >>> hex(unpack(b'\xaa\x55', 16, endian='big', sign=False)) @@ -256,6 +258,7 @@ def unpack_many(data, word_size = None): The unpacked numbers. Examples: + >>> list(map(hex, unpack_many(b'\\xaa\\x55\\xcc\\x33', 16, endian='little', sign=False))) ['0x55aa', '0x33cc'] >>> list(map(hex, unpack_many(b'\\xaa\\x55\\xcc\\x33', 16, endian='big', sign=False))) @@ -510,6 +513,7 @@ def make_packer(word_size = None, sign = None, **kwargs): of that number in a packed form. Examples: + >>> p = make_packer(32, endian='little', sign='unsigned') >>> p @@ -573,6 +577,7 @@ def make_unpacker(word_size = None, endianness = None, sign = None, **kwargs): of that string in an unpacked form. Examples: + >>> u = make_unpacker(32, endian='little', sign='unsigned') >>> u @@ -978,6 +983,7 @@ def dd(dst, src, count = 0, skip = 0, seek = 0, truncate = False): modified in-place. Examples: + >>> dd(tuple('Hello!'), b'?', skip = 5) ('H', 'e', 'l', 'l', 'o', b'?') >>> dd(list('Hello!'), (63,), skip = 5) diff --git a/pwnlib/util/proc.py b/pwnlib/util/proc.py index 9de9ac59e..0bcaca4d8 100644 --- a/pwnlib/util/proc.py +++ b/pwnlib/util/proc.py @@ -34,6 +34,7 @@ def pidof(target): A list of found PIDs. Example: + >>> l = tubes.listen.listen() >>> p = process(['curl', '-s', 'http://127.0.0.1:%d'%l.lport]) >>> pidof(p) == pidof(l) == pidof(('127.0.0.1', l.lport)) @@ -68,6 +69,7 @@ def pid_by_name(name): List of PIDs matching `name` sorted by lifetime, youngest to oldest. Example: + >>> os.getpid() in pid_by_name(name(os.getpid())) True """ @@ -99,6 +101,7 @@ def name(pid): Name of process as listed in ``/proc//status``. Example: + >>> p = process('cat') >>> name(p.pid) 'cat' @@ -141,6 +144,7 @@ def ancestors(pid): List of PIDs of whose parent process is `pid` or an ancestor of `pid`. Example: + >>> ancestors(os.getpid()) # doctest: +ELLIPSIS [..., 1] """ @@ -160,6 +164,7 @@ def descendants(pid): Dictionary mapping the PID of each child of `pid` to it's descendants. Example: + >>> d = descendants(os.getppid()) >>> os.getpid() in d.keys() True @@ -187,6 +192,7 @@ def exe(pid): The path of the binary of the process. I.e. what ``/proc//exe`` points to. Example: + >>> exe(os.getpid()) == os.path.realpath(sys.executable) True """ @@ -203,6 +209,7 @@ def cwd(pid): ``/proc//cwd`` points to. Example: + >>> cwd(os.getpid()) == os.getcwd() True """ @@ -218,6 +225,7 @@ def cmdline(pid): A list of the fields in ``/proc//cmdline``. Example: + >>> 'py' in ''.join(cmdline(os.getpid())) True """ @@ -233,6 +241,7 @@ def memory_maps(pid): A list of the memory mappings in the process. Example: + >>> maps = memory_maps(os.getpid()) >>> [(m.path, m.perms) for m in maps if '[stack]' in m.path] [('[stack]', 'rw-p')] @@ -250,6 +259,7 @@ def stat(pid): A list of the values in ``/proc//stat``, with the exception that ``(`` and ``)`` has been removed from around the process name. Example: + >>> stat(os.getpid())[2] 'R' """ @@ -271,6 +281,7 @@ def starttime(pid): The time (in seconds) the process started after system boot Example: + >>> starttime(os.getppid()) <= starttime(os.getpid()) True """ @@ -314,6 +325,7 @@ def tracer(pid): PID of the process tracing `pid`, or None if no `pid` is not being traced. Example: + >>> tracer(os.getpid()) is None True """ @@ -330,6 +342,7 @@ def state(pid): State of the process as listed in ``/proc//status``. See `proc(5)` for details. Example: + >>> state(os.getpid()) 'R (running)' """ From f046fdd93e154bd892332f38cfbb518de130f1f2 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 22 Feb 2024 22:15:10 +0100 Subject: [PATCH 083/107] Release 4.12.0 --- CHANGELOG.md | 78 +++++++++++++++++++++++++++++++++++++++-------- pwnlib/version.py | 2 +- setup.py | 2 +- 3 files changed, 67 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 538685394..c62a27b99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ The table below shows which release corresponds to each branch, and what date th | Version | Branch | Release Date | | ---------------- | -------- | ---------------------- | -| [4.13.0](#4130-dev) | `dev` | -| [4.12.0](#4120-beta) | `beta` | -| [4.11.1](#4111-stable) | `stable` | Nov 14, 2023 +| [4.14.0](#4140-dev) | `dev` | +| [4.13.0](#4130-beta) | `beta` | +| [4.12.0](#4120-stable) | `stable` | Feb 22, 2024 +| [4.11.1](#4111) | | Nov 14, 2023 | [4.11.0](#4110) | | Sep 15, 2023 | [4.10.0](#4100) | | May 21, 2023 | [4.9.0](#490) | | Dec 29, 2022 @@ -68,13 +69,67 @@ The table below shows which release corresponds to each branch, and what date th | [3.0.0](#300) | | Aug 20, 2016 | [2.2.0](#220) | | Jan 5, 2015 -## 4.13.0 (`dev`) +## 4.14.0 (`dev`) -- [#2281][2281] FIX: Getting right amount of data for search fix -[2281]: https://github.com/Gallopsled/pwntools/pull/2281 +## 4.13.0 (`beta`) -## 4.12.0 (`beta`) +- [#2242][2242] Term module revamp: activating special handling of terminal only when necessary +- [#2277][2277] elf: Resolve more relocations into GOT entries +- [#2281][2281] FIX: Getting right amount of data for search fix +- [#2293][2293] Add x86 CET status to checksec output +- [#1763][1763] Allow to add to the existing environment in `process` instead of replacing it +- [#2307][2307] Fix `pwn libcdb file` crashing if "/bin/sh" string was not found +- [#2309][2309] Detect challenge binary and libc in `pwn template` +- [#2308][2308] Fix WinExec shellcraft to make sure it's 16 byte aligned +- [#2279][2279] Make `pwn template` always set context.binary +- [#2310][2310] Add support to start a process on Windows +- [#2335][2335] Add lookup optimizations in DynELF +- [#2334][2334] Speed up disasm commandline tool with colored output +- [#2328][2328] Lookup using $PATHEXT file extensions in `which` on Windows +- [#2189][2189] Explicitly define p64/u64 functions for IDE support +- [#2339][2339] Fix: Allow setting attributes on gdb Breakpoints +- [#2323][2323] Retry failed lookups after one week in libcdb +- [#2325][2325] Match against local system libc first in libcdb +- [#2336][2336] Add `ELF.stripped` and `ELF.debuginfo` properties +- [#2161][2161] Add basic support for darwin shellcraft/asm/disasm/run_shellcode/run_assembly +- [#2161][2161] Fix freebsd amd64 SyscallABI +- [#2160][2161] Fix invalid shellcraft.mov on arm64 +- [#2284][2161] Fix invalid shellcraft.pushstr_array on arm64 +- [#2345][2345] Fix pwn constgrep when it matches a non-constant type +- [#2338][2338] Fix: follow symlink for libs on ssh connection +- [#2341][2341] Launch GDB correctly in iTerm on Mac +- [#2268][2268] Add a `flatten` argument to `ssh.libs` +- [#2347][2347] Fix/workaround Unicorn Engine 1GB limit that calls exit() +- [#2233][2233] Fix gdb.debug: exe parameter now respected, allow empty argv + +[2242]: https://github.com/Gallopsled/pwntools/pull/2242 +[2277]: https://github.com/Gallopsled/pwntools/pull/2277 +[2281]: https://github.com/Gallopsled/pwntools/pull/2281 +[2293]: https://github.com/Gallopsled/pwntools/pull/2293 +[1763]: https://github.com/Gallopsled/pwntools/pull/1763 +[2307]: https://github.com/Gallopsled/pwntools/pull/2307 +[2309]: https://github.com/Gallopsled/pwntools/pull/2309 +[2308]: https://github.com/Gallopsled/pwntools/pull/2308 +[2279]: https://github.com/Gallopsled/pwntools/pull/2279 +[2310]: https://github.com/Gallopsled/pwntools/pull/2310 +[2335]: https://github.com/Gallopsled/pwntools/pull/2335 +[2334]: https://github.com/Gallopsled/pwntools/pull/2334 +[2328]: https://github.com/Gallopsled/pwntools/pull/2328 +[2189]: https://github.com/Gallopsled/pwntools/pull/2189 +[2339]: https://github.com/Gallopsled/pwntools/pull/2339 +[2323]: https://github.com/Gallopsled/pwntools/pull/2323 +[2325]: https://github.com/Gallopsled/pwntools/pull/2325 +[2336]: https://github.com/Gallopsled/pwntools/pull/2336 +[2161]: https://github.com/Gallopsled/pwntools/pull/2161 +[2345]: https://github.com/Gallopsled/pwntools/pull/2345 +[2338]: https://github.com/Gallopsled/pwntools/pull/2338 +[2341]: https://github.com/Gallopsled/pwntools/pull/2341 +[2268]: https://github.com/Gallopsled/pwntools/pull/2268 +[2347]: https://github.com/Gallopsled/pwntools/pull/2347 +[2233]: https://github.com/Gallopsled/pwntools/pull/2233 + +## 4.12.0 (`stable`) - [#2202][2202] Fix `remote` and `listen` in sagemath - [#2117][2117] Add -p (--prefix) and -s (--separator) arguments to `hex` command @@ -83,6 +138,8 @@ The table below shows which release corresponds to each branch, and what date th - [#2212][2212] Add `--libc libc.so` argument to `pwn template` command - [#2257][2257] Allow creation of custom templates for `pwn template` command - [#2225][2225] Allow empty argv in ssh.process() +- [#2349][2349] Fix term.readline omitting a trailing \n +- [#2352][2352] add `RETURN_CONST` as an allowed `_const_code` in safeeval [2202]: https://github.com/Gallopsled/pwntools/pull/2202 [2117]: https://github.com/Gallopsled/pwntools/pull/2117 @@ -91,15 +148,10 @@ The table below shows which release corresponds to each branch, and what date th [2212]: https://github.com/Gallopsled/pwntools/pull/2212 [2257]: https://github.com/Gallopsled/pwntools/pull/2257 [2225]: https://github.com/Gallopsled/pwntools/pull/2225 - -## 4.11.2 -- [#2349][2349] Fix term.readline omitting a trailing \n -- [#2352][2352] add `RETURN_CONST` as an allowed `_const_code` in safeeval - [2349]: https://github.com/Gallopsled/pwntools/pull/2349 [2352]: https://github.com/Gallopsled/pwntools/pull/2352 -## 4.11.1 (`stable`) +## 4.11.1 - [#2271][2271] FIX: Generated shebang with path to python invalid if path contains spaces - [#2272][2272] Fix `tube.clean_and_log` not logging buffered data diff --git a/pwnlib/version.py b/pwnlib/version.py index 7cbf3fdc1..e8de3f408 100644 --- a/pwnlib/version.py +++ b/pwnlib/version.py @@ -1 +1 @@ -__version__ = '4.12.0beta1' +__version__ = '4.12.0' diff --git a/setup.py b/setup.py index 79999e864..88ce6c250 100755 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ sys.exit(-1) setup( - version = '4.12.0beta1', + version = '4.12.0', data_files = [('pwntools-doc', glob.glob('*.md') + glob.glob('*.txt')), ], From c983f1c232b9d1ff12c3ca602b18b5640b4a4e77 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 22 Feb 2024 22:43:33 +0100 Subject: [PATCH 084/107] Release 4.13.0beta0 --- CHANGELOG.md | 26 ++++++++++++++------------ pwnlib/version.py | 2 +- setup.py | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50cc93746..5187d79da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ The table below shows which release corresponds to each branch, and what date th | Version | Branch | Release Date | | ---------------- | -------- | ---------------------- | -| [4.13.0](#4130-dev) | `dev` | -| [4.12.0](#4120-beta) | `beta` | -| [4.11.1](#4111-stable) | `stable` | Nov 14, 2023 +| [4.14.0](#4140-dev) | `dev` | +| [4.13.0](#4130-beta) | `beta` | +| [4.12.0](#4120-stable) | `stable` | Feb 22, 2024 +| [4.11.1](#4111) | | Nov 14, 2023 | [4.11.0](#4110) | | Sep 15, 2023 | [4.10.0](#4100) | | May 21, 2023 | [4.9.0](#490) | | Dec 29, 2022 @@ -68,7 +69,11 @@ The table below shows which release corresponds to each branch, and what date th | [3.0.0](#300) | | Aug 20, 2016 | [2.2.0](#220) | | Jan 5, 2015 -## 4.13.0 (`dev`) +## 4.14.0 (`dev`) + + + +## 4.13.0 (`beta`) - [#2242][2242] Term module revamp: activating special handling of terminal only when necessary - [#2277][2277] elf: Resolve more relocations into GOT entries @@ -125,7 +130,7 @@ The table below shows which release corresponds to each branch, and what date th [2347]: https://github.com/Gallopsled/pwntools/pull/2347 [2233]: https://github.com/Gallopsled/pwntools/pull/2233 -## 4.12.0 (`beta`) +## 4.12.0 (`stable`) - [#2202][2202] Fix `remote` and `listen` in sagemath - [#2117][2117] Add -p (--prefix) and -s (--separator) arguments to `hex` command @@ -134,6 +139,8 @@ The table below shows which release corresponds to each branch, and what date th - [#2212][2212] Add `--libc libc.so` argument to `pwn template` command - [#2257][2257] Allow creation of custom templates for `pwn template` command - [#2225][2225] Allow empty argv in ssh.process() +- [#2349][2349] Fix term.readline omitting a trailing \n +- [#2352][2352] add `RETURN_CONST` as an allowed `_const_code` in safeeval [2202]: https://github.com/Gallopsled/pwntools/pull/2202 [2117]: https://github.com/Gallopsled/pwntools/pull/2117 @@ -142,15 +149,10 @@ The table below shows which release corresponds to each branch, and what date th [2212]: https://github.com/Gallopsled/pwntools/pull/2212 [2257]: https://github.com/Gallopsled/pwntools/pull/2257 [2225]: https://github.com/Gallopsled/pwntools/pull/2225 - -## 4.11.2 -- [#2349][2349] Fix term.readline omitting a trailing \n -- [#2352][2352] add `RETURN_CONST` as an allowed `_const_code` in safeeval - [2349]: https://github.com/Gallopsled/pwntools/pull/2349 [2352]: https://github.com/Gallopsled/pwntools/pull/2352 -## 4.11.1 (`stable`) +## 4.11.1 - [#2271][2271] FIX: Generated shebang with path to python invalid if path contains spaces - [#2272][2272] Fix `tube.clean_and_log` not logging buffered data @@ -1131,4 +1133,4 @@ are mentioned here. - Added a lots of shellcodes - Stuff we forgot - Lots of documentation fixes -- Lots of bugfixes \ No newline at end of file +- Lots of bugfixes diff --git a/pwnlib/version.py b/pwnlib/version.py index 94955abb8..2d93f4daf 100644 --- a/pwnlib/version.py +++ b/pwnlib/version.py @@ -1 +1 @@ -__version__ = '4.13.0dev' +__version__ = '4.13.0beta0' diff --git a/setup.py b/setup.py index 11ecba6db..d9f91917c 100755 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ sys.exit(-1) setup( - version = '4.13.0dev', + version = '4.13.0beta0', data_files = [('pwntools-doc', glob.glob('*.md') + glob.glob('*.txt')), ], From e1770a30456e903193bd8084419792e77ec9b48a Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 22 Feb 2024 22:49:41 +0100 Subject: [PATCH 085/107] Begin working on 4.14.0 --- pwnlib/version.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pwnlib/version.py b/pwnlib/version.py index 2d93f4daf..8e5051f7e 100644 --- a/pwnlib/version.py +++ b/pwnlib/version.py @@ -1 +1 @@ -__version__ = '4.13.0beta0' +__version__ = '4.14.0dev' diff --git a/setup.py b/setup.py index d9f91917c..7d57ff7c5 100755 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ sys.exit(-1) setup( - version = '4.13.0beta0', + version = '4.14.0dev', data_files = [('pwntools-doc', glob.glob('*.md') + glob.glob('*.txt')), ], From 000c31c15527601a7f4ff5f39d2688d362fe3a40 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sun, 25 Feb 2024 14:14:08 +0100 Subject: [PATCH 086/107] ci: Install rpyc from pip instead of apt The apt package appears outdated and incompatible with the latest version on pypi. >>> ValueError: invalid message type: 18 --- .github/workflows/ci.yml | 8 +++++++- pwnlib/gdb.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e0d5bda2..7cfe71039 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,13 @@ jobs: git fetch origin git log --oneline --graph -10 + - name: Install RPyC for gdb + run: | + # The version packaged in python3-rpyc is too old on Ubuntu 22.04 + sudo apt-get update && sudo apt-get install -y python3-pip gdb gdbserver + /usr/bin/python -m pip install rpyc + gdb --batch --quiet --nx --nh --ex 'py import rpyc; print(rpyc.version.version)' + - name: Cache for pip uses: actions/cache@v4 id: cache-pip @@ -62,7 +69,6 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \ ash bash-static dash ksh mksh zsh \ - python3-rpyc \ gdb gdbserver socat \ binutils-multiarch qemu-user-static \ binutils-aarch64-linux-gnu \ diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 730635ff4..33aac5810 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -526,6 +526,7 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io = gdb.debug(["grep", "local-libc.so", "/proc/self/maps"], gdbscript="continue", env={"LD_PRELOAD": "./local-libc.so"}) >>> io.recvline().split()[-1] # doctest: +ELLIPSIS b'.../local-libc.so' + >>> io.close() >>> os.remove("./local-libc.so") # cleanup @@ -555,6 +556,7 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io.gdb.continue_nowait() >>> io.recvline() b'foo\n' + >>> io.close() Using SSH: From 3b4b261b5aad685a4e1eecfd3e295c22cafe03fa Mon Sep 17 00:00:00 2001 From: Th3S <46804083+the-soloist@users.noreply.github.com> Date: Fri, 1 Mar 2024 20:01:09 +0800 Subject: [PATCH 087/107] Add local libc database provider for libcdb (#2356) * Add local libc database provider for libcdb * Remove unnecessary assert * Add docstring for local_libcdb * Suppress warning output while `context.libdb` sets default * Testing the local system's libc first * Set falsely `context.lcoal_libcdb` to turn off local libc-database integration * Fix docstring * Make path check in validator * Fix doctests * Add CHANGELOG --- CHANGELOG.md | 2 ++ pwnlib/args.py | 6 ++++++ pwnlib/context/__init__.py | 27 +++++++++++++++++++++++++++ pwnlib/libcdb.py | 19 ++++++++++++++++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5187d79da..e253c3cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,7 +71,9 @@ The table below shows which release corresponds to each branch, and what date th ## 4.14.0 (`dev`) +- [#2356][2356] Add local libc database provider for libcdb +[2356]: https://github.com/Gallopsled/pwntools/pull/2356 ## 4.13.0 (`beta`) diff --git a/pwnlib/args.py b/pwnlib/args.py index 6af4a34cd..f7985e7d6 100644 --- a/pwnlib/args.py +++ b/pwnlib/args.py @@ -159,6 +159,11 @@ def STDERR(v): """Sends logging to ``stderr`` by default, instead of ``stdout``""" context.log_console = sys.stderr +def LOCAL_LIBCDB(v): + """Sets path to local libc-database via ``context.local_libcdb``, e.g. + ``LOCAL_LIBCDB='/path/to/libc-databse'``""" + context.local_libcdb = v + hooks = { 'LOG_LEVEL': LOG_LEVEL, 'LOG_FILE': LOG_FILE, @@ -170,6 +175,7 @@ def STDERR(v): 'NOASLR': NOASLR, 'NOPTRACE': NOPTRACE, 'STDERR': STDERR, + 'LOCAL_LIBCDB': LOCAL_LIBCDB, } def initialize(): diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 6b3f636b7..9d6ebe71d 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -360,6 +360,7 @@ class ContextType(object): 'endian': 'little', 'gdbinit': "", 'kernel': None, + 'local_libcdb': "/var/lib/libc-database", 'log_level': logging.INFO, 'log_file': _devnull(), 'log_console': sys.stdout, @@ -1071,6 +1072,32 @@ def log_console(self, stream): stream = open(stream, 'wt') return stream + @_validator + def local_libcdb(self, path): + """ + Sets path to local libc-database, get more information for libc-database: + https://github.com/niklasb/libc-database + + Works in :attr:`pwnlib.libcdb` when searching by local database provider. + + The default value is ``/var/lib/libc-database``. + + Sets `context.local_libcdb` to empty string or `None` will turn off local libc-database integration. + + Examples: + + >>> context.local_libcdb = pwnlib.data.elf.path + >>> context.local_libcdb = 'foobar' + Traceback (most recent call last): + ... + AttributeError: 'foobar' does not exist, please download libc-database first + """ + + if not os.path.isdir(path): + raise AttributeError("'%s' does not exist, please download libc-database first" % path) + + return path + @property def mask(self): return (1 << self.bits) - 1 diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 885a0eea2..329ed187f 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -11,6 +11,7 @@ from pwnlib.context import context from pwnlib.elf import ELF +from pwnlib.filesystem.path import Path from pwnlib.log import getLogger from pwnlib.tubes.process import process from pwnlib.util.fiddling import enhex @@ -126,7 +127,23 @@ def provider_local_system(hex_encoded_id, hash_type): return local_libc.data return None -PROVIDERS = [provider_local_system, provider_libcdb, provider_libc_rip] +# Offline search https://github.com/niklasb/libc-database for hash type +def provider_local_database(hex_encoded_id, hash_type): + if not context.local_libcdb: + return None + + localdb = Path(context.local_libcdb) + if not localdb.is_dir(): + return None + + log.debug("Searching local libc database, %s: %s", hash_type, hex_encoded_id) + for libc_path in localdb.rglob("*.so"): + if hex_encoded_id == HASHES[hash_type](libc_path): + return read(libc_path) + + return None + +PROVIDERS = [provider_local_system, provider_local_database, provider_libcdb, provider_libc_rip] def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True): assert hash_type in HASHES, hash_type From 14c0d73f89d285717b3d976d5c2eba5965996ae9 Mon Sep 17 00:00:00 2001 From: Pratik Raj Date: Thu, 7 Mar 2024 18:08:36 +0530 Subject: [PATCH 088/107] feat : use --no-cache-dir flag to pip in dockerfiles to save space (#2357) using the "--no-cache-dir" flag in pip install, make sure downloaded packages by pip don't cache on the system. This is a best practice that makes sure to fetch from a repo instead of using a local cached one. Further, in the case of Docker Containers, by restricting caching, we can reduce image size. In terms of stats, it depends upon the number of python packages multiplied by their respective size. e.g for heavy packages with a lot of dependencies it reduces a lot by don't cache pip packages. Further, more detailed information can be found at https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6 Signed-off-by: Pratik Raj --- extra/docker/base/Dockerfile | 8 ++++---- extra/docker/beta/Dockerfile | 4 ++-- extra/docker/buster/Dockerfile | 2 +- extra/docker/stable/Dockerfile | 4 ++-- travis/docker/Dockerfile | 16 ++++++++-------- travis/docker/Dockerfile.travis | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/extra/docker/base/Dockerfile b/extra/docker/base/Dockerfile index 2755d1452..0d07c33f5 100644 --- a/extra/docker/base/Dockerfile +++ b/extra/docker/base/Dockerfile @@ -40,10 +40,10 @@ RUN apt-get update \ patchelf \ && locale-gen en_US.UTF-8 \ && update-locale LANG=en_US.UTF-8 \ - && PYTHONPATH=`echo /usr/share/python-wheels/pip-*.whl` python2.7 -m pip install --upgrade pip setuptools wheel \ - && python2.7 -m pip install --upgrade pwntools \ - && python3 -m pip install --upgrade pip \ - && python3 -m pip install --upgrade pwntools \ + && PYTHONPATH=`echo /usr/share/python-wheels/pip-*.whl` python2.7 -m pip install --no-cache-dir --upgrade pip setuptools wheel \ + && python2.7 -m pip install --no-cache-dir --upgrade pwntools \ + && python3 -m pip install --no-cache-dir --upgrade pip \ + && python3 -m pip install --no-cache-dir --upgrade pwntools \ && PWNLIB_NOTERM=1 pwn update \ && useradd -m pwntools \ && passwd --delete --unlock pwntools \ diff --git a/extra/docker/beta/Dockerfile b/extra/docker/beta/Dockerfile index 5a83dd6fc..a83bd0f4e 100644 --- a/extra/docker/beta/Dockerfile +++ b/extra/docker/beta/Dockerfile @@ -1,7 +1,7 @@ FROM pwntools/pwntools:stable USER root -RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@beta \ - && python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@beta +RUN python2.7 -m pip install --no-cache-dir --upgrade git+https://github.com/Gallopsled/pwntools@beta \ + && python3 -m pip install --no-cache-dir --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@beta RUN PWNLIB_NOTERM=1 pwn update USER pwntools diff --git a/extra/docker/buster/Dockerfile b/extra/docker/buster/Dockerfile index e2f3c0acf..33a9491d6 100644 --- a/extra/docker/buster/Dockerfile +++ b/extra/docker/buster/Dockerfile @@ -5,4 +5,4 @@ RUN apt-get -y dist-upgrade RUN apt-get -y install python3 python3-pip RUN apt-get -y install git wget unzip -RUN pip3 install --upgrade git+https://github.com/Gallopsled/pwntools@dev \ No newline at end of file +RUN pip3 install --no-cache-dir --upgrade git+https://github.com/Gallopsled/pwntools@dev \ No newline at end of file diff --git a/extra/docker/stable/Dockerfile b/extra/docker/stable/Dockerfile index 1535d4af1..aa241c1fb 100644 --- a/extra/docker/stable/Dockerfile +++ b/extra/docker/stable/Dockerfile @@ -1,7 +1,7 @@ FROM pwntools/pwntools:base USER root -RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@stable \ - && python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@stable +RUN python2.7 -m pip install --no-cache-dir --upgrade git+https://github.com/Gallopsled/pwntools@stable \ + && python3 -m pip install --no-cache-dir --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@stable RUN PWNLIB_NOTERM=1 pwn update USER pwntools diff --git a/travis/docker/Dockerfile b/travis/docker/Dockerfile index ccc22ab49..d04663cea 100644 --- a/travis/docker/Dockerfile +++ b/travis/docker/Dockerfile @@ -18,17 +18,17 @@ ENV PATH="/home/pwntools/.local/bin:${PATH}" # Install Pwntools to the home directory, make it an editable install RUN git clone https://github.com/Gallopsled/pwntools \ - && python2.7 -m pip install --upgrade --editable pwntools \ - && python3 -m pip install --upgrade --editable pwntools \ + && python2.7 -m pip install --no-cache-dir --upgrade --editable pwntools \ + && python3 -m pip install --no-cache-dir --upgrade --editable pwntools \ && PWNLIB_NOTERM=1 pwn version # Requirements for running the tests -RUN python2.7 -m pip install --upgrade --requirement pwntools/docs/requirements.txt \ - && python3 -m pip install --upgrade --requirement pwntools/docs/requirements.txt +RUN python2.7 -m pip install --no-cache-dir --upgrade --requirement pwntools/docs/requirements.txt \ + && python3 -m pip install --no-cache-dir --upgrade --requirement pwntools/docs/requirements.txt # Python niceties for debugging -RUN python2.7 -m pip install -U ipython ipdb \ - && python3 -m pip install -U ipython ipdb +RUN python2.7 -m pip install --no-cache-dir -U ipython ipdb \ + && python3 -m pip install --no-cache-dir -U ipython ipdb # Dependencies from .travis.yml addons -> apt -> packages ARG DEBIAN_FRONTEND=noninteractive @@ -86,8 +86,8 @@ ADD ipython_config.py /home/pwntools/.ipython/profile_default RUN echo "pwntools ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/travis # Some additional debugging tools that are useful -RUN python2.7 -m pip install ipdb && \ - python3 -m pip install ipdb +RUN python2.7 -m pip install --no-cache-dir ipdb && \ + python3 -m pip install --no-cache-dir ipdb # Install debugging utilities USER root diff --git a/travis/docker/Dockerfile.travis b/travis/docker/Dockerfile.travis index 9ab13721d..4346d8799 100644 --- a/travis/docker/Dockerfile.travis +++ b/travis/docker/Dockerfile.travis @@ -1,7 +1,7 @@ # Some additional debugging tools that are useful -RUN python2.7 -m pip install ipdb && \ - python3 -m pip install ipdb +RUN python2.7 -m pip install --no-cache-dir ipdb && \ + python3 -m pip install --no-cache-dir ipdb # Install debugging utilities USER root From a2acdf9bd9161d4102454d999182fba3417372fe Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Fri, 22 Mar 2024 20:32:57 +0100 Subject: [PATCH 089/107] Pin pyelftools<0.30 for Python 2 in docs/requirements.txt Docs only installs fail under python2 due to trying to install pyelftools>=0.30 which dropped py2 support. Fixes #2372 --- docs/requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index cca064106..9b9003604 100755 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,7 +8,8 @@ isort mako>=1.0.0 paramiko>=1.15.2 pip>=6.0.8 -pyelftools>=0.2.3 +pyelftools>=0.29, <0.30; python_version<'3' +pyelftools>=0.29; python_version>='3' pygments>=2.0 pypandoc pyserial>=2.7 From 75cc3c3d5cd1e4d03dee1cf31ba67dd8139b941c Mon Sep 17 00:00:00 2001 From: Swastik Sarkar <40518186+sswastik02@users.noreply.github.com> Date: Sun, 24 Mar 2024 17:49:31 +0530 Subject: [PATCH 090/107] libcdb.unstrip_libc: debug symbols are fetched only if not present (#2374) * libcdb.unstrip_libc: debug symbols are fetched only if not present * Usage of `ELF.debuginfo` to check if debug symbols exist closes #2324 --------- Signed-off-by: sswastik02 <40518186+sswastik02@users.noreply.github.com> * Add CHANGELOG Signed-off-by: sswastik02 <40518186+sswastik02@users.noreply.github.com> --------- Signed-off-by: sswastik02 <40518186+sswastik02@users.noreply.github.com> --- CHANGELOG.md | 2 ++ pwnlib/libcdb.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e253c3cf3..2bd84bd4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,8 +72,10 @@ The table below shows which release corresponds to each branch, and what date th ## 4.14.0 (`dev`) - [#2356][2356] Add local libc database provider for libcdb +- [#2374][2374] libcdb.unstrip_libc: debug symbols are fetched only if not present [2356]: https://github.com/Gallopsled/pwntools/pull/2356 +[2374]: https://github.com/Gallopsled/pwntools/pull/2374 ## 4.13.0 (`beta`) diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 329ed187f..0902c40d6 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -291,6 +291,10 @@ def unstrip_libc(filename): log.warn_once('Given libc does not have a buildid. Cannot look for debuginfo to unstrip.') return False + if libc.debuginfo: + log.debug('Given libc already contains debug information. Skipping unstrip.') + return True + log.debug('Trying debuginfod servers: %r', DEBUGINFOD_SERVERS) for server_url in DEBUGINFOD_SERVERS: From 4ac98cd11ac252165e019ba8795cf2fd9afa5750 Mon Sep 17 00:00:00 2001 From: Th3S <46804083+the-soloist@users.noreply.github.com> Date: Fri, 29 Mar 2024 22:27:38 +0800 Subject: [PATCH 091/107] Add offline parameter for `libcdb.search_by_hash` series function (#2360) * Add offline parameter * Add CHANGELOG * Rename `offline` to `offline_only` --- CHANGELOG.md | 2 ++ pwnlib/libcdb.py | 46 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bd84bd4c..64feee6fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,9 +71,11 @@ The table below shows which release corresponds to each branch, and what date th ## 4.14.0 (`dev`) +- [#2360][2360] Add offline parameter for `search_by_hash` series function - [#2356][2356] Add local libc database provider for libcdb - [#2374][2374] libcdb.unstrip_libc: debug symbols are fetched only if not present +[2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 [2374]: https://github.com/Gallopsled/pwntools/pull/2374 diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 0902c40d6..8e2548acd 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -143,9 +143,12 @@ def provider_local_database(hex_encoded_id, hash_type): return None -PROVIDERS = [provider_local_system, provider_local_database, provider_libcdb, provider_libc_rip] +PROVIDERS = { + "offline": [provider_local_system, provider_local_database], + "online": [provider_libcdb, provider_libc_rip] +} -def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True): +def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline_only=False): assert hash_type in HASHES, hash_type # Ensure that the libcdb cache directory exists @@ -157,8 +160,12 @@ def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True): if cache is None: return None + providers = PROVIDERS["offline"] + if not offline_only: + providers += PROVIDERS["online"] + # Run through all available libc database providers to see if we have a match. - for provider in PROVIDERS: + for provider in providers: data = provider(hex_encoded_id, hash_type) if data and data.startswith(b'\x7FELF'): break @@ -607,7 +614,7 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as selected_libc = _handle_multiple_matching_libcs(matching_libcs) return search_by_build_id(selected_libc['buildid'], unstrip=unstrip) -def search_by_build_id(hex_encoded_id, unstrip=True): +def search_by_build_id(hex_encoded_id, unstrip=True, offline_only=False): """ Given a hex-encoded Build ID, attempt to download a matching libc from libcdb. @@ -616,6 +623,10 @@ def search_by_build_id(hex_encoded_id, unstrip=True): Hex-encoded Build ID (e.g. 'ABCDEF...') of the library unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. + offline_only(bool): + Both offline and online providers are used by default. When pass + `offline_only=True`, libcdb enable an exclusive offline search mode, + which will disable online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -631,9 +642,9 @@ def search_by_build_id(hex_encoded_id, unstrip=True): >>> hex(ELF(filename).symbols.read) '0xeef40' """ - return search_by_hash(hex_encoded_id, 'build_id', unstrip) + return search_by_hash(hex_encoded_id, 'build_id', unstrip, offline_only) -def search_by_md5(hex_encoded_id, unstrip=True): +def search_by_md5(hex_encoded_id, unstrip=True, offline_only=False): """ Given a hex-encoded md5sum, attempt to download a matching libc from libcdb. @@ -642,6 +653,10 @@ def search_by_md5(hex_encoded_id, unstrip=True): Hex-encoded md5sum (e.g. 'ABCDEF...') of the library unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. + offline_only(bool): + Both offline and online providers are used by default. When pass + `offline_only=True`, libcdb enable an exclusive offline search mode, + which will disable online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -657,9 +672,9 @@ def search_by_md5(hex_encoded_id, unstrip=True): >>> hex(ELF(filename).symbols.read) '0xeef40' """ - return search_by_hash(hex_encoded_id, 'md5', unstrip) + return search_by_hash(hex_encoded_id, 'md5', unstrip, offline_only) -def search_by_sha1(hex_encoded_id, unstrip=True): +def search_by_sha1(hex_encoded_id, unstrip=True, offline_only=False): """ Given a hex-encoded sha1, attempt to download a matching libc from libcdb. @@ -668,6 +683,10 @@ def search_by_sha1(hex_encoded_id, unstrip=True): Hex-encoded sha1sum (e.g. 'ABCDEF...') of the library unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. + offline_only(bool): + Both offline and online providers are used by default. When pass + `offline_only=True`, libcdb enable an exclusive offline search mode, + which will disable online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -683,10 +702,9 @@ def search_by_sha1(hex_encoded_id, unstrip=True): >>> hex(ELF(filename).symbols.read) '0xeef40' """ - return search_by_hash(hex_encoded_id, 'sha1', unstrip) - + return search_by_hash(hex_encoded_id, 'sha1', unstrip, offline_only) -def search_by_sha256(hex_encoded_id, unstrip=True): +def search_by_sha256(hex_encoded_id, unstrip=True, offline_only=False): """ Given a hex-encoded sha256, attempt to download a matching libc from libcdb. @@ -695,6 +713,10 @@ def search_by_sha256(hex_encoded_id, unstrip=True): Hex-encoded sha256sum (e.g. 'ABCDEF...') of the library unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. + offline_only(bool): + Both offline and online providers are used by default. When pass + `offline_only=True`, libcdb enable an exclusive offline search mode, + which will disable online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -710,7 +732,7 @@ def search_by_sha256(hex_encoded_id, unstrip=True): >>> hex(ELF(filename).symbols.read) '0xeef40' """ - return search_by_hash(hex_encoded_id, 'sha256', unstrip) + return search_by_hash(hex_encoded_id, 'sha256', unstrip, offline_only) From 8ba1bdf0b6fe06490e72a50fc417631b77dd9db0 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Fri, 29 Mar 2024 16:04:56 +0100 Subject: [PATCH 092/107] Add basic support to debug processes on Windows (#2327) * Add basic support to debug processes on Windows Currently only `windbg.debug()` and `windbg.attach()` are implemented, which open a WinDbg instance and attach to the process. * Update CHANGELOG * Cleanup CheckRemoteDebuggerPresent call Only require PROCESS_QUERY_INFORMATION access and check for errors when opening the process. * process.close: Move closing of std fds after kill Windows processes would block on fd.close() when the main thread is suspended. --- CHANGELOG.md | 2 + docs/source/index.rst | 1 + docs/source/windbg.rst | 9 ++ pwnlib/__init__.py | 1 + pwnlib/tubes/process.py | 18 +-- pwnlib/util/proc.py | 42 ++++++- pwnlib/windbg.py | 239 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 302 insertions(+), 10 deletions(-) create mode 100644 docs/source/windbg.rst create mode 100644 pwnlib/windbg.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 64feee6fb..0dc7ad8d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,10 +74,12 @@ The table below shows which release corresponds to each branch, and what date th - [#2360][2360] Add offline parameter for `search_by_hash` series function - [#2356][2356] Add local libc database provider for libcdb - [#2374][2374] libcdb.unstrip_libc: debug symbols are fetched only if not present +- [#2327][2327] Add basic support to debug processes on Windows [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 [2374]: https://github.com/Gallopsled/pwntools/pull/2374 +[2327]: https://github.com/Gallopsled/pwntools/pull/2327 ## 4.13.0 (`beta`) diff --git a/docs/source/index.rst b/docs/source/index.rst index 596cf738a..051ece0af 100755 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -77,6 +77,7 @@ Each of the ``pwntools`` modules is documented here. update useragents util/* + windbg .. toctree:: :hidden: diff --git a/docs/source/windbg.rst b/docs/source/windbg.rst new file mode 100644 index 000000000..e08397205 --- /dev/null +++ b/docs/source/windbg.rst @@ -0,0 +1,9 @@ +.. testsetup:: * + + from pwn import * + +:mod:`pwnlib.windbg` --- Working with WinDbg +====================================== + +.. automodule:: pwnlib.windbg + :members: \ No newline at end of file diff --git a/pwnlib/__init__.py b/pwnlib/__init__.py index 446907c04..3dae1f00f 100644 --- a/pwnlib/__init__.py +++ b/pwnlib/__init__.py @@ -36,6 +36,7 @@ 'util', 'update', 'version', + 'windbg', ] from . import args diff --git a/pwnlib/tubes/process.py b/pwnlib/tubes/process.py index e5f143e75..4bbcf56e2 100644 --- a/pwnlib/tubes/process.py +++ b/pwnlib/tubes/process.py @@ -802,15 +802,6 @@ def close(self): # First check if we are already dead self.poll() - # close file descriptors - for fd in [self.proc.stdin, self.proc.stdout, self.proc.stderr]: - if fd is not None: - try: - fd.close() - except IOError as e: - if e.errno != errno.EPIPE and e.errno != errno.EINVAL: - raise - if not self._stop_noticed: try: self.proc.kill() @@ -820,6 +811,15 @@ def close(self): except OSError: pass + # close file descriptors + for fd in [self.proc.stdin, self.proc.stdout, self.proc.stderr]: + if fd is not None: + try: + fd.close() + except IOError as e: + if e.errno != errno.EPIPE and e.errno != errno.EINVAL: + raise + def fileno(self): if not self.connected(): diff --git a/pwnlib/util/proc.py b/pwnlib/util/proc.py index 0bcaca4d8..1769bda56 100644 --- a/pwnlib/util/proc.py +++ b/pwnlib/util/proc.py @@ -3,6 +3,7 @@ import errno import socket +import sys import time import psutil @@ -315,6 +316,42 @@ def status(pid): raise return out +def _tracer_windows(pid): + import ctypes + from ctypes import wintypes + + def _check_bool(result, func, args): + if not result: + raise ctypes.WinError(ctypes.get_last_error()) + return args + + kernel32 = ctypes.WinDLL("kernel32", use_last_error=True) + OpenProcess = kernel32.OpenProcess + OpenProcess.argtypes = [wintypes.DWORD, wintypes.BOOL, wintypes.DWORD] + OpenProcess.restype = wintypes.HANDLE + OpenProcess.errcheck = _check_bool + + CheckRemoteDebuggerPresent = kernel32.CheckRemoteDebuggerPresent + CheckRemoteDebuggerPresent.argtypes = [wintypes.HANDLE, ctypes.POINTER(wintypes.BOOL)] + CheckRemoteDebuggerPresent.restype = wintypes.BOOL + CheckRemoteDebuggerPresent.errcheck = _check_bool + + CloseHandle = kernel32.CloseHandle + CloseHandle.argtypes = [wintypes.HANDLE] + CloseHandle.restype = wintypes.BOOL + CloseHandle.errcheck = _check_bool + + PROCESS_QUERY_INFORMATION = 0x0400 + proc_handle = OpenProcess(PROCESS_QUERY_INFORMATION, False, pid) + present = wintypes.BOOL() + CheckRemoteDebuggerPresent(proc_handle, ctypes.byref(present)) + ret = 0 + if present.value: + ret = pid + CloseHandle(proc_handle) + + return ret + def tracer(pid): """tracer(pid) -> int @@ -329,7 +366,10 @@ def tracer(pid): >>> tracer(os.getpid()) is None True """ - tpid = int(status(pid)['TracerPid']) + if sys.platform == 'win32': + tpid = _tracer_windows(pid) + else: + tpid = int(status(pid)['TracerPid']) return tpid if tpid > 0 else None def state(pid): diff --git a/pwnlib/windbg.py b/pwnlib/windbg.py new file mode 100644 index 000000000..588714572 --- /dev/null +++ b/pwnlib/windbg.py @@ -0,0 +1,239 @@ +""" +During exploit development, it is frequently useful to debug the +target binary under WinDbg. This module provides a simple interface +to do so under Windows. + +Useful Functions +---------------- + +- :func:`attach` - Attach to an existing process + +Debugging Tips +-------------- + +The :func:`attach` and :func:`debug` functions will likely be your bread and +butter for debugging. + +Both allow you to provide a script to pass to WinDbg when it is started, so that +it can automatically set your breakpoints. + +Attaching to Processes +~~~~~~~~~~~~~~~~~~~~~~ + +To attach to an existing process, just use :func:`attach`. You can pass a PID, +a process name (including file extension), or a :class:`.process`. + +Spawning New Processes +~~~~~~~~~~~~~~~~~~~~~~ + +Attaching to processes with :func:`attach` is useful, but the state the process +is in may vary. If you need to attach to a process very early, and debug it from +the very first instruction (or even the start of ``main``), you instead should use +:func:`debug`. + +When you use :func:`debug`, the return value is a :class:`.tube` object +that you interact with exactly like normal. + +Tips and Troubleshooting +------------------------ + +``NOPTRACE`` magic argument +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It's quite cumbersom to comment and un-comment lines containing `attach`. + +You can cause these lines to be a no-op by running your script with the +``NOPTRACE`` argument appended, or with ``PWNLIB_NOPTRACE=1`` in the environment. +(The name is borrowed from ptrace syscall on Linux.) + +:: + + $ python exploit.py NOPTRACE + [+] Starting local process 'chall.exe': Done + [!] Skipping debug attach since context.noptrace==True + ... + +Member Documentation +=============================== +""" +from __future__ import absolute_import +import atexit +import os +import signal + +import subprocess + +import six + +from pwnlib import tubes +from pwnlib.context import LocalContext +from pwnlib.context import context +from pwnlib.log import getLogger +from pwnlib.util import misc +from pwnlib.util import proc + +log = getLogger(__name__) + +CREATE_SUSPENDED = 0x00000004 + +@LocalContext +def debug(args, windbgscript=None, exe=None, env=None, creationflags=0, **kwargs): + """debug(args, windbgscript=None, exe=None, env=None, creationflags=0) -> tube + + Launch a process in suspended state, attach debugger and resume process. + + Arguments: + args(list): Arguments to the process, similar to :class:`.process`. + windbgscript(str): windbg script to run. + exe(str): Path to the executable on disk. + env(dict): Environment to start the binary in. + creationflags(int): Flags to pass to :func:`.process.process`. + + Returns: + :class:`.process`: A tube connected to the target process. + + Notes: + + .. code-block: python + + # Create a new process, and stop it at 'main' + io = windbg.debug('calc', ''' + bp $exentry + go + ''') + + When WinDbg opens via :func:`.debug`, it will initially be stopped on the very first + instruction of the entry point. + """ + if isinstance( + args, six.integer_types + (tubes.process.process, tubes.ssh.ssh_channel) + ): + log.error("Use windbg.attach() to debug a running process") + + if context.noptrace: + log.warn_once("Skipping debugger since context.noptrace==True") + return tubes.process.process(args, executable=exe, env=env, creationflags=creationflags) + + windbgscript = windbgscript or '' + if isinstance(windbgscript, six.string_types): + windbgscript = windbgscript.split('\n') + # resume main thread + windbgscript = ['~0m'] + windbgscript + creationflags |= CREATE_SUSPENDED + io = tubes.process.process(args, executable=exe, env=env, creationflags=creationflags) + attach(target=io, windbgscript=windbgscript, **kwargs) + + return io + +def binary(): + """binary() -> str + + Returns the path to the WinDbg binary. + + Returns: + str: Path to the appropriate ``windbg`` binary to use. + """ + windbg = misc.which('windbgx.exe') or misc.which('windbg.exe') + if not windbg: + log.error('windbg is not installed or in system PATH') + return windbg + +@LocalContext +def attach(target, windbgscript=None, windbg_args=[]): + """attach(target, windbgscript=None, windbg_args=[]) -> int + + Attach to a running process with WinDbg. + + Arguments: + target(int, str, process): Process to attach to. + windbgscript(str, list): WinDbg script to run after attaching. + windbg_args(list): Additional arguments to pass to WinDbg. + + Returns: + int: PID of the WinDbg process. + + Notes: + + The ``target`` argument is very robust, and can be any of the following: + + :obj:`int` + PID of a process + :obj:`str` + Process name. The youngest process is selected. + :class:`.process` + Process to connect to + + Examples: + + Attach to a process by PID + + >>> pid = windbg.attach(1234) # doctest: +SKIP + + Attach to the youngest process by name + + >>> pid = windbg.attach('cmd.exe') # doctest: +SKIP + + Attach a debugger to a :class:`.process` tube and automate interaction + + >>> io = process('cmd') # doctest: +SKIP + >>> pid = windbg.attach(io, windbgscript=''' + ... bp kernelbase!WriteFile + ... g + ... ''') # doctest: +SKIP + """ + if context.noptrace: + log.warn_once("Skipping debug attach since context.noptrace==True") + return + + # let's see if we can find a pid to attach to + pid = None + if isinstance(target, six.integer_types): + # target is a pid, easy peasy + pid = target + elif isinstance(target, str): + # pidof picks the youngest process + pids = list(proc.pidof(target)) + if not pids: + log.error('No such process: %s', target) + pid = pids[0] + log.info('Attaching to youngest process "%s" (PID = %d)' % + (target, pid)) + elif isinstance(target, tubes.process.process): + pid = proc.pidof(target)[0] + else: + log.error("don't know how to attach to target: %r", target) + + if not pid: + log.error('could not find target process') + + cmd = [binary()] + if windbg_args: + cmd.extend(windbg_args) + + cmd.extend(['-p', str(pid)]) + + windbgscript = windbgscript or '' + if isinstance(windbgscript, six.string_types): + windbgscript = windbgscript.split('\n') + if isinstance(windbgscript, list): + windbgscript = ';'.join(script.strip() for script in windbgscript if script.strip()) + if windbgscript: + cmd.extend(['-c', windbgscript]) + + log.info("Launching a new process: %r" % cmd) + + io = subprocess.Popen(cmd) + windbg_pid = io.pid + + def kill(): + try: + os.kill(windbg_pid, signal.SIGTERM) + except OSError: + pass + + atexit.register(kill) + + if context.native: + proc.wait_for_debugger(pid, windbg_pid) + + return windbg_pid From cb540857ccd4ea45678e24949f48a2231857f8ed Mon Sep 17 00:00:00 2001 From: peace-maker Date: Fri, 29 Mar 2024 17:28:50 +0100 Subject: [PATCH 093/107] Add basic RISCV64 shellcraft support (#2322) * Add basic RISCV64 shellcraft support The `mov` template isn't 100% null-byte and newline free for all inputs. Certain larger values are just emitted using the `li` pseudo-instruction by the assembler which might contain null-bytes. Co-authored-by: LevitatingLion * Generate RISCV syscall constants from musl-libc diet-libc doesn't support RISCV, so borrow from musl. Need to consider their license. * Update CHANGELOG * Fix CHANGELOG --------- Co-authored-by: LevitatingLion --- .github/workflows/ci.yml | 1 + CHANGELOG.md | 2 + docs/source/shellcraft/riscv64.rst | 19 + pwnlib/constants/linux/riscv64.py | 1306 +++++++++++++++++ .../generator/linux/diet/riscv64/syscalls.h | 304 ++++ .../data/includes/generator/linux/riscv64.h | 4 + .../includes/generator/linux/syscall_map.h | 10 + pwnlib/data/includes/linux/riscv64.h | 1305 ++++++++++++++++ pwnlib/shellcraft/registers.py | 39 +- .../common/linux/syscalls/close_range.asm | 101 ++ .../common/linux/syscalls/epoll_pwait2.asm | 101 ++ .../common/linux/syscalls/faccessat2.asm | 101 ++ .../linux/syscalls/landlock_add_rule.asm | 101 ++ .../syscalls/landlock_create_ruleset.asm | 101 ++ .../linux/syscalls/landlock_restrict_self.asm | 101 ++ .../common/linux/syscalls/mount_setattr.asm | 101 ++ .../common/linux/syscalls/process_madvise.asm | 101 ++ .../linux/syscalls/riscv_flush_icache.asm | 101 ++ .../common/linux/syscalls/sysriscv.asm | 101 ++ pwnlib/shellcraft/templates/riscv64/__doc__ | 1 + .../templates/riscv64/linux/__doc__ | 1 + .../templates/riscv64/linux/syscall.asm | 109 ++ .../templates/riscv64/linux/syscalls | 1 + pwnlib/shellcraft/templates/riscv64/mov.asm | 131 ++ pwnlib/shellcraft/templates/riscv64/nop.asm | 2 + pwnlib/shellcraft/templates/riscv64/push.asm | 27 + .../shellcraft/templates/riscv64/pushstr.asm | 98 ++ .../templates/riscv64/pushstr_array.asm | 38 + .../shellcraft/templates/riscv64/setregs.asm | 46 + pwnlib/shellcraft/templates/riscv64/trap.asm | 2 + pwnlib/shellcraft/templates/riscv64/xor.asm | 34 + 31 files changed, 4489 insertions(+), 1 deletion(-) create mode 100644 docs/source/shellcraft/riscv64.rst create mode 100644 pwnlib/constants/linux/riscv64.py create mode 100644 pwnlib/data/includes/generator/linux/diet/riscv64/syscalls.h create mode 100644 pwnlib/data/includes/generator/linux/riscv64.h create mode 100644 pwnlib/data/includes/linux/riscv64.h create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm create mode 100644 pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/__doc__ create mode 100644 pwnlib/shellcraft/templates/riscv64/linux/__doc__ create mode 100644 pwnlib/shellcraft/templates/riscv64/linux/syscall.asm create mode 120000 pwnlib/shellcraft/templates/riscv64/linux/syscalls create mode 100644 pwnlib/shellcraft/templates/riscv64/mov.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/nop.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/push.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/pushstr.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/pushstr_array.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/setregs.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/trap.asm create mode 100644 pwnlib/shellcraft/templates/riscv64/xor.asm diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cfe71039..145b668e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,6 +78,7 @@ jobs: binutils-powerpc-linux-gnu \ binutils-s390x-linux-gnu \ binutils-sparc64-linux-gnu \ + binutils-riscv64-linux-gnu \ gcc-multilib \ libc6-dbg \ elfutils \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dc7ad8d5..347a26c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,11 +75,13 @@ The table below shows which release corresponds to each branch, and what date th - [#2356][2356] Add local libc database provider for libcdb - [#2374][2374] libcdb.unstrip_libc: debug symbols are fetched only if not present - [#2327][2327] Add basic support to debug processes on Windows +- [#2322][2322] Add basic RISCV64 shellcraft support [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 [2374]: https://github.com/Gallopsled/pwntools/pull/2374 [2327]: https://github.com/Gallopsled/pwntools/pull/2327 +[2322]: https://github.com/Gallopsled/pwntools/pull/2322 ## 4.13.0 (`beta`) diff --git a/docs/source/shellcraft/riscv64.rst b/docs/source/shellcraft/riscv64.rst new file mode 100644 index 000000000..47b484af7 --- /dev/null +++ b/docs/source/shellcraft/riscv64.rst @@ -0,0 +1,19 @@ +.. testsetup:: * + + from pwn import * + context.clear(arch='riscv64') + +:mod:`pwnlib.shellcraft.riscv64` --- Shellcode for RISCV64 +=========================================================== + +:mod:`pwnlib.shellcraft.riscv64` +------------------------------- + +.. automodule:: pwnlib.shellcraft.riscv64 + :members: + +:mod:`pwnlib.shellcraft.riscv64.linux` +--------------------------------------- + +.. automodule:: pwnlib.shellcraft.riscv64.linux + :members: diff --git a/pwnlib/constants/linux/riscv64.py b/pwnlib/constants/linux/riscv64.py new file mode 100644 index 000000000..d7ac82417 --- /dev/null +++ b/pwnlib/constants/linux/riscv64.py @@ -0,0 +1,1306 @@ +from pwnlib.constants.constant import Constant +__NR_io_setup = Constant('__NR_io_setup',0) +__NR_io_destroy = Constant('__NR_io_destroy',1) +__NR_io_submit = Constant('__NR_io_submit',2) +__NR_io_cancel = Constant('__NR_io_cancel',3) +__NR_io_getevents = Constant('__NR_io_getevents',4) +__NR_setxattr = Constant('__NR_setxattr',5) +__NR_lsetxattr = Constant('__NR_lsetxattr',6) +__NR_fsetxattr = Constant('__NR_fsetxattr',7) +__NR_getxattr = Constant('__NR_getxattr',8) +__NR_lgetxattr = Constant('__NR_lgetxattr',9) +__NR_fgetxattr = Constant('__NR_fgetxattr',10) +__NR_listxattr = Constant('__NR_listxattr',11) +__NR_llistxattr = Constant('__NR_llistxattr',12) +__NR_flistxattr = Constant('__NR_flistxattr',13) +__NR_removexattr = Constant('__NR_removexattr',14) +__NR_lremovexattr = Constant('__NR_lremovexattr',15) +__NR_fremovexattr = Constant('__NR_fremovexattr',16) +__NR_getcwd = Constant('__NR_getcwd',17) +__NR_lookup_dcookie = Constant('__NR_lookup_dcookie',18) +__NR_eventfd2 = Constant('__NR_eventfd2',19) +__NR_epoll_create1 = Constant('__NR_epoll_create1',20) +__NR_epoll_ctl = Constant('__NR_epoll_ctl',21) +__NR_epoll_pwait = Constant('__NR_epoll_pwait',22) +__NR_dup = Constant('__NR_dup',23) +__NR_dup3 = Constant('__NR_dup3',24) +__NR_fcntl = Constant('__NR_fcntl',25) +__NR_inotify_init1 = Constant('__NR_inotify_init1',26) +__NR_inotify_add_watch = Constant('__NR_inotify_add_watch',27) +__NR_inotify_rm_watch = Constant('__NR_inotify_rm_watch',28) +__NR_ioctl = Constant('__NR_ioctl',29) +__NR_ioprio_set = Constant('__NR_ioprio_set',30) +__NR_ioprio_get = Constant('__NR_ioprio_get',31) +__NR_flock = Constant('__NR_flock',32) +__NR_mknodat = Constant('__NR_mknodat',33) +__NR_mkdirat = Constant('__NR_mkdirat',34) +__NR_unlinkat = Constant('__NR_unlinkat',35) +__NR_symlinkat = Constant('__NR_symlinkat',36) +__NR_linkat = Constant('__NR_linkat',37) +__NR_umount2 = Constant('__NR_umount2',39) +__NR_mount = Constant('__NR_mount',40) +__NR_pivot_root = Constant('__NR_pivot_root',41) +__NR_nfsservctl = Constant('__NR_nfsservctl',42) +__NR_statfs = Constant('__NR_statfs',43) +__NR_fstatfs = Constant('__NR_fstatfs',44) +__NR_truncate = Constant('__NR_truncate',45) +__NR_ftruncate = Constant('__NR_ftruncate',46) +__NR_fallocate = Constant('__NR_fallocate',47) +__NR_faccessat = Constant('__NR_faccessat',48) +__NR_chdir = Constant('__NR_chdir',49) +__NR_fchdir = Constant('__NR_fchdir',50) +__NR_chroot = Constant('__NR_chroot',51) +__NR_fchmod = Constant('__NR_fchmod',52) +__NR_fchmodat = Constant('__NR_fchmodat',53) +__NR_fchownat = Constant('__NR_fchownat',54) +__NR_fchown = Constant('__NR_fchown',55) +__NR_openat = Constant('__NR_openat',56) +__NR_close = Constant('__NR_close',57) +__NR_vhangup = Constant('__NR_vhangup',58) +__NR_pipe2 = Constant('__NR_pipe2',59) +__NR_quotactl = Constant('__NR_quotactl',60) +__NR_getdents64 = Constant('__NR_getdents64',61) +__NR_lseek = Constant('__NR_lseek',62) +__NR_read = Constant('__NR_read',63) +__NR_write = Constant('__NR_write',64) +__NR_readv = Constant('__NR_readv',65) +__NR_writev = Constant('__NR_writev',66) +__NR_pread64 = Constant('__NR_pread64',67) +__NR_pwrite64 = Constant('__NR_pwrite64',68) +__NR_preadv = Constant('__NR_preadv',69) +__NR_pwritev = Constant('__NR_pwritev',70) +__NR_sendfile = Constant('__NR_sendfile',71) +__NR_pselect6 = Constant('__NR_pselect6',72) +__NR_ppoll = Constant('__NR_ppoll',73) +__NR_signalfd4 = Constant('__NR_signalfd4',74) +__NR_vmsplice = Constant('__NR_vmsplice',75) +__NR_splice = Constant('__NR_splice',76) +__NR_tee = Constant('__NR_tee',77) +__NR_readlinkat = Constant('__NR_readlinkat',78) +__NR_newfstatat = Constant('__NR_newfstatat',79) +__NR_fstat = Constant('__NR_fstat',80) +__NR_sync = Constant('__NR_sync',81) +__NR_fsync = Constant('__NR_fsync',82) +__NR_fdatasync = Constant('__NR_fdatasync',83) +__NR_sync_file_range = Constant('__NR_sync_file_range',84) +__NR_timerfd_create = Constant('__NR_timerfd_create',85) +__NR_timerfd_settime = Constant('__NR_timerfd_settime',86) +__NR_timerfd_gettime = Constant('__NR_timerfd_gettime',87) +__NR_utimensat = Constant('__NR_utimensat',88) +__NR_acct = Constant('__NR_acct',89) +__NR_capget = Constant('__NR_capget',90) +__NR_capset = Constant('__NR_capset',91) +__NR_personality = Constant('__NR_personality',92) +__NR_exit = Constant('__NR_exit',93) +__NR_exit_group = Constant('__NR_exit_group',94) +__NR_waitid = Constant('__NR_waitid',95) +__NR_set_tid_address = Constant('__NR_set_tid_address',96) +__NR_unshare = Constant('__NR_unshare',97) +__NR_futex = Constant('__NR_futex',98) +__NR_set_robust_list = Constant('__NR_set_robust_list',99) +__NR_get_robust_list = Constant('__NR_get_robust_list',100) +__NR_nanosleep = Constant('__NR_nanosleep',101) +__NR_getitimer = Constant('__NR_getitimer',102) +__NR_setitimer = Constant('__NR_setitimer',103) +__NR_kexec_load = Constant('__NR_kexec_load',104) +__NR_init_module = Constant('__NR_init_module',105) +__NR_delete_module = Constant('__NR_delete_module',106) +__NR_timer_create = Constant('__NR_timer_create',107) +__NR_timer_gettime = Constant('__NR_timer_gettime',108) +__NR_timer_getoverrun = Constant('__NR_timer_getoverrun',109) +__NR_timer_settime = Constant('__NR_timer_settime',110) +__NR_timer_delete = Constant('__NR_timer_delete',111) +__NR_clock_settime = Constant('__NR_clock_settime',112) +__NR_clock_gettime = Constant('__NR_clock_gettime',113) +__NR_clock_getres = Constant('__NR_clock_getres',114) +__NR_clock_nanosleep = Constant('__NR_clock_nanosleep',115) +__NR_syslog = Constant('__NR_syslog',116) +__NR_ptrace = Constant('__NR_ptrace',117) +__NR_sched_setparam = Constant('__NR_sched_setparam',118) +__NR_sched_setscheduler = Constant('__NR_sched_setscheduler',119) +__NR_sched_getscheduler = Constant('__NR_sched_getscheduler',120) +__NR_sched_getparam = Constant('__NR_sched_getparam',121) +__NR_sched_setaffinity = Constant('__NR_sched_setaffinity',122) +__NR_sched_getaffinity = Constant('__NR_sched_getaffinity',123) +__NR_sched_yield = Constant('__NR_sched_yield',124) +__NR_sched_get_priority_max = Constant('__NR_sched_get_priority_max',125) +__NR_sched_get_priority_min = Constant('__NR_sched_get_priority_min',126) +__NR_sched_rr_get_interval = Constant('__NR_sched_rr_get_interval',127) +__NR_restart_syscall = Constant('__NR_restart_syscall',128) +__NR_kill = Constant('__NR_kill',129) +__NR_tkill = Constant('__NR_tkill',130) +__NR_tgkill = Constant('__NR_tgkill',131) +__NR_sigaltstack = Constant('__NR_sigaltstack',132) +__NR_rt_sigsuspend = Constant('__NR_rt_sigsuspend',133) +__NR_rt_sigaction = Constant('__NR_rt_sigaction',134) +__NR_rt_sigprocmask = Constant('__NR_rt_sigprocmask',135) +__NR_rt_sigpending = Constant('__NR_rt_sigpending',136) +__NR_rt_sigtimedwait = Constant('__NR_rt_sigtimedwait',137) +__NR_rt_sigqueueinfo = Constant('__NR_rt_sigqueueinfo',138) +__NR_rt_sigreturn = Constant('__NR_rt_sigreturn',139) +__NR_setpriority = Constant('__NR_setpriority',140) +__NR_getpriority = Constant('__NR_getpriority',141) +__NR_reboot = Constant('__NR_reboot',142) +__NR_setregid = Constant('__NR_setregid',143) +__NR_setgid = Constant('__NR_setgid',144) +__NR_setreuid = Constant('__NR_setreuid',145) +__NR_setuid = Constant('__NR_setuid',146) +__NR_setresuid = Constant('__NR_setresuid',147) +__NR_getresuid = Constant('__NR_getresuid',148) +__NR_setresgid = Constant('__NR_setresgid',149) +__NR_getresgid = Constant('__NR_getresgid',150) +__NR_setfsuid = Constant('__NR_setfsuid',151) +__NR_setfsgid = Constant('__NR_setfsgid',152) +__NR_times = Constant('__NR_times',153) +__NR_setpgid = Constant('__NR_setpgid',154) +__NR_getpgid = Constant('__NR_getpgid',155) +__NR_getsid = Constant('__NR_getsid',156) +__NR_setsid = Constant('__NR_setsid',157) +__NR_getgroups = Constant('__NR_getgroups',158) +__NR_setgroups = Constant('__NR_setgroups',159) +__NR_uname = Constant('__NR_uname',160) +__NR_sethostname = Constant('__NR_sethostname',161) +__NR_setdomainname = Constant('__NR_setdomainname',162) +__NR_getrlimit = Constant('__NR_getrlimit',163) +__NR_setrlimit = Constant('__NR_setrlimit',164) +__NR_getrusage = Constant('__NR_getrusage',165) +__NR_umask = Constant('__NR_umask',166) +__NR_prctl = Constant('__NR_prctl',167) +__NR_getcpu = Constant('__NR_getcpu',168) +__NR_gettimeofday = Constant('__NR_gettimeofday',169) +__NR_settimeofday = Constant('__NR_settimeofday',170) +__NR_adjtimex = Constant('__NR_adjtimex',171) +__NR_getpid = Constant('__NR_getpid',172) +__NR_getppid = Constant('__NR_getppid',173) +__NR_getuid = Constant('__NR_getuid',174) +__NR_geteuid = Constant('__NR_geteuid',175) +__NR_getgid = Constant('__NR_getgid',176) +__NR_getegid = Constant('__NR_getegid',177) +__NR_gettid = Constant('__NR_gettid',178) +__NR_sysinfo = Constant('__NR_sysinfo',179) +__NR_mq_open = Constant('__NR_mq_open',180) +__NR_mq_unlink = Constant('__NR_mq_unlink',181) +__NR_mq_timedsend = Constant('__NR_mq_timedsend',182) +__NR_mq_timedreceive = Constant('__NR_mq_timedreceive',183) +__NR_mq_notify = Constant('__NR_mq_notify',184) +__NR_mq_getsetattr = Constant('__NR_mq_getsetattr',185) +__NR_msgget = Constant('__NR_msgget',186) +__NR_msgctl = Constant('__NR_msgctl',187) +__NR_msgrcv = Constant('__NR_msgrcv',188) +__NR_msgsnd = Constant('__NR_msgsnd',189) +__NR_semget = Constant('__NR_semget',190) +__NR_semctl = Constant('__NR_semctl',191) +__NR_semtimedop = Constant('__NR_semtimedop',192) +__NR_semop = Constant('__NR_semop',193) +__NR_shmget = Constant('__NR_shmget',194) +__NR_shmctl = Constant('__NR_shmctl',195) +__NR_shmat = Constant('__NR_shmat',196) +__NR_shmdt = Constant('__NR_shmdt',197) +__NR_socket = Constant('__NR_socket',198) +__NR_socketpair = Constant('__NR_socketpair',199) +__NR_bind = Constant('__NR_bind',200) +__NR_listen = Constant('__NR_listen',201) +__NR_accept = Constant('__NR_accept',202) +__NR_connect = Constant('__NR_connect',203) +__NR_getsockname = Constant('__NR_getsockname',204) +__NR_getpeername = Constant('__NR_getpeername',205) +__NR_sendto = Constant('__NR_sendto',206) +__NR_recvfrom = Constant('__NR_recvfrom',207) +__NR_setsockopt = Constant('__NR_setsockopt',208) +__NR_getsockopt = Constant('__NR_getsockopt',209) +__NR_shutdown = Constant('__NR_shutdown',210) +__NR_sendmsg = Constant('__NR_sendmsg',211) +__NR_recvmsg = Constant('__NR_recvmsg',212) +__NR_readahead = Constant('__NR_readahead',213) +__NR_brk = Constant('__NR_brk',214) +__NR_munmap = Constant('__NR_munmap',215) +__NR_mremap = Constant('__NR_mremap',216) +__NR_add_key = Constant('__NR_add_key',217) +__NR_request_key = Constant('__NR_request_key',218) +__NR_keyctl = Constant('__NR_keyctl',219) +__NR_clone = Constant('__NR_clone',220) +__NR_execve = Constant('__NR_execve',221) +__NR_mmap = Constant('__NR_mmap',222) +__NR_fadvise64 = Constant('__NR_fadvise64',223) +__NR_swapon = Constant('__NR_swapon',224) +__NR_swapoff = Constant('__NR_swapoff',225) +__NR_mprotect = Constant('__NR_mprotect',226) +__NR_msync = Constant('__NR_msync',227) +__NR_mlock = Constant('__NR_mlock',228) +__NR_munlock = Constant('__NR_munlock',229) +__NR_mlockall = Constant('__NR_mlockall',230) +__NR_munlockall = Constant('__NR_munlockall',231) +__NR_mincore = Constant('__NR_mincore',232) +__NR_madvise = Constant('__NR_madvise',233) +__NR_remap_file_pages = Constant('__NR_remap_file_pages',234) +__NR_mbind = Constant('__NR_mbind',235) +__NR_get_mempolicy = Constant('__NR_get_mempolicy',236) +__NR_set_mempolicy = Constant('__NR_set_mempolicy',237) +__NR_migrate_pages = Constant('__NR_migrate_pages',238) +__NR_move_pages = Constant('__NR_move_pages',239) +__NR_rt_tgsigqueueinfo = Constant('__NR_rt_tgsigqueueinfo',240) +__NR_perf_event_open = Constant('__NR_perf_event_open',241) +__NR_accept4 = Constant('__NR_accept4',242) +__NR_recvmmsg = Constant('__NR_recvmmsg',243) +__NR_arch_specific_syscall = Constant('__NR_arch_specific_syscall',244) +__NR_wait4 = Constant('__NR_wait4',260) +__NR_prlimit64 = Constant('__NR_prlimit64',261) +__NR_fanotify_init = Constant('__NR_fanotify_init',262) +__NR_fanotify_mark = Constant('__NR_fanotify_mark',263) +__NR_name_to_handle_at = Constant('__NR_name_to_handle_at',264) +__NR_open_by_handle_at = Constant('__NR_open_by_handle_at',265) +__NR_clock_adjtime = Constant('__NR_clock_adjtime',266) +__NR_syncfs = Constant('__NR_syncfs',267) +__NR_setns = Constant('__NR_setns',268) +__NR_sendmmsg = Constant('__NR_sendmmsg',269) +__NR_process_vm_readv = Constant('__NR_process_vm_readv',270) +__NR_process_vm_writev = Constant('__NR_process_vm_writev',271) +__NR_kcmp = Constant('__NR_kcmp',272) +__NR_finit_module = Constant('__NR_finit_module',273) +__NR_sched_setattr = Constant('__NR_sched_setattr',274) +__NR_sched_getattr = Constant('__NR_sched_getattr',275) +__NR_renameat2 = Constant('__NR_renameat2',276) +__NR_seccomp = Constant('__NR_seccomp',277) +__NR_getrandom = Constant('__NR_getrandom',278) +__NR_memfd_create = Constant('__NR_memfd_create',279) +__NR_bpf = Constant('__NR_bpf',280) +__NR_execveat = Constant('__NR_execveat',281) +__NR_userfaultfd = Constant('__NR_userfaultfd',282) +__NR_membarrier = Constant('__NR_membarrier',283) +__NR_mlock2 = Constant('__NR_mlock2',284) +__NR_copy_file_range = Constant('__NR_copy_file_range',285) +__NR_preadv2 = Constant('__NR_preadv2',286) +__NR_pwritev2 = Constant('__NR_pwritev2',287) +__NR_pkey_mprotect = Constant('__NR_pkey_mprotect',288) +__NR_pkey_alloc = Constant('__NR_pkey_alloc',289) +__NR_pkey_free = Constant('__NR_pkey_free',290) +__NR_statx = Constant('__NR_statx',291) +__NR_io_pgetevents = Constant('__NR_io_pgetevents',292) +__NR_rseq = Constant('__NR_rseq',293) +__NR_kexec_file_load = Constant('__NR_kexec_file_load',294) +__NR_pidfd_send_signal = Constant('__NR_pidfd_send_signal',424) +__NR_io_uring_setup = Constant('__NR_io_uring_setup',425) +__NR_io_uring_enter = Constant('__NR_io_uring_enter',426) +__NR_io_uring_register = Constant('__NR_io_uring_register',427) +__NR_open_tree = Constant('__NR_open_tree',428) +__NR_move_mount = Constant('__NR_move_mount',429) +__NR_fsopen = Constant('__NR_fsopen',430) +__NR_fsconfig = Constant('__NR_fsconfig',431) +__NR_fsmount = Constant('__NR_fsmount',432) +__NR_fspick = Constant('__NR_fspick',433) +__NR_pidfd_open = Constant('__NR_pidfd_open',434) +__NR_clone3 = Constant('__NR_clone3',435) +__NR_close_range = Constant('__NR_close_range',436) +__NR_openat2 = Constant('__NR_openat2',437) +__NR_pidfd_getfd = Constant('__NR_pidfd_getfd',438) +__NR_faccessat2 = Constant('__NR_faccessat2',439) +__NR_process_madvise = Constant('__NR_process_madvise',440) +__NR_epoll_pwait2 = Constant('__NR_epoll_pwait2',441) +__NR_mount_setattr = Constant('__NR_mount_setattr',442) +__NR_landlock_create_ruleset = Constant('__NR_landlock_create_ruleset',444) +__NR_landlock_add_rule = Constant('__NR_landlock_add_rule',445) +__NR_landlock_restrict_self = Constant('__NR_landlock_restrict_self',446) +__NR_sysriscv = Constant('__NR_sysriscv',244) +__NR_riscv_flush_icache = Constant('__NR_riscv_flush_icache',(244 + 15)) +MAP_32BIT = Constant('MAP_32BIT',0x40) +INADDR_ANY = Constant('INADDR_ANY',0) +INADDR_BROADCAST = Constant('INADDR_BROADCAST',0xffffffff) +INADDR_NONE = Constant('INADDR_NONE',0xffffffff) +INADDR_LOOPBACK = Constant('INADDR_LOOPBACK',0x7f000001) +EPERM = Constant('EPERM',1) +ENOENT = Constant('ENOENT',2) +ESRCH = Constant('ESRCH',3) +EINTR = Constant('EINTR',4) +EIO = Constant('EIO',5) +ENXIO = Constant('ENXIO',6) +E2BIG = Constant('E2BIG',7) +ENOEXEC = Constant('ENOEXEC',8) +EBADF = Constant('EBADF',9) +ECHILD = Constant('ECHILD',10) +EAGAIN = Constant('EAGAIN',11) +ENOMEM = Constant('ENOMEM',12) +EACCES = Constant('EACCES',13) +EFAULT = Constant('EFAULT',14) +ENOTBLK = Constant('ENOTBLK',15) +EBUSY = Constant('EBUSY',16) +EEXIST = Constant('EEXIST',17) +EXDEV = Constant('EXDEV',18) +ENODEV = Constant('ENODEV',19) +ENOTDIR = Constant('ENOTDIR',20) +EISDIR = Constant('EISDIR',21) +EINVAL = Constant('EINVAL',22) +ENFILE = Constant('ENFILE',23) +EMFILE = Constant('EMFILE',24) +ENOTTY = Constant('ENOTTY',25) +ETXTBSY = Constant('ETXTBSY',26) +EFBIG = Constant('EFBIG',27) +ENOSPC = Constant('ENOSPC',28) +ESPIPE = Constant('ESPIPE',29) +EROFS = Constant('EROFS',30) +EMLINK = Constant('EMLINK',31) +EPIPE = Constant('EPIPE',32) +EDOM = Constant('EDOM',33) +ERANGE = Constant('ERANGE',34) +EDEADLK = Constant('EDEADLK',35) +ENAMETOOLONG = Constant('ENAMETOOLONG',36) +ENOLCK = Constant('ENOLCK',37) +ENOSYS = Constant('ENOSYS',38) +ENOTEMPTY = Constant('ENOTEMPTY',39) +ELOOP = Constant('ELOOP',40) +EWOULDBLOCK = Constant('EWOULDBLOCK',11) +ENOMSG = Constant('ENOMSG',42) +EIDRM = Constant('EIDRM',43) +ECHRNG = Constant('ECHRNG',44) +EL2NSYNC = Constant('EL2NSYNC',45) +EL3HLT = Constant('EL3HLT',46) +EL3RST = Constant('EL3RST',47) +ELNRNG = Constant('ELNRNG',48) +EUNATCH = Constant('EUNATCH',49) +ENOCSI = Constant('ENOCSI',50) +EL2HLT = Constant('EL2HLT',51) +EBADE = Constant('EBADE',52) +EBADR = Constant('EBADR',53) +EXFULL = Constant('EXFULL',54) +ENOANO = Constant('ENOANO',55) +EBADRQC = Constant('EBADRQC',56) +EBADSLT = Constant('EBADSLT',57) +EDEADLOCK = Constant('EDEADLOCK',35) +EBFONT = Constant('EBFONT',59) +ENOSTR = Constant('ENOSTR',60) +ENODATA = Constant('ENODATA',61) +ETIME = Constant('ETIME',62) +ENOSR = Constant('ENOSR',63) +ENONET = Constant('ENONET',64) +ENOPKG = Constant('ENOPKG',65) +EREMOTE = Constant('EREMOTE',66) +ENOLINK = Constant('ENOLINK',67) +EADV = Constant('EADV',68) +ESRMNT = Constant('ESRMNT',69) +ECOMM = Constant('ECOMM',70) +EPROTO = Constant('EPROTO',71) +EMULTIHOP = Constant('EMULTIHOP',72) +EDOTDOT = Constant('EDOTDOT',73) +EBADMSG = Constant('EBADMSG',74) +EOVERFLOW = Constant('EOVERFLOW',75) +ENOTUNIQ = Constant('ENOTUNIQ',76) +EBADFD = Constant('EBADFD',77) +EREMCHG = Constant('EREMCHG',78) +ELIBACC = Constant('ELIBACC',79) +ELIBBAD = Constant('ELIBBAD',80) +ELIBSCN = Constant('ELIBSCN',81) +ELIBMAX = Constant('ELIBMAX',82) +ELIBEXEC = Constant('ELIBEXEC',83) +EILSEQ = Constant('EILSEQ',84) +ERESTART = Constant('ERESTART',85) +ESTRPIPE = Constant('ESTRPIPE',86) +EUSERS = Constant('EUSERS',87) +ENOTSOCK = Constant('ENOTSOCK',88) +EDESTADDRREQ = Constant('EDESTADDRREQ',89) +EMSGSIZE = Constant('EMSGSIZE',90) +EPROTOTYPE = Constant('EPROTOTYPE',91) +ENOPROTOOPT = Constant('ENOPROTOOPT',92) +EPROTONOSUPPORT = Constant('EPROTONOSUPPORT',93) +ESOCKTNOSUPPORT = Constant('ESOCKTNOSUPPORT',94) +EOPNOTSUPP = Constant('EOPNOTSUPP',95) +ENOTSUP = Constant('ENOTSUP',95) +EPFNOSUPPORT = Constant('EPFNOSUPPORT',96) +EAFNOSUPPORT = Constant('EAFNOSUPPORT',97) +EADDRINUSE = Constant('EADDRINUSE',98) +EADDRNOTAVAIL = Constant('EADDRNOTAVAIL',99) +ENETDOWN = Constant('ENETDOWN',100) +ENETUNREACH = Constant('ENETUNREACH',101) +ENETRESET = Constant('ENETRESET',102) +ECONNABORTED = Constant('ECONNABORTED',103) +ECONNRESET = Constant('ECONNRESET',104) +ENOBUFS = Constant('ENOBUFS',105) +EISCONN = Constant('EISCONN',106) +ENOTCONN = Constant('ENOTCONN',107) +ESHUTDOWN = Constant('ESHUTDOWN',108) +ETOOMANYREFS = Constant('ETOOMANYREFS',109) +ETIMEDOUT = Constant('ETIMEDOUT',110) +ECONNREFUSED = Constant('ECONNREFUSED',111) +EHOSTDOWN = Constant('EHOSTDOWN',112) +EHOSTUNREACH = Constant('EHOSTUNREACH',113) +EALREADY = Constant('EALREADY',114) +EINPROGRESS = Constant('EINPROGRESS',115) +ESTALE = Constant('ESTALE',116) +EUCLEAN = Constant('EUCLEAN',117) +ENOTNAM = Constant('ENOTNAM',118) +ENAVAIL = Constant('ENAVAIL',119) +EISNAM = Constant('EISNAM',120) +EREMOTEIO = Constant('EREMOTEIO',121) +EDQUOT = Constant('EDQUOT',122) +ENOMEDIUM = Constant('ENOMEDIUM',123) +EMEDIUMTYPE = Constant('EMEDIUMTYPE',124) +ECANCELED = Constant('ECANCELED',125) +ENOKEY = Constant('ENOKEY',126) +EKEYEXPIRED = Constant('EKEYEXPIRED',127) +EKEYREVOKED = Constant('EKEYREVOKED',128) +EKEYREJECTED = Constant('EKEYREJECTED',129) +EOWNERDEAD = Constant('EOWNERDEAD',130) +ENOTRECOVERABLE = Constant('ENOTRECOVERABLE',131) +ERFKILL = Constant('ERFKILL',132) +EHWPOISON = Constant('EHWPOISON',133) +__SYS_NERR = Constant('__SYS_NERR',((133) + 1)) +__LITTLE_ENDIAN = Constant('__LITTLE_ENDIAN',1234) +__BIG_ENDIAN = Constant('__BIG_ENDIAN',4321) +__BYTE_ORDER = Constant('__BYTE_ORDER',4321) +__FLOAT_WORD_ORDER = Constant('__FLOAT_WORD_ORDER',4321) +LITTLE_ENDIAN = Constant('LITTLE_ENDIAN',1234) +BIG_ENDIAN = Constant('BIG_ENDIAN',4321) +BYTE_ORDER = Constant('BYTE_ORDER',4321) +__WORDSIZE = Constant('__WORDSIZE',32) +INT8_MAX = Constant('INT8_MAX',(127)) +INT16_MAX = Constant('INT16_MAX',(32767)) +INT32_MAX = Constant('INT32_MAX',(2147483647)) +INT64_MAX = Constant('INT64_MAX',(9223372036854775807)) +INT8_MIN = Constant('INT8_MIN',(-1 - (127))) +INT16_MIN = Constant('INT16_MIN',(-1 - (32767))) +INT32_MIN = Constant('INT32_MIN',(-1 - (2147483647))) +INT64_MIN = Constant('INT64_MIN',(-1 - (9223372036854775807))) +INT_LEAST8_MAX = Constant('INT_LEAST8_MAX',(127)) +INT_LEAST8_MIN = Constant('INT_LEAST8_MIN',(-1 - (127))) +INT_LEAST16_MAX = Constant('INT_LEAST16_MAX',(32767)) +INT_LEAST16_MIN = Constant('INT_LEAST16_MIN',(-1 - (32767))) +INT_LEAST32_MAX = Constant('INT_LEAST32_MAX',(2147483647)) +INT_LEAST32_MIN = Constant('INT_LEAST32_MIN',(-1 - (2147483647))) +INT_LEAST64_MAX = Constant('INT_LEAST64_MAX',(9223372036854775807)) +INT_LEAST64_MIN = Constant('INT_LEAST64_MIN',(-1 - (9223372036854775807))) +UINT8_MAX = Constant('UINT8_MAX',0xff) +UINT16_MAX = Constant('UINT16_MAX',0xffff) +UINT32_MAX = Constant('UINT32_MAX',0xffffffff) +UINT64_MAX = Constant('UINT64_MAX',0xffffffffffffffff) +UINT_LEAST8_MAX = Constant('UINT_LEAST8_MAX',0xff) +UINT_LEAST16_MAX = Constant('UINT_LEAST16_MAX',0xffff) +UINT_LEAST32_MAX = Constant('UINT_LEAST32_MAX',0xffffffff) +UINT_LEAST64_MAX = Constant('UINT_LEAST64_MAX',0xffffffffffffffff) +INTPTR_MIN = Constant('INTPTR_MIN',(-1 - (2147483647))) +INTPTR_MAX = Constant('INTPTR_MAX',(2147483647)) +UINTPTR_MAX = Constant('UINTPTR_MAX',0xffffffff) +SIZE_MAX = Constant('SIZE_MAX',0xffffffff) +PTRDIFF_MIN = Constant('PTRDIFF_MIN',(-1 - (2147483647))) +PTRDIFF_MAX = Constant('PTRDIFF_MAX',(2147483647)) +INTMAX_MIN = Constant('INTMAX_MIN',(-1 - (9223372036854775807))) +INTMAX_MAX = Constant('INTMAX_MAX',(9223372036854775807)) +UINTMAX_MAX = Constant('UINTMAX_MAX',0xffffffffffffffff) +INT_FAST8_MIN = Constant('INT_FAST8_MIN',(-1 - (127))) +INT_FAST8_MAX = Constant('INT_FAST8_MAX',(127)) +INT_FAST64_MIN = Constant('INT_FAST64_MIN',(-1 - (9223372036854775807))) +INT_FAST64_MAX = Constant('INT_FAST64_MAX',(9223372036854775807)) +UINT_FAST8_MAX = Constant('UINT_FAST8_MAX',0xff) +UINT_FAST64_MAX = Constant('UINT_FAST64_MAX',0xffffffffffffffff) +INT_FAST16_MIN = Constant('INT_FAST16_MIN',(-1 - (2147483647))) +INT_FAST16_MAX = Constant('INT_FAST16_MAX',(2147483647)) +UINT_FAST16_MAX = Constant('UINT_FAST16_MAX',0xffffffff) +INT_FAST32_MIN = Constant('INT_FAST32_MIN',(-1 - (2147483647))) +INT_FAST32_MAX = Constant('INT_FAST32_MAX',(2147483647)) +UINT_FAST32_MAX = Constant('UINT_FAST32_MAX',0xffffffff) +WINT_MIN = Constant('WINT_MIN',0) +__FSUID_H = Constant('__FSUID_H',1) +NSIG = Constant('NSIG',32) +_NSIG = Constant('_NSIG',65) +SIGHUP = Constant('SIGHUP',1) +SIGINT = Constant('SIGINT',2) +SIGQUIT = Constant('SIGQUIT',3) +SIGILL = Constant('SIGILL',4) +SIGTRAP = Constant('SIGTRAP',5) +SIGABRT = Constant('SIGABRT',6) +SIGIOT = Constant('SIGIOT',6) +SIGFPE = Constant('SIGFPE',8) +SIGKILL = Constant('SIGKILL',9) +SIGSEGV = Constant('SIGSEGV',11) +SIGPIPE = Constant('SIGPIPE',13) +SIGALRM = Constant('SIGALRM',14) +SIGTERM = Constant('SIGTERM',15) +SIGUNUSED = Constant('SIGUNUSED',31) +SIGRTMIN = Constant('SIGRTMIN',32) +SIGRTMAX = Constant('SIGRTMAX',(65-1)) +SA_NOCLDSTOP = Constant('SA_NOCLDSTOP',0x00000001) +SA_NOCLDWAIT = Constant('SA_NOCLDWAIT',0x00000002) +SA_SIGINFO = Constant('SA_SIGINFO',0x00000004) +SA_RESTORER = Constant('SA_RESTORER',0x04000000) +SA_ONSTACK = Constant('SA_ONSTACK',0x08000000) +SA_RESTART = Constant('SA_RESTART',0x10000000) +SA_INTERRUPT = Constant('SA_INTERRUPT',0x20000000) +SA_NODEFER = Constant('SA_NODEFER',0x40000000) +SA_RESETHAND = Constant('SA_RESETHAND',0x80000000) +SA_NOMASK = Constant('SA_NOMASK',0x40000000) +SA_ONESHOT = Constant('SA_ONESHOT',0x80000000) +SS_ONSTACK = Constant('SS_ONSTACK',1) +SS_DISABLE = Constant('SS_DISABLE',2) +MINSIGSTKSZ = Constant('MINSIGSTKSZ',2048) +SIGSTKSZ = Constant('SIGSTKSZ',8192) +SIG_BLOCK = Constant('SIG_BLOCK',0) +SIG_UNBLOCK = Constant('SIG_UNBLOCK',1) +SIG_SETMASK = Constant('SIG_SETMASK',2) +SI_MAX_SIZE = Constant('SI_MAX_SIZE',128) +SIGEV_SIGNAL = Constant('SIGEV_SIGNAL',0) +SIGEV_NONE = Constant('SIGEV_NONE',1) +SIGEV_THREAD = Constant('SIGEV_THREAD',2) +SIGEV_THREAD_ID = Constant('SIGEV_THREAD_ID',4) +SIGEV_MAX_SIZE = Constant('SIGEV_MAX_SIZE',64) +_SYS_TIME_H = Constant('_SYS_TIME_H',1) +ITIMER_REAL = Constant('ITIMER_REAL',0) +ITIMER_VIRTUAL = Constant('ITIMER_VIRTUAL',1) +ITIMER_PROF = Constant('ITIMER_PROF',2) +FD_SETSIZE = Constant('FD_SETSIZE',1024) +R_OK = Constant('R_OK',4) +W_OK = Constant('W_OK',2) +X_OK = Constant('X_OK',1) +F_OK = Constant('F_OK',0) +SEEK_SET = Constant('SEEK_SET',0) +SEEK_CUR = Constant('SEEK_CUR',1) +SEEK_END = Constant('SEEK_END',2) +STDIN_FILENO = Constant('STDIN_FILENO',0) +STDOUT_FILENO = Constant('STDOUT_FILENO',1) +STDERR_FILENO = Constant('STDERR_FILENO',2) +_CS_PATH = Constant('_CS_PATH',1) +_SC_CLK_TCK = Constant('_SC_CLK_TCK',1) +_SC_ARG_MAX = Constant('_SC_ARG_MAX',2) +_SC_NGROUPS_MAX = Constant('_SC_NGROUPS_MAX',3) +_SC_OPEN_MAX = Constant('_SC_OPEN_MAX',4) +_SC_PAGESIZE = Constant('_SC_PAGESIZE',5) +_SC_NPROCESSORS_ONLN = Constant('_SC_NPROCESSORS_ONLN',6) +_SC_NPROCESSORS_CONF = Constant('_SC_NPROCESSORS_CONF',6) +_SC_PHYS_PAGES = Constant('_SC_PHYS_PAGES',7) +_SC_GETPW_R_SIZE_MAX = Constant('_SC_GETPW_R_SIZE_MAX',8) +_SC_GETGR_R_SIZE_MAX = Constant('_SC_GETGR_R_SIZE_MAX',9) +_PC_PATH_MAX = Constant('_PC_PATH_MAX',1) +_PC_VDISABLE = Constant('_PC_VDISABLE',2) +L_cuserid = Constant('L_cuserid',17) +_POSIX_VERSION = Constant('_POSIX_VERSION',199506) +F_ULOCK = Constant('F_ULOCK',0) +F_LOCK = Constant('F_LOCK',1) +F_TLOCK = Constant('F_TLOCK',2) +F_TEST = Constant('F_TEST',3) +_POSIX_MAPPED_FILES = Constant('_POSIX_MAPPED_FILES',200809) +S_IFMT = Constant('S_IFMT',0o0170000) +S_IFSOCK = Constant('S_IFSOCK',0o140000) +S_IFLNK = Constant('S_IFLNK',0o120000) +S_IFREG = Constant('S_IFREG',0o100000) +S_IFBLK = Constant('S_IFBLK',0o060000) +S_IFDIR = Constant('S_IFDIR',0o040000) +S_IFCHR = Constant('S_IFCHR',0o020000) +S_IFIFO = Constant('S_IFIFO',0o010000) +S_ISUID = Constant('S_ISUID',0o004000) +S_ISGID = Constant('S_ISGID',0o002000) +S_ISVTX = Constant('S_ISVTX',0o001000) +S_IRWXU = Constant('S_IRWXU',0o0700) +S_IRUSR = Constant('S_IRUSR',0o0400) +S_IWUSR = Constant('S_IWUSR',0o0200) +S_IXUSR = Constant('S_IXUSR',0o0100) +S_IRWXG = Constant('S_IRWXG',0o0070) +S_IRGRP = Constant('S_IRGRP',0o0040) +S_IWGRP = Constant('S_IWGRP',0o0020) +S_IXGRP = Constant('S_IXGRP',0o0010) +S_IRWXO = Constant('S_IRWXO',0o0007) +S_IROTH = Constant('S_IROTH',0o0004) +S_IWOTH = Constant('S_IWOTH',0o0002) +S_IXOTH = Constant('S_IXOTH',0o0001) +S_IREAD = Constant('S_IREAD',0o0400) +S_IWRITE = Constant('S_IWRITE',0o0200) +S_IEXEC = Constant('S_IEXEC',0o0100) +_SYS_UIO = Constant('_SYS_UIO',1) +SOL_SOCKET = Constant('SOL_SOCKET',1) +SO_DEBUG = Constant('SO_DEBUG',1) +SO_REUSEADDR = Constant('SO_REUSEADDR',2) +SO_TYPE = Constant('SO_TYPE',3) +SO_ERROR = Constant('SO_ERROR',4) +SO_DONTROUTE = Constant('SO_DONTROUTE',5) +SO_BROADCAST = Constant('SO_BROADCAST',6) +SO_SNDBUF = Constant('SO_SNDBUF',7) +SO_RCVBUF = Constant('SO_RCVBUF',8) +SO_KEEPALIVE = Constant('SO_KEEPALIVE',9) +SO_OOBINLINE = Constant('SO_OOBINLINE',10) +SO_NO_CHECK = Constant('SO_NO_CHECK',11) +SO_PRIORITY = Constant('SO_PRIORITY',12) +SO_LINGER = Constant('SO_LINGER',13) +SO_BSDCOMPAT = Constant('SO_BSDCOMPAT',14) +SO_REUSEPORT = Constant('SO_REUSEPORT',15) +SO_PASSCRED = Constant('SO_PASSCRED',16) +SO_PEERCRED = Constant('SO_PEERCRED',17) +SO_RCVLOWAT = Constant('SO_RCVLOWAT',18) +SO_SNDLOWAT = Constant('SO_SNDLOWAT',19) +SO_RCVTIMEO = Constant('SO_RCVTIMEO',20) +SO_SNDTIMEO = Constant('SO_SNDTIMEO',21) +SO_SECURITY_AUTHENTICATION = Constant('SO_SECURITY_AUTHENTICATION',22) +SO_SECURITY_ENCRYPTION_TRANSPORT = Constant('SO_SECURITY_ENCRYPTION_TRANSPORT',23) +SO_SECURITY_ENCRYPTION_NETWORK = Constant('SO_SECURITY_ENCRYPTION_NETWORK',24) +SO_BINDTODEVICE = Constant('SO_BINDTODEVICE',25) +SO_ATTACH_FILTER = Constant('SO_ATTACH_FILTER',26) +SO_DETACH_FILTER = Constant('SO_DETACH_FILTER',27) +SO_GET_FILTER = Constant('SO_GET_FILTER',26) +SO_PEERNAME = Constant('SO_PEERNAME',28) +SO_TIMESTAMP = Constant('SO_TIMESTAMP',29) +SCM_TIMESTAMP = Constant('SCM_TIMESTAMP',29) +SO_ACCEPTCONN = Constant('SO_ACCEPTCONN',30) +SO_PEERSEC = Constant('SO_PEERSEC',31) +SO_SNDBUFFORCE = Constant('SO_SNDBUFFORCE',32) +SO_RCVBUFFORCE = Constant('SO_RCVBUFFORCE',33) +SO_PASSSEC = Constant('SO_PASSSEC',34) +SO_TIMESTAMPNS = Constant('SO_TIMESTAMPNS',35) +SCM_TIMESTAMPNS = Constant('SCM_TIMESTAMPNS',35) +SO_MARK = Constant('SO_MARK',36) +SO_TIMESTAMPING = Constant('SO_TIMESTAMPING',37) +SCM_TIMESTAMPING = Constant('SCM_TIMESTAMPING',37) +SO_PROTOCOL = Constant('SO_PROTOCOL',38) +SO_DOMAIN = Constant('SO_DOMAIN',39) +SO_RXQ_OVFL = Constant('SO_RXQ_OVFL',40) +SO_WIFI_STATUS = Constant('SO_WIFI_STATUS',41) +SCM_WIFI_STATUS = Constant('SCM_WIFI_STATUS',41) +SO_PEEK_OFF = Constant('SO_PEEK_OFF',42) +SO_NOFCS = Constant('SO_NOFCS',43) +SO_LOCK_FILTER = Constant('SO_LOCK_FILTER',44) +SO_SELECT_ERR_QUEUE = Constant('SO_SELECT_ERR_QUEUE',45) +SO_BUSY_POLL = Constant('SO_BUSY_POLL',46) +SO_MAX_PACING_RATE = Constant('SO_MAX_PACING_RATE',47) +SO_BPF_EXTENSIONS = Constant('SO_BPF_EXTENSIONS',48) +SO_INCOMING_CPU = Constant('SO_INCOMING_CPU',49) +SO_ATTACH_BPF = Constant('SO_ATTACH_BPF',50) +SO_DETACH_BPF = Constant('SO_DETACH_BPF',27) +SO_ATTACH_REUSEPORT_CBPF = Constant('SO_ATTACH_REUSEPORT_CBPF',51) +SO_ATTACH_REUSEPORT_EBPF = Constant('SO_ATTACH_REUSEPORT_EBPF',52) +SO_CNX_ADVICE = Constant('SO_CNX_ADVICE',53) +SCM_TIMESTAMPING_OPT_STATS = Constant('SCM_TIMESTAMPING_OPT_STATS',54) +SO_MEMINFO = Constant('SO_MEMINFO',55) +SO_INCOMING_NAPI_ID = Constant('SO_INCOMING_NAPI_ID',56) +SO_COOKIE = Constant('SO_COOKIE',57) +SCM_TIMESTAMPING_PKTINFO = Constant('SCM_TIMESTAMPING_PKTINFO',58) +SO_PEERGROUPS = Constant('SO_PEERGROUPS',59) +SO_ZEROCOPY = Constant('SO_ZEROCOPY',60) +SOCK_STREAM = Constant('SOCK_STREAM',1) +SOCK_DGRAM = Constant('SOCK_DGRAM',2) +SOCK_RAW = Constant('SOCK_RAW',3) +SOCK_RDM = Constant('SOCK_RDM',4) +SOCK_SEQPACKET = Constant('SOCK_SEQPACKET',5) +SOCK_DCCP = Constant('SOCK_DCCP',6) +SOCK_PACKET = Constant('SOCK_PACKET',10) +UIO_FASTIOV = Constant('UIO_FASTIOV',8) +UIO_MAXIOV = Constant('UIO_MAXIOV',1024) +SCM_RIGHTS = Constant('SCM_RIGHTS',0x01) +SCM_CREDENTIALS = Constant('SCM_CREDENTIALS',0x02) +SCM_CONNECT = Constant('SCM_CONNECT',0x03) +AF_UNSPEC = Constant('AF_UNSPEC',0) +AF_UNIX = Constant('AF_UNIX',1) +AF_LOCAL = Constant('AF_LOCAL',1) +AF_INET = Constant('AF_INET',2) +AF_AX25 = Constant('AF_AX25',3) +AF_IPX = Constant('AF_IPX',4) +AF_APPLETALK = Constant('AF_APPLETALK',5) +AF_NETROM = Constant('AF_NETROM',6) +AF_BRIDGE = Constant('AF_BRIDGE',7) +AF_ATMPVC = Constant('AF_ATMPVC',8) +AF_X25 = Constant('AF_X25',9) +AF_INET6 = Constant('AF_INET6',10) +AF_ROSE = Constant('AF_ROSE',11) +AF_DECnet = Constant('AF_DECnet',12) +AF_NETBEUI = Constant('AF_NETBEUI',13) +AF_SECURITY = Constant('AF_SECURITY',14) +AF_KEY = Constant('AF_KEY',15) +AF_NETLINK = Constant('AF_NETLINK',16) +AF_ROUTE = Constant('AF_ROUTE',16) +AF_PACKET = Constant('AF_PACKET',17) +AF_ASH = Constant('AF_ASH',18) +AF_ECONET = Constant('AF_ECONET',19) +AF_ATMSVC = Constant('AF_ATMSVC',20) +AF_SNA = Constant('AF_SNA',22) +AF_IRDA = Constant('AF_IRDA',23) +AF_PPPOX = Constant('AF_PPPOX',24) +AF_WANPIPE = Constant('AF_WANPIPE',25) +AF_LLC = Constant('AF_LLC',26) +AF_IB = Constant('AF_IB',27) +AF_MPLS = Constant('AF_MPLS',28) +AF_CAN = Constant('AF_CAN',29) +AF_TIPC = Constant('AF_TIPC',30) +AF_BLUETOOTH = Constant('AF_BLUETOOTH',31) +AF_IUCV = Constant('AF_IUCV',32) +AF_RXRPC = Constant('AF_RXRPC',33) +AF_ISDN = Constant('AF_ISDN',34) +AF_PHONET = Constant('AF_PHONET',35) +AF_IEEE802154 = Constant('AF_IEEE802154',36) +AF_CAIF = Constant('AF_CAIF',37) +AF_ALG = Constant('AF_ALG',38) +AF_NFC = Constant('AF_NFC',39) +AF_VSOCK = Constant('AF_VSOCK',40) +AF_KCM = Constant('AF_KCM',41) +AF_QIPCRTR = Constant('AF_QIPCRTR',42) +AF_SMC = Constant('AF_SMC',43) +AF_MAX = Constant('AF_MAX',44) +PF_UNSPEC = Constant('PF_UNSPEC',0) +PF_UNIX = Constant('PF_UNIX',1) +PF_LOCAL = Constant('PF_LOCAL',1) +PF_INET = Constant('PF_INET',2) +PF_AX25 = Constant('PF_AX25',3) +PF_IPX = Constant('PF_IPX',4) +PF_APPLETALK = Constant('PF_APPLETALK',5) +PF_NETROM = Constant('PF_NETROM',6) +PF_BRIDGE = Constant('PF_BRIDGE',7) +PF_ATMPVC = Constant('PF_ATMPVC',8) +PF_X25 = Constant('PF_X25',9) +PF_INET6 = Constant('PF_INET6',10) +PF_ROSE = Constant('PF_ROSE',11) +PF_DECnet = Constant('PF_DECnet',12) +PF_NETBEUI = Constant('PF_NETBEUI',13) +PF_SECURITY = Constant('PF_SECURITY',14) +PF_KEY = Constant('PF_KEY',15) +PF_NETLINK = Constant('PF_NETLINK',16) +PF_ROUTE = Constant('PF_ROUTE',16) +PF_PACKET = Constant('PF_PACKET',17) +PF_ASH = Constant('PF_ASH',18) +PF_ECONET = Constant('PF_ECONET',19) +PF_ATMSVC = Constant('PF_ATMSVC',20) +PF_SNA = Constant('PF_SNA',22) +PF_IRDA = Constant('PF_IRDA',23) +PF_PPPOX = Constant('PF_PPPOX',24) +PF_WANPIPE = Constant('PF_WANPIPE',25) +PF_LLC = Constant('PF_LLC',26) +PF_IB = Constant('PF_IB',27) +PF_MPLS = Constant('PF_MPLS',28) +PF_CAN = Constant('PF_CAN',29) +PF_TIPC = Constant('PF_TIPC',30) +PF_BLUETOOTH = Constant('PF_BLUETOOTH',31) +PF_IUCV = Constant('PF_IUCV',32) +PF_RXRPC = Constant('PF_RXRPC',33) +PF_ISDN = Constant('PF_ISDN',34) +PF_PHONET = Constant('PF_PHONET',35) +PF_IEEE802154 = Constant('PF_IEEE802154',36) +PF_CAIF = Constant('PF_CAIF',37) +PF_ALG = Constant('PF_ALG',38) +PF_NFC = Constant('PF_NFC',39) +PF_VSOCK = Constant('PF_VSOCK',40) +PF_KCM = Constant('PF_KCM',41) +PF_QIPCRTR = Constant('PF_QIPCRTR',42) +PF_SMC = Constant('PF_SMC',43) +PF_MAX = Constant('PF_MAX',44) +SOMAXCONN = Constant('SOMAXCONN',128) +MSG_OOB = Constant('MSG_OOB',1) +MSG_PEEK = Constant('MSG_PEEK',2) +MSG_DONTROUTE = Constant('MSG_DONTROUTE',4) +MSG_TRYHARD = Constant('MSG_TRYHARD',4) +MSG_CTRUNC = Constant('MSG_CTRUNC',8) +MSG_PROBE = Constant('MSG_PROBE',0x10) +MSG_TRUNC = Constant('MSG_TRUNC',0x20) +MSG_DONTWAIT = Constant('MSG_DONTWAIT',0x40) +MSG_EOR = Constant('MSG_EOR',0x80) +MSG_WAITALL = Constant('MSG_WAITALL',0x100) +MSG_FIN = Constant('MSG_FIN',0x200) +MSG_SYN = Constant('MSG_SYN',0x400) +MSG_CONFIRM = Constant('MSG_CONFIRM',0x800) +MSG_RST = Constant('MSG_RST',0x1000) +MSG_ERRQUEUE = Constant('MSG_ERRQUEUE',0x2000) +MSG_NOSIGNAL = Constant('MSG_NOSIGNAL',0x4000) +MSG_MORE = Constant('MSG_MORE',0x8000) +MSG_WAITFORONE = Constant('MSG_WAITFORONE',0x10000) +MSG_SENDPAGE_NOTLAST = Constant('MSG_SENDPAGE_NOTLAST',0x20000) +MSG_BATCH = Constant('MSG_BATCH',0x40000) +MSG_EOF = Constant('MSG_EOF',0x200) +MSG_ZEROCOPY = Constant('MSG_ZEROCOPY',0x4000000) +MSG_FASTOPEN = Constant('MSG_FASTOPEN',0x20000000) +MSG_CMSG_CLOEXEC = Constant('MSG_CMSG_CLOEXEC',0x40000000) +SOL_IP = Constant('SOL_IP',0) +SOL_TCP = Constant('SOL_TCP',6) +SOL_UDP = Constant('SOL_UDP',17) +SOL_IPV6 = Constant('SOL_IPV6',41) +SOL_ICMPV6 = Constant('SOL_ICMPV6',58) +SOL_SCTP = Constant('SOL_SCTP',132) +SOL_UDPLITE = Constant('SOL_UDPLITE',136) +SOL_RAW = Constant('SOL_RAW',255) +SOL_IPX = Constant('SOL_IPX',256) +SOL_AX25 = Constant('SOL_AX25',257) +SOL_ATALK = Constant('SOL_ATALK',258) +SOL_NETROM = Constant('SOL_NETROM',259) +SOL_ROSE = Constant('SOL_ROSE',260) +SOL_DECNET = Constant('SOL_DECNET',261) +SOL_X25 = Constant('SOL_X25',262) +SOL_PACKET = Constant('SOL_PACKET',263) +SOL_ATM = Constant('SOL_ATM',264) +SOL_AAL = Constant('SOL_AAL',265) +SOL_IRDA = Constant('SOL_IRDA',266) +SOL_NETBEUI = Constant('SOL_NETBEUI',267) +SOL_LLC = Constant('SOL_LLC',268) +SOL_DCCP = Constant('SOL_DCCP',269) +SOL_NETLINK = Constant('SOL_NETLINK',270) +SOL_TIPC = Constant('SOL_TIPC',271) +SOL_RXRPC = Constant('SOL_RXRPC',272) +SOL_PPPOL2TP = Constant('SOL_PPPOL2TP',273) +SOL_BLUETOOTH = Constant('SOL_BLUETOOTH',274) +SOL_PNPIPE = Constant('SOL_PNPIPE',275) +SOL_RDS = Constant('SOL_RDS',276) +SOL_IUCV = Constant('SOL_IUCV',277) +SOL_CAIF = Constant('SOL_CAIF',278) +SOL_ALG = Constant('SOL_ALG',279) +SOL_NFC = Constant('SOL_NFC',280) +SOL_KCM = Constant('SOL_KCM',281) +SOL_TLS = Constant('SOL_TLS',282) +IPX_TYPE = Constant('IPX_TYPE',1) +SHUT_RD = Constant('SHUT_RD',0) +SHUT_WR = Constant('SHUT_WR',1) +SHUT_RDWR = Constant('SHUT_RDWR',2) +NI_NOFQDN = Constant('NI_NOFQDN',1) +NI_NUMERICHOST = Constant('NI_NUMERICHOST',2) +NI_NAMEREQD = Constant('NI_NAMEREQD',4) +NI_NUMERICSERV = Constant('NI_NUMERICSERV',8) +NI_DGRAM = Constant('NI_DGRAM',16) +EAI_FAMILY = Constant('EAI_FAMILY',-1) +EAI_SOCKTYPE = Constant('EAI_SOCKTYPE',-2) +EAI_BADFLAGS = Constant('EAI_BADFLAGS',-3) +EAI_NONAME = Constant('EAI_NONAME',-4) +EAI_SERVICE = Constant('EAI_SERVICE',-5) +EAI_ADDRFAMILY = Constant('EAI_ADDRFAMILY',-6) +EAI_NODATA = Constant('EAI_NODATA',-7) +EAI_MEMORY = Constant('EAI_MEMORY',-8) +EAI_FAIL = Constant('EAI_FAIL',-9) +EAI_AGAIN = Constant('EAI_AGAIN',-10) +EAI_SYSTEM = Constant('EAI_SYSTEM',-11) +AI_NUMERICHOST = Constant('AI_NUMERICHOST',1) +AI_CANONNAME = Constant('AI_CANONNAME',2) +AI_PASSIVE = Constant('AI_PASSIVE',4) +AI_NUMERICSERV = Constant('AI_NUMERICSERV',8) +AI_ADDRCONFIG = Constant('AI_ADDRCONFIG',16) +AI_V4MAPPED = Constant('AI_V4MAPPED',32) +AI_ALL = Constant('AI_ALL',64) +SIOCADDRT = Constant('SIOCADDRT',0x890B) +SIOCDELRT = Constant('SIOCDELRT',0x890C) +SIOCRTMSG = Constant('SIOCRTMSG',0x890D) +SIOCGIFNAME = Constant('SIOCGIFNAME',0x8910) +SIOCSIFLINK = Constant('SIOCSIFLINK',0x8911) +SIOCGIFCONF = Constant('SIOCGIFCONF',0x8912) +SIOCGIFFLAGS = Constant('SIOCGIFFLAGS',0x8913) +SIOCSIFFLAGS = Constant('SIOCSIFFLAGS',0x8914) +SIOCGIFADDR = Constant('SIOCGIFADDR',0x8915) +SIOCSIFADDR = Constant('SIOCSIFADDR',0x8916) +SIOCGIFDSTADDR = Constant('SIOCGIFDSTADDR',0x8917) +SIOCSIFDSTADDR = Constant('SIOCSIFDSTADDR',0x8918) +SIOCGIFBRDADDR = Constant('SIOCGIFBRDADDR',0x8919) +SIOCSIFBRDADDR = Constant('SIOCSIFBRDADDR',0x891a) +SIOCGIFNETMASK = Constant('SIOCGIFNETMASK',0x891b) +SIOCSIFNETMASK = Constant('SIOCSIFNETMASK',0x891c) +SIOCGIFMETRIC = Constant('SIOCGIFMETRIC',0x891d) +SIOCSIFMETRIC = Constant('SIOCSIFMETRIC',0x891e) +SIOCGIFMEM = Constant('SIOCGIFMEM',0x891f) +SIOCSIFMEM = Constant('SIOCSIFMEM',0x8920) +SIOCGIFMTU = Constant('SIOCGIFMTU',0x8921) +SIOCSIFMTU = Constant('SIOCSIFMTU',0x8922) +SIOCSIFNAME = Constant('SIOCSIFNAME',0x8923) +SIOCSIFHWADDR = Constant('SIOCSIFHWADDR',0x8924) +SIOCGIFENCAP = Constant('SIOCGIFENCAP',0x8925) +SIOCSIFENCAP = Constant('SIOCSIFENCAP',0x8926) +SIOCGIFHWADDR = Constant('SIOCGIFHWADDR',0x8927) +SIOCGIFSLAVE = Constant('SIOCGIFSLAVE',0x8929) +SIOCSIFSLAVE = Constant('SIOCSIFSLAVE',0x8930) +SIOCADDMULTI = Constant('SIOCADDMULTI',0x8931) +SIOCDELMULTI = Constant('SIOCDELMULTI',0x8932) +SIOCGIFINDEX = Constant('SIOCGIFINDEX',0x8933) +SIOGIFINDEX = Constant('SIOGIFINDEX',0x8933) +SIOCSIFPFLAGS = Constant('SIOCSIFPFLAGS',0x8934) +SIOCGIFPFLAGS = Constant('SIOCGIFPFLAGS',0x8935) +SIOCDIFADDR = Constant('SIOCDIFADDR',0x8936) +SIOCSIFHWBROADCAST = Constant('SIOCSIFHWBROADCAST',0x8937) +SIOCGIFCOUNT = Constant('SIOCGIFCOUNT',0x8938) +SIOCGIFBR = Constant('SIOCGIFBR',0x8940) +SIOCSIFBR = Constant('SIOCSIFBR',0x8941) +SIOCGIFTXQLEN = Constant('SIOCGIFTXQLEN',0x8942) +SIOCSIFTXQLEN = Constant('SIOCSIFTXQLEN',0x8943) +SIOCGIFDIVERT = Constant('SIOCGIFDIVERT',0x8944) +SIOCSIFDIVERT = Constant('SIOCSIFDIVERT',0x8945) +SIOCETHTOOL = Constant('SIOCETHTOOL',0x8946) +SIOCDARP = Constant('SIOCDARP',0x8953) +SIOCGARP = Constant('SIOCGARP',0x8954) +SIOCSARP = Constant('SIOCSARP',0x8955) +SIOCDRARP = Constant('SIOCDRARP',0x8960) +SIOCGRARP = Constant('SIOCGRARP',0x8961) +SIOCSRARP = Constant('SIOCSRARP',0x8962) +SIOCGIFMAP = Constant('SIOCGIFMAP',0x8970) +SIOCSIFMAP = Constant('SIOCSIFMAP',0x8971) +SIOCADDDLCI = Constant('SIOCADDDLCI',0x8980) +SIOCDELDLCI = Constant('SIOCDELDLCI',0x8981) +SIOCDEVPRIVATE = Constant('SIOCDEVPRIVATE',0x89F0) +F_LINUX_SPECIFIC_BASE = Constant('F_LINUX_SPECIFIC_BASE',1024) +F_SETOWN_EX = Constant('F_SETOWN_EX',15) +F_GETOWN_EX = Constant('F_GETOWN_EX',16) +F_GETOWNER_UIDS = Constant('F_GETOWNER_UIDS',17) +F_OFD_GETLK = Constant('F_OFD_GETLK',36) +F_OFD_SETLK = Constant('F_OFD_SETLK',37) +F_OFD_SETLKW = Constant('F_OFD_SETLKW',38) +F_OWNER_TID = Constant('F_OWNER_TID',0) +F_OWNER_PID = Constant('F_OWNER_PID',1) +F_OWNER_PGRP = Constant('F_OWNER_PGRP',2) +AT_FDCWD = Constant('AT_FDCWD',-100) +AT_SYMLINK_NOFOLLOW = Constant('AT_SYMLINK_NOFOLLOW',0x100) +AT_REMOVEDIR = Constant('AT_REMOVEDIR',0x200) +AT_SYMLINK_FOLLOW = Constant('AT_SYMLINK_FOLLOW',0x400) +AT_NO_AUTOMOUNT = Constant('AT_NO_AUTOMOUNT',0x800) +AT_EMPTY_PATH = Constant('AT_EMPTY_PATH',0x1000) +AT_EACCESS = Constant('AT_EACCESS',0x200) +MREMAP_MAYMOVE = Constant('MREMAP_MAYMOVE',1) +MREMAP_FIXED = Constant('MREMAP_FIXED',2) +PROT_READ = Constant('PROT_READ',0x1) +PROT_WRITE = Constant('PROT_WRITE',0x2) +PROT_EXEC = Constant('PROT_EXEC',0x4) +PROT_SEM = Constant('PROT_SEM',0x8) +PROT_NONE = Constant('PROT_NONE',0x0) +PROT_GROWSDOWN = Constant('PROT_GROWSDOWN',0x01000000) +PROT_GROWSUP = Constant('PROT_GROWSUP',0x02000000) +MAP_SHARED = Constant('MAP_SHARED',0x01) +MAP_PRIVATE = Constant('MAP_PRIVATE',0x02) +MAP_TYPE = Constant('MAP_TYPE',0xf) +MADV_REMOVE = Constant('MADV_REMOVE',9) +MADV_DONTFORK = Constant('MADV_DONTFORK',10) +MADV_DOFORK = Constant('MADV_DOFORK',11) +MADV_MERGEABLE = Constant('MADV_MERGEABLE',12) +MADV_UNMERGEABLE = Constant('MADV_UNMERGEABLE',13) +MADV_HUGEPAGE = Constant('MADV_HUGEPAGE',14) +MADV_NOHUGEPAGE = Constant('MADV_NOHUGEPAGE',15) +MADV_DONTDUMP = Constant('MADV_DONTDUMP',16) +MADV_DODUMP = Constant('MADV_DODUMP',17) +MADV_HWPOISON = Constant('MADV_HWPOISON',100) +MADV_SOFT_OFFLINE = Constant('MADV_SOFT_OFFLINE',101) +MLOCK_ONFAULT = Constant('MLOCK_ONFAULT',1) +MAP_FILE = Constant('MAP_FILE',0) +PTRACE_TRACEME = Constant('PTRACE_TRACEME',0) +PTRACE_PEEKTEXT = Constant('PTRACE_PEEKTEXT',1) +PTRACE_PEEKDATA = Constant('PTRACE_PEEKDATA',2) +PTRACE_PEEKUSR = Constant('PTRACE_PEEKUSR',3) +PTRACE_PEEKUSER = Constant('PTRACE_PEEKUSER',3) +PTRACE_POKETEXT = Constant('PTRACE_POKETEXT',4) +PTRACE_POKEDATA = Constant('PTRACE_POKEDATA',5) +PTRACE_POKEUSR = Constant('PTRACE_POKEUSR',6) +PTRACE_POKEUSER = Constant('PTRACE_POKEUSER',6) +PTRACE_CONT = Constant('PTRACE_CONT',7) +PTRACE_KILL = Constant('PTRACE_KILL',8) +PTRACE_SINGLESTEP = Constant('PTRACE_SINGLESTEP',9) +PTRACE_ATTACH = Constant('PTRACE_ATTACH',0x10) +PTRACE_DETACH = Constant('PTRACE_DETACH',0x11) +PTRACE_SYSCALL = Constant('PTRACE_SYSCALL',24) +PTRACE_GETEVENTMSG = Constant('PTRACE_GETEVENTMSG',0x4201) +PTRACE_GETSIGINFO = Constant('PTRACE_GETSIGINFO',0x4202) +PTRACE_SETSIGINFO = Constant('PTRACE_SETSIGINFO',0x4203) +PTRACE_O_TRACESYSGOOD = Constant('PTRACE_O_TRACESYSGOOD',0x00000001) +PTRACE_O_TRACEFORK = Constant('PTRACE_O_TRACEFORK',0x00000002) +PTRACE_O_TRACEVFORK = Constant('PTRACE_O_TRACEVFORK',0x00000004) +PTRACE_O_TRACECLONE = Constant('PTRACE_O_TRACECLONE',0x00000008) +PTRACE_O_TRACEEXEC = Constant('PTRACE_O_TRACEEXEC',0x00000010) +PTRACE_O_TRACEVFORKDONE = Constant('PTRACE_O_TRACEVFORKDONE',0x00000020) +PTRACE_O_TRACEEXIT = Constant('PTRACE_O_TRACEEXIT',0x00000040) +PTRACE_O_MASK = Constant('PTRACE_O_MASK',0x0000007f) +PTRACE_EVENT_FORK = Constant('PTRACE_EVENT_FORK',1) +PTRACE_EVENT_VFORK = Constant('PTRACE_EVENT_VFORK',2) +PTRACE_EVENT_CLONE = Constant('PTRACE_EVENT_CLONE',3) +PTRACE_EVENT_EXEC = Constant('PTRACE_EVENT_EXEC',4) +PTRACE_EVENT_VFORK_DONE = Constant('PTRACE_EVENT_VFORK_DONE',5) +PTRACE_EVENT_EXIT = Constant('PTRACE_EVENT_EXIT',6) +PT_TRACE_ME = Constant('PT_TRACE_ME',0) +PT_READ_I = Constant('PT_READ_I',1) +PT_READ_D = Constant('PT_READ_D',2) +PT_READ_U = Constant('PT_READ_U',3) +PT_WRITE_I = Constant('PT_WRITE_I',4) +PT_WRITE_D = Constant('PT_WRITE_D',5) +PT_WRITE_U = Constant('PT_WRITE_U',6) +PT_CONTINUE = Constant('PT_CONTINUE',7) +PT_KILL = Constant('PT_KILL',8) +PT_STEP = Constant('PT_STEP',9) +PT_ATTACH = Constant('PT_ATTACH',0x10) +PT_DETACH = Constant('PT_DETACH',0x11) +SYS_accept = Constant('SYS_accept',202) +SYS_accept4 = Constant('SYS_accept4',242) +SYS_acct = Constant('SYS_acct',89) +SYS_add_key = Constant('SYS_add_key',217) +SYS_adjtimex = Constant('SYS_adjtimex',171) +SYS_arch_specific_syscall = Constant('SYS_arch_specific_syscall',244) +SYS_bind = Constant('SYS_bind',200) +SYS_bpf = Constant('SYS_bpf',280) +SYS_brk = Constant('SYS_brk',214) +SYS_capget = Constant('SYS_capget',90) +SYS_capset = Constant('SYS_capset',91) +SYS_chdir = Constant('SYS_chdir',49) +SYS_chroot = Constant('SYS_chroot',51) +SYS_clock_adjtime = Constant('SYS_clock_adjtime',266) +SYS_clock_getres = Constant('SYS_clock_getres',114) +SYS_clock_gettime = Constant('SYS_clock_gettime',113) +SYS_clock_nanosleep = Constant('SYS_clock_nanosleep',115) +SYS_clock_settime = Constant('SYS_clock_settime',112) +SYS_clone = Constant('SYS_clone',220) +SYS_clone3 = Constant('SYS_clone3',435) +SYS_close = Constant('SYS_close',57) +SYS_close_range = Constant('SYS_close_range',436) +SYS_connect = Constant('SYS_connect',203) +SYS_copy_file_range = Constant('SYS_copy_file_range',285) +SYS_delete_module = Constant('SYS_delete_module',106) +SYS_dup = Constant('SYS_dup',23) +SYS_dup3 = Constant('SYS_dup3',24) +SYS_epoll_create1 = Constant('SYS_epoll_create1',20) +SYS_epoll_ctl = Constant('SYS_epoll_ctl',21) +SYS_epoll_pwait = Constant('SYS_epoll_pwait',22) +SYS_epoll_pwait2 = Constant('SYS_epoll_pwait2',441) +SYS_eventfd2 = Constant('SYS_eventfd2',19) +SYS_execve = Constant('SYS_execve',221) +SYS_execveat = Constant('SYS_execveat',281) +SYS_exit = Constant('SYS_exit',93) +SYS_exit_group = Constant('SYS_exit_group',94) +SYS_faccessat = Constant('SYS_faccessat',48) +SYS_faccessat2 = Constant('SYS_faccessat2',439) +SYS_fadvise64 = Constant('SYS_fadvise64',223) +SYS_fallocate = Constant('SYS_fallocate',47) +SYS_fanotify_init = Constant('SYS_fanotify_init',262) +SYS_fanotify_mark = Constant('SYS_fanotify_mark',263) +SYS_fchdir = Constant('SYS_fchdir',50) +SYS_fchmod = Constant('SYS_fchmod',52) +SYS_fchmodat = Constant('SYS_fchmodat',53) +SYS_fchown = Constant('SYS_fchown',55) +SYS_fchownat = Constant('SYS_fchownat',54) +SYS_fcntl = Constant('SYS_fcntl',25) +SYS_fdatasync = Constant('SYS_fdatasync',83) +SYS_fgetxattr = Constant('SYS_fgetxattr',10) +SYS_finit_module = Constant('SYS_finit_module',273) +SYS_flistxattr = Constant('SYS_flistxattr',13) +SYS_flock = Constant('SYS_flock',32) +SYS_fremovexattr = Constant('SYS_fremovexattr',16) +SYS_fsconfig = Constant('SYS_fsconfig',431) +SYS_fsetxattr = Constant('SYS_fsetxattr',7) +SYS_fsmount = Constant('SYS_fsmount',432) +SYS_fsopen = Constant('SYS_fsopen',430) +SYS_fspick = Constant('SYS_fspick',433) +SYS_fstat = Constant('SYS_fstat',80) +SYS_fstatfs = Constant('SYS_fstatfs',44) +SYS_fsync = Constant('SYS_fsync',82) +SYS_ftruncate = Constant('SYS_ftruncate',46) +SYS_futex = Constant('SYS_futex',98) +SYS_getcpu = Constant('SYS_getcpu',168) +SYS_getcwd = Constant('SYS_getcwd',17) +SYS_getdents64 = Constant('SYS_getdents64',61) +SYS_getegid = Constant('SYS_getegid',177) +SYS_geteuid = Constant('SYS_geteuid',175) +SYS_getgid = Constant('SYS_getgid',176) +SYS_getgroups = Constant('SYS_getgroups',158) +SYS_getitimer = Constant('SYS_getitimer',102) +SYS_get_mempolicy = Constant('SYS_get_mempolicy',236) +SYS_getpeername = Constant('SYS_getpeername',205) +SYS_getpgid = Constant('SYS_getpgid',155) +SYS_getpid = Constant('SYS_getpid',172) +SYS_getppid = Constant('SYS_getppid',173) +SYS_getpriority = Constant('SYS_getpriority',141) +SYS_getrandom = Constant('SYS_getrandom',278) +SYS_getresgid = Constant('SYS_getresgid',150) +SYS_getresuid = Constant('SYS_getresuid',148) +SYS_getrlimit = Constant('SYS_getrlimit',163) +SYS_get_robust_list = Constant('SYS_get_robust_list',100) +SYS_getrusage = Constant('SYS_getrusage',165) +SYS_getsid = Constant('SYS_getsid',156) +SYS_getsockname = Constant('SYS_getsockname',204) +SYS_getsockopt = Constant('SYS_getsockopt',209) +SYS_gettid = Constant('SYS_gettid',178) +SYS_gettimeofday = Constant('SYS_gettimeofday',169) +SYS_getuid = Constant('SYS_getuid',174) +SYS_getxattr = Constant('SYS_getxattr',8) +SYS_init_module = Constant('SYS_init_module',105) +SYS_inotify_add_watch = Constant('SYS_inotify_add_watch',27) +SYS_inotify_init1 = Constant('SYS_inotify_init1',26) +SYS_inotify_rm_watch = Constant('SYS_inotify_rm_watch',28) +SYS_io_cancel = Constant('SYS_io_cancel',3) +SYS_ioctl = Constant('SYS_ioctl',29) +SYS_io_destroy = Constant('SYS_io_destroy',1) +SYS_io_getevents = Constant('SYS_io_getevents',4) +SYS_io_pgetevents = Constant('SYS_io_pgetevents',292) +SYS_ioprio_get = Constant('SYS_ioprio_get',31) +SYS_ioprio_set = Constant('SYS_ioprio_set',30) +SYS_io_setup = Constant('SYS_io_setup',0) +SYS_io_submit = Constant('SYS_io_submit',2) +SYS_io_uring_enter = Constant('SYS_io_uring_enter',426) +SYS_io_uring_register = Constant('SYS_io_uring_register',427) +SYS_io_uring_setup = Constant('SYS_io_uring_setup',425) +SYS_kcmp = Constant('SYS_kcmp',272) +SYS_kexec_file_load = Constant('SYS_kexec_file_load',294) +SYS_kexec_load = Constant('SYS_kexec_load',104) +SYS_keyctl = Constant('SYS_keyctl',219) +SYS_kill = Constant('SYS_kill',129) +SYS_landlock_add_rule = Constant('SYS_landlock_add_rule',445) +SYS_landlock_create_ruleset = Constant('SYS_landlock_create_ruleset',444) +SYS_landlock_restrict_self = Constant('SYS_landlock_restrict_self',446) +SYS_lgetxattr = Constant('SYS_lgetxattr',9) +SYS_linkat = Constant('SYS_linkat',37) +SYS_listen = Constant('SYS_listen',201) +SYS_listxattr = Constant('SYS_listxattr',11) +SYS_llistxattr = Constant('SYS_llistxattr',12) +SYS_lookup_dcookie = Constant('SYS_lookup_dcookie',18) +SYS_lremovexattr = Constant('SYS_lremovexattr',15) +SYS_lseek = Constant('SYS_lseek',62) +SYS_lsetxattr = Constant('SYS_lsetxattr',6) +SYS_madvise = Constant('SYS_madvise',233) +SYS_mbind = Constant('SYS_mbind',235) +SYS_membarrier = Constant('SYS_membarrier',283) +SYS_memfd_create = Constant('SYS_memfd_create',279) +SYS_migrate_pages = Constant('SYS_migrate_pages',238) +SYS_mincore = Constant('SYS_mincore',232) +SYS_mkdirat = Constant('SYS_mkdirat',34) +SYS_mknodat = Constant('SYS_mknodat',33) +SYS_mlock = Constant('SYS_mlock',228) +SYS_mlock2 = Constant('SYS_mlock2',284) +SYS_mlockall = Constant('SYS_mlockall',230) +SYS_mmap = Constant('SYS_mmap',222) +SYS_mount = Constant('SYS_mount',40) +SYS_mount_setattr = Constant('SYS_mount_setattr',442) +SYS_move_mount = Constant('SYS_move_mount',429) +SYS_move_pages = Constant('SYS_move_pages',239) +SYS_mprotect = Constant('SYS_mprotect',226) +SYS_mq_getsetattr = Constant('SYS_mq_getsetattr',185) +SYS_mq_notify = Constant('SYS_mq_notify',184) +SYS_mq_open = Constant('SYS_mq_open',180) +SYS_mq_timedreceive = Constant('SYS_mq_timedreceive',183) +SYS_mq_timedsend = Constant('SYS_mq_timedsend',182) +SYS_mq_unlink = Constant('SYS_mq_unlink',181) +SYS_mremap = Constant('SYS_mremap',216) +SYS_msgctl = Constant('SYS_msgctl',187) +SYS_msgget = Constant('SYS_msgget',186) +SYS_msgrcv = Constant('SYS_msgrcv',188) +SYS_msgsnd = Constant('SYS_msgsnd',189) +SYS_msync = Constant('SYS_msync',227) +SYS_munlock = Constant('SYS_munlock',229) +SYS_munlockall = Constant('SYS_munlockall',231) +SYS_munmap = Constant('SYS_munmap',215) +SYS_name_to_handle_at = Constant('SYS_name_to_handle_at',264) +SYS_nanosleep = Constant('SYS_nanosleep',101) +SYS_newfstatat = Constant('SYS_newfstatat',79) +SYS_nfsservctl = Constant('SYS_nfsservctl',42) +SYS_openat = Constant('SYS_openat',56) +SYS_openat2 = Constant('SYS_openat2',437) +SYS_open_by_handle_at = Constant('SYS_open_by_handle_at',265) +SYS_open_tree = Constant('SYS_open_tree',428) +SYS_perf_event_open = Constant('SYS_perf_event_open',241) +SYS_personality = Constant('SYS_personality',92) +SYS_pidfd_getfd = Constant('SYS_pidfd_getfd',438) +SYS_pidfd_open = Constant('SYS_pidfd_open',434) +SYS_pidfd_send_signal = Constant('SYS_pidfd_send_signal',424) +SYS_pipe2 = Constant('SYS_pipe2',59) +SYS_pivot_root = Constant('SYS_pivot_root',41) +SYS_pkey_alloc = Constant('SYS_pkey_alloc',289) +SYS_pkey_free = Constant('SYS_pkey_free',290) +SYS_pkey_mprotect = Constant('SYS_pkey_mprotect',288) +SYS_ppoll = Constant('SYS_ppoll',73) +SYS_prctl = Constant('SYS_prctl',167) +SYS_pread64 = Constant('SYS_pread64',67) +SYS_preadv = Constant('SYS_preadv',69) +SYS_preadv2 = Constant('SYS_preadv2',286) +SYS_prlimit64 = Constant('SYS_prlimit64',261) +SYS_process_madvise = Constant('SYS_process_madvise',440) +SYS_process_vm_readv = Constant('SYS_process_vm_readv',270) +SYS_process_vm_writev = Constant('SYS_process_vm_writev',271) +SYS_pselect6 = Constant('SYS_pselect6',72) +SYS_ptrace = Constant('SYS_ptrace',117) +SYS_pwrite64 = Constant('SYS_pwrite64',68) +SYS_pwritev = Constant('SYS_pwritev',70) +SYS_pwritev2 = Constant('SYS_pwritev2',287) +SYS_quotactl = Constant('SYS_quotactl',60) +SYS_read = Constant('SYS_read',63) +SYS_readahead = Constant('SYS_readahead',213) +SYS_readlinkat = Constant('SYS_readlinkat',78) +SYS_readv = Constant('SYS_readv',65) +SYS_reboot = Constant('SYS_reboot',142) +SYS_recvfrom = Constant('SYS_recvfrom',207) +SYS_recvmmsg = Constant('SYS_recvmmsg',243) +SYS_recvmsg = Constant('SYS_recvmsg',212) +SYS_remap_file_pages = Constant('SYS_remap_file_pages',234) +SYS_removexattr = Constant('SYS_removexattr',14) +SYS_renameat2 = Constant('SYS_renameat2',276) +SYS_request_key = Constant('SYS_request_key',218) +SYS_restart_syscall = Constant('SYS_restart_syscall',128) +SYS_riscv_flush_icache = Constant('SYS_riscv_flush_icache',(244 + 15)) +SYS_rseq = Constant('SYS_rseq',293) +SYS_rt_sigaction = Constant('SYS_rt_sigaction',134) +SYS_rt_sigpending = Constant('SYS_rt_sigpending',136) +SYS_rt_sigprocmask = Constant('SYS_rt_sigprocmask',135) +SYS_rt_sigqueueinfo = Constant('SYS_rt_sigqueueinfo',138) +SYS_rt_sigreturn = Constant('SYS_rt_sigreturn',139) +SYS_rt_sigsuspend = Constant('SYS_rt_sigsuspend',133) +SYS_rt_sigtimedwait = Constant('SYS_rt_sigtimedwait',137) +SYS_rt_tgsigqueueinfo = Constant('SYS_rt_tgsigqueueinfo',240) +SYS_sched_getaffinity = Constant('SYS_sched_getaffinity',123) +SYS_sched_getattr = Constant('SYS_sched_getattr',275) +SYS_sched_getparam = Constant('SYS_sched_getparam',121) +SYS_sched_get_priority_max = Constant('SYS_sched_get_priority_max',125) +SYS_sched_get_priority_min = Constant('SYS_sched_get_priority_min',126) +SYS_sched_getscheduler = Constant('SYS_sched_getscheduler',120) +SYS_sched_rr_get_interval = Constant('SYS_sched_rr_get_interval',127) +SYS_sched_setaffinity = Constant('SYS_sched_setaffinity',122) +SYS_sched_setattr = Constant('SYS_sched_setattr',274) +SYS_sched_setparam = Constant('SYS_sched_setparam',118) +SYS_sched_setscheduler = Constant('SYS_sched_setscheduler',119) +SYS_sched_yield = Constant('SYS_sched_yield',124) +SYS_seccomp = Constant('SYS_seccomp',277) +SYS_semctl = Constant('SYS_semctl',191) +SYS_semget = Constant('SYS_semget',190) +SYS_semop = Constant('SYS_semop',193) +SYS_semtimedop = Constant('SYS_semtimedop',192) +SYS_sendfile = Constant('SYS_sendfile',71) +SYS_sendmmsg = Constant('SYS_sendmmsg',269) +SYS_sendmsg = Constant('SYS_sendmsg',211) +SYS_sendto = Constant('SYS_sendto',206) +SYS_setdomainname = Constant('SYS_setdomainname',162) +SYS_setfsgid = Constant('SYS_setfsgid',152) +SYS_setfsuid = Constant('SYS_setfsuid',151) +SYS_setgid = Constant('SYS_setgid',144) +SYS_setgroups = Constant('SYS_setgroups',159) +SYS_sethostname = Constant('SYS_sethostname',161) +SYS_setitimer = Constant('SYS_setitimer',103) +SYS_set_mempolicy = Constant('SYS_set_mempolicy',237) +SYS_setns = Constant('SYS_setns',268) +SYS_setpgid = Constant('SYS_setpgid',154) +SYS_setpriority = Constant('SYS_setpriority',140) +SYS_setregid = Constant('SYS_setregid',143) +SYS_setresgid = Constant('SYS_setresgid',149) +SYS_setresuid = Constant('SYS_setresuid',147) +SYS_setreuid = Constant('SYS_setreuid',145) +SYS_setrlimit = Constant('SYS_setrlimit',164) +SYS_set_robust_list = Constant('SYS_set_robust_list',99) +SYS_setsid = Constant('SYS_setsid',157) +SYS_setsockopt = Constant('SYS_setsockopt',208) +SYS_set_tid_address = Constant('SYS_set_tid_address',96) +SYS_settimeofday = Constant('SYS_settimeofday',170) +SYS_setuid = Constant('SYS_setuid',146) +SYS_setxattr = Constant('SYS_setxattr',5) +SYS_shmat = Constant('SYS_shmat',196) +SYS_shmctl = Constant('SYS_shmctl',195) +SYS_shmdt = Constant('SYS_shmdt',197) +SYS_shmget = Constant('SYS_shmget',194) +SYS_shutdown = Constant('SYS_shutdown',210) +SYS_sigaltstack = Constant('SYS_sigaltstack',132) +SYS_signalfd4 = Constant('SYS_signalfd4',74) +SYS_socket = Constant('SYS_socket',198) +SYS_socketpair = Constant('SYS_socketpair',199) +SYS_splice = Constant('SYS_splice',76) +SYS_statfs = Constant('SYS_statfs',43) +SYS_statx = Constant('SYS_statx',291) +SYS_swapoff = Constant('SYS_swapoff',225) +SYS_swapon = Constant('SYS_swapon',224) +SYS_symlinkat = Constant('SYS_symlinkat',36) +SYS_sync = Constant('SYS_sync',81) +SYS_sync_file_range = Constant('SYS_sync_file_range',84) +SYS_syncfs = Constant('SYS_syncfs',267) +SYS_sysinfo = Constant('SYS_sysinfo',179) +SYS_syslog = Constant('SYS_syslog',116) +SYS_sysriscv = Constant('SYS_sysriscv',244) +SYS_tee = Constant('SYS_tee',77) +SYS_tgkill = Constant('SYS_tgkill',131) +SYS_timer_create = Constant('SYS_timer_create',107) +SYS_timer_delete = Constant('SYS_timer_delete',111) +SYS_timerfd_create = Constant('SYS_timerfd_create',85) +SYS_timerfd_gettime = Constant('SYS_timerfd_gettime',87) +SYS_timerfd_settime = Constant('SYS_timerfd_settime',86) +SYS_timer_getoverrun = Constant('SYS_timer_getoverrun',109) +SYS_timer_gettime = Constant('SYS_timer_gettime',108) +SYS_timer_settime = Constant('SYS_timer_settime',110) +SYS_times = Constant('SYS_times',153) +SYS_tkill = Constant('SYS_tkill',130) +SYS_truncate = Constant('SYS_truncate',45) +SYS_umask = Constant('SYS_umask',166) +SYS_umount2 = Constant('SYS_umount2',39) +SYS_uname = Constant('SYS_uname',160) +SYS_unlinkat = Constant('SYS_unlinkat',35) +SYS_unshare = Constant('SYS_unshare',97) +SYS_userfaultfd = Constant('SYS_userfaultfd',282) +SYS_utimensat = Constant('SYS_utimensat',88) +SYS_vhangup = Constant('SYS_vhangup',58) +SYS_vmsplice = Constant('SYS_vmsplice',75) +SYS_wait4 = Constant('SYS_wait4',260) +SYS_waitid = Constant('SYS_waitid',95) +SYS_write = Constant('SYS_write',64) +SYS_writev = Constant('SYS_writev',66) diff --git a/pwnlib/data/includes/generator/linux/diet/riscv64/syscalls.h b/pwnlib/data/includes/generator/linux/diet/riscv64/syscalls.h new file mode 100644 index 000000000..b534afe81 --- /dev/null +++ b/pwnlib/data/includes/generator/linux/diet/riscv64/syscalls.h @@ -0,0 +1,304 @@ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_io_getevents 4 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_fcntl 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_umount2 39 +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR_statfs 43 +#define __NR_fstatfs 44 +#define __NR_truncate 45 +#define __NR_ftruncate 46 +#define __NR_fallocate 47 +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR_lseek 62 +#define __NR_read 63 +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR_sendfile 71 +#define __NR_pselect6 72 +#define __NR_ppoll 73 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR_newfstatat 79 +#define __NR_fstat 80 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +#define __NR_sync_file_range 84 +#define __NR_timerfd_create 85 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_gettime 87 +#define __NR_utimensat 88 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_futex 98 +#define __NR_set_robust_list 99 +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +#define __NR_timer_gettime 108 +#define __NR_timer_getoverrun 109 +#define __NR_timer_settime 110 +#define __NR_timer_delete 111 +#define __NR_clock_settime 112 +#define __NR_clock_gettime 113 +#define __NR_clock_getres 114 +#define __NR_clock_nanosleep 115 +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_rr_get_interval 127 +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrlimit 163 +#define __NR_setrlimit 164 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +#define __NR_getcpu 168 +#define __NR_gettimeofday 169 +#define __NR_settimeofday 170 +#define __NR_adjtimex 171 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedreceive 183 +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +#define __NR_semtimedop 192 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR_mmap 222 +#define __NR_fadvise64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +#define __NR_move_pages 239 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +#define __NR_accept4 242 +#define __NR_recvmmsg 243 +#define __NR_arch_specific_syscall 244 +#define __NR_wait4 260 +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +#define __NR_open_by_handle_at 265 +#define __NR_clock_adjtime 266 +#define __NR_syncfs 267 +#define __NR_setns 268 +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +#define __NR_finit_module 273 +#define __NR_sched_setattr 274 +#define __NR_sched_getattr 275 +#define __NR_renameat2 276 +#define __NR_seccomp 277 +#define __NR_getrandom 278 +#define __NR_memfd_create 279 +#define __NR_bpf 280 +#define __NR_execveat 281 +#define __NR_userfaultfd 282 +#define __NR_membarrier 283 +#define __NR_mlock2 284 +#define __NR_copy_file_range 285 +#define __NR_preadv2 286 +#define __NR_pwritev2 287 +#define __NR_pkey_mprotect 288 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_statx 291 +#define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 + +#define __NR_sysriscv __NR_arch_specific_syscall +#define __NR_riscv_flush_icache (__NR_sysriscv + 15) diff --git a/pwnlib/data/includes/generator/linux/riscv64.h b/pwnlib/data/includes/generator/linux/riscv64.h new file mode 100644 index 000000000..125c50648 --- /dev/null +++ b/pwnlib/data/includes/generator/linux/riscv64.h @@ -0,0 +1,4 @@ +// https://git.musl-libc.org/cgit/musl/plain/arch/riscv64/bits/syscall.h.in +#define __riscv64__ +#include +#include diff --git a/pwnlib/data/includes/generator/linux/syscall_map.h b/pwnlib/data/includes/generator/linux/syscall_map.h index 028ae0bfa..ec8bd658f 100644 --- a/pwnlib/data/includes/generator/linux/syscall_map.h +++ b/pwnlib/data/includes/generator/linux/syscall_map.h @@ -44,6 +44,7 @@ #define SYS_clone2 __NR_clone2 #define SYS_clone3 __NR_clone3 #define SYS_close __NR_close +#define SYS_close_range __NR_close_range #define SYS_connect __NR_connect #define SYS_copy_file_range __NR_copy_file_range #define SYS_creat __NR_creat @@ -58,6 +59,7 @@ #define SYS_epoll_ctl __NR_epoll_ctl #define SYS_epoll_ctl_old __NR_epoll_ctl_old #define SYS_epoll_pwait __NR_epoll_pwait +#define SYS_epoll_pwait2 __NR_epoll_pwait2 #define SYS_epoll_wait __NR_epoll_wait #define SYS_epoll_wait_old __NR_epoll_wait_old #define SYS_eventfd __NR_eventfd @@ -69,6 +71,7 @@ #define SYS_exit __NR_exit #define SYS_exit_group __NR_exit_group #define SYS_faccessat __NR_faccessat +#define SYS_faccessat2 __NR_faccessat2 #define SYS_fadvise64 __NR_fadvise64 #define SYS_fadvise64_64 __NR_fadvise64_64 #define SYS_fallocate __NR_fallocate @@ -191,6 +194,9 @@ #define SYS_kexec_load __NR_kexec_load #define SYS_keyctl __NR_keyctl #define SYS_kill __NR_kill +#define SYS_landlock_add_rule __NR_landlock_add_rule +#define SYS_landlock_create_ruleset __NR_landlock_create_ruleset +#define SYS_landlock_restrict_self __NR_landlock_restrict_self #define SYS_lchown __NR_lchown #define SYS_lchown32 __NR_lchown32 #define SYS_lgetxattr __NR_lgetxattr @@ -228,6 +234,7 @@ #define SYS_mmap2 __NR_mmap2 #define SYS_modify_ldt __NR_modify_ldt #define SYS_mount __NR_mount +#define SYS_mount_setattr __NR_mount_setattr #define SYS_move_mount __NR_move_mount #define SYS_move_pages __NR_move_pages #define SYS_mprotect __NR_mprotect @@ -402,6 +409,7 @@ #define SYS_preadv __NR_preadv #define SYS_preadv2 __NR_preadv2 #define SYS_prlimit64 __NR_prlimit64 +#define SYS_process_madvise __NR_process_madvise #define SYS_process_vm_readv __NR_process_vm_readv #define SYS_process_vm_writev __NR_process_vm_writev #define SYS_prof __NR_prof @@ -440,6 +448,7 @@ #define SYS_reserved221 __NR_reserved221 #define SYS_reserved82 __NR_reserved82 #define SYS_restart_syscall __NR_restart_syscall +#define SYS_riscv_flush_icache __NR_riscv_flush_icache #define SYS_rmdir __NR_rmdir #define SYS_rseq __NR_rseq #define SYS_rtas __NR_rtas @@ -572,6 +581,7 @@ #define SYS_sys_kexec_load __NR_sys_kexec_load #define SYS_syslog __NR_syslog #define SYS_sysmips __NR_sysmips +#define SYS_sysriscv __NR_sysriscv #define SYS_sys_setaltroot __NR_sys_setaltroot #define SYS_tee __NR_tee #define SYS_tgkill __NR_tgkill diff --git a/pwnlib/data/includes/linux/riscv64.h b/pwnlib/data/includes/linux/riscv64.h new file mode 100644 index 000000000..8151f8bd3 --- /dev/null +++ b/pwnlib/data/includes/linux/riscv64.h @@ -0,0 +1,1305 @@ +#define __NR_io_setup 0 +#define __NR_io_destroy 1 +#define __NR_io_submit 2 +#define __NR_io_cancel 3 +#define __NR_io_getevents 4 +#define __NR_setxattr 5 +#define __NR_lsetxattr 6 +#define __NR_fsetxattr 7 +#define __NR_getxattr 8 +#define __NR_lgetxattr 9 +#define __NR_fgetxattr 10 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_flistxattr 13 +#define __NR_removexattr 14 +#define __NR_lremovexattr 15 +#define __NR_fremovexattr 16 +#define __NR_getcwd 17 +#define __NR_lookup_dcookie 18 +#define __NR_eventfd2 19 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_fcntl 25 +#define __NR_inotify_init1 26 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_rm_watch 28 +#define __NR_ioctl 29 +#define __NR_ioprio_set 30 +#define __NR_ioprio_get 31 +#define __NR_flock 32 +#define __NR_mknodat 33 +#define __NR_mkdirat 34 +#define __NR_unlinkat 35 +#define __NR_symlinkat 36 +#define __NR_linkat 37 +#define __NR_umount2 39 +#define __NR_mount 40 +#define __NR_pivot_root 41 +#define __NR_nfsservctl 42 +#define __NR_statfs 43 +#define __NR_fstatfs 44 +#define __NR_truncate 45 +#define __NR_ftruncate 46 +#define __NR_fallocate 47 +#define __NR_faccessat 48 +#define __NR_chdir 49 +#define __NR_fchdir 50 +#define __NR_chroot 51 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchownat 54 +#define __NR_fchown 55 +#define __NR_openat 56 +#define __NR_close 57 +#define __NR_vhangup 58 +#define __NR_pipe2 59 +#define __NR_quotactl 60 +#define __NR_getdents64 61 +#define __NR_lseek 62 +#define __NR_read 63 +#define __NR_write 64 +#define __NR_readv 65 +#define __NR_writev 66 +#define __NR_pread64 67 +#define __NR_pwrite64 68 +#define __NR_preadv 69 +#define __NR_pwritev 70 +#define __NR_sendfile 71 +#define __NR_pselect6 72 +#define __NR_ppoll 73 +#define __NR_signalfd4 74 +#define __NR_vmsplice 75 +#define __NR_splice 76 +#define __NR_tee 77 +#define __NR_readlinkat 78 +#define __NR_newfstatat 79 +#define __NR_fstat 80 +#define __NR_sync 81 +#define __NR_fsync 82 +#define __NR_fdatasync 83 +#define __NR_sync_file_range 84 +#define __NR_timerfd_create 85 +#define __NR_timerfd_settime 86 +#define __NR_timerfd_gettime 87 +#define __NR_utimensat 88 +#define __NR_acct 89 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_personality 92 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_waitid 95 +#define __NR_set_tid_address 96 +#define __NR_unshare 97 +#define __NR_futex 98 +#define __NR_set_robust_list 99 +#define __NR_get_robust_list 100 +#define __NR_nanosleep 101 +#define __NR_getitimer 102 +#define __NR_setitimer 103 +#define __NR_kexec_load 104 +#define __NR_init_module 105 +#define __NR_delete_module 106 +#define __NR_timer_create 107 +#define __NR_timer_gettime 108 +#define __NR_timer_getoverrun 109 +#define __NR_timer_settime 110 +#define __NR_timer_delete 111 +#define __NR_clock_settime 112 +#define __NR_clock_gettime 113 +#define __NR_clock_getres 114 +#define __NR_clock_nanosleep 115 +#define __NR_syslog 116 +#define __NR_ptrace 117 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_getscheduler 120 +#define __NR_sched_getparam 121 +#define __NR_sched_setaffinity 122 +#define __NR_sched_getaffinity 123 +#define __NR_sched_yield 124 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_rr_get_interval 127 +#define __NR_restart_syscall 128 +#define __NR_kill 129 +#define __NR_tkill 130 +#define __NR_tgkill 131 +#define __NR_sigaltstack 132 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigtimedwait 137 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_setpriority 140 +#define __NR_getpriority 141 +#define __NR_reboot 142 +#define __NR_setregid 143 +#define __NR_setgid 144 +#define __NR_setreuid 145 +#define __NR_setuid 146 +#define __NR_setresuid 147 +#define __NR_getresuid 148 +#define __NR_setresgid 149 +#define __NR_getresgid 150 +#define __NR_setfsuid 151 +#define __NR_setfsgid 152 +#define __NR_times 153 +#define __NR_setpgid 154 +#define __NR_getpgid 155 +#define __NR_getsid 156 +#define __NR_setsid 157 +#define __NR_getgroups 158 +#define __NR_setgroups 159 +#define __NR_uname 160 +#define __NR_sethostname 161 +#define __NR_setdomainname 162 +#define __NR_getrlimit 163 +#define __NR_setrlimit 164 +#define __NR_getrusage 165 +#define __NR_umask 166 +#define __NR_prctl 167 +#define __NR_getcpu 168 +#define __NR_gettimeofday 169 +#define __NR_settimeofday 170 +#define __NR_adjtimex 171 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getuid 174 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getegid 177 +#define __NR_gettid 178 +#define __NR_sysinfo 179 +#define __NR_mq_open 180 +#define __NR_mq_unlink 181 +#define __NR_mq_timedsend 182 +#define __NR_mq_timedreceive 183 +#define __NR_mq_notify 184 +#define __NR_mq_getsetattr 185 +#define __NR_msgget 186 +#define __NR_msgctl 187 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_semget 190 +#define __NR_semctl 191 +#define __NR_semtimedop 192 +#define __NR_semop 193 +#define __NR_shmget 194 +#define __NR_shmctl 195 +#define __NR_shmat 196 +#define __NR_shmdt 197 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_bind 200 +#define __NR_listen 201 +#define __NR_accept 202 +#define __NR_connect 203 +#define __NR_getsockname 204 +#define __NR_getpeername 205 +#define __NR_sendto 206 +#define __NR_recvfrom 207 +#define __NR_setsockopt 208 +#define __NR_getsockopt 209 +#define __NR_shutdown 210 +#define __NR_sendmsg 211 +#define __NR_recvmsg 212 +#define __NR_readahead 213 +#define __NR_brk 214 +#define __NR_munmap 215 +#define __NR_mremap 216 +#define __NR_add_key 217 +#define __NR_request_key 218 +#define __NR_keyctl 219 +#define __NR_clone 220 +#define __NR_execve 221 +#define __NR_mmap 222 +#define __NR_fadvise64 223 +#define __NR_swapon 224 +#define __NR_swapoff 225 +#define __NR_mprotect 226 +#define __NR_msync 227 +#define __NR_mlock 228 +#define __NR_munlock 229 +#define __NR_mlockall 230 +#define __NR_munlockall 231 +#define __NR_mincore 232 +#define __NR_madvise 233 +#define __NR_remap_file_pages 234 +#define __NR_mbind 235 +#define __NR_get_mempolicy 236 +#define __NR_set_mempolicy 237 +#define __NR_migrate_pages 238 +#define __NR_move_pages 239 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_perf_event_open 241 +#define __NR_accept4 242 +#define __NR_recvmmsg 243 +#define __NR_arch_specific_syscall 244 +#define __NR_wait4 260 +#define __NR_prlimit64 261 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_name_to_handle_at 264 +#define __NR_open_by_handle_at 265 +#define __NR_clock_adjtime 266 +#define __NR_syncfs 267 +#define __NR_setns 268 +#define __NR_sendmmsg 269 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_kcmp 272 +#define __NR_finit_module 273 +#define __NR_sched_setattr 274 +#define __NR_sched_getattr 275 +#define __NR_renameat2 276 +#define __NR_seccomp 277 +#define __NR_getrandom 278 +#define __NR_memfd_create 279 +#define __NR_bpf 280 +#define __NR_execveat 281 +#define __NR_userfaultfd 282 +#define __NR_membarrier 283 +#define __NR_mlock2 284 +#define __NR_copy_file_range 285 +#define __NR_preadv2 286 +#define __NR_pwritev2 287 +#define __NR_pkey_mprotect 288 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_statx 291 +#define __NR_io_pgetevents 292 +#define __NR_rseq 293 +#define __NR_kexec_file_load 294 +#define __NR_pidfd_send_signal 424 +#define __NR_io_uring_setup 425 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_open_tree 428 +#define __NR_move_mount 429 +#define __NR_fsopen 430 +#define __NR_fsconfig 431 +#define __NR_fsmount 432 +#define __NR_fspick 433 +#define __NR_pidfd_open 434 +#define __NR_clone3 435 +#define __NR_close_range 436 +#define __NR_openat2 437 +#define __NR_pidfd_getfd 438 +#define __NR_faccessat2 439 +#define __NR_process_madvise 440 +#define __NR_epoll_pwait2 441 +#define __NR_mount_setattr 442 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_sysriscv 244 +#define __NR_riscv_flush_icache (244 + 15) +#define MAP_32BIT 0x40 +#define INADDR_ANY 0 +#define INADDR_BROADCAST 0xffffffff +#define INADDR_NONE 0xffffffff +#define INADDR_LOOPBACK 0x7f000001 +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EDEADLK 35 +#define ENAMETOOLONG 36 +#define ENOLCK 37 +#define ENOSYS 38 +#define ENOTEMPTY 39 +#define ELOOP 40 +#define EWOULDBLOCK 11 +#define ENOMSG 42 +#define EIDRM 43 +#define ECHRNG 44 +#define EL2NSYNC 45 +#define EL3HLT 46 +#define EL3RST 47 +#define ELNRNG 48 +#define EUNATCH 49 +#define ENOCSI 50 +#define EL2HLT 51 +#define EBADE 52 +#define EBADR 53 +#define EXFULL 54 +#define ENOANO 55 +#define EBADRQC 56 +#define EBADSLT 57 +#define EDEADLOCK 35 +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EMULTIHOP 72 +#define EDOTDOT 73 +#define EBADMSG 74 +#define EOVERFLOW 75 +#define ENOTUNIQ 76 +#define EBADFD 77 +#define EREMCHG 78 +#define ELIBACC 79 +#define ELIBBAD 80 +#define ELIBSCN 81 +#define ELIBMAX 82 +#define ELIBEXEC 83 +#define EILSEQ 84 +#define ERESTART 85 +#define ESTRPIPE 86 +#define EUSERS 87 +#define ENOTSOCK 88 +#define EDESTADDRREQ 89 +#define EMSGSIZE 90 +#define EPROTOTYPE 91 +#define ENOPROTOOPT 92 +#define EPROTONOSUPPORT 93 +#define ESOCKTNOSUPPORT 94 +#define EOPNOTSUPP 95 +#define ENOTSUP 95 +#define EPFNOSUPPORT 96 +#define EAFNOSUPPORT 97 +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 +#define ENETRESET 102 +#define ECONNABORTED 103 +#define ECONNRESET 104 +#define ENOBUFS 105 +#define EISCONN 106 +#define ENOTCONN 107 +#define ESHUTDOWN 108 +#define ETOOMANYREFS 109 +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 +#define ESTALE 116 +#define EUCLEAN 117 +#define ENOTNAM 118 +#define ENAVAIL 119 +#define EISNAM 120 +#define EREMOTEIO 121 +#define EDQUOT 122 +#define ENOMEDIUM 123 +#define EMEDIUMTYPE 124 +#define ECANCELED 125 +#define ENOKEY 126 +#define EKEYEXPIRED 127 +#define EKEYREVOKED 128 +#define EKEYREJECTED 129 +#define EOWNERDEAD 130 +#define ENOTRECOVERABLE 131 +#define ERFKILL 132 +#define EHWPOISON 133 +#define __SYS_NERR ((133) + 1) +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __BYTE_ORDER 4321 +#define __FLOAT_WORD_ORDER 4321 +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 +#define BYTE_ORDER 4321 +#define __WORDSIZE 32 +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807) +#define INT8_MIN (-1 - (127)) +#define INT16_MIN (-1 - (32767)) +#define INT32_MIN (-1 - (2147483647)) +#define INT64_MIN (-1 - (9223372036854775807)) +#define INT_LEAST8_MAX (127) +#define INT_LEAST8_MIN (-1 - (127)) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST16_MIN (-1 - (32767)) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST32_MIN (-1 - (2147483647)) +#define INT_LEAST64_MAX (9223372036854775807) +#define INT_LEAST64_MIN (-1 - (9223372036854775807)) +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xffffffff +#define UINT64_MAX 0xffffffffffffffff +#define UINT_LEAST8_MAX 0xff +#define UINT_LEAST16_MAX 0xffff +#define UINT_LEAST32_MAX 0xffffffff +#define UINT_LEAST64_MAX 0xffffffffffffffff +#define INTPTR_MIN (-1 - (2147483647)) +#define INTPTR_MAX (2147483647) +#define UINTPTR_MAX 0xffffffff +#define SIZE_MAX 0xffffffff +#define PTRDIFF_MIN (-1 - (2147483647)) +#define PTRDIFF_MAX (2147483647) +#define INTMAX_MIN (-1 - (9223372036854775807)) +#define INTMAX_MAX (9223372036854775807) +#define UINTMAX_MAX 0xffffffffffffffff +#define INT_FAST8_MIN (-1 - (127)) +#define INT_FAST8_MAX (127) +#define INT_FAST64_MIN (-1 - (9223372036854775807)) +#define INT_FAST64_MAX (9223372036854775807) +#define UINT_FAST8_MAX 0xff +#define UINT_FAST64_MAX 0xffffffffffffffff +#define INT_FAST16_MIN (-1 - (2147483647)) +#define INT_FAST16_MAX (2147483647) +#define UINT_FAST16_MAX 0xffffffff +#define INT_FAST32_MIN (-1 - (2147483647)) +#define INT_FAST32_MAX (2147483647) +#define UINT_FAST32_MAX 0xffffffff +#define WINT_MIN 0 +#define __FSUID_H 1 +#define NSIG 32 +#define _NSIG 65 +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT 6 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGSEGV 11 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGUNUSED 31 +#define SIGRTMIN 32 +#define SIGRTMAX (65-1) +#define SA_NOCLDSTOP 0x00000001 +#define SA_NOCLDWAIT 0x00000002 +#define SA_SIGINFO 0x00000004 +#define SA_RESTORER 0x04000000 +#define SA_ONSTACK 0x08000000 +#define SA_RESTART 0x10000000 +#define SA_INTERRUPT 0x20000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 +#define SA_NOMASK 0x40000000 +#define SA_ONESHOT 0x80000000 +#define SS_ONSTACK 1 +#define SS_DISABLE 2 +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 +#define SI_MAX_SIZE 128 +#define SIGEV_SIGNAL 0 +#define SIGEV_NONE 1 +#define SIGEV_THREAD 2 +#define SIGEV_THREAD_ID 4 +#define SIGEV_MAX_SIZE 64 +#define _SYS_TIME_H 1 +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 +#define FD_SETSIZE 1024 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 +#define _CS_PATH 1 +#define _SC_CLK_TCK 1 +#define _SC_ARG_MAX 2 +#define _SC_NGROUPS_MAX 3 +#define _SC_OPEN_MAX 4 +#define _SC_PAGESIZE 5 +#define _SC_NPROCESSORS_ONLN 6 +#define _SC_NPROCESSORS_CONF 6 +#define _SC_PHYS_PAGES 7 +#define _SC_GETPW_R_SIZE_MAX 8 +#define _SC_GETGR_R_SIZE_MAX 9 +#define _PC_PATH_MAX 1 +#define _PC_VDISABLE 2 +#define L_cuserid 17 +#define _POSIX_VERSION 199506 +#define F_ULOCK 0 +#define F_LOCK 1 +#define F_TLOCK 2 +#define F_TEST 3 +#define _POSIX_MAPPED_FILES 200809 +#define S_IFMT 0xf000 +#define S_IFSOCK 0xc000 +#define S_IFLNK 0xa000 +#define S_IFREG 0x8000 +#define S_IFBLK 0x6000 +#define S_IFDIR 0x4000 +#define S_IFCHR 0x2000 +#define S_IFIFO 0x1000 +#define S_ISUID 0x800 +#define S_ISGID 0x400 +#define S_ISVTX 0x200 +#define S_IRWXU 0x1c0 +#define S_IRUSR 0x100 +#define S_IWUSR 0x80 +#define S_IXUSR 0x40 +#define S_IRWXG 0x38 +#define S_IRGRP 0x20 +#define S_IWGRP 0x10 +#define S_IXGRP 0x8 +#define S_IRWXO 0x7 +#define S_IROTH 0x4 +#define S_IWOTH 0x2 +#define S_IXOTH 0x1 +#define S_IREAD 0x100 +#define S_IWRITE 0x80 +#define S_IEXEC 0x40 +#define _SYS_UIO 1 +#define SOL_SOCKET 1 +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +#define SO_BSDCOMPAT 14 +#define SO_REUSEPORT 15 +#define SO_PASSCRED 16 +#define SO_PEERCRED 17 +#define SO_RCVLOWAT 18 +#define SO_SNDLOWAT 19 +#define SO_RCVTIMEO 20 +#define SO_SNDTIMEO 21 +#define SO_SECURITY_AUTHENTICATION 22 +#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 +#define SO_SECURITY_ENCRYPTION_NETWORK 24 +#define SO_BINDTODEVICE 25 +#define SO_ATTACH_FILTER 26 +#define SO_DETACH_FILTER 27 +#define SO_GET_FILTER 26 +#define SO_PEERNAME 28 +#define SO_TIMESTAMP 29 +#define SCM_TIMESTAMP 29 +#define SO_ACCEPTCONN 30 +#define SO_PEERSEC 31 +#define SO_SNDBUFFORCE 32 +#define SO_RCVBUFFORCE 33 +#define SO_PASSSEC 34 +#define SO_TIMESTAMPNS 35 +#define SCM_TIMESTAMPNS 35 +#define SO_MARK 36 +#define SO_TIMESTAMPING 37 +#define SCM_TIMESTAMPING 37 +#define SO_PROTOCOL 38 +#define SO_DOMAIN 39 +#define SO_RXQ_OVFL 40 +#define SO_WIFI_STATUS 41 +#define SCM_WIFI_STATUS 41 +#define SO_PEEK_OFF 42 +#define SO_NOFCS 43 +#define SO_LOCK_FILTER 44 +#define SO_SELECT_ERR_QUEUE 45 +#define SO_BUSY_POLL 46 +#define SO_MAX_PACING_RATE 47 +#define SO_BPF_EXTENSIONS 48 +#define SO_INCOMING_CPU 49 +#define SO_ATTACH_BPF 50 +#define SO_DETACH_BPF 27 +#define SO_ATTACH_REUSEPORT_CBPF 51 +#define SO_ATTACH_REUSEPORT_EBPF 52 +#define SO_CNX_ADVICE 53 +#define SCM_TIMESTAMPING_OPT_STATS 54 +#define SO_MEMINFO 55 +#define SO_INCOMING_NAPI_ID 56 +#define SO_COOKIE 57 +#define SCM_TIMESTAMPING_PKTINFO 58 +#define SO_PEERGROUPS 59 +#define SO_ZEROCOPY 60 +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SOCK_DCCP 6 +#define SOCK_PACKET 10 +#define UIO_FASTIOV 8 +#define UIO_MAXIOV 1024 +#define SCM_RIGHTS 0x01 +#define SCM_CREDENTIALS 0x02 +#define SCM_CONNECT 0x03 +#define AF_UNSPEC 0 +#define AF_UNIX 1 +#define AF_LOCAL 1 +#define AF_INET 2 +#define AF_AX25 3 +#define AF_IPX 4 +#define AF_APPLETALK 5 +#define AF_NETROM 6 +#define AF_BRIDGE 7 +#define AF_ATMPVC 8 +#define AF_X25 9 +#define AF_INET6 10 +#define AF_ROSE 11 +#define AF_DECnet 12 +#define AF_NETBEUI 13 +#define AF_SECURITY 14 +#define AF_KEY 15 +#define AF_NETLINK 16 +#define AF_ROUTE 16 +#define AF_PACKET 17 +#define AF_ASH 18 +#define AF_ECONET 19 +#define AF_ATMSVC 20 +#define AF_SNA 22 +#define AF_IRDA 23 +#define AF_PPPOX 24 +#define AF_WANPIPE 25 +#define AF_LLC 26 +#define AF_IB 27 +#define AF_MPLS 28 +#define AF_CAN 29 +#define AF_TIPC 30 +#define AF_BLUETOOTH 31 +#define AF_IUCV 32 +#define AF_RXRPC 33 +#define AF_ISDN 34 +#define AF_PHONET 35 +#define AF_IEEE802154 36 +#define AF_CAIF 37 +#define AF_ALG 38 +#define AF_NFC 39 +#define AF_VSOCK 40 +#define AF_KCM 41 +#define AF_QIPCRTR 42 +#define AF_SMC 43 +#define AF_MAX 44 +#define PF_UNSPEC 0 +#define PF_UNIX 1 +#define PF_LOCAL 1 +#define PF_INET 2 +#define PF_AX25 3 +#define PF_IPX 4 +#define PF_APPLETALK 5 +#define PF_NETROM 6 +#define PF_BRIDGE 7 +#define PF_ATMPVC 8 +#define PF_X25 9 +#define PF_INET6 10 +#define PF_ROSE 11 +#define PF_DECnet 12 +#define PF_NETBEUI 13 +#define PF_SECURITY 14 +#define PF_KEY 15 +#define PF_NETLINK 16 +#define PF_ROUTE 16 +#define PF_PACKET 17 +#define PF_ASH 18 +#define PF_ECONET 19 +#define PF_ATMSVC 20 +#define PF_SNA 22 +#define PF_IRDA 23 +#define PF_PPPOX 24 +#define PF_WANPIPE 25 +#define PF_LLC 26 +#define PF_IB 27 +#define PF_MPLS 28 +#define PF_CAN 29 +#define PF_TIPC 30 +#define PF_BLUETOOTH 31 +#define PF_IUCV 32 +#define PF_RXRPC 33 +#define PF_ISDN 34 +#define PF_PHONET 35 +#define PF_IEEE802154 36 +#define PF_CAIF 37 +#define PF_ALG 38 +#define PF_NFC 39 +#define PF_VSOCK 40 +#define PF_KCM 41 +#define PF_QIPCRTR 42 +#define PF_SMC 43 +#define PF_MAX 44 +#define SOMAXCONN 128 +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 +#define MSG_TRYHARD 4 +#define MSG_CTRUNC 8 +#define MSG_PROBE 0x10 +#define MSG_TRUNC 0x20 +#define MSG_DONTWAIT 0x40 +#define MSG_EOR 0x80 +#define MSG_WAITALL 0x100 +#define MSG_FIN 0x200 +#define MSG_SYN 0x400 +#define MSG_CONFIRM 0x800 +#define MSG_RST 0x1000 +#define MSG_ERRQUEUE 0x2000 +#define MSG_NOSIGNAL 0x4000 +#define MSG_MORE 0x8000 +#define MSG_WAITFORONE 0x10000 +#define MSG_SENDPAGE_NOTLAST 0x20000 +#define MSG_BATCH 0x40000 +#define MSG_EOF 0x200 +#define MSG_ZEROCOPY 0x4000000 +#define MSG_FASTOPEN 0x20000000 +#define MSG_CMSG_CLOEXEC 0x40000000 +#define SOL_IP 0 +#define SOL_TCP 6 +#define SOL_UDP 17 +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 +#define SOL_SCTP 132 +#define SOL_UDPLITE 136 +#define SOL_RAW 255 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_ROSE 260 +#define SOL_DECNET 261 +#define SOL_X25 262 +#define SOL_PACKET 263 +#define SOL_ATM 264 +#define SOL_AAL 265 +#define SOL_IRDA 266 +#define SOL_NETBEUI 267 +#define SOL_LLC 268 +#define SOL_DCCP 269 +#define SOL_NETLINK 270 +#define SOL_TIPC 271 +#define SOL_RXRPC 272 +#define SOL_PPPOL2TP 273 +#define SOL_BLUETOOTH 274 +#define SOL_PNPIPE 275 +#define SOL_RDS 276 +#define SOL_IUCV 277 +#define SOL_CAIF 278 +#define SOL_ALG 279 +#define SOL_NFC 280 +#define SOL_KCM 281 +#define SOL_TLS 282 +#define IPX_TYPE 1 +#define SHUT_RD 0 +#define SHUT_WR 1 +#define SHUT_RDWR 2 +#define NI_NOFQDN 1 +#define NI_NUMERICHOST 2 +#define NI_NAMEREQD 4 +#define NI_NUMERICSERV 8 +#define NI_DGRAM 16 +#define EAI_FAMILY -1 +#define EAI_SOCKTYPE -2 +#define EAI_BADFLAGS -3 +#define EAI_NONAME -4 +#define EAI_SERVICE -5 +#define EAI_ADDRFAMILY -6 +#define EAI_NODATA -7 +#define EAI_MEMORY -8 +#define EAI_FAIL -9 +#define EAI_AGAIN -10 +#define EAI_SYSTEM -11 +#define AI_NUMERICHOST 1 +#define AI_CANONNAME 2 +#define AI_PASSIVE 4 +#define AI_NUMERICSERV 8 +#define AI_ADDRCONFIG 16 +#define AI_V4MAPPED 32 +#define AI_ALL 64 +#define SIOCADDRT 0x890B +#define SIOCDELRT 0x890C +#define SIOCRTMSG 0x890D +#define SIOCGIFNAME 0x8910 +#define SIOCSIFLINK 0x8911 +#define SIOCGIFCONF 0x8912 +#define SIOCGIFFLAGS 0x8913 +#define SIOCSIFFLAGS 0x8914 +#define SIOCGIFADDR 0x8915 +#define SIOCSIFADDR 0x8916 +#define SIOCGIFDSTADDR 0x8917 +#define SIOCSIFDSTADDR 0x8918 +#define SIOCGIFBRDADDR 0x8919 +#define SIOCSIFBRDADDR 0x891a +#define SIOCGIFNETMASK 0x891b +#define SIOCSIFNETMASK 0x891c +#define SIOCGIFMETRIC 0x891d +#define SIOCSIFMETRIC 0x891e +#define SIOCGIFMEM 0x891f +#define SIOCSIFMEM 0x8920 +#define SIOCGIFMTU 0x8921 +#define SIOCSIFMTU 0x8922 +#define SIOCSIFNAME 0x8923 +#define SIOCSIFHWADDR 0x8924 +#define SIOCGIFENCAP 0x8925 +#define SIOCSIFENCAP 0x8926 +#define SIOCGIFHWADDR 0x8927 +#define SIOCGIFSLAVE 0x8929 +#define SIOCSIFSLAVE 0x8930 +#define SIOCADDMULTI 0x8931 +#define SIOCDELMULTI 0x8932 +#define SIOCGIFINDEX 0x8933 +#define SIOGIFINDEX 0x8933 +#define SIOCSIFPFLAGS 0x8934 +#define SIOCGIFPFLAGS 0x8935 +#define SIOCDIFADDR 0x8936 +#define SIOCSIFHWBROADCAST 0x8937 +#define SIOCGIFCOUNT 0x8938 +#define SIOCGIFBR 0x8940 +#define SIOCSIFBR 0x8941 +#define SIOCGIFTXQLEN 0x8942 +#define SIOCSIFTXQLEN 0x8943 +#define SIOCGIFDIVERT 0x8944 +#define SIOCSIFDIVERT 0x8945 +#define SIOCETHTOOL 0x8946 +#define SIOCDARP 0x8953 +#define SIOCGARP 0x8954 +#define SIOCSARP 0x8955 +#define SIOCDRARP 0x8960 +#define SIOCGRARP 0x8961 +#define SIOCSRARP 0x8962 +#define SIOCGIFMAP 0x8970 +#define SIOCSIFMAP 0x8971 +#define SIOCADDDLCI 0x8980 +#define SIOCDELDLCI 0x8981 +#define SIOCDEVPRIVATE 0x89F0 +#define F_LINUX_SPECIFIC_BASE 1024 +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 +#define F_GETOWNER_UIDS 17 +#define F_OFD_GETLK 36 +#define F_OFD_SETLK 37 +#define F_OFD_SETLKW 38 +#define F_OWNER_TID 0 +#define F_OWNER_PID 1 +#define F_OWNER_PGRP 2 +#define AT_FDCWD -100 +#define AT_SYMLINK_NOFOLLOW 0x100 +#define AT_REMOVEDIR 0x200 +#define AT_SYMLINK_FOLLOW 0x400 +#define AT_NO_AUTOMOUNT 0x800 +#define AT_EMPTY_PATH 0x1000 +#define AT_EACCESS 0x200 +#define MREMAP_MAYMOVE 1 +#define MREMAP_FIXED 2 +#define PROT_READ 0x1 +#define PROT_WRITE 0x2 +#define PROT_EXEC 0x4 +#define PROT_SEM 0x8 +#define PROT_NONE 0x0 +#define PROT_GROWSDOWN 0x01000000 +#define PROT_GROWSUP 0x02000000 +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 +#define MAP_TYPE 0xf +#define MADV_REMOVE 9 +#define MADV_DONTFORK 10 +#define MADV_DOFORK 11 +#define MADV_MERGEABLE 12 +#define MADV_UNMERGEABLE 13 +#define MADV_HUGEPAGE 14 +#define MADV_NOHUGEPAGE 15 +#define MADV_DONTDUMP 16 +#define MADV_DODUMP 17 +#define MADV_HWPOISON 100 +#define MADV_SOFT_OFFLINE 101 +#define MLOCK_ONFAULT 1 +#define MAP_FILE 0 +#define PTRACE_TRACEME 0 +#define PTRACE_PEEKTEXT 1 +#define PTRACE_PEEKDATA 2 +#define PTRACE_PEEKUSR 3 +#define PTRACE_PEEKUSER 3 +#define PTRACE_POKETEXT 4 +#define PTRACE_POKEDATA 5 +#define PTRACE_POKEUSR 6 +#define PTRACE_POKEUSER 6 +#define PTRACE_CONT 7 +#define PTRACE_KILL 8 +#define PTRACE_SINGLESTEP 9 +#define PTRACE_ATTACH 0x10 +#define PTRACE_DETACH 0x11 +#define PTRACE_SYSCALL 24 +#define PTRACE_GETEVENTMSG 0x4201 +#define PTRACE_GETSIGINFO 0x4202 +#define PTRACE_SETSIGINFO 0x4203 +#define PTRACE_O_TRACESYSGOOD 0x00000001 +#define PTRACE_O_TRACEFORK 0x00000002 +#define PTRACE_O_TRACEVFORK 0x00000004 +#define PTRACE_O_TRACECLONE 0x00000008 +#define PTRACE_O_TRACEEXEC 0x00000010 +#define PTRACE_O_TRACEVFORKDONE 0x00000020 +#define PTRACE_O_TRACEEXIT 0x00000040 +#define PTRACE_O_MASK 0x0000007f +#define PTRACE_EVENT_FORK 1 +#define PTRACE_EVENT_VFORK 2 +#define PTRACE_EVENT_CLONE 3 +#define PTRACE_EVENT_EXEC 4 +#define PTRACE_EVENT_VFORK_DONE 5 +#define PTRACE_EVENT_EXIT 6 +#define PT_TRACE_ME 0 +#define PT_READ_I 1 +#define PT_READ_D 2 +#define PT_READ_U 3 +#define PT_WRITE_I 4 +#define PT_WRITE_D 5 +#define PT_WRITE_U 6 +#define PT_CONTINUE 7 +#define PT_KILL 8 +#define PT_STEP 9 +#define PT_ATTACH 0x10 +#define PT_DETACH 0x11 +#define SYS_accept 202 +#define SYS_accept4 242 +#define SYS_acct 89 +#define SYS_add_key 217 +#define SYS_adjtimex 171 +#define SYS_arch_specific_syscall 244 +#define SYS_bind 200 +#define SYS_bpf 280 +#define SYS_brk 214 +#define SYS_capget 90 +#define SYS_capset 91 +#define SYS_chdir 49 +#define SYS_chroot 51 +#define SYS_clock_adjtime 266 +#define SYS_clock_getres 114 +#define SYS_clock_gettime 113 +#define SYS_clock_nanosleep 115 +#define SYS_clock_settime 112 +#define SYS_clone 220 +#define SYS_clone3 435 +#define SYS_close 57 +#define SYS_close_range 436 +#define SYS_connect 203 +#define SYS_copy_file_range 285 +#define SYS_delete_module 106 +#define SYS_dup 23 +#define SYS_dup3 24 +#define SYS_epoll_create1 20 +#define SYS_epoll_ctl 21 +#define SYS_epoll_pwait 22 +#define SYS_epoll_pwait2 441 +#define SYS_eventfd2 19 +#define SYS_execve 221 +#define SYS_execveat 281 +#define SYS_exit 93 +#define SYS_exit_group 94 +#define SYS_faccessat 48 +#define SYS_faccessat2 439 +#define SYS_fadvise64 223 +#define SYS_fallocate 47 +#define SYS_fanotify_init 262 +#define SYS_fanotify_mark 263 +#define SYS_fchdir 50 +#define SYS_fchmod 52 +#define SYS_fchmodat 53 +#define SYS_fchown 55 +#define SYS_fchownat 54 +#define SYS_fcntl 25 +#define SYS_fdatasync 83 +#define SYS_fgetxattr 10 +#define SYS_finit_module 273 +#define SYS_flistxattr 13 +#define SYS_flock 32 +#define SYS_fremovexattr 16 +#define SYS_fsconfig 431 +#define SYS_fsetxattr 7 +#define SYS_fsmount 432 +#define SYS_fsopen 430 +#define SYS_fspick 433 +#define SYS_fstat 80 +#define SYS_fstatfs 44 +#define SYS_fsync 82 +#define SYS_ftruncate 46 +#define SYS_futex 98 +#define SYS_getcpu 168 +#define SYS_getcwd 17 +#define SYS_getdents64 61 +#define SYS_getegid 177 +#define SYS_geteuid 175 +#define SYS_getgid 176 +#define SYS_getgroups 158 +#define SYS_getitimer 102 +#define SYS_get_mempolicy 236 +#define SYS_getpeername 205 +#define SYS_getpgid 155 +#define SYS_getpid 172 +#define SYS_getppid 173 +#define SYS_getpriority 141 +#define SYS_getrandom 278 +#define SYS_getresgid 150 +#define SYS_getresuid 148 +#define SYS_getrlimit 163 +#define SYS_get_robust_list 100 +#define SYS_getrusage 165 +#define SYS_getsid 156 +#define SYS_getsockname 204 +#define SYS_getsockopt 209 +#define SYS_gettid 178 +#define SYS_gettimeofday 169 +#define SYS_getuid 174 +#define SYS_getxattr 8 +#define SYS_init_module 105 +#define SYS_inotify_add_watch 27 +#define SYS_inotify_init1 26 +#define SYS_inotify_rm_watch 28 +#define SYS_io_cancel 3 +#define SYS_ioctl 29 +#define SYS_io_destroy 1 +#define SYS_io_getevents 4 +#define SYS_io_pgetevents 292 +#define SYS_ioprio_get 31 +#define SYS_ioprio_set 30 +#define SYS_io_setup 0 +#define SYS_io_submit 2 +#define SYS_io_uring_enter 426 +#define SYS_io_uring_register 427 +#define SYS_io_uring_setup 425 +#define SYS_kcmp 272 +#define SYS_kexec_file_load 294 +#define SYS_kexec_load 104 +#define SYS_keyctl 219 +#define SYS_kill 129 +#define SYS_landlock_add_rule 445 +#define SYS_landlock_create_ruleset 444 +#define SYS_landlock_restrict_self 446 +#define SYS_lgetxattr 9 +#define SYS_linkat 37 +#define SYS_listen 201 +#define SYS_listxattr 11 +#define SYS_llistxattr 12 +#define SYS_lookup_dcookie 18 +#define SYS_lremovexattr 15 +#define SYS_lseek 62 +#define SYS_lsetxattr 6 +#define SYS_madvise 233 +#define SYS_mbind 235 +#define SYS_membarrier 283 +#define SYS_memfd_create 279 +#define SYS_migrate_pages 238 +#define SYS_mincore 232 +#define SYS_mkdirat 34 +#define SYS_mknodat 33 +#define SYS_mlock 228 +#define SYS_mlock2 284 +#define SYS_mlockall 230 +#define SYS_mmap 222 +#define SYS_mount 40 +#define SYS_mount_setattr 442 +#define SYS_move_mount 429 +#define SYS_move_pages 239 +#define SYS_mprotect 226 +#define SYS_mq_getsetattr 185 +#define SYS_mq_notify 184 +#define SYS_mq_open 180 +#define SYS_mq_timedreceive 183 +#define SYS_mq_timedsend 182 +#define SYS_mq_unlink 181 +#define SYS_mremap 216 +#define SYS_msgctl 187 +#define SYS_msgget 186 +#define SYS_msgrcv 188 +#define SYS_msgsnd 189 +#define SYS_msync 227 +#define SYS_munlock 229 +#define SYS_munlockall 231 +#define SYS_munmap 215 +#define SYS_name_to_handle_at 264 +#define SYS_nanosleep 101 +#define SYS_newfstatat 79 +#define SYS_nfsservctl 42 +#define SYS_openat 56 +#define SYS_openat2 437 +#define SYS_open_by_handle_at 265 +#define SYS_open_tree 428 +#define SYS_perf_event_open 241 +#define SYS_personality 92 +#define SYS_pidfd_getfd 438 +#define SYS_pidfd_open 434 +#define SYS_pidfd_send_signal 424 +#define SYS_pipe2 59 +#define SYS_pivot_root 41 +#define SYS_pkey_alloc 289 +#define SYS_pkey_free 290 +#define SYS_pkey_mprotect 288 +#define SYS_ppoll 73 +#define SYS_prctl 167 +#define SYS_pread64 67 +#define SYS_preadv 69 +#define SYS_preadv2 286 +#define SYS_prlimit64 261 +#define SYS_process_madvise 440 +#define SYS_process_vm_readv 270 +#define SYS_process_vm_writev 271 +#define SYS_pselect6 72 +#define SYS_ptrace 117 +#define SYS_pwrite64 68 +#define SYS_pwritev 70 +#define SYS_pwritev2 287 +#define SYS_quotactl 60 +#define SYS_read 63 +#define SYS_readahead 213 +#define SYS_readlinkat 78 +#define SYS_readv 65 +#define SYS_reboot 142 +#define SYS_recvfrom 207 +#define SYS_recvmmsg 243 +#define SYS_recvmsg 212 +#define SYS_remap_file_pages 234 +#define SYS_removexattr 14 +#define SYS_renameat2 276 +#define SYS_request_key 218 +#define SYS_restart_syscall 128 +#define SYS_riscv_flush_icache (244 + 15) +#define SYS_rseq 293 +#define SYS_rt_sigaction 134 +#define SYS_rt_sigpending 136 +#define SYS_rt_sigprocmask 135 +#define SYS_rt_sigqueueinfo 138 +#define SYS_rt_sigreturn 139 +#define SYS_rt_sigsuspend 133 +#define SYS_rt_sigtimedwait 137 +#define SYS_rt_tgsigqueueinfo 240 +#define SYS_sched_getaffinity 123 +#define SYS_sched_getattr 275 +#define SYS_sched_getparam 121 +#define SYS_sched_get_priority_max 125 +#define SYS_sched_get_priority_min 126 +#define SYS_sched_getscheduler 120 +#define SYS_sched_rr_get_interval 127 +#define SYS_sched_setaffinity 122 +#define SYS_sched_setattr 274 +#define SYS_sched_setparam 118 +#define SYS_sched_setscheduler 119 +#define SYS_sched_yield 124 +#define SYS_seccomp 277 +#define SYS_semctl 191 +#define SYS_semget 190 +#define SYS_semop 193 +#define SYS_semtimedop 192 +#define SYS_sendfile 71 +#define SYS_sendmmsg 269 +#define SYS_sendmsg 211 +#define SYS_sendto 206 +#define SYS_setdomainname 162 +#define SYS_setfsgid 152 +#define SYS_setfsuid 151 +#define SYS_setgid 144 +#define SYS_setgroups 159 +#define SYS_sethostname 161 +#define SYS_setitimer 103 +#define SYS_set_mempolicy 237 +#define SYS_setns 268 +#define SYS_setpgid 154 +#define SYS_setpriority 140 +#define SYS_setregid 143 +#define SYS_setresgid 149 +#define SYS_setresuid 147 +#define SYS_setreuid 145 +#define SYS_setrlimit 164 +#define SYS_set_robust_list 99 +#define SYS_setsid 157 +#define SYS_setsockopt 208 +#define SYS_set_tid_address 96 +#define SYS_settimeofday 170 +#define SYS_setuid 146 +#define SYS_setxattr 5 +#define SYS_shmat 196 +#define SYS_shmctl 195 +#define SYS_shmdt 197 +#define SYS_shmget 194 +#define SYS_shutdown 210 +#define SYS_sigaltstack 132 +#define SYS_signalfd4 74 +#define SYS_socket 198 +#define SYS_socketpair 199 +#define SYS_splice 76 +#define SYS_statfs 43 +#define SYS_statx 291 +#define SYS_swapoff 225 +#define SYS_swapon 224 +#define SYS_symlinkat 36 +#define SYS_sync 81 +#define SYS_sync_file_range 84 +#define SYS_syncfs 267 +#define SYS_sysinfo 179 +#define SYS_syslog 116 +#define SYS_sysriscv 244 +#define SYS_tee 77 +#define SYS_tgkill 131 +#define SYS_timer_create 107 +#define SYS_timer_delete 111 +#define SYS_timerfd_create 85 +#define SYS_timerfd_gettime 87 +#define SYS_timerfd_settime 86 +#define SYS_timer_getoverrun 109 +#define SYS_timer_gettime 108 +#define SYS_timer_settime 110 +#define SYS_times 153 +#define SYS_tkill 130 +#define SYS_truncate 45 +#define SYS_umask 166 +#define SYS_umount2 39 +#define SYS_uname 160 +#define SYS_unlinkat 35 +#define SYS_unshare 97 +#define SYS_userfaultfd 282 +#define SYS_utimensat 88 +#define SYS_vhangup 58 +#define SYS_vmsplice 75 +#define SYS_wait4 260 +#define SYS_waitid 95 +#define SYS_write 64 +#define SYS_writev 66 diff --git a/pwnlib/shellcraft/registers.py b/pwnlib/shellcraft/registers.py index fcc42d717..fe366f70c 100644 --- a/pwnlib/shellcraft/registers.py +++ b/pwnlib/shellcraft/registers.py @@ -73,7 +73,42 @@ sparc += ["pc", "sp", "fp", "psr" ] sparc = list(map('%{}'.format, sparc)) +riscv = { + 'x0' : 0, 'zero': 0, + 'x1' : 1, 'ra': 1, + 'x2' : 2, 'sp': 2, + 'x3' : 3, 'gp': 3, + 'x4' : 4, 'tp': 4, + 'x5' : 5, 't0': 5, + 'x6' : 6, 't1': 6, + 'x7' : 7, 't2': 7, + 'x8' : 8, 's0': 8, 'fp': 8, + 'x9' : 9, 's1': 9, + 'x10': 10, 'a0': 10, + 'x11': 11, 'a1': 11, + 'x12': 12, 'a2': 12, + 'x13': 13, 'a3': 13, + 'x14': 14, 'a4': 14, + 'x15': 15, 'a5': 15, + 'x16': 16, 'a6': 16, + 'x17': 17, 'a7': 17, + 'x18': 18, 's2': 18, + 'x19': 19, 's3': 19, + 'x20': 20, 's4': 20, + 'x21': 21, 's5': 21, + 'x22': 22, 's6': 22, + 'x23': 23, 's7': 23, + 'x24': 24, 's8': 24, + 'x25': 25, 's9': 25, + 'x26': 26, 's10': 26, + 'x27': 27, 's11': 27, + 'x28': 28, 't3': 28, + 'x29': 29, 't4': 29, + 'x30': 30, 't5': 30, + 'x31': 31, 't6': 31, +} +riscv_list = list(riscv) # x86/amd64 registers in decreasing size i386_ordered = [ @@ -215,7 +250,9 @@ def current(): 'thumb': arm, 'aarch64': aarch64, 'mips': mips_list, - 'powerpc': powerpc + 'powerpc': powerpc, + 'riscv32': riscv, + 'riscv64': riscv, }[context.arch] # def is_register(sz): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm new file mode 100644 index 000000000..ecb77a9b6 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>close_range(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall close_range. + +See 'man 2 close_range' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_close_range']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* close_range(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm new file mode 100644 index 000000000..a06777704 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>epoll_pwait2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall epoll_pwait2. + +See 'man 2 epoll_pwait2' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_epoll_pwait2']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* epoll_pwait2(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm new file mode 100644 index 000000000..5d6f05d18 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>faccessat2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall faccessat2. + +See 'man 2 faccessat2' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_faccessat2']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* faccessat2(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm new file mode 100644 index 000000000..920d91e97 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>landlock_add_rule(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall landlock_add_rule. + +See 'man 2 landlock_add_rule' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_landlock_add_rule']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* landlock_add_rule(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm new file mode 100644 index 000000000..179d2f7f7 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>landlock_create_ruleset(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall landlock_create_ruleset. + +See 'man 2 landlock_create_ruleset' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_landlock_create_ruleset']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* landlock_create_ruleset(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm new file mode 100644 index 000000000..0a138bcc2 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>landlock_restrict_self(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall landlock_restrict_self. + +See 'man 2 landlock_restrict_self' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_landlock_restrict_self']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* landlock_restrict_self(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm new file mode 100644 index 000000000..33cc2f5af --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>mount_setattr(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall mount_setattr. + +See 'man 2 mount_setattr' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_mount_setattr']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* mount_setattr(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm new file mode 100644 index 000000000..6a6357a2c --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>process_madvise(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall process_madvise. + +See 'man 2 process_madvise' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_process_madvise']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* process_madvise(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm new file mode 100644 index 000000000..532c6802b --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>riscv_flush_icache(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall riscv_flush_icache. + +See 'man 2 riscv_flush_icache' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_riscv_flush_icache']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* riscv_flush_icache(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm new file mode 100644 index 000000000..d65886016 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm @@ -0,0 +1,101 @@ +<% +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +import six +%> +<%docstring>sysriscv(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4) -> str + +Invokes the syscall sysriscv. + +See 'man 2 sysriscv' for more information. + +Arguments: + vararg(int): vararg +Returns: + long + +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = [] + can_pushstr_array = [] + + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4] + + # Load all of the arguments into their destination registers / stack slots. + register_arguments = dict() + stack_arguments = collections.OrderedDict() + string_arguments = dict() + dict_arguments = dict() + array_arguments = dict() + syscall_repr = [] + + for name, arg in zip(argument_names, argument_values): + if arg is not None: + syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False))) + + # If the argument itself (input) is a register... + if arg in allregs: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[index] = arg + + # The argument is not a register. It is a string value, and we + # are expecting a string value + elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)): + if isinstance(arg, six.text_type): + arg = arg.encode('utf-8') + string_arguments[name] = arg + + # The argument is not a register. It is a dictionary, and we are + # expecting K:V paris. + elif name in can_pushstr_array and isinstance(arg, dict): + array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()] + + # The arguent is not a register. It is a list, and we are expecting + # a list of arguments. + elif name in can_pushstr_array and isinstance(arg, (list, tuple)): + array_arguments[name] = arg + + # The argument is not a register, string, dict, or list. + # It could be a constant string ('O_RDONLY') for an integer argument, + # an actual integer value, or a constant. + else: + index = argument_names.index(name) + if index < len(regs): + target = regs[index] + register_arguments[target] = arg + elif arg is not None: + stack_arguments[target] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_sysriscv']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % syscalls) +%> + /* sysriscv(${', '.join(syscall_repr)}) */ +%for name, arg in string_arguments.items(): + ${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))} + ${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)} +%endfor +%for name, arg in array_arguments.items(): + ${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)} +%endfor +%for name, arg in stack_arguments.items(): + ${pwnlib.shellcraft.push(arg)} +%endfor + ${pwnlib.shellcraft.setregs(register_arguments)} + ${pwnlib.shellcraft.syscall(syscall)} diff --git a/pwnlib/shellcraft/templates/riscv64/__doc__ b/pwnlib/shellcraft/templates/riscv64/__doc__ new file mode 100644 index 000000000..a5420bbe2 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/__doc__ @@ -0,0 +1 @@ +Shellcraft module containing generic RISCV64 shellcodes. diff --git a/pwnlib/shellcraft/templates/riscv64/linux/__doc__ b/pwnlib/shellcraft/templates/riscv64/linux/__doc__ new file mode 100644 index 000000000..af7cba2ce --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/linux/__doc__ @@ -0,0 +1 @@ +Shellcraft module containing RISCV64 shellcodes for Linux. diff --git a/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm b/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm new file mode 100644 index 000000000..85bd4bdd1 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm @@ -0,0 +1,109 @@ +<% + from pwnlib.shellcraft import riscv64, pretty + from pwnlib.constants import Constant + from pwnlib.abi import linux_riscv64_syscall as abi + from six import text_type +%> +<%page args="syscall = None, arg0 = None, arg1 = None, arg2 = None, arg3 = None, arg4=None, arg5=None"/> +<%docstring> +Args: [syscall_number, \*args] + Does a syscall + +Any of the arguments can be expressions to be evaluated by :func:`pwnlib.constants.eval`. + +Example: + + >>> print(pwnlib.shellcraft.riscv64.linux.syscall('SYS_execve', 1, 'sp', 2, 0).rstrip()) + /* call execve(1, 'sp', 2, 0) */ + c.li a0, 1 + c.mv a1, sp + c.li a2, 2 + c.li a3, 0 + /* mv a7, 0xdd */ + xori a7, zero, 0x722 + xori a7, a7, 0x7ff + ecall + >>> print(pwnlib.shellcraft.riscv64.linux.syscall('SYS_execve', 2, 1, 0, 20).rstrip()) + /* call execve(2, 1, 0, 0x14) */ + c.li a0, 2 + c.li a1, 1 + c.li a2, 0 + c.li a3, 0x14 + /* mv a7, 0xdd */ + xori a7, zero, 0x722 + xori a7, a7, 0x7ff + ecall + >>> print(pwnlib.shellcraft.riscv64.linux.syscall().rstrip()) + /* call syscall() */ + ecall + >>> print(pwnlib.shellcraft.riscv64.linux.syscall('a7', 'a0', 'a1').rstrip()) + /* call syscall('a7', 'a0', 'a1') */ + /* setregs noop */ + ecall + >>> print(pwnlib.shellcraft.riscv64.linux.syscall('a3', None, None, 1).rstrip()) + /* call syscall('a3', ?, ?, 1) */ + c.li a2, 1 + c.mv a7, a3 + ecall + >>> print(pwnlib.shellcraft.riscv64.linux.syscall( + ... 'SYS_mmap', 0, 0x1000, + ... 'PROT_READ | PROT_WRITE | PROT_EXEC', + ... 'MAP_PRIVATE', + ... -1, 0).rstrip()) + /* call mmap(0, 0x1000, 'PROT_READ | PROT_WRITE | PROT_EXEC', 'MAP_PRIVATE', -1, 0) */ + c.li a0, 0 + c.lui a1, 1 /* mv a1, 0x1000 */ + c.li a2, 7 + c.li a3, 2 + c.li a4, 0xffffffffffffffff + c.li a5, 0 + /* mv a7, 0xde */ + xori a7, zero, 0x721 + xori a7, a7, 0x7ff + ecall + >>> print(pwnlib.shellcraft.openat('AT_FDCWD', '/home/pwn/flag').rstrip()) + /* openat(fd='AT_FDCWD', file='/home/pwn/flag', oflag=0) */ + /* push b'/home/pwn/flag\x00' */ + li t4, 0x77702f656d6f682f + sd t4, -16(sp) + li t4, 0x67616c662f6e + sd t4, -8(sp) + addi sp, sp, -16 + c.mv a1, sp + xori a0, zero, 0xffffffffffffff9c + c.li a2, 0 + /* call openat() */ + /* mv a7, 0x38 */ + xori a7, zero, 0x7c7 + xori a7, a7, 0x7ff + ecall + +<% + if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + syscall_repr = str(syscall)[4:] + "(%s)" + args = [] + else: + syscall_repr = 'syscall(%s)' + if syscall is None: + args = ['?'] + else: + args = [pretty(syscall, False)] + + for arg in [arg0, arg1, arg2, arg3, arg4, arg5]: + if arg is None: + args.append('?') + else: + args.append(pretty(arg, False)) + while args and args[-1] == '?': + args.pop() + syscall_repr = syscall_repr % ', '.join(args) + + registers = abi.register_arguments + arguments = [syscall, arg0, arg1, arg2, arg3, arg4, arg5] + regctx = dict(zip(registers, arguments)) +%>\ + /* call ${syscall_repr} */ +%if any(a is not None for a in arguments): + ${riscv64.setregs(regctx)} +%endif + ecall diff --git a/pwnlib/shellcraft/templates/riscv64/linux/syscalls b/pwnlib/shellcraft/templates/riscv64/linux/syscalls new file mode 120000 index 000000000..82bc97edb --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/linux/syscalls @@ -0,0 +1 @@ +../../common/linux/syscalls \ No newline at end of file diff --git a/pwnlib/shellcraft/templates/riscv64/mov.asm b/pwnlib/shellcraft/templates/riscv64/mov.asm new file mode 100644 index 000000000..8005b47d1 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/mov.asm @@ -0,0 +1,131 @@ +<% + from pwnlib.util import lists, packing, fiddling, misc + from pwnlib.constants import eval, Constant + from pwnlib.context import context as ctx # Ugly hack, mako will not let it be called context + from pwnlib.log import getLogger + from pwnlib.shellcraft import riscv64, registers, pretty, okay + import six + log = getLogger('pwnlib.shellcraft.riscv64.mov') +%> +<%page args="dst, src"/> +<%docstring> +Move src into dst without newlines and null bytes. + +Registers t4 and t6 are not guaranteed to be preserved. + +If src is a string that is not a register, then it will locally set +`context.arch` to `'riscv64'` and use :func:`pwnlib.constants.eval` to evaluate the +string. Note that this means that this shellcode can change behavior depending +on the value of `context.os`. + +Args: + + dst (str): The destination register. + src (str): Either the input register, or an immediate value. + +Example: + + >>> print(shellcraft.riscv64.mov('t0', 0).rstrip()) + c.li t0, 0 + >>> print(shellcraft.riscv64.mov('t0', 0x2000).rstrip()) + c.lui t0, 2 /* mv t0, 0x2000 */ + >>> print(shellcraft.riscv64.mov('t5', 0x601).rstrip()) + xori t5, zero, 0x601 + >>> print(shellcraft.riscv64.mov('t5', 0x600).rstrip()) + /* mv t5, 0x600 */ + xori t5, zero, 0x1ff + xori t5, t5, 0x7ff + >>> print(shellcraft.riscv64.mov('t6', 0x181f).rstrip()) + /* mv t6, 0x181f */ + lui t6, 0xffffe + xori t6, t6, 0xfffffffffffff81f + >>> print(shellcraft.riscv64.mov('t5', 0x40b561f).rstrip()) + /* mv t5, 0x40b561f */ + lui t5, 0x40b5 + xori t5, t5, 0x61f + >>> print(shellcraft.riscv64.mov('t0', 0xcafebabe).rstrip()) + li t0, 0xcafebabe + >>> print(shellcraft.riscv64.mov('a0', 't2').rstrip()) + c.mv a0, t2 + >>> print(shellcraft.riscv64.mov('t1', 'sp').rstrip()) + c.mv t6, sp + c.mv t1, t6 /* mv t1, sp */ + + +<% +if not isinstance(dst, str) or dst not in registers.riscv: + log.error("Unknown register %r", dst) + return + +if isinstance(src, str) and src not in registers.riscv: + src = eval(src) + +if isinstance(src, str) and src not in registers.riscv: + log.error("Unknown register %r", src) + return + +src_reg = registers.riscv.get(src, None) +dst_reg = registers.riscv[dst] +tmp = 't6' if dst_reg != registers.riscv['t6'] else 't4' + +# If source register is zero, treat it as immediate 0 +if src_reg == 0: + src = 0 + src_reg = None + +encodes_no_newline = lambda a, not_a: not (a & 0xf == 0 or (a & 0xff0) >> 8 in [0, 10]) and not (((not_a & 0xf000) >> 8 | (dst_reg >> 1) in [0, 10]) or (not_a & 0xff0000) >> 16 in [0, 10] or not_a >> 24 in [0, 10]) +%> + +% if dst_reg == 0 or dst_reg == src_reg: + /* mv ${dst}, ${src} is a noop */ + +% elif src_reg is not None: +## Source is a register +## Special case where c.mv would produce a newline +% if src_reg == 2 and dst_reg % 2 == 0: + c.mv ${tmp}, ${src} + c.mv ${dst}, ${tmp} /* mv ${dst}, ${src} */ +% else: + c.mv ${dst}, ${src} +% endif +% else: +## Source is an immediate, normalize to [0, 2**64) + +<% src = packing.unpack(packing.pack(src, word_size=64), word_size=64, sign=False) %> +## Immediates are always sign-extended to 64-bit + +## 6-bit immediate for c.li +% if src < 0x20 or src >= 0xffffffffffffffe0: + c.li ${dst}, ${pretty(src)} + +## 6-bit immediate for c.lui +% elif dst_reg != 2 and src & 0xfff == 0 and ((src>>12) < 0x20 or (src>>12) >= 0xffffffffffffffe0): + c.lui ${dst}, ${pretty(src>>12)} /* mv ${dst}, ${pretty(src)} */ + +## 12-bit immediate +% elif src < 0x800 or src >= 0xfffffffffffff800: + % if src & 0xf == 0 or (src & 0xfff) >> 8 in [0, 10]: + /* mv ${dst}, ${pretty(src)} */ + xori ${dst}, zero, ${pretty(src ^ 0x7ff)} + xori ${dst}, ${dst}, ${pretty(0x7ff)} + % else: + xori ${dst}, zero, ${pretty(src)} + % endif + +## 32-bit immediate with lui and xori +% elif (src < 0x80000000 or src >= 0xffffffff80000000) and src & 0x800 == 0 and encodes_no_newline(src, src): + /* mv ${dst}, ${pretty(src)} */ + lui ${dst}, ${pretty(src >> 12)} + xori ${dst}, ${dst}, ${pretty(src & 0xfff)} +% elif (src < 0x80000000 or src >= 0xffffffff80000000) and src & 0x800 == 0x800 and encodes_no_newline(src, ~src): + /* mv ${dst}, ${pretty(src)} */ + lui ${dst}, ${pretty((~src >> 12) & 0xfffff)} + xori ${dst}, ${dst}, ${pretty(src & 0xfff | 0xfffffffffffff000)} + +## 64-bit immediate with lui, addi, and slli +## FIXME: Make this null and newline free +% else: + li ${dst}, ${pretty(src)} + +% endif +% endif diff --git a/pwnlib/shellcraft/templates/riscv64/nop.asm b/pwnlib/shellcraft/templates/riscv64/nop.asm new file mode 100644 index 000000000..dbb731dd4 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/nop.asm @@ -0,0 +1,2 @@ +<%docstring>RISCV64 nop instruction. + add x31, x0, x31 diff --git a/pwnlib/shellcraft/templates/riscv64/push.asm b/pwnlib/shellcraft/templates/riscv64/push.asm new file mode 100644 index 000000000..0a9f97adc --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/push.asm @@ -0,0 +1,27 @@ +<% + from pwnlib.shellcraft import riscv64 + from pwnlib import constants + from pwnlib.shellcraft import registers + from six import text_type, binary_type +%> +<%page args="value"/> +<%docstring> +Pushes a value onto the stack. + +Register t4 is not guaranteed to be preserved. + +<% +is_reg = value in registers.riscv + +if not is_reg and isinstance(value, (binary_type, text_type)): + try: + value = constants.eval(value) + except (ValueError, AttributeError): + pass +%> +% if not is_reg: + ${riscv64.mov('t4', value)} + <% value = 't4' %>\ +%endif + sd ${value}, -8(sp) + addi sp, sp, -8 diff --git a/pwnlib/shellcraft/templates/riscv64/pushstr.asm b/pwnlib/shellcraft/templates/riscv64/pushstr.asm new file mode 100644 index 000000000..252536e27 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/pushstr.asm @@ -0,0 +1,98 @@ +<% + from pwnlib.util import lists, packing, fiddling + from pwnlib.shellcraft import riscv64, pretty + import six +%>\ +<%page args="string, append_null = True"/> +<%docstring> +Pushes a string onto the stack without using +null bytes or newline characters. + +Example: + + >>> print(shellcraft.riscv64.pushstr('').rstrip()) + /* push b'\x00' */ + sw zero, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr('a').rstrip()) + /* push b'a\x00' */ + /* mv t4, 0x61 */ + xori t4, zero, 0x79e + xori t4, t4, 0x7ff + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr('aa').rstrip()) + /* push b'aa\x00' */ + li t4, 0x6161 + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr('aaaa').rstrip()) + /* push b'aaaa\x00' */ + /* mv t4, 0x61616161 */ + lui t4, 0x61616 + xori t4, t4, 0x161 + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr('aaaaa').rstrip()) + /* push b'aaaaa\x00' */ + li t4, 0x6161616161 + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr('aaaa', append_null = False).rstrip()) + /* push b'aaaa' */ + /* mv t4, 0x61616161 */ + lui t4, 0x61616 + xori t4, t4, 0x161 + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr(b'\xc3').rstrip()) + /* push b'\xc3\x00' */ + /* mv t4, 0xc3 */ + xori t4, zero, 0x73c + xori t4, t4, 0x7ff + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(shellcraft.riscv64.pushstr(b'\xc3', append_null = False).rstrip()) + /* push b'\xc3' */ + /* mv t4, 0xc3 */ + xori t4, zero, 0x73c + xori t4, t4, 0x7ff + sd t4, -8(sp) + addi sp, sp, -8 + >>> print(enhex(asm(shellcraft.riscv64.pushstr("/bin/sh")))) + b79e39349b8e7e7bb20e938ebe34b60e938efe22233cd1ff6111 + >>> print(enhex(asm(shellcraft.riscv64.pushstr("")))) + 232c01fe6111 + >>> print(enhex(asm(shellcraft.riscv64.pushstr("\x00", append_null = False)))) + 232c01fe6111 + +Args: + string (str): The string to push. + append_null (bool): Whether to append a single NULL-byte before pushing. + +<% + if isinstance(string, six.text_type): + string = string.encode('utf-8') + if append_null: + string += b'\x00' + if not string: + return + + split_string = lists.group(8, string, 'fill', b'\x00') + stack_offset = len(split_string) * -8 +%>\ + /* push ${pretty(string, False)} */ +% for index, word in enumerate(split_string): +% if word == b'\x00\x00\x00\x00\x00\x00\x00\x00': + sw zero, ${stack_offset+(8 * index)}(sp) +<% + continue +%>\ +% endif +<% + word = packing.u64(word, sign=True) +%>\ + ${riscv64.mov('t4', word)} + sd t4, ${stack_offset+(8 * index)}(sp) +% endfor + addi sp, sp, ${stack_offset} diff --git a/pwnlib/shellcraft/templates/riscv64/pushstr_array.asm b/pwnlib/shellcraft/templates/riscv64/pushstr_array.asm new file mode 100644 index 000000000..a7a40fd52 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/pushstr_array.asm @@ -0,0 +1,38 @@ +<% from pwnlib.shellcraft import riscv64, pretty %> +<%docstring> +Pushes an array/envp-style array of pointers onto the stack. + +Arguments: + reg(str): + Destination register to hold the pointer. + array(str,list): + Single argument or list of arguments to push. + NULL termination is normalized so that each argument + ends with exactly one NULL byte. + +<%page args="reg, array"/> +<% +if isinstance(array, (str)): + array = [array] + +array_str = '' + +# Normalize all of the arguments' endings +array = [arg.rstrip('\x00') + '\x00' for arg in array] +array_str = ''.join(array) + +word_size = 8 +offset = len(array_str) + word_size + +%>\ + /* push argument array ${pretty(array, False)} */ + ${riscv64.pushstr(array_str)} + ${riscv64.mov(reg, 0)} + ${riscv64.push(reg)} /* null terminate */ +% for i,arg in enumerate(reversed(array)): + ${riscv64.mov(reg, offset + word_size*i - len(arg))} + add ${reg}, sp, ${reg} + ${riscv64.push(reg)} /* ${pretty(arg, False)} */ + <% offset -= len(arg) %>\ +% endfor + ${riscv64.mov(reg,'sp')} diff --git a/pwnlib/shellcraft/templates/riscv64/setregs.asm b/pwnlib/shellcraft/templates/riscv64/setregs.asm new file mode 100644 index 000000000..90306e106 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/setregs.asm @@ -0,0 +1,46 @@ +<% + from pwnlib.regsort import regsort + from pwnlib.constants import Constant, eval + from pwnlib.shellcraft import registers + from pwnlib.shellcraft import riscv64 +%> +<%page args="reg_context, stack_allowed = True"/> +<%docstring> +Sets multiple registers, taking any register dependencies into account +(i.e., given eax=1,ebx=eax, set ebx first). + +Args: + reg_context (dict): Desired register context + stack_allowed (bool): Can the stack be used? + +Example: + + >>> print(shellcraft.setregs({'t0':1, 'a3':'0'}).rstrip()) + c.li a3, 0 + c.li t0, 1 + >>> print(shellcraft.setregs({'a0':'a1', 'a1':'a0', 'a2':'a1'}).rstrip()) + c.mv a2, a1 + c.mv t4, a1 + xor a1, a0, t4 /* xchg a1, a0 */ + c.mv t4, a0 + xor a0, a1, t4 + c.mv t4, a1 + xor a1, a0, t4 + +<% +reg_context = {k:v for k,v in reg_context.items() if v is not None} +sorted_regs = regsort(reg_context, registers.riscv) +%> +% if not sorted_regs: + /* setregs noop */ +% else: +% for how, src, dst in regsort(reg_context, registers.riscv): +% if how == 'xchg': + ${riscv64.xor(dst, dst, src)} /* xchg ${dst}, ${src} */ + ${riscv64.xor(src, src, dst)} + ${riscv64.xor(dst, dst, src)} +% else: + ${riscv64.mov(src, dst)} +% endif +% endfor +% endif diff --git a/pwnlib/shellcraft/templates/riscv64/trap.asm b/pwnlib/shellcraft/templates/riscv64/trap.asm new file mode 100644 index 000000000..fade233c0 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/trap.asm @@ -0,0 +1,2 @@ +<%docstring>A trap instruction. + ebreak diff --git a/pwnlib/shellcraft/templates/riscv64/xor.asm b/pwnlib/shellcraft/templates/riscv64/xor.asm new file mode 100644 index 000000000..5a506e284 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/xor.asm @@ -0,0 +1,34 @@ +<% + from pwnlib.shellcraft import riscv64 + from pwnlib.shellcraft import registers +%> +<%page args="dst,rs1,rs2"/> +<%docstring> +XOR two registers rs1 and rs2, store result in register dst. + +Register t4 is not guaranteed to be preserved. + +<% +if not isinstance(dst, str) or dst not in registers.riscv: + log.error("Unknown register %r", dst) + return +if not isinstance(rs1, str) or rs1 not in registers.riscv: + log.error("Unknown register %r", rs1) + return +if not isinstance(rs2, str) or rs2 not in registers.riscv: + log.error("Unknown register %r", rs2) + return + +rs1_reg = registers.riscv[rs1] +rs2_reg = registers.riscv[rs2] +%> +## 0000000 rs2 rs1 +## 0000000 00000 0000 +% if rs1_reg & 0x10 > 0 and (rs2_reg > 1 or rs1_reg & 0xf > 0) and (rs1_reg != 0x10 and rs2_reg != 10): + xor ${dst}, ${rs2}, ${rs1} +% elif rs2_reg & 0x10 > 0 and (rs1_reg > 1 or rs2_reg & 0xf > 0) and (rs2_reg != 0x10 and rs1_reg != 10): + xor ${dst}, ${rs1}, ${rs2} +% else: + ${riscv64.mov('t4', rs1)} + xor ${dst}, ${rs2}, t4 +% endif From 5981c7290dd5190733c1f2e9ccf08633869f8b31 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Fri, 29 Mar 2024 17:52:34 +0100 Subject: [PATCH 094/107] Change newline when setting `context.os` to "windows" (#2330) * Change newline when setting `context.os` Windows uses `b'\r\n'` for newlines while unix uses `b'\n'`. Change the expected newline to `b'\r\n'` when setting `context.os = "windows"` automatically for convenience. * Update CHANGELOG * Fix other tests setting os --- CHANGELOG.md | 2 + pwnlib/context/__init__.py | 77 +++++++++++++++++++++++++++++++++----- 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 347a26c66..2fb9e31d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,12 +76,14 @@ The table below shows which release corresponds to each branch, and what date th - [#2374][2374] libcdb.unstrip_libc: debug symbols are fetched only if not present - [#2327][2327] Add basic support to debug processes on Windows - [#2322][2322] Add basic RISCV64 shellcraft support +- [#2330][2330] Change `context.newline` when setting `context.os` to `"windows"` [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 [2374]: https://github.com/Gallopsled/pwntools/pull/2374 [2327]: https://github.com/Gallopsled/pwntools/pull/2327 [2322]: https://github.com/Gallopsled/pwntools/pull/2322 +[2330]: https://github.com/Gallopsled/pwntools/pull/2330 ## 4.13.0 (`beta`) diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 9d6ebe71d..3d090e138 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -302,7 +302,7 @@ class ContextType(object): >>> context.os == 'linux' True >>> context.arch = 'arm' - >>> vars(context) == {'arch': 'arm', 'bits': 32, 'endian': 'little', 'os': 'linux'} + >>> vars(context) == {'arch': 'arm', 'bits': 32, 'endian': 'little', 'os': 'linux', 'newline': b'\n'} True >>> context.endian 'little' @@ -376,8 +376,19 @@ class ContextType(object): 'timeout': Timeout.maximum, } - #: Valid values for :meth:`pwnlib.context.ContextType.os` - oses = sorted(('linux','freebsd','windows','cgc','android','baremetal','darwin')) + unix_like = {'newline': b'\n'} + windows_like = {'newline': b'\r\n'} + + #: Keys are valid values for :meth:`pwnlib.context.ContextType.os` + oses = _longest({ + 'linux': unix_like, + 'freebsd': unix_like, + 'windows': windows_like, + 'cgc': unix_like, + 'android': unix_like, + 'baremetal': unix_like, + 'darwin': unix_like, + }) big_32 = {'endian': 'big', 'bits': 32} big_64 = {'endian': 'big', 'bits': 64} @@ -446,14 +457,14 @@ def __init__(self, **kwargs): def copy(self): - """copy() -> dict + r"""copy() -> dict Returns a copy of the current context as a dictionary. Examples: >>> context.clear() >>> context.os = 'linux' - >>> vars(context) == {'os': 'linux'} + >>> vars(context) == {'os': 'linux', 'newline': b'\n'} True """ return self._tls.copy() @@ -1104,25 +1115,73 @@ def mask(self): @_validator def os(self, os): - """ + r""" Operating system of the target machine. The default value is ``linux``. Allowed values are listed in :attr:`pwnlib.context.ContextType.oses`. + Side Effects: + + If an os is specified some attributes will be set on the context + if a user has not already set a value. + + The following property may be modified: + + - :attr:`newline` + + Raises: + AttributeError: An invalid os was specified + Examples: - >>> context.os = 'linux' + >>> context.clear() + >>> context.os == 'linux' # Default os + True + + >>> context.os = 'freebsd' + >>> context.os == 'freebsd' + True + >>> context.os = 'foobar' #doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: os must be one of ['android', 'baremetal', 'cgc', 'freebsd', 'linux', 'windows'] + + >>> context.clear() + >>> context.newline == b'\n' # Default value + True + >>> context.os = 'windows' + >>> context.newline == b'\r\n' # New value + True + + Note that expressly setting :attr:`newline` means that we use + that value instead of the default + + >>> context.clear() + >>> context.newline = b'\n' + >>> context.os = 'windows' + >>> context.newline == b'\n' + True + + Setting the os can override the default for :attr:`newline` + + >>> context.clear() + >>> context.os = 'windows' + >>> vars(context) == {'os': 'windows', 'newline': b'\r\n'} + True """ os = os.lower() - if os not in self.oses: - raise AttributeError("os must be one of %r" % self.oses) + try: + defaults = self.oses[os] + except KeyError: + raise AttributeError("os must be one of %r" % sorted(self.oses)) + + for k,v in defaults.items(): + if k not in self._tls: + self._tls[k] = v return os From c1ce1897df77d816b8ff1b929c5189ba0e9b809f Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 21 Apr 2024 22:13:56 +0200 Subject: [PATCH 095/107] Fix duplicate definition of `ssh.sftp` (#2394) --- pwnlib/tubes/ssh.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 53b8be0d5..0bedd6359 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -550,10 +550,6 @@ class ssh(Timeout, Logger): #: Paramiko SSHClient which backs this object client = None - #: Paramiko SFTPClient object which is used for file transfers. - #: Set to :const:`None` to disable ``sftp``. - sftp = None - #: PID of the remote ``sshd`` process servicing this connection. pid = None @@ -719,6 +715,9 @@ def cwd(self, cwd): @property def sftp(self): + """Paramiko SFTPClient object which is used for file transfers. + Set to :const:`None` to disable ``sftp``. + """ if not self._tried_sftp: try: self._sftp = self.transport.open_sftp_client() From d2a02a7b37ba9d7c8c510b16eb16e268053f29de Mon Sep 17 00:00:00 2001 From: Lewis Watson Date: Sun, 21 Apr 2024 21:14:55 +0100 Subject: [PATCH 096/107] Updated Mac OS Install Documentation (#2392) * Added Missing MacOS Requirements * Updated Binutils Install Docs Due to security reasons Homebrew has removed direct formula references, this is the workaround. * Updated changelog for #2392 * reverting changelog --- docs/source/install.rst | 3 +++ docs/source/install/binutils.rst | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index d63e67523..6ea664dd5 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -15,6 +15,9 @@ following system libraries installed. install/* + +Note: For Mac OS X you will need to have cmake ``brew install cmake`` and pkg-config ``brew install pkg-config`` installed. + Released Version ----------------- diff --git a/docs/source/install/binutils.rst b/docs/source/install/binutils.rst index d802701bb..6a33369cd 100644 --- a/docs/source/install/binutils.rst +++ b/docs/source/install/binutils.rst @@ -32,14 +32,15 @@ Mac OS X ^^^^^^^^^^^^^^^^ Mac OS X is just as easy, but requires building binutils from source. -However, we've made ``homebrew`` recipes to make this a single command. +However, we've made ``homebrew`` recipes to make this just two commands. After installing `brew `__, grab the appropriate recipe from our `binutils repo `__. .. code-block:: bash - $ brew install https://raw.githubusercontent.com/Gallopsled/pwntools-binutils/master/macos/binutils-$ARCH.rb + $ wget https://raw.githubusercontent.com/Gallopsled/pwntools-binutils/master/macos/binutils-$ARCH.rb + $ brew install ./binutils-$ARCH.rb Alternate OSes ^^^^^^^^^^^^^^^^ From eec3321ae9c1306b64231f6538a573e7265bdb11 Mon Sep 17 00:00:00 2001 From: marinelay Date: Mon, 22 Apr 2024 05:18:28 +0900 Subject: [PATCH 097/107] Fix passing bytes to `context.log_file` and `crc.BitPolynom` (#2389) * Fix incosistent usage of bytes/str * update changelog * Update CHANGELOG --------- Co-authored-by: marinelay Co-authored-by: Peace-Maker --- CHANGELOG.md | 2 ++ pwnlib/context/__init__.py | 2 ++ pwnlib/util/crc/__init__.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fb9e31d1..631184f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2327][2327] Add basic support to debug processes on Windows - [#2322][2322] Add basic RISCV64 shellcraft support - [#2330][2330] Change `context.newline` when setting `context.os` to `"windows"` +- [#2389][2389] Fix passing bytes to `context.log_file` and `crc.BitPolynom` [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 @@ -84,6 +85,7 @@ The table below shows which release corresponds to each branch, and what date th [2327]: https://github.com/Gallopsled/pwntools/pull/2327 [2322]: https://github.com/Gallopsled/pwntools/pull/2322 [2330]: https://github.com/Gallopsled/pwntools/pull/2330 +[2389]: https://github.com/Gallopsled/pwntools/pull/2389 ## 4.13.0 (`beta`) diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 3d090e138..3bf265893 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -1033,6 +1033,8 @@ def log_file(self, value): """ if isinstance(value, (bytes, six.text_type)): # check if mode was specified as "[value],[mode]" + from pwnlib.util.packing import _need_text + value = _need_text(value) if ',' not in value: value += ',a' filename, mode = value.rsplit(',', 1) diff --git a/pwnlib/util/crc/__init__.py b/pwnlib/util/crc/__init__.py index f4271b23f..80a5c5649 100644 --- a/pwnlib/util/crc/__init__.py +++ b/pwnlib/util/crc/__init__.py @@ -74,6 +74,8 @@ class BitPolynom(object): def __init__(self, n): if isinstance(n, (bytes, six.text_type)): + from pwnlib.util.packing import _need_text + n = _need_text(n) self.n = 0 x = BitPolynom(2) try: From 7ac5a34a59336035eaee7e90fb205559dca5ec58 Mon Sep 17 00:00:00 2001 From: marinelay Date: Mon, 22 Apr 2024 05:22:46 +0900 Subject: [PATCH 098/107] Change from `pop` to `keys` for reporting proper error message (#2391) * Change from pop to keys for reporting proper error message * update changelog * add doctest for xor * Add newline to run xor doctests * Switch to `dict.popitem()` --------- Co-authored-by: marinelay Co-authored-by: Peace-Maker --- CHANGELOG.md | 2 ++ pwnlib/util/fiddling.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 631184f05..287b4b36c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2322][2322] Add basic RISCV64 shellcraft support - [#2330][2330] Change `context.newline` when setting `context.os` to `"windows"` - [#2389][2389] Fix passing bytes to `context.log_file` and `crc.BitPolynom` +- [#2391][2391] Fix error message when passing invalid kwargs to `xor` [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 @@ -86,6 +87,7 @@ The table below shows which release corresponds to each branch, and what date th [2322]: https://github.com/Gallopsled/pwntools/pull/2322 [2330]: https://github.com/Gallopsled/pwntools/pull/2330 [2389]: https://github.com/Gallopsled/pwntools/pull/2389 +[2391]: https://github.com/Gallopsled/pwntools/pull/2391 ## 4.13.0 (`beta`) diff --git a/pwnlib/util/fiddling.py b/pwnlib/util/fiddling.py index 2b7ec7296..ccad12e04 100644 --- a/pwnlib/util/fiddling.py +++ b/pwnlib/util/fiddling.py @@ -320,14 +320,19 @@ def xor(*args, **kwargs): The string of the arguments xor'ed together. Example: + >>> xor(b'lol', b'hello', 42) b'. ***' + >>> xor(cut = 'min', other = '') + Traceback (most recent call last): + ... + TypeError: xor() got an unexpected keyword argument 'other' """ cut = kwargs.pop('cut', 'max') if kwargs != {}: - raise TypeError("xor() got an unexpected keyword argument '%s'" % kwargs.pop()[0]) + raise TypeError("xor() got an unexpected keyword argument '%s'" % kwargs.popitem()[0]) if len(args) == 0: raise ValueError("Must have something to xor") From 60072487f1c4bd14f372c7a5494d4c5f53251a32 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 21 Apr 2024 22:24:35 +0200 Subject: [PATCH 099/107] Fix displaying bright color variation in terminal output (#2373) * Recompute text.has_bright when num_colors changes The number of simultaneous colors in the current terminal are queried later during initialization and the text.num_colors attribute is updated accordingly. The text.has_bright attribute wasn't updated when that happened and always remained set to False. Calculate those properties based on num_colors dynamically. * Update CHANGELOG * Enable bright colors on Windows too Only get "colors" on Windows to avoid #1201 again. * Fix support for old terminals on windows --- CHANGELOG.md | 5 +++++ pwnlib/term/text.py | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c62a27b99..703b3f2a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -129,6 +129,11 @@ The table below shows which release corresponds to each branch, and what date th [2347]: https://github.com/Gallopsled/pwntools/pull/2347 [2233]: https://github.com/Gallopsled/pwntools/pull/2233 +## 4.12.1 +- [#2373][2373] Fix displaying bright color variation in terminal output + +[2373]: https://github.com/Gallopsled/pwntools/pull/2373 + ## 4.12.0 (`stable`) - [#2202][2202] Fix `remote` and `listen` in sagemath diff --git a/pwnlib/term/text.py b/pwnlib/term/text.py index 8e5ddef63..84cfdc923 100644 --- a/pwnlib/term/text.py +++ b/pwnlib/term/text.py @@ -27,9 +27,7 @@ class Module(types.ModuleType): def __init__(self): self.__file__ = __file__ self.__name__ = __name__ - self.num_colors = 8 - self.has_bright = self.num_colors >= 16 - self.has_gray = self.has_bright + self.num_colors = termcap.get('colors', 8) if sys.platform == 'win32' else 8 self.when = 'auto' self._colors = { 'black': 0, @@ -61,6 +59,14 @@ def when(self): def when(self, val): self._when = eval_when(val) + @property + def has_bright(self): + return self.num_colors >= 16 + + @property + def has_gray(self): + return self.has_bright + def _fg_color(self, c): c = termcap.get('setaf', c) or termcap.get('setf', c) if not hasattr(c, 'encode'): From db98e5edfba9e8f57334254a474bc7d3c2463dd6 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 21 Apr 2024 22:33:34 +0200 Subject: [PATCH 100/107] Don't go through a shell in `gdb.debug` (#2378) * Don't go though a shell in `gdb.debug` gdbserver starts a shell and runs the target process through it. This behavior was added in gdbserver 8.0 together with the commandline flag --no-startup-with-shell to disable it. * Update CHANGELOG --- CHANGELOG.md | 4 ++++ pwnlib/gdb.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 703b3f2a3..ff133fbf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The table below shows which release corresponds to each branch, and what date th | ---------------- | -------- | ---------------------- | | [4.14.0](#4140-dev) | `dev` | | [4.13.0](#4130-beta) | `beta` | +| [4.12.1](#4121) | | | [4.12.0](#4120-stable) | `stable` | Feb 22, 2024 | [4.11.1](#4111) | | Nov 14, 2023 | [4.11.0](#4110) | | Sep 15, 2023 @@ -130,9 +131,12 @@ The table below shows which release corresponds to each branch, and what date th [2233]: https://github.com/Gallopsled/pwntools/pull/2233 ## 4.12.1 + - [#2373][2373] Fix displaying bright color variation in terminal output +- [#2378][2378] Don't go though a shell in `gdb.debug` [2373]: https://github.com/Gallopsled/pwntools/pull/2373 +[2378]: https://github.com/Gallopsled/pwntools/pull/2378 ## 4.12.0 (`stable`) diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 753955ea4..51762f1a9 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -287,7 +287,9 @@ def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None): orig_args = args - gdbserver_args = [gdbserver, '--multi'] + # --no-startup-with-shell is required for forking shells like SHELL=/bin/fish + # https://github.com/Gallopsled/pwntools/issues/2377 + gdbserver_args = [gdbserver, '--multi', '--no-startup-with-shell'] if context.aslr: gdbserver_args += ['--no-disable-randomization'] else: From f2f55f3e1c26e41e7b23f2fab0ff41baf7ebb27c Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 21 Apr 2024 22:37:46 +0200 Subject: [PATCH 101/107] Return buffered data on first EOF in tube.readline() (#2376) * Return buffered data on first EOF in tube.readline() When there is still data available in the tube buffer when an EOFError occurs in `tube.recvline()`, return that data even though it doesn't contain a newline. The next time `tube.recvline()` is called afterwards will raise EOFError normally. This behavior is in line with the GNU readline implementation and avoids loss of data. It allows `tube.stream()` to print everything that's received before the receiving end terminates. A new warning is logged when data is returned due to an EOF informing about the lack of the trailing newline character. Fixes #2366 * Update CHANGELOG * Add context.throw_eof_on_incomplete_line Allow to control the behavior of `tube.recvline` and be able to suppress the new warning. * Cleanup docs --- CHANGELOG.md | 2 ++ pwnlib/context/__init__.py | 20 ++++++++++++++++++ pwnlib/tubes/tube.py | 43 ++++++++++++++++++++++++++++++++++---- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 287b4b36c..d3c083d07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2330][2330] Change `context.newline` when setting `context.os` to `"windows"` - [#2389][2389] Fix passing bytes to `context.log_file` and `crc.BitPolynom` - [#2391][2391] Fix error message when passing invalid kwargs to `xor` +- [#2376][2376] Return buffered data on first EOF in tube.readline() [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 @@ -88,6 +89,7 @@ The table below shows which release corresponds to each branch, and what date th [2330]: https://github.com/Gallopsled/pwntools/pull/2330 [2389]: https://github.com/Gallopsled/pwntools/pull/2389 [2391]: https://github.com/Gallopsled/pwntools/pull/2391 +[2376]: https://github.com/Gallopsled/pwntools/pull/2376 ## 4.13.0 (`beta`) diff --git a/pwnlib/context/__init__.py b/pwnlib/context/__init__.py index 3bf265893..0750c7f20 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -367,6 +367,7 @@ class ContextType(object): 'randomize': False, 'rename_corefiles': True, 'newline': b'\n', + 'throw_eof_on_incomplete_line': None, 'noptrace': False, 'os': 'linux', 'proxy': None, @@ -1490,6 +1491,25 @@ def newline(self, v): # circular imports from pwnlib.util.packing import _need_bytes return _need_bytes(v) + + @_validator + def throw_eof_on_incomplete_line(self, v): + """Whether to raise an :class:`EOFError` if an EOF is received before a newline in ``tube.recvline``. + + Controls if an :class:`EOFError` is treated as newline in ``tube.recvline`` and similar functions + and whether a warning should be logged about it. + + Possible values are: + + - ``True``: Raise an :class:`EOFError` if an EOF is received before a newline. + - ``False``: Return the data received so far if an EOF is received + before a newline without logging a warning. + - ``None``: Return the data received so far if an EOF is received + before a newline and log a warning. + + Default value is ``None``. + """ + return v if v is None else bool(v) @_validator diff --git a/pwnlib/tubes/tube.py b/pwnlib/tubes/tube.py index 89ae3fcce..a14e2d286 100644 --- a/pwnlib/tubes/tube.py +++ b/pwnlib/tubes/tube.py @@ -467,19 +467,31 @@ def recvline(self, keepends=True, timeout=default): Receive a single line from the tube. A "line" is any sequence of bytes terminated by the byte sequence - set in :attr:`newline`, which defaults to ``'\n'``. + set in :attr:`newline`, which defaults to ``b'\n'``. + + If the connection is closed (:class:`EOFError`) before a newline + is received, the buffered data is returned by default and a warning + is logged. If the buffer is empty, an :class:`EOFError` is raised. + This behavior can be changed by setting :meth:`pwnlib.context.ContextType.throw_eof_on_incomplete_line`. If the request is not satisfied before ``timeout`` seconds pass, - all data is buffered and an empty string (``''``) is returned. + all data is buffered and an empty byte string (``b''``) is returned. Arguments: keepends(bool): Keep the line ending (:const:`True`). timeout(int): Timeout + Raises: + :class:`EOFError`: The connection closed before the request + could be satisfied and the buffer is empty + Return: All bytes received over the tube until the first newline ``'\n'`` is received. Optionally retains - the ending. + the ending. If the connection is closed before a newline + is received, the remaining data received up to this point + is returned. + Examples: @@ -494,8 +506,31 @@ def recvline(self, keepends=True, timeout=default): >>> t.newline = b'\r\n' >>> t.recvline(keepends = False) b'Foo\nBar' + >>> t = tube() + >>> def _recv_eof(n): + ... if not _recv_eof.throw: + ... _recv_eof.throw = True + ... return b'real line\ntrailing data' + ... raise EOFError + >>> _recv_eof.throw = False + >>> t.recv_raw = _recv_eof + >>> t.recvline() + b'real line\n' + >>> t.recvline() + b'trailing data' + >>> t.recvline() # doctest: +ELLIPSIS + Traceback (most recent call last): + ... + EOFError """ - return self.recvuntil(self.newline, drop = not keepends, timeout = timeout) + try: + return self.recvuntil(self.newline, drop = not keepends, timeout = timeout) + except EOFError: + if not context.throw_eof_on_incomplete_line and self.buffer.size > 0: + if context.throw_eof_on_incomplete_line is None: + self.warn_once('EOFError during recvline. Returning buffered data without trailing newline.') + return self.buffer.get() + raise def recvline_pred(self, pred, keepends=False, timeout=default): r"""recvline_pred(pred, keepends=False) -> bytes From af6c8c88782cf2865c8dc060d943104958f27ef4 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sun, 21 Apr 2024 23:31:29 +0200 Subject: [PATCH 102/107] gdb.debug: gdbserver --wrapper requires startup-with-shell Only add it when we don't want to manipulate the environment or argv[0]. This will cause the problem with fish shell to reappear in those cases, but it's another step for compatibility at least. #2378 --- pwnlib/gdb.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 72581de9e..7a718799e 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -323,9 +323,7 @@ def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None, python orig_args = args - # --no-startup-with-shell is required for forking shells like SHELL=/bin/fish - # https://github.com/Gallopsled/pwntools/issues/2377 - gdbserver_args = [gdbserver, '--multi', '--no-startup-with-shell'] + gdbserver_args = [gdbserver, '--multi'] if context.aslr: gdbserver_args += ['--no-disable-randomization'] else: @@ -348,6 +346,10 @@ def _gdbserver_args(pid=None, path=None, args=None, which=None, env=None, python gdbserver_args += ['--wrapper', python_wrapper_script, '--'] elif env is not None: gdbserver_args += ['--wrapper', which('env'), '-i'] + env_args + ['--'] + # --no-startup-with-shell is required for forking shells like SHELL=/bin/fish + # https://github.com/Gallopsled/pwntools/issues/2377 + else: + gdbserver_args += ['--no-startup-with-shell'] gdbserver_args += ['localhost:0'] gdbserver_args += args From 5f79e1dc5135e80bfde9a93e9c9c99a2fd684e6a Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sun, 25 Feb 2024 14:14:08 +0100 Subject: [PATCH 103/107] ci: Install rpyc from pip instead of apt The apt package appears outdated and incompatible with the latest version on pypi. >>> ValueError: invalid message type: 18 --- .github/workflows/ci.yml | 8 +++++++- pwnlib/gdb.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e0d5bda2..7cfe71039 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,13 @@ jobs: git fetch origin git log --oneline --graph -10 + - name: Install RPyC for gdb + run: | + # The version packaged in python3-rpyc is too old on Ubuntu 22.04 + sudo apt-get update && sudo apt-get install -y python3-pip gdb gdbserver + /usr/bin/python -m pip install rpyc + gdb --batch --quiet --nx --nh --ex 'py import rpyc; print(rpyc.version.version)' + - name: Cache for pip uses: actions/cache@v4 id: cache-pip @@ -62,7 +69,6 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \ ash bash-static dash ksh mksh zsh \ - python3-rpyc \ gdb gdbserver socat \ binutils-multiarch qemu-user-static \ binutils-aarch64-linux-gnu \ diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 7a718799e..c8f637402 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -530,6 +530,7 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io = gdb.debug(["grep", "local-libc.so", "/proc/self/maps"], gdbscript="continue", env={"LD_PRELOAD": "./local-libc.so"}) >>> io.recvline().split()[-1] # doctest: +ELLIPSIS b'.../local-libc.so' + >>> io.close() >>> os.remove("./local-libc.so") # cleanup @@ -559,6 +560,7 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, api= >>> io.gdb.continue_nowait() >>> io.recvline() b'foo\n' + >>> io.close() Using SSH: From fe560c98355ccfea6f895f64c12eb39d082147ca Mon Sep 17 00:00:00 2001 From: qux-bbb <1147635419@qq.com> Date: Wed, 24 Apr 2024 18:46:07 +0800 Subject: [PATCH 104/107] Add sudo for apt-get (#2395) --- README.md | 4 ++-- docs/source/install.rst | 8 ++++---- docs/source/install/binutils.rst | 8 ++++---- docs/source/install/headers.rst | 2 +- setup.py | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index c9d31bf4b..7bd8fdf99 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Pwntools is best supported on 64-bit Ubuntu LTS releases (14.04, 16.04, 18.04, a Python3 is suggested, but Pwntools still works with Python 2.7. Most of the functionality of pwntools is self-contained and Python-only. You should be able to get running quickly with ```sh -apt-get update -apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential +sudo apt-get update +sudo apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential python3 -m pip install --upgrade pip python3 -m pip install --upgrade pwntools ``` diff --git a/docs/source/install.rst b/docs/source/install.rst index 6ea664dd5..2087826a6 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -28,8 +28,8 @@ Python3 .. code-block:: bash - $ apt-get update - $ apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential + $ sudo apt-get update + $ sudo apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential $ python3 -m pip install --upgrade pip $ python3 -m pip install --upgrade pwntools @@ -43,8 +43,8 @@ Additionally, due to `pip` dropping support for Python2, a specfic version of `p .. code-block:: bash - $ apt-get update - $ apt-get install python python-pip python-dev git libssl-dev libffi-dev build-essential + $ sudo apt-get update + $ sudo apt-get install python python-pip python-dev git libssl-dev libffi-dev build-essential $ python2 -m pip install --upgrade pip==20.3.4 $ python2 -m pip install --upgrade pwntools diff --git a/docs/source/install/binutils.rst b/docs/source/install/binutils.rst index 6a33369cd..c24043a2d 100644 --- a/docs/source/install/binutils.rst +++ b/docs/source/install/binutils.rst @@ -18,15 +18,15 @@ Ubuntu Xenial (16.04) has official packages for most architectures, and does not .. code-block:: bash - $ apt-get install software-properties-common - $ apt-add-repository ppa:pwntools/binutils - $ apt-get update + $ sudo apt-get install software-properties-common + $ sudo apt-add-repository ppa:pwntools/binutils + $ sudo apt-get update Then, install the binutils for your architecture. .. code-block:: bash - $ apt-get install binutils-$ARCH-linux-gnu + $ sudo apt-get install binutils-$ARCH-linux-gnu Mac OS X ^^^^^^^^^^^^^^^^ diff --git a/docs/source/install/headers.rst b/docs/source/install/headers.rst index bfed6bfff..d884e8599 100644 --- a/docs/source/install/headers.rst +++ b/docs/source/install/headers.rst @@ -10,7 +10,7 @@ Ubuntu .. code-block:: bash - $ apt-get install python-dev + $ sudo apt-get install python-dev Mac OS X ^^^^^^^^^^^^^^^^ diff --git a/setup.py b/setup.py index 7d57ff7c5..27c62ac18 100755 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ PythonH = os.path.join(get_python_inc(), 'Python.h') if not os.path.exists(PythonH): print("You must install the Python development headers!", file=sys.stderr) - print("$ apt-get install python-dev", file=sys.stderr) + print("$ sudo apt-get install python-dev", file=sys.stderr) sys.exit(-1) setup( From fcec11784ad261170e2f23b628ddfc6f3b38c6b4 Mon Sep 17 00:00:00 2001 From: peace-maker Date: Sun, 12 May 2024 11:31:46 +0200 Subject: [PATCH 105/107] Fix access of undefined `ssh._tried_sftp` in `raw` mode (#2396) * Fix access of undefined `ssh._tried_sftp` in `raw` mode The attribute was never set when setting `ssh(raw=True)` which caused the code to run `ssh.__getattr__` which raised an AttributeError due to `_tried_sftp` starting with an `_` on Python 3.12. * Document all `ssh` attributes --- pwnlib/tubes/ssh.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 0bedd6359..9d5c2d7ea 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -544,9 +544,24 @@ class ssh(Timeout, Logger): #: Remote port (``int``) port = None + #: Remote username (``str``) + user = None + + #: Remote password (``str``) + password = None + + #: Remote private key (``str``) + key = None + + #: Remote private key file (``str``) + keyfile = None + #: Enable caching of SSH downloads (``bool``) cache = True + #: Enable raw mode and don't probe the environment (``bool``) + raw = False + #: Paramiko SSHClient which backs this object client = None @@ -554,6 +569,7 @@ class ssh(Timeout, Logger): pid = None _cwd = '.' + _tried_sftp = False def __init__(self, user=None, host=None, port=22, password=None, key=None, keyfile=None, proxy_command=None, proxy_sock=None, level=None, From e92a30bbf7a838e739b8428d9b1d446fd671cf48 Mon Sep 17 00:00:00 2001 From: Sanjit Kumar Date: Sun, 12 May 2024 11:26:08 +0000 Subject: [PATCH 106/107] Convert bytes-like object to string in apport_corefile() method (#2387) * converting bytes-like object to string * updated changelog --------- Co-authored-by: peace-maker --- CHANGELOG.md | 2 ++ pwnlib/elf/corefile.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0c919127..fb60b6768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2389][2389] Fix passing bytes to `context.log_file` and `crc.BitPolynom` - [#2391][2391] Fix error message when passing invalid kwargs to `xor` - [#2376][2376] Return buffered data on first EOF in tube.readline() +- [#2387][2387] Convert apport_corefile() output from bytes-like object to string [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 @@ -91,6 +92,7 @@ The table below shows which release corresponds to each branch, and what date th [2389]: https://github.com/Gallopsled/pwntools/pull/2389 [2391]: https://github.com/Gallopsled/pwntools/pull/2391 [2376]: https://github.com/Gallopsled/pwntools/pull/2376 +[2387]: https://github.com/Gallopsled/pwntools/pull/2387 ## 4.13.0 (`beta`) diff --git a/pwnlib/elf/corefile.py b/pwnlib/elf/corefile.py index 02ac36ebf..1cb8823fa 100644 --- a/pwnlib/elf/corefile.py +++ b/pwnlib/elf/corefile.py @@ -1329,6 +1329,10 @@ def apport_read_crash_data(self): except Exception: pass + # Convert bytes-like object to string + if isinstance(data, bytes): + data = data.decode('utf-8') + return data def systemd_coredump_corefile(self): From 51e8eb09ee206de670e688ea5801f259cd8b80e4 Mon Sep 17 00:00:00 2001 From: Th3S <46804083+the-soloist@users.noreply.github.com> Date: Thu, 23 May 2024 22:57:19 +0800 Subject: [PATCH 107/107] libcdb: add `offline_only` to `search_by_symbol_offsets` (#2388) * Add `offline_only` for `search_by_symbol_offsets` * Fix bug * Update CHANGELOG * Remove redundant code * Update --------- Co-authored-by: peace-maker --- CHANGELOG.md | 2 + pwnlib/libcdb.py | 147 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 124 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb60b6768..312af8267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2391][2391] Fix error message when passing invalid kwargs to `xor` - [#2376][2376] Return buffered data on first EOF in tube.readline() - [#2387][2387] Convert apport_corefile() output from bytes-like object to string +- [#2388][2388] libcdb: add `offline_only` to `search_by_symbol_offsets` [2360]: https://github.com/Gallopsled/pwntools/pull/2360 [2356]: https://github.com/Gallopsled/pwntools/pull/2356 @@ -93,6 +94,7 @@ The table below shows which release corresponds to each branch, and what date th [2391]: https://github.com/Gallopsled/pwntools/pull/2391 [2376]: https://github.com/Gallopsled/pwntools/pull/2376 [2387]: https://github.com/Gallopsled/pwntools/pull/2387 +[2388]: https://github.com/Gallopsled/pwntools/pull/2388 ## 4.13.0 (`beta`) diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 8e2548acd..3685465ed 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -143,6 +143,43 @@ def provider_local_database(hex_encoded_id, hash_type): return None +def query_local_database(params): + if not context.local_libcdb or not params.get("symbols"): + return None + + localdb = Path(context.local_libcdb) + if not localdb.is_dir(): + return None + + res = [] + query_syms = params["symbols"] + + # Loop through each '.symbols' file in the local database + # Make sure `Path.rglod` order stable + for symbol_file in sorted(localdb.rglob("*.symbols"), key=lambda x: x.as_posix()): + libc_syms = _parse_libc_symbol(symbol_file) + + matched = 0 + for name, addr in query_syms.items(): + if isinstance(addr, str): + addr = int(addr, 16) + + # Compare last 12 bits + if libc_syms.get(name) and (libc_syms.get(name) & 0xfff) == (addr & 0xfff): + matched += 1 + else: + # aborting this loop once there was a mismatch. + break + + # Check if all symbols have been matched + if matched == len(query_syms): + libs_id = symbol_file.stem + libc_path = symbol_file.parent / ("%s.so" % libs_id) + libs_url = read(symbol_file.parent / ("%s.url" % libs_id)).decode().strip() + res.append(_pack_libs_info(libc_path, libs_id, libs_url, libc_syms)) + + return res + PROVIDERS = { "offline": [provider_local_system, provider_local_database], "online": [provider_libcdb, provider_libc_rip] @@ -546,7 +583,7 @@ def _handle_multiple_matching_libcs(matching_libcs): selected_index = options("Select the libc version to use:", [libc['id'] for libc in matching_libcs]) return matching_libcs[selected_index] -def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as_list=False): +def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as_list=False, offline_only=False): """ Lookup possible matching libc versions based on leaked function addresses. @@ -568,6 +605,9 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as return_as_list(bool): Return a list of build ids of all matching libc versions instead of a path to a downloaded file. + offline_only(bool): + When pass `offline_only=True`, restricts search mode to offline sources only, + disable online lookup. Defaults to `False`, and enable both offline and online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -592,27 +632,50 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as params = {'symbols': symbols} log.debug('Request: %s', params) - matching_libcs = query_libc_rip(params) - log.debug('Result: %s', matching_libcs) - if matching_libcs is None or len(matching_libcs) == 0: - log.warn_once("No matching libc for symbols %r on libc.rip", symbols) + + offline_matching = query_local_database(params) + online_matching = query_libc_rip(params) if not offline_only else None + + if offline_matching is None: + offline_matching = [] + if online_matching is None: + online_matching = [] + + # Aggregate and deduplicate matches from both sources + matching_libcs = {} + for libc in offline_matching + online_matching: + if libc['id'] not in matching_libcs: + matching_libcs[libc['id']] = libc + + log.debug('Offline search result: %s', offline_matching) + if not offline_only: + log.debug('Online search result: %s', online_matching) + + # Check if no matches are found + if len(matching_libcs) == 0: + log.warn_once("No matching libc for symbols %r", symbols) return None + matching_list = list(matching_libcs.values()) + if return_as_list: - return [libc['buildid'] for libc in matching_libcs] + return [libc['buildid'] for libc in matching_list] - if len(matching_libcs) == 1: - return search_by_build_id(matching_libcs[0]['buildid'], unstrip=unstrip) + # If there's only one match, return it directly + if len(matching_list) == 1: + return search_by_build_id(matching_list[0]['buildid'], unstrip=unstrip, offline_only=offline_only) + # If a specific index is provided, validate it and return the selected libc if select_index is not None: - if select_index > 0 and select_index <= len(matching_libcs): - return search_by_build_id(matching_libcs[select_index - 1]['buildid'], unstrip=unstrip) + if select_index > 0 and select_index <= len(matching_list): + return search_by_build_id(matching_list[select_index - 1]['buildid'], unstrip=unstrip, offline_only=offline_only) else: - log.error('Invalid selected libc index. %d is not in the range of 1-%d.', select_index, len(matching_libcs)) + log.error('Invalid selected libc index. %d is not in the range of 1-%d.', select_index, len(matching_list)) return None - selected_libc = _handle_multiple_matching_libcs(matching_libcs) - return search_by_build_id(selected_libc['buildid'], unstrip=unstrip) + # Handle multiple matches interactively if no index is specified + selected_libc = _handle_multiple_matching_libcs(matching_list) + return search_by_build_id(selected_libc['buildid'], unstrip=unstrip, offline_only=offline_only) def search_by_build_id(hex_encoded_id, unstrip=True, offline_only=False): """ @@ -624,9 +687,8 @@ def search_by_build_id(hex_encoded_id, unstrip=True, offline_only=False): unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. offline_only(bool): - Both offline and online providers are used by default. When pass - `offline_only=True`, libcdb enable an exclusive offline search mode, - which will disable online providers. + When pass `offline_only=True`, restricts search mode to offline sources only, + disable online lookup. Defaults to `False`, and enable both offline and online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -654,9 +716,8 @@ def search_by_md5(hex_encoded_id, unstrip=True, offline_only=False): unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. offline_only(bool): - Both offline and online providers are used by default. When pass - `offline_only=True`, libcdb enable an exclusive offline search mode, - which will disable online providers. + When pass `offline_only=True`, restricts search mode to offline sources only, + disable online lookup. Defaults to `False`, and enable both offline and online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -684,9 +745,8 @@ def search_by_sha1(hex_encoded_id, unstrip=True, offline_only=False): unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. offline_only(bool): - Both offline and online providers are used by default. When pass - `offline_only=True`, libcdb enable an exclusive offline search mode, - which will disable online providers. + When pass `offline_only=True`, restricts search mode to offline sources only, + disable online lookup. Defaults to `False`, and enable both offline and online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -714,9 +774,8 @@ def search_by_sha256(hex_encoded_id, unstrip=True, offline_only=False): unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. offline_only(bool): - Both offline and online providers are used by default. When pass - `offline_only=True`, libcdb enable an exclusive offline search mode, - which will disable online providers. + When pass `offline_only=True`, restricts search mode to offline sources only, + disable online lookup. Defaults to `False`, and enable both offline and online providers. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -734,7 +793,45 @@ def search_by_sha256(hex_encoded_id, unstrip=True, offline_only=False): """ return search_by_hash(hex_encoded_id, 'sha256', unstrip, offline_only) +def _parse_libc_symbol(path): + """ + Parse symbols file to `dict`, the format is same as https://github.com/niklasb/libc-database/ + """ + + syms = {} + + with open(path, "r") as fd: + for x in fd: + name, addr = x.split(" ") + syms[name] = int(addr, 16) + + return syms + +def _pack_libs_info(path, libs_id, libs_url, syms): + """ + The JSON format is the same as libc.rip, and the "download_url" field is by default an empty string, + as it's not required in offline mode. + """ + + info = {} + + info["id"] = libs_id + info["libs_url"] = libs_url + info["download_url"] = "" + + for hash_type, hash_func in HASHES.items(): + # replace 'build_id' to 'buildid' + info[hash_type.replace("_", "")] = hash_func(path) + + default_symbol_list = [ + "__libc_start_main_ret", "dup2", "printf", "puts", "read", "system", "str_bin_sh" + ] + + info["symbols"] = {} + for name in default_symbol_list: + info["symbols"][name] = hex(syms[name]) + return info def get_build_id_offsets():