diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index ba09bdaca..79b0173bd 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,7 +4,7 @@ Thanks for contributing to Pwntools! When reporting an issue, be sure that you are running the latest released version of pwntools (`pip install --upgrade pwntools`). -Please verify that your issue occurs on 64-bit Ubuntu 14.04. You can use the Dockerfile on `docker.io` for quick testing. +Please verify that your issue occurs on 64-bit Ubuntu 22.04. You can use the Dockerfile on `docker.io` for quick testing. ``` $ docker pull pwntools/pwntools:stable diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8f8e0fb65..258c51299 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -39,7 +39,7 @@ You should see `[DEBUG]` statements that show what's happening behind the scenes ## Verify on Ubuntu -If possible, please verify that your issue occurs on 64-bit Ubuntu 18.04. We provide a Dockerfile based on Ubuntu 18.04 via `docker.io` to make this super simple, no VM required! +If possible, please verify that your issue occurs on 64-bit Ubuntu 22.04. We provide a Dockerfile based on Ubuntu 22.04 via `docker.io` to make this super simple, no VM required! ```sh # Download the Docker image diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index e066f94e2..000000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Android Tests - -on: [push, pull_request] - -jobs: - android-test: - strategy: - matrix: - python-version: ['3.10'] - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: | - **/pyproject.toml - **/requirements*.txt - - - name: Install Linux dependencies - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \ - gdb gdbserver socat \ - qemu-user-static \ - binutils-aarch64-linux-gnu \ - binutils-arm-linux-gnueabihf \ - libc6-dbg - - - name: Cache for avd - uses: actions/cache@v4 - id: cache-avd - with: - path: | - ~/.android - /usr/local/lib/android/sdk/emulator - /usr/local/lib/android/sdk/platform-tools - /usr/local/lib/android/sdk/system-images - key: ${{ matrix.os }}-cache-avd-${{ hashFiles('travis/setup_avd*.sh') }} - restore-keys: | - ${{ matrix.os }}-cache-avd- - - - 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 - - - name: Install dependencies - run: | - pip install --upgrade pip - python setup.py egg_info - pip install --upgrade --editable . - - - name: Sanity checks - run: PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)' - - - name: Install documentation dependencies - run: pip install -r docs/requirements.txt - - - name: Coverage Doctests (Android Only) - run: | - source .android.env - PWNLIB_NOTERM=1 coverage run -m sphinx -b doctest docs/source docs/build/doctest docs/source/adb.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3a3e29bd..ffb3b337e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,13 +5,25 @@ jobs: test: strategy: matrix: - python_version: ['3.10', '3.12'] + python_version: ['3.10', '3.12', '3.13'] os: [ubuntu-latest] - include: - - python_version: '2.7' - os: ubuntu-22.04 runs-on: ${{ matrix.os }} timeout-minutes: 30 + services: + libcdb-cache: + image: nginx + volumes: + - /home/runner/libcdb-cache:/var/cache/nginx + ports: + - 3000:3000 # https://debuginfod.elfutils.org proxy cache + - 3001:3001 # https://libc.rip/ proxy cache + - 3002:3002 # http://archive.ubuntu.com/ proxy cache + - 3003:3003 # https://gitlab.com/ proxy cache + env: + DEBUGINFOD_URLS: http://localhost:3000/ + PWN_LIBCRIP_URL: http://localhost:3001/ + PWN_UBUNTU_ARCHIVE_URL: http://localhost:3002/ + PWN_GITLAB_LIBCDB_URL: http://localhost:3003/ steps: - uses: actions/checkout@v4 with: @@ -22,6 +34,28 @@ jobs: git fetch origin git log --oneline --graph -10 + - name: Fix libcdb-cache permissions + id: fix-perms + run: | + sudo chown -R runner:runner /home/runner/libcdb-cache + echo "date=$(/bin/date -u "+%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT + + - name: Cache for libcdb requests + uses: actions/cache@v4 + with: + path: ~/libcdb-cache + key: libcdb-python${{ matrix.python_version }}-${{ steps.fix-perms.outputs.date }} + restore-keys: | + libcdb-python${{ matrix.python_version }}- + libcdb- + + - name: Install libcdb-cache service config + run: | + sudo chown -R 101:101 /home/runner/libcdb-cache + container_id=$(docker ps --all --filter volume=/home/runner/libcdb-cache --no-trunc --format "{{.ID}}") + docker cp ./travis/libcdb_nginx_cache.conf $container_id:/etc/nginx/nginx.conf + docker restart $container_id + - name: Install RPyC for gdb run: | # The version packaged in python3-rpyc is too old on Ubuntu 24.04 @@ -30,17 +64,7 @@ jobs: /usr/bin/python -m pip install --break-system-packages rpyc || /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 - if: matrix.python_version == '2.7' - id: cache-pip - with: - path: ~/.cache/pip - key: ${{ matrix.os }}-${{ matrix.python_version }}-cache-pip-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }} - restore-keys: ${{ matrix.os }}-${{ matrix.python_version }}-cache-pip- - - name: Set up Python ${{ matrix.python_version }} - if: matrix.python_version != '2.7' uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} @@ -49,17 +73,6 @@ jobs: **/pyproject.toml **/requirements*.txt - - name: Set up Python 2.7 - if: matrix.python_version == '2.7' - run: | - sudo apt-get update - sudo apt-get install -y \ - python2.7 python2.7-dev python2-pip-whl - sudo ln -sf python2.7 /usr/bin/python - export PYTHONPATH=`echo /usr/share/python-wheels/pip-*py2*.whl` - sudo --preserve-env=PYTHONPATH python -m pip install --upgrade pip setuptools wheel - sudo chown -R $USER /usr/local/lib/python2.7 - - name: Verify tag against version if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') @@ -89,11 +102,12 @@ jobs: binutils-s390x-linux-gnu \ binutils-sparc64-linux-gnu \ binutils-riscv64-linux-gnu \ + binutils-loongarch64-linux-gnu \ gcc-multilib \ libc6-dbg \ elfutils \ patchelf - + - name: Testing Corefiles run: | ulimit -a @@ -119,10 +133,6 @@ jobs: - name: Install documentation dependencies run: pip install -r docs/requirements.txt - - name: Manually install non-broken Unicorn - if: matrix.python_version == '2.7' - run: pip install unicorn==2.0.0rc7 - - name: Disable yama ptrace_scope run: | echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope # required by some gdb doctests @@ -208,7 +218,6 @@ jobs: pwn libcdb hash b229d1da1e161f95e839cf90cded5f719e5de308 - name: Build source and wheel distributions - if: matrix.python_version != '2.7' run: | python -m build @@ -225,6 +234,116 @@ jobs: path: .coverage* include-hidden-files: true + - name: Fix libcdb-cache permissions + run: | + container_id=$(docker ps --filter volume=/home/runner/libcdb-cache --no-trunc --format "{{.ID}}") + docker stop $container_id + sudo chown -R runner:runner /home/runner/libcdb-cache + + android-test: + runs-on: ubuntu-latest + timeout-minutes: 30 + continue-on-error: true + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + cache-dependency-path: | + **/pyproject.toml + **/requirements*.txt + + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \ + gdb gdbserver socat \ + qemu-user-static \ + binutils-aarch64-linux-gnu \ + binutils-arm-linux-gnueabihf \ + libc6-dbg + + - name: Cache for avd + uses: actions/cache@v4 + id: cache-avd + with: + path: | + ~/.android + /usr/local/lib/android/sdk/emulator + /usr/local/lib/android/sdk/platform-tools + /usr/local/lib/android/sdk/system-images + key: ${{ matrix.os }}-cache-avd-${{ hashFiles('travis/setup_avd*.sh') }} + restore-keys: | + ${{ matrix.os }}-cache-avd- + + - 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 + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install --upgrade wheel build + pip install --upgrade flake8 appdirs + pip install --upgrade --editable . + + - name: Sanity checks + run: PWNLIB_NOTERM=1 python -c 'from pwn import *; print(pwnlib.term.term_mode)' + + - name: Install documentation dependencies + run: pip install -r docs/requirements.txt + + - name: Coverage Doctests (Android Only) + run: | + source .android.env + PWNLIB_NOTERM=1 coverage run -m sphinx -b doctest docs/source docs/build/doctest docs/source/adb.rst + + - uses: actions/upload-artifact@v4 + with: + name: coverage-android + path: .coverage* + include-hidden-files: true + + windows-test: + runs-on: windows-latest + timeout-minutes: 30 + continue-on-error: true + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + pip install --upgrade pip + pip install --upgrade --editable . + + - name: Install documentation dependencies + run: pip install -r docs/requirements.txt + + - name: Sanity checks + run: | + python -bb -c 'from pwn import *' + python -bb examples/text.py + + - name: Coverage doctests + run: | + python -bb -m coverage run -m sphinx -b doctest docs/source docs/build/doctest + + - uses: actions/upload-artifact@v4 + with: + name: coverage-windows + path: .coverage* + include-hidden-files: true upload-coverage: runs-on: ubuntu-latest diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index ee21b8614..410e1cae5 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -26,10 +26,11 @@ jobs: set -x pip install pylint pip install --upgrade -e . - pylint --exit-zero --errors-only pwnlib -f parseable | cut -d ' ' -f2- > current.txt + run_pylint() { pylint --exit-zero --errors-only pwnlib -f parseable | cut -d ' ' -f2- | sed 's/line [0-9]\+/line XXXX/g'; } + run_pylint > current.txt git fetch origin git checkout origin/"$GITHUB_BASE_REF" - pylint --exit-zero --errors-only pwnlib -f parseable | cut -d ' ' -f2- > base.txt + run_pylint > base.txt if diff base.txt current.txt | grep '>'; then false fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 91079ac18..4b801af95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,8 +74,32 @@ The table below shows which release corresponds to each branch, and what date th ## 5.0.0 (`dev`) +- [#2519][2519] Drop Python 2.7 support / Require Python 3.10 +- [#2507][2507] Add `+LINUX` and `+WINDOWS` doctest options and start proper testing on Windows +- [#2522][2522] Support starting a kitty debugging window with the 'kitten' command +- [#2524][2524] Raise EOFError during `process.recv` when stdout closes on Windows +- [#2526][2526] Properly make use of extra arguments in `packing` utilities. `sign` parameter requires keyword syntax to specify it. +- [#2517][2517] Allow to passthru kwargs on `ssh.__getattr__` convenience function to fix SSH motd problems +- [#2527][2527] Allow setting debugger path via `context.gdb_binary` +- [#2530][2530] Do NOT error when passing directory arguments in `checksec` commandline tool. +- [#2529][2529] Add LoongArch64 support +- [#2506][2506] ROP: fix `ROP(ELF(exe)).leave` is `None` in some ELF +- [#2504][2504] doc: add example case for `tuple` (host, port pair) in `gdb.attach` + +[2519]: https://github.com/Gallopsled/pwntools/pull/2519 +[2507]: https://github.com/Gallopsled/pwntools/pull/2507 +[2522]: https://github.com/Gallopsled/pwntools/pull/2522 +[2524]: https://github.com/Gallopsled/pwntools/pull/2524 +[2526]: https://github.com/Gallopsled/pwntools/pull/2526 +[2517]: https://github.com/Gallopsled/pwntools/pull/2517 +[2527]: https://github.com/Gallopsled/pwntools/pull/2527 +[2530]: https://github.com/Gallopsled/pwntools/pull/2530 +[2529]: https://github.com/Gallopsled/pwntools/pull/2529 +[2506]: https://github.com/Gallopsled/pwntools/pull/2506 +[2504]: https://github.com/Gallopsled/pwntools/pull/2504 ## 4.15.0 (`beta`) + - [#2508][2508] Ignore a warning when compiling with asm on nix - [#2471][2471] Properly close spawned kitty window - [#2358][2358] Cache output of `asm()` @@ -143,6 +167,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2435][2435] Speed up gdbserver handshake in gdb.debug() - [#2436][2436] Add resolution_addr parameter to Ret2dlresolvePayload - [#2497][2497] Fix remote.fromsocket() to handle AF_INET6 socket +- [#2532][2532] Fix various bugs from FmtStr()/fmtstr_payload() [2436]: https://github.com/Gallopsled/pwntools/pull/2436 [2371]: https://github.com/Gallopsled/pwntools/pull/2371 @@ -165,6 +190,7 @@ The table below shows which release corresponds to each branch, and what date th [2435]: https://github.com/Gallopsled/pwntools/pull/2435 [2437]: https://github.com/Gallopsled/pwntools/pull/2437 [2497]: https://github.com/Gallopsled/pwntools/pull/2497 +[2532]: https://github.com/Gallopsled/pwntools/pull/2532 ## 4.13.1 @@ -191,7 +217,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 +- [#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 @@ -278,7 +304,7 @@ The table below shows which release corresponds to each branch, and what date th ## 4.11.0 -- [#2185][2185] make fmtstr module able to create payload without $ notation +- [#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()` - [#2177][2177] Support for RISC-V 64-bit architecture - [#2186][2186] Enhance `ELF.nx` and `ELF.execstack` diff --git a/README.md b/README.md index 7bd8fdf99..bc8638683 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ To get you started, we've provided some example solutions for past CTF challenge # Installation -Pwntools is best supported on 64-bit Ubuntu LTS releases (14.04, 16.04, 18.04, and 20.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.). +Pwntools is best supported on 64-bit Ubuntu LTS releases (22.04 and 24.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.). -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 +Pwntools supports Python 3.10+ since version 5.0.0. Use Pwntools 4.x for older versions as well as 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 sudo apt-get update diff --git a/TESTING.md b/TESTING.md index 4674e565b..8c4f2e80a 100644 --- a/TESTING.md +++ b/TESTING.md @@ -4,7 +4,7 @@ Pwntools makes extensive use of unit tests and integration tests to ensure every ## Test Suite -To run the test suite, it is best to use Ubuntu 12.04 or 14.04, and run the following commands. **Be aware** that this will add a user to the machine, and create a public key for SSH login! +To run the test suite, it is best to use Ubuntu 22.04 or 24.04, and run the following commands. **Be aware** that this will add a user to the machine, and create a public key for SSH login! ```sh bash travis/install.sh @@ -15,7 +15,7 @@ PWNLIB_NOTERM=1 make -C docs doctest ## Testing in Docker -A `Dockerfile` has been provided which has a clean testing environment with Ubuntu Xenial. It is very similar to the online Travis CI testing environment, but uses a more modern version of Ubuntu. +A `Dockerfile` has been provided which has a clean testing environment with Ubuntu Jammy. It is very similar to the online Github Actions CI testing environment, but uses a more modern version of Ubuntu. See `travis/docker/README.md` for more information. diff --git a/docs/requirements.txt b/docs/requirements.txt index 9b9003604..980c9dd36 100755 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,14 +2,13 @@ capstone coverage[toml] python-dateutil doc2dash -docutils<0.18 +docutils>=0.18 intervaltree isort mako>=1.0.0 paramiko>=1.15.2 pip>=6.0.8 -pyelftools>=0.29, <0.30; python_version<'3' -pyelftools>=0.29; python_version>='3' +pyelftools>=0.29 pygments>=2.0 pypandoc pyserial>=2.7 @@ -17,7 +16,6 @@ pysocks psutil requests>=2.5.1 ropgadget>=5.3 -sphinx==1.8.6; python_version<'3' -sphinx>=4.5.0; python_version>='3' +sphinx>=8.1.3, <9 sphinx_rtd_theme sphinxcontrib-autoprogram<=0.1.5 diff --git a/docs/source/adb.rst b/docs/source/adb.rst index 242979fab..baf1f492c 100644 --- a/docs/source/adb.rst +++ b/docs/source/adb.rst @@ -4,6 +4,9 @@ from pwn import * adb = pwnlib.adb + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.adb` --- Android Debug Bridge ===================================================== diff --git a/docs/source/asm.rst b/docs/source/asm.rst index a47bd867c..d87b14333 100644 --- a/docs/source/asm.rst +++ b/docs/source/asm.rst @@ -4,6 +4,10 @@ import subprocess from pwn import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.asm` --- Assembler functions ========================================= diff --git a/docs/source/conf.py b/docs/source/conf.py index 6d72a01af..4754954bd 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -99,7 +99,6 @@ 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' @@ -360,6 +359,9 @@ def linkcode_resolve(domain, info): else: filename = info['module'].replace('.', '/') + '.py' + if isinstance(val, property): + val = val.fget + if isinstance(val, (types.ModuleType, types.MethodType, types.FunctionType, types.TracebackType, types.FrameType, types.CodeType) + six.class_types): try: lines, first = inspect.getsourcelines(val) @@ -385,7 +387,6 @@ def linkcode_resolve(domain, info): # -- Customization to Sphinx autodoc generation -------------------------------------------- -import sphinx.ext.autodoc # Test hidden members (e.g. def _foo(...)) def dont_skip_any_doctests(app, what, name, obj, skip, options): @@ -393,56 +394,87 @@ def dont_skip_any_doctests(app, what, name, obj, skip, options): autodoc_default_options = {'special-members': None, 'private-members': None} -class _DummyClass(object): pass - -class Py2OutputChecker(_DummyClass, doctest.OutputChecker): - def check_output(self, want, got, optionflags): - sup = super(Py2OutputChecker, self).check_output - if sup(want, got, optionflags): - return True - try: - rly_want = pwnlib.util.safeeval.const(want) - if sup(repr(rly_want), got, optionflags): - return True - rly_got = pwnlib.util.safeeval.const(got) - if rly_want == rly_got: - return True - except ValueError: - pass - rly_want = ' '.join(x[:2].replace('b"','"').replace("b'","'")+x[2:] for x in want.replace('\n','\n ').split(' ')).replace('\n ','\n') - if sup(rly_want, got, optionflags): - return True - rly_want = ' '.join(x[:2].replace('b"',' "').replace("b'"," '")+x[2:] for x in want.replace('\n','\n ').split(' ')).replace('\n ','\n') - if sup(rly_want, got, optionflags): - return True - for wantl, gotl in six.moves.zip_longest(want.splitlines(), got.splitlines(), fillvalue=''): - rly_want1 = '['.join(x[:2].replace('b"','"').replace("b'","'")+x[2:] for x in wantl.split('[')) - rly_want2 = ' '.join(x[:2].replace('b"',' "').replace("b'"," '")+x[2:] for x in wantl.split(' ')) - if not sup(rly_want1, gotl, optionflags) and not sup(rly_want2, gotl, optionflags): +# doctest optionflags for platform-specific tests +# they are skipped on other platforms +WINDOWS = doctest.register_optionflag('WINDOWS') +LINUX = doctest.register_optionflag('LINUX') +POSIX = doctest.register_optionflag('POSIX') + +# doctest optionflag for tests that haven't been looked at yet +TODO = doctest.register_optionflag('TODO') + +import sphinx.ext.doctest + +class PlatformDocTestRunner(sphinx.ext.doctest.SphinxDocTestRunner): + def run(self, test, compileflags=None, out=None, clear_globs=True): + original_optionflags = self.optionflags | test.globs.get('doctest_additional_flags', 0) + def filter_platform(example): + optionflags = original_optionflags + if example.options: + for (optionflag, val) in example.options.items(): + if val: + optionflags |= optionflag + else: + optionflags &= ~optionflag + + if (optionflags & WINDOWS) == WINDOWS and sys.platform != 'win32': return False - return True - -def py2_doctest_init(self, checker=None, verbose=None, optionflags=0): - if checker is None: - checker = Py2OutputChecker() - doctest.DocTestRunner.__init__(self, checker, verbose, optionflags) + if (optionflags & LINUX) == LINUX and sys.platform != 'linux': + return False + if (optionflags & POSIX) == POSIX and os.name != 'posix': + return False + return True + + test.examples[:] = [example for example in test.examples if filter_platform(example)] + + return super(PlatformDocTestRunner, self).run(test, compileflags, out, clear_globs) + +class PlatformDocTestBuilder(sphinx.ext.doctest.DocTestBuilder): + _test_runner = None + + @property + def test_runner(self): + return self._test_runner + + @test_runner.setter + def test_runner(self, value): + self._test_runner = PlatformDocTestRunner(value._checker, value._verbose, value.optionflags) if 'doctest' in sys.argv: def setup(app): - pass # app.connect('autodoc-skip-member', dont_skip_any_doctests) + app.add_builder(PlatformDocTestBuilder, override=True) + # app.connect('autodoc-skip-member', dont_skip_any_doctests) + # monkey patching paramiko due to https://github.com/paramiko/paramiko/pull/1661 + import paramiko.client + import binascii + paramiko.client.hexlify = lambda x: binascii.hexlify(x).decode() + paramiko.util.safe_string = lambda x: '' # function result never *actually used* - if sys.version_info[:1] < (3,): - import sphinx.ext.doctest - sphinx.ext.doctest.SphinxDocTestRunner.__init__ = py2_doctest_init - else: - # monkey patching paramiko due to https://github.com/paramiko/paramiko/pull/1661 - import paramiko.client - import binascii - paramiko.client.hexlify = lambda x: binascii.hexlify(x).decode() - paramiko.util.safe_string = lambda x: '' # function result never *actually used* class EndlessLoop(Exception): pass - def alrm_handler(sig, frame): - signal.alarm(180) # three minutes - raise EndlessLoop() - signal.signal(signal.SIGALRM, alrm_handler) - signal.alarm(600) # ten minutes + if hasattr(signal, 'alarm'): + def alrm_handler(sig, frame): + signal.alarm(180) # three minutes + raise EndlessLoop() + signal.signal(signal.SIGALRM, alrm_handler) + signal.alarm(600) # ten minutes + else: + def sigabrt_handler(signum, frame): + raise EndlessLoop() + # thread.interrupt_main received the signum parameter in Python 3.10 + if sys.version_info >= (3, 10): + signal.signal(signal.SIGABRT, sigabrt_handler) + def alrm_handler(): + try: + import thread + except ImportError: + import _thread as thread + # pre Python 3.10 this raises a KeyboardInterrupt in the main thread. + # it might not show a traceback in that case, but it will stop the endless loop. + thread.interrupt_main(signal.SIGABRT) + timer = threading.Timer(interval=180, function=alrm_handler) # three minutes + timer.daemon = True + timer.start() + import threading + timer = threading.Timer(interval=600, function=alrm_handler) # ten minutes + timer.daemon = True + timer.start() diff --git a/docs/source/elf/corefile.rst b/docs/source/elf/corefile.rst index ab088414e..85668ae79 100644 --- a/docs/source/elf/corefile.rst +++ b/docs/source/elf/corefile.rst @@ -18,6 +18,9 @@ # Set the environment here so it's not in the middle of our tests. os.environ.setdefault('SHELL', '/bin/sh') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.elf.corefile` --- Core Files =========================================================== diff --git a/docs/source/elf/elf.rst b/docs/source/elf/elf.rst index b54e9a393..7501ca20c 100644 --- a/docs/source/elf/elf.rst +++ b/docs/source/elf/elf.rst @@ -5,6 +5,10 @@ from pwnlib.elf.maps import CAT_PROC_MAPS_EXIT import shutil + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.elf.elf` --- ELF Files =========================================================== diff --git a/docs/source/encoders.rst b/docs/source/encoders.rst index e36ed86d4..8132023f4 100644 --- a/docs/source/encoders.rst +++ b/docs/source/encoders.rst @@ -1,6 +1,10 @@ .. testsetup:: * from pwn import * + + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] :mod:`pwnlib.encoders` --- Encoding Shellcode =============================================== diff --git a/docs/source/filesystem.rst b/docs/source/filesystem.rst index 6a7fae504..26cc62ce3 100644 --- a/docs/source/filesystem.rst +++ b/docs/source/filesystem.rst @@ -6,6 +6,10 @@ from pwnlib.tubes.ssh import ssh from pwnlib.filesystem import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.filesystem` --- Manipulating Files Locally and Over SSH ==================================================================== diff --git a/docs/source/gdb.rst b/docs/source/gdb.rst index a2067e956..5f4f30406 100644 --- a/docs/source/gdb.rst +++ b/docs/source/gdb.rst @@ -4,6 +4,10 @@ context.arch = 'amd64' context.terminal = [os.path.join(os.path.dirname(pwnlib.__file__), 'gdb_faketerminal.py')] + # TODO: Test on cygwin too + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.gdb` --- Working with GDB ====================================== diff --git a/docs/source/install.rst b/docs/source/install.rst index 2087826a6..81d4f749b 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -1,7 +1,7 @@ Installation ============ -Pwntools is best supported on 64-bit Ubuntu LTS releases (14.04, 16.04, 18.04, and 20.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.). +Pwntools is best supported on 64-bit Ubuntu LTS releases (22.04 and 24.04). Most functionality should work on any Posix-like distribution (Debian, Arch, FreeBSD, OSX, etc.). Prerequisites ------------- @@ -21,11 +21,13 @@ Note: For Mac OS X you will need to have cmake ``brew install cmake`` and pkg-co Released Version ----------------- -pwntools is available as a ``pip`` package for both Python2 and Python3. +pwntools is available as a ``pip`` package for Python3. Version v5.0.0 supports Python3.10 or later. Use v4 if you use earlier versions of Python. Python3 ^^^^^^^ +The Python version required for installing Pwntools is kept as low as possible on a best-effort basis. However, new features target Python3.10 and later. + .. code-block:: bash $ sudo apt-get update @@ -37,6 +39,8 @@ Python3 Python2 (Deprecated) ^^^^^^^^^^^^^^^^^^^^ +Python2 support has been removed in Pwntools v5.0.0. The last version to support Python2 was v4.15.0. + NOTE: Pwntools maintainers STRONGLY recommend using Python3 for all future Pwntools-based scripts and projects. Additionally, due to `pip` dropping support for Python2, a specfic version of `pip` must be installed. diff --git a/docs/source/intro.rst b/docs/source/intro.rst index 25e5cc1ae..3832dde32 100644 --- a/docs/source/intro.rst +++ b/docs/source/intro.rst @@ -2,6 +2,9 @@ from pwn import * + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + Getting Started ======================== diff --git a/docs/source/libcdb.rst b/docs/source/libcdb.rst index 54d152a58..a31dd7eb4 100644 --- a/docs/source/libcdb.rst +++ b/docs/source/libcdb.rst @@ -3,6 +3,10 @@ from pwn import * from pwnlib.libcdb import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.libcdb` --- Libc Database =========================================== diff --git a/docs/source/protocols.rst b/docs/source/protocols.rst index 8b1378917..f4ed4099e 100644 --- a/docs/source/protocols.rst +++ b/docs/source/protocols.rst @@ -1 +1,10 @@ +.. testsetup:: * + from pwn import * + + +:mod:`pwnlib.protocols.adb` --- Protocol implementations +======================================================== + +.. automodule:: pwnlib.protocols.adb + :members: \ No newline at end of file diff --git a/docs/source/qemu.rst b/docs/source/qemu.rst index a28ab316c..bf8884de2 100644 --- a/docs/source/qemu.rst +++ b/docs/source/qemu.rst @@ -2,6 +2,10 @@ from pwn import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.qemu` --- QEMU Utilities ========================================== diff --git a/docs/source/rop/rop.rst b/docs/source/rop/rop.rst index 8d5d93f39..553cac97d 100644 --- a/docs/source/rop/rop.rst +++ b/docs/source/rop/rop.rst @@ -19,6 +19,10 @@ context.clear() + # TODO: Remove global LINUX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.rop.rop` --- Return Oriented Programming ========================================================== diff --git a/docs/source/rop/srop.rst b/docs/source/rop/srop.rst index f38490498..8248be2f5 100644 --- a/docs/source/rop/srop.rst +++ b/docs/source/rop/srop.rst @@ -7,6 +7,9 @@ from pwnlib.elf import ELF from pwnlib.tubes.process import process + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.rop.srop` --- Sigreturn Oriented Programming ========================================================== diff --git a/docs/source/runner.rst b/docs/source/runner.rst index 2aa661aeb..f0c33d7e8 100644 --- a/docs/source/runner.rst +++ b/docs/source/runner.rst @@ -3,6 +3,10 @@ from pwnlib.runner import * from pwnlib.asm import asm + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.runner` --- Running Shellcode =========================================== diff --git a/docs/source/shellcraft.rst b/docs/source/shellcraft.rst index 1f5d0bc7a..5d9e37c24 100644 --- a/docs/source/shellcraft.rst +++ b/docs/source/shellcraft.rst @@ -2,6 +2,10 @@ from pwnlib import shellcraft + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.shellcraft` --- Shellcode generation ================================================= diff --git a/docs/source/shellcraft/aarch64.rst b/docs/source/shellcraft/aarch64.rst index 1abf6f68c..700d30f2e 100644 --- a/docs/source/shellcraft/aarch64.rst +++ b/docs/source/shellcraft/aarch64.rst @@ -3,6 +3,9 @@ from pwn import * context.clear(arch='aarch64') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.shellcraft.aarch64` --- Shellcode for AArch64 =========================================================== diff --git a/docs/source/shellcraft/amd64.rst b/docs/source/shellcraft/amd64.rst index 8aced2c41..27c65547c 100644 --- a/docs/source/shellcraft/amd64.rst +++ b/docs/source/shellcraft/amd64.rst @@ -3,6 +3,10 @@ from pwn import * context.clear(arch='amd64') + # TODO: POSIX/WINDOWS shellcode test + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.shellcraft.amd64` --- Shellcode for AMD64 =========================================================== diff --git a/docs/source/shellcraft/arm.rst b/docs/source/shellcraft/arm.rst index 8e4d2400e..96316900f 100644 --- a/docs/source/shellcraft/arm.rst +++ b/docs/source/shellcraft/arm.rst @@ -3,6 +3,9 @@ from pwn import * context.clear(arch='arm') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.shellcraft.arm` --- Shellcode for ARM =========================================================== diff --git a/docs/source/shellcraft/i386.rst b/docs/source/shellcraft/i386.rst index 5820abf18..3d72adc5c 100644 --- a/docs/source/shellcraft/i386.rst +++ b/docs/source/shellcraft/i386.rst @@ -3,6 +3,9 @@ from pwn import * context.clear(arch='i386') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.shellcraft.i386` --- Shellcode for Intel 80386 =========================================================== diff --git a/docs/source/shellcraft/loongarch64.rst b/docs/source/shellcraft/loongarch64.rst new file mode 100644 index 000000000..2f41e1ebe --- /dev/null +++ b/docs/source/shellcraft/loongarch64.rst @@ -0,0 +1,22 @@ +.. testsetup:: * + + from pwn import * + context.clear(arch='loongarch64') + + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + +:mod:`pwnlib.shellcraft.loongarch64` --- Shellcode for LoongArch64 +========================================================== + +:mod:`pwnlib.shellcraft.loongarch64` +-------------------------------- + +.. automodule:: pwnlib.shellcraft.loongarch64 + :members: + +:mod:`pwnlib.shellcraft.loongarch64.linux` +-------------------------------------- + +.. automodule:: pwnlib.shellcraft.loongarch64.linux + :members: diff --git a/docs/source/shellcraft/mips.rst b/docs/source/shellcraft/mips.rst index 15e9f3e0d..5efb5c736 100644 --- a/docs/source/shellcraft/mips.rst +++ b/docs/source/shellcraft/mips.rst @@ -12,6 +12,9 @@ context.clear(arch='mips') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.shellcraft.mips` --- Shellcode for MIPS =========================================================== diff --git a/docs/source/shellcraft/riscv64.rst b/docs/source/shellcraft/riscv64.rst index 47b484af7..4b0c3cf11 100644 --- a/docs/source/shellcraft/riscv64.rst +++ b/docs/source/shellcraft/riscv64.rst @@ -3,17 +3,20 @@ from pwn import * context.clear(arch='riscv64') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :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/docs/source/shellcraft/thumb.rst b/docs/source/shellcraft/thumb.rst index 8beaddbe6..020f368fa 100644 --- a/docs/source/shellcraft/thumb.rst +++ b/docs/source/shellcraft/thumb.rst @@ -3,6 +3,9 @@ from pwn import * context.clear(arch='thumb') + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.shellcraft.thumb` --- Shellcode for Thumb Mode =========================================================== diff --git a/docs/source/tubes/processes.rst b/docs/source/tubes/processes.rst index a14377c0b..c4d891b35 100644 --- a/docs/source/tubes/processes.rst +++ b/docs/source/tubes/processes.rst @@ -2,6 +2,10 @@ from pwn import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.tubes.process` --- Processes =========================================================== diff --git a/docs/source/tubes/serial.rst b/docs/source/tubes/serial.rst index d850a0483..599ca35c4 100644 --- a/docs/source/tubes/serial.rst +++ b/docs/source/tubes/serial.rst @@ -2,6 +2,10 @@ from pwn import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.tubes.serialtube` --- Serial Ports =========================================================== diff --git a/docs/source/tubes/ssh.rst b/docs/source/tubes/ssh.rst index ae351cc3b..21c78e2f1 100644 --- a/docs/source/tubes/ssh.rst +++ b/docs/source/tubes/ssh.rst @@ -2,6 +2,10 @@ from pwn import * + # TODO: Remove global POSIX flag + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.tubes.ssh` --- SSH =========================================================== diff --git a/docs/source/ui.rst b/docs/source/ui.rst index c0fb38394..173f39bf9 100644 --- a/docs/source/ui.rst +++ b/docs/source/ui.rst @@ -3,6 +3,9 @@ from pwn import * import io + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['POSIX'] + :mod:`pwnlib.ui` --- Functions for user interaction =================================================== diff --git a/docs/source/util/net.rst b/docs/source/util/net.rst index 1c1ca8fbb..cf4247020 100644 --- a/docs/source/util/net.rst +++ b/docs/source/util/net.rst @@ -2,6 +2,9 @@ from pwnlib.util.net import * + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.util.net` --- Networking interfaces =================================================== diff --git a/docs/source/util/proc.rst b/docs/source/util/proc.rst index b556f25aa..521143222 100644 --- a/docs/source/util/proc.rst +++ b/docs/source/util/proc.rst @@ -4,6 +4,9 @@ from pwnlib.tubes.process import process import os, sys + import doctest + doctest_additional_flags = doctest.OPTIONFLAGS_BY_NAME['LINUX'] + :mod:`pwnlib.util.proc` --- Working with ``/proc/`` =================================================== diff --git a/docs/source/windbg.rst b/docs/source/windbg.rst index e08397205..3a713f09a 100644 --- a/docs/source/windbg.rst +++ b/docs/source/windbg.rst @@ -3,7 +3,7 @@ from pwn import * :mod:`pwnlib.windbg` --- Working with WinDbg -====================================== +============================================ .. automodule:: pwnlib.windbg :members: \ No newline at end of file diff --git a/extra/docker/base/Dockerfile b/extra/docker/base/Dockerfile index 0d07c33f5..e50e697ed 100644 --- a/extra/docker/base/Dockerfile +++ b/extra/docker/base/Dockerfile @@ -3,7 +3,7 @@ # Based on Ubuntu ############################################################ -FROM ubuntu:jammy +FROM ubuntu:noble MAINTAINER Maintainer Gallopsled et al. ENV LANG en_US.UTF-8 @@ -20,9 +20,6 @@ RUN apt-get update \ git \ libssl-dev \ libffi-dev \ - python2.7 \ - python2.7-dev \ - python2-pip-whl \ python3 \ python3-pip \ python3-dev \ @@ -36,12 +33,11 @@ RUN apt-get update \ binutils-powerpc64-linux-gnu \ binutils-sparc64-linux-gnu \ binutils-riscv64-linux-gnu \ + binutils-loongarch64-linux-gnu \ tmux \ 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 --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 \ diff --git a/extra/docker/beta/Dockerfile b/extra/docker/beta/Dockerfile index a83bd0f4e..65f0d25ac 100644 --- a/extra/docker/beta/Dockerfile +++ b/extra/docker/beta/Dockerfile @@ -1,7 +1,6 @@ FROM pwntools/pwntools:stable USER root -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 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 deleted file mode 100644 index 33a9491d6..000000000 --- a/extra/docker/buster/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -from debian:buster - -RUN apt-get update -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 --no-cache-dir --upgrade git+https://github.com/Gallopsled/pwntools@dev \ No newline at end of file diff --git a/extra/docker/dev/Dockerfile b/extra/docker/dev/Dockerfile index 77d04d331..19579a916 100644 --- a/extra/docker/dev/Dockerfile +++ b/extra/docker/dev/Dockerfile @@ -1,7 +1,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 --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@dev +RUN 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/develop/Dockerfile b/extra/docker/develop/Dockerfile index c2845c5b5..d3b8a879c 100644 --- a/extra/docker/develop/Dockerfile +++ b/extra/docker/develop/Dockerfile @@ -5,8 +5,7 @@ ENV HISTFILE=/home/pwntools/.history # Uninstall existing versions of pwntools USER root -RUN python2.7 -m pip uninstall -q -y pwntools \ - && python3 -m pip uninstall -q -y pwntools +RUN python3 -m pip uninstall -q -y pwntools # Switch back to the pwntools user from here forward USER pwntools @@ -18,17 +17,14 @@ 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 \ && 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 python3 -m pip install --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 python3 -m pip install -U ipython ipdb # Dependencies from .travis.yml addons -> apt -> packages ARG DEBIAN_FRONTEND=noninteractive diff --git a/extra/docker/stable/Dockerfile b/extra/docker/stable/Dockerfile index aa241c1fb..d89618472 100644 --- a/extra/docker/stable/Dockerfile +++ b/extra/docker/stable/Dockerfile @@ -1,7 +1,6 @@ FROM pwntools/pwntools:base USER root -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 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/pwnlib/__init__.py b/pwnlib/__init__.py index 3dae1f00f..306dc67f4 100644 --- a/pwnlib/__init__.py +++ b/pwnlib/__init__.py @@ -23,7 +23,6 @@ 'libcdb', 'log', 'memleak', - 'pep237', 'regsort', 'replacements', 'rop', diff --git a/pwnlib/abi.py b/pwnlib/abi.py index 1ba669b0e..05d2266bf 100644 --- a/pwnlib/abi.py +++ b/pwnlib/abi.py @@ -27,9 +27,9 @@ class ABI(object): #: Indicates that this ABI returns to the next address on the slot returns = True - def __init__(self, stack, regs, align, minimum): + def __init__(self, stack, arg_regs, align, minimum): self.stack = stack - self.register_arguments = regs + self.register_arguments = arg_regs self.arg_alignment = align self.stack_minimum = minimum @@ -50,6 +50,7 @@ def default(): (64, 'powerpc', 'linux'): linux_ppc64, (32, 'riscv32', 'linux'): linux_riscv32, (64, 'riscv64', 'linux'): linux_riscv64, + (64, 'loongarch64', 'linux'): linux_loongarch64, (32, 'i386', 'freebsd'): freebsd_i386, (64, 'aarch64', 'freebsd'): freebsd_aarch64, (64, 'amd64', 'freebsd'): freebsd_amd64, @@ -82,6 +83,7 @@ def syscall(): (64, 'powerpc', 'linux'): linux_ppc64_syscall, (32, 'riscv32', 'linux'): linux_riscv32_syscall, (64, 'riscv64', 'linux'): linux_riscv64_syscall, + (64, 'loongarch64', 'linux'): linux_loongarch64_syscall, (32, 'i386', 'freebsd'): freebsd_i386_syscall, (64, 'amd64', 'freebsd'): freebsd_amd64_syscall, (64, 'aarch64', 'freebsd'): freebsd_aarch64_syscall, @@ -109,6 +111,7 @@ def sigreturn(): (64, 'aarch64', 'linux'): linux_aarch64_sigreturn, (32, 'riscv32', 'linux'): linux_riscv32_sigreturn, (64, 'riscv64', 'linux'): linux_riscv64_sigreturn, + (64, 'loongarch64', 'linux'): linux_loongarch64_sigreturn, (32, 'i386', 'freebsd'): freebsd_i386_sigreturn, (64, 'amd64', 'freebsd'): freebsd_amd64_sigreturn, (32, 'arm', 'freebsd'): freebsd_arm_sigreturn, @@ -148,6 +151,7 @@ class SigreturnABI(SyscallABI): 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) +linux_loongarch64 = ABI('sp', ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7'], 8, 0) sysv_i386 = linux_i386 sysv_amd64 = linux_amd64 @@ -158,6 +162,7 @@ class SigreturnABI(SyscallABI): sysv_ppc64 = linux_ppc64 sysv_riscv32 = linux_riscv32 sysv_riscv64 = linux_riscv64 +sysv_loongarch64 = linux_loongarch64 # 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) @@ -169,6 +174,7 @@ class SigreturnABI(SyscallABI): 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_loongarch64_syscall = SyscallABI('sp', ['a7', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6'], 8, 0) linux_i386_sigreturn = SigreturnABI('esp', ['eax'], 4, 0) linux_amd64_sigreturn = SigreturnABI('rsp', ['rax'], 8, 0) @@ -176,6 +182,7 @@ class SigreturnABI(SyscallABI): linux_aarch64_sigreturn = SigreturnABI('sp', ['x8'], 16, 0) linux_riscv32_sigreturn = SigreturnABI('sp', ['a7'], 4, 0) linux_riscv64_sigreturn = SigreturnABI('sp', ['a7'], 8, 0) +linux_loongarch64_sigreturn = SigreturnABI('sp', ['a7'], 8, 0) sysv_i386_sigreturn = linux_i386_sigreturn sysv_amd64_sigreturn = linux_amd64_sigreturn @@ -183,6 +190,7 @@ class SigreturnABI(SyscallABI): sysv_aarch64_sigreturn = linux_aarch64_sigreturn sysv_riscv32_sigreturn = linux_riscv32_sigreturn sysv_riscv64_sigreturn = linux_riscv64_sigreturn +sysv_loongarch64_sigreturn = linux_loongarch64_sigreturn freebsd_i386 = sysv_i386 freebsd_amd64 = sysv_amd64 diff --git a/pwnlib/adb/adb.py b/pwnlib/adb/adb.py index 45d27875c..e2d8ebce7 100644 --- a/pwnlib/adb/adb.py +++ b/pwnlib/adb/adb.py @@ -54,7 +54,6 @@ import os import re import shutil -import six import stat import tempfile import time @@ -85,7 +84,7 @@ def adb(argv, *a, **kw): >>> adb.adb(['shell', 'uname']) # it is better to use adb.process b'Linux\n' """ - if isinstance(argv, (bytes, six.text_type)): + if isinstance(argv, (bytes, str)): argv = [argv] log.debug("$ " + ' '.join(context.adb + argv)) @@ -838,7 +837,7 @@ def process(argv, *a, **kw): >>> print(adb.process(['cat','/proc/version']).recvall().decode('utf-8')) # doctest: +ELLIPSIS Linux version ... """ - if isinstance(argv, (bytes, six.text_type)): + if isinstance(argv, (bytes, str)): argv = [argv] message = "Starting %s process %r" % ('Android', argv[0]) @@ -1263,7 +1262,7 @@ def __eq__(self, other): >>> adb.properties.ro.build.version.sdk == "24" True """ - if isinstance(other, six.string_types): + if isinstance(other, str): return str(self) == other return super(Property, self).__eq__(other) diff --git a/pwnlib/adb/bootloader.py b/pwnlib/adb/bootloader.py index 149dd4715..d03a3563a 100644 --- a/pwnlib/adb/bootloader.py +++ b/pwnlib/adb/bootloader.py @@ -4,7 +4,6 @@ import ctypes import io import os -import six import sys from pwnlib.log import getLogger @@ -65,7 +64,7 @@ def extract(self, index_or_name): Returns: Contents of the image. """ - if isinstance(index_or_name, six.integer_types): + if isinstance(index_or_name, int): index = index_or_name else: for i in range(len(self.img_info)): diff --git a/pwnlib/asm.py b/pwnlib/asm.py index f9e39d959..a41352a91 100644 --- a/pwnlib/asm.py +++ b/pwnlib/asm.py @@ -59,6 +59,9 @@ from pwnlib.context import LocalContext from pwnlib.context import context from pwnlib.log import getLogger +from pwnlib.util.hashes import sha1sumhex +from pwnlib.util.packing import _encode +from pwnlib.version import __version__ log = getLogger(__name__) @@ -187,6 +190,7 @@ def which_binutils(util, check_version=False): 'sparc64': ['sparc'], 'riscv32': ['riscv32', 'riscv64', 'riscv'], 'riscv64': ['riscv64', 'riscv32', 'riscv'], + 'loongarch64': ['loongarch64', 'loong64'], }.get(arch, []) # If one of the candidate architectures matches the native @@ -272,6 +276,9 @@ def _assembler(): # riscv64-unknown-elf-as supports riscv32 as well as riscv64 'riscv32': [gas, '-march=rv32gc', '-mabi=ilp32'], 'riscv64': [gas, '-march=rv64gc', '-mabi=lp64'], + + # loongarch64 supports none of -64, -EB, -EL or -march + 'loongarch64' : [gas], } assembler = assemblers.get(context.arch, [gas]) @@ -373,6 +380,7 @@ def _bfdname(): 'powerpc64' : 'elf64-powerpc', 'riscv32' : 'elf%d-%sriscv' % (context.bits, E), 'riscv64' : 'elf%d-%sriscv' % (context.bits, E), + 'loongarch64' : 'elf%d-loongarch' % context.bits, 'vax' : 'elf32-vax', 's390' : 'elf%d-s390' % context.bits, 'sparc' : 'elf32-sparc', @@ -397,6 +405,7 @@ def _bfdarch(): 'thumb': 'arm', 'riscv32': 'riscv', 'riscv64': 'riscv', + 'loongarch64': 'loongarch64' } if arch in convert: @@ -468,6 +477,7 @@ def cpp(shellcode): code = _include_header() + shellcode cmd = [ cpp, + '-Wno-unused-command-line-argument', '-C', '-nostdinc', '-undef', @@ -758,8 +768,23 @@ def asm(shellcode, vma = 0, extract = True, shared = False): b'0@*\x00' >>> asm("la %r0, 42", arch = 's390', bits=64) b'A\x00\x00*' + + The output is cached: + + >>> start = time.time() + >>> asm("lea rax, [rip+0]", arch = 'amd64', cache_dir = None) # force uncached time + b'H\x8d\x05\x00\x00\x00\x00' + >>> uncached_time = time.time() - start + >>> asm("lea rax, [rip+0]", arch = 'amd64') # cache it + b'H\x8d\x05\x00\x00\x00\x00' + >>> start = time.time() + >>> asm("lea rax, [rip+0]", arch = 'amd64') + b'H\x8d\x05\x00\x00\x00\x00' + >>> cached_time = time.time() - start + >>> uncached_time > cached_time + True """ - result = '' + result = b'' assembler = _assembler() linker = _linker() @@ -770,6 +795,30 @@ def asm(shellcode, vma = 0, extract = True, shared = False): log.debug('Assembling\n%s' % code) + cache_file = None + if context.cache_dir: + cache_dir = os.path.join(context.cache_dir, 'asm-cache') + if not os.path.isdir(cache_dir): + os.makedirs(cache_dir) + + # Include the context in the hash in addition to the shellcode + hash_params = '{}_{}_{}_{}'.format(vma, extract, shared, __version__) + fingerprint_params = _encode(code) + _encode(hash_params) + _encode(' '.join(assembler)) + _encode(' '.join(linker)) + _encode(' '.join(objcopy)) + asm_hash = sha1sumhex(fingerprint_params) + cache_file = os.path.join(cache_dir, asm_hash) + if os.path.exists(cache_file): + log.debug('Using cached assembly output from %r', cache_file) + if extract: + with open(cache_file, 'rb') as f: + return f.read() + + # Create a temporary copy of the cached file to avoid modification. + tmpdir = tempfile.mkdtemp(prefix = 'pwn-asm-') + atexit.register(shutil.rmtree, tmpdir) + step3 = os.path.join(tmpdir, 'step3') + shutil.copy(cache_file, step3) + return step3 + tmpdir = tempfile.mkdtemp(prefix = 'pwn-asm-') step1 = path.join(tmpdir, 'step1') step2 = path.join(tmpdir, 'step2') @@ -817,6 +866,8 @@ def asm(shellcode, vma = 0, extract = True, shared = False): shutil.copy(step2, step3) if not extract: + if cache_file is not None: + shutil.copy(step3, cache_file) return step3 _run(objcopy + [step3, step4]) @@ -830,6 +881,10 @@ def asm(shellcode, vma = 0, extract = True, shared = False): else: atexit.register(lambda: shutil.rmtree(tmpdir)) + if cache_file is not None and result != b'': + with open(cache_file, 'wb') as f: + f.write(result) + return result @LocalContext diff --git a/pwnlib/commandline/checksec.py b/pwnlib/commandline/checksec.py index 687ab214a..d346a89c4 100644 --- a/pwnlib/commandline/checksec.py +++ b/pwnlib/commandline/checksec.py @@ -15,7 +15,6 @@ parser.add_argument( 'elf', nargs='*', - type=argparse.FileType('rb'), help='Files to check' ) parser.add_argument( @@ -23,19 +22,21 @@ nargs='*', dest='elf2', metavar='elf', - type=argparse.FileType('rb'), help='File to check (for compatibility with checksec.sh)' ) def main(args): - files = args.elf or args.elf2 or [] + files = args.elf or args.elf2 or [] if not files: parser.print_usage() return for f in files: - e = ELF(f.name) + try: + e = ELF(f) + except Exception as e: + print("{name}: {error}".format(name=f, error=e)) if __name__ == '__main__': common.main(__file__, main) diff --git a/pwnlib/commandline/common.py b/pwnlib/commandline/common.py index 3ce0a0fad..b3d96e0c9 100644 --- a/pwnlib/commandline/common.py +++ b/pwnlib/commandline/common.py @@ -33,6 +33,13 @@ def main(file=sys.argv[0], command_main=None): sys.argv.insert(1, name) entrypoint({name: command_main}) +def deprecated_main(): + file=sys.argv[0] + name = os.path.splitext(os.path.basename(file))[0] + import warnings + warnings.warn("The '%s' command is deprecated and will be removed in a future version. Please use 'pwn %s' instead." % (name, name), DeprecationWarning, stacklevel=2) + main(file) + def entrypoint(commands): if len(sys.argv) < 2: parser.print_usage() diff --git a/pwnlib/commandline/cyclic.py b/pwnlib/commandline/cyclic.py index c7a5060f6..cfc4b8a39 100644 --- a/pwnlib/commandline/cyclic.py +++ b/pwnlib/commandline/cyclic.py @@ -2,7 +2,6 @@ from __future__ import division import argparse -import six import string import sys @@ -47,6 +46,7 @@ group.add_argument( '-l', '-o', '--offset', '--lookup', dest = 'lookup', + type = str.encode, metavar = 'lookup_value', help = 'Do a lookup instead printing the alphabet', ) @@ -66,9 +66,6 @@ def main(args): if args.lookup: pat = args.lookup - if six.PY3: - pat = bytes(pat, encoding='utf-8') - try: pat = int(pat, 0) pat = pack(pat, 'all') diff --git a/pwnlib/commandline/libcdb.py b/pwnlib/commandline/libcdb.py index d6523b627..70ccaa1a6 100644 --- a/pwnlib/commandline/libcdb.py +++ b/pwnlib/commandline/libcdb.py @@ -37,19 +37,12 @@ ) lookup_parser.add_argument( - '--download-libc', + '-d', '--download-libc', action = 'store_true', default = False, help = 'Attempt to download the matching libc.so' ) -lookup_parser.add_argument( - '--unstrip', - action = 'store_true', - default = True, - help = 'Attempt to unstrip the libc binary with debug symbols from a debuginfod server' -) - lookup_parser.add_argument( '--no-unstrip', action = 'store_false', @@ -57,6 +50,14 @@ help = 'Do NOT attempt to unstrip the libc binary with debug symbols from a debuginfod server' ) +lookup_parser.add_argument( + '--offline-only', + action = 'store_true', + default = False, + dest = 'offline_only', + help = 'Attempt to searching with offline only mode' +) + hash_parser = libc_commands.add_parser( 'hash', help = 'Display information of a libc version given an unique hash', @@ -80,19 +81,12 @@ ) hash_parser.add_argument( - '--download-libc', + '-d', '--download-libc', action = 'store_true', default = False, help = 'Attempt to download the matching libc.so' ) -hash_parser.add_argument( - '--unstrip', - action = 'store_true', - default = True, - help = 'Attempt to unstrip the libc binary with debug symbols from a debuginfod server' -) - hash_parser.add_argument( '--no-unstrip', action = 'store_false', @@ -100,6 +94,14 @@ help = 'Do NOT attempt to unstrip the libc binary with debug symbols from a debuginfod server' ) +hash_parser.add_argument( + '--offline-only', + action = 'store_true', + default = False, + dest = 'offline_only', + help = 'Attempt to searching with offline only mode' +) + file_parser = libc_commands.add_parser( 'file', help = 'Dump information about a libc binary', @@ -130,25 +132,34 @@ file_parser.add_argument( '--unstrip', action = 'store_true', - default = False, + dest = 'unstrip', help = 'Attempt to unstrip the libc binary inplace with debug symbols from a debuginfod server' ) -common_symbols = ['dup2', 'printf', 'puts', 'read', 'system', 'write'] +fetch_parser = libc_commands.add_parser( + 'fetch', + help = 'Fetch libc database', + description = 'Fetch libc database. If no argument passed, it will init and upgrade libc-database repository', +) -def find_libc(params): - import requests - url = "https://libc.rip/api/find" - result = requests.post(url, json=params, timeout=20) - log.debug('Request: %s', params) - log.debug('Result: %s', result.json()) - if result.status_code != 200 or len(result.json()) == 0: - log.failure("Could not find libc for %s on libc.rip", params) - return [] +fetch_parser.add_argument( + 'path', + nargs = '?', + default = context.local_libcdb, + help = 'Set libc-database path, If it is empty, the default path will be `context.local_libcdb` (%s)' % context.local_libcdb +) + +fetch_parser.add_argument( + '-u', '--update', + metavar = 'update', + nargs = '+', + choices = ['all', 'ubuntu', 'debian', 'rpm', 'centos', 'arch', 'alpine', 'kali', 'parrotsec', 'launchpad'], + help = 'Fetch the desired libc categories' +) - return result.json() +common_symbols = ['dup2', 'printf', 'puts', 'read', 'system', 'write'] -def print_libc(libc): +def print_libc_info(libc): log.info('%s', text.red(libc['id'])) log.indented('\t%-20s %s', text.green('BuildID:'), libc['buildid']) log.indented('\t%-20s %s', text.green('MD5:'), libc['md5']) @@ -158,14 +169,39 @@ def print_libc(libc): for symbol in libc['symbols'].items(): log.indented('\t%25s = %s', symbol[0], symbol[1]) -def handle_remote_libc(args, libc): - print_libc(libc) - if args.download_libc: - path = libcdb.search_by_build_id(libc['buildid'], args.unstrip) - if path: - if args.unstrip: - libcdb.unstrip_libc(path) - shutil.copy(path, './{}.so'.format(libc['id'])) +def print_libc_elf(exe): + from hashlib import md5, sha1, sha256 + + log.info('%s', text.red(os.path.basename(exe.path))) + + libc_version = get_libc_version(exe) + if libc_version: + log.indented('%-20s %s', text.green('Version:'), libc_version) + + if exe.buildid: + log.indented('%-20s %s', text.green('BuildID:'), enhex(exe.buildid)) + + log.indented('%-20s %s', text.green('MD5:'), md5(exe.data).hexdigest()) + log.indented('%-20s %s', text.green('SHA1:'), sha1(exe.data).hexdigest()) + log.indented('%-20s %s', text.green('SHA256:'), sha256(exe.data).hexdigest()) + + # Always dump the basic list of common symbols + log.indented('%s', text.green('Symbols:')) + synthetic_symbols = collect_synthetic_symbols(exe) + + symbols = common_symbols + (args.symbols or []) + synthetic_symbols + symbols.sort() + for symbol in symbols: + if symbol not in exe.symbols: + log.indented('%25s = %s', symbol, text.red('not found')) + else: + log.indented('%25s = %#x', symbol, translate_offset(exe.symbols[symbol], args, exe)) + +def get_libc_version(exe): + res = re.search(br'libc[ -](\d+\.\d+)', exe.data) + if res: + return res.group(1).decode() + return None def translate_offset(offs, args, exe): if args.offset: @@ -182,7 +218,7 @@ def collect_synthetic_symbols(exe): 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 @@ -200,52 +236,56 @@ def main(args): if len(pairs) % 2 != 0: log.failure('Uneven number of arguments. Please provide "symbol offset" pairs') return - + symbols = {pairs[i]:pairs[i+1] for i in range(0, len(pairs), 2)} - matched_libcs = find_libc({'symbols': symbols}) + matched_libcs = libcdb.search_by_symbol_offsets(symbols, offline_only=args.offline_only, return_raw=True) + for libc in matched_libcs: - handle_remote_libc(args, libc) + print_libc_info(libc) + if args.download_libc: + path = libcdb.search_by_build_id(libc['buildid'], args.unstrip) + if path: + shutil.copy(path, './{}.so'.format(libc['id'])) elif args.libc_command == 'hash': + inverted_map = {v: k for k, v in libcdb.MAP_TYPES.items()} + hash_type = inverted_map.get(args.hash_type, args.hash_type) + for hash_value in args.hash_value: - matched_libcs = find_libc({args.hash_type: hash_value}) - for libc in matched_libcs: - handle_remote_libc(args, libc) + path = libcdb.search_by_hash(hash_value, hash_type, unstrip=args.unstrip, offline_only=args.offline_only) + exe = ELF(path, checksec=False) + print_libc_elf(exe) + + if args.download_libc: + # if we cannot get actual libc version then copy with cache name + shutil.copy(path, './libc-{}.so'.format(get_libc_version(exe) or Path(path).stem)) elif args.libc_command == 'file': - from hashlib import md5, sha1, sha256 for file in args.files: if not os.path.exists(file) or not os.path.isfile(file): log.failure('File does not exist %s', args.file) continue - + if args.unstrip: libcdb.unstrip_libc(file) - exe = ELF(file, checksec=False) - log.info('%s', text.red(os.path.basename(file))) - - 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()) - - if exe.buildid: - log.indented('%-20s %s', text.green('BuildID:'), enhex(exe.buildid)) - log.indented('%-20s %s', text.green('MD5:'), md5(exe.data).hexdigest()) - log.indented('%-20s %s', text.green('SHA1:'), sha1(exe.data).hexdigest()) - log.indented('%-20s %s', text.green('SHA256:'), sha256(exe.data).hexdigest()) - - # Always dump the basic list of common symbols - log.indented('%s', text.green('Symbols:')) - synthetic_symbols = collect_synthetic_symbols(exe) - - symbols = common_symbols + (args.symbols or []) + synthetic_symbols - symbols.sort() - for symbol in symbols: - if symbol not in exe.symbols: - log.indented('%25s = %s', symbol, text.red('not found')) - else: - log.indented('%25s = %#x', symbol, translate_offset(exe.symbols[symbol], args, exe)) + print_libc_elf(ELF(file, checksec=False)) + + elif args.libc_command == 'fetch': + + if args.update: + subprocess.check_call(['./get'] + args.update, cwd=args.path) + + else: + if not Path(args.path).exists(): + if yesno("Would you like to initialize the libc-database repository? " + "If the path already exists, this prompt will not display, and automatically upgrade repository."): + log.waitfor("init libc-database repository") + subprocess.check_call(['git', 'clone', 'https://github.com/niklasb/libc-database/', args.path]) + else: + log.waitfor("upgrade libc-database repository") + subprocess.check_call(['git', 'pull'], cwd=args.path) + if __name__ == '__main__': pwnlib.commandline.common.main(__file__, main) diff --git a/pwnlib/commandline/shellcraft.py b/pwnlib/commandline/shellcraft.py index ae24e4c1f..f5f6fd6cf 100644 --- a/pwnlib/commandline/shellcraft.py +++ b/pwnlib/commandline/shellcraft.py @@ -3,7 +3,6 @@ import argparse import os -import six import sys import types @@ -280,8 +279,8 @@ def main(args): code_array = [] for (name, func, func_args) in funcs: - defargs = len(six.get_function_defaults(func) or ()) - reqargs = six.get_function_code(func).co_argcount - defargs + defargs = len(func.__defaults__ or ()) + reqargs = func.__code__.co_argcount - defargs if len(func_args) < reqargs: if defargs > 0: diff --git a/pwnlib/commandline/template.py b/pwnlib/commandline/template.py index 44456441c..faea7ca1d 100644 --- a/pwnlib/commandline/template.py +++ b/pwnlib/commandline/template.py @@ -1,9 +1,12 @@ from __future__ import absolute_import from __future__ import division +from __future__ import print_function from pwn import * from pwnlib.commandline import common +from pwnlib.util.misc import which, parse_ldd_output, write +from sys import stderr from mako.lookup import TemplateLookup, Template parser = common.parser_commands.add_parser( @@ -32,18 +35,100 @@ 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 get_docker_image_libraries(): + """Tries to retrieve challenge libraries from a Docker image built from the Dockerfile in the current working directory. + + The libraries are retrieved by parsing the output of running ldd on /bin/sh. + Supports regular Docker images as well as jail images. + """ + with log.progress("Extracting challenge libraries from Docker image") as progress: + if not which("docker"): + progress.failure("docker command not found") + return None, None + # maps jail image name to the root directory of the child image + jail_image_to_chroot_dir = { + "pwn.red/jail": "/srv", + } + dockerfile = open("Dockerfile", "r").read() + jail = None + chroot_dir = "/" + for jail_image in jail_image_to_chroot_dir: + if re.search(r"^FROM %s" % jail_image, dockerfile, re.MULTILINE): + jail = jail_image + chroot_dir = jail_image_to_chroot_dir[jail_image] + break + try: + progress.status("Building image") + image_sha = subprocess.check_output(["docker", "build", "-q", "."], stderr=subprocess.PIPE, shell=False).decode().strip() + + progress.status("Retrieving library paths") + ldd_command = ["-c", "chroot %s /bin/sh -c 'ldd /bin/sh'" % chroot_dir] + ldd_output = subprocess.check_output([ + "docker", + "run", + "--rm", + "--entrypoint", + "/bin/sh", + ] + (["--privileged"] if jail else []) + [ + image_sha, + ] + ldd_command, + stderr=subprocess.PIPE, + shell=False + ).decode() + + libc, ld = None, None + libc_basename, ld_basename = None, None + for lib_path in parse_ldd_output(ldd_output): + if "libc." in lib_path: + libc = lib_path + libc_basename = os.path.basename(lib_path) + if "ld-" in lib_path: + ld = lib_path + ld_basename = os.path.basename(lib_path) + + if not (libc and ld): + progress.failure("Could not find libraries") + return None, None + + progress.status("Copying libraries to current directory") + for filename, basename in zip((libc, ld), (libc_basename, ld_basename)): + cat_command = ["-c", "chroot %s /bin/sh -c '/bin/cat %s'" % (chroot_dir, filename)] + contents = subprocess.check_output([ + "docker", + "run", + "--rm", + "--entrypoint", + "/bin/sh", + ] + (["--privileged"] if jail else []) + [ + image_sha + ] + cat_command, + stderr=subprocess.PIPE, + shell=False + ) + write(basename, contents) + + except subprocess.CalledProcessError as e: + print(e.stderr.decode()) + log.error("docker failed with status: %d" % e.returncode) + + progress.success("Retrieved libraries from Docker image") + return libc_basename, ld_basename + 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 + has_dockerfile = False other_files = [] - for filename in os.listdir(): + 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 + elif filename == "Dockerfile": + has_dockerfile = True else: if os.access(filename, os.X_OK): other_files.append(filename) @@ -52,6 +137,9 @@ def detect_missing_binaries(args): 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 has_dockerfile and exe and not (libc or ld): + libc, ld = get_docker_image_libraries() if exe != args.exe: log.success("Found challenge binary %r", exe) diff --git a/pwnlib/config.py b/pwnlib/config.py index 06b9514b0..01981ea0b 100644 --- a/pwnlib/config.py +++ b/pwnlib/config.py @@ -35,7 +35,7 @@ from __future__ import absolute_import from __future__ import division -from six.moves import configparser +import configparser import os registered_configs = {} diff --git a/pwnlib/constants/darwin/aarch64.py b/pwnlib/constants/darwin/aarch64.py index 974670014..b00fa5492 100644 --- a/pwnlib/constants/darwin/aarch64.py +++ b/pwnlib/constants/darwin/aarch64.py @@ -88,6 +88,7 @@ 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_FMT_CLONE_MAPPING = Constant('VOL_CAP_FMT_CLONE_MAPPING',0x04000000) 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) @@ -109,6 +110,8 @@ 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) +VOL_CAP_INT_ATTRIBUTION_TAG = Constant('VOL_CAP_INT_ATTRIBUTION_TAG',0x00400000) +VOL_CAP_INT_PUNCHHOLE = Constant('VOL_CAP_INT_PUNCHHOLE',0x00800000) ATTR_CMN_NAME = Constant('ATTR_CMN_NAME',0x00000001) ATTR_CMN_DEVID = Constant('ATTR_CMN_DEVID',0x00000002) ATTR_CMN_FSID = Constant('ATTR_CMN_FSID',0x00000004) @@ -293,6 +296,8 @@ IO_SWAP_DISPATCH = Constant('IO_SWAP_DISPATCH',0x200000) IO_SKIP_ENCRYPTION = Constant('IO_SKIP_ENCRYPTION',0x400000) IO_EVTONLY = Constant('IO_EVTONLY',0x800000) +IO_NOCACHE_SYSSPACE = Constant('IO_NOCACHE_SYSSPACE',0x1000000) +IO_NOCACHE_SWRITE = Constant('IO_NOCACHE_SWRITE',0x2000000) LOOKUP = Constant('LOOKUP',0) CREATE = Constant('CREATE',1) DELETE = Constant('DELETE',2) @@ -347,6 +352,7 @@ 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_LOOKUP_NOFOLLOW_ANY = Constant('VNODE_LOOKUP_NOFOLLOW_ANY',0x08) VNODE_RELOAD = Constant('VNODE_RELOAD',0x01) VNODE_WAIT = Constant('VNODE_WAIT',0x02) VNODE_WRITEABLE = Constant('VNODE_WRITEABLE',0x04) @@ -425,7 +431,7 @@ WANTPARENT = Constant('WANTPARENT',0x0010) UIO_MAXIOV = Constant('UIO_MAXIOV',1024) UIO_SMALLIOV = Constant('UIO_SMALLIOV',8) -EVFILT_SYSCOUNT = Constant('EVFILT_SYSCOUNT',17) +EVFILT_SYSCOUNT = Constant('EVFILT_SYSCOUNT',18) 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) @@ -503,6 +509,7 @@ 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_3P_PLUGINS = Constant('IMGPF_3P_PLUGINS',0x00000080) 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) @@ -512,6 +519,7 @@ IMGPF_HW_TPRO = Constant('IMGPF_HW_TPRO',0x00004000) IMGPF_ROSETTA = Constant('IMGPF_ROSETTA',0x10000000) IMGPF_ALT_ROSETTA = Constant('IMGPF_ALT_ROSETTA',0x20000000) +IMGPF_RESERVED_2 = Constant('IMGPF_RESERVED_2',0x40000000) IMGPF_NOJOP = Constant('IMGPF_NOJOP',0x80000000) IMGPF_SB_DEFAULT = Constant('IMGPF_SB_DEFAULT',0) IMGPF_SB_TRUE = Constant('IMGPF_SB_TRUE',1) @@ -560,9 +568,34 @@ WCONTINUED = Constant('WCONTINUED',0x00000010) WNOWAIT = Constant('WNOWAIT',0x00000020) WAIT_MYPGRP = Constant('WAIT_MYPGRP',0) +PRIO_DARWIN_GPU = Constant('PRIO_DARWIN_GPU',5) +PRIO_DARWIN_GPU_ALLOW = Constant('PRIO_DARWIN_GPU_ALLOW',0x1) +PRIO_DARWIN_GPU_DENY = Constant('PRIO_DARWIN_GPU_DENY',0x2) +PRIO_DARWIN_ROLE = Constant('PRIO_DARWIN_ROLE',6) +PRIO_DARWIN_ROLE_DEFAULT = Constant('PRIO_DARWIN_ROLE_DEFAULT',0x0) +PRIO_DARWIN_ROLE_UI_FOCAL = Constant('PRIO_DARWIN_ROLE_UI_FOCAL',0x1) +PRIO_DARWIN_ROLE_UI = Constant('PRIO_DARWIN_ROLE_UI',0x2) +PRIO_DARWIN_ROLE_NON_UI = Constant('PRIO_DARWIN_ROLE_NON_UI',0x3) +PRIO_DARWIN_ROLE_UI_NON_FOCAL = Constant('PRIO_DARWIN_ROLE_UI_NON_FOCAL',0x4) +PRIO_DARWIN_ROLE_TAL_LAUNCH = Constant('PRIO_DARWIN_ROLE_TAL_LAUNCH',0x5) +PRIO_DARWIN_ROLE_DARWIN_BG = Constant('PRIO_DARWIN_ROLE_DARWIN_BG',0x6) PRIO_DARWIN_GAME_MODE = Constant('PRIO_DARWIN_GAME_MODE',7) +PRIO_DARWIN_CARPLAY_MODE = Constant('PRIO_DARWIN_CARPLAY_MODE',8) PRIO_DARWIN_GAME_MODE_OFF = Constant('PRIO_DARWIN_GAME_MODE_OFF',0x0) PRIO_DARWIN_GAME_MODE_ON = Constant('PRIO_DARWIN_GAME_MODE_ON',0x1) +PRIO_DARWIN_CARPLAY_MODE_OFF = Constant('PRIO_DARWIN_CARPLAY_MODE_OFF',0x0) +PRIO_DARWIN_CARPLAY_MODE_ON = Constant('PRIO_DARWIN_CARPLAY_MODE_ON',0x1) +IOMON_ENABLE = Constant('IOMON_ENABLE',0x01) +IOMON_DISABLE = Constant('IOMON_DISABLE',0x02) +IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY = Constant('IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY',1) +IOPOL_TYPE_VFS_ALTLINK = Constant('IOPOL_TYPE_VFS_ALTLINK',11) +IOPOL_TYPE_VFS_NOCACHE_WRITE_FS_BLKSIZE = Constant('IOPOL_TYPE_VFS_NOCACHE_WRITE_FS_BLKSIZE',12) +IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT = Constant('IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT',0) +IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE = Constant('IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE',1) +IOPOL_VFS_ALTLINK_DISABLED = Constant('IOPOL_VFS_ALTLINK_DISABLED',0) +IOPOL_VFS_ALTLINK_ENABLED = Constant('IOPOL_VFS_ALTLINK_ENABLED',1) +IOPOL_CMD_GET = Constant('IOPOL_CMD_GET',0x00000001) +IOPOL_CMD_SET = Constant('IOPOL_CMD_SET',0x00000002) IPC_CREAT = Constant('IPC_CREAT',0o001000) IPC_EXCL = Constant('IPC_EXCL',0o002000) IPC_NOWAIT = Constant('IPC_NOWAIT',0o004000) @@ -677,6 +710,7 @@ F_GETLEASE = Constant('F_GETLEASE',107) F_TRANSFEREXTENTS = Constant('F_TRANSFEREXTENTS',110) F_ATTRIBUTION_TAG = Constant('F_ATTRIBUTION_TAG',111) +F_ADDSIGS_MAIN_BINARY = Constant('F_ADDSIGS_MAIN_BINARY',113) FCNTL_FS_SPECIFIC_BASE = Constant('FCNTL_FS_SPECIFIC_BASE',0x00010000) F_DUPFD_CLOEXEC = Constant('F_DUPFD_CLOEXEC',67) FD_CLOEXEC = Constant('FD_CLOEXEC',1) @@ -904,6 +938,7 @@ MADV_FREE_REUSE = Constant('MADV_FREE_REUSE',8) MADV_CAN_REUSE = Constant('MADV_CAN_REUSE',9) MADV_PAGEOUT = Constant('MADV_PAGEOUT',10) +MADV_ZERO = Constant('MADV_ZERO',11) MINCORE_INCORE = Constant('MINCORE_INCORE',0x1) MINCORE_REFERENCED = Constant('MINCORE_REFERENCED',0x2) MINCORE_MODIFIED = Constant('MINCORE_MODIFIED',0x4) @@ -1111,6 +1146,9 @@ 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_EXCLAVES = Constant('DBG_MACH_EXCLAVES',0x2A) +DBG_MACH_EXCLAVES_SCHEDULER = Constant('DBG_MACH_EXCLAVES_SCHEDULER',0x2B) +DBG_MACH_EPOCH_SYNC = Constant('DBG_MACH_EPOCH_SYNC',0x2C) DBG_MACH_VM = Constant('DBG_MACH_VM',0x30) DBG_MACH_LEAKS = Constant('DBG_MACH_LEAKS',0x31) DBG_MACH_WORKINGSET = Constant('DBG_MACH_WORKINGSET',0x32) @@ -1136,6 +1174,7 @@ 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) +DBG_MACH_VM_RECLAIM = Constant('DBG_MACH_VM_RECLAIM',0xB0) 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) @@ -1177,7 +1216,6 @@ 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) @@ -1229,6 +1267,7 @@ 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_PROCESSOR_SHUTDOWN = Constant('MACH_PROCESSOR_SHUTDOWN',0x64) 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) @@ -1254,20 +1293,83 @@ 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) +DBG_VM_VNODE_PAGEOUT = Constant('DBG_VM_VNODE_PAGEOUT',0x001) +DBG_VM_FAULT_INTERNAL = Constant('DBG_VM_FAULT_INTERNAL',0x002) +DBG_VM_PURGEABLE_TOKEN_ADD = Constant('DBG_VM_PURGEABLE_TOKEN_ADD',0x040) +DBG_VM_PURGEABLE_TOKEN_DELETE = Constant('DBG_VM_PURGEABLE_TOKEN_DELETE',0x041) +DBG_VM_PURGEABLE_TOKEN_RIPEN = Constant('DBG_VM_PURGEABLE_TOKEN_RIPEN',0x042) +DBG_VM_PURGEABLE_OBJECT_ADD = Constant('DBG_VM_PURGEABLE_OBJECT_ADD',0x048) +DBG_VM_PURGEABLE_OBJECT_REMOVE = Constant('DBG_VM_PURGEABLE_OBJECT_REMOVE',0x049) +DBG_VM_PURGEABLE_OBJECT_PURGE = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE',0x04a) +DBG_VM_PURGEABLE_OBJECT_PURGE_ALL = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE_ALL',0x04b) +DBG_VM_PURGEABLE_OBJECT_PURGE_ONE = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE_ONE',0x04c) +DBG_VM_PURGEABLE_OBJECT_PURGE_LOOP = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE_LOOP',0x04e) +DBG_VM_MAP_PARTIAL_REAP = Constant('DBG_VM_MAP_PARTIAL_REAP',0x054) +DBG_VM_MAP_WILLNEED = Constant('DBG_VM_MAP_WILLNEED',0x055) +DBG_VM_FAULT_CHECK_ZFDELAY = Constant('DBG_VM_FAULT_CHECK_ZFDELAY',0x100) +DBG_VM_FAULT_COWDELAY = Constant('DBG_VM_FAULT_COWDELAY',0x101) +DBG_VM_FAULT_ZFDELAY = Constant('DBG_VM_FAULT_ZFDELAY',0x102) +DBG_VM_FAULT_COMPRESSORDELAY = Constant('DBG_VM_FAULT_COMPRESSORDELAY',0x103) +DBG_VM_PAGEOUT_SCAN = Constant('DBG_VM_PAGEOUT_SCAN',0x104) +DBG_VM_PAGEOUT_BALANCE = Constant('DBG_VM_PAGEOUT_BALANCE',0x105) +DBG_VM_PAGEOUT_FREELIST = Constant('DBG_VM_PAGEOUT_FREELIST',0x106) +DBG_VM_PAGEOUT_PURGEONE = Constant('DBG_VM_PAGEOUT_PURGEONE',0x107) +DBG_VM_PAGEOUT_CACHE_EVICT = Constant('DBG_VM_PAGEOUT_CACHE_EVICT',0x108) +DBG_VM_PAGEOUT_THREAD_BLOCK = Constant('DBG_VM_PAGEOUT_THREAD_BLOCK',0x109) +DBG_VM_PAGEOUT_JETSAM = Constant('DBG_VM_PAGEOUT_JETSAM',0x10A) +DBG_VM_INFO1 = Constant('DBG_VM_INFO1',0x10B) +DBG_VM_INFO2 = Constant('DBG_VM_INFO2',0x10C) +DBG_VM_INFO3 = Constant('DBG_VM_INFO3',0x10D) +DBG_VM_INFO4 = Constant('DBG_VM_INFO4',0x10E) +DBG_VM_INFO5 = Constant('DBG_VM_INFO5',0x10F) +DBG_VM_INFO6 = Constant('DBG_VM_INFO6',0x110) +DBG_VM_INFO7 = Constant('DBG_VM_INFO7',0x111) +DBG_VM_INFO8 = Constant('DBG_VM_INFO8',0x112) +DBG_VM_INFO9 = Constant('DBG_VM_INFO9',0x113) +DBG_VM_INFO10 = Constant('DBG_VM_INFO10',0x114) +DBG_VM_UPL_PAGE_WAIT = Constant('DBG_VM_UPL_PAGE_WAIT',0x120) +DBG_VM_IOPL_PAGE_WAIT = Constant('DBG_VM_IOPL_PAGE_WAIT',0x121) +DBG_VM_PAGE_WAIT_BLOCK = Constant('DBG_VM_PAGE_WAIT_BLOCK',0x122) +DBG_VM_PAGE_SLEEP = Constant('DBG_VM_PAGE_SLEEP',0x123) +DBG_VM_PAGE_EXPEDITE = Constant('DBG_VM_PAGE_EXPEDITE',0x124) +DBG_VM_PAGE_EXPEDITE_NO_MEMORY = Constant('DBG_VM_PAGE_EXPEDITE_NO_MEMORY',0x125) +DBG_VM_PAGE_GRAB = Constant('DBG_VM_PAGE_GRAB',0x126) +DBG_VM_PAGE_RELEASE = Constant('DBG_VM_PAGE_RELEASE',0x127) +DBG_VM_COMPRESSOR_COMPACT_AND_SWAP = Constant('DBG_VM_COMPRESSOR_COMPACT_AND_SWAP',0x128) +DBG_VM_COMPRESSOR_DELAYED_COMPACT = Constant('DBG_VM_COMPRESSOR_DELAYED_COMPACT',0x129) +DBG_VM_OBJECT_SLEEP = Constant('DBG_VM_OBJECT_SLEEP',0x12a) +DBG_VM_PAGE_WAKEUP = Constant('DBG_VM_PAGE_WAKEUP',0x12b) +DBG_VM_PAGE_WAKEUP_DONE = Constant('DBG_VM_PAGE_WAKEUP_DONE',0x12c) +DBG_VM_PRESSURE_EVENT = Constant('DBG_VM_PRESSURE_EVENT',0x130) +DBG_VM_EXECVE = Constant('DBG_VM_EXECVE',0x131) +DBG_VM_WAKEUP_COMPACTOR_SWAPPER = Constant('DBG_VM_WAKEUP_COMPACTOR_SWAPPER',0x132) +DBG_VM_UPL_REQUEST = Constant('DBG_VM_UPL_REQUEST',0x133) +DBG_VM_IOPL_REQUEST = Constant('DBG_VM_IOPL_REQUEST',0x134) +DBG_VM_KERN_REQUEST = Constant('DBG_VM_KERN_REQUEST',0x135) +DBG_VM_DATA_WRITE = Constant('DBG_VM_DATA_WRITE',0x140) +DBG_VM_PRESSURE_LEVEL_CHANGE = Constant('DBG_VM_PRESSURE_LEVEL_CHANGE',0x141) +DBG_VM_PHYS_WRITE_ACCT = Constant('DBG_VM_PHYS_WRITE_ACCT',0x142) +DBG_VM_MAP_LOOKUP_ENTRY_FAILURE = Constant('DBG_VM_MAP_LOOKUP_ENTRY_FAILURE',0x143) +VM_DISCONNECT_ALL_PAGE_MAPPINGS = Constant('VM_DISCONNECT_ALL_PAGE_MAPPINGS',0x00) +VM_DISCONNECT_TASK_PAGE_MAPPINGS = Constant('VM_DISCONNECT_TASK_PAGE_MAPPINGS',0x01) +VM_REAL_FAULT_ADDR_INTERNAL = Constant('VM_REAL_FAULT_ADDR_INTERNAL',0x02) +VM_REAL_FAULT_ADDR_PURGABLE = Constant('VM_REAL_FAULT_ADDR_PURGABLE',0x03) +VM_REAL_FAULT_ADDR_EXTERNAL = Constant('VM_REAL_FAULT_ADDR_EXTERNAL',0x04) +VM_REAL_FAULT_ADDR_SHAREDCACHE = Constant('VM_REAL_FAULT_ADDR_SHAREDCACHE',0x05) +VM_REAL_FAULT_FAST = Constant('VM_REAL_FAULT_FAST',0x06) +VM_REAL_FAULT_SLOW = Constant('VM_REAL_FAULT_SLOW',0x07) +VM_MAP_LOOKUP_OBJECT = Constant('VM_MAP_LOOKUP_OBJECT',0x08) +DBG_ZERO_FILL_FAULT = Constant('DBG_ZERO_FILL_FAULT',0x01) +DBG_PAGEIN_FAULT = Constant('DBG_PAGEIN_FAULT',0x02) +DBG_COW_FAULT = Constant('DBG_COW_FAULT',0x03) +DBG_CACHE_HIT_FAULT = Constant('DBG_CACHE_HIT_FAULT',0x04) +DBG_NZF_PAGE_FAULT = Constant('DBG_NZF_PAGE_FAULT',0x05) +DBG_GUARD_FAULT = Constant('DBG_GUARD_FAULT',0x06) +DBG_PAGEINV_FAULT = Constant('DBG_PAGEINV_FAULT',0x07) +DBG_PAGEIND_FAULT = Constant('DBG_PAGEIND_FAULT',0x08) +DBG_COMPRESSOR_FAULT = Constant('DBG_COMPRESSOR_FAULT',0x09) +DBG_COMPRESSOR_SWAPIN_FAULT = Constant('DBG_COMPRESSOR_SWAPIN_FAULT',0x0a) +DBG_COR_FAULT = Constant('DBG_COR_FAULT',0x0b) 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) @@ -1282,6 +1384,31 @@ 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_SUSPEND = Constant('MACH_THREAD_SUSPEND',0xe) +MACH_THREAD_RESUME = Constant('MACH_THREAD_RESUME',0xf) +MACH_EXCLAVES_SWITCH = Constant('MACH_EXCLAVES_SWITCH',0x0) +MACH_EXCLAVES_XNUPROXY = Constant('MACH_EXCLAVES_XNUPROXY',0x1) +MACH_EXCLAVES_RPC = Constant('MACH_EXCLAVES_RPC',0x2) +MACH_EXCLAVES_UPCALL = Constant('MACH_EXCLAVES_UPCALL',0x3) +MACH_EXCLAVES_BOOT_TASK = Constant('MACH_EXCLAVES_BOOT_TASK',0x4) +MACH_EXCLAVES_SCHEDULER_YIELD = Constant('MACH_EXCLAVES_SCHEDULER_YIELD',0x0) +MACH_EXCLAVES_SCHEDULER_SPAWNED = Constant('MACH_EXCLAVES_SCHEDULER_SPAWNED',0x1) +MACH_EXCLAVES_SCHEDULER_TERMINATED = Constant('MACH_EXCLAVES_SCHEDULER_TERMINATED',0x2) +MACH_EXCLAVES_SCHEDULER_WAIT = Constant('MACH_EXCLAVES_SCHEDULER_WAIT',0x3) +MACH_EXCLAVES_SCHEDULER_WAKE = Constant('MACH_EXCLAVES_SCHEDULER_WAKE',0x4) +MACH_EXCLAVES_SCHEDULER_SUSPENDED = Constant('MACH_EXCLAVES_SCHEDULER_SUSPENDED',0x5) +MACH_EXCLAVES_SCHEDULER_RESUMED = Constant('MACH_EXCLAVES_SCHEDULER_RESUMED',0x6) +MACH_EXCLAVES_SCHEDULER_INTERRUPTED = Constant('MACH_EXCLAVES_SCHEDULER_INTERRUPTED',0x7) +MACH_EXCLAVES_SCHEDULER_NOTHING_SCHEDULED = Constant('MACH_EXCLAVES_SCHEDULER_NOTHING_SCHEDULED',0x8) +MACH_EXCLAVES_SCHEDULER_ALL_EXCLAVES_BOOTED = Constant('MACH_EXCLAVES_SCHEDULER_ALL_EXCLAVES_BOOTED',0x9) +MACH_EXCLAVES_SCHEDULER_EARLY_ALLOC = Constant('MACH_EXCLAVES_SCHEDULER_EARLY_ALLOC',0xa) +MACH_EPOCH_SYNC_WAIT_STALE = Constant('MACH_EPOCH_SYNC_WAIT_STALE',0x0) +MACH_EPOCH_SYNC_WAIT = Constant('MACH_EPOCH_SYNC_WAIT',0x1) +MACH_EPOCH_SYNC_WAKE_NO_WAITERS = Constant('MACH_EPOCH_SYNC_WAKE_NO_WAITERS',0x2) +MACH_EPOCH_SYNC_WAKE_ONE = Constant('MACH_EPOCH_SYNC_WAKE_ONE',0x3) +MACH_EPOCH_SYNC_WAKE_ALL = Constant('MACH_EPOCH_SYNC_WAKE_ALL',0x4) +MACH_EPOCH_SYNC_WAKE_ONE_WITH_OWNER = Constant('MACH_EPOCH_SYNC_WAKE_ONE_WITH_OWNER',0x5) +MACH_EPOCH_SYNC_WAKE_THREAD = Constant('MACH_EPOCH_SYNC_WAKE_THREAD',0x6) 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) @@ -1424,6 +1551,13 @@ 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) +VM_RECLAIM_UPDATE_ACCOUNTING = Constant('VM_RECLAIM_UPDATE_ACCOUNTING',0x01) +VM_RECLAIM_ENTRIES = Constant('VM_RECLAIM_ENTRIES',0x02) +VM_RECLAIM_CHUNK = Constant('VM_RECLAIM_CHUNK',0x03) +VM_RECLAIM_ENTRY = Constant('VM_RECLAIM_ENTRY',0x04) +VM_RECLAIM_ALL_MEMORY = Constant('VM_RECLAIM_ALL_MEMORY',0x05) +VM_RECLAIM_ASYNC_MEMORY = Constant('VM_RECLAIM_ASYNC_MEMORY',0x06) +VM_RECLAIM_INIT = Constant('VM_RECLAIM_INIT',0x07) DBG_NETIP = Constant('DBG_NETIP',1) DBG_NETARP = Constant('DBG_NETARP',2) DBG_NETUDP = Constant('DBG_NETUDP',3) @@ -2109,6 +2243,7 @@ XATTR_NOSECURITY = Constant('XATTR_NOSECURITY',0x0008) XATTR_NODEFAULT = Constant('XATTR_NODEFAULT',0x0010) XATTR_SHOWCOMPRESSION = Constant('XATTR_SHOWCOMPRESSION',0x0020) +XATTR_NOFOLLOW_ANY = Constant('XATTR_NOFOLLOW_ANY',0x0040) XATTR_MAXNAMELEN = Constant('XATTR_MAXNAMELEN',127) PR_SLOWHZ = Constant('PR_SLOWHZ',2) PRC_IFDOWN = Constant('PRC_IFDOWN',0) @@ -2142,6 +2277,7 @@ 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) +__has_safe_buffers = Constant('__has_safe_buffers',0) __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) @@ -2479,7 +2615,8 @@ 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) +VQ_PURGEABLE_SPACE_CHANGE = Constant('VQ_PURGEABLE_SPACE_CHANGE',0x10000) +VQ_FLAG20000 = Constant('VQ_FLAG20000',0x20000) 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) @@ -2510,7 +2647,7 @@ 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) +CRYPTEX_AUTH_STRUCT_VERSION = Constant('CRYPTEX_AUTH_STRUCT_VERSION',2) EV_FD = Constant('EV_FD',1) EV_RE = Constant('EV_RE',1) EV_WR = Constant('EV_WR',2) @@ -2534,6 +2671,10 @@ 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_LITTLE_ENDIAN = Constant('__DARWIN_LITTLE_ENDIAN',1234) +__DARWIN_BIG_ENDIAN = Constant('__DARWIN_BIG_ENDIAN',4321) +__DARWIN_PDP_ENDIAN = Constant('__DARWIN_PDP_ENDIAN',3412) +USE_CLANG_TYPES = Constant('USE_CLANG_TYPES',0) __DARWIN_NULL = Constant('__DARWIN_NULL',0) UBC_PUSHDIRTY = Constant('UBC_PUSHDIRTY',0x01) UBC_PUSHALL = Constant('UBC_PUSHALL',0x02) @@ -3069,7 +3210,9 @@ 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_coalition_policy_set = Constant('SYS_coalition_policy_set',556) +SYS_coalition_policy_get = Constant('SYS_coalition_policy_get',557) +SYS_MAXSYSCALL = Constant('SYS_MAXSYSCALL',558) SYS_invalid = Constant('SYS_invalid',63) SOCK_STREAM = Constant('SOCK_STREAM',1) SOCK_DGRAM = Constant('SOCK_DGRAM',2) @@ -3117,6 +3260,7 @@ 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) +SO_BINDTODEVICE = Constant('SO_BINDTODEVICE',0x1134) 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) diff --git a/pwnlib/constants/darwin/amd64.py b/pwnlib/constants/darwin/amd64.py index 9c7f28401..a0b105848 100644 --- a/pwnlib/constants/darwin/amd64.py +++ b/pwnlib/constants/darwin/amd64.py @@ -88,6 +88,7 @@ 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_FMT_CLONE_MAPPING = Constant('VOL_CAP_FMT_CLONE_MAPPING',0x04000000) 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) @@ -109,6 +110,8 @@ 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) +VOL_CAP_INT_ATTRIBUTION_TAG = Constant('VOL_CAP_INT_ATTRIBUTION_TAG',0x00400000) +VOL_CAP_INT_PUNCHHOLE = Constant('VOL_CAP_INT_PUNCHHOLE',0x00800000) ATTR_CMN_NAME = Constant('ATTR_CMN_NAME',0x00000001) ATTR_CMN_DEVID = Constant('ATTR_CMN_DEVID',0x00000002) ATTR_CMN_FSID = Constant('ATTR_CMN_FSID',0x00000004) @@ -293,6 +296,8 @@ IO_SWAP_DISPATCH = Constant('IO_SWAP_DISPATCH',0x200000) IO_SKIP_ENCRYPTION = Constant('IO_SKIP_ENCRYPTION',0x400000) IO_EVTONLY = Constant('IO_EVTONLY',0x800000) +IO_NOCACHE_SYSSPACE = Constant('IO_NOCACHE_SYSSPACE',0x1000000) +IO_NOCACHE_SWRITE = Constant('IO_NOCACHE_SWRITE',0x2000000) LOOKUP = Constant('LOOKUP',0) CREATE = Constant('CREATE',1) DELETE = Constant('DELETE',2) @@ -347,6 +352,7 @@ 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_LOOKUP_NOFOLLOW_ANY = Constant('VNODE_LOOKUP_NOFOLLOW_ANY',0x08) VNODE_RELOAD = Constant('VNODE_RELOAD',0x01) VNODE_WAIT = Constant('VNODE_WAIT',0x02) VNODE_WRITEABLE = Constant('VNODE_WRITEABLE',0x04) @@ -425,7 +431,7 @@ WANTPARENT = Constant('WANTPARENT',0x0010) UIO_MAXIOV = Constant('UIO_MAXIOV',1024) UIO_SMALLIOV = Constant('UIO_SMALLIOV',8) -EVFILT_SYSCOUNT = Constant('EVFILT_SYSCOUNT',17) +EVFILT_SYSCOUNT = Constant('EVFILT_SYSCOUNT',18) 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) @@ -503,6 +509,7 @@ 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_3P_PLUGINS = Constant('IMGPF_3P_PLUGINS',0x00000080) 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) @@ -512,6 +519,7 @@ IMGPF_HW_TPRO = Constant('IMGPF_HW_TPRO',0x00004000) IMGPF_ROSETTA = Constant('IMGPF_ROSETTA',0x10000000) IMGPF_ALT_ROSETTA = Constant('IMGPF_ALT_ROSETTA',0x20000000) +IMGPF_RESERVED_2 = Constant('IMGPF_RESERVED_2',0x40000000) IMGPF_NOJOP = Constant('IMGPF_NOJOP',0x80000000) IMGPF_SB_DEFAULT = Constant('IMGPF_SB_DEFAULT',0) IMGPF_SB_TRUE = Constant('IMGPF_SB_TRUE',1) @@ -560,9 +568,34 @@ WCONTINUED = Constant('WCONTINUED',0x00000010) WNOWAIT = Constant('WNOWAIT',0x00000020) WAIT_MYPGRP = Constant('WAIT_MYPGRP',0) +PRIO_DARWIN_GPU = Constant('PRIO_DARWIN_GPU',5) +PRIO_DARWIN_GPU_ALLOW = Constant('PRIO_DARWIN_GPU_ALLOW',0x1) +PRIO_DARWIN_GPU_DENY = Constant('PRIO_DARWIN_GPU_DENY',0x2) +PRIO_DARWIN_ROLE = Constant('PRIO_DARWIN_ROLE',6) +PRIO_DARWIN_ROLE_DEFAULT = Constant('PRIO_DARWIN_ROLE_DEFAULT',0x0) +PRIO_DARWIN_ROLE_UI_FOCAL = Constant('PRIO_DARWIN_ROLE_UI_FOCAL',0x1) +PRIO_DARWIN_ROLE_UI = Constant('PRIO_DARWIN_ROLE_UI',0x2) +PRIO_DARWIN_ROLE_NON_UI = Constant('PRIO_DARWIN_ROLE_NON_UI',0x3) +PRIO_DARWIN_ROLE_UI_NON_FOCAL = Constant('PRIO_DARWIN_ROLE_UI_NON_FOCAL',0x4) +PRIO_DARWIN_ROLE_TAL_LAUNCH = Constant('PRIO_DARWIN_ROLE_TAL_LAUNCH',0x5) +PRIO_DARWIN_ROLE_DARWIN_BG = Constant('PRIO_DARWIN_ROLE_DARWIN_BG',0x6) PRIO_DARWIN_GAME_MODE = Constant('PRIO_DARWIN_GAME_MODE',7) +PRIO_DARWIN_CARPLAY_MODE = Constant('PRIO_DARWIN_CARPLAY_MODE',8) PRIO_DARWIN_GAME_MODE_OFF = Constant('PRIO_DARWIN_GAME_MODE_OFF',0x0) PRIO_DARWIN_GAME_MODE_ON = Constant('PRIO_DARWIN_GAME_MODE_ON',0x1) +PRIO_DARWIN_CARPLAY_MODE_OFF = Constant('PRIO_DARWIN_CARPLAY_MODE_OFF',0x0) +PRIO_DARWIN_CARPLAY_MODE_ON = Constant('PRIO_DARWIN_CARPLAY_MODE_ON',0x1) +IOMON_ENABLE = Constant('IOMON_ENABLE',0x01) +IOMON_DISABLE = Constant('IOMON_DISABLE',0x02) +IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY = Constant('IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY',1) +IOPOL_TYPE_VFS_ALTLINK = Constant('IOPOL_TYPE_VFS_ALTLINK',11) +IOPOL_TYPE_VFS_NOCACHE_WRITE_FS_BLKSIZE = Constant('IOPOL_TYPE_VFS_NOCACHE_WRITE_FS_BLKSIZE',12) +IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT = Constant('IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT',0) +IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE = Constant('IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE',1) +IOPOL_VFS_ALTLINK_DISABLED = Constant('IOPOL_VFS_ALTLINK_DISABLED',0) +IOPOL_VFS_ALTLINK_ENABLED = Constant('IOPOL_VFS_ALTLINK_ENABLED',1) +IOPOL_CMD_GET = Constant('IOPOL_CMD_GET',0x00000001) +IOPOL_CMD_SET = Constant('IOPOL_CMD_SET',0x00000002) IPC_CREAT = Constant('IPC_CREAT',0o001000) IPC_EXCL = Constant('IPC_EXCL',0o002000) IPC_NOWAIT = Constant('IPC_NOWAIT',0o004000) @@ -677,6 +710,7 @@ F_GETLEASE = Constant('F_GETLEASE',107) F_TRANSFEREXTENTS = Constant('F_TRANSFEREXTENTS',110) F_ATTRIBUTION_TAG = Constant('F_ATTRIBUTION_TAG',111) +F_ADDSIGS_MAIN_BINARY = Constant('F_ADDSIGS_MAIN_BINARY',113) FCNTL_FS_SPECIFIC_BASE = Constant('FCNTL_FS_SPECIFIC_BASE',0x00010000) F_DUPFD_CLOEXEC = Constant('F_DUPFD_CLOEXEC',67) FD_CLOEXEC = Constant('FD_CLOEXEC',1) @@ -904,6 +938,7 @@ MADV_FREE_REUSE = Constant('MADV_FREE_REUSE',8) MADV_CAN_REUSE = Constant('MADV_CAN_REUSE',9) MADV_PAGEOUT = Constant('MADV_PAGEOUT',10) +MADV_ZERO = Constant('MADV_ZERO',11) MINCORE_INCORE = Constant('MINCORE_INCORE',0x1) MINCORE_REFERENCED = Constant('MINCORE_REFERENCED',0x2) MINCORE_MODIFIED = Constant('MINCORE_MODIFIED',0x4) @@ -1111,6 +1146,9 @@ 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_EXCLAVES = Constant('DBG_MACH_EXCLAVES',0x2A) +DBG_MACH_EXCLAVES_SCHEDULER = Constant('DBG_MACH_EXCLAVES_SCHEDULER',0x2B) +DBG_MACH_EPOCH_SYNC = Constant('DBG_MACH_EPOCH_SYNC',0x2C) DBG_MACH_VM = Constant('DBG_MACH_VM',0x30) DBG_MACH_LEAKS = Constant('DBG_MACH_LEAKS',0x31) DBG_MACH_WORKINGSET = Constant('DBG_MACH_WORKINGSET',0x32) @@ -1136,6 +1174,7 @@ 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) +DBG_MACH_VM_RECLAIM = Constant('DBG_MACH_VM_RECLAIM',0xB0) 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) @@ -1177,7 +1216,6 @@ 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) @@ -1229,6 +1267,7 @@ 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_PROCESSOR_SHUTDOWN = Constant('MACH_PROCESSOR_SHUTDOWN',0x64) 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) @@ -1254,20 +1293,83 @@ 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) +DBG_VM_VNODE_PAGEOUT = Constant('DBG_VM_VNODE_PAGEOUT',0x001) +DBG_VM_FAULT_INTERNAL = Constant('DBG_VM_FAULT_INTERNAL',0x002) +DBG_VM_PURGEABLE_TOKEN_ADD = Constant('DBG_VM_PURGEABLE_TOKEN_ADD',0x040) +DBG_VM_PURGEABLE_TOKEN_DELETE = Constant('DBG_VM_PURGEABLE_TOKEN_DELETE',0x041) +DBG_VM_PURGEABLE_TOKEN_RIPEN = Constant('DBG_VM_PURGEABLE_TOKEN_RIPEN',0x042) +DBG_VM_PURGEABLE_OBJECT_ADD = Constant('DBG_VM_PURGEABLE_OBJECT_ADD',0x048) +DBG_VM_PURGEABLE_OBJECT_REMOVE = Constant('DBG_VM_PURGEABLE_OBJECT_REMOVE',0x049) +DBG_VM_PURGEABLE_OBJECT_PURGE = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE',0x04a) +DBG_VM_PURGEABLE_OBJECT_PURGE_ALL = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE_ALL',0x04b) +DBG_VM_PURGEABLE_OBJECT_PURGE_ONE = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE_ONE',0x04c) +DBG_VM_PURGEABLE_OBJECT_PURGE_LOOP = Constant('DBG_VM_PURGEABLE_OBJECT_PURGE_LOOP',0x04e) +DBG_VM_MAP_PARTIAL_REAP = Constant('DBG_VM_MAP_PARTIAL_REAP',0x054) +DBG_VM_MAP_WILLNEED = Constant('DBG_VM_MAP_WILLNEED',0x055) +DBG_VM_FAULT_CHECK_ZFDELAY = Constant('DBG_VM_FAULT_CHECK_ZFDELAY',0x100) +DBG_VM_FAULT_COWDELAY = Constant('DBG_VM_FAULT_COWDELAY',0x101) +DBG_VM_FAULT_ZFDELAY = Constant('DBG_VM_FAULT_ZFDELAY',0x102) +DBG_VM_FAULT_COMPRESSORDELAY = Constant('DBG_VM_FAULT_COMPRESSORDELAY',0x103) +DBG_VM_PAGEOUT_SCAN = Constant('DBG_VM_PAGEOUT_SCAN',0x104) +DBG_VM_PAGEOUT_BALANCE = Constant('DBG_VM_PAGEOUT_BALANCE',0x105) +DBG_VM_PAGEOUT_FREELIST = Constant('DBG_VM_PAGEOUT_FREELIST',0x106) +DBG_VM_PAGEOUT_PURGEONE = Constant('DBG_VM_PAGEOUT_PURGEONE',0x107) +DBG_VM_PAGEOUT_CACHE_EVICT = Constant('DBG_VM_PAGEOUT_CACHE_EVICT',0x108) +DBG_VM_PAGEOUT_THREAD_BLOCK = Constant('DBG_VM_PAGEOUT_THREAD_BLOCK',0x109) +DBG_VM_PAGEOUT_JETSAM = Constant('DBG_VM_PAGEOUT_JETSAM',0x10A) +DBG_VM_INFO1 = Constant('DBG_VM_INFO1',0x10B) +DBG_VM_INFO2 = Constant('DBG_VM_INFO2',0x10C) +DBG_VM_INFO3 = Constant('DBG_VM_INFO3',0x10D) +DBG_VM_INFO4 = Constant('DBG_VM_INFO4',0x10E) +DBG_VM_INFO5 = Constant('DBG_VM_INFO5',0x10F) +DBG_VM_INFO6 = Constant('DBG_VM_INFO6',0x110) +DBG_VM_INFO7 = Constant('DBG_VM_INFO7',0x111) +DBG_VM_INFO8 = Constant('DBG_VM_INFO8',0x112) +DBG_VM_INFO9 = Constant('DBG_VM_INFO9',0x113) +DBG_VM_INFO10 = Constant('DBG_VM_INFO10',0x114) +DBG_VM_UPL_PAGE_WAIT = Constant('DBG_VM_UPL_PAGE_WAIT',0x120) +DBG_VM_IOPL_PAGE_WAIT = Constant('DBG_VM_IOPL_PAGE_WAIT',0x121) +DBG_VM_PAGE_WAIT_BLOCK = Constant('DBG_VM_PAGE_WAIT_BLOCK',0x122) +DBG_VM_PAGE_SLEEP = Constant('DBG_VM_PAGE_SLEEP',0x123) +DBG_VM_PAGE_EXPEDITE = Constant('DBG_VM_PAGE_EXPEDITE',0x124) +DBG_VM_PAGE_EXPEDITE_NO_MEMORY = Constant('DBG_VM_PAGE_EXPEDITE_NO_MEMORY',0x125) +DBG_VM_PAGE_GRAB = Constant('DBG_VM_PAGE_GRAB',0x126) +DBG_VM_PAGE_RELEASE = Constant('DBG_VM_PAGE_RELEASE',0x127) +DBG_VM_COMPRESSOR_COMPACT_AND_SWAP = Constant('DBG_VM_COMPRESSOR_COMPACT_AND_SWAP',0x128) +DBG_VM_COMPRESSOR_DELAYED_COMPACT = Constant('DBG_VM_COMPRESSOR_DELAYED_COMPACT',0x129) +DBG_VM_OBJECT_SLEEP = Constant('DBG_VM_OBJECT_SLEEP',0x12a) +DBG_VM_PAGE_WAKEUP = Constant('DBG_VM_PAGE_WAKEUP',0x12b) +DBG_VM_PAGE_WAKEUP_DONE = Constant('DBG_VM_PAGE_WAKEUP_DONE',0x12c) +DBG_VM_PRESSURE_EVENT = Constant('DBG_VM_PRESSURE_EVENT',0x130) +DBG_VM_EXECVE = Constant('DBG_VM_EXECVE',0x131) +DBG_VM_WAKEUP_COMPACTOR_SWAPPER = Constant('DBG_VM_WAKEUP_COMPACTOR_SWAPPER',0x132) +DBG_VM_UPL_REQUEST = Constant('DBG_VM_UPL_REQUEST',0x133) +DBG_VM_IOPL_REQUEST = Constant('DBG_VM_IOPL_REQUEST',0x134) +DBG_VM_KERN_REQUEST = Constant('DBG_VM_KERN_REQUEST',0x135) +DBG_VM_DATA_WRITE = Constant('DBG_VM_DATA_WRITE',0x140) +DBG_VM_PRESSURE_LEVEL_CHANGE = Constant('DBG_VM_PRESSURE_LEVEL_CHANGE',0x141) +DBG_VM_PHYS_WRITE_ACCT = Constant('DBG_VM_PHYS_WRITE_ACCT',0x142) +DBG_VM_MAP_LOOKUP_ENTRY_FAILURE = Constant('DBG_VM_MAP_LOOKUP_ENTRY_FAILURE',0x143) +VM_DISCONNECT_ALL_PAGE_MAPPINGS = Constant('VM_DISCONNECT_ALL_PAGE_MAPPINGS',0x00) +VM_DISCONNECT_TASK_PAGE_MAPPINGS = Constant('VM_DISCONNECT_TASK_PAGE_MAPPINGS',0x01) +VM_REAL_FAULT_ADDR_INTERNAL = Constant('VM_REAL_FAULT_ADDR_INTERNAL',0x02) +VM_REAL_FAULT_ADDR_PURGABLE = Constant('VM_REAL_FAULT_ADDR_PURGABLE',0x03) +VM_REAL_FAULT_ADDR_EXTERNAL = Constant('VM_REAL_FAULT_ADDR_EXTERNAL',0x04) +VM_REAL_FAULT_ADDR_SHAREDCACHE = Constant('VM_REAL_FAULT_ADDR_SHAREDCACHE',0x05) +VM_REAL_FAULT_FAST = Constant('VM_REAL_FAULT_FAST',0x06) +VM_REAL_FAULT_SLOW = Constant('VM_REAL_FAULT_SLOW',0x07) +VM_MAP_LOOKUP_OBJECT = Constant('VM_MAP_LOOKUP_OBJECT',0x08) +DBG_ZERO_FILL_FAULT = Constant('DBG_ZERO_FILL_FAULT',0x01) +DBG_PAGEIN_FAULT = Constant('DBG_PAGEIN_FAULT',0x02) +DBG_COW_FAULT = Constant('DBG_COW_FAULT',0x03) +DBG_CACHE_HIT_FAULT = Constant('DBG_CACHE_HIT_FAULT',0x04) +DBG_NZF_PAGE_FAULT = Constant('DBG_NZF_PAGE_FAULT',0x05) +DBG_GUARD_FAULT = Constant('DBG_GUARD_FAULT',0x06) +DBG_PAGEINV_FAULT = Constant('DBG_PAGEINV_FAULT',0x07) +DBG_PAGEIND_FAULT = Constant('DBG_PAGEIND_FAULT',0x08) +DBG_COMPRESSOR_FAULT = Constant('DBG_COMPRESSOR_FAULT',0x09) +DBG_COMPRESSOR_SWAPIN_FAULT = Constant('DBG_COMPRESSOR_SWAPIN_FAULT',0x0a) +DBG_COR_FAULT = Constant('DBG_COR_FAULT',0x0b) 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) @@ -1282,6 +1384,31 @@ 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_SUSPEND = Constant('MACH_THREAD_SUSPEND',0xe) +MACH_THREAD_RESUME = Constant('MACH_THREAD_RESUME',0xf) +MACH_EXCLAVES_SWITCH = Constant('MACH_EXCLAVES_SWITCH',0x0) +MACH_EXCLAVES_XNUPROXY = Constant('MACH_EXCLAVES_XNUPROXY',0x1) +MACH_EXCLAVES_RPC = Constant('MACH_EXCLAVES_RPC',0x2) +MACH_EXCLAVES_UPCALL = Constant('MACH_EXCLAVES_UPCALL',0x3) +MACH_EXCLAVES_BOOT_TASK = Constant('MACH_EXCLAVES_BOOT_TASK',0x4) +MACH_EXCLAVES_SCHEDULER_YIELD = Constant('MACH_EXCLAVES_SCHEDULER_YIELD',0x0) +MACH_EXCLAVES_SCHEDULER_SPAWNED = Constant('MACH_EXCLAVES_SCHEDULER_SPAWNED',0x1) +MACH_EXCLAVES_SCHEDULER_TERMINATED = Constant('MACH_EXCLAVES_SCHEDULER_TERMINATED',0x2) +MACH_EXCLAVES_SCHEDULER_WAIT = Constant('MACH_EXCLAVES_SCHEDULER_WAIT',0x3) +MACH_EXCLAVES_SCHEDULER_WAKE = Constant('MACH_EXCLAVES_SCHEDULER_WAKE',0x4) +MACH_EXCLAVES_SCHEDULER_SUSPENDED = Constant('MACH_EXCLAVES_SCHEDULER_SUSPENDED',0x5) +MACH_EXCLAVES_SCHEDULER_RESUMED = Constant('MACH_EXCLAVES_SCHEDULER_RESUMED',0x6) +MACH_EXCLAVES_SCHEDULER_INTERRUPTED = Constant('MACH_EXCLAVES_SCHEDULER_INTERRUPTED',0x7) +MACH_EXCLAVES_SCHEDULER_NOTHING_SCHEDULED = Constant('MACH_EXCLAVES_SCHEDULER_NOTHING_SCHEDULED',0x8) +MACH_EXCLAVES_SCHEDULER_ALL_EXCLAVES_BOOTED = Constant('MACH_EXCLAVES_SCHEDULER_ALL_EXCLAVES_BOOTED',0x9) +MACH_EXCLAVES_SCHEDULER_EARLY_ALLOC = Constant('MACH_EXCLAVES_SCHEDULER_EARLY_ALLOC',0xa) +MACH_EPOCH_SYNC_WAIT_STALE = Constant('MACH_EPOCH_SYNC_WAIT_STALE',0x0) +MACH_EPOCH_SYNC_WAIT = Constant('MACH_EPOCH_SYNC_WAIT',0x1) +MACH_EPOCH_SYNC_WAKE_NO_WAITERS = Constant('MACH_EPOCH_SYNC_WAKE_NO_WAITERS',0x2) +MACH_EPOCH_SYNC_WAKE_ONE = Constant('MACH_EPOCH_SYNC_WAKE_ONE',0x3) +MACH_EPOCH_SYNC_WAKE_ALL = Constant('MACH_EPOCH_SYNC_WAKE_ALL',0x4) +MACH_EPOCH_SYNC_WAKE_ONE_WITH_OWNER = Constant('MACH_EPOCH_SYNC_WAKE_ONE_WITH_OWNER',0x5) +MACH_EPOCH_SYNC_WAKE_THREAD = Constant('MACH_EPOCH_SYNC_WAKE_THREAD',0x6) 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) @@ -1424,6 +1551,13 @@ 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) +VM_RECLAIM_UPDATE_ACCOUNTING = Constant('VM_RECLAIM_UPDATE_ACCOUNTING',0x01) +VM_RECLAIM_ENTRIES = Constant('VM_RECLAIM_ENTRIES',0x02) +VM_RECLAIM_CHUNK = Constant('VM_RECLAIM_CHUNK',0x03) +VM_RECLAIM_ENTRY = Constant('VM_RECLAIM_ENTRY',0x04) +VM_RECLAIM_ALL_MEMORY = Constant('VM_RECLAIM_ALL_MEMORY',0x05) +VM_RECLAIM_ASYNC_MEMORY = Constant('VM_RECLAIM_ASYNC_MEMORY',0x06) +VM_RECLAIM_INIT = Constant('VM_RECLAIM_INIT',0x07) DBG_NETIP = Constant('DBG_NETIP',1) DBG_NETARP = Constant('DBG_NETARP',2) DBG_NETUDP = Constant('DBG_NETUDP',3) @@ -2109,6 +2243,7 @@ XATTR_NOSECURITY = Constant('XATTR_NOSECURITY',0x0008) XATTR_NODEFAULT = Constant('XATTR_NODEFAULT',0x0010) XATTR_SHOWCOMPRESSION = Constant('XATTR_SHOWCOMPRESSION',0x0020) +XATTR_NOFOLLOW_ANY = Constant('XATTR_NOFOLLOW_ANY',0x0040) XATTR_MAXNAMELEN = Constant('XATTR_MAXNAMELEN',127) PR_SLOWHZ = Constant('PR_SLOWHZ',2) PRC_IFDOWN = Constant('PRC_IFDOWN',0) @@ -2142,6 +2277,7 @@ 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) +__has_safe_buffers = Constant('__has_safe_buffers',0) __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) @@ -2479,7 +2615,8 @@ 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) +VQ_PURGEABLE_SPACE_CHANGE = Constant('VQ_PURGEABLE_SPACE_CHANGE',0x10000) +VQ_FLAG20000 = Constant('VQ_FLAG20000',0x20000) 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) @@ -2510,7 +2647,7 @@ 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) +CRYPTEX_AUTH_STRUCT_VERSION = Constant('CRYPTEX_AUTH_STRUCT_VERSION',2) EV_FD = Constant('EV_FD',1) EV_RE = Constant('EV_RE',1) EV_WR = Constant('EV_WR',2) @@ -2534,6 +2671,10 @@ 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_LITTLE_ENDIAN = Constant('__DARWIN_LITTLE_ENDIAN',1234) +__DARWIN_BIG_ENDIAN = Constant('__DARWIN_BIG_ENDIAN',4321) +__DARWIN_PDP_ENDIAN = Constant('__DARWIN_PDP_ENDIAN',3412) +USE_CLANG_TYPES = Constant('USE_CLANG_TYPES',0) __DARWIN_NULL = Constant('__DARWIN_NULL',0) UBC_PUSHDIRTY = Constant('UBC_PUSHDIRTY',0x01) UBC_PUSHALL = Constant('UBC_PUSHALL',0x02) @@ -3069,7 +3210,9 @@ 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_coalition_policy_set = Constant('SYS_coalition_policy_set',556 + 0x2000000) +SYS_coalition_policy_get = Constant('SYS_coalition_policy_get',557 + 0x2000000) +SYS_MAXSYSCALL = Constant('SYS_MAXSYSCALL',558 + 0x2000000) SYS_invalid = Constant('SYS_invalid',63 + 0x2000000) SOCK_STREAM = Constant('SOCK_STREAM',1) SOCK_DGRAM = Constant('SOCK_DGRAM',2) @@ -3117,6 +3260,7 @@ 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) +SO_BINDTODEVICE = Constant('SO_BINDTODEVICE',0x1134) 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) diff --git a/pwnlib/constants/linux/loongarch64.py b/pwnlib/constants/linux/loongarch64.py new file mode 100644 index 000000000..d21c4fc5d --- /dev/null +++ b/pwnlib/constants/linux/loongarch64.py @@ -0,0 +1,1323 @@ +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) +__NR3264_fcntl = Constant('__NR3264_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) +__NR3264_statfs = Constant('__NR3264_statfs',43) +__NR3264_fstatfs = Constant('__NR3264_fstatfs',44) +__NR3264_truncate = Constant('__NR3264_truncate',45) +__NR3264_ftruncate = Constant('__NR3264_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) +__NR3264_lseek = Constant('__NR3264_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) +__NR3264_sendfile = Constant('__NR3264_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_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_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) +__NR3264_mmap = Constant('__NR3264_mmap',222) +__NR3264_fadvise64 = Constant('__NR3264_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_quotactl_fd = Constant('__NR_quotactl_fd',443) +__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_process_mrelease = Constant('__NR_process_mrelease',448) +__NR_futex_waitv = Constant('__NR_futex_waitv',449) +__NR_set_mempolicy_home_node = Constant('__NR_set_mempolicy_home_node',450) +__NR_cachestat = Constant('__NR_cachestat',451) +__NR_fchmodat2 = Constant('__NR_fchmodat2',452) +__NR_map_shadow_stack = Constant('__NR_map_shadow_stack',453) +__NR_futex_wake = Constant('__NR_futex_wake',454) +__NR_futex_wait = Constant('__NR_futex_wait',455) +__NR_futex_requeue = Constant('__NR_futex_requeue',456) +__NR_fcntl = Constant('__NR_fcntl',25) +__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_lseek = Constant('__NR_lseek',62) +__NR_sendfile = Constant('__NR_sendfile',71) +__NR_mmap = Constant('__NR_mmap',222) +__NR_fadvise64 = Constant('__NR_fadvise64',223) +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_cachestat = Constant('SYS_cachestat',451) +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_fchmodat2 = Constant('SYS_fchmodat2',452) +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_fstatfs = Constant('SYS_fstatfs',44) +SYS_fsync = Constant('SYS_fsync',82) +SYS_ftruncate = Constant('SYS_ftruncate',46) +SYS_futex = Constant('SYS_futex',98) +SYS_futex_requeue = Constant('SYS_futex_requeue',456) +SYS_futex_wait = Constant('SYS_futex_wait',455) +SYS_futex_waitv = Constant('SYS_futex_waitv',449) +SYS_futex_wake = Constant('SYS_futex_wake',454) +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_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_map_shadow_stack = Constant('SYS_map_shadow_stack',453) +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_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_mrelease = Constant('SYS_process_mrelease',448) +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_quotactl_fd = Constant('SYS_quotactl_fd',443) +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_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_set_mempolicy_home_node = Constant('SYS_set_mempolicy_home_node',450) +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_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_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/context/__init__.py b/pwnlib/context/__init__.py index 0750c7f20..4ffed2cf0 100644 --- a/pwnlib/context/__init__.py +++ b/pwnlib/context/__init__.py @@ -15,7 +15,6 @@ import os.path import platform import shutil -import six import socket import string import sys @@ -308,6 +307,10 @@ class ContextType(object): 'little' >>> context.bits 32 + + .. doctest:: + :options: +POSIX +TODO + >>> def nop(): ... print(enhex(pwnlib.asm.asm('nop'))) >>> nop() @@ -359,6 +362,7 @@ class ContextType(object): 'encoding': 'auto', 'endian': 'little', 'gdbinit': "", + 'gdb_binary': "", 'kernel': None, 'local_libcdb': "/var/lib/libc-database", 'log_level': logging.INFO, @@ -419,6 +423,7 @@ class ContextType(object): 'powerpc64': big_64, 'riscv32': little_32, 'riscv64': little_64, + 'loongarch64': little_64, 's390': big_32, 'sparc': big_32, 'sparc64': big_64, @@ -594,9 +599,9 @@ def quiet(self, function=None): ... log.debug("DEBUG") ... log.info("INFO") ... log.warn("WARN") - [DEBUG] DEBUG - [*] INFO - [!] WARN + [...] DEBUG + [...] INFO + [...] WARN """ level = 'error' if context.log_level <= logging.DEBUG: @@ -664,7 +669,7 @@ def verbose(self): information is printed. >>> with context.verbose: func() - [DEBUG] Hello + [...] Hello """ return self.local(log_level='debug') @@ -791,7 +796,9 @@ def arch(self, arch): ('armeabi', 'arm'), ('arm64', 'aarch64'), ('rv32', 'riscv32'), - ('rv64', 'riscv64')] + ('rv64', 'riscv64'), + ('loong64', 'loongarch64'), + ('la64', 'loongarch64')] for k, v in transform: if arch.startswith(k): arch = v @@ -870,6 +877,9 @@ def binary(self, binary): Examples: + .. doctest:: + :options: +POSIX +TODO + >>> context.clear() >>> context.arch, context.bits ('i386', 32) @@ -1032,7 +1042,7 @@ def log_file(self, value): >>> open(bar_txt).readlines()[-1] #doctest: +ELLIPSIS '...:DEBUG:...:Hello from bar!\n' """ - if isinstance(value, (bytes, six.text_type)): + if isinstance(value, (bytes, str)): # check if mode was specified as "[value],[mode]" from pwnlib.util.packing import _need_text value = _need_text(value) @@ -1078,7 +1088,7 @@ def log_console(self, stream): >>> context.log_level = 'warn' >>> log.warn("Hello") [!] Hello - >>> context.log_console=open('/dev/null', 'w') + >>> context.log_console=open(os.devnull, 'w') >>> log.warn("Hello") >>> context.clear() """ @@ -1088,7 +1098,7 @@ def log_console(self, 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 @@ -1250,7 +1260,7 @@ def terminal(self, value): Can be a string or an iterable of strings. In the latter case the first entry is the terminal and the rest are default arguments. """ - if isinstance(value, (bytes, six.text_type)): + if isinstance(value, (bytes, str)): return [value] return value @@ -1331,7 +1341,7 @@ def adb_port(self, value): def device(self, device): """Sets the device being operated on. """ - if isinstance(device, (bytes, six.text_type)): + if isinstance(device, (bytes, str)): device = Device(device) if isinstance(device, Device): self.arch = device.arch or self.arch @@ -1377,9 +1387,9 @@ def buffer_size(self, size): def cache_dir_base(self, new_base): """Base directory to use for caching content. - Changing this to a different value will clear the `cache_dir` path + Changing this to a different value will clear the :attr:`cache_dir` path stored in TLS since a new path will need to be generated to respect the - new `cache_dir_base` value. + new :attr:`cache_dir_base` value. """ if new_base != self.cache_dir_base: @@ -1394,6 +1404,9 @@ def cache_dir(self): Note: May be either a path string, or :const:`None`. + Set to :const:`None` to disable caching. + Set to :const:`True` to generate the default cache directory path + based on :attr:`cache_dir_base` again. Example: @@ -1401,12 +1414,18 @@ def cache_dir(self): >>> cache_dir is not None True >>> os.chmod(cache_dir, 0o000) - >>> del context._tls['cache_dir'] - >>> context.cache_dir is None + >>> context.cache_dir = True + >>> context.cache_dir is None # doctest: +POSIX +TODO True >>> os.chmod(cache_dir, 0o755) >>> cache_dir == context.cache_dir True + >>> context.cache_dir = None + >>> context.cache_dir is None + True + >>> context.cache_dir = True + >>> context.cache_dir is not None + True """ try: # If the TLS already has a cache directory path, we return it @@ -1451,7 +1470,9 @@ def cache_dir(self): @cache_dir.setter def cache_dir(self, v): - if os.access(v, os.W_OK): + if v is True: + del self._tls["cache_dir"] + elif v is None or os.access(v, os.W_OK): # Stash this in TLS for later reuse self._tls["cache_dir"] = v @@ -1491,7 +1512,7 @@ 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``. @@ -1528,6 +1549,20 @@ def gdbinit(self, value): """ return str(value) + @_validator + def gdb_binary(self, value): + """Path to the binary that is used when running GDB locally. + + This is useful when you have multiple versions of gdb installed or the gdb binary is + called something different. + + If set to an empty string, pwntools will try to search for a reasonable gdb binary from + the path. + + Default value is ``""``. + """ + return str(value) + @_validator def cyclic_alphabet(self, alphabet): """Cyclic alphabet. @@ -1722,7 +1757,7 @@ def update_context_defaults(section): default = ContextType.defaults[key] - if isinstance(default, six.string_types + six.integer_types + (tuple, list, dict)): + if isinstance(default, (str, int, tuple, list, dict)): value = safeeval.expr(value) else: log.warn("Unsupported configuration option %r in section %r" % (key, 'context')) diff --git a/pwnlib/data/includes/darwin/aarch64.h b/pwnlib/data/includes/darwin/aarch64.h index 81fb6f979..630009ddf 100644 --- a/pwnlib/data/includes/darwin/aarch64.h +++ b/pwnlib/data/includes/darwin/aarch64.h @@ -87,6 +87,7 @@ #define VOL_CAP_FMT_SHARED_SPACE 0x00800000 #define VOL_CAP_FMT_VOL_GROUPS 0x01000000 #define VOL_CAP_FMT_SEALED 0x02000000 +#define VOL_CAP_FMT_CLONE_MAPPING 0x04000000 #define VOL_CAP_INT_SEARCHFS 0x00000001 #define VOL_CAP_INT_ATTRLIST 0x00000002 #define VOL_CAP_INT_NFSEXPORT 0x00000004 @@ -108,6 +109,8 @@ #define VOL_CAP_INT_RENAME_EXCL 0x00080000 #define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 #define VOL_CAP_INT_RENAME_SECLUDE 0x00200000 +#define VOL_CAP_INT_ATTRIBUTION_TAG 0x00400000 +#define VOL_CAP_INT_PUNCHHOLE 0x00800000 #define ATTR_CMN_NAME 0x00000001 #define ATTR_CMN_DEVID 0x00000002 #define ATTR_CMN_FSID 0x00000004 @@ -292,6 +295,8 @@ #define IO_SWAP_DISPATCH 0x200000 #define IO_SKIP_ENCRYPTION 0x400000 #define IO_EVTONLY 0x800000 +#define IO_NOCACHE_SYSSPACE 0x1000000 +#define IO_NOCACHE_SWRITE 0x2000000 #define LOOKUP 0 #define CREATE 1 #define DELETE 2 @@ -346,6 +351,7 @@ #define VNODE_LOOKUP_NOFOLLOW 0x01 #define VNODE_LOOKUP_NOCROSSMOUNT 0x02 #define VNODE_LOOKUP_CROSSMOUNTNOWAIT 0x04 +#define VNODE_LOOKUP_NOFOLLOW_ANY 0x08 #define VNODE_RELOAD 0x01 #define VNODE_WAIT 0x02 #define VNODE_WRITEABLE 0x04 @@ -424,7 +430,7 @@ #define WANTPARENT 0x0010 #define UIO_MAXIOV 1024 #define UIO_SMALLIOV 8 -#define EVFILT_SYSCOUNT 17 +#define EVFILT_SYSCOUNT 18 #define KEVENT_FLAG_NONE 0x000000 #define KEVENT_FLAG_IMMEDIATE 0x000001 #define KEVENT_FLAG_ERROR_EVENTS 0x000002 @@ -502,6 +508,7 @@ #define IMGPF_SPAWN 0x00000010 #define IMGPF_DISABLE_ASLR 0x00000020 #define IMGPF_ALLOW_DATA_EXEC 0x00000040 +#define IMGPF_3P_PLUGINS 0x00000080 #define IMGPF_EXEC 0x00000100 #define IMGPF_HIGH_BITS_ASLR 0x00000200 #define IMGPF_IS_64BIT_DATA 0x00000400 @@ -511,6 +518,7 @@ #define IMGPF_HW_TPRO 0x00004000 #define IMGPF_ROSETTA 0x10000000 #define IMGPF_ALT_ROSETTA 0x20000000 +#define IMGPF_RESERVED_2 0x40000000 #define IMGPF_NOJOP 0x80000000 #define IMGPF_SB_DEFAULT 0 #define IMGPF_SB_TRUE 1 @@ -559,9 +567,34 @@ #define WCONTINUED 0x00000010 #define WNOWAIT 0x00000020 #define WAIT_MYPGRP 0 +#define PRIO_DARWIN_GPU 5 +#define PRIO_DARWIN_GPU_ALLOW 0x1 +#define PRIO_DARWIN_GPU_DENY 0x2 +#define PRIO_DARWIN_ROLE 6 +#define PRIO_DARWIN_ROLE_DEFAULT 0x0 +#define PRIO_DARWIN_ROLE_UI_FOCAL 0x1 +#define PRIO_DARWIN_ROLE_UI 0x2 +#define PRIO_DARWIN_ROLE_NON_UI 0x3 +#define PRIO_DARWIN_ROLE_UI_NON_FOCAL 0x4 +#define PRIO_DARWIN_ROLE_TAL_LAUNCH 0x5 +#define PRIO_DARWIN_ROLE_DARWIN_BG 0x6 #define PRIO_DARWIN_GAME_MODE 7 +#define PRIO_DARWIN_CARPLAY_MODE 8 #define PRIO_DARWIN_GAME_MODE_OFF 0x0 #define PRIO_DARWIN_GAME_MODE_ON 0x1 +#define PRIO_DARWIN_CARPLAY_MODE_OFF 0x0 +#define PRIO_DARWIN_CARPLAY_MODE_ON 0x1 +#define IOMON_ENABLE 0x01 +#define IOMON_DISABLE 0x02 +#define IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY 1 +#define IOPOL_TYPE_VFS_ALTLINK 11 +#define IOPOL_TYPE_VFS_NOCACHE_WRITE_FS_BLKSIZE 12 +#define IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT 0 +#define IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE 1 +#define IOPOL_VFS_ALTLINK_DISABLED 0 +#define IOPOL_VFS_ALTLINK_ENABLED 1 +#define IOPOL_CMD_GET 0x00000001 +#define IOPOL_CMD_SET 0x00000002 #define IPC_CREAT 0001000 #define IPC_EXCL 0002000 #define IPC_NOWAIT 0004000 @@ -676,6 +709,7 @@ #define F_GETLEASE 107 #define F_TRANSFEREXTENTS 110 #define F_ATTRIBUTION_TAG 111 +#define F_ADDSIGS_MAIN_BINARY 113 #define FCNTL_FS_SPECIFIC_BASE 0x00010000 #define F_DUPFD_CLOEXEC 67 #define FD_CLOEXEC 1 @@ -903,6 +937,7 @@ #define MADV_FREE_REUSE 8 #define MADV_CAN_REUSE 9 #define MADV_PAGEOUT 10 +#define MADV_ZERO 11 #define MINCORE_INCORE 0x1 #define MINCORE_REFERENCED 0x2 #define MINCORE_MODIFIED 0x4 @@ -1110,6 +1145,9 @@ #define DBG_MACH_IHDLR 0x10 #define DBG_MACH_IPC 0x20 #define DBG_MACH_RESOURCE 0x25 +#define DBG_MACH_EXCLAVES 0x2A +#define DBG_MACH_EXCLAVES_SCHEDULER 0x2B +#define DBG_MACH_EPOCH_SYNC 0x2C #define DBG_MACH_VM 0x30 #define DBG_MACH_LEAKS 0x31 #define DBG_MACH_WORKINGSET 0x32 @@ -1135,6 +1173,7 @@ #define DBG_MACH_KCOV 0xAD #define DBG_MACH_MACHDEP_EXCP_SC_x86 0xAE #define DBG_MACH_MACHDEP_EXCP_SC_ARM 0xAF +#define DBG_MACH_VM_RECLAIM 0xB0 #define DBC_MACH_IO_MMIO_READ 0x1 #define DBC_MACH_IO_MMIO_WRITE 0x2 #define DBC_MACH_IO_PHYS_READ 0x3 @@ -1176,7 +1215,6 @@ #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 @@ -1228,6 +1266,7 @@ #define MACH_SCHED_WI_EXTERNAL_WAKEUP 0x61 #define MACH_SCHED_AST_CHECK 0x62 #define MACH_SCHED_PREEMPT_TIMER_ACTIVE 0x63 +#define MACH_PROCESSOR_SHUTDOWN 0x64 #define MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE 0x0 #define MACH_SCHED_CLUTCH_TG_BUCKET_STATE 0x1 #define MACH_SCHED_CLUTCH_THREAD_SELECT 0x2 @@ -1253,20 +1292,83 @@ #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 DBG_VM_VNODE_PAGEOUT 0x001 +#define DBG_VM_FAULT_INTERNAL 0x002 +#define DBG_VM_PURGEABLE_TOKEN_ADD 0x040 +#define DBG_VM_PURGEABLE_TOKEN_DELETE 0x041 +#define DBG_VM_PURGEABLE_TOKEN_RIPEN 0x042 +#define DBG_VM_PURGEABLE_OBJECT_ADD 0x048 +#define DBG_VM_PURGEABLE_OBJECT_REMOVE 0x049 +#define DBG_VM_PURGEABLE_OBJECT_PURGE 0x04a +#define DBG_VM_PURGEABLE_OBJECT_PURGE_ALL 0x04b +#define DBG_VM_PURGEABLE_OBJECT_PURGE_ONE 0x04c +#define DBG_VM_PURGEABLE_OBJECT_PURGE_LOOP 0x04e +#define DBG_VM_MAP_PARTIAL_REAP 0x054 +#define DBG_VM_MAP_WILLNEED 0x055 +#define DBG_VM_FAULT_CHECK_ZFDELAY 0x100 +#define DBG_VM_FAULT_COWDELAY 0x101 +#define DBG_VM_FAULT_ZFDELAY 0x102 +#define DBG_VM_FAULT_COMPRESSORDELAY 0x103 +#define DBG_VM_PAGEOUT_SCAN 0x104 +#define DBG_VM_PAGEOUT_BALANCE 0x105 +#define DBG_VM_PAGEOUT_FREELIST 0x106 +#define DBG_VM_PAGEOUT_PURGEONE 0x107 +#define DBG_VM_PAGEOUT_CACHE_EVICT 0x108 +#define DBG_VM_PAGEOUT_THREAD_BLOCK 0x109 +#define DBG_VM_PAGEOUT_JETSAM 0x10A +#define DBG_VM_INFO1 0x10B +#define DBG_VM_INFO2 0x10C +#define DBG_VM_INFO3 0x10D +#define DBG_VM_INFO4 0x10E +#define DBG_VM_INFO5 0x10F +#define DBG_VM_INFO6 0x110 +#define DBG_VM_INFO7 0x111 +#define DBG_VM_INFO8 0x112 +#define DBG_VM_INFO9 0x113 +#define DBG_VM_INFO10 0x114 +#define DBG_VM_UPL_PAGE_WAIT 0x120 +#define DBG_VM_IOPL_PAGE_WAIT 0x121 +#define DBG_VM_PAGE_WAIT_BLOCK 0x122 +#define DBG_VM_PAGE_SLEEP 0x123 +#define DBG_VM_PAGE_EXPEDITE 0x124 +#define DBG_VM_PAGE_EXPEDITE_NO_MEMORY 0x125 +#define DBG_VM_PAGE_GRAB 0x126 +#define DBG_VM_PAGE_RELEASE 0x127 +#define DBG_VM_COMPRESSOR_COMPACT_AND_SWAP 0x128 +#define DBG_VM_COMPRESSOR_DELAYED_COMPACT 0x129 +#define DBG_VM_OBJECT_SLEEP 0x12a +#define DBG_VM_PAGE_WAKEUP 0x12b +#define DBG_VM_PAGE_WAKEUP_DONE 0x12c +#define DBG_VM_PRESSURE_EVENT 0x130 +#define DBG_VM_EXECVE 0x131 +#define DBG_VM_WAKEUP_COMPACTOR_SWAPPER 0x132 +#define DBG_VM_UPL_REQUEST 0x133 +#define DBG_VM_IOPL_REQUEST 0x134 +#define DBG_VM_KERN_REQUEST 0x135 +#define DBG_VM_DATA_WRITE 0x140 +#define DBG_VM_PRESSURE_LEVEL_CHANGE 0x141 +#define DBG_VM_PHYS_WRITE_ACCT 0x142 +#define DBG_VM_MAP_LOOKUP_ENTRY_FAILURE 0x143 +#define VM_DISCONNECT_ALL_PAGE_MAPPINGS 0x00 +#define VM_DISCONNECT_TASK_PAGE_MAPPINGS 0x01 +#define VM_REAL_FAULT_ADDR_INTERNAL 0x02 +#define VM_REAL_FAULT_ADDR_PURGABLE 0x03 +#define VM_REAL_FAULT_ADDR_EXTERNAL 0x04 +#define VM_REAL_FAULT_ADDR_SHAREDCACHE 0x05 +#define VM_REAL_FAULT_FAST 0x06 +#define VM_REAL_FAULT_SLOW 0x07 +#define VM_MAP_LOOKUP_OBJECT 0x08 +#define DBG_ZERO_FILL_FAULT 0x01 +#define DBG_PAGEIN_FAULT 0x02 +#define DBG_COW_FAULT 0x03 +#define DBG_CACHE_HIT_FAULT 0x04 +#define DBG_NZF_PAGE_FAULT 0x05 +#define DBG_GUARD_FAULT 0x06 +#define DBG_PAGEINV_FAULT 0x07 +#define DBG_PAGEIND_FAULT 0x08 +#define DBG_COMPRESSOR_FAULT 0x09 +#define DBG_COMPRESSOR_SWAPIN_FAULT 0x0a +#define DBG_COR_FAULT 0x0b #define MACH_TASK_SUSPEND 0x0 #define MACH_TASK_RESUME 0x1 #define MACH_THREAD_SET_VOUCHER 0x2 @@ -1281,6 +1383,31 @@ #define MACH_IPC_KMSG_LINK 0xb #define MACH_IPC_PORT_ENTRY_MODIFY 0xc #define MACH_IPC_DESTROY_GUARDED_DESC 0xd +#define MACH_THREAD_SUSPEND 0xe +#define MACH_THREAD_RESUME 0xf +#define MACH_EXCLAVES_SWITCH 0x0 +#define MACH_EXCLAVES_XNUPROXY 0x1 +#define MACH_EXCLAVES_RPC 0x2 +#define MACH_EXCLAVES_UPCALL 0x3 +#define MACH_EXCLAVES_BOOT_TASK 0x4 +#define MACH_EXCLAVES_SCHEDULER_YIELD 0x0 +#define MACH_EXCLAVES_SCHEDULER_SPAWNED 0x1 +#define MACH_EXCLAVES_SCHEDULER_TERMINATED 0x2 +#define MACH_EXCLAVES_SCHEDULER_WAIT 0x3 +#define MACH_EXCLAVES_SCHEDULER_WAKE 0x4 +#define MACH_EXCLAVES_SCHEDULER_SUSPENDED 0x5 +#define MACH_EXCLAVES_SCHEDULER_RESUMED 0x6 +#define MACH_EXCLAVES_SCHEDULER_INTERRUPTED 0x7 +#define MACH_EXCLAVES_SCHEDULER_NOTHING_SCHEDULED 0x8 +#define MACH_EXCLAVES_SCHEDULER_ALL_EXCLAVES_BOOTED 0x9 +#define MACH_EXCLAVES_SCHEDULER_EARLY_ALLOC 0xa +#define MACH_EPOCH_SYNC_WAIT_STALE 0x0 +#define MACH_EPOCH_SYNC_WAIT 0x1 +#define MACH_EPOCH_SYNC_WAKE_NO_WAITERS 0x2 +#define MACH_EPOCH_SYNC_WAKE_ONE 0x3 +#define MACH_EPOCH_SYNC_WAKE_ALL 0x4 +#define MACH_EPOCH_SYNC_WAKE_ONE_WITH_OWNER 0x5 +#define MACH_EPOCH_SYNC_WAKE_THREAD 0x6 #define MACH_THREAD_GROUP_NEW 0x0 #define MACH_THREAD_GROUP_FREE 0x1 #define MACH_THREAD_GROUP_SET 0x2 @@ -1423,6 +1550,13 @@ #define HV_X86_VM_PROTECT_TRAP 0x2b #define HV_X86_VM_UNMAP_TRAP 0x2c #define HV_X86_TSC_OFFSET_SET 0x2d +#define VM_RECLAIM_UPDATE_ACCOUNTING 0x01 +#define VM_RECLAIM_ENTRIES 0x02 +#define VM_RECLAIM_CHUNK 0x03 +#define VM_RECLAIM_ENTRY 0x04 +#define VM_RECLAIM_ALL_MEMORY 0x05 +#define VM_RECLAIM_ASYNC_MEMORY 0x06 +#define VM_RECLAIM_INIT 0x07 #define DBG_NETIP 1 #define DBG_NETARP 2 #define DBG_NETUDP 3 @@ -2108,6 +2242,7 @@ #define XATTR_NOSECURITY 0x0008 #define XATTR_NODEFAULT 0x0010 #define XATTR_SHOWCOMPRESSION 0x0020 +#define XATTR_NOFOLLOW_ANY 0x0040 #define XATTR_MAXNAMELEN 127 #define PR_SLOWHZ 2 #define PRC_IFDOWN 0 @@ -2141,6 +2276,7 @@ #define CTL_FLAG_REG_SOCK_STREAM 0x4 #define CTL_DATA_NOWAKEUP 0x1 #define CTL_DATA_EOR 0x2 +#define __has_safe_buffers 0 #define __DARWIN_ONLY_64_BIT_INO_T 0 #define __DARWIN_ONLY_UNIX_CONFORMANCE 0 #define __DARWIN_ONLY_VERS_1050 0 @@ -2478,7 +2614,8 @@ #define VQ_NEARLOWDISK 0x2000 #define VQ_DESIRED_DISK 0x4000 #define VQ_FREE_SPACE_CHANGE 0x8000 -#define VQ_FLAG10000 0x10000 +#define VQ_PURGEABLE_SPACE_CHANGE 0x10000 +#define VQ_FLAG20000 0x20000 #define VFS_IOATTR_FLAGS_FUA 0x00000001 #define VFS_IOATTR_FLAGS_UNMAP 0x00000002 #define VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED 0x00000010 @@ -2509,7 +2646,7 @@ #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 CRYPTEX_AUTH_STRUCT_VERSION 2 #define EV_FD 1 #define EV_RE 1 #define EV_WR 2 @@ -2533,6 +2670,10 @@ #define KDEBUG_LEVEL_FULL 3 #define KDBG_FLAG_FILTERED 0x01 #define KDBG_FLAG_NOPROCFILT 0x02 +#define __DARWIN_LITTLE_ENDIAN 1234 +#define __DARWIN_BIG_ENDIAN 4321 +#define __DARWIN_PDP_ENDIAN 3412 +#define USE_CLANG_TYPES 0 #define __DARWIN_NULL 0 #define UBC_PUSHDIRTY 0x01 #define UBC_PUSHALL 0x02 @@ -3068,7 +3209,9 @@ #define SYS_mkfifoat 553 #define SYS_mknodat 554 #define SYS_ungraftdmg 555 -#define SYS_MAXSYSCALL 556 +#define SYS_coalition_policy_set 556 +#define SYS_coalition_policy_get 557 +#define SYS_MAXSYSCALL 558 #define SYS_invalid 63 #define SOCK_STREAM 1 #define SOCK_DGRAM 2 @@ -3116,6 +3259,7 @@ #define SO_NET_SERVICE_TYPE 0x1116 #define SO_NETSVC_MARKING_LEVEL 0x1119 #define SO_RESOLVER_SIGNATURE 0x1131 +#define SO_BINDTODEVICE 0x1134 #define NET_SERVICE_TYPE_BE 0 #define NET_SERVICE_TYPE_BK 1 #define NET_SERVICE_TYPE_SIG 2 diff --git a/pwnlib/data/includes/darwin/amd64.h b/pwnlib/data/includes/darwin/amd64.h index ee9411473..de288d6a9 100644 --- a/pwnlib/data/includes/darwin/amd64.h +++ b/pwnlib/data/includes/darwin/amd64.h @@ -87,6 +87,7 @@ #define VOL_CAP_FMT_SHARED_SPACE 0x00800000 #define VOL_CAP_FMT_VOL_GROUPS 0x01000000 #define VOL_CAP_FMT_SEALED 0x02000000 +#define VOL_CAP_FMT_CLONE_MAPPING 0x04000000 #define VOL_CAP_INT_SEARCHFS 0x00000001 #define VOL_CAP_INT_ATTRLIST 0x00000002 #define VOL_CAP_INT_NFSEXPORT 0x00000004 @@ -108,6 +109,8 @@ #define VOL_CAP_INT_RENAME_EXCL 0x00080000 #define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000 #define VOL_CAP_INT_RENAME_SECLUDE 0x00200000 +#define VOL_CAP_INT_ATTRIBUTION_TAG 0x00400000 +#define VOL_CAP_INT_PUNCHHOLE 0x00800000 #define ATTR_CMN_NAME 0x00000001 #define ATTR_CMN_DEVID 0x00000002 #define ATTR_CMN_FSID 0x00000004 @@ -292,6 +295,8 @@ #define IO_SWAP_DISPATCH 0x200000 #define IO_SKIP_ENCRYPTION 0x400000 #define IO_EVTONLY 0x800000 +#define IO_NOCACHE_SYSSPACE 0x1000000 +#define IO_NOCACHE_SWRITE 0x2000000 #define LOOKUP 0 #define CREATE 1 #define DELETE 2 @@ -346,6 +351,7 @@ #define VNODE_LOOKUP_NOFOLLOW 0x01 #define VNODE_LOOKUP_NOCROSSMOUNT 0x02 #define VNODE_LOOKUP_CROSSMOUNTNOWAIT 0x04 +#define VNODE_LOOKUP_NOFOLLOW_ANY 0x08 #define VNODE_RELOAD 0x01 #define VNODE_WAIT 0x02 #define VNODE_WRITEABLE 0x04 @@ -424,7 +430,7 @@ #define WANTPARENT 0x0010 #define UIO_MAXIOV 1024 #define UIO_SMALLIOV 8 -#define EVFILT_SYSCOUNT 17 +#define EVFILT_SYSCOUNT 18 #define KEVENT_FLAG_NONE 0x000000 #define KEVENT_FLAG_IMMEDIATE 0x000001 #define KEVENT_FLAG_ERROR_EVENTS 0x000002 @@ -502,6 +508,7 @@ #define IMGPF_SPAWN 0x00000010 #define IMGPF_DISABLE_ASLR 0x00000020 #define IMGPF_ALLOW_DATA_EXEC 0x00000040 +#define IMGPF_3P_PLUGINS 0x00000080 #define IMGPF_EXEC 0x00000100 #define IMGPF_HIGH_BITS_ASLR 0x00000200 #define IMGPF_IS_64BIT_DATA 0x00000400 @@ -511,6 +518,7 @@ #define IMGPF_HW_TPRO 0x00004000 #define IMGPF_ROSETTA 0x10000000 #define IMGPF_ALT_ROSETTA 0x20000000 +#define IMGPF_RESERVED_2 0x40000000 #define IMGPF_NOJOP 0x80000000 #define IMGPF_SB_DEFAULT 0 #define IMGPF_SB_TRUE 1 @@ -559,9 +567,34 @@ #define WCONTINUED 0x00000010 #define WNOWAIT 0x00000020 #define WAIT_MYPGRP 0 +#define PRIO_DARWIN_GPU 5 +#define PRIO_DARWIN_GPU_ALLOW 0x1 +#define PRIO_DARWIN_GPU_DENY 0x2 +#define PRIO_DARWIN_ROLE 6 +#define PRIO_DARWIN_ROLE_DEFAULT 0x0 +#define PRIO_DARWIN_ROLE_UI_FOCAL 0x1 +#define PRIO_DARWIN_ROLE_UI 0x2 +#define PRIO_DARWIN_ROLE_NON_UI 0x3 +#define PRIO_DARWIN_ROLE_UI_NON_FOCAL 0x4 +#define PRIO_DARWIN_ROLE_TAL_LAUNCH 0x5 +#define PRIO_DARWIN_ROLE_DARWIN_BG 0x6 #define PRIO_DARWIN_GAME_MODE 7 +#define PRIO_DARWIN_CARPLAY_MODE 8 #define PRIO_DARWIN_GAME_MODE_OFF 0x0 #define PRIO_DARWIN_GAME_MODE_ON 0x1 +#define PRIO_DARWIN_CARPLAY_MODE_OFF 0x0 +#define PRIO_DARWIN_CARPLAY_MODE_ON 0x1 +#define IOMON_ENABLE 0x01 +#define IOMON_DISABLE 0x02 +#define IOPOL_TYPE_VFS_HFS_CASE_SENSITIVITY 1 +#define IOPOL_TYPE_VFS_ALTLINK 11 +#define IOPOL_TYPE_VFS_NOCACHE_WRITE_FS_BLKSIZE 12 +#define IOPOL_VFS_HFS_CASE_SENSITIVITY_DEFAULT 0 +#define IOPOL_VFS_HFS_CASE_SENSITIVITY_FORCE_CASE_SENSITIVE 1 +#define IOPOL_VFS_ALTLINK_DISABLED 0 +#define IOPOL_VFS_ALTLINK_ENABLED 1 +#define IOPOL_CMD_GET 0x00000001 +#define IOPOL_CMD_SET 0x00000002 #define IPC_CREAT 0001000 #define IPC_EXCL 0002000 #define IPC_NOWAIT 0004000 @@ -676,6 +709,7 @@ #define F_GETLEASE 107 #define F_TRANSFEREXTENTS 110 #define F_ATTRIBUTION_TAG 111 +#define F_ADDSIGS_MAIN_BINARY 113 #define FCNTL_FS_SPECIFIC_BASE 0x00010000 #define F_DUPFD_CLOEXEC 67 #define FD_CLOEXEC 1 @@ -903,6 +937,7 @@ #define MADV_FREE_REUSE 8 #define MADV_CAN_REUSE 9 #define MADV_PAGEOUT 10 +#define MADV_ZERO 11 #define MINCORE_INCORE 0x1 #define MINCORE_REFERENCED 0x2 #define MINCORE_MODIFIED 0x4 @@ -1110,6 +1145,9 @@ #define DBG_MACH_IHDLR 0x10 #define DBG_MACH_IPC 0x20 #define DBG_MACH_RESOURCE 0x25 +#define DBG_MACH_EXCLAVES 0x2A +#define DBG_MACH_EXCLAVES_SCHEDULER 0x2B +#define DBG_MACH_EPOCH_SYNC 0x2C #define DBG_MACH_VM 0x30 #define DBG_MACH_LEAKS 0x31 #define DBG_MACH_WORKINGSET 0x32 @@ -1135,6 +1173,7 @@ #define DBG_MACH_KCOV 0xAD #define DBG_MACH_MACHDEP_EXCP_SC_x86 0xAE #define DBG_MACH_MACHDEP_EXCP_SC_ARM 0xAF +#define DBG_MACH_VM_RECLAIM 0xB0 #define DBC_MACH_IO_MMIO_READ 0x1 #define DBC_MACH_IO_MMIO_WRITE 0x2 #define DBC_MACH_IO_PHYS_READ 0x3 @@ -1176,7 +1215,6 @@ #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 @@ -1228,6 +1266,7 @@ #define MACH_SCHED_WI_EXTERNAL_WAKEUP 0x61 #define MACH_SCHED_AST_CHECK 0x62 #define MACH_SCHED_PREEMPT_TIMER_ACTIVE 0x63 +#define MACH_PROCESSOR_SHUTDOWN 0x64 #define MACH_SCHED_CLUTCH_ROOT_BUCKET_STATE 0x0 #define MACH_SCHED_CLUTCH_TG_BUCKET_STATE 0x1 #define MACH_SCHED_CLUTCH_THREAD_SELECT 0x2 @@ -1253,20 +1292,83 @@ #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 DBG_VM_VNODE_PAGEOUT 0x001 +#define DBG_VM_FAULT_INTERNAL 0x002 +#define DBG_VM_PURGEABLE_TOKEN_ADD 0x040 +#define DBG_VM_PURGEABLE_TOKEN_DELETE 0x041 +#define DBG_VM_PURGEABLE_TOKEN_RIPEN 0x042 +#define DBG_VM_PURGEABLE_OBJECT_ADD 0x048 +#define DBG_VM_PURGEABLE_OBJECT_REMOVE 0x049 +#define DBG_VM_PURGEABLE_OBJECT_PURGE 0x04a +#define DBG_VM_PURGEABLE_OBJECT_PURGE_ALL 0x04b +#define DBG_VM_PURGEABLE_OBJECT_PURGE_ONE 0x04c +#define DBG_VM_PURGEABLE_OBJECT_PURGE_LOOP 0x04e +#define DBG_VM_MAP_PARTIAL_REAP 0x054 +#define DBG_VM_MAP_WILLNEED 0x055 +#define DBG_VM_FAULT_CHECK_ZFDELAY 0x100 +#define DBG_VM_FAULT_COWDELAY 0x101 +#define DBG_VM_FAULT_ZFDELAY 0x102 +#define DBG_VM_FAULT_COMPRESSORDELAY 0x103 +#define DBG_VM_PAGEOUT_SCAN 0x104 +#define DBG_VM_PAGEOUT_BALANCE 0x105 +#define DBG_VM_PAGEOUT_FREELIST 0x106 +#define DBG_VM_PAGEOUT_PURGEONE 0x107 +#define DBG_VM_PAGEOUT_CACHE_EVICT 0x108 +#define DBG_VM_PAGEOUT_THREAD_BLOCK 0x109 +#define DBG_VM_PAGEOUT_JETSAM 0x10A +#define DBG_VM_INFO1 0x10B +#define DBG_VM_INFO2 0x10C +#define DBG_VM_INFO3 0x10D +#define DBG_VM_INFO4 0x10E +#define DBG_VM_INFO5 0x10F +#define DBG_VM_INFO6 0x110 +#define DBG_VM_INFO7 0x111 +#define DBG_VM_INFO8 0x112 +#define DBG_VM_INFO9 0x113 +#define DBG_VM_INFO10 0x114 +#define DBG_VM_UPL_PAGE_WAIT 0x120 +#define DBG_VM_IOPL_PAGE_WAIT 0x121 +#define DBG_VM_PAGE_WAIT_BLOCK 0x122 +#define DBG_VM_PAGE_SLEEP 0x123 +#define DBG_VM_PAGE_EXPEDITE 0x124 +#define DBG_VM_PAGE_EXPEDITE_NO_MEMORY 0x125 +#define DBG_VM_PAGE_GRAB 0x126 +#define DBG_VM_PAGE_RELEASE 0x127 +#define DBG_VM_COMPRESSOR_COMPACT_AND_SWAP 0x128 +#define DBG_VM_COMPRESSOR_DELAYED_COMPACT 0x129 +#define DBG_VM_OBJECT_SLEEP 0x12a +#define DBG_VM_PAGE_WAKEUP 0x12b +#define DBG_VM_PAGE_WAKEUP_DONE 0x12c +#define DBG_VM_PRESSURE_EVENT 0x130 +#define DBG_VM_EXECVE 0x131 +#define DBG_VM_WAKEUP_COMPACTOR_SWAPPER 0x132 +#define DBG_VM_UPL_REQUEST 0x133 +#define DBG_VM_IOPL_REQUEST 0x134 +#define DBG_VM_KERN_REQUEST 0x135 +#define DBG_VM_DATA_WRITE 0x140 +#define DBG_VM_PRESSURE_LEVEL_CHANGE 0x141 +#define DBG_VM_PHYS_WRITE_ACCT 0x142 +#define DBG_VM_MAP_LOOKUP_ENTRY_FAILURE 0x143 +#define VM_DISCONNECT_ALL_PAGE_MAPPINGS 0x00 +#define VM_DISCONNECT_TASK_PAGE_MAPPINGS 0x01 +#define VM_REAL_FAULT_ADDR_INTERNAL 0x02 +#define VM_REAL_FAULT_ADDR_PURGABLE 0x03 +#define VM_REAL_FAULT_ADDR_EXTERNAL 0x04 +#define VM_REAL_FAULT_ADDR_SHAREDCACHE 0x05 +#define VM_REAL_FAULT_FAST 0x06 +#define VM_REAL_FAULT_SLOW 0x07 +#define VM_MAP_LOOKUP_OBJECT 0x08 +#define DBG_ZERO_FILL_FAULT 0x01 +#define DBG_PAGEIN_FAULT 0x02 +#define DBG_COW_FAULT 0x03 +#define DBG_CACHE_HIT_FAULT 0x04 +#define DBG_NZF_PAGE_FAULT 0x05 +#define DBG_GUARD_FAULT 0x06 +#define DBG_PAGEINV_FAULT 0x07 +#define DBG_PAGEIND_FAULT 0x08 +#define DBG_COMPRESSOR_FAULT 0x09 +#define DBG_COMPRESSOR_SWAPIN_FAULT 0x0a +#define DBG_COR_FAULT 0x0b #define MACH_TASK_SUSPEND 0x0 #define MACH_TASK_RESUME 0x1 #define MACH_THREAD_SET_VOUCHER 0x2 @@ -1281,6 +1383,31 @@ #define MACH_IPC_KMSG_LINK 0xb #define MACH_IPC_PORT_ENTRY_MODIFY 0xc #define MACH_IPC_DESTROY_GUARDED_DESC 0xd +#define MACH_THREAD_SUSPEND 0xe +#define MACH_THREAD_RESUME 0xf +#define MACH_EXCLAVES_SWITCH 0x0 +#define MACH_EXCLAVES_XNUPROXY 0x1 +#define MACH_EXCLAVES_RPC 0x2 +#define MACH_EXCLAVES_UPCALL 0x3 +#define MACH_EXCLAVES_BOOT_TASK 0x4 +#define MACH_EXCLAVES_SCHEDULER_YIELD 0x0 +#define MACH_EXCLAVES_SCHEDULER_SPAWNED 0x1 +#define MACH_EXCLAVES_SCHEDULER_TERMINATED 0x2 +#define MACH_EXCLAVES_SCHEDULER_WAIT 0x3 +#define MACH_EXCLAVES_SCHEDULER_WAKE 0x4 +#define MACH_EXCLAVES_SCHEDULER_SUSPENDED 0x5 +#define MACH_EXCLAVES_SCHEDULER_RESUMED 0x6 +#define MACH_EXCLAVES_SCHEDULER_INTERRUPTED 0x7 +#define MACH_EXCLAVES_SCHEDULER_NOTHING_SCHEDULED 0x8 +#define MACH_EXCLAVES_SCHEDULER_ALL_EXCLAVES_BOOTED 0x9 +#define MACH_EXCLAVES_SCHEDULER_EARLY_ALLOC 0xa +#define MACH_EPOCH_SYNC_WAIT_STALE 0x0 +#define MACH_EPOCH_SYNC_WAIT 0x1 +#define MACH_EPOCH_SYNC_WAKE_NO_WAITERS 0x2 +#define MACH_EPOCH_SYNC_WAKE_ONE 0x3 +#define MACH_EPOCH_SYNC_WAKE_ALL 0x4 +#define MACH_EPOCH_SYNC_WAKE_ONE_WITH_OWNER 0x5 +#define MACH_EPOCH_SYNC_WAKE_THREAD 0x6 #define MACH_THREAD_GROUP_NEW 0x0 #define MACH_THREAD_GROUP_FREE 0x1 #define MACH_THREAD_GROUP_SET 0x2 @@ -1423,6 +1550,13 @@ #define HV_X86_VM_PROTECT_TRAP 0x2b #define HV_X86_VM_UNMAP_TRAP 0x2c #define HV_X86_TSC_OFFSET_SET 0x2d +#define VM_RECLAIM_UPDATE_ACCOUNTING 0x01 +#define VM_RECLAIM_ENTRIES 0x02 +#define VM_RECLAIM_CHUNK 0x03 +#define VM_RECLAIM_ENTRY 0x04 +#define VM_RECLAIM_ALL_MEMORY 0x05 +#define VM_RECLAIM_ASYNC_MEMORY 0x06 +#define VM_RECLAIM_INIT 0x07 #define DBG_NETIP 1 #define DBG_NETARP 2 #define DBG_NETUDP 3 @@ -2108,6 +2242,7 @@ #define XATTR_NOSECURITY 0x0008 #define XATTR_NODEFAULT 0x0010 #define XATTR_SHOWCOMPRESSION 0x0020 +#define XATTR_NOFOLLOW_ANY 0x0040 #define XATTR_MAXNAMELEN 127 #define PR_SLOWHZ 2 #define PRC_IFDOWN 0 @@ -2141,6 +2276,7 @@ #define CTL_FLAG_REG_SOCK_STREAM 0x4 #define CTL_DATA_NOWAKEUP 0x1 #define CTL_DATA_EOR 0x2 +#define __has_safe_buffers 0 #define __DARWIN_ONLY_64_BIT_INO_T 0 #define __DARWIN_ONLY_UNIX_CONFORMANCE 0 #define __DARWIN_ONLY_VERS_1050 0 @@ -2478,7 +2614,8 @@ #define VQ_NEARLOWDISK 0x2000 #define VQ_DESIRED_DISK 0x4000 #define VQ_FREE_SPACE_CHANGE 0x8000 -#define VQ_FLAG10000 0x10000 +#define VQ_PURGEABLE_SPACE_CHANGE 0x10000 +#define VQ_FLAG20000 0x20000 #define VFS_IOATTR_FLAGS_FUA 0x00000001 #define VFS_IOATTR_FLAGS_UNMAP 0x00000002 #define VFS_IOATTR_FLAGS_SWAPPIN_SUPPORTED 0x00000010 @@ -2509,7 +2646,7 @@ #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 CRYPTEX_AUTH_STRUCT_VERSION 2 #define EV_FD 1 #define EV_RE 1 #define EV_WR 2 @@ -2533,6 +2670,10 @@ #define KDEBUG_LEVEL_FULL 3 #define KDBG_FLAG_FILTERED 0x01 #define KDBG_FLAG_NOPROCFILT 0x02 +#define __DARWIN_LITTLE_ENDIAN 1234 +#define __DARWIN_BIG_ENDIAN 4321 +#define __DARWIN_PDP_ENDIAN 3412 +#define USE_CLANG_TYPES 0 #define __DARWIN_NULL 0 #define UBC_PUSHDIRTY 0x01 #define UBC_PUSHALL 0x02 @@ -3068,7 +3209,9 @@ #define SYS_mkfifoat 553 + 0x2000000 #define SYS_mknodat 554 + 0x2000000 #define SYS_ungraftdmg 555 + 0x2000000 -#define SYS_MAXSYSCALL 556 + 0x2000000 +#define SYS_coalition_policy_set 556 + 0x2000000 +#define SYS_coalition_policy_get 557 + 0x2000000 +#define SYS_MAXSYSCALL 558 + 0x2000000 #define SYS_invalid 63 + 0x2000000 #define SOCK_STREAM 1 #define SOCK_DGRAM 2 @@ -3116,6 +3259,7 @@ #define SO_NET_SERVICE_TYPE 0x1116 #define SO_NETSVC_MARKING_LEVEL 0x1119 #define SO_RESOLVER_SIGNATURE 0x1131 +#define SO_BINDTODEVICE 0x1134 #define NET_SERVICE_TYPE_BE 0 #define NET_SERVICE_TYPE_BK 1 #define NET_SERVICE_TYPE_SIG 2 diff --git a/pwnlib/data/includes/generator/linux/diet/loongarch64/syscalls.h b/pwnlib/data/includes/generator/linux/diet/loongarch64/syscalls.h new file mode 100644 index 000000000..2afb4ea16 --- /dev/null +++ b/pwnlib/data/includes/generator/linux/diet/loongarch64/syscalls.h @@ -0,0 +1,316 @@ +#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 __NR3264_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 __NR3264_statfs 43 +#define __NR3264_fstatfs 44 +#define __NR3264_truncate 45 +#define __NR3264_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 __NR3264_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 __NR3264_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_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_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 __NR3264_mmap 222 +#define __NR3264_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_quotactl_fd 443 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 +#define __NR_map_shadow_stack 453 +#define __NR_futex_wake 454 +#define __NR_futex_wait 455 +#define __NR_futex_requeue 456 +#define __NR_fcntl __NR3264_fcntl +#define __NR_statfs __NR3264_statfs +#define __NR_fstatfs __NR3264_fstatfs +#define __NR_truncate __NR3264_truncate +#define __NR_ftruncate __NR3264_ftruncate +#define __NR_lseek __NR3264_lseek +#define __NR_sendfile __NR3264_sendfile +#define __NR_mmap __NR3264_mmap +#define __NR_fadvise64 __NR3264_fadvise64 diff --git a/pwnlib/data/includes/generator/linux/loongarch64.h b/pwnlib/data/includes/generator/linux/loongarch64.h new file mode 100644 index 000000000..e252eeb12 --- /dev/null +++ b/pwnlib/data/includes/generator/linux/loongarch64.h @@ -0,0 +1,4 @@ +// https://git.musl-libc.org/cgit/musl/plain/arch/loongarch64/bits/syscall.h.in +#define __loongarch64 +#include +#include diff --git a/pwnlib/data/includes/generator/linux/syscall_map.h b/pwnlib/data/includes/generator/linux/syscall_map.h index ec8bd658f..cd0276f3c 100644 --- a/pwnlib/data/includes/generator/linux/syscall_map.h +++ b/pwnlib/data/includes/generator/linux/syscall_map.h @@ -23,6 +23,7 @@ #define SYS_brk __NR_brk #define SYS_cachectl __NR_cachectl #define SYS_cacheflush __NR_cacheflush +#define SYS_cachestat __NR_cachestat #define SYS_capget __NR_capget #define SYS_capset __NR_capset #define SYS_chdir __NR_chdir @@ -80,6 +81,7 @@ #define SYS_fchdir __NR_fchdir #define SYS_fchmod __NR_fchmod #define SYS_fchmodat __NR_fchmodat +#define SYS_fchmodat2 __NR_fchmodat2 #define SYS_fchown __NR_fchown #define SYS_fchown32 __NR_fchown32 #define SYS_fchownat __NR_fchownat @@ -109,7 +111,11 @@ #define SYS_ftruncate __NR_ftruncate #define SYS_ftruncate64 __NR_ftruncate64 #define SYS_futex __NR_futex +#define SYS_futex_requeue __NR_futex_requeue #define SYS_futex_time64 __NR_futex_time64 +#define SYS_futex_wait __NR_futex_wait +#define SYS_futex_waitv __NR_futex_waitv +#define SYS_futex_wake __NR_futex_wake #define SYS_futimesat __NR_futimesat #define SYS_getcpu __NR_getcpu #define SYS_getcwd __NR_getcwd @@ -217,6 +223,7 @@ #define SYS_lstat64 __NR_lstat64 #define SYS_madvise __NR_madvise #define SYS_madvise1 __NR_madvise1 +#define SYS_map_shadow_stack __NR_map_shadow_stack #define SYS_mbind __NR_mbind #define SYS_membarrier __NR_membarrier #define SYS_memfd_create __NR_memfd_create @@ -410,6 +417,7 @@ #define SYS_preadv2 __NR_preadv2 #define SYS_prlimit64 __NR_prlimit64 #define SYS_process_madvise __NR_process_madvise +#define SYS_process_mrelease __NR_process_mrelease #define SYS_process_vm_readv __NR_process_vm_readv #define SYS_process_vm_writev __NR_process_vm_writev #define SYS_prof __NR_prof @@ -425,6 +433,7 @@ #define SYS_pwritev2 __NR_pwritev2 #define SYS_query_module __NR_query_module #define SYS_quotactl __NR_quotactl +#define SYS_quotactl_fd __NR_quotactl_fd #define SYS_read __NR_read #define SYS_readahead __NR_readahead #define SYS_readdir __NR_readdir @@ -506,6 +515,7 @@ #define SYS_sethostname __NR_sethostname #define SYS_setitimer __NR_setitimer #define SYS_set_mempolicy __NR_set_mempolicy +#define SYS_set_mempolicy_home_node __NR_set_mempolicy_home_node #define SYS_setns __NR_setns #define SYS_setpgid __NR_setpgid #define SYS_setpgrp __NR_setpgrp diff --git a/pwnlib/data/includes/linux/loongarch64.h b/pwnlib/data/includes/linux/loongarch64.h new file mode 100644 index 000000000..c4aef8a95 --- /dev/null +++ b/pwnlib/data/includes/linux/loongarch64.h @@ -0,0 +1,1322 @@ +#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 __NR3264_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 __NR3264_statfs 43 +#define __NR3264_fstatfs 44 +#define __NR3264_truncate 45 +#define __NR3264_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 __NR3264_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 __NR3264_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_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_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 __NR3264_mmap 222 +#define __NR3264_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_quotactl_fd 443 +#define __NR_landlock_create_ruleset 444 +#define __NR_landlock_add_rule 445 +#define __NR_landlock_restrict_self 446 +#define __NR_process_mrelease 448 +#define __NR_futex_waitv 449 +#define __NR_set_mempolicy_home_node 450 +#define __NR_cachestat 451 +#define __NR_fchmodat2 452 +#define __NR_map_shadow_stack 453 +#define __NR_futex_wake 454 +#define __NR_futex_wait 455 +#define __NR_futex_requeue 456 +#define __NR_fcntl 25 +#define __NR_statfs 43 +#define __NR_fstatfs 44 +#define __NR_truncate 45 +#define __NR_ftruncate 46 +#define __NR_lseek 62 +#define __NR_sendfile 71 +#define __NR_mmap 222 +#define __NR_fadvise64 223 +#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_cachestat 451 +#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_fchmodat2 452 +#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_fstatfs 44 +#define SYS_fsync 82 +#define SYS_ftruncate 46 +#define SYS_futex 98 +#define SYS_futex_requeue 456 +#define SYS_futex_wait 455 +#define SYS_futex_waitv 449 +#define SYS_futex_wake 454 +#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_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_map_shadow_stack 453 +#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_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_mrelease 448 +#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_quotactl_fd 443 +#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_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_set_mempolicy_home_node 450 +#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_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_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/data/syscalls/Makefile b/pwnlib/data/syscalls/Makefile index e80f50c2b..22aabfd9a 100644 --- a/pwnlib/data/syscalls/Makefile +++ b/pwnlib/data/syscalls/Makefile @@ -1,5 +1,4 @@ ROOT=$(shell git rev-parse --show-toplevel) -TEMPLATE_DIR="$ROOT/pwnlib/shellcraft/templates/common/linux/syscalls" all: generate.py functions.py python generate.py "$(ROOT)/pwnlib/shellcraft/templates/common/linux/syscalls" @@ -8,6 +7,6 @@ functions.py: wget https://raw.githubusercontent.com/zachriggle/functions/master/functions.py generate_darwin: - python generate_darwin.py "$(ROOT)" + python3 generate_darwin.py "$(ROOT)" .phony: all diff --git a/pwnlib/data/syscalls/generate.py b/pwnlib/data/syscalls/generate.py index 4ddfdc5a2..9a3af4910 100644 --- a/pwnlib/data/syscalls/generate.py +++ b/pwnlib/data/syscalls/generate.py @@ -10,15 +10,15 @@ # github.com/zachriggle/functions from functions import functions, Function, Argument -ARCHITECTURES = ['i386', 'amd64', 'arm', 'aarch64', 'mips'] +ARCHITECTURES = ['i386', 'amd64', 'arm', 'aarch64', 'mips', 'riscv64', 'powerpc64'] HEADER = ''' <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> ''' @@ -40,7 +40,7 @@ <%page args="{arguments_default_values}"/> """ -CALL = """ +CALL = r""" <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -76,8 +76,8 @@ # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -112,7 +112,7 @@ %> /* {name}(${{', '.join(syscall_repr)}}) */ %for name, arg in string_arguments.items(): - ${{pwnlib.shellcraft.pushstr(arg, append_null=(b'\\x00' not in arg))}} + ${{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(): diff --git a/pwnlib/data/syscalls/generate_darwin.py b/pwnlib/data/syscalls/generate_darwin.py index 96c3572b0..870efda25 100644 --- a/pwnlib/data/syscalls/generate_darwin.py +++ b/pwnlib/data/syscalls/generate_darwin.py @@ -1,16 +1,16 @@ - # ./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) +# https://github.com/joseluisq/macosx-sdks (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/') +# In the future, you should change the version of `MacOSX15.sdk` +sdk_path = Path('/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/') if not sdk_path.exists(): print('missing MacOSX sdk') exit(1) diff --git a/pwnlib/dynelf.py b/pwnlib/dynelf.py index 5c3948937..e22cf3082 100644 --- a/pwnlib/dynelf.py +++ b/pwnlib/dynelf.py @@ -652,7 +652,7 @@ def _dynamic_load_dynelf(self, libname): break if name: - self.status('Skipping %s' % name) + self.status('Skipping %r' % name) cur = leak.field(cur, LinkMap.l_next) else: diff --git a/pwnlib/elf/corefile.py b/pwnlib/elf/corefile.py index f092153c1..b82dc57e0 100644 --- a/pwnlib/elf/corefile.py +++ b/pwnlib/elf/corefile.py @@ -238,8 +238,8 @@ class Corefile(ELF): Registers can be accessed directly, e.g. via ``core_obj.eax`` and enumerated via :data:`Corefile.registers`. - Memory can be accessed directly via :meth:`.read` or :meth:`.write`, and also - via :meth:`.pack` or :meth:`.unpack` or even :meth:`.string`. + Memory can be accessed directly via :meth:`pwnlib.elf.elf.ELF.read` or :meth:`pwnlib.elf.elf.ELF.write`, and also + via :meth:`pwnlib.elf.elf.ELF.pack` or :meth:`pwnlib.elf.elf.ELF.unpack` or even :meth:`.string`. Arguments: core: Path to the core file. Alternately, may be a :class:`.process` instance, @@ -376,8 +376,8 @@ class Corefile(ELF): >>> core.exe.data[0:4] b'\x7fELF' - It also supports all of the features of :class:`ELF`, so you can :meth:`.read` - or :meth:`.write` or even the helpers like :meth:`.pack` or :meth:`.unpack`. + It also supports all of the features of :class:`ELF`, so you can :meth:`pwnlib.elf.elf.ELF.read` + or :meth:`pwnlib.elf.elf.ELF.write` or even the helpers like :meth:`pwnlib.elf.elf.ELF.pack` or :meth:`pwnlib.elf.elf.ELF.unpack`. Don't forget to call :meth:`.ELF.save` to save the changes to disk. diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index acb0a2d7a..df8661e45 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -41,17 +41,17 @@ import mmap import os import re -import six import subprocess import tempfile -from six import BytesIO +from io import BytesIO from collections import namedtuple, defaultdict from elftools.elf.constants import P_FLAGS from elftools.elf.constants import SHN_INDICES from elftools.elf.descriptions import describe_e_type +from elftools.elf.dynamic import DynamicSection from elftools.elf.elffile import ELFFile from elftools.elf.enums import ENUM_GNU_PROPERTY_X86_FEATURE_1_FLAGS from elftools.elf.gnuversions import GNUVerDefSection @@ -265,7 +265,7 @@ def __init__(self, path, checksec=True): #: #: See: :attr:`.ContextType.arch` self.arch = self.get_machine_arch() - if isinstance(self.arch, (bytes, six.text_type)): + if isinstance(self.arch, (bytes, str)): self.arch = self.arch.lower() self._sections = None @@ -358,12 +358,21 @@ def __init__(self, path, checksec=True): self._populate_functions() self._populate_kernel_version() + self._print_checksec = checksec if checksec: self._describe() self._libs = None self._maps = None + def close(self): + """close() -> None + + Close the ELF file and release all resources associated with it. + """ + super(ELF, self).close() + self.file.close() + @staticmethod @LocalContext def from_assembly(assembly, *a, **kw): @@ -474,6 +483,7 @@ def get_machine_arch(self): ('EM_IA_64', 64): 'ia64', ('EM_RISCV', 32): 'riscv32', ('EM_RISCV', 64): 'riscv64', + ('EM_LOONGARCH', 64): 'loongarch64', }.get((self['e_machine'], self.bits), self['e_machine']) @property @@ -513,7 +523,7 @@ def iter_segments_by_type(self, t): 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 @@ -534,7 +544,7 @@ def iter_properties(self): 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 @@ -705,14 +715,14 @@ def non_writable_segments(self): @property def libs(self): - """Dictionary of {path: address} for every library loaded for this ELF.""" + """Dictionary of ``{path: address}`` for every library loaded for this ELF.""" if self._libs is None: self._populate_libraries() return self._libs @property def maps(self): - """Dictionary of {name: address} for every mapping in this ELF's address space.""" + """Dictionary of ``{name: address}`` for every mapping in this ELF's address space.""" if self._maps is None: self._populate_libraries() return self._maps @@ -722,12 +732,13 @@ def libc(self): """:class:`.ELF`: If this :class:`.ELF` imports any libraries which contain ``'libc[.-]``, and we can determine the appropriate path to it on the local system, returns a new :class:`.ELF` object pertaining to that library. + Prints the `checksec` output of the library if it was printed for the original ELF too. If not found, the value will be :const:`None`. """ for lib in self.libs: if '/libc.' in lib or '/libc-' in lib: - return ELF(lib) + return ELF(lib, self._print_checksec) def _populate_libraries(self): """ @@ -1597,7 +1608,7 @@ def dynamic_by_tag(self, tag): dt = None dynamic = self.get_section_by_name('.dynamic') - if not dynamic: + if not dynamic or not isinstance(dynamic, DynamicSection): return None try: @@ -1725,7 +1736,7 @@ def nx(self): Unfortunately, :class:`ELF` is not context-aware, so it's not always possible to determine whether the process of a binary that's missing ``PT_GNU_STACK`` will have NX or not. - + The rules are as follows: +-----------+--------------+---------------------------+------------------------------------------------+----------+ @@ -1880,7 +1891,7 @@ def nx(self): /* stripped */ # define elf_read_implies_exec(ex, exec_stk) (is_32bit_task() ? \\ (exec_stk == EXSTACK_DEFAULT) : 0) - #else + #else # define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT) #endif /* __powerpc64__ */ @@ -1908,7 +1919,7 @@ def nx(self): """ if not self.executable: return True - + exec_bit = None for seg in self.iter_segments_by_type('GNU_STACK'): exec_bit = bool(seg.header.p_flags & P_FLAGS.PF_X) @@ -1985,7 +1996,7 @@ def execstack(self): # If the ``PT_GNU_STACK`` program header is preset, use it's premissions. for seg in self.iter_segments_by_type('GNU_STACK'): return bool(seg.header.p_flags & P_FLAGS.PF_X) - + # If the ``PT_GNU_STACK`` program header is missing, then use the # default rules. Out of the supported architectures, only AArch64, # IA-64, and RISC-V get a non-executable stack by default. @@ -2113,16 +2124,16 @@ def checksec(self, banner=True, color=True): if self.ubsan: res.append("UBSAN:".ljust(12) + green("Enabled")) - + if self.shadowstack: res.append("SHSTK:".ljust(12) + green("Enabled")) - + if self.ibt: 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")) @@ -2182,10 +2193,10 @@ 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 + """:class:`bool`: Whether the current binary was built with Shadow Stack (``SHSTK``)""" if self.arch not in ['i386', 'amd64']: return False @@ -2337,10 +2348,10 @@ def disable_nx(self): return log.error("Could not find PT_GNU_STACK, stack should already be executable") - + @staticmethod def set_runpath(exepath, runpath): - r"""set_runpath(str, str) -> ELF + r"""set_runpath(exepath, runpath) -> ELF Patches the RUNPATH of the ELF to the given path using the `patchelf utility `_. @@ -2375,7 +2386,7 @@ def set_runpath(exepath, runpath): @staticmethod def set_interpreter(exepath, interpreter_path): - r"""set_interpreter(str, str) -> ELF + r"""set_interpreter(exepath, interpreter_path) -> ELF Patches the interpreter of the ELF to the given binary using the `patchelf utility `_. @@ -2409,7 +2420,7 @@ def set_interpreter(exepath, interpreter_path): @staticmethod def patch_custom_libraries(exe_path, custom_library_path, create_copy=True, suffix='_remotelibc'): - r"""patch_custom_libraries(str, str, bool, str) -> ELF + r"""patch_custom_libraries(exe_path, custom_library_path, create_copy=True, suffix='_remotelibc') -> ELF Looks for the interpreter binary in the given path and patches the binary to use it if available. Also patches the RUNPATH to the given path using the `patchelf utility `_. @@ -2439,7 +2450,7 @@ def patch_custom_libraries(exe_path, custom_library_path, create_copy=True, suff if not which('patchelf'): log.error('"patchelf" tool not installed. See https://github.com/NixOS/patchelf') return None - + # Create a copy of the ELF to patch instead of the original file. if create_copy: import shutil diff --git a/pwnlib/elf/plt.py b/pwnlib/elf/plt.py index 70846177f..8b64db976 100644 --- a/pwnlib/elf/plt.py +++ b/pwnlib/elf/plt.py @@ -93,6 +93,7 @@ def prepare_unicorn_and_context(elf, got, address, data): 'thumb': U.UC_ARCH_ARM, 'riscv32': U.UC_ARCH_RISCV, 'riscv64': U.UC_ARCH_RISCV, + # 'loongarch64': U.UC_ARCH_LOONGARCH, <-- Not actually supported }.get(elf.arch, None) if arch is None: diff --git a/pwnlib/encoders/i386/ascii_shellcode.py b/pwnlib/encoders/i386/ascii_shellcode.py index 993cfbb1d..7071d30ff 100644 --- a/pwnlib/encoders/i386/ascii_shellcode.py +++ b/pwnlib/encoders/i386/ascii_shellcode.py @@ -6,8 +6,6 @@ from itertools import product -import six - from pwnlib.context import LocalContext from pwnlib.context import context from pwnlib.encoders.encoder import Encoder @@ -43,10 +41,7 @@ def __init__(self, slop=20, max_subs=4): there are, the bigger the packed shellcode will be. Defaults to 4. """ - if six.PY2: - super(AsciiShellcodeEncoder, self).__init__() - elif six.PY3: - super().__init__() + super().__init__() self.slop = slop self.max_subs = max_subs diff --git a/pwnlib/encoders/i386/delta.py b/pwnlib/encoders/i386/delta.py index e3d272917..14d408bd4 100644 --- a/pwnlib/encoders/i386/delta.py +++ b/pwnlib/encoders/i386/delta.py @@ -1,7 +1,6 @@ from __future__ import absolute_import from __future__ import division -import six import collections from random import choice from random import randint @@ -59,7 +58,7 @@ def __call__(self, raw_bytes, avoid, pcreg=''): table = collections.defaultdict(lambda: []) endchar = bytearray() - not_bad = lambda x: six.int2byte(x) not in avoid + not_bad = lambda x: x not in avoid not_bad_or_term = lambda x: not_bad(x) and x != self.terminator for i in filter(not_bad_or_term, range(0, 256)): diff --git a/pwnlib/encoders/mips/xor.py b/pwnlib/encoders/mips/xor.py index bd2fcbc83..9bb4bf6f0 100644 --- a/pwnlib/encoders/mips/xor.py +++ b/pwnlib/encoders/mips/xor.py @@ -25,7 +25,6 @@ from __future__ import absolute_import from __future__ import division -import six from pwnlib import asm from pwnlib import shellcraft from pwnlib.context import context @@ -128,8 +127,8 @@ def __call__(self, raw_bytes, avoid, pcreg=''): sizehi = size >> 8 decoder = decoders[context.endian] - decoder = decoder.replace(b'SIZ1', six.int2byte(sizehi)) - decoder = decoder.replace(b'SIZ2', six.int2byte(sizelo)) + decoder = decoder.replace(b'SIZ1', bytes([sizehi])) + decoder = decoder.replace(b'SIZ2', bytes([sizelo])) key, data = xor_key(raw_bytes, avoid=avoid) diff --git a/pwnlib/filepointer.py b/pwnlib/filepointer.py index 8b05781e3..d92fa72d9 100644 --- a/pwnlib/filepointer.py +++ b/pwnlib/filepointer.py @@ -27,7 +27,6 @@ from pwnlib.context import context from pwnlib.log import getLogger -from pwnlib.util.misc import python_2_bytes_compatible from pwnlib.util.packing import pack log = getLogger(__name__) @@ -98,7 +97,6 @@ def update_var(l): return var -@python_2_bytes_compatible class FileStructure(object): r""" Crafts a FILE structure, with default values for some fields, like _lock which should point to null ideally, set. diff --git a/pwnlib/filesystem/path.py b/pwnlib/filesystem/path.py index 032bf77c6..40c04fc9a 100644 --- a/pwnlib/filesystem/path.py +++ b/pwnlib/filesystem/path.py @@ -1,10 +1,6 @@ -import six import tempfile -if six.PY3: - from pathlib import * -else: - from pathlib2 import * +from pathlib import * @classmethod def mktemp(cls): diff --git a/pwnlib/filesystem/ssh.py b/pwnlib/filesystem/ssh.py index 6cf6626b6..49a91d0fd 100644 --- a/pwnlib/filesystem/ssh.py +++ b/pwnlib/filesystem/ssh.py @@ -5,7 +5,6 @@ Emulates pathlib as much as possible, but does so through duck typing. """ import os -import six import sys import tempfile import time @@ -14,10 +13,7 @@ from pwnlib.util.misc import read, write from pwnlib.util.packing import _encode, _decode -if six.PY3: - from pathlib import * -else: - from pathlib2 import * +from pathlib import * class SSHPath(PosixPath): r"""Represents a file that exists on a remote filesystem. @@ -81,13 +77,8 @@ def _s(self, other): if isinstance(other, str): return other - # We don't want unicode - if isinstance(other, six.text_type): - return str(other) - - # We also don't want binary - if isinstance(other, six.binary_type): - return str(_decode(other)) + # We don't want binary + return _decode(other) def _new(self, path, *a, **kw): kw['ssh'] = self.ssh @@ -399,14 +390,9 @@ def resolve(self, strict=False): path = self.absolute().path path = os.path.normpath(path) - if six.PY2: - error_type = IOError - else: - error_type = FileNotFoundError - try: return self._new(self.ssh.sftp.normalize(path)) - except error_type as e: + except FileNotFoundError as e: raise ValueError("Could not normalize path: %r" % path) def stat(self): diff --git a/pwnlib/fmtstr.py b/pwnlib/fmtstr.py index 2b8508806..85e59d1d0 100644 --- a/pwnlib/fmtstr.py +++ b/pwnlib/fmtstr.py @@ -33,6 +33,9 @@ We can automate the exploitation of the process like so: +.. doctest:: + :options: +POSIX +TODO + >>> program = pwnlib.data.elf.fmtstr.get('i386') >>> def exec_fmt(payload): ... p = process(program) @@ -95,7 +98,6 @@ def send_payload(payload): import logging import re from operator import itemgetter -from six.moves import range from sortedcontainers import SortedList from pwnlib.log import getLogger @@ -841,6 +843,12 @@ def fmtstr_payload(offset, writes, numbwritten=0, write_size='byte', write_size_ The overflows argument is a format-string-length to output-amount tradeoff: Larger values for ``overflows`` produce shorter format strings that generate more output at runtime. + The writes argument is a dictionary with address/value pairs like ``{addr: value, addr2: value2}``. + If the value is an ``int`` datatype, it will be automatically casted into a bytestring with the length of a ``long`` (8 bytes in 64-bit, 4 bytes in 32-bit). + If a specific number of bytes is intended to be written (such as only a single byte, single short, or single int and not an entire long), + then provide a bytestring like ``b'\x37\x13'`` or ``p16(0x1337)``. + Note that the ``write_size`` argument does not determine **total** bytes written, only the size of each consecutive write. + Arguments: offset(int): the first formatter's offset you control writes(dict): dict with addr, value ``{addr: value, addr2: value2}`` @@ -857,6 +865,8 @@ def fmtstr_payload(offset, writes, numbwritten=0, write_size='byte', write_size_ >>> context.clear(arch = 'amd64') >>> fmtstr_payload(1, {0x0: 0x1337babe}, write_size='int') b'%322419390c%4$llnaaaabaa\x00\x00\x00\x00\x00\x00\x00\x00' + >>> fmtstr_payload(1, {0x0: p32(0x1337babe)}, write_size='int') + b'%322419390c%3$na\x00\x00\x00\x00\x00\x00\x00\x00' >>> fmtstr_payload(1, {0x0: 0x1337babe}, write_size='short') b'%47806c%5$lln%22649c%6$hnaaaabaa\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00' >>> fmtstr_payload(1, {0x0: 0x1337babe}, write_size='byte') @@ -872,6 +882,8 @@ def fmtstr_payload(offset, writes, numbwritten=0, write_size='byte', write_size_ b'%19c%12$hhn%36c%13$hhn%131c%14$hhn%4c%15$hhn\x03\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00' >>> fmtstr_payload(1, {0x0: 0x00000001}, write_size='byte') b'c%3$naaa\x00\x00\x00\x00' + >>> fmtstr_payload(1, {0x0: b'\x01'}, write_size='byte') + b'c%3$hhna\x00\x00\x00\x00' >>> fmtstr_payload(1, {0x0: b"\xff\xff\x04\x11\x00\x00\x00\x00"}, write_size='short') b'%327679c%7$lln%18c%8$hhn\x00\x00\x00\x00\x03\x00\x00\x00' >>> fmtstr_payload(10, {0x404048 : 0xbadc0ffe, 0x40403c : 0xdeadbeef}, no_dollars=True) @@ -999,7 +1011,7 @@ def write(self, addr, data): Arguments: addr(int): the address where you want to write - data(int): the data that you want to write ``addr`` + data(int or bytes): the data that you want to write ``addr`` Returns: None @@ -1013,6 +1025,10 @@ def write(self, addr, data): >>> f.write(0x08040506, 0x1337babe) >>> f.execute_writes() b'%19c%16$hhn%36c%17$hhn%131c%18$hhn%4c%19$hhn\t\x05\x04\x08\x08\x05\x04\x08\x07\x05\x04\x08\x06\x05\x04\x08' + >>> f2 = FmtStr(send_fmt_payload, offset=5) + >>> f2.write(0x08040506, p16(0x1337)) + >>> f2.execute_writes() + b'%19c%11$hhn%36c%12$hhnaa\x07\x05\x04\x08\x06\x05\x04\x08' """ self.writes[addr] = data diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 690e360a4..d35920c7b 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -146,8 +146,6 @@ import psutil import random import re -import six -import six.moves import socket import tempfile from threading import Event @@ -233,7 +231,7 @@ def debug_shellcode(data, gdbscript=None, vma=None, api=False): >>> io.recvline() b'Hello world!\n' """ - if isinstance(data, six.text_type): + if isinstance(data, str): log.error("Shellcode is cannot be unicode. Did you mean debug_assembly?") tmp_elf = make_elf(data, extract=False, vma=vma) os.chmod(tmp_elf, 0o777) @@ -250,7 +248,7 @@ def debug_shellcode(data, gdbscript=None, vma=None, api=False): def _execve_script(argv, executable, env, ssh): """_execve_script(argv, executable, env, ssh) -> str - Returns the filename of a python script that calls + 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. @@ -281,7 +279,7 @@ def _execve_script(argv, executable, env, ssh): log.debug("Created execve wrapper script %s:\n%s", tmp.name, script) return tmp.name - + def _gdbserver_args(pid=None, path=None, port=0, gdbserver_args=None, args=None, which=None, env=None, python_wrapper_script=None): """_gdbserver_args(pid=None, path=None, args=None, which=None, env=None) -> list @@ -348,7 +346,7 @@ def _gdbserver_args(pid=None, path=None, port=0, gdbserver_args=None, args=None, 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: @@ -521,7 +519,7 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por >>> io.interactive() # doctest: +SKIP >>> io.close() - + Start a new process with modified argv[0] >>> io = gdb.debug(args=[b'\xde\xad\xbe\xef'], gdbscript='continue', exe="/bin/sh") @@ -587,9 +585,6 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por Using GDB Python API: - .. doctest:: - :skipif: is_python2 - Debug a new process >>> io = gdb.debug(['echo', 'foo'], api=True) @@ -630,10 +625,10 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por >>> ssh_io.close() >>> shell.close() """ - if isinstance(args, six.integer_types + (tubes.process.process, tubes.ssh.ssh_channel)): + if isinstance(args, (int, tubes.process.process, tubes.ssh.ssh_channel)): log.error("Use gdb.attach() to debug a running process") - if isinstance(args, (bytes, six.text_type)): + if isinstance(args, (bytes, str)): args = [args] orig_args = args @@ -660,7 +655,7 @@ def debug(args, gdbscript=None, gdb_args=None, exe=None, ssh=None, env=None, por if ssh or context.native or (context.os == 'android'): if len(args) > 0 and which(packing._decode(args[0])) == packing._decode(exe): args = _gdbserver_args(gdbserver_args=gdbserver_args, args=args, port=port, 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 @@ -737,6 +732,7 @@ def get_gdb_arch(): 'sparc64': 'sparc:v9', 'riscv32': 'riscv:rv32', 'riscv64': 'riscv:rv64', + 'loongarch64': 'Loongarch64', }.get(context.arch, context.arch) def binary(): @@ -750,6 +746,12 @@ def binary(): >>> gdb.binary() # doctest: +SKIP '/usr/bin/gdb' """ + if context.gdb_binary: + gdb = misc.which(context.gdb_binary) + if not gdb: + log.warn_once('Path to gdb binary `{}` not found'.format(context.gdb_binary)) + return gdb + gdb = misc.which('pwntools-gdb') or misc.which('gdb') if not context.native: @@ -950,6 +952,8 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr Process name. The youngest process is selected. :obj:`tuple` Host, port pair of a listening ``gdbserver`` + Tries to look up the target exe from the ``gdbserver`` commandline, + requires explicit ``exe`` argument if the target exe is not in the commandline. :class:`.process` Process to connect to :class:`.sock` @@ -957,7 +961,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr Can be any socket type, including :class:`.listen` or :class:`.remote`. :class:`.ssh_channel` Remote process spawned via :meth:`.ssh.process`. - This will use the GDB installed on the remote machine. + **This will use the GDB installed on the remote machine.** If a password is required to connect, the ``sshpass`` program must be installed. Examples: @@ -986,9 +990,6 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr Using GDB Python API: - .. doctest:: - :skipif: is_python2 - >>> io = process('bash') Attach a debugger @@ -1034,6 +1035,30 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr >>> io.sendline(b'echo Hello from bash && exit') >>> io.recvall() b'Hello from bash\n' + >>> server.close() + + Attach to a gdbserver / gdbstub running on the local machine + by specifying the host and port tuple it is listening on. + (gdbserver always listens on 0.0.0.0) + + >>> gdbserver = process(['gdbserver', '1.2.3.4:12345', '/bin/bash']) + >>> gdbserver.recvline_contains(b'Listening on port', timeout=10) + b'Listening on port 12345' + >>> pid = gdb.attach(('0.0.0.0', 12345), gdbscript=''' + ... tbreak main + ... commands + ... call puts("Hello from gdbserver debugger!") + ... continue + ... end + ... ''') + >>> gdbserver.recvline(timeout=10) # doctest: +ELLIPSIS + b'Remote debugging from host 127.0.0.1, ...\n' + >>> gdbserver.recvline(timeout=10) + b'Hello from gdbserver debugger!\n' + >>> gdbserver.sendline(b'echo Hello from bash && exit') + >>> gdbserver.recvline(timeout=10) + b'Hello from bash\n' + >>> gdbserver.close() Attach to processes running on a remote machine via an SSH :class:`.ssh` process @@ -1051,6 +1076,26 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr >>> io.recvline() b'This will be echoed back\n' >>> io.close() + + To attach to remote gdbserver, assume you have a socat server delivering gdbserver + with ``socat TCP-LISTEN:1336,reuseaddr,fork 'EXEC:"gdbserver :1337 /bin/bash"'``, + then you can connect to gdbserver and attach to it by: + (When connection with gdbserver established, ``/bin/bash`` will pause at ``_start``, + waiting for our gdb to attach.) + + A typical case is a sample can't run locally as some dependencies is missing, + so this sample is provided by remote server or docker. + + >>> with context.local(log_level='warning'): + ... server = process(['socat', 'TCP-LISTEN:1336,reuseaddr,fork', 'EXEC:"gdbserver :1337 /bin/bash"']) + ... sleep(1) # wait for socat to bind + ... io = remote('127.0.0.1', 1336) + ... _ = gdb.attach(('127.0.0.1', 1337), 'c', '/bin/bash') + ... io.sendline(b'echo Hello') + ... io.recvline() + ... io.close() + ... server.close() + b'Hello\n' """ if context.noptrace: log.warn_once("Skipping debug attach since context.noptrace==True") @@ -1086,7 +1131,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr # let's see if we can find a pid to attach to pid = None - if isinstance(target, six.integer_types): + if isinstance(target, int): # target is a pid, easy peasy pid = target elif isinstance(target, str): @@ -1137,7 +1182,7 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr if proc.exe(pid).endswith('/socat') and time.sleep(0.1) and proc.children(pid): pid = proc.children(pid)[0] - # We may attach to the remote process after the fork but before it performs an exec. + # We may attach to the remote process after the fork but before it performs an exec. # If an exe is provided, wait until the process is actually running the expected exe # before we attach the debugger. t = Timeout() @@ -1251,7 +1296,7 @@ def preexec_fn(): gdb_pid = misc.run_in_new_terminal(cmd, preexec_fn = preexec_fn) if pid and context.native: - proc.wait_for_debugger(pid, gdb_pid) + gdb_pid = proc.wait_for_debugger(pid, gdb_pid) if not api: return gdb_pid @@ -1259,10 +1304,6 @@ def preexec_fn(): # connect to the GDB Python API bridge from rpyc import BgServingThread from rpyc.utils.factory import unix_connect - if six.PY2: - retriable = socket.error - else: - retriable = ConnectionRefusedError, FileNotFoundError t = Timeout() with t.countdown(10): @@ -1270,7 +1311,7 @@ def preexec_fn(): try: conn = unix_connect(socket_path) break - except retriable: + except (ConnectionRefusedError, FileNotFoundError): time.sleep(0.1) else: # Check to see if RPyC is installed at all in GDB diff --git a/pwnlib/libcdb.py b/pwnlib/libcdb.py index 9daeb4a99..bde4f2c56 100644 --- a/pwnlib/libcdb.py +++ b/pwnlib/libcdb.py @@ -6,16 +6,15 @@ import os import time -import six import tempfile -import sys +import struct 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 +from pwnlib.util.fiddling import enhex, unhex from pwnlib.util.hashes import sha1filehex, sha256filehex, md5filehex from pwnlib.util.misc import read from pwnlib.util.misc import which @@ -24,12 +23,46 @@ log = getLogger(__name__) -HASHES = { - 'build_id': lambda path: enhex(ELF(path, checksec=False).buildid or b''), + +def _turbofast_extract_build_id(path): + """ + Elf_External_Note: + + 0x00 +--------+ + | namesz | <- Size of entry's owner string + 0x04 +--------+ + | descsz | <- Size of the note descriptor + 0x08 +--------+ + | type | <- Interpretation of the descriptor + 0x0c +--------+ + | name | <- Start of the name+desc data + ... +-------- + | desc | + ... +--------+ + """ + data = read(path, 0x1000) + # search NT_GNU_BUILD_ID and b"GNU\x00" (type+name) + idx = data.find(unhex("03000000474e5500")) + if idx == -1: + return enhex(ELF(path, checksec=False).buildid or b'') + descsz, = struct.unpack(" 1: @@ -105,16 +146,17 @@ def provider_libc_rip(hex_encoded_id, hash_type): url = libc_match[0]['download_url'] log.debug("Downloading data from libc.rip: %s", url) + url = url.replace("https://libc.rip", LIBC_RIP_URL) data = wget(url, timeout=20) if not data: - log.warn_once("Could not fetch libc binary for %s %s from libc.rip", hash_type, hex_encoded_id) + log.warn_once("Could not fetch libc binary for %s %s from libc.rip", search_type, search_target) return None return data # Check if the local system libc matches the requested hash. -def provider_local_system(hex_encoded_id, hash_type): - if hash_type == 'id': +def provider_local_system(hex_encoded_id, search_type): + if search_type == 'libs_id': return None shell_path = os.environ.get('SHELL', None) or '/bin/sh' if not os.path.exists(shell_path): @@ -124,12 +166,12 @@ def provider_local_system(hex_encoded_id, hash_type): 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: + if TYPES[search_type](local_libc.path) == hex_encoded_id: return local_libc.data return None # Offline search https://github.com/niklasb/libc-database for hash type -def provider_local_database(hex_encoded_id, hash_type): +def provider_local_database(search_target, search_type): if not context.local_libcdb: return None @@ -137,9 +179,16 @@ def provider_local_database(hex_encoded_id, hash_type): if not localdb.is_dir(): return None - log.debug("Searching local libc database, %s: %s", hash_type, hex_encoded_id) + # Handle the specific search type 'libs_id' + if search_type == 'libs_id': + libc_list = list(localdb.rglob("%s.so" % search_target)) + if len(libc_list) == 0: + return None + return read(libc_list[0]) + + log.debug("Searching local libc database, %s: %s", search_type, search_target) for libc_path in localdb.rglob("*.so"): - if hex_encoded_id == HASHES[hash_type](libc_path): + if search_target == TYPES[search_type](libc_path): return read(libc_path) return None @@ -186,12 +235,31 @@ def query_local_database(params): "online": [provider_libcdb, provider_libc_rip] } -def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline_only=False): - assert hash_type in HASHES, hash_type +def search_by_hash(search_target, search_type='build_id', unstrip=True, offline_only=False): + """search_by_hash(str, str, bool, bool) -> str + Arguments: + search_target(str): + Use for searching the libc. This could be a hex encoded ID (`hex_encoded_id`) or a library + name (`libs_id`). Depending on `search_type`, this can represent different types of encoded + values or names. + search_type(str): + The type of the search to be performed, it should be one of the keys in the `TYPES` dictionary. + unstrip(bool): + Try to fetch debug info for the libc and apply it to the downloaded file. + offline_only(bool): + If True, restricts the search to offline providers only (local database). If False, it will also + search online providers. Default is False. + + Returns: + The path to the cached directory containing the downloaded libraries. + """ + assert search_type in TYPES, search_type # Ensure that the libcdb cache directory exists - cache, cache_valid = _check_elf_cache('libcdb', hex_encoded_id, hash_type) + cache, cache_valid = _check_elf_cache('libcdb', search_target, search_type) if cache_valid: + if unstrip: + unstrip_libc(cache) return cache # We searched for this buildid before, but didn't find anything. @@ -204,12 +272,12 @@ def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline_o # Run through all available libc database providers to see if we have a match. for provider in providers: - data = provider(hex_encoded_id, hash_type) + data = provider(search_target, search_type) if data and data.startswith(b'\x7FELF'): break if not data: - log.warn_once("Could not find libc for %s %s anywhere", hash_type, hex_encoded_id) + log.warn_once("Could not find libc for %s %s anywhere", search_type, search_target) # Save whatever we got to the cache write(cache, data or b'') @@ -225,9 +293,18 @@ def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline_o return cache def _search_debuginfo_by_hash(base_url, hex_encoded_id): + """ + Given a hex-encoded build_id, attempt to download a matching debuginfo from the debuginfod server. + + >>> debuginfo_file = _search_debuginfo_by_hash(DEBUGINFOD_SERVERS[0], 'd1704d25fbbb72fa95d517b883131828c0883fe9') + >>> debuginfo_file is not None + True + >>> 'main_arena' in ELF(debuginfo_file).symbols + True + """ # Deferred import because it's slow import requests - from six.moves import urllib + import urllib.parse # Check if we tried this buildid before. cache, cache_valid = _check_elf_cache('libcdb_dbg', hex_encoded_id, 'build_id') @@ -258,7 +335,7 @@ def _search_debuginfo_by_hash(base_url, hex_encoded_id): return cache -def _check_elf_cache(cache_type, hex_encoded_id, hash_type): +def _check_elf_cache(cache_type, search_target, search_type): """ Check if there already is an ELF file for this hash in the cache. @@ -271,14 +348,14 @@ def _check_elf_cache(cache_type, hex_encoded_id, hash_type): True """ # Ensure that the cache directory exists - cache_dir = os.path.join(context.cache_dir, cache_type, hash_type) + cache_dir = os.path.join(context.cache_dir, cache_type, search_type) if not os.path.isdir(cache_dir): os.makedirs(cache_dir) # If we already downloaded the file, and it looks even passingly like # a valid ELF file, return it. - cache = os.path.join(cache_dir, hex_encoded_id) + cache = os.path.join(cache_dir, search_target) if not os.path.exists(cache): return cache, False @@ -290,7 +367,7 @@ def _check_elf_cache(cache_type, hex_encoded_id, hash_type): # 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) + log.info_once("Skipping invalid cached ELF %s", search_target) return None, False log.info_once("Using cached data from %r", cache) @@ -362,7 +439,7 @@ def unstrip_libc(filename): return True def _extract_tarfile(cache_dir, data_filename, tarball): - from six import BytesIO + from io import BytesIO import tarfile # Handle zstandard compression, since tarfile only supports gz, bz2, and xz. if data_filename.endswith('.zst') or data_filename.endswith('.zstd'): @@ -374,19 +451,6 @@ def _extract_tarfile(cache_dir, data_filename, tarball): tarball.close() tarball = decompressed_tar - if six.PY2 and data_filename.endswith('.xz'): - # Python 2's tarfile doesn't support xz, so we need to decompress it first. - # Shell out to xz, since the Python 2 pylzma module is broken. - # (https://github.com/fancycode/pylzma/issues/67) - if not which('xz'): - log.error('Couldn\'t find "xz" in PATH. Please install xz first.') - import subprocess - try: - uncompressed_tarball = subprocess.check_output(['xz', '--decompress', '--stdout', tarball.name]) - tarball = BytesIO(uncompressed_tarball) - except subprocess.CalledProcessError: - log.error('Failed to decompress xz archive.') - with tarfile.open(fileobj=tarball) as tar_file: # Find the library folder in the archive (e.g. /lib/x86_64-linux-gnu/) lib_dir = None @@ -420,46 +484,18 @@ def _extract_tarfile(cache_dir, data_filename, tarball): def _extract_debfile(cache_dir, package_filename, package): # Extract data.tar in the .deb archive. - if sys.version_info < (3, 6): - if not which('ar'): - log.error('Missing command line tool "ar" to extract .deb archive. Please install "ar" first.') - - import atexit - import shutil - import subprocess - - # Use mkdtemp instead of TemporaryDirectory because the latter is not available in Python 2. - tempdir = tempfile.mkdtemp(prefix=".pwntools-tmp") - atexit.register(shutil.rmtree, tempdir) - with tempfile.NamedTemporaryFile(mode='wb', dir=tempdir) as debfile: - debfile.write(package) - debfile.flush() - try: - files_in_deb = subprocess.check_output(['ar', 't', debfile.name]).split(b'\n') - except subprocess.CalledProcessError: - log.error('Failed to list files in .deb archive.') - [data_filename] = filter(lambda f: f.startswith(b'data.tar'), files_in_deb) - - try: - subprocess.check_call(['ar', 'x', debfile.name, data_filename], cwd=tempdir) - except subprocess.CalledProcessError: - log.error('Failed to extract data.tar from .deb archive.') - - with open(os.path.join(tempdir, data_filename), 'rb') as tarball: - return _extract_tarfile(cache_dir, data_filename, tarball) - else: - import unix_ar - from six import BytesIO - ar_file = unix_ar.open(BytesIO(package)) - try: - data_filename = next(filter(lambda f: f.name.startswith(b'data.tar'), ar_file.infolist())).name.decode() - tarball = ar_file.open(data_filename) - return _extract_tarfile(cache_dir, data_filename, tarball) - finally: - ar_file.close() + import unix_ar + from io import BytesIO + ar_file = unix_ar.open(BytesIO(package)) + try: + data_filename = next(filter(lambda f: f.name.startswith(b'data.tar'), ar_file.infolist())).name.decode() + tarball = ar_file.open(data_filename) + return _extract_tarfile(cache_dir, data_filename, tarball) + finally: + ar_file.close() def _extract_pkgfile(cache_dir, package_filename, package): - from six import BytesIO + from io import BytesIO return _extract_tarfile(cache_dir, package_filename, BytesIO(package)) def _find_libc_package_lib_url(libc): @@ -467,7 +503,9 @@ def _find_libc_package_lib_url(libc): libc_match = query_libc_rip({'buildid': enhex(libc.buildid)}) if libc_match is not None: for match in libc_match: - yield match['libs_url'] + # Allow to override url with a caching proxy in CI + ubuntu_archive_url = os.environ.get('PWN_UBUNTU_ARCHIVE_URL', 'http://archive.ubuntu.com').rstrip('/') + yield match['libs_url'].replace('http://archive.ubuntu.com', ubuntu_archive_url) # Check launchpad.net if it's an Ubuntu libc # GNU C Library (Ubuntu GLIBC 2.36-0ubuntu4) @@ -584,7 +622,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, offline_only=False): +def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, offline_only=False, search_type='build_id', return_as_list=False, return_raw=False): """ Lookup possible matching libc versions based on leaked function addresses. @@ -603,12 +641,16 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as The libc to select if there are multiple matches (starting at 1). unstrip(bool): Try to fetch debug info for the libc and apply it to the downloaded file. - 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. + search_type(str): + An option to select searched hash. + return_as_list(bool): + Return a list of build ids of all matching libc versions + instead of a path to a downloaded file. + return_raw(bool): + Return raw list of matched libc. Returns: Path to the downloaded library on disk, or :const:`None`. @@ -627,6 +669,8 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as >>> for buildid in matched_libcs: # doctest +SKIP ... libc = ELF(search_by_build_id(buildid)) # doctest +SKIP """ + assert search_type in TYPES, search_type + for symbol, address in symbols.items(): if isinstance(address, int): symbols[symbol] = hex(address) @@ -662,21 +706,52 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as if return_as_list: return [libc['buildid'] for libc in matching_list] + if return_raw: + return matching_list + + mapped_type = MAP_TYPES.get(search_type, search_type) + # 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) + return search_by_hash(matching_list[0][mapped_type], search_type=search_type, 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_list): - return search_by_build_id(matching_list[select_index - 1]['buildid'], unstrip=unstrip, offline_only=offline_only) + return search_by_hash(matching_list[select_index - 1][mapped_type], search_type=search_type, 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_list)) return None # 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) + return search_by_hash(selected_libc[mapped_type], search_type=search_type, unstrip=unstrip, offline_only=offline_only) + +def search_by_libs_id(libs_id, unstrip=True, offline_only=False): + """ + Given a Libs ID, attempt to download a matching libc from libcdb. + + Arguments: + libs_id(str): + Libs ID (e.g. ``'libc6_...'``) of the library + unstrip(bool): + Try to fetch debug info for the libc and apply it to the downloaded file. + offline_only(bool): + When pass ``offline_only=True``, restricts search mode to offline sources only, + disable online lookup. Defaults to :const:`False`, and enable both offline and online providers. + + Returns: + Path to the downloaded library on disk, or :const:`None`. + + Examples: + + >>> None == search_by_libs_id('XX') + True + >>> filename = search_by_libs_id('libc6_2.31-3_amd64') + >>> hex(ELF(filename).symbols.read) + '0xeef40' + """ + return search_by_hash(libs_id, 'libs_id', unstrip, offline_only) def search_by_build_id(hex_encoded_id, unstrip=True, offline_only=False): """ @@ -820,9 +895,16 @@ def _pack_libs_info(path, libs_id, libs_url, syms): 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) + for search_type, hash_func in TYPES.items(): + # pass libs_id + if search_type == 'libs_id': + continue + + # replace search_type + if search_type in MAP_TYPES.keys(): + search_type = MAP_TYPES[search_type] + + info[search_type] = hash_func(path) default_symbol_list = [ "__libc_start_main_ret", "dup2", "printf", "puts", "read", "system", "str_bin_sh" @@ -887,4 +969,4 @@ def get_build_id_offsets(): }.get(context.arch, []) -__all__ = ['get_build_id_offsets', 'search_by_build_id', 'search_by_sha1', 'search_by_sha256', 'search_by_md5', 'unstrip_libc', 'search_by_symbol_offsets', 'download_libraries'] +__all__ = ['get_build_id_offsets', 'search_by_build_id', 'search_by_sha1', 'search_by_sha256', 'search_by_md5', 'search_by_libs_id', 'unstrip_libc', 'search_by_symbol_offsets', 'download_libraries'] diff --git a/pwnlib/log.py b/pwnlib/log.py index 317dde44a..21cf8a39f 100644 --- a/pwnlib/log.py +++ b/pwnlib/log.py @@ -98,7 +98,6 @@ import os import random import re -import six import string import sys import threading @@ -284,7 +283,7 @@ def __init__(self, logger=None): self._logger = logger def _getlevel(self, levelString): - if isinstance(levelString, six.integer_types): + if isinstance(levelString, int): return levelString return logging._levelNames[levelString.upper()] diff --git a/pwnlib/memleak.py b/pwnlib/memleak.py index 4759f3486..46871ab26 100644 --- a/pwnlib/memleak.py +++ b/pwnlib/memleak.py @@ -5,9 +5,6 @@ import functools import string -import six -from six.moves import range - from pwnlib.context import context from pwnlib.log import getLogger from pwnlib.util.packing import pack, _p8lu @@ -39,6 +36,9 @@ def some_leaker(addr): Example: + .. doctest:: + :options: +POSIX +TODO + >>> import pwnlib >>> binsh = pwnlib.util.misc.read('/bin/sh') >>> @pwnlib.memleak.MemLeak @@ -163,7 +163,7 @@ def field_compare(self, address, obj, expected): the type of ``field``. """ - if isinstance(expected, six.integer_types): + if isinstance(expected, int): expected = pack(expected, bytes=obj.size) elif not isinstance(expected, bytes): raise TypeError("Expected value must be an int or bytes") diff --git a/pwnlib/pep237.py b/pwnlib/pep237.py deleted file mode 100644 index 70212f3be..000000000 --- a/pwnlib/pep237.py +++ /dev/null @@ -1,18 +0,0 @@ -# -# Override the behavior of the built-in hex() method -# to strip the trailing 'L'. -# -# This has no meaning anymore, as of 2006. -# -# https://www.python.org/dev/peps/pep-0237/ -# https://mail.python.org/pipermail/python-dev/2006-June/065918.html -# -from six.moves import builtins - -original_hex = builtins.hex - -def hex(number): - original_hex.__doc__ - return original_hex(number).rstrip('L') - -builtins.hex = hex diff --git a/pwnlib/protocols/adb/__init__.py b/pwnlib/protocols/adb/__init__.py index bf305c74b..f195da53f 100644 --- a/pwnlib/protocols/adb/__init__.py +++ b/pwnlib/protocols/adb/__init__.py @@ -10,7 +10,6 @@ import logging import functools -import six import stat import time @@ -144,7 +143,7 @@ def wrapper(self, *a, **kw): def send(self, *a, **kw): """Sends data to the ADB server""" - if isinstance(a[0], six.text_type): + if isinstance(a[0], str): a = (a[0].encode('utf-8'),) + a[1:] return self.c.adb_send(*a, **kw) @@ -432,7 +431,7 @@ def list(self, path): @_with_transport @_sync def _list(self, path): - if isinstance(path, six.text_type): + if isinstance(path, str): path = path.encode('utf-8') self.c.flat32(b'LIST', len(path), path) files = {} @@ -486,7 +485,7 @@ def stat(self, path): >>> pwnlib.protocols.adb.AdbClient().stat('/does/not/exist') is None True """ - if isinstance(path, six.text_type): + if isinstance(path, str): path = path.encode('utf-8') self.c.flat32(b'STAT', len(path), path) if self.c.recvn(4) != b'STAT': @@ -530,7 +529,7 @@ def write(self, path, data, mode=0o755, timestamp=None, callback=None): @_with_transport @_sync def _write(self, path, data, mode=0o755, timestamp=None, callback=None): - if isinstance(path, six.text_type): + if isinstance(path, str): path = path.encode('utf-8') path += b',%d' % mode @@ -576,7 +575,7 @@ def read(self, path, filesize=0, callback=lambda *a: True): Return: The data received as a string. """ - if isinstance(path, six.text_type): + if isinstance(path, str): path = path.encode('utf-8') self.c.send(b'RECV' + p32(len(path)) + path) diff --git a/pwnlib/rop/call.py b/pwnlib/rop/call.py index 4e7534726..49c852123 100644 --- a/pwnlib/rop/call.py +++ b/pwnlib/rop/call.py @@ -7,9 +7,7 @@ from pwnlib.context import context from pwnlib.util import packing -import six - -from pwnlib.util.misc import python_2_bytes_compatible, align +from pwnlib.util.misc import align class Unresolved(object): @@ -58,7 +56,6 @@ class StackAdjustment(Unresolved): pass -@python_2_bytes_compatible class AppendedArgument(Unresolved): r""" Encapsulates information about a pointer argument, and the data @@ -115,7 +112,7 @@ def __init__(self, value, address = 0): if isinstance(v, (list, tuple)): self.size += context.bytes else: - if isinstance(v, six.text_type): + if isinstance(v, str): v = packing._need_bytes(v) try: self.size += align(context.bytes, len(v)) @@ -173,9 +170,9 @@ def resolve(self, addr=None): self.address = addr rv = [None] * len(self.values) for i, value in enumerate(self.values): - if isinstance(value, six.integer_types): + if isinstance(value, int): rv[i] = value - elif isinstance(value, six.text_type): + elif isinstance(value, str): value = packing._need_bytes(value) if isinstance(value, (bytes, bytearray)): value += b'\x00' @@ -197,7 +194,7 @@ def __bytes__(self): return packing.flat(self.resolve()) def __repr__(self): - if isinstance(self.address, six.integer_types): + if isinstance(self.address, int): return '%s(%r, %#x)' % (self.__class__.__name__, self.values, self.address) else: return '%s(%r, %r)' % (self.__class__.__name__, self.values, self.address) @@ -227,27 +224,26 @@ class Call(object): args = [] def __init__(self, name, target, args, abi=None, before=()): - assert isinstance(name, (bytes, six.text_type)) - # assert isinstance(target, six.integer_types) + assert isinstance(name, (bytes, str)) assert isinstance(args, (list, tuple)) self.abi = abi or ABI.default() self.name = name self.target = target self.args = list(args) for i, arg in enumerate(args): - if not isinstance(arg, six.integer_types+(Unresolved,)): + if not isinstance(arg, (int, Unresolved)): self.args[i] = AppendedArgument(arg) self.stack_arguments_before = before def __repr__(self): - fmt = "%#x" if isinstance(self.target, six.integer_types) else "%r" + fmt = "%#x" if isinstance(self.target, int) else "%r" return '%s(%r, %s, %r)' % (self.__class__.__name__, self.name, fmt % self.target, self.args) def is_flat(self): - if isinstance(self, six.integer_types + (Unresolved,)): + if isinstance(self, (int, Unresolved)): return True if not isinstance(self, Call): return False @@ -271,7 +267,7 @@ def _special_repr(cls, x): return x def __str__(self): - fmt = "%#x" if isinstance(self.target, six.integer_types) else "%r" + fmt = "%#x" if isinstance(self.target, int) else "%r" args = [] for arg in self.args: args.append(self._special_repr(arg)) @@ -279,7 +275,7 @@ def __str__(self): name = self.name or (fmt % self.target) arg_str = [] for arg in args: - if isinstance(arg, six.integer_types) and arg > 0x100: + if isinstance(arg, int) and arg > 0x100: arg_str.append(hex(arg)) else: arg_str.append(str(arg)) diff --git a/pwnlib/rop/gadgets.py b/pwnlib/rop/gadgets.py index 67a6dab01..e8aecf4e0 100644 --- a/pwnlib/rop/gadgets.py +++ b/pwnlib/rop/gadgets.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import six class Gadget(object): """ @@ -55,12 +54,12 @@ def __repr__(self): def __getitem__(self, key): # Backward compatibility - if isinstance(key, six.integer_types): + if isinstance(key, int): key = self.__indices[key] return getattr(self, key) def __setitem__(self, key, value): # Backward compatibility - if isinstance(key, six.integer_types): + if isinstance(key, int): key = self.__indices[key] return setattr(self, key, value) diff --git a/pwnlib/rop/ret2dlresolve.py b/pwnlib/rop/ret2dlresolve.py index 08a05420a..2788a0936 100644 --- a/pwnlib/rop/ret2dlresolve.py +++ b/pwnlib/rop/ret2dlresolve.py @@ -32,9 +32,9 @@ 0x0014: 0x2b84 [dlresolve index] 0x0018: b'gaaa' 0x001c: 0x804ae24 arg0 - >>> p = elf.process() - >>> p.sendline(fit({64+context.bytes*3: raw_rop, 200: dlresolve.payload})) - >>> p.recvline() + >>> p = elf.process() # doctest: +LINUX + >>> p.sendline(fit({64+context.bytes*3: raw_rop, 200: dlresolve.payload})) # doctest: +LINUX + >>> p.recvline() # doctest: +LINUX b'pwned\n' You can also use ``Ret2dlresolve`` on AMD64: @@ -56,16 +56,15 @@ 0x0038: 0x601e48 [arg0] rdi = 6299208 0x0040: 0x4003e0 [plt_init] system 0x0048: 0x15670 [dlresolve index] - >>> p = elf.process() - >>> p.sendline(fit({64+context.bytes: raw_rop, 200: dlresolve.payload})) - >>> if dlresolve.unreliable: + >>> p = elf.process() # doctest: +LINUX + >>> p.sendline(fit({64+context.bytes: raw_rop, 200: dlresolve.payload})) # doctest: +LINUX + >>> if dlresolve.unreliable: # doctest: +LINUX ... p.poll(True) == -signal.SIGSEGV ... else: ... p.recvline() == b'pwned\n' True """ -import six from copy import deepcopy from pwnlib.context import context @@ -377,7 +376,7 @@ def _build_args(self): elif isinstance(top, bytes): top = pack(self.data_addr + len(self.payload) + queue.size()) queue.append(MarkedBytes(queue[0])) - elif isinstance(top, six.integer_types): + elif isinstance(top, int): top = pack(top) self.payload += top diff --git a/pwnlib/rop/rop.py b/pwnlib/rop/rop.py index 4505962d7..5eb94f852 100644 --- a/pwnlib/rop/rop.py +++ b/pwnlib/rop/rop.py @@ -367,7 +367,6 @@ import os import re import shutil -import six import string import struct import sys @@ -392,7 +391,6 @@ from pwnlib.util import packing from pwnlib.util.cyclic import cyclic from pwnlib.util.packing import pack -from pwnlib.util.misc import python_2_bytes_compatible log = getLogger(__name__) __all__ = ['ROP'] @@ -413,7 +411,7 @@ def __init__(self, name=''): self.name = name def _slot_len(x): - if isinstance(x, six.integer_types+(Unresolved, Padding, Gadget)): + if isinstance(x, (int, Unresolved, Padding, Gadget)): return context.bytes else: return len(packing.flat(x)) @@ -456,7 +454,7 @@ def dump(self): line = '0x%04x:' % addr if isinstance(data, (str, bytes)): line += ' %16r' % data - elif isinstance(data, six.integer_types): + elif isinstance(data, int): line += ' %#16x' % data if self.address != 0 and self.address < data < self.next: off = data - addr @@ -473,7 +471,6 @@ def dump(self): return '\n'.join(rv) -@python_2_bytes_compatible class ROP(object): r"""Class which simplifies the generation of ROP-chains. @@ -603,7 +600,7 @@ def __init__(self, elfs, base = None, badchars = b'', **kwargs): # Permit singular ROP(elf) vs ROP([elf]) if isinstance(elfs, ELF): elfs = [elfs] - elif isinstance(elfs, (bytes, six.text_type)): + elif isinstance(elfs, (bytes, str)): elfs = [ELF(elfs)] #: List of individual ROP gadgets, ROP calls, SROP frames, etc. @@ -788,7 +785,7 @@ def resolve(self, resolvable): if resolvable in elf.symbols: return elf.symbols[resolvable] - if isinstance(resolvable, six.integer_types): + if isinstance(resolvable, int): return resolvable def unresolve(self, value): @@ -841,9 +838,9 @@ def describe(self, object): """ if isinstance(object, enums): return str(object) - if isinstance(object, six.integer_types): + if isinstance(object, int): return self.unresolve(object) - if isinstance(object, (bytes, six.text_type)): + if isinstance(object, (bytes, str)): return repr(object) if isinstance(object, Gadget): return '; '.join(object.insns) @@ -886,14 +883,14 @@ def build(self, base = None, description = None): # Integers can just be added. # Do our best to find out what the address is. - if isinstance(slot, six.integer_types): + if isinstance(slot, int): stack.describe(self.describe(slot)) stack.append(slot) # Byte blobs can also be added, however they must be # broken down into pointer-width blobs. - elif isinstance(slot, (bytes, six.text_type)): + elif isinstance(slot, (bytes, str)): stack.describe(self.describe(slot)) if not isinstance(slot, bytes): slot = slot.encode() @@ -1011,10 +1008,10 @@ def build(self, base = None, description = None): size = (stack.next - base) slot_address = base for i, slot in enumerate(stack): - if isinstance(slot, six.integer_types): + if isinstance(slot, int): pass - elif isinstance(slot, (bytes, six.text_type)): + elif isinstance(slot, (bytes, str)): pass elif isinstance(slot, AppendedArgument): @@ -1136,7 +1133,7 @@ def _srop_call(self, resolvable, arguments): SYS_sigreturn = constants.SYS_rt_sigreturn for register, value in zip(frame.arguments, arguments): - if not isinstance(value, six.integer_types + (Unresolved,)): + if not isinstance(value, (int, Unresolved)): frame[register] = AppendedArgument(value) else: frame[register] = value @@ -1391,6 +1388,8 @@ def __getattr__(self, k): if pop.match(insn): regs.append(pop.match(insn).group(1)) sp_move += context.bytes + if 'sp' in insn: + sp_move += 9999999 elif add.match(insn): arg = int(add.match(insn).group(1), 16) sp_move += arg @@ -1418,7 +1417,7 @@ def __getattr__(self, k): if not set(['rsp', 'esp']) & set(regs): self.pivots[sp_move] = addr - leave = self.search(regs=frame_regs, order='regs') + leave = self.search(regs=frame_regs, order='leav') if leave and leave.regs != frame_regs: leave = None self.leave = leave @@ -1451,7 +1450,7 @@ def search(self, move = 0, regs = None, order = 'size'): pointer is adjusted. regs(list): Minimum list of registers which are popped off the stack. - order(str): Either the string 'size' or 'regs'. Decides how to + order(str): Either the string 'size', 'leav' or 'regs'. Decides how to order multiple gadgets the fulfill the requirements. The search will try to minimize the number of bytes popped more than @@ -1459,7 +1458,9 @@ def search(self, move = 0, regs = None, order = 'size'): the address. If ``order == 'size'``, then gadgets are compared lexicographically - by ``(total_moves, total_regs, addr)``, otherwise by ``(total_regs, total_moves, addr)``. + by ``(total_moves, total_regs, addr)``, if ``order == 'regs'``, + then by ``(total_regs, total_moves, addr)``. ``order == 'leav'`` + is specifically for ``leave`` insn. Returns: A :class:`.Gadget` object @@ -1471,8 +1472,9 @@ def search(self, move = 0, regs = None, order = 'size'): # Search for an exact match, save the closest match key = { 'size': lambda g: (g.move, len(g.regs), g.address), - 'regs': lambda g: (len(g.regs), g.move, g.address) - }[order] + 'regs': lambda g: (len(g.regs), g.move, g.address), + 'leav': lambda g: ('leave' not in g.insns, len(g.regs), g.address) + }[order] # False is prior than True try: result = min(matches, key=key) diff --git a/pwnlib/shellcraft/__init__.py b/pwnlib/shellcraft/__init__.py index de1127448..58f20379b 100644 --- a/pwnlib/shellcraft/__init__.py +++ b/pwnlib/shellcraft/__init__.py @@ -4,7 +4,6 @@ import itertools import os import re -import six import sys from types import ModuleType @@ -137,7 +136,7 @@ def templates(self): return templates def eval(self, item): - if isinstance(item, six.integer_types): + if isinstance(item, int): return item return constants.eval(item) @@ -147,7 +146,7 @@ def pretty(self, n, comment=True): if not comment: # then it can be inside a comment! r = r.replace('*/', r'\x2a/') return r - if not isinstance(n, six.integer_types): + if not isinstance(n, int): return n if isinstance(n, constants.Constant): if comment: return '%s /* %s */' % (n,self.pretty(int(n))) @@ -158,7 +157,7 @@ def pretty(self, n, comment=True): return '%#x' % n def okay(self, s, *a, **kw): - if isinstance(s, six.integer_types): + if isinstance(s, int): s = packing.pack(s, *a, **kw) return b'\0' not in s and b'\n' not in s diff --git a/pwnlib/shellcraft/registers.py b/pwnlib/shellcraft/registers.py index fe366f70c..667014ce2 100644 --- a/pwnlib/shellcraft/registers.py +++ b/pwnlib/shellcraft/registers.py @@ -110,6 +110,43 @@ riscv_list = list(riscv) +loongarch64 = { + 'r0' : 0, 'zero': 0, + 'r1' : 1, 'ra': 1, + 'r2' : 2, 'tp': 2, + 'r3' : 3, 'sp': 3, + 'r4' : 4, 'a0': 4, 'v0': 4, + 'r5' : 5, 'a1': 5, 'v1': 5, + 'r6' : 6, 'a2': 6, + 'r7' : 7, 'a3': 7, + 'r8' : 8, 'a4': 8, + 'r9' : 9, 'a5': 9, + 'r10': 10, 'a6': 10, + 'r11': 11, 'a7': 11, + 'r12': 12, 't0': 12, + 'r13': 13, 't1': 13, + 'r14': 14, 't2': 14, + 'r15': 15, 't3': 15, + 'r16': 16, 't4': 16, + 'r17': 17, 't5': 17, + 'r18': 18, 't6': 18, + 'r19': 19, 't7': 19, + 'r20': 20, 't8': 20, + 'r21': 21, 'u0': 21, # u0 is only used by Linux kernel + 'r22': 22, 'fp': 22, 's9': 22, + 'r23': 23, 's0': 23, + 'r24': 24, 's1': 24, + 'r25': 25, 's2': 25, + 'r26': 26, 's3': 26, + 'r27': 27, 's4': 27, + 'r28': 28, 't5': 28, + 'r29': 29, 't6': 29, + 'r30': 30, 't7': 30, + 'r31': 31, 't8': 31, +} + +loongarch64_list = list(loongarch64) + # x86/amd64 registers in decreasing size i386_ordered = [ ['rax', 'eax', 'ax', 'al'], @@ -253,6 +290,7 @@ def current(): 'powerpc': powerpc, 'riscv32': riscv, 'riscv64': riscv, + 'loongarch64': loongarch64, }[context.arch] # def is_register(sz): diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm index fb3d2318c..d7da7c0f3 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscall.asm @@ -2,7 +2,6 @@ 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> @@ -28,7 +27,7 @@ Example: svc 0 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm index 1f74b7377..092eb85d2 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/execve.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>execve(path, argv, envp) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm index 08e080de0..8f194f099 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/exit.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>exit(status) -> str @@ -52,8 +51,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm index 3e12b01f6..1c30947d1 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getdirentries64.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getdirentries64(fd, buf, bufsize, position) -> str @@ -55,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm index 42806a004..4f4e159d1 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/getxattr.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getxattr(path, name, value, size) -> str @@ -55,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm index a5f691716..40e75b3c2 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/lseek.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lseek(fd, offset, whence) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm index b4fe7b4e8..c4c0de06a 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/read.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>read(fd, buf, nbytes) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm index a20c06995..9bd2178aa 100644 --- a/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm +++ b/pwnlib/shellcraft/templates/aarch64/darwin/syscalls/write.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>write(fd, buf, n) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/aarch64/freebsd/syscall.asm b/pwnlib/shellcraft/templates/aarch64/freebsd/syscall.asm index e08b5b4a2..95960f52e 100644 --- a/pwnlib/shellcraft/templates/aarch64/freebsd/syscall.asm +++ b/pwnlib/shellcraft/templates/aarch64/freebsd/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import aarch64, pretty from pwnlib.constants import Constant from pwnlib.abi import freebsd_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> @@ -28,7 +27,7 @@ Example: svc 0 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/aarch64/linux/stage.asm b/pwnlib/shellcraft/templates/aarch64/linux/stage.asm index a0e8df3ed..a90eaf36b 100644 --- a/pwnlib/shellcraft/templates/aarch64/linux/stage.asm +++ b/pwnlib/shellcraft/templates/aarch64/linux/stage.asm @@ -1,5 +1,4 @@ <% -import six from pwnlib.shellcraft.aarch64 import mov from pwnlib.shellcraft.aarch64.linux import read, readn, mmap from pwnlib import constants as C @@ -29,7 +28,7 @@ Example: protection = C.PROT_READ | C.PROT_WRITE | C.PROT_EXEC flags = C.MAP_ANONYMOUS | C.MAP_PRIVATE - assert isinstance(fd, six.integer_types) + assert isinstance(fd, int) %> %if length is None: /* How many bytes should we receive? */ diff --git a/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm b/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm index b0acc3068..ee676acff 100644 --- a/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/aarch64/linux/syscall.asm @@ -1,8 +1,7 @@ <% from pwnlib.shellcraft import aarch64, pretty - from pwnlib.constants import eval + from pwnlib.constants import Constant from pwnlib.abi import linux_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, arg6 = None"/> <%docstring> @@ -51,8 +50,8 @@ Example: svc 0 <% - if isinstance(syscall, (str, text_type)) and syscall.startswith('SYS_'): - syscall_repr = syscall[4:] + "(%s)" + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): + syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: syscall_repr = 'syscall(%s)' diff --git a/pwnlib/shellcraft/templates/aarch64/mov.asm b/pwnlib/shellcraft/templates/aarch64/mov.asm index 06a3609e0..b83e0fb03 100644 --- a/pwnlib/shellcraft/templates/aarch64/mov.asm +++ b/pwnlib/shellcraft/templates/aarch64/mov.asm @@ -8,7 +8,6 @@ from pwnlib.util.fiddling import xor_pair from pwnlib.shellcraft import pretty from pwnlib.shellcraft.registers import aarch64 as regs - import six log = getLogger('pwnlib.shellcraft.arm.mov') %> <%page args="dst, src"/> @@ -50,7 +49,7 @@ mov_x15 = None xor = None -if isinstance(src, six.integer_types): +if isinstance(src, int): lobits = dst not in ('x0', 'x10') packed = pack(src) words = group(2, packed) @@ -93,7 +92,7 @@ if dst == 'x15': add ${dst}, ${src}, xzr %elif src == 'x0': add ${dst}, ${src}, xzr, lsl #1 -%elif not isinstance(src, six.integer_types): +%elif not isinstance(src, int): mov ${dst}, ${src} %else: %if src == 0: diff --git a/pwnlib/shellcraft/templates/aarch64/pushstr.asm b/pwnlib/shellcraft/templates/aarch64/pushstr.asm index c5cf0e15d..06a320974 100644 --- a/pwnlib/shellcraft/templates/aarch64/pushstr.asm +++ b/pwnlib/shellcraft/templates/aarch64/pushstr.asm @@ -1,6 +1,5 @@ <% from pwnlib.util import lists, packing, fiddling %> <% from pwnlib import shellcraft %> -<% import six %> <%page args="string, append_null = True, register1='x14', register2='x15', pretty=None"/> <%docstring> Pushes a string onto the stack. @@ -30,7 +29,7 @@ Examples: b'Hello, world! This is a long string! Wow!' <% -if isinstance(string, six.text_type): +if isinstance(string, str): string = string.encode('utf-8') if append_null and not string.endswith(b'\x00'): diff --git a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm index 7b5ed7302..e03a0fac6 100644 --- a/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm +++ b/pwnlib/shellcraft/templates/aarch64/pushstr_array.asm @@ -3,7 +3,6 @@ from pwnlib.shellcraft import pretty from pwnlib.util.iters import group from pwnlib.util.packing import _need_bytes - from six import text_type, binary_type %> <%docstring> Pushes an array/envp-style array of pointers onto the stack. @@ -24,7 +23,7 @@ Example: <%page args="reg, array, register1='x14', register2='x15'"/> <% -if isinstance(array, (binary_type, text_type)): +if isinstance(array, (bytes, str)): array = [array] # Convert all items to strings diff --git a/pwnlib/shellcraft/templates/aarch64/xor.asm b/pwnlib/shellcraft/templates/aarch64/xor.asm index 7a5e95611..32fc47426 100644 --- a/pwnlib/shellcraft/templates/aarch64/xor.asm +++ b/pwnlib/shellcraft/templates/aarch64/xor.asm @@ -1,5 +1,4 @@ <% - import six from pwnlib.shellcraft import pretty, common, aarch64, registers from pwnlib.shellcraft.registers import aarch64 as regs from pwnlib.util.packing import pack, unpack @@ -40,7 +39,7 @@ if not key in regs: key_str = key key_int = key - if isinstance(key, six.integer_types): + if isinstance(key, int): key_str = pack(key, bytes=4) else: key_int = unpack(key, 'all') diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm index 526d9a4d1..eb9328fb6 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscall.asm @@ -2,7 +2,6 @@ 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> @@ -82,7 +81,7 @@ Example: <% append_cdq = False - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm index 1f74b7377..092eb85d2 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/execve.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>execve(path, argv, envp) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm index 08e080de0..8f194f099 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/exit.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>exit(status) -> str @@ -52,8 +51,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm index 3e12b01f6..1c30947d1 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getdirentries64.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getdirentries64(fd, buf, bufsize, position) -> str @@ -55,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm index 42806a004..4f4e159d1 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/getxattr.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getxattr(path, name, value, size) -> str @@ -55,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm index a5f691716..40e75b3c2 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/lseek.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lseek(fd, offset, whence) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm index b4fe7b4e8..c4c0de06a 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/read.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>read(fd, buf, nbytes) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm index a20c06995..9bd2178aa 100644 --- a/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm +++ b/pwnlib/shellcraft/templates/amd64/darwin/syscalls/write.asm @@ -3,7 +3,6 @@ import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>write(fd, buf, n) -> str @@ -54,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/amd64/freebsd/syscall.asm b/pwnlib/shellcraft/templates/amd64/freebsd/syscall.asm index c33ea8a97..25bbe1fb9 100644 --- a/pwnlib/shellcraft/templates/amd64/freebsd/syscall.asm +++ b/pwnlib/shellcraft/templates/amd64/freebsd/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import amd64, pretty from pwnlib.constants import Constant from pwnlib.abi import freebsd_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> @@ -71,7 +70,7 @@ Example: syscall <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/amd64/linux/egghunter.asm b/pwnlib/shellcraft/templates/amd64/linux/egghunter.asm index fcfecfbc5..d2a573a15 100644 --- a/pwnlib/shellcraft/templates/amd64/linux/egghunter.asm +++ b/pwnlib/shellcraft/templates/amd64/linux/egghunter.asm @@ -1,5 +1,4 @@ <% -import six from pwnlib.shellcraft import amd64, pretty, common from pwnlib.util.packing import pack, unpack from pwnlib.util.lists import group @@ -25,7 +24,7 @@ done = common.label('egghunter_done') next_page = common.label('egghunter_nextpage') egg_str = egg -if isinstance(egg, six.integer_types): +if isinstance(egg, int): egg_str = pack(egg, bytes=4) if len(egg_str) % 4: diff --git a/pwnlib/shellcraft/templates/amd64/linux/stage.asm b/pwnlib/shellcraft/templates/amd64/linux/stage.asm index 6c5a9b4b1..b06a3004e 100644 --- a/pwnlib/shellcraft/templates/amd64/linux/stage.asm +++ b/pwnlib/shellcraft/templates/amd64/linux/stage.asm @@ -1,5 +1,4 @@ <% -import six from pwnlib.shellcraft.amd64 import push from pwnlib.shellcraft.amd64.linux import read, readn, mmap from pwnlib import constants as C @@ -29,7 +28,7 @@ Example: protection = C.PROT_READ | C.PROT_WRITE | C.PROT_EXEC flags = C.MAP_ANONYMOUS | C.MAP_PRIVATE - assert isinstance(fd, six.integer_types) + assert isinstance(fd, int) %> %if length is None: /* How many bytes should we receive? */ diff --git a/pwnlib/shellcraft/templates/amd64/linux/syscall.asm b/pwnlib/shellcraft/templates/amd64/linux/syscall.asm index a1c971a1f..f3381901e 100644 --- a/pwnlib/shellcraft/templates/amd64/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/amd64/linux/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import amd64, pretty from pwnlib.constants import Constant from pwnlib.abi import linux_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> @@ -101,7 +100,7 @@ Example: <% append_cdq = False - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/amd64/mov.asm b/pwnlib/shellcraft/templates/amd64/mov.asm index e661bc120..a8016809c 100644 --- a/pwnlib/shellcraft/templates/amd64/mov.asm +++ b/pwnlib/shellcraft/templates/amd64/mov.asm @@ -4,7 +4,6 @@ from pwnlib.log import getLogger from pwnlib.shellcraft import eval, pretty, okay from pwnlib.shellcraft.registers import get_register, is_register, bits_required - import six log = getLogger('pwnlib.shellcraft.amd64.mov') %> <%page args="dest, src, stack_allowed = True"/> @@ -149,7 +148,7 @@ else: % else: mov ${dest}, ${src} % endif -% elif isinstance(src, six.integer_types): +% elif isinstance(src, int): ## Special case for zeroes ## XORing the 32-bit register clears the high 32 bits as well % if src == 0: diff --git a/pwnlib/shellcraft/templates/amd64/push.asm b/pwnlib/shellcraft/templates/amd64/push.asm index 1792f7ca6..e02d6bab6 100644 --- a/pwnlib/shellcraft/templates/amd64/push.asm +++ b/pwnlib/shellcraft/templates/amd64/push.asm @@ -5,7 +5,6 @@ from pwnlib import constants from pwnlib.shellcraft.registers import amd64 as regs from pwnlib.context import context as ctx # Ugly hack, mako will not let it be called context - from six import text_type import re %> <%page args="value"/> @@ -50,7 +49,7 @@ Example: is_reg = False if value in regs: is_reg = True - if not is_reg and isinstance(value, (str, text_type)): + if not is_reg and isinstance(value, (str, str)): try: with ctx.local(arch = 'amd64'): value = constants.eval(value) diff --git a/pwnlib/shellcraft/templates/amd64/pushstr.asm b/pwnlib/shellcraft/templates/amd64/pushstr.asm index 104ae2c51..6c35743a9 100644 --- a/pwnlib/shellcraft/templates/amd64/pushstr.asm +++ b/pwnlib/shellcraft/templates/amd64/pushstr.asm @@ -1,7 +1,6 @@ <% from pwnlib.util import lists, packing, fiddling from pwnlib.shellcraft import pretty - import six %>\ <%page args="string, append_null = True"/> <%docstring> @@ -62,7 +61,7 @@ Args: append_null (bool): Whether to append a single NULL-byte before pushing. <% - if isinstance(string, six.text_type): + if isinstance(string, str): string = string.encode('utf-8') if append_null and not string.endswith(b'\x00'): string += b'\x00' @@ -72,7 +71,7 @@ Args: def okay(s): return b'\n' not in s and b'\0' not in s - if six.indexbytes(string, -1) >= 128: + if string[-1] >= 128: extend = b'\xff' else: extend = b'\x00' diff --git a/pwnlib/shellcraft/templates/amd64/setregs.asm b/pwnlib/shellcraft/templates/amd64/setregs.asm index 11e8a430c..f7a424095 100644 --- a/pwnlib/shellcraft/templates/amd64/setregs.asm +++ b/pwnlib/shellcraft/templates/amd64/setregs.asm @@ -1,5 +1,4 @@ <% - import six from pwnlib.regsort import regsort from pwnlib.shellcraft import registers, eval from pwnlib.shellcraft.amd64 import mov @@ -51,7 +50,7 @@ if isinstance(edx, str): except NameError: pass -if isinstance(eax, six.integer_types) and isinstance(edx, six.integer_types) and eax >> 63 == edx: +if isinstance(eax, int) and isinstance(edx, int) and eax >> 63 == edx: cdq = True reg_context.pop('rdx') diff --git a/pwnlib/shellcraft/templates/amd64/xor.asm b/pwnlib/shellcraft/templates/amd64/xor.asm index 6e10f811f..e57db734e 100644 --- a/pwnlib/shellcraft/templates/amd64/xor.asm +++ b/pwnlib/shellcraft/templates/amd64/xor.asm @@ -1,5 +1,4 @@ <% - import six from pwnlib.shellcraft import pretty, common, amd64, registers from pwnlib.util.packing import pack, unpack from pwnlib.context import context as ctx @@ -46,7 +45,7 @@ else: key_str = key key_int = key - if isinstance(key, six.integer_types): + if isinstance(key, int): key_str = pack(key, bytes=4) else: key_int = unpack(key, 'all') diff --git a/pwnlib/shellcraft/templates/arm/freebsd/syscall.asm b/pwnlib/shellcraft/templates/arm/freebsd/syscall.asm index 421f1f1ae..14772e630 100644 --- a/pwnlib/shellcraft/templates/arm/freebsd/syscall.asm +++ b/pwnlib/shellcraft/templates/arm/freebsd/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import arm, pretty from pwnlib.constants import Constant from pwnlib.abi import freebsd_arm_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> @@ -28,7 +27,7 @@ Example: svc 0 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/arm/linux/egghunter.asm b/pwnlib/shellcraft/templates/arm/linux/egghunter.asm index 52ef1f6f8..79d8f8d8c 100644 --- a/pwnlib/shellcraft/templates/arm/linux/egghunter.asm +++ b/pwnlib/shellcraft/templates/arm/linux/egghunter.asm @@ -1,4 +1,3 @@ -<% import six %> <% from pwnlib.shellcraft.arm import mov %> <% from pwnlib.util.packing import unpack %> <% from pwnlib import constants %> @@ -15,7 +14,7 @@ first address of the page that contains that address. <% - if not isinstance(egg, six.integer_types): + if not isinstance(egg, int): if not len(egg) == 4: raise Exception('Egg should be either an integer or a four byte string') egg = unpack(egg) diff --git a/pwnlib/shellcraft/templates/arm/linux/open_file.asm b/pwnlib/shellcraft/templates/arm/linux/open_file.asm index ed914e188..50b62665b 100644 --- a/pwnlib/shellcraft/templates/arm/linux/open_file.asm +++ b/pwnlib/shellcraft/templates/arm/linux/open_file.asm @@ -1,4 +1,3 @@ -<% import six %> <%page args="filepath, flags = 'O_RDONLY', mode = 0644"/> <%docstring>Opens a file. Leaves the file descriptor in r0. @@ -21,7 +20,7 @@ Args: break filepath_out = ', '.join(filepath_out) - if isinstance(mode, six.integer_types): + if isinstance(mode, int): mode = hex(mode) %> %if expr(cpp("%s & O_CREAT" % flags, arch = 'arm', os = 'linux')): diff --git a/pwnlib/shellcraft/templates/arm/linux/syscall.asm b/pwnlib/shellcraft/templates/arm/linux/syscall.asm index de3f89ad3..ed7113b0a 100644 --- a/pwnlib/shellcraft/templates/arm/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/arm/linux/syscall.asm @@ -1,8 +1,7 @@ <% from pwnlib.shellcraft import arm, pretty - from pwnlib.constants import eval + from pwnlib.constants import Constant from pwnlib.abi import linux_arm_syscall as abi - from six import text_type %> <%page args="syscall = None, arg0 = None, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None, arg6 = None"/> <%docstring> @@ -49,8 +48,8 @@ Example: svc 0 <% - if isinstance(syscall, (str, text_type)) and syscall.startswith('SYS_'): - syscall_repr = syscall[4:] + "(%s)" + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): + syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: syscall_repr = 'syscall(%s)' diff --git a/pwnlib/shellcraft/templates/arm/mov.asm b/pwnlib/shellcraft/templates/arm/mov.asm index a030fbccb..615f065d5 100644 --- a/pwnlib/shellcraft/templates/arm/mov.asm +++ b/pwnlib/shellcraft/templates/arm/mov.asm @@ -4,7 +4,6 @@ from pwnlib.log import getLogger from pwnlib.shellcraft.registers import arm as regs from pwnlib.util import fiddling - import six log = getLogger('pwnlib.shellcraft.arm.mov') %> <%page args="dst, src"/> @@ -86,7 +85,7 @@ if not src in regs: %> %if src == dst: /* mov ${dst}, ${src} */ -%elif not isinstance(src, six.integer_types): +%elif not isinstance(src, int): mov ${dst}, ${src} %else: %if src == 0: diff --git a/pwnlib/shellcraft/templates/arm/pushstr.asm b/pwnlib/shellcraft/templates/arm/pushstr.asm index 8975a4d28..02391c23f 100644 --- a/pwnlib/shellcraft/templates/arm/pushstr.asm +++ b/pwnlib/shellcraft/templates/arm/pushstr.asm @@ -1,7 +1,6 @@ <% from pwnlib.util import lists, packing, fiddling %> <% from pwnlib.shellcraft.arm import push %> <% from pwnlib.shellcraft import pretty %> -<% import six %> <%page args="string, append_null = True, register='r7'"/> <%docstring> Pushes a string onto the stack. @@ -24,7 +23,7 @@ Examples: <% - if isinstance(string, six.text_type): + if isinstance(string, str): string = string.encode('utf-8') if append_null: diff --git a/pwnlib/shellcraft/templates/arm/xor.asm b/pwnlib/shellcraft/templates/arm/xor.asm index 6caf7435b..f83ce71bd 100644 --- a/pwnlib/shellcraft/templates/arm/xor.asm +++ b/pwnlib/shellcraft/templates/arm/xor.asm @@ -1,5 +1,4 @@ <% - import six from pwnlib.shellcraft import pretty, common, arm, registers from pwnlib.shellcraft.registers import arm as regs from pwnlib.util.packing import pack, unpack @@ -40,7 +39,7 @@ if not key in regs: key_str = key key_int = key - if isinstance(key, six.integer_types): + if isinstance(key, int): key_str = pack(key, bytes=4) else: key_int = unpack(key, 'all') diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/_llseek.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/_llseek.asm index 3eedc9c04..16486d575 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/_llseek.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/_llseek.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>_llseek(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/_newselect.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/_newselect.asm index 59d3f454d..8088d55fb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/_newselect.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/_newselect.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>_newselect(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/_sysctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/_sysctl.asm index c3084db0c..0a09d1204 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/_sysctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/_sysctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>_sysctl(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/accept.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/accept.asm index e4810e139..583488472 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/accept.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/accept.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>accept(fd, addr, addr_len) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/accept4.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/accept4.asm index d6a635dba..a5e32b84f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/accept4.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/accept4.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>accept4(fd, addr, addr_len, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/access.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/access.asm index f3fd88e0d..5bda13773 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/access.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/access.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>access(name, type) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/acct.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/acct.asm index c62eb386f..48c2e7d11 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/acct.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/acct.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>acct(name) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/add_key.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/add_key.asm index a9133a04f..f7fe92c26 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/add_key.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/add_key.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>add_key(type, description, payload, plen, keyring) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/adjtimex.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/adjtimex.asm index b170de61e..ba9cac4b7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/adjtimex.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/adjtimex.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>adjtimex(ntx) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/afs_syscall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/afs_syscall.asm index 1da013333..d267537e0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/afs_syscall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/afs_syscall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>afs_syscall(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/alarm.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/alarm.asm index df6c709dd..f77384ca9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/alarm.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/alarm.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>alarm(seconds) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/arch_prctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/arch_prctl.asm index 9b8f42e79..8a148134d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/arch_prctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/arch_prctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>arch_prctl(code, addr) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/arch_specific_syscall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/arch_specific_syscall.asm index 35736ab83..d7960ccb0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/arch_specific_syscall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/arch_specific_syscall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>arch_specific_syscall(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/arm_fadvise64_64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/arm_fadvise64_64.asm index b1d4aa1d4..46ad1c2dd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/arm_fadvise64_64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/arm_fadvise64_64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>arm_fadvise64_64(fd, advice, offset, length) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/arm_sync_file_range.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/arm_sync_file_range.asm index e65f4afb3..9a6c69ea4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/arm_sync_file_range.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/arm_sync_file_range.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>arm_sync_file_range(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/bdflush.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/bdflush.asm index 27eff5293..d5f3aacd9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/bdflush.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/bdflush.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>bdflush(func, data) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/bind.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/bind.asm index 0d4823ec4..8c05d947a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/bind.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/bind.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>bind(fd, addr, length) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/bpf.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/bpf.asm index ef074304c..ffc4085f2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/bpf.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/bpf.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>bpf(cmd, attr, size) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/break_.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/break_.asm index 1a3154c3b..ac92f53ad 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/break_.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/break_.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>break(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/brk.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/brk.asm index 8d0004dbd..26c72ac16 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/brk.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/brk.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>brk(addr) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/cachectl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/cachectl.asm index bdf66609a..7db8dfe3f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/cachectl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/cachectl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>cachectl(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/cacheflush.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/cacheflush.asm index 9515bf466..6d2e3146c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/cacheflush.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/cacheflush.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>cacheflush(addr, nbytes, cache) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/capget.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/capget.asm index ba767931b..c059d4610 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/capget.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/capget.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>capget(hdrp, datap) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/capset.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/capset.asm index 446741a7e..68e9e4271 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/capset.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/capset.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>capset(hdrp, datap) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/chdir.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/chdir.asm index 0ae1b46a3..0bbefe6d0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/chdir.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/chdir.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>chdir(path) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/chmod.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/chmod.asm index 894bd3fbe..9d6a78c92 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/chmod.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/chmod.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>chmod(file, mode) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/chown.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/chown.asm index df3b319d5..bf5970978 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/chown.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/chown.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>chown(file, owner, group) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/chown32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/chown32.asm index 037bcb418..9a28a5270 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/chown32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/chown32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>chown32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/chroot.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/chroot.asm index eabaf7f52..27828eccb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/chroot.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/chroot.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>chroot(path) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime.asm index 203d9eee9..bbeb27b89 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_adjtime(clock_id, utx) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime64.asm index 99f2c5d4b..760457fed 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_adjtime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_adjtime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres.asm index 1d457df04..51a2683d9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_getres(clock_id, res) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres_time64.asm index 8498e48c5..f0e3e0b6d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_getres_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_getres_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime.asm index 248180a7c..2cd18e11b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_gettime(clock_id, tp) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime64.asm index 89d1596ef..6ac9896cd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_gettime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_gettime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep.asm index bd9b1df65..9153a04e2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_nanosleep(clock_id, flags, req, rem) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep_time64.asm index 85bda7c76..a63a7f015 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_nanosleep_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_nanosleep_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime.asm index 03addde39..db9e2326f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_settime(clock_id, tp) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime64.asm index c5f9f772f..65d7cc9af 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clock_settime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clock_settime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clone.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clone.asm index 00a037dd6..85499d45f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clone.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clone.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clone(fn, child_stack, flags, arg, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/clone3.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/clone3.asm index 11003f6bd..782032f9a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/clone3.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/clone3.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>clone3(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/close.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/close.asm index ea9c2c6d5..bcf9fd289 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/close.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/close.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>close(fd) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm index ecb77a9b6..8e6ee2fe3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/close_range.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>close_range(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall close_range. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_close_range']) %> /* close_range(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/connect.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/connect.asm index a52f14952..e9f6d386f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/connect.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/connect.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>connect(fd, addr, length) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/copy_file_range.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/copy_file_range.asm index 98554b265..10705cf05 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/copy_file_range.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/copy_file_range.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>copy_file_range(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/creat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/creat.asm index 960f62087..b60173160 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/creat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/creat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>creat(file, mode) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/create_module.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/create_module.asm index 945cf2416..61db44cb1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/create_module.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/create_module.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>create_module(name, size) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/delete_module.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/delete_module.asm index 922a3d06d..4e2e3dc31 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/delete_module.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/delete_module.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>delete_module(name) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/dup.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/dup.asm index 60b0d8b05..d5711e282 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/dup.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/dup.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>dup(fd) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/dup2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/dup2.asm index f235bc3b4..9d3f79d7d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/dup2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/dup2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>dup2(fd, fd2) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/dup3.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/dup3.asm index e5f64888e..e85d14515 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/dup3.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/dup3.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>dup3(fd, fd2, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create.asm index a5fa95d3d..c4be353b4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_create(size) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create1.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create1.asm index aa174e1d8..ebe40f5fb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create1.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_create1.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_create1(flags) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl.asm index 09a3bcf98..5152052b4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_ctl(epfd, op, fd, event) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl_old.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl_old.asm index a90c18ac8..bccf9e185 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl_old.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_ctl_old.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_ctl_old(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait.asm index fd8e87fc0..57d85e000 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_pwait(epfd, events, maxevents, timeout, ss) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm index a06777704..175cfa104 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_pwait2.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>epoll_pwait2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall epoll_pwait2. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_epoll_pwait2']) %> /* epoll_pwait2(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait.asm index f6f44ba71..2704f873f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_wait(epfd, events, maxevents, timeout) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait_old.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait_old.asm index 49d2afe21..3caa809ca 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait_old.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/epoll_wait_old.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>epoll_wait_old(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd.asm index 6291327bb..36fcd6f5a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>eventfd(count, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd2.asm index c280701f7..8ad2a42e8 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/eventfd2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>eventfd2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/execve.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/execve.asm index 56df88bcc..43b0458a9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/execve.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/execve.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>execve(path, argv, envp) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/execveat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/execveat.asm index 473eee7f0..c2b8c4264 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/execveat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/execveat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>execveat(dirfd, pathname, argv, envp, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/exit.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/exit.asm index 60b8d4a23..16d8b9b61 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/exit.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/exit.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>exit(status) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/exit_group.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/exit_group.asm index f2e5ed35e..a0e180d6c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/exit_group.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/exit_group.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>exit_group(status) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat.asm index a1c015538..eceda32fc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>faccessat(fd, file, type, flag) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm index 5d6f05d18..0eafe64a7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/faccessat2.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>faccessat2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall faccessat2. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_faccessat2']) %> /* faccessat2(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64.asm index d364aa019..76dac2355 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fadvise64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64_64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64_64.asm index 4d4f99609..a374ff7af 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64_64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fadvise64_64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fadvise64_64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fallocate.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fallocate.asm index 9a4fae4dc..c6132d0a3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fallocate.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fallocate.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fallocate(fd, mode, offset, length) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_init.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_init.asm index 8e26f9fb5..7a6fd7e2a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_init.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_init.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fanotify_init(flags, event_f_flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_mark.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_mark.asm index 573f017e1..24fcd2fef 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_mark.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fanotify_mark.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fanotify_mark(fanotify_fd, flags, mask, dfd, pathname) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fchdir.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fchdir.asm index b15b46ae9..cdcdf9646 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fchdir.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fchdir.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fchdir(fd) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fchmod.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fchmod.asm index 1e0f14d42..c12e8eddb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fchmod.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fchmod.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fchmod(fd, mode) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fchmodat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fchmodat.asm index e1505fafe..2fc52b712 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fchmodat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fchmodat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fchmodat(fd, file, mode, flag) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fchown.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fchown.asm index b7ece230c..55c4fd5b4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fchown.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fchown.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fchown(fd, owner, group) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fchown32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fchown32.asm index 5dd88c2ac..e34a2bfc5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fchown32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fchown32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fchown32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fchownat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fchownat.asm index ff3b2cef7..423e8a0e2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fchownat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fchownat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fchownat(fd, file, owner, group, flag) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl.asm index 9a51d22fc..a056eb73b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fcntl(fd, cmd, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl64.asm index c237bb20e..7e3e044e5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fcntl64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fcntl64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fdatasync.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fdatasync.asm index 39ed0e3f5..1d32ed1df 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fdatasync.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fdatasync.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fdatasync(fildes) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fgetxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fgetxattr.asm index 804d7dd04..7bf41a574 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fgetxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fgetxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fgetxattr(fd, name, value, size) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/finit_module.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/finit_module.asm index 645f36f8a..204ac1978 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/finit_module.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/finit_module.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>finit_module(fd, param_values, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/flistxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/flistxattr.asm index 4e0bd4f7f..b86006498 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/flistxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/flistxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>flistxattr(fd, list, size) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/flock.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/flock.asm index 3670f5a42..8719d6a59 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/flock.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/flock.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>flock(fd, operation) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fork.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fork.asm index dedebd9ca..23f0e23ca 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fork.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fork.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fork() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fremovexattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fremovexattr.asm index 019d6752e..c05c49ad7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fremovexattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fremovexattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fremovexattr(fd, name) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fsconfig.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fsconfig.asm index 80bb5882e..da16decd8 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fsconfig.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fsconfig.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fsconfig(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fsetxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fsetxattr.asm index 8ea87914c..fff9d0c24 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fsetxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fsetxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fsetxattr(fd, name, value, size, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fsmount.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fsmount.asm index 5b9c1c2e3..52386947e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fsmount.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fsmount.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fsmount(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fsopen.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fsopen.asm index fe1ea366e..04709419a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fsopen.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fsopen.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fsopen(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fspick.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fspick.asm index e415cb9e7..4c890ed83 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fspick.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fspick.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fspick(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fstat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fstat.asm index 62b18ab5f..d7e31487f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fstat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fstat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fstat(fd, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fstat64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fstat64.asm index 610dbcaee..937698853 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fstat64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fstat64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fstat64(fd, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat.asm index 9996e8bdd..efa345a81 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fstatat(fd, file, buf, flag) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat64.asm index 1ba1bd221..d31c2455c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatat64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fstatat64(fd, file, buf, flag) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs.asm index 36b4f7ff9..aefded3fe 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fstatfs(fildes, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs64.asm index 9f353280b..dfe0c9842 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fstatfs64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fstatfs64(fildes, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/fsync.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/fsync.asm index ef0d54195..04cd60ac4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/fsync.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/fsync.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>fsync(fd) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ftime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ftime.asm index 60648689a..5332a6c55 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ftime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ftime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ftime(timebuf) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate.asm index f8fe31d3f..81ca30945 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ftruncate(fd, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate64.asm index 0b0a56a76..35d47afa4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ftruncate64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ftruncate64(fd, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/futex.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/futex.asm index 6512f2fd2..d0161b10e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/futex.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/futex.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>futex(uaddr, futex_op, val, timeout, uaddr2, val3) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/futex_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/futex_time64.asm index 2aff8eb8d..0f6a3ac44 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/futex_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/futex_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>futex_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/futimesat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/futimesat.asm index 6f8df453d..275cf0ea8 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/futimesat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/futimesat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>futimesat(fd, file, tvp) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/get_kernel_syms.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/get_kernel_syms.asm index 5caafed4d..808fca45d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/get_kernel_syms.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/get_kernel_syms.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>get_kernel_syms(table) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/get_mempolicy.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/get_mempolicy.asm index a9295e468..462bc2826 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/get_mempolicy.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/get_mempolicy.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>get_mempolicy(mode, nodemask, maxnode, addr, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/get_robust_list.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/get_robust_list.asm index 2c86b91ef..dc4b5fe1b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/get_robust_list.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/get_robust_list.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>get_robust_list(pid, head_ptr, len_ptr) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/get_thread_area.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/get_thread_area.asm index 14bb85b4f..019ccd7ff 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/get_thread_area.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/get_thread_area.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>get_thread_area(u_info) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getcpu.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getcpu.asm index 02f86d445..9b07aef33 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getcpu.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getcpu.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getcpu(cpu, node, tcache) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getcwd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getcwd.asm index f98346bf3..ab21a10a1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getcwd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getcwd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getcwd(buf, size) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getdents.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getdents.asm index 0a1818af1..4c46a0002 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getdents.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getdents.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getdents(fd, dirp, count) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getdents64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getdents64.asm index ea51af8d0..624c7e766 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getdents64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getdents64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getdents64(fd, dirp, count) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getegid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getegid.asm index f2e01cfc5..92325ba83 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getegid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getegid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getegid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getegid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getegid32.asm index fde842aa6..a42da03fc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getegid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getegid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getegid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid.asm index ae78ab76d..0b9eab4de 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>geteuid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid32.asm index 2aed2b383..34de0dfbe 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/geteuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>geteuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getgid.asm index 2e800d370..1521a6ab5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getgid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getgid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getgid32.asm index 74bb0f55d..7f305f727 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getgid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getgid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getgid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups.asm index 5b8a42ef7..629eed721 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getgroups(size, list) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups32.asm index be2695244..b84b853c7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getgroups32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getgroups32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getitimer.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getitimer.asm index 8f40e60ed..9b3740286 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getitimer.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getitimer.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getitimer(which, value) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getpeername.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getpeername.asm index f9a0ea4ed..fcdd0a307 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getpeername.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getpeername.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getpeername(fd, addr, length) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getpgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getpgid.asm index 7663b2885..50ebd4720 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getpgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getpgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getpgid(pid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getpgrp.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getpgrp.asm index 6b39026c0..a0282c14f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getpgrp.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getpgrp.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getpgrp() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getpid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getpid.asm index 60b16f950..5fc3701a3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getpid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getpid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getpid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getpmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getpmsg.asm index db65c32db..fc9e20674 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getpmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getpmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getpmsg(fildes, ctlptr, dataptr, bandp, flagsp) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getppid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getppid.asm index 0d5328462..7610341b0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getppid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getppid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getppid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getpriority.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getpriority.asm index 8087531ef..9f0e611f5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getpriority.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getpriority.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getpriority(which, who) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getrandom.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getrandom.asm index 67aa065c3..39107040f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getrandom.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getrandom.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getrandom(buf, buflen, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid.asm index 7dbf29dfc..44c14efe7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getresgid(rgid, egid, sgid) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid32.asm index f44acdb4f..ab69bbad5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getresgid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getresgid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid.asm index 88bfbf3db..9c0019ab4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getresuid(ruid, euid, suid) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid32.asm index ee04bbdbd..e7322b349 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getresuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getresuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getrlimit.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getrlimit.asm index 9ad22fffe..0d5244343 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getrlimit.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getrlimit.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getrlimit(resource, rlimits) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getrusage.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getrusage.asm index bee4d43f6..b9b62a2e6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getrusage.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getrusage.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getrusage(who, usage) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getsid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getsid.asm index 07a0f6bc9..ff5362030 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getsid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getsid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getsid(pid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getsockname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getsockname.asm index b2334aa11..05f1cbbd0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getsockname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getsockname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getsockname(fd, addr, length) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getsockopt.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getsockopt.asm index c8f07d5e3..b25b01e79 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getsockopt.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getsockopt.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getsockopt(fd, level, optname, optval, optlen) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/gettid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/gettid.asm index da4575ba2..1488caecf 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/gettid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/gettid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>gettid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/gettimeofday.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/gettimeofday.asm index 7be2da334..f875cb8b5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/gettimeofday.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/gettimeofday.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>gettimeofday(tv, tz) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getuid.asm index 69c3a0b5c..8a4c98426 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getuid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getuid32.asm index 9f9dc2dfb..1a07613a6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/getxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/getxattr.asm index 74c9b57a2..0536657cd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/getxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/getxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>getxattr(path, name, value, size) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/gtty.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/gtty.asm index 33eacdcb6..f7de16d19 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/gtty.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/gtty.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>gtty(fd, params) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_arch_prctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_arch_prctl.asm index 189916cce..75cf529a8 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_arch_prctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_arch_prctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ia32_arch_prctl(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_io_pgetevents.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_io_pgetevents.asm index 4b6955231..2e43aeeb4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_io_pgetevents.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_io_pgetevents.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ia32_io_pgetevents(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_rseq.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_rseq.asm index b6c1e2ae2..cecc10f06 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_rseq.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_rseq.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ia32_rseq(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_statx.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_statx.asm index e4102c40b..a1fec2f91 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_statx.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ia32_statx.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ia32_statx(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/idle.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/idle.asm index 3b95bd578..ac2c7f552 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/idle.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/idle.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>idle() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/init_module.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/init_module.asm index fd9f99455..f81379256 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/init_module.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/init_module.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>init_module(name, image) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_add_watch.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_add_watch.asm index 4475ac40a..e9b29d6b2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_add_watch.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_add_watch.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>inotify_add_watch(fd, name, mask) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init.asm index 50ecf6f6b..344e2e05f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>inotify_init() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init1.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init1.asm index 438d17a1a..05a57efa4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init1.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_init1.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>inotify_init1(flags) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_rm_watch.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_rm_watch.asm index 0dcf795ae..e5e409054 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_rm_watch.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/inotify_rm_watch.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>inotify_rm_watch(fd, wd) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_cancel.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_cancel.asm index 1a058fea9..cc4201986 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_cancel.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_cancel.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_cancel(ctx_id, iocb, result) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_destroy.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_destroy.asm index d2227f9da..906e28840 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_destroy.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_destroy.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_destroy(ctx_id) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_getevents.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_getevents.asm index 45e5309e5..d34b524da 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_getevents.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_getevents.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_getevents(ctx_id, min_nr, nr, events, timeout) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents.asm index bd04fa70d..b0d13fc83 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_pgetevents(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents_time64.asm index a710c44d8..28d22b0f0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_pgetevents_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_pgetevents_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_setup.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_setup.asm index d1b89c2f0..ba66169d3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_setup.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_setup.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_setup(nr_events, ctx_idp) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_submit.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_submit.asm index 3d7ee9386..939adcb9a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_submit.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_submit.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_submit(ctx_id, nr, iocbpp) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_enter.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_enter.asm index fd6c60c5f..7414b0393 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_enter.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_enter.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_uring_enter(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_register.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_register.asm index 1e8fbe0b9..7357ccb38 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_register.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_register.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_uring_register(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_setup.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_setup.asm index 80038170f..97532ea1d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_setup.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/io_uring_setup.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>io_uring_setup(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ioctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ioctl.asm index 5d6ddf920..366748092 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ioctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ioctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ioctl(fd, request, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ioperm.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ioperm.asm index b07f0ff1b..4ff6036d6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ioperm.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ioperm.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ioperm(from_, num, turn_on) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/iopl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/iopl.asm index e3a906816..96902ca1b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/iopl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/iopl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>iopl(level) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_get.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_get.asm index 8115fddd5..6c38e513a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_get.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_get.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ioprio_get(which, who) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_set.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_set.asm index e0e84503d..503fedee9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_set.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ioprio_set.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ioprio_set(which, who, ioprio) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ipc.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ipc.asm index 0fe71e4e1..56f5c1575 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ipc.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ipc.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ipc(call, first, second, third, ptr, fifth) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/kcmp.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/kcmp.asm index 5dccefea3..671638f17 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/kcmp.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/kcmp.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>kcmp(pid1, pid2, type, idx1, idx2) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_file_load.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_file_load.asm index bc839851d..7fbb05073 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_file_load.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_file_load.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>kexec_file_load(kernel_fd, initrd_fd, cmdline_len, cmdline, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_load.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_load.asm index 92820b487..fb8214b10 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_load.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/kexec_load.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>kexec_load(entry, nr_segments, segments, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/keyctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/keyctl.asm index 77603e94b..3b090f99e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/keyctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/keyctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>keyctl(cmd, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/kill.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/kill.asm index 05a1ca3be..f17201398 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/kill.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/kill.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>kill(pid, sig) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm index 920d91e97..84d52dd1e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_add_rule.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>landlock_add_rule(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall landlock_add_rule. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_landlock_add_rule']) %> /* landlock_add_rule(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm index 179d2f7f7..aaa28192c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_create_ruleset.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>landlock_create_ruleset(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall landlock_create_ruleset. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_landlock_create_ruleset']) %> /* landlock_create_ruleset(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm index 0a138bcc2..4a71d8acf 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/landlock_restrict_self.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>landlock_restrict_self(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall landlock_restrict_self. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_landlock_restrict_self']) %> /* landlock_restrict_self(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lchown.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lchown.asm index 1698624ac..aa0c21ec9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lchown.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lchown.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lchown(file, owner, group) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lchown32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lchown32.asm index 768ab6604..657fb6e01 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lchown32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lchown32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lchown32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lgetxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lgetxattr.asm index 8917d528d..d558d153d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lgetxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lgetxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lgetxattr(path, name, value, size) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/link.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/link.asm index e334411be..53645e24b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/link.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/link.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>link(from_, to) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/linkat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/linkat.asm index d297b2a6f..8b5cec9df 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/linkat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/linkat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>linkat(fromfd, from_, tofd, to, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/listen.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/listen.asm index 27e653036..e92eece37 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/listen.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/listen.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>listen(fd, n) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/listxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/listxattr.asm index f5759491b..9e1acdceb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/listxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/listxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>listxattr(path, list, size) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/llistxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/llistxattr.asm index e88e1e05c..32b93ab41 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/llistxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/llistxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>llistxattr(path, list, size) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lock.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lock.asm index db1075cbc..bcae2a859 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lock.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lock.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lock(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lookup_dcookie.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lookup_dcookie.asm index 3413214a1..09502d4fe 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lookup_dcookie.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lookup_dcookie.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lookup_dcookie(cookie, buffer, length) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lremovexattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lremovexattr.asm index 58a8ad722..a489edf0a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lremovexattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lremovexattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lremovexattr(path, name) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lseek.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lseek.asm index f367e155f..71ecdeaa0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lseek.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lseek.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lseek(fd, offset, whence) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lsetxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lsetxattr.asm index f7956d934..f749be612 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lsetxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lsetxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lsetxattr(path, name, value, size, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lstat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lstat.asm index 9bb908cd6..bb7b52f70 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lstat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lstat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lstat(file, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/lstat64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/lstat64.asm index b03993f28..98c19b5e3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/lstat64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/lstat64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>lstat64(file, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/madvise.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/madvise.asm index 622c4666c..de9e3f719 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/madvise.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/madvise.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>madvise(addr, length, advice) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/madvise1.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/madvise1.asm index d9e067a34..26cfe31d7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/madvise1.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/madvise1.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>madvise1(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mbind.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mbind.asm index c5b8ee210..22e05a434 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mbind.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mbind.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mbind(addr, length, mode, nodemask, maxnode, flags) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/membarrier.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/membarrier.asm index 6dc94e17d..9c3a1832f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/membarrier.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/membarrier.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>membarrier(cmd, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/memfd_create.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/memfd_create.asm index 63cbd15db..5d49ebc25 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/memfd_create.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/memfd_create.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>memfd_create(name, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/migrate_pages.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/migrate_pages.asm index 56b1d95a5..1c89ac92e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/migrate_pages.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/migrate_pages.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>migrate_pages(pid, maxnode, old_nodes, new_nodes) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mincore.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mincore.asm index f11c171ad..f5994e94d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mincore.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mincore.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mincore(start, length, vec) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mkdir.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mkdir.asm index 6d4184054..841196f05 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mkdir.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mkdir.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mkdir(path, mode) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mkdirat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mkdirat.asm index ad58eb582..aa31096dd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mkdirat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mkdirat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mkdirat(fd, path, mode) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mknod.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mknod.asm index ea011bae8..c9a73b22d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mknod.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mknod.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mknod(path, mode, dev) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mknodat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mknodat.asm index 283b824a3..e6a39f0d7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mknodat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mknodat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mknodat(fd, path, mode, dev) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mlock.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mlock.asm index a033065a8..43bf32c88 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mlock.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mlock.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mlock(addr, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mlock2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mlock2.asm index 8ee17fefe..dd312d06f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mlock2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mlock2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mlock2(addr, length, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mlockall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mlockall.asm index 92cbe1a00..2ed0ac691 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mlockall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mlockall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mlockall(flags) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mmap.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mmap.asm index 266bb7df5..bbd7932f0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mmap.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mmap.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mmap(addr, length, prot, flags, fd, offset) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mmap2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mmap2.asm index b510af4c0..746486803 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mmap2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mmap2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mmap2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/modify_ldt.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/modify_ldt.asm index d1f7e1f1d..3add61ad2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/modify_ldt.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/modify_ldt.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>modify_ldt(func, ptr, bytecount) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mount.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mount.asm index 4b8edba80..a1aa2226e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mount.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mount.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mount(special_file, dir, fstype, rwflag, data) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm index 33cc2f5af..2e4c2aecc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mount_setattr.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>mount_setattr(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall mount_setattr. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_mount_setattr']) %> /* mount_setattr(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/move_mount.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/move_mount.asm index df5d0474c..8e4609dce 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/move_mount.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/move_mount.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>move_mount(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/move_pages.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/move_pages.asm index 2642cd97e..7c5bf0ea7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/move_pages.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/move_pages.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>move_pages(pid, count, pages, nodes, status, flags) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mprotect.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mprotect.asm index 9a17360d0..123f02216 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mprotect.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mprotect.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mprotect(addr, length, prot) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mpx.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mpx.asm index 9cf1c128d..01fa857ff 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mpx.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mpx.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mpx(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_getsetattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_getsetattr.asm index fd25c20f6..e1b1e0dca 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_getsetattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_getsetattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_getsetattr(mqdes, newattr, oldattr) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_notify.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_notify.asm index 0173bd900..b221e7bc5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_notify.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_notify.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_notify(mqdes, notification) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_open.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_open.asm index d01e5c367..a77e0b846 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_open.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_open.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_open(name, oflag, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive.asm index 9923b112f..e99d07ab4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive_time64.asm index 547189127..fdb617e01 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedreceive_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_timedreceive_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend.asm index 0d955e259..ec68adf25 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend_time64.asm index 7d8f3dc76..51b288bcb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_timedsend_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_timedsend_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_unlink.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_unlink.asm index 210664eac..cb6a3dd4e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mq_unlink.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mq_unlink.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mq_unlink(name) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/mremap.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/mremap.asm index 68c3312ef..b7a49c46d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/mremap.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/mremap.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>mremap(addr, old_len, new_len, flags, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/msgctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/msgctl.asm index 4ea7f03be..34ba959b4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/msgctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/msgctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>msgctl(msqid, cmd, buf) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/msgget.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/msgget.asm index 56a6debb1..224db3891 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/msgget.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/msgget.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>msgget(key, msgflg) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/msgrcv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/msgrcv.asm index adcb1b2f7..3848b9202 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/msgrcv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/msgrcv.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>msgrcv(msqid, msgp, msgsz, msgtyp, msgflg) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/msgsnd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/msgsnd.asm index 9656f0c3f..c23d09e50 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/msgsnd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/msgsnd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>msgsnd(msqid, msgp, msgsz, msgflg) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/msync.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/msync.asm index 7e7bd2247..333deadca 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/msync.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/msync.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>msync(addr, length, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/multiplexer.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/multiplexer.asm new file mode 100644 index 000000000..d81e734cf --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/multiplexer.asm @@ -0,0 +1,101 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>multiplexer(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str + +Invokes the syscall multiplexer. + +See 'man 2 multiplexer' 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, vararg_5=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', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_multiplexer']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_multiplexer']) +%> + /* multiplexer(${', '.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/munlock.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/munlock.asm index ce5e529bb..b478c551f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/munlock.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/munlock.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>munlock(addr, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/munlockall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/munlockall.asm index 89c2cb620..6eaf69e55 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/munlockall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/munlockall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>munlockall() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/munmap.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/munmap.asm index 9fe5f2022..92e14930d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/munmap.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/munmap.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>munmap(addr, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/name_to_handle_at.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/name_to_handle_at.asm index 5890a006e..5094dd0ad 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/name_to_handle_at.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/name_to_handle_at.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>name_to_handle_at(dfd, name, handle, mnt_id, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/nanosleep.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/nanosleep.asm index 7605a85b5..5e9366217 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/nanosleep.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/nanosleep.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>nanosleep(requested_time, remaining) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/newfstatat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/newfstatat.asm index caac21dbc..a106f7a8f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/newfstatat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/newfstatat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>newfstatat(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/nfsservctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/nfsservctl.asm index 0e703ef4c..2ed2dd833 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/nfsservctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/nfsservctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>nfsservctl(cmd, argp, resp) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/nice.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/nice.asm index 50f1698e2..653d0d1ad 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/nice.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/nice.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>nice(inc) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/oldfstat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/oldfstat.asm index f6e6e8c65..5e2beeedc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/oldfstat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/oldfstat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>oldfstat(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/oldlstat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/oldlstat.asm index 630e68a0c..19422950b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/oldlstat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/oldlstat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>oldlstat(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/oldolduname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/oldolduname.asm index edd8ba6cc..0a5bc135e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/oldolduname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/oldolduname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>oldolduname(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/oldstat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/oldstat.asm index eb6cdb9cf..42c4bd56e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/oldstat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/oldstat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>oldstat(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/olduname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/olduname.asm index 0b64e97c8..d7f321855 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/olduname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/olduname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>olduname(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/open.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/open.asm index 297ee9488..04115bffd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/open.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/open.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>open(file, oflag, mode) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/open_by_handle_at.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/open_by_handle_at.asm index ace6e8874..688de7af1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/open_by_handle_at.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/open_by_handle_at.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>open_by_handle_at(mountdirfd, handle, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/open_tree.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/open_tree.asm index 39360db42..493a07644 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/open_tree.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/open_tree.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>open_tree(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/openat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/openat.asm index bb4c119fc..059f1f9de 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/openat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/openat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>openat(fd, file, oflag, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/openat2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/openat2.asm index b32d8b148..7d412e657 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/openat2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/openat2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>openat2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pause.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pause.asm index ede24fab7..d62d43c13 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pause.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pause.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pause() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_iobase.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_iobase.asm index f9e95552c..2ee0edc05 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_iobase.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_iobase.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pciconfig_iobase(which, bus, devfn) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_read.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_read.asm index f43526b18..09f550a13 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_read.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_read.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pciconfig_read(bus, dfn, off, length, buf) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_write.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_write.asm index 866f30c52..479c439c5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_write.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pciconfig_write.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pciconfig_write(bus, dfn, off, length, buf) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/perf_event_open.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/perf_event_open.asm index 963e5065f..3feb197ae 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/perf_event_open.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/perf_event_open.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>perf_event_open(attr, pid, cpu, group_fd, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/personality.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/personality.asm index 8337eaef9..e2c347215 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/personality.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/personality.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>personality(persona) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_getfd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_getfd.asm index 0ae267b6b..bd05ac068 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_getfd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_getfd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pidfd_getfd(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_open.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_open.asm index cbc72413d..40db93fc1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_open.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_open.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pidfd_open(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_send_signal.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_send_signal.asm index aa7a169d5..a0b413c1a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_send_signal.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pidfd_send_signal.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pidfd_send_signal(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pipe.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pipe.asm index 1872488ba..73f3cddcd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pipe.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pipe.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pipe(pipedes) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pipe2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pipe2.asm index 40ac96098..de1e300fc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pipe2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pipe2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pipe2(pipedes, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pivot_root.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pivot_root.asm index 4fb910f08..d96e9cbb3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pivot_root.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pivot_root.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pivot_root(new_root, put_old) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_alloc.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_alloc.asm index bd8a8d53a..c2d198abd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_alloc.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_alloc.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pkey_alloc(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_free.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_free.asm index e105aff82..133ee9095 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_free.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_free.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pkey_free(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_mprotect.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_mprotect.asm index e1d04165d..cc15fdc4f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_mprotect.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pkey_mprotect.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pkey_mprotect(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/poll.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/poll.asm index c5dfdfd86..da8281f54 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/poll.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/poll.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>poll(fds, nfds, timeout) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll.asm index 0cdae7946..bb0be39ee 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ppoll(fds, nfds, timeout, ss) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll_time64.asm index e21ad0f1e..53b6510e7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ppoll_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ppoll_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/prctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/prctl.asm index 7b803fa16..3aacf2bea 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/prctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/prctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>prctl(option, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pread.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pread.asm index 621493ead..57567bb39 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pread.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pread.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pread(fd, buf, nbytes, offset) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pread64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pread64.asm index b18fcd3db..2b31f7b78 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pread64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pread64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pread64(fd, buf, nbytes, offset) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/preadv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/preadv.asm index b008afdbf..c92d481b1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/preadv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/preadv.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>preadv(fd, iovec, count, offset) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/preadv2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/preadv2.asm index dfeb1ee86..d19f5f358 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/preadv2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/preadv2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>preadv2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/prlimit64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/prlimit64.asm index 3ee6c82b8..5795f0e18 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/prlimit64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/prlimit64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>prlimit64(pid, resource, new_limit, old_limit) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm index 6a6357a2c..b3af59569 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/process_madvise.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>process_madvise(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall process_madvise. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_process_madvise']) %> /* process_madvise(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_readv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_readv.asm index 338b4751f..f9d3a2628 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_readv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_readv.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>process_vm_readv(pid, lvec, liovcnt, rvec, riovcnt, flags) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_writev.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_writev.asm index d621ea8ef..0ce517fc0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_writev.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/process_vm_writev.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>process_vm_writev(pid, lvec, liovcnt, rvec, riovcnt, flags) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/prof.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/prof.asm index ff04c92a9..1c3f599b9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/prof.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/prof.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>prof(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/profil.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/profil.asm index 4fdf729c8..caa929952 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/profil.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/profil.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>profil(sample_buffer, size, offset, scale) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6.asm index bf3c0066c..33fa2f6d3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pselect6(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6_time64.asm index c7d657798..43f4fa34a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pselect6_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pselect6_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ptrace.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ptrace.asm index bb145c804..48270cdae 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ptrace.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ptrace.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ptrace(request, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/putpmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/putpmsg.asm index 566e21649..57eb29a1e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/putpmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/putpmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>putpmsg(fildes, ctlptr, dataptr, band, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite.asm index bf3c03cc6..39ba9b742 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pwrite(fd, buf, n, offset) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite64.asm index e55e74d72..13e8aeaae 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pwrite64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pwrite64(fd, buf, n, offset) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev.asm index 72bd4aaca..22d70f473 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pwritev(fd, iovec, count, offset) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev2.asm index 2f55f2db6..4276f0987 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/pwritev2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>pwritev2(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/query_module.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/query_module.asm index 17fac6174..edeecb167 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/query_module.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/query_module.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>query_module(name, which, buf, bufsize, ret) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/quotactl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/quotactl.asm index 486c56f51..faeec2503 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/quotactl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/quotactl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>quotactl(cmd, special, id, addr) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/read.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/read.asm index e6df22e8a..d7f285c12 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/read.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/read.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>read(fd, buf, nbytes) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/readahead.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/readahead.asm index 1efe333e3..520721057 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/readahead.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/readahead.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>readahead(fd, offset, count) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/readdir.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/readdir.asm index a776721d5..e3af9d44f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/readdir.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/readdir.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>readdir(dirp) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/readlink.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/readlink.asm index 4c0aadef5..c95e44891 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/readlink.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/readlink.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>readlink(path, buf, length) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/readlinkat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/readlinkat.asm index e8729579e..9fa7e2aa4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/readlinkat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/readlinkat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>readlinkat(fd, path, buf, length) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/readv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/readv.asm index 5369ca059..16f159342 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/readv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/readv.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>readv(fd, iovec, count) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/reboot.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/reboot.asm index 6864700d9..13aa123a7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/reboot.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/reboot.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>reboot(howto) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/recv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/recv.asm index fdc2a03f6..ab49aa4c6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/recv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/recv.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>recv(fd, buf, n, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/recvfrom.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/recvfrom.asm index 85621b800..4947dd9a6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/recvfrom.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/recvfrom.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>recvfrom(fd, buf, n, flags, addr, addr_len) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg.asm index ad072d59f..7b1c021df 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>recvmmsg(fd, vmessages, vlen, flags, tmo) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg_time64.asm index 05d465111..c5e408e57 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/recvmmsg_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>recvmmsg_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/recvmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/recvmsg.asm index a83867418..aed191e4a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/recvmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/recvmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>recvmsg(fd, message, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/remap_file_pages.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/remap_file_pages.asm index 1cd3d128f..40c60c2bc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/remap_file_pages.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/remap_file_pages.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>remap_file_pages(start, size, prot, pgoff, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/removexattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/removexattr.asm index 46eff9307..fd8634bc3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/removexattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/removexattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>removexattr(path, name) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/rename.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/rename.asm index a7d357413..7426ba50f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/rename.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/rename.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>rename(old, new) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/renameat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/renameat.asm index 1d44b10b9..b0e9706e4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/renameat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/renameat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>renameat(oldfd, old, newfd, new) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/renameat2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/renameat2.asm index 8a7ac1529..4f13a83af 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/renameat2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/renameat2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>renameat2(olddirfd, oldpath, newdirfd, newpath, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/request_key.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/request_key.asm index 30daef5a9..1bb88b2c5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/request_key.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/request_key.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>request_key(type, description, callout_info, keyring) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/reserved221.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/reserved221.asm index acbd67929..12c54ceea 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/reserved221.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/reserved221.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>reserved221(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/reserved82.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/reserved82.asm index fd2d049ed..357daae55 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/reserved82.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/reserved82.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>reserved82(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/restart_syscall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/restart_syscall.asm index 36f093533..cb55dc9f0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/restart_syscall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/restart_syscall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>restart_syscall() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm index 532c6802b..572d11d2b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/riscv_flush_icache.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>riscv_flush_icache(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall riscv_flush_icache. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_riscv_flush_icache']) %> /* riscv_flush_icache(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/rmdir.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/rmdir.asm index effc01603..05f6f40e7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/rmdir.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/rmdir.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>rmdir(path) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/rseq.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/rseq.asm index 934466fb1..9a2016d13 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/rseq.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/rseq.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>rseq(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/rtas.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/rtas.asm new file mode 100644 index 000000000..37add7a20 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/rtas.asm @@ -0,0 +1,101 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>rtas(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str + +Invokes the syscall rtas. + +See 'man 2 rtas' 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, vararg_5=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', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_rtas']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_rtas']) +%> + /* rtas(${', '.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/sched_get_priority_max.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_max.asm index bc7db37d4..21201f74b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_max.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_max.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_get_priority_max(algorithm) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_min.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_min.asm index 98b5f3b09..453487392 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_min.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_get_priority_min.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_get_priority_min(algorithm) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getaffinity.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getaffinity.asm index be2045848..35a5fc21b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getaffinity.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getaffinity.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_getaffinity(pid, cpusetsize, cpuset) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getattr.asm index aaa683f9a..92803fc05 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_getattr(pid, attr, size, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getparam.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getparam.asm index ab2c2a295..c4a8d8aa6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getparam.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getparam.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_getparam(pid, param) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getscheduler.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getscheduler.asm index 785352d91..b49fe5c4c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getscheduler.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_getscheduler.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_getscheduler(pid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval.asm index 4410a54b8..2527ef276 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_rr_get_interval(pid, t) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval_time64.asm index 8f8fc4d1d..a45e88b17 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_rr_get_interval_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_rr_get_interval_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setaffinity.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setaffinity.asm index 430b15ca6..a2bf83e52 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setaffinity.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setaffinity.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_setaffinity(pid, cpusetsize, cpuset) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setattr.asm index c252381ee..cfaa41b14 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_setattr(pid, attr, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setparam.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setparam.asm index b830473e9..699a4fec0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setparam.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setparam.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_setparam(pid, param) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setscheduler.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setscheduler.asm index 70bca5a1f..903b975ff 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setscheduler.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_setscheduler.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_setscheduler(pid, policy, param) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_yield.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_yield.asm index ce9b5a744..f2abed71c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sched_yield.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sched_yield.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sched_yield() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/seccomp.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/seccomp.asm index e34561170..cfe505738 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/seccomp.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/seccomp.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>seccomp(operation, flags, args) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/security.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/security.asm index 590b155f7..22f7b7217 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/security.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/security.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>security(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/select.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/select.asm index f79e38bff..a9349f750 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/select.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/select.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>select(nfds, readfds, writefds, exceptfds, timeout) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/semctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/semctl.asm index 10f618d19..e4eb3a29c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/semctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/semctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>semctl(semid, semnum, cmd, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/semget.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/semget.asm index 0ebbc25cd..d806c735c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/semget.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/semget.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>semget(key, nsems, semflg) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/semop.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/semop.asm index 442c33e8d..1ccf8e8c5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/semop.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/semop.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>semop(semid, sops, nsops) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop.asm index d05d8eace..f5168ffe2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>semtimedop(semid, sops, nsops, timeout) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop_time64.asm index 426e835a3..65ba7653d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/semtimedop_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>semtimedop_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/send.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/send.asm index 2004a1849..e8c7f2747 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/send.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/send.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>send(fd, buf, n, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile.asm index 7239231de..4ca4996e0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sendfile(out_fd, in_fd, offset, count) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile64.asm index 5c2e76143..c2c83f18c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sendfile64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sendfile64(out_fd, in_fd, offset, count) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sendmmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sendmmsg.asm index f0789ce1d..b307ce4b1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sendmmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sendmmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sendmmsg(fd, vmessages, vlen, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sendmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sendmsg.asm index b4f06d1c6..0499ea895 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sendmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sendmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sendmsg(fd, message, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sendto.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sendto.asm index 39d2ddd21..aed643252 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sendto.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sendto.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sendto(fd, buf, n, flags, addr, addr_len) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/set_mempolicy.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/set_mempolicy.asm index afae84492..64eadc3e8 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/set_mempolicy.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/set_mempolicy.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>set_mempolicy(mode, nodemask, maxnode) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/set_robust_list.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/set_robust_list.asm index e18a6f191..4e72d85a4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/set_robust_list.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/set_robust_list.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>set_robust_list(head, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/set_thread_area.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/set_thread_area.asm index 7338af023..84081fa9e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/set_thread_area.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/set_thread_area.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>set_thread_area(u_info) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/set_tid_address.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/set_tid_address.asm index 11ff295be..423d3afb0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/set_tid_address.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/set_tid_address.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>set_tid_address(tidptr) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setdomainname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setdomainname.asm index 2f6ad3a38..09ef7b53b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setdomainname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setdomainname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setdomainname(name, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid.asm index 64a5f507c..e467f561e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setfsgid(gid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid32.asm index ca825877a..0210db4c3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsgid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setfsgid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid.asm index 8b4b176c4..59597ea0b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setfsuid(uid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid32.asm index d94023391..b75d3e90d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setfsuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setfsuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setgid.asm index 76c967155..0238b18b4 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setgid(gid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setgid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setgid32.asm index 68e460152..15b98fa11 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setgid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setgid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setgid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups.asm index 74962f67d..0ec219829 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setgroups(n, groups) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups32.asm index e4bac6045..c5c62db31 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setgroups32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setgroups32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sethostname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sethostname.asm index f1ce026e7..7b2f52251 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sethostname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sethostname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sethostname(name, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setitimer.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setitimer.asm index 4c74e4cd9..dd5befe6b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setitimer.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setitimer.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setitimer(which, new, old) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setns.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setns.asm index 15de2a88b..f1d6db05d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setns.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setns.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setns(fd, nstype) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setpgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setpgid.asm index 2e52b89be..64bf684c2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setpgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setpgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setpgid(pid, pgid) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setpriority.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setpriority.asm index 2529371da..377000695 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setpriority.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setpriority.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setpriority(which, who, prio) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setregid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setregid.asm index f6a3f7aaf..fb28cc15d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setregid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setregid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setregid(rgid, egid) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setregid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setregid32.asm index fa6c87207..5b13a672d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setregid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setregid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setregid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid.asm index f6dd87cba..6dfca72a9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setresgid(rgid, egid, sgid) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid32.asm index 437a7e712..8e8e76d28 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setresgid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setresgid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid.asm index 521fdedff..435b30f7b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setresuid(ruid, euid, suid) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid32.asm index d8402fc50..2c9af542b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setresuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setresuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid.asm index 1846c3338..5f40eeaeb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setreuid(ruid, euid) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid32.asm index 533a719c0..376a666d3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setreuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setreuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setrlimit.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setrlimit.asm index 0bec32588..f4ad1e5b6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setrlimit.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setrlimit.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setrlimit(resource, rlimits) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setsid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setsid.asm index 215180fc0..f8bf32c4a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setsid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setsid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setsid() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setsockopt.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setsockopt.asm index bf81f45c4..5f5818e22 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setsockopt.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setsockopt.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setsockopt(fd, level, optname, optval, optlen) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/settimeofday.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/settimeofday.asm index c05371680..50c037a66 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/settimeofday.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/settimeofday.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>settimeofday(tv, tz) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setuid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setuid.asm index db7e485ed..298650bbd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setuid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setuid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setuid(uid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setuid32.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setuid32.asm index e1a0d0209..3c317048b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setuid32.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setuid32.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setuid32(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/setxattr.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/setxattr.asm index 2b5cb11d5..26cdf8fb2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/setxattr.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/setxattr.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>setxattr(path, name, value, size, flags) -> str @@ -56,8 +56,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sgetmask.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sgetmask.asm index 3580171a7..da04f13c3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sgetmask.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sgetmask.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sgetmask() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/shmat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/shmat.asm index 5b15dee8d..f44b5a8a7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/shmat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/shmat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>shmat(shmid, shmaddr, shmflg) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/shmctl.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/shmctl.asm index eb2a0fa5e..1a57433ec 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/shmctl.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/shmctl.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>shmctl(shmid, cmd, buf) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/shmdt.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/shmdt.asm index 932a96427..3da8141ea 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/shmdt.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/shmdt.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>shmdt(shmaddr) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/shmget.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/shmget.asm index d4f0b8422..299c71354 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/shmget.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/shmget.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>shmget(key, size, shmflg) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/shutdown.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/shutdown.asm index 581c79e5d..7a45cc6b7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/shutdown.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/shutdown.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>shutdown(ctx) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigaction.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigaction.asm index 95be329dd..669f52568 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigaction.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigaction.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigaction(sig, act, oact) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigaltstack.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigaltstack.asm index b6cc7fe32..f40827cd2 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigaltstack.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigaltstack.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigaltstack(ss, oss) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/signal.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/signal.asm index 17d775caf..cc67743f9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/signal.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/signal.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>signal(sig, handler) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd.asm index aad39bbfa..a9d501c18 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>signalfd(fd, mask, flags) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd4.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd4.asm index e9baec77f..e34d3a734 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd4.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/signalfd4.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>signalfd4(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigpending.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigpending.asm index bdfbcfb5d..a4e193961 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigpending.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigpending.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigpending(set) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigprocmask.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigprocmask.asm index 676b30028..e23c8c731 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigprocmask.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigprocmask.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigprocmask(how, set, oset) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigqueueinfo.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigqueueinfo.asm index 8f6101bdd..e96ded219 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigqueueinfo.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigqueueinfo.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigqueueinfo(tgid, sig, uinfo) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigreturn.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigreturn.asm index 1610c58e2..622837bbe 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigreturn.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigreturn.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigreturn(scp) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigsuspend.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigsuspend.asm index 8ecdf2818..f4d61505d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigsuspend.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigsuspend.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigsuspend(set) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait.asm index bfd1dca32..87e09ca3e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigtimedwait(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait_time64.asm index b8e6800a0..ecd2f3c1e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sigtimedwait_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sigtimedwait_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socket.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socket.asm index 082764e97..0d6e7b1eb 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socket.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socket.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socket(domain, type, protocol) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall.asm index 7bc3fa69a..e4b6da6ee 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall(call, args) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_accept.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_accept.asm index f935c7290..66e005af9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_accept.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_accept.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_accept(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_bind.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_bind.asm index 57096bdcd..a7577165e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_bind.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_bind.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_bind(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_connect.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_connect.asm index a52a450e3..2d7c4c685 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_connect.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_connect.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_connect(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getpeername.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getpeername.asm index 88366bf8e..cc821013e 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getpeername.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getpeername.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_getpeername(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockname.asm index 8e5d86405..1ed786ac1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_getsockname(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockopt.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockopt.asm index 9a29e9281..d284a1dcc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockopt.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_getsockopt.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_getsockopt(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_listen.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_listen.asm index a7b00be1f..dd99b1f5d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_listen.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_listen.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_listen(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recv.asm index a85eefb01..1028808df 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recv.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_recv(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvfrom.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvfrom.asm index 67a461e75..f229970b7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvfrom.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvfrom.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_recvfrom(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvmsg.asm index 1701d4f8b..f323bf7a7 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_recvmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_recvmsg(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_send.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_send.asm index c283bd3bc..9ef633f99 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_send.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_send.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_send(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendmsg.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendmsg.asm index 602ead26e..ccb538aef 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendmsg.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendmsg.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_sendmsg(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendto.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendto.asm index 0d8e37f24..1c2ffcd2d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendto.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_sendto.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_sendto(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_setsockopt.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_setsockopt.asm index aeda36e92..7c536a61b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_setsockopt.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_setsockopt.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_setsockopt(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_shutdown.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_shutdown.asm index 96d4b9262..603f9a0d9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_shutdown.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_shutdown.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_shutdown(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socket.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socket.asm index dbdb9e315..ee1548b12 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socket.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socket.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_socket(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socketpair.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socketpair.asm index bd2d2cf3c..0631c6439 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socketpair.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketcall_socketpair.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketcall_socketpair(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/socketpair.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/socketpair.asm index 666d0fb7e..848701892 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/socketpair.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/socketpair.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>socketpair(domain, type, protocol, fds) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/splice.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/splice.asm index df825e874..7fdd6f08b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/splice.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/splice.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>splice(fdin, offin, fdout, offout, length, flags) -> str @@ -57,8 +57,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/spu_create.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/spu_create.asm new file mode 100644 index 000000000..6caeed723 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/spu_create.asm @@ -0,0 +1,104 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>spu_create(pathname, flags, mode, neighbor_fd) -> str + +Invokes the syscall spu_create. + +See 'man 2 spu_create' for more information. + +Arguments: + pathname(char*): pathname + flags(int): flags + mode(mode_t): mode + neighbor_fd(int): neighbor_fd +Returns: + int + +<%page args="pathname=0, flags=0, mode=0, neighbor_fd=0"/> +<% + abi = pwnlib.abi.ABI.syscall() + stack = abi.stack + regs = abi.register_arguments[1:] + allregs = pwnlib.shellcraft.registers.current() + + can_pushstr = ['pathname'] + can_pushstr_array = [] + + argument_names = ['pathname', 'flags', 'mode', 'neighbor_fd'] + argument_values = [pathname, flags, mode, neighbor_fd] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_spu_create']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_spu_create']) +%> + /* spu_create(${', '.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/spu_run.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/spu_run.asm new file mode 100644 index 000000000..9d8b54e41 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/spu_run.asm @@ -0,0 +1,103 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>spu_run(fd, npc, event) -> str + +Invokes the syscall spu_run. + +See 'man 2 spu_run' for more information. + +Arguments: + fd(int): fd + npc(unsigned*): npc + event(unsigned*): event +Returns: + int + +<%page args="fd=0, npc=0, event=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', 'npc', 'event'] + argument_values = [fd, npc, event] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_spu_run']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_spu_run']) +%> + /* spu_run(${', '.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/ssetmask.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ssetmask.asm index 9e6623c16..eba536956 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ssetmask.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ssetmask.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ssetmask(newmask) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/stat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/stat.asm index 3be17fbe9..83a882222 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/stat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/stat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>stat(file, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/stat64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/stat64.asm index 2b6896671..b0b07f925 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/stat64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/stat64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>stat64(file, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/statfs.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/statfs.asm index dbf242535..8122fc67f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/statfs.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/statfs.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>statfs(file, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/statfs64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/statfs64.asm index 30b0e5ca8..907371f64 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/statfs64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/statfs64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>statfs64(file, buf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/statx.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/statx.asm index c8a693a04..ec3db668f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/statx.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/statx.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>statx(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/stime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/stime.asm index a729df423..41d524087 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/stime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/stime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>stime(when) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/stty.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/stty.asm index 5a2b8ccaa..7df96d658 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/stty.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/stty.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>stty(fd, params) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/subpage_prot.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/subpage_prot.asm new file mode 100644 index 000000000..3bfd54a87 --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/subpage_prot.asm @@ -0,0 +1,103 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>subpage_prot(addr, length, map) -> str + +Invokes the syscall subpage_prot. + +See 'man 2 subpage_prot' for more information. + +Arguments: + addr(unsigned): addr + length(unsigned): length + map(uint32_t*): map +Returns: + long + +<%page args="addr=0, length=0, map=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 = ['addr', 'length', 'map'] + argument_values = [addr, length, map] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_subpage_prot']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_subpage_prot']) +%> + /* subpage_prot(${', '.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/swapcontext.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/swapcontext.asm new file mode 100644 index 000000000..afebb938e --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/swapcontext.asm @@ -0,0 +1,102 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>swapcontext(oucp, ucp) -> str + +Invokes the syscall swapcontext. + +See 'man 2 swapcontext' for more information. + +Arguments: + oucp(ucontext_t*): oucp + ucp(ucontext_t*): ucp +Returns: + int + +<%page args="oucp=0, ucp=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 = ['oucp', 'ucp'] + argument_values = [oucp, ucp] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_swapcontext']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_swapcontext']) +%> + /* swapcontext(${', '.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/swapoff.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/swapoff.asm index 7988e9512..f48d89f18 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/swapoff.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/swapoff.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>swapoff(path) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/swapon.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/swapon.asm index 966f5e719..e0490d942 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/swapon.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/swapon.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>swapon(path, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/switch_endian.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/switch_endian.asm new file mode 100644 index 000000000..9165a01ee --- /dev/null +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/switch_endian.asm @@ -0,0 +1,101 @@ +<% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! +import collections +import pwnlib.abi +import pwnlib.constants +import pwnlib.shellcraft +%> +<%docstring>switch_endian(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str + +Invokes the syscall switch_endian. + +See 'man 2 switch_endian' 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, vararg_5=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', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] + + # 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[name] = 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, (bytes, bytearray, str)): + if isinstance(arg, str): + 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[name] = arg + + # Some syscalls have different names on various architectures. + # Determine which syscall number to use for the current architecture. + for syscall in ['SYS_switch_endian']: + if hasattr(pwnlib.constants, syscall): + break + else: + raise Exception("Could not locate any syscalls: %r" % ['SYS_switch_endian']) +%> + /* switch_endian(${', '.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/symlink.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/symlink.asm index 6d7bdec87..ea11db9db 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/symlink.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/symlink.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>symlink(from_, to) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/symlinkat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/symlinkat.asm index 44a146b94..29b37b8fe 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/symlinkat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/symlinkat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>symlinkat(from_, tofd, to) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sync.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sync.asm index 244804221..67f24693f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sync.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sync.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sync() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range.asm index 106f2cdfd..9f32d9ec5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sync_file_range(fd, offset, count, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range2.asm index a516eea19..4cf1da7cc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sync_file_range2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sync_file_range2(fd, flags, offset, nbytes) -> str @@ -51,12 +51,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -79,7 +79,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -87,7 +87,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_sync_file_range2']) %> /* sync_file_range2(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/syncfs.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/syncfs.asm index 77894516b..63c966ba0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/syncfs.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/syncfs.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>syncfs(fd) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sys_kexec_load.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sys_kexec_load.asm index c67f2dd42..61c6c6919 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sys_kexec_load.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sys_kexec_load.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sys_kexec_load(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/syscall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/syscall.asm index 03c6ec0e2..ed24b86c3 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/syscall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/syscall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>syscall(sysno, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sysfs.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sysfs.asm index c2b3aaa74..a28834fef 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sysfs.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sysfs.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sysfs(option) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sysinfo.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sysinfo.asm index a756a0b2d..4fd0480d5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sysinfo.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sysinfo.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sysinfo(info) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/syslog.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/syslog.asm index 19cb3b51d..1ae00efdd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/syslog.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/syslog.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>syslog(pri, fmt, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sysmips.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sysmips.asm index cea4f4e21..9500ef235 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sysmips.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sysmips.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>sysmips(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm index d65886016..ce7c33dda 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/sysriscv.asm @@ -1,11 +1,11 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! 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 +<%docstring>sysriscv(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str Invokes the syscall sysriscv. @@ -16,7 +16,7 @@ Arguments: Returns: long -<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None"/> +<%page args="vararg_0=None, vararg_1=None, vararg_2=None, vararg_3=None, vararg_4=None, vararg_5=None"/> <% abi = pwnlib.abi.ABI.syscall() stack = abi.stack @@ -26,8 +26,8 @@ Returns: 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] + argument_names = ['vararg_0', 'vararg_1', 'vararg_2', 'vararg_3', 'vararg_4', 'vararg_5'] + argument_values = [vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5] # Load all of the arguments into their destination registers / stack slots. register_arguments = dict() @@ -48,12 +48,12 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[index] = arg + stack_arguments[name] = 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg @@ -76,7 +76,7 @@ Returns: target = regs[index] register_arguments[target] = arg elif arg is not None: - stack_arguments[target] = arg + stack_arguments[name] = arg # Some syscalls have different names on various architectures. # Determine which syscall number to use for the current architecture. @@ -84,7 +84,7 @@ Returns: if hasattr(pwnlib.constants, syscall): break else: - raise Exception("Could not locate any syscalls: %r" % syscalls) + raise Exception("Could not locate any syscalls: %r" % ['SYS_sysriscv']) %> /* sysriscv(${', '.join(syscall_repr)}) */ %for name, arg in string_arguments.items(): diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/tee.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/tee.asm index 3e45f1246..c6163ffd6 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/tee.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/tee.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>tee(fdin, fdout, length, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/tgkill.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/tgkill.asm index f8d81c40d..7adc249bc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/tgkill.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/tgkill.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>tgkill(tgid, tid, sig) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/tgsigqueueinfo.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/tgsigqueueinfo.asm index 2cbb2fb48..133cb5f50 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/tgsigqueueinfo.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/tgsigqueueinfo.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>tgsigqueueinfo(tgid, tid, sig, uinfo) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/time.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/time.asm index fb47c7616..8c531bf31 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/time.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/time.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>time(timer) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_create.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_create.asm index 587fffc00..4c1d2a11d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_create.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_create.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_create(clock_id, evp, timerid) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_delete.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_delete.asm index 048c02465..25c90a1ba 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_delete.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_delete.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_delete(timerid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_getoverrun.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_getoverrun.asm index e00097653..9296bb661 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_getoverrun.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_getoverrun.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_getoverrun(timerid) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime.asm index 6e0d9b984..7838427af 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_gettime(timerid, value) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime64.asm index 2eca15382..23508a763 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_gettime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_gettime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime.asm index 2297b341c..b28433885 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_settime(timerid, flags, value, ovalue) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime64.asm index 6d2445a43..2f6e76182 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timer_settime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timer_settime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd.asm index b55c6a3c9..eb3ae0e41 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timerfd(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_create.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_create.asm index 5f4ffe1a0..fe8fa2fa9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_create.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_create.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timerfd_create(clock_id, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime.asm index eafdab35d..377feb381 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timerfd_gettime(ufd, otmr) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime64.asm index 7bb53b938..175ecde7a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_gettime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timerfd_gettime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime.asm index a10932e40..47e73dc44 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timerfd_settime(ufd, flags, utmr, otmr) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime64.asm index 52f33750a..9a77e41c5 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/timerfd_settime64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>timerfd_settime64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/times.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/times.asm index 055bbffb0..5c7feb756 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/times.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/times.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>times(buffer) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/tkill.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/tkill.asm index 85815e666..6029aac75 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/tkill.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/tkill.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>tkill(tid, sig) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/truncate.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/truncate.asm index 56081278d..a89a69b70 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/truncate.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/truncate.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>truncate(file, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/truncate64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/truncate64.asm index 64676a3f2..61d3392ac 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/truncate64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/truncate64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>truncate64(file, length) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/tuxcall.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/tuxcall.asm index c50126577..845a7ef69 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/tuxcall.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/tuxcall.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>tuxcall(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ugetrlimit.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ugetrlimit.asm index 33f1743a6..29a4e68c1 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ugetrlimit.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ugetrlimit.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ugetrlimit(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ulimit.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ulimit.asm index dd14a9509..7d0a8df84 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ulimit.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ulimit.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ulimit(cmd, vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/umask.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/umask.asm index 1edda3bc0..6d00d9904 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/umask.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/umask.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>umask(mask) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/umount.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/umount.asm index 6a5e71a1e..7b33f4f43 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/umount.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/umount.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>umount(special_file) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/umount2.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/umount2.asm index 4513cc314..c8500facc 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/umount2.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/umount2.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>umount2(special_file, flags) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/uname.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/uname.asm index 4acb894e8..2f8cd2d91 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/uname.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/uname.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>uname(name) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/unlink.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/unlink.asm index 77c04a43f..270c79f81 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/unlink.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/unlink.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>unlink(name) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/unlinkat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/unlinkat.asm index 14044bbe3..2c4f3751a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/unlinkat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/unlinkat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>unlinkat(fd, name, flag) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/unshare.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/unshare.asm index f7bbf5b76..8b31cfb6a 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/unshare.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/unshare.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>unshare(flags) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/uselib.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/uselib.asm index 8e55a878c..2cf67f7f9 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/uselib.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/uselib.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>uselib(library) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/userfaultfd.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/userfaultfd.asm index bf4462517..f1ce9692c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/userfaultfd.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/userfaultfd.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>userfaultfd(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/ustat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/ustat.asm index 36039daab..fa014944d 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/ustat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/ustat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>ustat(dev, ubuf) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/utime.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/utime.asm index 33aa64fbc..b5364904b 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/utime.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/utime.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>utime(file, file_times) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat.asm index c346e2b74..d05d62e1f 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>utimensat(fd, path, times, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat_time64.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat_time64.asm index 13eb78491..788ddbc08 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat_time64.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/utimensat_time64.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>utimensat_time64(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/utimes.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/utimes.asm index 30cff2a7a..a1907be47 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/utimes.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/utimes.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>utimes(file, tvp) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/vfork.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/vfork.asm index 0d0444f7e..7da395769 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/vfork.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/vfork.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>vfork() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/vhangup.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/vhangup.asm index b78351b19..79c56ed63 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/vhangup.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/vhangup.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>vhangup() -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/vm86.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/vm86.asm index a824d1425..3897713de 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/vm86.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/vm86.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>vm86(fn, v86) -> str @@ -53,8 +53,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/vm86old.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/vm86old.asm index 269fabceb..81a73a6fd 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/vm86old.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/vm86old.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>vm86old(info) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/vmsplice.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/vmsplice.asm index a7256608d..b6ad4f380 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/vmsplice.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/vmsplice.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>vmsplice(fdout, iov, count, flags) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/vserver.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/vserver.asm index 5ce055aee..701049149 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/vserver.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/vserver.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>vserver(vararg_0, vararg_1, vararg_2, vararg_3, vararg_4, vararg_5) -> str @@ -52,8 +52,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/wait4.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/wait4.asm index c51f92045..3250d53cf 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/wait4.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/wait4.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>wait4(pid, stat_loc, options, usage) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/waitid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/waitid.asm index abeb66dd4..2fec78c46 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/waitid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/waitid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>waitid(idtype, id, infop, options) -> str @@ -55,8 +55,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/waitpid.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/waitpid.asm index 2a9f09024..7d38c20a0 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/waitpid.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/waitpid.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>waitpid(pid, stat_loc, options) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/write.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/write.asm index 24e7f17af..dfe91a416 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/write.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/write.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>write(fd, buf, n) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/common/linux/syscalls/writev.asm b/pwnlib/shellcraft/templates/common/linux/syscalls/writev.asm index 0d23c5f58..20aa14c6c 100644 --- a/pwnlib/shellcraft/templates/common/linux/syscalls/writev.asm +++ b/pwnlib/shellcraft/templates/common/linux/syscalls/writev.asm @@ -1,9 +1,9 @@ <% +# Auto-generated by pwnlib/data/syscalls/generate.py. DO NOT EDIT! import collections import pwnlib.abi import pwnlib.constants import pwnlib.shellcraft -import six %> <%docstring>writev(fd, iovec, count) -> str @@ -54,8 +54,8 @@ Returns: # 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): + elif name in can_pushstr and isinstance(arg, (bytes, bytearray, str)): + if isinstance(arg, str): arg = arg.encode('utf-8') string_arguments[name] = arg diff --git a/pwnlib/shellcraft/templates/i386/cgc/syscall.asm b/pwnlib/shellcraft/templates/i386/cgc/syscall.asm index d7774cf0e..4be7781b6 100644 --- a/pwnlib/shellcraft/templates/i386/cgc/syscall.asm +++ b/pwnlib/shellcraft/templates/i386/cgc/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import i386 from pwnlib.constants import Constant from pwnlib.abi import linux_i386_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> @@ -13,7 +12,7 @@ Any of the arguments can be expressions to be evaluated by :func:`pwnlib.constan <% append_cdq = False - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/i386/freebsd/syscall.asm b/pwnlib/shellcraft/templates/i386/freebsd/syscall.asm index 3bbd24291..eb33cf676 100644 --- a/pwnlib/shellcraft/templates/i386/freebsd/syscall.asm +++ b/pwnlib/shellcraft/templates/i386/freebsd/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import i386, pretty from pwnlib.constants import Constant from pwnlib.abi import freebsd_i386_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> @@ -60,7 +59,7 @@ Example: int 0x80 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/i386/linux/egghunter.asm b/pwnlib/shellcraft/templates/i386/linux/egghunter.asm index c8bb72c51..c6e5702e5 100644 --- a/pwnlib/shellcraft/templates/i386/linux/egghunter.asm +++ b/pwnlib/shellcraft/templates/i386/linux/egghunter.asm @@ -1,5 +1,4 @@ <% -import six from pwnlib.shellcraft import i386, pretty, common from pwnlib.util.packing import pack, unpack from pwnlib.util.lists import group @@ -25,7 +24,7 @@ done = common.label('egghunter_done') next_page = common.label('egghunter_nextpage') egg_str = egg -if isinstance(egg, six.integer_types): +if isinstance(egg, int): egg_str = pack(egg) if len(egg_str) % 4: diff --git a/pwnlib/shellcraft/templates/i386/linux/stage.asm b/pwnlib/shellcraft/templates/i386/linux/stage.asm index 7687e9a08..bc781243b 100644 --- a/pwnlib/shellcraft/templates/i386/linux/stage.asm +++ b/pwnlib/shellcraft/templates/i386/linux/stage.asm @@ -1,5 +1,4 @@ <% -import six from pwnlib.shellcraft.i386 import push from pwnlib.shellcraft.i386.linux import read, readn, mmap from pwnlib import constants as C @@ -30,7 +29,7 @@ Example: protection = C.PROT_READ | C.PROT_WRITE | C.PROT_EXEC flags = C.MAP_ANONYMOUS | C.MAP_PRIVATE - assert isinstance(fd, six.integer_types) + assert isinstance(fd, int) %> %if length is None: /* How many bytes should we receive? */ diff --git a/pwnlib/shellcraft/templates/i386/linux/syscall.asm b/pwnlib/shellcraft/templates/i386/linux/syscall.asm index 8e493ec27..bf09ab5ee 100644 --- a/pwnlib/shellcraft/templates/i386/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/i386/linux/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import i386, pretty from pwnlib.constants import Constant from pwnlib.abi import linux_i386_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> @@ -85,7 +84,7 @@ Example: int 0x80 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/i386/mov.asm b/pwnlib/shellcraft/templates/i386/mov.asm index e3f1db511..5a719d872 100644 --- a/pwnlib/shellcraft/templates/i386/mov.asm +++ b/pwnlib/shellcraft/templates/i386/mov.asm @@ -3,7 +3,6 @@ from pwnlib.util import lists, packing, fiddling, misc from pwnlib.log import getLogger from pwnlib.shellcraft.registers import get_register, is_register, bits_required - import six log = getLogger('pwnlib.shellcraft.i386.mov') %> <%page args="dest, src, stack_allowed = True"/> @@ -143,7 +142,7 @@ else: % else: mov ${dest}, ${src} % endif -% elif isinstance(src, six.integer_types): +% elif isinstance(src, int): ## Special case for zeroes % if src == 0: xor ${dest}, ${dest} diff --git a/pwnlib/shellcraft/templates/i386/push.asm b/pwnlib/shellcraft/templates/i386/push.asm index 0efa07257..110b6ff87 100644 --- a/pwnlib/shellcraft/templates/i386/push.asm +++ b/pwnlib/shellcraft/templates/i386/push.asm @@ -3,7 +3,6 @@ from pwnlib.shellcraft import i386 from pwnlib import constants from pwnlib.shellcraft.registers import get_register, is_register, bits_required - from six import text_type import re %> <%page args="value"/> @@ -49,7 +48,7 @@ Example: value_orig = value is_reg = get_register(value) -if not is_reg and isinstance(value, (str, text_type)): +if not is_reg and isinstance(value, (str, str)): try: value = constants.eval(value) except (ValueError, AttributeError): diff --git a/pwnlib/shellcraft/templates/i386/pushstr.asm b/pwnlib/shellcraft/templates/i386/pushstr.asm index ae0ad9668..796b3c137 100644 --- a/pwnlib/shellcraft/templates/i386/pushstr.asm +++ b/pwnlib/shellcraft/templates/i386/pushstr.asm @@ -1,7 +1,6 @@ <% from pwnlib.util import lists, packing, fiddling from pwnlib.shellcraft import pretty, okay - import six %> <%page args="string, append_null = True"/> <%docstring> @@ -63,22 +62,22 @@ Args: <% original = string -if isinstance(string, six.text_type): +if isinstance(string, str): string = packing._need_bytes(string, 2, 0x80) else: string = packing.flat(string) if append_null: string += b'\x00' - if isinstance(original, six.binary_type): + if isinstance(original, bytes): original += b'\x00' - elif isinstance(original, six.text_type): + elif isinstance(original, str): original += '\x00' if not string: return -if six.indexbytes(string, -1) >= 128: +if string[-1] >= 128: extend = b'\xff' else: extend = b'\x00' diff --git a/pwnlib/shellcraft/templates/i386/setregs.asm b/pwnlib/shellcraft/templates/i386/setregs.asm index e05328daa..104e5c7cd 100644 --- a/pwnlib/shellcraft/templates/i386/setregs.asm +++ b/pwnlib/shellcraft/templates/i386/setregs.asm @@ -1,5 +1,4 @@ <% - import six from pwnlib.regsort import regsort from pwnlib.constants import Constant, eval from pwnlib.shellcraft import registers @@ -45,7 +44,7 @@ if isinstance(edx, str): except NameError: pass -if isinstance(eax, six.integer_types) and isinstance(edx, six.integer_types) and eax >> 31 == edx: +if isinstance(eax, int) and isinstance(edx, int) and eax >> 31 == edx: cdq = True reg_context.pop('edx') diff --git a/pwnlib/shellcraft/templates/i386/xor.asm b/pwnlib/shellcraft/templates/i386/xor.asm index 462b133fc..1e3795e59 100644 --- a/pwnlib/shellcraft/templates/i386/xor.asm +++ b/pwnlib/shellcraft/templates/i386/xor.asm @@ -1,5 +1,4 @@ <% - import six from pwnlib.shellcraft import pretty, common, i386, registers from pwnlib.util.packing import pack, unpack from pwnlib.context import context as ctx @@ -46,7 +45,7 @@ else: key_str = key key_int = key - if isinstance(key, six.integer_types): + if isinstance(key, int): key_str = pack(key, bytes=4) else: key_int = unpack(key, 'all') diff --git a/pwnlib/shellcraft/templates/loongarch64/__doc__ b/pwnlib/shellcraft/templates/loongarch64/__doc__ new file mode 100644 index 000000000..8b823d815 --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/__doc__ @@ -0,0 +1 @@ +Shellcraft module containing generic LoongArch64 shellcodes. diff --git a/pwnlib/shellcraft/templates/loongarch64/linux/__doc__ b/pwnlib/shellcraft/templates/loongarch64/linux/__doc__ new file mode 100644 index 000000000..a4c44edc9 --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/linux/__doc__ @@ -0,0 +1 @@ +Shellcraft module containing LoongArch64 shellcodes for Linux. diff --git a/pwnlib/shellcraft/templates/loongarch64/linux/syscall.asm b/pwnlib/shellcraft/templates/loongarch64/linux/syscall.asm new file mode 100644 index 000000000..b9228c1a1 --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/linux/syscall.asm @@ -0,0 +1,110 @@ +<% + from pwnlib.shellcraft import loongarch64, pretty + from pwnlib.constants import Constant + from pwnlib.abi import linux_loongarch64_syscall as abi +%> +<%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.loongarch64.linux.syscall('SYS_execve', 1, 'sp', 2, 0).rstrip()) + addi.d $a0, $r0, 1 + addi.d $a1, $sp, 0 + addi.d $a2, $r0, 2 + addi.d $a3, $r0, 0 + addi.d $a7, $r0, 221 + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.linux.syscall('SYS_execve', 2, 1, 0, 20).rstrip()) + addi.d $a0, $r0, 2 + addi.d $a1, $r0, 1 + addi.d $a2, $r0, 0 + addi.d $a3, $r0, 20 + addi.d $a7, $r0, 221 + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.linux.syscall().rstrip()) + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.linux.syscall('a7', 'a0', 'a1').rstrip()) + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.linux.syscall('a3', None, None, 1).rstrip()) + addi.d $a2, $r0, 1 + addi.d $a7, $a3, 0 + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.linux.syscall( + ... 'SYS_mmap', 0, 0x1000, + ... 'PROT_READ | PROT_WRITE | PROT_EXEC', + ... 'MAP_PRIVATE', + ... -1, 0).rstrip()) + addi.d $a0, $r0, 0 + addi.d $a1, $r0, 1 + lu52i.d $a1, $a1, 0 + addi.d $a2, $r0, 7 + addi.d $a3, $r0, 2 + addi.d $a4, $r0, 15 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + addi.d $a5, $r0, 0 + addi.d $a7, $r0, 222 + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.linux.syscall( + ... 'SYS_mmap', 0, 0x1000, + ... 'PROT_READ | PROT_WRITE | PROT_EXEC', + ... 'MAP_PRIVATE', + ... -1, 0).rstrip()) + addi.d $a0, $r0, 0 + addi.d $a1, $r0, 1 + lu52i.d $a1, $a1, 0 + addi.d $a2, $r0, 7 + addi.d $a3, $r0, 2 + addi.d $a4, $r0, 15 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + lu52i.d $a4, $a4, -1 + addi.d $a5, $r0, 0 + addi.d $a7, $r0, 222 + syscall 0 + >>> print(pwnlib.shellcraft.loongarch64.openat('AT_FDCWD', '/home/pwn/flag').rstrip()) + /* openat(fd='AT_FDCWD', file='/home/pwn/flag', oflag=0) */ + addi.d $t8, $r0, 7 + lu52i.d $t8, $t8, 1904 + lu52i.d $t8, $t8, 758 + lu52i.d $t8, $t8, 1389 + lu52i.d $t8, $t8, 1782 + lu52i.d $t8, $t8, -2001 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + addi.d $t8, $r0, 1654 + lu52i.d $t8, $t8, 364 + lu52i.d $t8, $t8, 1634 + lu52i.d $t8, $t8, -146 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + addi.d $a1, $sp, 0 + addi.d $a0, $r0, 15 + lu52i.d $a0, $a0, -1 + lu52i.d $a0, $a0, -1 + lu52i.d $a0, $a0, -1 + lu52i.d $a0, $a0, -1 + lu52i.d $a0, $a0, -100 + addi.d $a2, $r0, 0 + addi.d $a7, $r0, 56 + syscall 0 + +<% + registers = abi.register_arguments + arguments = [syscall, arg0, arg1, arg2, arg3, arg4, arg5] + regctx = dict(zip(registers, arguments)) +%>\ +%if any(a is not None for a in arguments): +${loongarch64.setregs(regctx)} +%endif + syscall 0 diff --git a/pwnlib/shellcraft/templates/loongarch64/linux/syscalls b/pwnlib/shellcraft/templates/loongarch64/linux/syscalls new file mode 120000 index 000000000..82bc97edb --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/linux/syscalls @@ -0,0 +1 @@ +../../common/linux/syscalls \ No newline at end of file diff --git a/pwnlib/shellcraft/templates/loongarch64/mov.asm b/pwnlib/shellcraft/templates/loongarch64/mov.asm new file mode 100644 index 000000000..3956a792a --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/mov.asm @@ -0,0 +1,89 @@ +<% + 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 loongarch64, registers, pretty, okay + log = getLogger('pwnlib.shellcraft.loongarch64.mov') +%> +<%page args="dst, src"/> +<%docstring> +Move src into dst. + +If src is a string that is not a register, then it will locally set +`context.arch` to `'loongarch64'` 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`. + +There is no effort done to avoid newlines and null bytes in the generated code. + +Args: + + dst (str): The destination register. + src (str): Either the input register, or an immediate value. + +Example: + + >>> print(shellcraft.loongarch64.mov('t0', 0).rstrip()) + addi.d $t0, $r0, 0 + >>> print(shellcraft.loongarch64.mov('t0', 0x2000).rstrip()) + addi.d $t0, $r0, 2 + lu52i.d $t0, $t0, 0 + >>> print(shellcraft.loongarch64.mov('t0', 0xcafebabe).rstrip()) + addi.d $t0, $r0, 202 + lu52i.d $t0, $t0, -21 + lu52i.d $t0, $t0, -1346 + >>> print(shellcraft.loongarch64.mov('t1', 'sp').rstrip()) + addi.d $t1, $sp, 0 + + +<% +if not isinstance(dst, str) or dst not in registers.loongarch64: + log.error("Unknown register %r", dst) + return + +if isinstance(src, str) and src not in registers.loongarch64: + src = eval(src) + +if isinstance(src, str) and src not in registers.loongarch64: + log.error("Unknown register %r", src) + return + +src_reg = registers.loongarch64.get(src, None) +dst_reg = registers.loongarch64[dst] + +# If source register is zero, treat it as immediate 0 +if src_reg == 0: + src = 0 + src_reg = None +%> + +% if dst_reg == 0 or dst_reg == src_reg: + /* ld ${dst}, ${src} is a noop */ +% elif src_reg is not None: + addi.d $${dst}, $${src}, 0 +% 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 + +% if src == 0: + addi.d $${dst}, $r0, 0 +% else: +<% +parts = [] +fullsrc = src +while src != 0: + parts.append(packing.unpack(packing.pack((src & 0xfff), word_size=12, sign=False), word_size=12, sign=True)) + src = src >> 12 +%> +% for idx, part in enumerate(reversed(parts)): + % if idx == 0: + addi.d $${dst}, $r0, ${part} + % else: + lu52i.d $${dst}, $${dst}, ${part} + % endif +% endfor +% endif +% endif diff --git a/pwnlib/shellcraft/templates/loongarch64/nop.asm b/pwnlib/shellcraft/templates/loongarch64/nop.asm new file mode 100644 index 000000000..ebd713f2a --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/nop.asm @@ -0,0 +1,2 @@ +<%docstring>LoongArch64 nop instruction. + addi.d $r0, $r0, 0 diff --git a/pwnlib/shellcraft/templates/loongarch64/push.asm b/pwnlib/shellcraft/templates/loongarch64/push.asm new file mode 100644 index 000000000..52f82482b --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/push.asm @@ -0,0 +1,26 @@ +<% + from pwnlib.shellcraft import loongarch64 + from pwnlib import constants + from pwnlib.shellcraft import registers +%> +<%page args="value"/> +<%docstring> +Pushes a value onto the stack. + +Register t8 is not guaranteed to be preserved. + +<% +is_reg = value in registers.loongarch64 + +if not is_reg and isinstance(value, (bytes, str)): + try: + value = constants.eval(value) + except (ValueError, AttributeError): + pass +%> +% if not is_reg: + ${loongarch64.mov('t8', value)} + <% value = 't8' %>\ +%endif + addi.d $sp, $sp, -8 + st.d $${value}, $sp, 0 diff --git a/pwnlib/shellcraft/templates/loongarch64/pushstr.asm b/pwnlib/shellcraft/templates/loongarch64/pushstr.asm new file mode 100644 index 000000000..292d0d9c2 --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/pushstr.asm @@ -0,0 +1,80 @@ +<% + from pwnlib.util import lists, packing, fiddling + from pwnlib.shellcraft import loongarch64, pretty +%>\ +<%page args="string, append_null = True"/> +<%docstring> +Pushes a string onto the stack. + +There is no effort done to avoid newlines and null bytes in the generated code. + +Register t8 is not guaranteed to be preserved. + +Example: + + >>> print(shellcraft.loongarch64.pushstr('').rstrip()) + st.d $r0, -8(sp) + >>> print(shellcraft.loongarch64.pushstr('a').rstrip()) + addi.d $t8, $r0, 97 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + >>> print(shellcraft.loongarch64.pushstr('aa').rstrip()) + addi.d $t8, $r0, 6 + lu52i.d $t8, $t8, 353 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + >>> print(shellcraft.loongarch64.pushstr('aaaa').rstrip()) + addi.d $t8, $r0, 97 + lu52i.d $t8, $t8, 1558 + lu52i.d $t8, $t8, 353 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + >>> print(shellcraft.loongarch64.pushstr('aaaaa').rstrip()) + addi.d $t8, $r0, 6 + lu52i.d $t8, $t8, 353 + lu52i.d $t8, $t8, 1558 + lu52i.d $t8, $t8, 353 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + >>> print(shellcraft.loongarch64.pushstr('aaaa', append_null = False).rstrip()) + addi.d $t8, $r0, 97 + lu52i.d $t8, $t8, 1558 + lu52i.d $t8, $t8, 353 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + >>> print(shellcraft.loongarch64.pushstr(b'\xc3').rstrip()) + addi.d $t8, $r0, 195 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + >>> print(shellcraft.loongarch64.pushstr(b'\xc3', append_null = False).rstrip()) + addi.d $t8, $r0, 195 + addi.d $sp, $sp, -8 + st.d $t8, $sp, 0 + +Args: + string (str): The string to push. + append_null (bool): Whether to append a single NULL-byte before pushing. + +<% + if isinstance(string, str): + 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 +%>\ +% for index, word in enumerate(split_string): +% if word == b'\x00\x00\x00\x00\x00\x00\x00\x00': + st.d $r0, ${stack_offset+(8 * index)}(sp) +<% + continue +%>\ +% endif +<% + word = packing.u64(word, sign=True) +%>\ + ${loongarch64.push(word)} +% endfor diff --git a/pwnlib/shellcraft/templates/loongarch64/pushstr_array.asm b/pwnlib/shellcraft/templates/loongarch64/pushstr_array.asm new file mode 100644 index 000000000..fe6cf9708 --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/pushstr_array.asm @@ -0,0 +1,37 @@ +<% from pwnlib.shellcraft import loongarch64, 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 + +%>\ + ${loongarch64.pushstr(array_str)} + ${loongarch64.mov(reg, 0)} + ${loongarch64.push(reg)} +% for i,arg in enumerate(reversed(array)): + ${loongarch64.mov(reg, offset + word_size*i - len(arg))} + addi.d $${reg}, $sp, $${reg} + ${loongarch64.push(reg)} + <% offset -= len(arg) %>\ +% endfor + ${loongarch64.mov(reg,'sp')} diff --git a/pwnlib/shellcraft/templates/loongarch64/setregs.asm b/pwnlib/shellcraft/templates/loongarch64/setregs.asm new file mode 100644 index 000000000..66eedda6e --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/setregs.asm @@ -0,0 +1,41 @@ +<% + from pwnlib.regsort import regsort + from pwnlib.constants import Constant, eval + from pwnlib.shellcraft import registers + from pwnlib.shellcraft import loongarch64 +%> +<%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()) + addi.d $a3, $r0, 0 + addi.d $t0, $r0, 1 + >>> print(shellcraft.setregs({'a0':'a1', 'a1':'a0', 'a2':'a1'}).rstrip()) + addi.d $a2, $a1, 0 + xor $a1, $a1, $a0 /* xchg a1, a0 */ + xor $a0, $a0, $a1 + xor $a1, $a1, $a0 + +<% +reg_context = {k:v for k,v in reg_context.items() if v is not None} +sorted_regs = regsort(reg_context, registers.loongarch64) +%> +% if sorted_regs: +% for how, src, dst in regsort(reg_context, registers.loongarch64): +% if how == 'xchg': + ${loongarch64.xor(dst, dst, src)} /* xchg ${dst}, ${src} */ + ${loongarch64.xor(src, src, dst)} + ${loongarch64.xor(dst, dst, src)} +% else: + ${loongarch64.mov(src, dst)} +% endif +% endfor +% endif diff --git a/pwnlib/shellcraft/templates/loongarch64/trap.asm b/pwnlib/shellcraft/templates/loongarch64/trap.asm new file mode 100644 index 000000000..e75c7c34f --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/trap.asm @@ -0,0 +1,2 @@ +<%docstring>A trap instruction. + break 0 diff --git a/pwnlib/shellcraft/templates/loongarch64/xor.asm b/pwnlib/shellcraft/templates/loongarch64/xor.asm new file mode 100644 index 000000000..24b979b29 --- /dev/null +++ b/pwnlib/shellcraft/templates/loongarch64/xor.asm @@ -0,0 +1,23 @@ +<% + from pwnlib.shellcraft import loongarch64 + 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.loongarch64: + log.error("Unknown register %r", dst) + return +if not isinstance(rs1, str) or rs1 not in registers.loongarch64: + log.error("Unknown register %r", rs1) + return +if not isinstance(rs2, str) or rs2 not in registers.loongarch64: + log.error("Unknown register %r", rs2) + return + +%> + xor $${dst}, $${rs1}, $${rs2} diff --git a/pwnlib/shellcraft/templates/mips/freebsd/syscall.asm b/pwnlib/shellcraft/templates/mips/freebsd/syscall.asm index 391955f75..f8c5bf981 100644 --- a/pwnlib/shellcraft/templates/mips/freebsd/syscall.asm +++ b/pwnlib/shellcraft/templates/mips/freebsd/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import mips, pretty from pwnlib.constants import Constant from pwnlib.abi import freebsd_mips_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> @@ -53,7 +52,7 @@ Example: syscall 0x40404 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/mips/linux/syscall.asm b/pwnlib/shellcraft/templates/mips/linux/syscall.asm index 07cf02f6c..ea19cdbea 100644 --- a/pwnlib/shellcraft/templates/mips/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/mips/linux/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import mips, pretty from pwnlib.constants import Constant from pwnlib.abi import linux_mips_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> @@ -88,7 +87,7 @@ Example: syscall 0x40404 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/mips/mov.asm b/pwnlib/shellcraft/templates/mips/mov.asm index 9eb795f3a..4d307fc7b 100644 --- a/pwnlib/shellcraft/templates/mips/mov.asm +++ b/pwnlib/shellcraft/templates/mips/mov.asm @@ -4,7 +4,6 @@ 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 mips, registers, pretty, okay - import six log = getLogger('pwnlib.shellcraft.mips.mov') %> <%page args="dst, src"/> @@ -109,7 +108,7 @@ if src_reg == 0: ${mips.mov('$t9', src)} ${mips.mov(dst, '$t9')} %endif -% elif isinstance(src, six.integer_types): +% elif isinstance(src, int): ## Everything else is the general case for moving into registers. <% srcp = packing.pack(src, word_size=32) diff --git a/pwnlib/shellcraft/templates/mips/push.asm b/pwnlib/shellcraft/templates/mips/push.asm index 43dc293a9..ca29b818e 100644 --- a/pwnlib/shellcraft/templates/mips/push.asm +++ b/pwnlib/shellcraft/templates/mips/push.asm @@ -3,7 +3,6 @@ from pwnlib.shellcraft import mips from pwnlib import constants from pwnlib.shellcraft import registers - from six import text_type, binary_type import re %> <%page args="value"/> @@ -14,7 +13,7 @@ Pushes a value onto the stack. value_orig = value is_reg = value in registers.mips -if not is_reg and isinstance(value, (binary_type, text_type)): +if not is_reg and isinstance(value, (bytes, str)): try: value = constants.eval(value) except (ValueError, AttributeError): diff --git a/pwnlib/shellcraft/templates/mips/pushstr.asm b/pwnlib/shellcraft/templates/mips/pushstr.asm index e4025a148..2bacfe62a 100644 --- a/pwnlib/shellcraft/templates/mips/pushstr.asm +++ b/pwnlib/shellcraft/templates/mips/pushstr.asm @@ -1,7 +1,6 @@ <% from pwnlib.util import lists, packing, fiddling from pwnlib.shellcraft import mips, pretty - import six %>\ <%page args="string, append_null = True"/> <%docstring> @@ -74,7 +73,7 @@ Args: append_null (bool): Whether to append a single NULL-byte before pushing. <% - if isinstance(string, six.text_type): + if isinstance(string, str): string = string.encode('utf-8') if append_null: string += b'\x00' diff --git a/pwnlib/shellcraft/templates/riscv64/linux/kill.asm b/pwnlib/shellcraft/templates/riscv64/linux/kill.asm new file mode 120000 index 000000000..118bebff8 --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/linux/kill.asm @@ -0,0 +1 @@ +../../common/linux/kill.asm \ No newline at end of file diff --git a/pwnlib/shellcraft/templates/riscv64/linux/sleep.asm b/pwnlib/shellcraft/templates/riscv64/linux/sleep.asm new file mode 120000 index 000000000..5949528ed --- /dev/null +++ b/pwnlib/shellcraft/templates/riscv64/linux/sleep.asm @@ -0,0 +1 @@ +../../common/linux/sleep.asm \ No newline at end of file diff --git a/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm b/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm index 85bd4bdd1..1d6766758 100644 --- a/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/riscv64/linux/syscall.asm @@ -2,7 +2,6 @@ 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> @@ -79,7 +78,7 @@ Example: ecall <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/riscv64/mov.asm b/pwnlib/shellcraft/templates/riscv64/mov.asm index 8005b47d1..4feaff586 100644 --- a/pwnlib/shellcraft/templates/riscv64/mov.asm +++ b/pwnlib/shellcraft/templates/riscv64/mov.asm @@ -4,7 +4,6 @@ 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"/> diff --git a/pwnlib/shellcraft/templates/riscv64/push.asm b/pwnlib/shellcraft/templates/riscv64/push.asm index 0a9f97adc..10f6ded49 100644 --- a/pwnlib/shellcraft/templates/riscv64/push.asm +++ b/pwnlib/shellcraft/templates/riscv64/push.asm @@ -2,7 +2,6 @@ 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> @@ -13,7 +12,7 @@ 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)): +if not is_reg and isinstance(value, (bytes, str)): try: value = constants.eval(value) except (ValueError, AttributeError): diff --git a/pwnlib/shellcraft/templates/riscv64/pushstr.asm b/pwnlib/shellcraft/templates/riscv64/pushstr.asm index 252536e27..e7aae9961 100644 --- a/pwnlib/shellcraft/templates/riscv64/pushstr.asm +++ b/pwnlib/shellcraft/templates/riscv64/pushstr.asm @@ -1,7 +1,6 @@ <% from pwnlib.util import lists, packing, fiddling from pwnlib.shellcraft import riscv64, pretty - import six %>\ <%page args="string, append_null = True"/> <%docstring> @@ -71,7 +70,7 @@ Args: append_null (bool): Whether to append a single NULL-byte before pushing. <% - if isinstance(string, six.text_type): + if isinstance(string, str): string = string.encode('utf-8') if append_null: string += b'\x00' diff --git a/pwnlib/shellcraft/templates/thumb/freebsd/syscall.asm b/pwnlib/shellcraft/templates/thumb/freebsd/syscall.asm index ec4238e3a..9598d5da7 100644 --- a/pwnlib/shellcraft/templates/thumb/freebsd/syscall.asm +++ b/pwnlib/shellcraft/templates/thumb/freebsd/syscall.asm @@ -2,7 +2,6 @@ from pwnlib.shellcraft import thumb, pretty from pwnlib.constants import Constant from pwnlib.abi import freebsd_arm_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> @@ -28,7 +27,7 @@ Example: svc 0x41 <% - if isinstance(syscall, (str, text_type, Constant)) and str(syscall).startswith('SYS_'): + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: diff --git a/pwnlib/shellcraft/templates/thumb/linux/stage.asm b/pwnlib/shellcraft/templates/thumb/linux/stage.asm index bc480401a..635c5bf7f 100644 --- a/pwnlib/shellcraft/templates/thumb/linux/stage.asm +++ b/pwnlib/shellcraft/templates/thumb/linux/stage.asm @@ -1,5 +1,4 @@ <% -import six from pwnlib.shellcraft.thumb import push from pwnlib.shellcraft.thumb.linux import read, readn, mmap from pwnlib import constants as C @@ -29,7 +28,7 @@ Example: protection = C.PROT_READ | C.PROT_WRITE | C.PROT_EXEC flags = C.MAP_ANONYMOUS | C.MAP_PRIVATE - assert isinstance(fd, six.integer_types) + assert isinstance(fd, int) %> %if length is None: /* How many bytes should we receive? */ diff --git a/pwnlib/shellcraft/templates/thumb/linux/syscall.asm b/pwnlib/shellcraft/templates/thumb/linux/syscall.asm index d0720c3ea..dbb102c89 100644 --- a/pwnlib/shellcraft/templates/thumb/linux/syscall.asm +++ b/pwnlib/shellcraft/templates/thumb/linux/syscall.asm @@ -1,8 +1,7 @@ <% from pwnlib.shellcraft import thumb, pretty - from pwnlib.constants import eval + from pwnlib.constants import Constant from pwnlib.abi import linux_arm_syscall as abi - from six import text_type %> <%page args="syscall = None, arg0 = None, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None, arg6 = None"/> <%docstring> @@ -57,8 +56,8 @@ Example: <% - if isinstance(syscall, (str, text_type)) and syscall.startswith('SYS_'): - syscall_repr = syscall[4:] + "(%s)" + if isinstance(syscall, (str, Constant)) and str(syscall).startswith('SYS_'): + syscall_repr = str(syscall)[4:] + "(%s)" args = [] else: syscall_repr = 'syscall(%s)' diff --git a/pwnlib/shellcraft/templates/thumb/mov.asm b/pwnlib/shellcraft/templates/thumb/mov.asm index 2ce65b37e..2bf11ce48 100644 --- a/pwnlib/shellcraft/templates/thumb/mov.asm +++ b/pwnlib/shellcraft/templates/thumb/mov.asm @@ -3,7 +3,6 @@ from pwnlib.log import getLogger from pwnlib.util import fiddling from pwnlib.context import context as ctx # Ugly hack, mako will not let it be called context - import six %> <%page args="dst, src"/> <%docstring> @@ -60,7 +59,7 @@ Example: <% log = getLogger(__name__) src_orig = src -if isinstance(src, (six.binary_type, six.text_type)): +if isinstance(src, (bytes, str)): src = src.strip() if src.lower() in registers.arm: src = src.lower() @@ -110,7 +109,7 @@ if not src in registers.arm: %> % if dst == src: /* moving ${src} into ${dst}, but this is a no-op */ -% elif not isinstance(src, six.integer_types): +% elif not isinstance(src, int): mov ${dst}, ${src} % else: <% diff --git a/pwnlib/shellcraft/templates/thumb/push.asm b/pwnlib/shellcraft/templates/thumb/push.asm index 00a65bb33..a2939cf0c 100644 --- a/pwnlib/shellcraft/templates/thumb/push.asm +++ b/pwnlib/shellcraft/templates/thumb/push.asm @@ -3,7 +3,6 @@ from pwnlib.shellcraft import thumb, registers, pretty from pwnlib import constants from pwnlib.context import context as ctx # Ugly hack, mako will not let it be called context - import six import re %> <%page args="value"/> @@ -50,7 +49,7 @@ Example: value_orig = value is_register = value in registers.arm -if not is_register and isinstance(value, (six.binary_type, six.text_type)): +if not is_register and isinstance(value, (bytes, str)): try: with ctx.local(arch = 'thumb'): value = constants.eval(value) @@ -60,7 +59,7 @@ if not is_register and isinstance(value, (six.binary_type, six.text_type)): % if is_register: push {${value}} -% elif isinstance(value, six.integer_types): +% elif isinstance(value, int): /* push ${pretty(value_orig, False)} */ ${re.sub(r'^\s*/.*\n', '', thumb.pushstr(packing.pack(value), False), 1)} % else: diff --git a/pwnlib/shellcraft/templates/thumb/pushstr.asm b/pwnlib/shellcraft/templates/thumb/pushstr.asm index be227c9d2..1aca76b96 100644 --- a/pwnlib/shellcraft/templates/thumb/pushstr.asm +++ b/pwnlib/shellcraft/templates/thumb/pushstr.asm @@ -1,7 +1,6 @@ <% from pwnlib.shellcraft import thumb, pretty from pwnlib.util import lists, packing - import six %> <%page args="string, append_null = True, register = 'r7'"/> <%docstring> @@ -36,7 +35,7 @@ on your version of binutils. <% - if isinstance(string, six.text_type): + if isinstance(string, str): string = string.encode('utf-8') if append_null: string += b'\x00' diff --git a/pwnlib/term/key.py b/pwnlib/term/key.py index e21477a46..2ce8eda98 100644 --- a/pwnlib/term/key.py +++ b/pwnlib/term/key.py @@ -4,7 +4,6 @@ import errno import os import select -import six import string import sys @@ -149,7 +148,7 @@ def __repr__(self): return self.__str__() def __eq__(self, other): - if isinstance(other, (six.text_type, six.binary_type)): + if isinstance(other, (bytes, str)): return Matcher(other)(self) elif isinstance(other, Matcher): return other(self) @@ -284,7 +283,7 @@ def _csi_ss3(cmd, args): return k def _csi_u(cmd, args): - k = Key(kc.TYPE_UNICODE, six.unichr(args[0])) + k = Key(kc.TYPE_UNICODE, chr(args[0])) if len(args) > 1 and args[1]: k.mods |= args[1] - 1 return k @@ -457,17 +456,17 @@ def _peek_simple(): if c0 == 0: k.code = u' ' elif chr(c0 + 0x40) in string.ascii_uppercase: - k.code = six.unichr(c0 + 0x60) + k.code = chr(c0 + 0x60) else: - k.code = six.unichr(c0 + 0x40) + k.code = chr(c0 + 0x40) k.mods |= kc.MOD_CTRL elif c0 == 0x7f: # print('del\r') k = Key(kc.TYPE_KEYSYM, kc.KEY_DEL) elif c0 >= 0x20 and c0 < 0x80: - k = Key(kc.TYPE_UNICODE, six.unichr(c0)) + k = Key(kc.TYPE_UNICODE, chr(c0)) else: - k = Key(kc.TYPE_UNICODE, six.unichr(c0 - 0x40), kc.MOD_CTRL | kc.MOD_ALT) + k = Key(kc.TYPE_UNICODE, chr(c0 - 0x40), kc.MOD_CTRL | kc.MOD_ALT) else: # utf8 n = 0 if c0 & 0b11100000 == 0b11000000: diff --git a/pwnlib/term/readline.py b/pwnlib/term/readline.py index d9c03c4fe..82536b6eb 100644 --- a/pwnlib/term/readline.py +++ b/pwnlib/term/readline.py @@ -4,7 +4,6 @@ from __future__ import print_function import io -import six import sys import os @@ -379,7 +378,7 @@ def readline(_size=-1, prompt='', float=True, priority=10): # XXX circular imports from pwnlib.term import term_mode if not term_mode: - six.print_(prompt, end='', flush=True) + print(prompt, end='', flush=True) return getattr(sys.stdin, 'buffer', sys.stdin).readline(_size).rstrip(b'\n') show_suggestions = False eof = False @@ -482,7 +481,7 @@ def init(): global safeeval # defer imports until initialization import sys - from six.moves import builtins + import builtins from pwnlib.util import safeeval class Wrapper: @@ -497,8 +496,4 @@ def __getattr__(self, k): return getattr(self._fd, k) sys.stdin = Wrapper(sys.stdin) - if six.PY2: - builtins.raw_input = raw_input - builtins.input = eval_input - else: - builtins.input = str_input + builtins.input = str_input diff --git a/pwnlib/tubes/listen.py b/pwnlib/tubes/listen.py index ecbd629bd..08bae02c8 100644 --- a/pwnlib/tubes/listen.py +++ b/pwnlib/tubes/listen.py @@ -36,13 +36,16 @@ class listen(sock): >>> r.recvline() b'Hello\n' - >>> # It works with ipv4 by default - >>> l = listen() - >>> l.spawn_process('/bin/sh') - >>> r = remote('127.0.0.1', l.lport) - >>> r.sendline(b'echo Goodbye') - >>> r.recvline() - b'Goodbye\n' + .. doctest:: + :options: +POSIX +TODO + + >>> # It works with ipv4 by default + >>> l = listen() + >>> l.spawn_process('/bin/sh') + >>> r = remote('127.0.0.1', l.lport) + >>> r.sendline(b'echo Goodbye') + >>> r.recvline() + b'Goodbye\n' >>> # and it works with ipv6 by defaut, too! >>> l = listen() diff --git a/pwnlib/tubes/process.py b/pwnlib/tubes/process.py index 3b2ec16fa..c53ab2e5c 100644 --- a/pwnlib/tubes/process.py +++ b/pwnlib/tubes/process.py @@ -767,9 +767,13 @@ def can_recv_raw(self, timeout): if IS_WINDOWS: with self.countdown(timeout=timeout): - while self.timeout and self._read_queue.empty(): + while self.timeout and self._read_queue.empty() and self._read_thread.is_alive(): time.sleep(0.01) - return not self._read_queue.empty() + if not self._read_queue.empty(): + return True + if not self._read_thread.is_alive(): + raise EOFError + return False try: if timeout is None: @@ -888,8 +892,10 @@ def maps(self): """maps() -> [mapping] Returns a list of process mappings. + A mapping object has the following fields: addr, address (addr alias), start (addr alias), end, size, perms, path, rss, pss, shared_clean, shared_dirty, private_clean, private_dirty, referenced, anonymous, swap + perms is a permissions object, with the following fields: read, write, execute, private, shared, string @@ -917,24 +923,25 @@ def maps(self): >>> checker_arr == [True] * len(proc_maps) * 5 True - """ - - """ Useful information about this can be found at: https://man7.org/linux/man-pages/man5/proc.5.html specifically the /proc/pid/maps section. - memory_maps() returns a list of pmmap_ext objects + memory_maps() returns a list of pmmap_ext objects. The definition (from psutil/_pslinux.py) is: + + .. code-block:: python - The definition (from psutil/_pslinux.py) is: - pmmap_grouped = namedtuple( - 'pmmap_grouped', - ['path', 'rss', 'size', 'pss', 'shared_clean', 'shared_dirty', - 'private_clean', 'private_dirty', 'referenced', 'anonymous', 'swap']) - pmmap_ext = namedtuple( - 'pmmap_ext', 'addr perms ' + ' '.join(pmmap_grouped._fields)) + pmmap_grouped = namedtuple( + 'pmmap_grouped', + ['path', 'rss', 'size', 'pss', 'shared_clean', 'shared_dirty', + 'private_clean', 'private_dirty', 'referenced', 'anonymous', 'swap']) + pmmap_ext = namedtuple( + 'pmmap_ext', 'addr perms ' + ' '.join(pmmap_grouped._fields)) Here is an example of a pmmap_ext entry: + + .. code-block:: python + pmmap_ext(addr='15555551c000-155555520000', perms='r--p', path='[vvar]', rss=0, size=16384, pss=0, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=0, referenced=0, anonymous=0, swap=0) """ diff --git a/pwnlib/tubes/remote.py b/pwnlib/tubes/remote.py index 1d3ecebec..9f69c0322 100644 --- a/pwnlib/tubes/remote.py +++ b/pwnlib/tubes/remote.py @@ -96,6 +96,8 @@ def __init__(self, host, port, import ssl as _ssl ssl_args = ssl_args or {} + if "server_hostname" in ssl_args and sni: + log.error("sni and server_hostname cannot be set at the same time") ssl_context = ssl_context or _ssl.SSLContext(_ssl.PROTOCOL_TLSv1_2) if isinstance(sni, str): ssl_args["server_hostname"] = sni diff --git a/pwnlib/tubes/server.py b/pwnlib/tubes/server.py index 6f630f5bb..5bb5deb3b 100644 --- a/pwnlib/tubes/server.py +++ b/pwnlib/tubes/server.py @@ -9,7 +9,7 @@ from pwnlib.log import getLogger from pwnlib.tubes.sock import sock from pwnlib.tubes.remote import remote -from six.moves.queue import Queue +from queue import Queue log = getLogger(__name__) diff --git a/pwnlib/tubes/sock.py b/pwnlib/tubes/sock.py index 022eb4814..4751f7d5c 100644 --- a/pwnlib/tubes/sock.py +++ b/pwnlib/tubes/sock.py @@ -3,7 +3,6 @@ import errno import select -import six import socket from pwnlib.log import getLogger @@ -212,7 +211,7 @@ def shutdown_raw(self, direction): @classmethod def _get_family(cls, fam): - if isinstance(fam, six.integer_types): + if isinstance(fam, int): pass elif fam == 'any': fam = socket.AF_UNSPEC @@ -229,7 +228,7 @@ def _get_family(cls, fam): @classmethod def _get_type(cls, typ): - if isinstance(typ, six.integer_types): + if isinstance(typ, int): pass elif typ == "tcp": typ = socket.SOCK_STREAM diff --git a/pwnlib/tubes/ssh.py b/pwnlib/tubes/ssh.py index 8f19b57a2..a22accb47 100644 --- a/pwnlib/tubes/ssh.py +++ b/pwnlib/tubes/ssh.py @@ -5,7 +5,6 @@ import os import re import shutil -import six import string import sys import tarfile @@ -68,7 +67,7 @@ def __init__(self, parent, process = None, tty = False, cwd = None, env = None, self.env = env self.process = process self.cwd = cwd or '.' - if isinstance(cwd, six.text_type): + if isinstance(cwd, str): cwd = packing._need_bytes(cwd, 2, 0x80) env = env or {} @@ -76,7 +75,7 @@ def __init__(self, parent, process = None, tty = False, cwd = None, env = None, if isinstance(process, (list, tuple)): process = b' '.join(sh_string(packing._need_bytes(s, 2, 0x80)) for s in process) - if isinstance(process, six.text_type): + if isinstance(process, str): process = packing._need_bytes(process, 2, 0x80) if process and cwd: @@ -450,7 +449,7 @@ def __init__(self, parent, host, port, *a, **kw): try: self.sock = parent.transport.open_channel('direct-tcpip', (host, port), ('127.0.0.1', 0)) except Exception as e: - self.exception(e.message) + self.exception(str(e)) raise try: @@ -706,7 +705,7 @@ def __init__(self, user=None, host=None, port=22, password=None, key=None, if self.sftp: with context.quiet: - self.cwd = packing._decode(self.pwd()) + self.cwd = packing._decode(self.pwd(tty=False)) else: self.cwd = '.' @@ -1140,7 +1139,7 @@ def run_to_end(self, process, tty = False, cwd = None, env = None, wd = None): cwd = wd with context.local(log_level = 'ERROR'): - c = self.run(process, tty, cwd = cwd, env = env, timeout = Timeout.default) + c = self.system(process, tty, cwd = cwd, env = env, timeout = Timeout.default) data = c.recvall() retcode = c.wait() c.close() @@ -1203,7 +1202,7 @@ def __getitem__(self, attr): >>> print(repr(s['echo hello'])) b'hello' """ - return self.run(attr).recvall().strip() + return self.system(attr).recvall().strip() def __call__(self, attr): """Permits function-style access to run commands over SSH @@ -1214,10 +1213,12 @@ def __call__(self, attr): >>> print(repr(s('echo hello'))) b'hello' """ - return self.run(attr).recvall().strip() + return self.system(attr).recvall().strip() def __getattr__(self, attr): - """Permits member access to run commands over SSH + """Permits member access to run commands over SSH. + + Supports other keyword arguments which are passed to :meth:`.system`. Examples: @@ -1228,6 +1229,8 @@ def __getattr__(self, attr): b'travis' >>> s.echo(['huh','yay','args']) b'huh yay args' + >>> s.echo('value: $MYENV', env={'MYENV':'the env'}) + b'value: the env' """ bad_attrs = [ 'trait_names', # ipython tab-complete @@ -1239,7 +1242,7 @@ def __getattr__(self, attr): raise AttributeError @LocalContext - def runner(*args): + def runner(*args, **kwargs): if len(args) == 1 and isinstance(args[0], (list, tuple)): command = [attr] command.extend(args[0]) @@ -1248,7 +1251,7 @@ def runner(*args): command.extend(args) command = b' '.join(packing._need_bytes(arg, min_wrong=0x80) for arg in command) - return self.run(command).recvall().strip() + return self.system(command, **kwargs).recvall().strip() return runner def connected(self): @@ -1348,7 +1351,7 @@ def update(has, total): with context.local(log_level = 'ERROR'): cmd = 'cat < ' + sh_string(remote) - c = self.run(cmd) + c = self.system(cmd) data = b'' while True: @@ -1369,7 +1372,7 @@ def update(has, total): def _download_to_cache(self, remote, p, fingerprint=True): with context.local(log_level='error'): - remote = self.readlink('-f',remote) + remote = self.readlink('-f', remote, tty=False) if not hasattr(remote, 'encode'): remote = remote.decode('utf-8') @@ -1534,7 +1537,7 @@ def upload_data(self, data, remote): with context.local(log_level = 'ERROR'): cmd = 'cat > ' + sh_string(remote) - s = self.run(cmd, tty=False) + s = self.system(cmd, tty=False) s.send(data) s.shutdown('send') data = s.recvall() @@ -1592,7 +1595,7 @@ def upload_dir(self, local, remote=None): remote_tar = self.mktemp('--suffix=.tar.gz') self.upload_file(local_tar, remote_tar) - untar = self.run(b'cd %s && tar -xzf %s' % (sh_string(remote), sh_string(remote_tar))) + untar = self.system(b'cd %s && tar -xzf %s' % (sh_string(remote), sh_string(remote_tar))) message = untar.recvrepeat(2) if untar.wait() != 0: @@ -1809,12 +1812,12 @@ def set_working_directory(self, wd = None, symlink = False): """ status = 0 - if symlink and not isinstance(symlink, (six.binary_type, six.text_type)): + if symlink and not isinstance(symlink, (bytes, str)): symlink = os.path.join(self.pwd(), b'*') if not hasattr(symlink, 'encode') and hasattr(symlink, 'decode'): symlink = symlink.decode('utf-8') - if isinstance(wd, six.text_type): + if isinstance(wd, str): wd = packing._need_bytes(wd, 2, 0x80) if not wd: diff --git a/pwnlib/tubes/tube.py b/pwnlib/tubes/tube.py index a14e2d286..47afa0055 100644 --- a/pwnlib/tubes/tube.py +++ b/pwnlib/tubes/tube.py @@ -6,21 +6,20 @@ import logging import os import re -import six import string import subprocess import sys import threading import time -from six.moves import range - from pwnlib import atexit from pwnlib import term from pwnlib.context import context from pwnlib.log import Logger from pwnlib.timeout import Timeout from pwnlib.tubes.buffer import Buffer +from pwnlib.util import fiddling +from pwnlib.util import iters from pwnlib.util import misc from pwnlib.util import packing @@ -44,6 +43,44 @@ def __init__(self, timeout = default, level = None, *a, **kw): self._newline = None atexit.register(self.close) + def _normalize_keepends_drop(self, keepends, drop, drop_default): + ''' + >>> t = tube() + >>> t._normalize_keepends_drop(None, None, True) + True + >>> t._normalize_keepends_drop(None, None, False) + False + >>> t._normalize_keepends_drop(None, True, True) + True + >>> t._normalize_keepends_drop(None, True, False) + True + >>> t._normalize_keepends_drop(True, None, True) + False + >>> t._normalize_keepends_drop(True, None, False) + False + >>> t._normalize_keepends_drop(None, False, True) + False + >>> t._normalize_keepends_drop(None, False, False) + False + >>> t._normalize_keepends_drop(False, None, True) + True + >>> t._normalize_keepends_drop(False, None, False) + True + >>> t._normalize_keepends_drop(False, True, False) + Traceback (most recent call last): + ... + pwnlib.exception.PwnlibException: 'drop' and 'keepends' arguments cannot be used together. + ''' + if keepends is not None: + self.warn_once("'keepends' argument is deprecated. Use 'drop' instead.") + if drop is None and keepends is None: + return drop_default + elif drop is not None: + if keepends is not None: + self.error("'drop' and 'keepends' arguments cannot be used together.") + return drop + return not keepends + @property def newline(self): r'''Character sent with methods like sendline() or used for recvline(). @@ -98,7 +135,7 @@ def recv(self, numb = None, timeout = default): >>> t.recv() == b'Woohoo' True >>> with context.local(log_level='debug'): - ... _ = t.recv() # doctest: +ELLIPSIS + ... _ = t.recv() [...] Received 0xc bytes: b'Hello, world' """ @@ -263,7 +300,7 @@ def recvn(self, numb, timeout = default): >>> t.recv_raw = lambda *a: time.sleep(0.01) or b'a' >>> t.recvn(10, timeout=0.05) b'' - >>> t.recvn(10, timeout=0.06) # doctest: +ELLIPSIS + >>> t.recvn(10, timeout=0.06) b'aaaaaa...' """ # Keep track of how much data has been received @@ -324,7 +361,7 @@ def recvuntil(self, delims, drop=False, timeout=default): """ # Convert string into singleton tupple - if isinstance(delims, (bytes, bytearray, six.text_type)): + if isinstance(delims, (bytes, bytearray, str)): delims = (delims,) delims = tuple(map(packing._need_bytes, delims)) @@ -368,8 +405,8 @@ def recvuntil(self, delims, drop=False, timeout=default): return b'' - def recvlines(self, numlines=2**20, keepends=False, timeout=default): - r"""recvlines(numlines, keepends=False, timeout=default) -> list of bytes objects + def recvlines(self, numlines=2**20, keepends=None, drop=None, timeout=default): + r"""recvlines(numlines, drop=True, timeout=default) -> list of bytes objects Receive up to ``numlines`` lines. @@ -381,7 +418,7 @@ def recvlines(self, numlines=2**20, keepends=False, timeout=default): Arguments: numlines(int): Maximum number of lines to receive - keepends(bool): Keep newlines at the end of each line (:const:`False`). + drop(bool): Drop newlines at the end of each line (:const:`True`). timeout(int): Maximum timeout Raises: @@ -402,15 +439,20 @@ def recvlines(self, numlines=2**20, keepends=False, timeout=default): [b'Foo', b'Bar', b'Baz'] >>> t.recvlines(3, True) [b'Foo\n', b'Bar\n', b'Baz\n'] + >>> t.recvlines(3, drop=False) + [b'Foo\n', b'Bar\n', b'Baz\n'] """ + drop = self._normalize_keepends_drop(keepends, drop, True) + del keepends + lines = [] with self.countdown(timeout): for _ in range(numlines): try: - # We must set 'keepends' to True here so that we can + # We must set 'drop' to False here so that we can # restore the original, unmodified data to the buffer # in the event of a timeout. - res = self.recvline(keepends=True, timeout=timeout) + res = self.recvline(drop=False, timeout=timeout) except Exception: self.unrecv(b''.join(lines)) raise @@ -420,13 +462,13 @@ def recvlines(self, numlines=2**20, keepends=False, timeout=default): else: break - if not keepends: + if drop: lines = [line.rstrip(self.newline) for line in lines] return lines - def recvlinesS(self, numlines=2**20, keepends=False, timeout=default): - r"""recvlinesS(numlines, keepends=False, timeout=default) -> str list + def recvlinesS(self, numlines=2**20, keepends=None, drop=None, timeout=default): + r"""recvlinesS(numlines, drop=True, timeout=default) -> str list This function is identical to :meth:`recvlines`, but decodes the received bytes into string using :func:`context.encoding`. @@ -442,10 +484,10 @@ def recvlinesS(self, numlines=2**20, keepends=False, timeout=default): >>> t.recvlinesS(3) ['Foo', 'Bar', 'Baz'] """ - return [packing._decode(x) for x in self.recvlines(numlines, keepends, timeout)] + return [packing._decode(x) for x in self.recvlines(numlines, keepends=keepends, drop=drop, timeout=timeout)] - def recvlinesb(self, numlines=2**20, keepends=False, timeout=default): - r"""recvlinesb(numlines, keepends=False, timeout=default) -> bytearray list + def recvlinesb(self, numlines=2**20, keepends=None, drop=None, timeout=default): + r"""recvlinesb(numlines, drop=True, timeout=default) -> bytearray list This function is identical to :meth:`recvlines`, but returns a bytearray. @@ -459,10 +501,10 @@ def recvlinesb(self, numlines=2**20, keepends=False, timeout=default): >>> t.recvlinesb(3) [bytearray(b'Foo'), bytearray(b'Bar'), bytearray(b'Baz')] """ - return [bytearray(x) for x in self.recvlines(numlines, keepends, timeout)] + return [bytearray(x) for x in self.recvlines(numlines, keepends=keepends, drop=drop, timeout=timeout)] - def recvline(self, keepends=True, timeout=default): - r"""recvline(keepends=True, timeout=default) -> bytes + def recvline(self, keepends=None, drop=None, timeout=default): + r"""recvline(drop=False, timeout=default) -> bytes Receive a single line from the tube. @@ -478,7 +520,7 @@ def recvline(self, keepends=True, timeout=default): all data is buffered and an empty byte string (``b''``) is returned. Arguments: - keepends(bool): Keep the line ending (:const:`True`). + drop(bool): Drop the line ending (:const:`False`). timeout(int): Timeout Raises: @@ -501,10 +543,10 @@ def recvline(self, keepends=True, timeout=default): b'Foo\n' >>> t.recvline() b'Bar\r\n' - >>> t.recvline(keepends = False) + >>> t.recvline(False) b'Baz' >>> t.newline = b'\r\n' - >>> t.recvline(keepends = False) + >>> t.recvline(drop=True) b'Foo\nBar' >>> t = tube() >>> def _recv_eof(n): @@ -518,13 +560,16 @@ def recvline(self, keepends=True, timeout=default): b'real line\n' >>> t.recvline() b'trailing data' - >>> t.recvline() # doctest: +ELLIPSIS + >>> t.recvline() Traceback (most recent call last): - ... + ... EOFError """ + drop = self._normalize_keepends_drop(keepends, drop, False) + del keepends + try: - return self.recvuntil(self.newline, drop = not keepends, timeout = timeout) + return self.recvuntil(self.newline, drop=drop, 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: @@ -532,8 +577,8 @@ def recvline(self, keepends=True, timeout=default): return self.buffer.get() raise - def recvline_pred(self, pred, keepends=False, timeout=default): - r"""recvline_pred(pred, keepends=False) -> bytes + def recvline_pred(self, pred, keepends=None, drop=None, timeout=default): + r"""recvline_pred(pred, drop=True, timeout=default) -> bytes Receive data until ``pred(line)`` returns a truthy value. Drop all other data. @@ -544,6 +589,7 @@ def recvline_pred(self, pred, keepends=False, timeout=default): Arguments: pred(callable): Function to call. Returns the line for which this function returns :const:`True`. + drop(bool): Drop the line ending (:const:`True`). Examples: @@ -551,18 +597,22 @@ def recvline_pred(self, pred, keepends=False, timeout=default): >>> t.recv_raw = lambda n: b"Foo\nBar\nBaz\n" >>> t.recvline_pred(lambda line: line == b"Bar\n") b'Bar' - >>> t.recvline_pred(lambda line: line == b"Bar\n", keepends=True) + >>> t.recvline_pred(lambda line: line == b"Bar\n", True) + b'Bar\n' + >>> t.recvline_pred(lambda line: line == b"Bar\n", drop=False) b'Bar\n' >>> t.recvline_pred(lambda line: line == b'Nope!', timeout=0.1) b'' """ + drop = self._normalize_keepends_drop(keepends, drop, True) + del keepends tmpbuf = Buffer() line = b'' with self.countdown(timeout): while self.countdown_active(): try: - line = self.recvline(keepends=True) + line = self.recvline(drop=False) except Exception: self.buffer.unget(tmpbuf) raise @@ -572,22 +622,23 @@ def recvline_pred(self, pred, keepends=False, timeout=default): return b'' if pred(line): - if not keepends: - line = line[:-len(self.newline)] + if drop: + line = line.rstrip(self.newline) return line else: tmpbuf.add(line) return b'' - def recvline_contains(self, items, keepends = False, timeout = default): - r""" + def recvline_contains(self, items, keepends=None, drop=None, timeout=default): + r"""recvline_contains(items, drop=True, timeout=default) -> bytes + Receive lines until one line is found which contains at least one of `items`. Arguments: items(str,tuple): List of strings to search for, or a single string. - keepends(bool): Return lines with newlines if :const:`True` + drop(bool): Drop the line ending (:const:`True`). timeout(int): Timeout, in seconds Examples: @@ -606,17 +657,17 @@ def recvline_contains(self, items, keepends = False, timeout = default): >>> t.recvline_contains((b'car', b'train')) b'bicycle car train' """ - if isinstance(items, (bytes, bytearray, six.text_type)): + if isinstance(items, (bytes, bytearray, str)): items = (items,) items = tuple(map(packing._need_bytes, items)) def pred(line): return any(d in line for d in items) - return self.recvline_pred(pred, keepends, timeout) + return self.recvline_pred(pred, keepends=keepends, drop=drop, timeout=timeout) - def recvline_startswith(self, delims, keepends=False, timeout=default): - r"""recvline_startswith(delims, keepends=False, timeout=default) -> bytes + def recvline_startswith(self, delims, keepends=None, drop=None, timeout=default): + r"""recvline_startswith(delims, drop=True, timeout=default) -> bytes Keep receiving lines until one is found that starts with one of `delims`. Returns the last line received. @@ -626,7 +677,7 @@ def recvline_startswith(self, delims, keepends=False, timeout=default): Arguments: delims(str,tuple): List of strings to search for, or string of single characters - keepends(bool): Return lines with newlines if :const:`True` + drop(bool): Drop the line ending (:const:`True`). timeout(int): Timeout, in seconds Returns: @@ -638,22 +689,23 @@ def recvline_startswith(self, delims, keepends=False, timeout=default): >>> t.recv_raw = lambda n: b"Hello\nWorld\nXylophone\n" >>> t.recvline_startswith((b'W',b'X',b'Y',b'Z')) b'World' - >>> t.recvline_startswith((b'W',b'X',b'Y',b'Z'), True) + >>> t.recvline_startswith((b'W',b'X',b'Y',b'Z'), drop=False) b'Xylophone\n' >>> t.recvline_startswith(b'Wo') b'World' """ # Convert string into singleton tupple - if isinstance(delims, (bytes, bytearray, six.text_type)): + if isinstance(delims, (bytes, bytearray, str)): delims = (delims,) delims = tuple(map(packing._need_bytes, delims)) return self.recvline_pred(lambda line: any(map(line.startswith, delims)), keepends=keepends, + drop=drop, timeout=timeout) - def recvline_endswith(self, delims, keepends=False, timeout=default): - r"""recvline_endswith(delims, keepends=False, timeout=default) -> bytes + def recvline_endswith(self, delims, keepends=None, drop=None, timeout=default): + r"""recvline_endswith(delims, drop=True, timeout=default) -> bytes Keep receiving lines until one is found that ends with one of `delims`. Returns the last line received. @@ -669,19 +721,20 @@ def recvline_endswith(self, delims, keepends=False, timeout=default): >>> t.recv_raw = lambda n: b'Foo\nBar\nBaz\nKaboodle\n' >>> t.recvline_endswith(b'r') b'Bar' - >>> t.recvline_endswith((b'a',b'b',b'c',b'd',b'e'), True) + >>> t.recvline_endswith((b'a',b'b',b'c',b'd',b'e'), drop=False) b'Kaboodle\n' >>> t.recvline_endswith(b'oodle') b'Kaboodle' """ # Convert string into singleton tupple - if isinstance(delims, (bytes, bytearray, six.text_type)): + if isinstance(delims, (bytes, bytearray, str)): delims = (delims,) delims = tuple(packing._need_bytes(delim) + self.newline for delim in delims) return self.recvline_pred(lambda line: any(map(line.endswith, delims)), keepends=keepends, + drop=drop, timeout=timeout) def recvregex(self, regex, exact=False, timeout=default, capture=False): @@ -710,7 +763,7 @@ def recvregex(self, regex, exact=False, timeout=default, capture=False): b'Bla blubb blargh\n' """ - if isinstance(regex, (bytes, bytearray, six.text_type)): + if isinstance(regex, (bytes, bytearray, str)): regex = packing._need_bytes(regex) regex = re.compile(regex) @@ -724,8 +777,8 @@ def recvregex(self, regex, exact=False, timeout=default, capture=False): else: return self.recvpred(pred, timeout = timeout) - def recvline_regex(self, regex, exact=False, keepends=False, timeout=default): - """recvline_regex(regex, exact=False, keepends=False, timeout=default) -> bytes + def recvline_regex(self, regex, exact=False, keepends=None, drop=None, timeout=default): + """recvline_regex(regex, exact=False, drop=True, timeout=default) -> bytes Wrapper around :func:`recvline_pred`, which will return when a regex matches a line. @@ -737,7 +790,7 @@ def recvline_regex(self, regex, exact=False, keepends=False, timeout=default): all data is buffered and an empty string (``''``) is returned. """ - if isinstance(regex, (bytes, bytearray, six.text_type)): + if isinstance(regex, (bytes, bytearray, str)): regex = packing._need_bytes(regex) regex = re.compile(regex) @@ -746,7 +799,7 @@ def recvline_regex(self, regex, exact=False, keepends=False, timeout=default): else: pred = regex.search - return self.recvline_pred(pred, keepends = keepends, timeout = timeout) + return self.recvline_pred(pred, keepends=keepends, drop=drop, timeout=timeout) def recvrepeat(self, timeout=default): """recvrepeat(timeout=default) -> bytes @@ -1062,8 +1115,8 @@ def clean_and_log(self, timeout = 0.05): >>> t.connected_raw = lambda d: True >>> t.fileno = lambda: 1234 >>> with context.local(log_level='info'): - ... data = t.clean_and_log() #doctest: +ELLIPSIS - [DEBUG] Received 0xb bytes: + ... data = t.clean_and_log() + [...] Received 0xb bytes: b'hooray_data' >>> data b'hooray_data' @@ -1077,6 +1130,132 @@ def clean_and_log(self, timeout = 0.05): with context.local(log_level='debug'): return cached_data + self.clean(timeout) + def upload_manually(self, data, target_path = './payload', prompt = b'$', chunk_size = 0x200, chmod_flags = 'u+x', compression='auto', end_marker = 'PWNTOOLS_DONE'): + """upload_manually(data, target_path = './payload', prompt = b'$', chunk_size = 0x200, chmod_flags = 'u+x', compression='auto', end_marker = 'PWNTOOLS_DONE') + + Upload a file manually using base64 encoding and compression. + This can be used when the tube is connected to a shell. + + The file is uploaded in base64-encoded chunks by appending to a file + and then decompressing it: + + .. code-block:: + + loop: + echo | base64 -d >> . + -d -f . + chmod + + It is assumed that a `base64` command is available on the target system. + When ``compression`` is ``auto`` the best compression utility available + between ``gzip`` and ``xz`` is chosen with a fallback to uncompressed + upload. + + Arguments: + + data(bytes): The data to upload. + target_path(str): The path to upload the data to. + prompt(bytes): The shell prompt to wait for. + chunk_size(int): The size of each chunk to upload. + chmod_flags(str): The flags to use with chmod. ``""`` to ignore. + compression(str): The compression to use. ``auto`` to automatically choose the best compression or ``gzip`` or ``xz``. + end_marker(str): The marker to use to detect the end of the output. Only used when prompt is not set. + + Examples: + + .. doctest:: + :options: +POSIX +TODO + + >>> l = listen() + >>> l.spawn_process('/bin/sh') + >>> r = remote('127.0.0.1', l.lport) + >>> r.upload_manually(b'some\\xca\\xfedata\\n', prompt=b'', chmod_flags='') + >>> r.sendline(b'cat ./payload') + >>> r.recvline() + b'some\\xca\\xfedata\\n' + + >>> r.upload_manually(cyclic(0x1000), target_path='./cyclic_pattern', prompt=b'', chunk_size=0x10, compression='gzip') + >>> r.sendline(b'sha256sum ./cyclic_pattern') + >>> r.recvlineS(keepends=False).startswith(sha256sumhex(cyclic(0x1000))) + True + + >>> blob = ELF.from_assembly(shellcraft.echo('Hello world!\\n') + shellcraft.exit(0)) + >>> r.upload_manually(blob.data, prompt=b'') + >>> r.sendline(b'./payload') + >>> r.recvline() + b'Hello world!\\n' + >>> r.close() + >>> l.close() + """ + echo_end = "" + if not prompt: + echo_end = "; echo {}".format(end_marker) + end_markerb = end_marker.encode() + else: + end_markerb = prompt + + # Detect available compression utility, fallback to uncompressed upload. + compression_mode = None + possible_compression = ['xz', 'gzip'] + if not prompt: + self.sendline("echo {}".format(end_marker).encode()) + if compression == 'auto': + for utility in possible_compression: + self.sendlineafter(end_markerb, "command -v {} && echo YEP || echo NOPE{}".format(utility, echo_end).encode()) + result = self.recvuntil([b'YEP', b'NOPE']) + if b'YEP' in result: + compression_mode = utility + break + elif compression in possible_compression: + compression_mode = compression + else: + self.error('Invalid compression mode: %s, has to be one of %s', compression, possible_compression) + + self.debug('Manually uploading using compression mode: %s', compression_mode) + + compressed_data = b'' + if compression_mode == 'xz': + import lzma + compressed_data = lzma.compress(data, format=lzma.FORMAT_XZ, preset=9) + compressed_path = target_path + '.xz' + elif compression_mode == 'gzip': + import gzip + from io import BytesIO + f = BytesIO() + with gzip.GzipFile(fileobj=f, mode='wb', compresslevel=9) as g: + g.write(data) + compressed_data = f.getvalue() + compressed_path = target_path + '.gz' + else: + compressed_path = target_path + + # Don't compress if it doesn't reduce the size. + if len(compressed_data) >= len(data): + compression_mode = None + compressed_path = target_path + else: + data = compressed_data + + # Upload data in `chunk_size` chunks. Assume base64 is available. + with self.progress('Uploading payload') as p: + for idx, chunk in enumerate(iters.group(chunk_size, data)): + if None in chunk: + chunk = chunk[:chunk.index(None)] + if idx == 0: + self.sendlineafter(end_markerb, "echo {} | base64 -d > {}{}".format(fiddling.b64e(bytearray(chunk)), compressed_path, echo_end).encode()) + else: + self.sendlineafter(end_markerb, "echo {} | base64 -d >> {}{}".format(fiddling.b64e(bytearray(chunk)), compressed_path, echo_end).encode()) + p.status('{}/{} {}'.format(idx+1, len(data)//chunk_size+1, misc.size(idx*chunk_size + len(chunk)))) + p.success(misc.size(len(data))) + + # Decompress the file and set the permissions. + if compression_mode is not None: + self.sendlineafter(end_markerb, '{} -d -f {}{}'.format(compression_mode, compressed_path, echo_end).encode()) + if chmod_flags: + self.sendlineafter(end_markerb, 'chmod {} {}{}'.format(chmod_flags, target_path, echo_end).encode()) + if not prompt: + self.recvuntil(end_markerb + b'\n') + def connect_input(self, other): """connect_input(other) @@ -1313,7 +1492,7 @@ def shutdown(self, direction = "send"): send send send - >>> t.shutdown('bad_value') #doctest: +ELLIPSIS + >>> t.shutdown('bad_value') Traceback (most recent call last): ... KeyError: "direction must be in ['in', 'out', 'read', 'recv', 'send', 'write']" @@ -1347,7 +1526,7 @@ def connected(self, direction = 'any'): send send send - >>> t.connected('bad_value') #doctest: +ELLIPSIS + >>> t.connected('bad_value') Traceback (most recent call last): ... KeyError: "direction must be in ['any', 'in', 'out', 'read', 'recv', 'send', 'write']" diff --git a/pwnlib/ui.py b/pwnlib/ui.py index 95f89ad27..2789f6eba 100644 --- a/pwnlib/ui.py +++ b/pwnlib/ui.py @@ -3,7 +3,6 @@ import os import signal -import six import string import struct import subprocess @@ -180,7 +179,7 @@ def options(prompt, opts, default = None): Choice 2 """ - if default is not None and not isinstance(default, six.integer_types): + if default is not None and not isinstance(default, int): raise ValueError('options(): default must be a number or None') if term.term_mode: @@ -294,7 +293,7 @@ def pause(n=None): else: log.info('Paused (press enter to continue)') raw_input('') - elif isinstance(n, six.integer_types): + elif isinstance(n, int): with log.waitfor("Waiting") as l: for i in range(n, 0, -1): l.status('%d... ' % i) diff --git a/pwnlib/util/crc/__init__.py b/pwnlib/util/crc/__init__.py index 80a5c5649..b5c6c5e40 100644 --- a/pwnlib/util/crc/__init__.py +++ b/pwnlib/util/crc/__init__.py @@ -20,7 +20,6 @@ from __future__ import absolute_import from __future__ import division -import six import sys import types @@ -73,7 +72,7 @@ class BitPolynom(object): def __init__(self, n): - if isinstance(n, (bytes, six.text_type)): + if isinstance(n, (bytes, bytearray, str)): from pwnlib.util.packing import _need_text n = _need_text(n) self.n = 0 @@ -81,13 +80,13 @@ def __init__(self, n): try: for p in n.split('+'): k = safeeval.values(p.strip(), {'x': x, 'X': x}) - assert isinstance(k, (BitPolynom,)+six.integer_types) + assert isinstance(k, (BitPolynom, int)) k = int(k) assert k >= 0 self.n ^= k except (ValueError, NameError, AssertionError): raise ValueError("Not a valid polynomial: %s" % n) - elif isinstance(n, six.integer_types): + elif isinstance(n, int): if n >= 0: self.n = n else: @@ -297,7 +296,7 @@ def generic_crc(data, polynom, width, init, refin, refout, xorout): # refin is not meaningful in this case inlen = len(data) p = BitPolynom(int(''.join('1' if v else '0' for v in data), 2)) - elif isinstance(data, six.binary_type): + elif isinstance(data, bytes): inlen = len(data)*8 if refin: data = fiddling.bitswap(data) diff --git a/pwnlib/util/cyclic.py b/pwnlib/util/cyclic.py index 316b70ec5..3271892c8 100644 --- a/pwnlib/util/cyclic.py +++ b/pwnlib/util/cyclic.py @@ -1,7 +1,6 @@ from __future__ import absolute_import from __future__ import division -import six import string from pwnlib.context import context, LocalNoarchContext @@ -217,7 +216,7 @@ def cyclic_find(subseq, alphabet = None, n = None): if n is None: n = context.cyclic_size - if isinstance(subseq, six.integer_types): + if isinstance(subseq, int): if subseq >= 2**(8*n): # Assumption: The user has given an integer that is more than 2**(8n) bits, but would otherwise fit within # a register of size 2**(8m) where m is a multiple of four @@ -339,7 +338,7 @@ def cyclic_metasploit_find(subseq, sets = None): """ sets = sets or [ string.ascii_uppercase.encode(), string.ascii_lowercase.encode(), string.digits.encode() ] - if isinstance(subseq, six.integer_types): + if isinstance(subseq, int): subseq = packing.pack(subseq, 'all', 'little', False) return _gen_find(subseq, metasploit_pattern(sets)) @@ -362,10 +361,10 @@ def _gen_find(subseq, generator): return -1 def _join_sequence(seq, alphabet): - if isinstance(alphabet, six.text_type): + if isinstance(alphabet, str): return ''.join(seq) elif isinstance(alphabet, bytes): - return bytes(bytearray(seq)) + return bytes(seq) else: return seq diff --git a/pwnlib/util/fiddling.py b/pwnlib/util/fiddling.py index 51541be2f..967892fd1 100644 --- a/pwnlib/util/fiddling.py +++ b/pwnlib/util/fiddling.py @@ -7,11 +7,9 @@ import random import re import os -import six import string -from six import BytesIO -from six.moves import range +from io import BytesIO from pwnlib.context import LocalNoarchContext from pwnlib.context import context @@ -149,7 +147,7 @@ def bits(s, endian = 'big', zero = 0, one = 1): out += byte else: out += byte[::-1] - elif isinstance(s, six.integer_types): + elif isinstance(s, int): if s < 0: s = s & ((1<> (word_size - k)) n &= (1 << word_size) - 1 @@ -556,7 +554,7 @@ def isprint(c): """isprint(c) -> bool Return True if a character is printable""" - if isinstance(c, six.text_type): + if isinstance(c, str): c = ord(c) t = bytearray(string.ascii_letters + string.digits + string.punctuation + ' ', 'ascii') return c in t diff --git a/pwnlib/util/iters.py b/pwnlib/util/iters.py index d037fe921..c64f41120 100644 --- a/pwnlib/util/iters.py +++ b/pwnlib/util/iters.py @@ -11,7 +11,6 @@ import random import time from itertools import * -from six.moves import map, filter, filterfalse, range, zip, zip_longest from pwnlib.context import context from pwnlib.log import getLogger @@ -53,11 +52,8 @@ 'cycle' , 'dropwhile' , 'groupby' , - 'filter' , 'filterfalse' , - 'map' , 'islice' , - 'zip' , 'zip_longest' , 'permutations' , 'product' , @@ -888,6 +884,9 @@ def mbruteforce(func, alphabet, length, method = 'upto', start = None, threads = Example: + .. doctest:: + :options: +POSIX +TODO + >>> 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 ada0c44f7..5ee47487e 100644 --- a/pwnlib/util/lists.py +++ b/pwnlib/util/lists.py @@ -1,9 +1,6 @@ from __future__ import division import collections -import six - -from six.moves import range def partition(lst, f, save_keys = False): @@ -77,8 +74,8 @@ def group(n, lst, underfull_action = 'ignore', fill_value = None): fill_value = (fill_value,) elif isinstance(lst, list): fill_value = [fill_value] - elif isinstance(lst, (bytes, six.text_type)): - if not isinstance(fill_value, (bytes, six.text_type)): + elif isinstance(lst, (bytes, str)): + if not isinstance(fill_value, (bytes, str)): raise ValueError("group(): cannot fill a string with a non-string") else: raise ValueError("group(): 'lst' must be either a tuple, list or string") diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index d1622154e..3b5682e8d 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -1,11 +1,11 @@ from __future__ import division +import json import base64 import errno import os import re import signal -import six import socket import stat import string @@ -13,11 +13,13 @@ import sys import tempfile import inspect +import time import types from pwnlib import atexit from pwnlib.context import context from pwnlib.log import getLogger +from pwnlib.timeout import Timeout from pwnlib.util import fiddling from pwnlib.util import lists from pwnlib.util import packing @@ -121,7 +123,7 @@ def read(path, count=-1, skip=0): Examples: - >>> read('/proc/self/exe')[:4] + >>> read('/proc/self/exe')[:4] # doctest: +LINUX +TODO b'\x7fELF' """ path = os.path.expanduser(os.path.expandvars(path)) @@ -161,7 +163,7 @@ def which(name, all = False, path=None): Example: - >>> which('sh') # doctest: +ELLIPSIS + >>> which('sh') # doctest: +ELLIPSIS +POSIX +TODO '.../bin/sh' """ # If name is a path, do not attempt to resolve it. @@ -211,13 +213,13 @@ def normalize_argv_env(argv, env, log, level=2): # - Each string must not contain '\x00' # argv = argv or [] - if isinstance(argv, (six.text_type, six.binary_type)): + if isinstance(argv, (str, bytes, bytearray)): argv = [argv] if not isinstance(argv, (list, tuple)): log.error('argv must be a list or tuple: %r' % argv) - if not all(isinstance(arg, (six.text_type, bytes, bytearray)) for arg in argv): + if not all(isinstance(arg, (str, bytes, bytearray)) for arg in argv): log.error("argv must be strings or bytes: %r" % argv) # Create a duplicate so we can modify it @@ -244,13 +246,13 @@ def normalize_argv_env(argv, env, log, level=2): env_items = env if env: for k,v in env_items: - if not isinstance(k, (bytes, six.text_type)): + if not isinstance(k, (bytes, str)): log.error('Environment keys must be strings: %r' % k) # Check if = is in the key, Required check since we sometimes call ctypes.execve directly # https://github.com/python/cpython/blob/025995feadaeebeef5d808f2564f0fd65b704ea5/Modules/posixmodule.c#L6476 if b'=' in packing._encode(k): log.error('Environment keys may not contain "=": %r' % (k)) - if not isinstance(v, (bytes, six.text_type)): + if not isinstance(v, (bytes, str)): log.error('Environment values must be strings: %r=%r' % (k,v)) k = packing._need_bytes(k, level, 0x80) # ASCII text is okay v = packing._need_bytes(v, level, 0x80) # ASCII text is okay @@ -368,13 +370,13 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr terminal = 'cmd.exe' args = ['/c', 'start'] distro_name = os.getenv('WSL_DISTRO_NAME') + current_dir = os.getcwd() # Split pane in Windows Terminal if 'WT_SESSION' in os.environ and which('wt.exe'): - args.extend(['wt.exe', '-w', '0', 'split-pane', '-d', '.']) - + args.extend(['wt.exe', '-w', '0', 'split-pane']) if distro_name: - args.extend(['wsl.exe', '-d', distro_name, 'bash', '-c']) + args.extend(['wsl.exe', '-d', distro_name, '--cd', current_dir, 'bash', '-c']) else: args.extend(['bash.exe', '-c']) @@ -394,7 +396,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr argv = [which(terminal)] + args - if isinstance(command, six.string_types): + if isinstance(command, str): if ';' in command: log.error("Cannot use commands with semicolon. Create a script and invoke that directly.") argv += [command] @@ -439,11 +441,16 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr tmp.flush() os.chmod(tmp.name, 0o700) argv = [which(terminal), tmp.name] + # cmd.exe does not support WSL UNC paths as working directory + # so it gets reset to %WINDIR% before starting wsl again. + # Set the working directory correctly in WSL. + elif terminal == 'cmd.exe': + argv[-1] = "cd '{}' && {}".format(os.getcwd(), argv[-1]) log.debug("Launching a new terminal: %r" % argv) stdin = stdout = stderr = open(os.devnull, 'r+b') - if terminal == 'tmux': + if terminal == 'tmux' or terminal in ('kitty', 'kitten'): stdout = subprocess.PIPE p = subprocess.Popen(argv, stdin=stdin, stdout=stdout, stderr=stderr, preexec_fn=preexec_fn) @@ -460,10 +467,44 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr with subprocess.Popen((qdbus, konsole_dbus_service, '/Sessions/{}'.format(last_konsole_session), 'org.kde.konsole.Session.processId'), stdout=subprocess.PIPE) as proc: pid = int(proc.communicate()[0].decode()) + elif terminal in ('kitty', 'kitten'): + pid = None + out, _ = p.communicate() + try: + kittyid = int(out) + except ValueError: + kittyid = None + if kittyid is None: + log.error("Could not parse kitty window ID from output (%r)", out) + else: + lsout, _ = subprocess.Popen(["kitten", "@", "ls", "--match", "id:%d" % kittyid], stdin=stdin, stdout=stdout, stderr=stderr).communicate() + try: + lsj = json.loads(lsout) + pid = int(lsj[0]["tabs"][0]["windows"][0]["pid"]) + except json.JSONDecodeError as e: + pid = None + log.error("Json decode failed while parsing 'kitten @ ls' output (%r) (error: %r)", lsout, e) + + elif terminal == 'cmd.exe': + # p.pid is cmd.exe's pid instead of the WSL process we want to start eventually. + # I don't know how to trace the execution through Windows and back into the WSL2 VM. + # Do a best guess by waiting for a new process matching the command to be run. + # Otherwise it's better to return nothing instead of a know wrong pid. + from pwnlib.util.proc import pid_by_name + pid = None + ran_program = command.split(' ')[0] if isinstance(command, str) else command[0] + t = Timeout() + with t.countdown(timeout=5): + while t.timeout: + new_pid = pid_by_name(ran_program) + if new_pid and new_pid[0] > p.pid: + pid = new_pid[0] + break + time.sleep(0.01) else: pid = p.pid - if kill_at_exit: + if kill_at_exit and pid: def kill(): try: if terminal == 'qdbus': @@ -654,16 +695,6 @@ def register_sizes(regs, in_sizes): return lists.concat(regs), sizes, bigger, smaller -def python_2_bytes_compatible(klass): - """ - A class decorator that defines __str__ methods under Python 2. - Under Python 3 it does nothing. - """ - if six.PY2: - 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): @@ -729,7 +760,7 @@ def _create_execve_script(argv=None, executable=None, cwd=None, env=None, ignore cwd = cwd or '.' # Validate, since failures on the remote side will suck. - if not isinstance(executable, (six.text_type, six.binary_type, bytearray)): + if not isinstance(executable, (str, bytes, bytearray)): log.error("executable / argv[0] must be a string: %r" % executable) executable = bytearray(packing._need_bytes(executable, min_wrong=0x80)) diff --git a/pwnlib/util/net.py b/pwnlib/util/net.py index fab1dacbb..df8cd5662 100644 --- a/pwnlib/util/net.py +++ b/pwnlib/util/net.py @@ -259,17 +259,17 @@ def sockinfos(addr, f, t): infos |= set(socket.getaddrinfo(sockaddr[0], sockaddr[1], socket.AF_INET6, t, proto, socket.AI_V4MAPPED)) return infos - if local is not None: - local = sockinfos(local, fam, typ) - remote = sockinfos(remote, fam, typ) + local = sockinfos(local, fam, typ) + if remote is not None: + remote = sockinfos(remote, fam, typ) def match(c): laddrs = sockinfos(c.laddr, c.family, c.type) raddrs = sockinfos(c.raddr, c.family, c.type) - if not (raddrs & remote): + if not (laddrs & local): return False - if local is None: + if remote is None: return True - return bool(laddrs & local) + return bool(raddrs & remote) return match diff --git a/pwnlib/util/packing.py b/pwnlib/util/packing.py index 3503bd937..e6a55f9a8 100644 --- a/pwnlib/util/packing.py +++ b/pwnlib/util/packing.py @@ -34,13 +34,10 @@ from __future__ import division import collections -import six import struct import sys import warnings -from six.moves import range - from pwnlib.context import LocalNoarchContext from pwnlib.context import context from pwnlib.log import getLogger @@ -115,8 +112,8 @@ def pack(number, word_size = None, endianness = None, sign = None, **kwargs): endianness = context.endianness sign = context.sign - if not isinstance(number, six.integer_types): - raise ValueError("pack(): number must be of type (int,long) (got %r)" % type(number)) + if not isinstance(number, int): + raise ValueError("pack(): number must be of type int (got %r)" % type(number)) if not isinstance(sign, bool): raise ValueError("pack(): sign must be either True or False (got %r)" % sign) @@ -137,7 +134,7 @@ def pack(number, word_size = None, endianness = None, sign = None, **kwargs): if not sign: raise ValueError("pack(): number does not fit within word_size") word_size = ((number + 1).bit_length() | 7) + 1 - elif not isinstance(word_size, six.integer_types) or word_size <= 0: + elif not isinstance(word_size, int) or word_size <= 0: raise ValueError("pack(): word_size must be a positive integer or the string 'all'") if sign: @@ -214,7 +211,7 @@ def unpack(data, word_size = None): # Verify that word_size make sense if word_size == 'all': word_size = len(data) * 8 - elif not isinstance(word_size, six.integer_types) or word_size <= 0: + elif not isinstance(word_size, int) or word_size <= 0: raise ValueError("unpack(): word_size must be a positive integer or the string 'all'") byte_size = (word_size + 7) // 8 @@ -332,7 +329,7 @@ def routine(data, stacklevel=None): # # Make normal user-oriented packers, e.g. p8 # -def _do_packing(op, size, number): +def _do_packing(op, size, number, endianness=None): name = "%s%s" % (op,size) mod = sys.modules[__name__] @@ -342,7 +339,7 @@ def _do_packing(op, size, number): bs = getattr(mod, "_%sbs" % (name)) bu = getattr(mod, "_%sbu" % (name)) - endian = context.endian + endian = endianness or context.endian signed = context.signed return {("little", True ): ls, ("little", False): lu, @@ -350,7 +347,7 @@ def _do_packing(op, size, number): ("big", False): bu}[endian, signed](number, 3) @LocalNoarchContext -def p8(number, endianness = None, sign = None, **kwargs): +def p8(number, endianness = None, **kwargs): """p8(number, endianness, sign, ...) -> bytes Packs an 8-bit integer @@ -365,10 +362,10 @@ def p8(number, endianness = None, sign = None, **kwargs): Returns: The packed number as a byte string """ - return _do_packing('p', 8, number) + return _do_packing('p', 8, number, endianness) @LocalNoarchContext -def p16(number, endianness = None, sign = None, **kwargs): +def p16(number, endianness = None, **kwargs): """p16(number, endianness, sign, ...) -> bytes Packs an 16-bit integer @@ -382,11 +379,18 @@ def p16(number, endianness = None, sign = None, **kwargs): Returns: The packed number as a byte string + + Examples: + + >>> p16(0x4142, 'big') + b'AB' + >>> p16(0x4142, endianness='big') + b'AB' """ - return _do_packing('p', 16, number) + return _do_packing('p', 16, number, endianness) @LocalNoarchContext -def p32(number, endianness = None, sign = None, **kwargs): +def p32(number, endianness = None, **kwargs): """p32(number, endianness, sign, ...) -> bytes Packs an 32-bit integer @@ -400,11 +404,18 @@ def p32(number, endianness = None, sign = None, **kwargs): Returns: The packed number as a byte string + + Examples: + + >>> p32(0x41424344, 'big') + b'ABCD' + >>> p32(0x41424344, endianness='big') + b'ABCD' """ - return _do_packing('p', 32, number) + return _do_packing('p', 32, number, endianness) @LocalNoarchContext -def p64(number, endianness = None, sign = None, **kwargs): +def p64(number, endianness = None, **kwargs): """p64(number, endianness, sign, ...) -> bytes Packs an 64-bit integer @@ -418,11 +429,18 @@ def p64(number, endianness = None, sign = None, **kwargs): Returns: The packed number as a byte string + + Examples: + + >>> p64(0x4142434445464748, 'big') + b'ABCDEFGH' + >>> p64(0x4142434445464748, endianness='big') + b'ABCDEFGH' """ - return _do_packing('p', 64, number) + return _do_packing('p', 64, number, endianness) @LocalNoarchContext -def u8(data, endianness = None, sign = None, **kwargs): +def u8(data, endianness = None, **kwargs): """u8(data, endianness, sign, ...) -> int Unpacks an 8-bit integer @@ -437,10 +455,10 @@ def u8(data, endianness = None, sign = None, **kwargs): Returns: The unpacked number """ - return _do_packing('u', 8, data) + return _do_packing('u', 8, data, endianness) @LocalNoarchContext -def u16(data, endianness = None, sign = None, **kwargs): +def u16(data, endianness = None, **kwargs): """u16(data, endianness, sign, ...) -> int Unpacks an 16-bit integer @@ -455,10 +473,10 @@ def u16(data, endianness = None, sign = None, **kwargs): Returns: The unpacked number """ - return _do_packing('u', 16, data) + return _do_packing('u', 16, data, endianness) @LocalNoarchContext -def u32(data, endianness = None, sign = None, **kwargs): +def u32(data, endianness = None, **kwargs): """u32(data, endianness, sign, ...) -> int Unpacks an 32-bit integer @@ -473,10 +491,10 @@ def u32(data, endianness = None, sign = None, **kwargs): Returns: The unpacked number """ - return _do_packing('u', 32, data) + return _do_packing('u', 32, data, endianness) @LocalNoarchContext -def u64(data, endianness = None, sign = None, **kwargs): +def u64(data, endianness = None, **kwargs): """u64(data, endianness, sign, ...) -> int Unpacks an 64-bit integer @@ -491,7 +509,7 @@ def u64(data, endianness = None, sign = None, **kwargs): Returns: The unpacked number """ - return _do_packing('u', 64, data) + return _do_packing('u', 64, data, endianness) def make_packer(word_size = None, sign = None, **kwargs): """make_packer(word_size = None, endianness = None, sign = None) -> number → str @@ -637,10 +655,10 @@ def fill(key): pieces_ = dict() large_key = 2**(context.word_size-8) for k, v in pieces.items(): - if isinstance(k, six.integer_types): + if isinstance(k, int): if k >= large_key: k = fill(pack(k)) - elif isinstance(k, (six.text_type, bytearray, bytes)): + elif isinstance(k, (str, bytearray, bytes)): k = fill(_need_bytes(k, stacklevel, 0x80)) else: raise TypeError("flat(): offset must be of type int or str, but got '%s'" % type(k)) @@ -710,9 +728,9 @@ def _flat(args, preprocessor, packer, filler, stacklevel=1): filler, val = _fit(arg, preprocessor, packer, filler, stacklevel + 1) elif isinstance(arg, bytes): val = arg - elif isinstance(arg, six.text_type): + elif isinstance(arg, str): val = _need_bytes(arg, stacklevel + 1) - elif isinstance(arg, six.integer_types): + elif isinstance(arg, int): val = packer(arg) elif isinstance(arg, bytearray): val = bytes(arg) @@ -775,7 +793,7 @@ def flat(*args, **kwargs): Examples: (Test setup, please ignore) - + >>> context.clear() Basic usage of :meth:`flat` works similar to the pack() routines. @@ -822,7 +840,7 @@ def flat(*args, **kwargs): Dictionary usage permits directly using values derived from :func:`.cyclic`. See :func:`.cyclic`, :function:`pwnlib.context.context.cyclic_alphabet`, and :data:`.context.cyclic_size` - for more options. + for more options. The cyclic pattern can be provided as either the text or hexadecimal offset. @@ -873,7 +891,7 @@ def flat(*args, **kwargs): Negative indices are also supported, though this only works for integer keys. - + >>> flat({-4: b'x', -1: b'A', 0: b'0', 4: b'y'}) b'xaaA0aaay' """ @@ -885,7 +903,7 @@ def flat(*args, **kwargs): length = kwargs.pop('length', None) stacklevel = kwargs.pop('stacklevel', 0) - if isinstance(filler, (str, six.text_type)): + if isinstance(filler, str): filler = bytearray(_need_bytes(filler)) if kwargs != {}: @@ -988,6 +1006,10 @@ def dd(dst, src, count = 0, skip = 0, seek = 0, truncate = False): ('H', 'e', 'l', 'l', 'o', b'?') >>> dd(list('Hello!'), (63,), skip = 5) ['H', 'e', 'l', 'l', 'o', b'?'] + + .. doctest:: + :options: +POSIX +TODO + >>> _ = open('/tmp/foo', 'w').write('A' * 10) >>> dd(open('/tmp/foo'), open('/dev/zero'), skip = 3, count = 4).read() 'AAA\\x00\\x00\\x00\\x00AAA' @@ -1031,7 +1053,7 @@ def dd(dst, src, count = 0, skip = 0, seek = 0, truncate = False): # Otherwise get `src` in canonical form, i.e. a string of at most `count` # bytes - if isinstance(src, six.text_type): + if isinstance(src, str): if count: # The only way to know where the `seek`th byte is, is to decode, but # we only need to decode up to the first `seek + count` code points @@ -1073,7 +1095,7 @@ def dd(dst, src, count = 0, skip = 0, seek = 0, truncate = False): break if isinstance(b, bytes): src_ += b - elif isinstance(b, six.integer_types): + elif isinstance(b, int): if b > 255 or b < 0: raise ValueError("dd(): Source value %d at index %d is not in range [0;255]" % (b, i)) src_ += _p8lu(b) @@ -1089,7 +1111,7 @@ def dd(dst, src, count = 0, skip = 0, seek = 0, truncate = False): truncate = skip + len(src) # UTF-8 encode unicode `dst` - if isinstance(dst, six.text_type): + if isinstance(dst, str): dst = dst.encode('utf8') utf8 = True else: @@ -1153,7 +1175,7 @@ def _need_bytes(s, level=1, min_wrong=0): return s.encode(encoding, errors) def _need_text(s, level=1): - if isinstance(s, (str, six.text_type)): + if isinstance(s, str): return s # already text if not isinstance(s, (bytes, bytearray)): @@ -1186,7 +1208,7 @@ def _encode(s): return s.encode(context.encoding) def _decode(b): - if isinstance(b, (str, six.text_type)): + if isinstance(b, str): return b # already text if context.encoding == 'auto': diff --git a/pwnlib/util/proc.py b/pwnlib/util/proc.py index 1769bda56..9889bb697 100644 --- a/pwnlib/util/proc.py +++ b/pwnlib/util/proc.py @@ -27,6 +27,11 @@ def pidof(target): - :class:`pwnlib.tubes.sock.sock`: singleton list of the PID at the remote end of `target` if it is running on the host. Otherwise an empty list. + - :class:`pwnlib.tubes.ssh.ssh_channel`: singleton list of the PID of + `target` on the remote system. + - :class:`tuple`: singleton list of the PID at the local end of the + connection to `target` if it is running on the host. Otherwise an + empty list. Arguments: target(object): The target whose PID(s) to find. @@ -38,7 +43,7 @@ def pidof(target): >>> 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)) + >>> pidof(p) == pidof(l) == pidof(('127.0.0.1', l.rport)) True """ if isinstance(target, tubes.ssh.ssh_channel): @@ -51,7 +56,7 @@ def pidof(target): return [c.pid for c in psutil.net_connections() if match(c)] elif isinstance(target, tuple): - match = sock_match(None, target) + match = sock_match(target, None) return [c.pid for c in psutil.net_connections() if match(c)] elif isinstance(target, tubes.process.process): @@ -82,6 +87,8 @@ def match(p): try: if p.exe() == name: return True + if p.cmdline()[0] == name: + return True except Exception: pass return False @@ -398,7 +405,7 @@ def wait_for_debugger(pid, debugger_pid=None): pid (int): PID of the process. Returns: - None + The PID of the debugger that attached to the process. """ t = Timeout() with t.countdown(timeout=15): @@ -416,9 +423,11 @@ def wait_for_debugger(pid, debugger_pid=None): else: time.sleep(0.01) - if tracer(pid): + tracer_pid = tracer(pid) + if tracer_pid: l.success() elif debugger_pid == 0: l.failure("debugger exited! (maybe check /proc/sys/kernel/yama/ptrace_scope)") else: l.failure('Debugger did not attach to pid %d within 15 seconds', pid) + return tracer_pid diff --git a/pwnlib/util/safeeval.py b/pwnlib/util/safeeval.py index 35694976d..6819c1546 100644 --- a/pwnlib/util/safeeval.py +++ b/pwnlib/util/safeeval.py @@ -21,31 +21,17 @@ _values_codes = _expr_codes + ['LOAD_NAME'] -import six - def _get_opcodes(codeobj): """_get_opcodes(codeobj) -> [opcodes] Extract the actual opcodes as a list from a code object >>> c = compile("[1 + 2, (1,2)]", "", "eval") - >>> _get_opcodes(c) # doctest: +ELLIPSIS + >>> _get_opcodes(c) # doctest: +SKIP [...100, 100, 103, 83] """ import dis - if hasattr(dis, 'get_instructions'): - return [ins.opcode for ins in dis.get_instructions(codeobj)] - i = 0 - opcodes = [] - s = codeobj.co_code - while i < len(s): - code = six.indexbytes(s, i) - opcodes.append(code) - if code >= dis.HAVE_ARGUMENT: - i += 3 - else: - i += 1 - return opcodes + return [ins.opcode for ins in dis.get_instructions(codeobj)] def test_expr(expr, allowed_codes): """test_expr(expr, allowed_codes) -> codeobj diff --git a/pwnlib/util/sh_string.py b/pwnlib/util/sh_string.py index 00ddb81fc..eb4ca19e9 100644 --- a/pwnlib/util/sh_string.py +++ b/pwnlib/util/sh_string.py @@ -241,7 +241,6 @@ from __future__ import absolute_import from __future__ import division -import six import string import subprocess @@ -258,7 +257,7 @@ def test_all(): test('ab') ## test('a b') ## test(r"a\'b") ## - everything_1 = b''.join(six.int2byte(c) for c in range(1,256)) + everything_1 = bytes(range(1,256)) for s in everything_1: test(s) test(s*4) @@ -271,7 +270,7 @@ def test_all(): test(everything_1) test(everything_1 * 2) test(everything_1 * 4) - everything_2 = b''.join(six.int2byte(c) * 2 for c in range(1,256)) ## + everything_2 = b''.join(bytes([c,c]) for c in range(1,256)) ## test(everything_2) test(randoms(1000, everything_1)) @@ -280,23 +279,26 @@ def test_all(): def test(original): r"""Tests the output provided by a shell interpreting a string - >>> test(b'foobar') - >>> test(b'foo bar') - >>> test(b'foo bar\n') - >>> test(b"foo'bar") - >>> test(b"foo\\\\bar") - >>> test(b"foo\\\\'bar") - >>> test(b"foo\\x01'bar") - >>> test(b'\n') - >>> test(b'\xff') - >>> test(os.urandom(16 * 1024).replace(b'\x00', b'')) + .. doctest:: + :options: +POSIX + + >>> test(b'foobar') + >>> test(b'foo bar') + >>> test(b'foo bar\n') + >>> test(b"foo'bar") + >>> test(b"foo\\\\bar") + >>> test(b"foo\\\\'bar") + >>> test(b"foo\\x01'bar") + >>> test(b'\n') + >>> test(b'\xff') + >>> test(os.urandom(16 * 1024).replace(b'\x00', b'')) """ input = sh_string(original) - if not isinstance(input, str): - input = input.decode('latin1') + if isinstance(input, str): + input = input.encode() - cmdstr = six.b('/bin/echo %s' % input) + cmdstr = b'/bin/echo %s' % input SUPPORTED_SHELLS = [ ['ash', '-c', cmdstr], diff --git a/pwnlib/util/web.py b/pwnlib/util/web.py index 7e98b67ae..a76ff61b7 100644 --- a/pwnlib/util/web.py +++ b/pwnlib/util/web.py @@ -3,7 +3,6 @@ from __future__ import division import os -import six import tempfile from pwnlib.log import getLogger @@ -70,7 +69,7 @@ def wget(url, save=None, timeout=5, **kwargs): # Save to the target file if provided if save: - if not isinstance(save, (bytes, six.text_type)): + if not isinstance(save, (bytes, str)): save = os.path.basename(url) save = save or tempfile.NamedTemporaryFile(dir='.', delete=False).name with open(save,'wb+') as f: diff --git a/pwnlib/version.py b/pwnlib/version.py index 2908f6aea..c48ee63da 100644 --- a/pwnlib/version.py +++ b/pwnlib/version.py @@ -1 +1 @@ -__version__ = '4.14.0' +__version__ = '5.0.0dev' diff --git a/pwnlib/windbg.py b/pwnlib/windbg.py index 588714572..042c49335 100644 --- a/pwnlib/windbg.py +++ b/pwnlib/windbg.py @@ -63,8 +63,6 @@ import subprocess -import six - from pwnlib import tubes from pwnlib.context import LocalContext from pwnlib.context import context @@ -106,7 +104,7 @@ def debug(args, windbgscript=None, exe=None, env=None, creationflags=0, **kwargs instruction of the entry point. """ if isinstance( - args, six.integer_types + (tubes.process.process, tubes.ssh.ssh_channel) + args, (int, tubes.process.process, tubes.ssh.ssh_channel) ): log.error("Use windbg.attach() to debug a running process") @@ -115,7 +113,7 @@ def debug(args, windbgscript=None, exe=None, env=None, creationflags=0, **kwargs return tubes.process.process(args, executable=exe, env=env, creationflags=creationflags) windbgscript = windbgscript or '' - if isinstance(windbgscript, six.string_types): + if isinstance(windbgscript, str): windbgscript = windbgscript.split('\n') # resume main thread windbgscript = ['~0m'] + windbgscript @@ -187,7 +185,7 @@ def attach(target, windbgscript=None, windbg_args=[]): # let's see if we can find a pid to attach to pid = None - if isinstance(target, six.integer_types): + if isinstance(target, int): # target is a pid, easy peasy pid = target elif isinstance(target, str): @@ -213,7 +211,7 @@ def attach(target, windbgscript=None, windbg_args=[]): cmd.extend(['-p', str(pid)]) windbgscript = windbgscript or '' - if isinstance(windbgscript, six.string_types): + if isinstance(windbgscript, str): windbgscript = windbgscript.split('\n') if isinstance(windbgscript, list): windbgscript = ';'.join(script.strip() for script in windbgscript if script.strip()) diff --git a/pyproject.toml b/pyproject.toml index 2f4e687d9..9adc9ac4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=44.0", "wheel", "toml; python_version<'3.4'"] +requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta" [project] @@ -19,7 +19,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Security", "Topic :: Software Development :: Assemblers", @@ -32,13 +31,12 @@ classifiers = [ ] keywords = ["pwntools", "exploit", "ctf", "capture", "the", "flag", "binary", "wargame", "overflow", "stack", "heap", "defcon"] -requires-python = ">=2.7" +requires-python = ">=3.6" dependencies = [ "paramiko>=1.15.2", "mako>=1.0.0", - "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 + "pyelftools>=0.29", + "capstone>=4.0.0", "ropgadget>=5.3", "pyserial>=2.7", "requests>=2.0", @@ -51,12 +49,9 @@ dependencies = [ "intervaltree>=3.0", "sortedcontainers", "unicorn>=2.0.1", - "six>=1.12.0", "rpyc", - "colored_traceback<0.4; python_version < '3'", - "colored_traceback; python_version >= '3'", - "pathlib2; python_version < '3.4'", - "unix-ar; python_version >= '3.6'", + "colored_traceback", + "unix-ar", "zstandard", ] @@ -83,7 +78,13 @@ omit = [ source = [ "pwn", "pwnlib", - "~/.cache/.pwntools-cache-2.7/", "~/.cache/.pwntools-cache-3.10/", + "~/.cache/.pwntools-cache-3.11/", + "~/.cache/.pwntools-cache-3.12/", + "~/.cache/.pwntools-cache-3.13/", ] disable_warnings = ["module-not-imported"] + +[tool.coverage.paths] +pwnlib = ["pwnlib", "*/pwntools/pwnlib", "*\\pwntools\\pwnlib"] +pwn = ["pwn", "*/pwntools/pwn", "*\\pwntools\\pwn"] diff --git a/setup.py b/setup.py index 8a189a1e0..80ffe5c06 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import print_function import glob import os @@ -8,7 +7,6 @@ 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 @@ -23,37 +21,39 @@ console_scripts = ['pwn=pwnlib.commandline.main:main'] -# Find all of the ancillary console scripts -# We have a magic flag --include-all-scripts -flag = '--only-use-pwn-command' -if flag in sys.argv: - sys.argv.remove(flag) -else: - flag = False +DEPRECATED_SCRIPTS= [ + 'asm', + # 'checksec', + # 'constgrep', + 'cyclic', + 'debug', + 'disablenx', + 'disasm', + 'elfdiff', + 'elfpatch', + 'errno', + 'hex', + # 'libcdb', + # 'phd', + # 'pwnstrip', + 'scramble', + # 'shellcraft', + 'template', + 'unhex', +] for filename in glob.glob('pwnlib/commandline/*'): filename = os.path.basename(filename) filename, ext = os.path.splitext(filename) - if ext != '.py' or '__init__' in filename: + if ext != '.py' or filename in ('__init__', 'common', 'main', 'update', 'version'): continue - script = '%s=pwnlib.commandline.common:main' % filename - if not flag: - console_scripts.append(script) - -compat = {} -if sys.version_info < (3, 4): - import site - - import toml - project = toml.load('pyproject.toml')['project'] - compat['packages'] = find_packages() - compat['install_requires'] = project['dependencies'] - compat['name'] = project['name'] - # https://github.com/pypa/pip/issues/7953 - site.ENABLE_USER_SITE = "--user" in sys.argv[1:] - + if filename in DEPRECATED_SCRIPTS: + script = '%s=pwnlib.commandline.common:deprecated_main' % filename + else: + script = '%s=pwnlib.commandline.common:main' % filename + console_scripts.append(script) # Check that the user has installed the Python development headers PythonH = os.path.join(get_python_inc(), 'Python.h') @@ -63,7 +63,7 @@ sys.exit(-1) setup( - version = '4.14.0', + version = '5.0.0dev', data_files = [('pwntools-doc', glob.glob('*.md') + glob.glob('*.txt')), ], @@ -78,6 +78,4 @@ ] + templates, }, entry_points = {'console_scripts': console_scripts}, - scripts = glob.glob("bin/*"), - **compat ) diff --git a/travis/docker/Dockerfile b/travis/docker/Dockerfile index d04663cea..acf357dc8 100644 --- a/travis/docker/Dockerfile +++ b/travis/docker/Dockerfile @@ -5,8 +5,7 @@ ENV HISTFILE=/home/pwntools/.history # Uninstall existing versions of pwntools USER root -RUN python2.7 -m pip uninstall -q -y pwntools \ - && python3 -m pip uninstall -q -y pwntools +RUN python3 -m pip uninstall -q -y pwntools # Switch back to the pwntools user from here forward USER pwntools @@ -18,17 +17,14 @@ 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 --no-cache-dir --upgrade --editable pwntools \ - && python3 -m pip install --no-cache-dir --upgrade --editable pwntools \ + && python3 -m pip install --upgrade --editable pwntools \ && PWNLIB_NOTERM=1 pwn version # Requirements for running the tests -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 +RUN python3 -m pip install --upgrade --requirement pwntools/docs/requirements.txt # Python niceties for debugging -RUN python2.7 -m pip install --no-cache-dir -U ipython ipdb \ - && python3 -m pip install --no-cache-dir -U ipython ipdb +RUN python3 -m pip install -U ipython ipdb # Dependencies from .travis.yml addons -> apt -> packages ARG DEBIAN_FRONTEND=noninteractive @@ -86,8 +82,7 @@ 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 --no-cache-dir ipdb && \ - python3 -m pip install --no-cache-dir ipdb +RUN python3 -m pip install --no-cache-dir ipdb # Install debugging utilities USER root @@ -103,7 +98,8 @@ RUN mkdir /etc/qemu-binfmt && \ ln -sf /usr/lib/powerpc-linux-gnu /etc/qemu-binfmt/powerpc && \ ln -sf /usr/lib/powerpc-linux-gnu64 /etc/qemu-binfmt/powerpc64 && \ ln -sf /usr/lib/sparc64-linux-gnu /etc/qemu-binfmt/sparc64 && \ - ln -sf /usr/lib/riscv64-linux-gnu /etc/qemu-binfmt/riscv64 + ln -sf /usr/lib/riscv64-linux-gnu /etc/qemu-binfmt/riscv64 && \ + ln -sf /usr/lib/loongarch64-linux-gnu /etc/qemu-binfmt/loongarch64 # Create the Travis user USER root @@ -127,14 +123,14 @@ RUN mkdir -m 0700 ~/.ssh && \ # Add the doctest entrypoint to /usr/bin so we don't have to supply the full path USER root -ADD doctest2 doctest3 /usr/bin +ADD doctest3 /usr/bin # Switch back to pwntools to actually run the image USER pwntools WORKDIR /home/pwntools # Copy in the Doctest script -COPY doctest2 doctest3 tmux.sh /home/pwntools +COPY doctest3 tmux.sh /home/pwntools/ # Do everything in UTF-8 mode! ENV LANG=C.UTF-8 diff --git a/travis/docker/Dockerfile.travis b/travis/docker/Dockerfile.travis index 4346d8799..75de4f035 100644 --- a/travis/docker/Dockerfile.travis +++ b/travis/docker/Dockerfile.travis @@ -1,7 +1,6 @@ # Some additional debugging tools that are useful -RUN python2.7 -m pip install --no-cache-dir ipdb && \ - python3 -m pip install --no-cache-dir ipdb +RUN python3 -m pip install --no-cache-dir ipdb # Install debugging utilities USER root @@ -17,7 +16,8 @@ RUN mkdir /etc/qemu-binfmt && \ ln -sf /usr/lib/powerpc-linux-gnu /etc/qemu-binfmt/powerpc && \ ln -sf /usr/lib/powerpc-linux-gnu64 /etc/qemu-binfmt/powerpc64 && \ ln -sf /usr/lib/sparc64-linux-gnu /etc/qemu-binfmt/sparc64 && \ - ln -sf /usr/lib/riscv64-linux-gnu /etc/qemu-binfmt/riscv64 + ln -sf /usr/lib/riscv64-linux-gnu /etc/qemu-binfmt/riscv64 && \ + ln -sf /usr/lib/loongarch64-linux-gnu /etc/qemu-binfmt/loongarch64 # Create the Travis user USER root @@ -41,14 +41,14 @@ RUN mkdir -m 0700 ~/.ssh && \ # Add the doctest entrypoint to /usr/bin so we don't have to supply the full path USER root -ADD doctest2 doctest3 /usr/bin +ADD doctest3 /usr/bin # Switch back to pwntools to actually run the image USER pwntools WORKDIR /home/pwntools # Copy in the Doctest script -COPY doctest2 doctest3 tmux.sh /home/pwntools +COPY doctest3 tmux.sh /home/pwntools/ # Do everything in UTF-8 mode! ENV LANG=C.UTF-8 diff --git a/travis/docker/Makefile b/travis/docker/Makefile index 50aa8cf7e..0b4c1b7ef 100644 --- a/travis/docker/Makefile +++ b/travis/docker/Makefile @@ -18,7 +18,7 @@ shell bash: image --entrypoint ./tmux.sh \ travis -doctest2 doctest3: image FORCE +doctest3: image FORCE @echo Running doctests docker run -it --privileged --net=host --hostname localhost \ --ulimit core=-1:-1 \ @@ -31,4 +31,4 @@ image: Dockerfile docker build -t travis . FORCE: -.PHONY: all image doctest2 doctest3 bash +.PHONY: all image doctest3 bash diff --git a/travis/docker/README.md b/travis/docker/README.md index 7aae9f7db..fad3bda6b 100644 --- a/travis/docker/README.md +++ b/travis/docker/README.md @@ -9,12 +9,6 @@ $ make -C travis/docker ANDROID=yes $ 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 diff --git a/travis/docker/doctest2 b/travis/docker/doctest2 deleted file mode 100755 index bad37834d..000000000 --- a/travis/docker/doctest2 +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -reset - -# We have to explicitly start the ssh service -sudo service ssh start - -# Enable the IPv6 interface -echo 0 | sudo tee /proc/sys/net/ipv6/conf/all/disable_ipv6 - -# Run the tests from the repo -cd ~ - -ORIG_TARGET="$TARGET" - -if [ -n "$TARGET" ]; then - TARGET=$(find ~/pwntools/docs/source -iname "$TARGET") - - if [ -z "$TARGET" ]; then - echo "Could not find target $ORIG_TARGET" - exit 1 - fi - - echo "DOCTEST TARGET is $TARGET" -fi - -# GDB tests currently don't work inside Docker for unknown reasons. -# Disable these tests until we can get them working. -echo > ~/pwntools/docs/source/gdb.rst - -# Android tests are disabled in general, support is deprecateds -echo > ~/pwntools/docs/source/adb.rst -echo > ~/pwntools/docs/source/protocols.rst - -export PWNLIB_NOTERM=1 -python2.7 -bb -m coverage run -m sphinx -b doctest $HOME/pwntools/docs/source $HOME/pwntools/docs/build/doctest $TARGET - diff --git a/travis/libcdb_nginx_cache.conf b/travis/libcdb_nginx_cache.conf new file mode 100644 index 000000000..689784978 --- /dev/null +++ b/travis/libcdb_nginx_cache.conf @@ -0,0 +1,69 @@ +events { + worker_connections 1024; +} + +http { + proxy_cache_path /var/cache/nginx keys_zone=my_cache:1m max_size=1g inactive=12w use_temp_path=off; + log_format cache_st '$remote_addr - $remote_user - $upstream_cache_status [$time_local] ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; + access_log /dev/stdout cache_st; + + server { + listen 3000; + proxy_cache my_cache; + + location / { + proxy_set_header Host debuginfod.elfutils.org; + proxy_cache_revalidate on; + proxy_cache_key $scheme://$host$uri$is_args$query_string; + proxy_cache_valid 200 404 12w; + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 http_429; + proxy_pass https://debuginfod.elfutils.org/; + } + } + + server { + listen 3001; + proxy_cache my_cache; + + location / { + proxy_set_header Host libc.rip; + proxy_cache_methods GET HEAD POST; + proxy_cache_revalidate on; + proxy_cache_key $scheme://$host$uri$is_args$query_string$request_body; + proxy_cache_valid 200 404 12w; + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 http_429; + proxy_pass https://libc.rip/; + } + } + + server { + listen 3002; + proxy_cache my_cache; + + location / { + proxy_set_header Host archive.ubuntu.com; + proxy_cache_revalidate on; + proxy_cache_key $scheme://$host$uri$is_args$query_string; + proxy_cache_valid 200 404 12w; + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 http_429; + proxy_pass http://archive.ubuntu.com/; + } + } + + server { + listen 3003; + proxy_cache my_cache; + + location / { + proxy_set_header Host gitlab.com; + proxy_ssl_server_name on; + proxy_cache_revalidate on; + proxy_cache_key $scheme://$host$uri$is_args$query_string; + proxy_cache_valid 200 404 12w; + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 http_429; + proxy_pass https://gitlab.com/; + } + } +}