Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic darwin support for shellcrafter #2161

Merged
merged 16 commits into from Feb 4, 2024
Merged

Conversation

patryk4815
Copy link
Contributor

@patryk4815 patryk4815 commented Jan 24, 2023

Pwntools Pull Request

Added basic darwin support for shellcrafter

What is working on linux:

  • shellcraft
  • asm
  • disasm

What is working on darwin:

  • shellcraft
  • asm (binutils needed)
  • disasm (binutils needed)
  • run_assembly
  • run_shellcode

Testing

Pull Requests that introduce new code should try to add doctests for that code. See TESTING.md for more information.

Target Branch

Depending on what the PR is for, it needs to target a different branch.

You can always change the branch after you create the PR if it's against the wrong branch.

Branch Type of PR
dev New features, and enhancements
dev Documentation fixes and new tests
stable Bug fixes that affect the current stable branch
beta Bug fixes that affect the current beta branch, but not stable
dev Bug fixes for code that has never been released

Changelog

After creating your Pull Request, please add and push a commit that updates the changelog for the appropriate branch.
You can look at the existing changelog for examples of how to do this.

pwnlib/abi.py Outdated Show resolved Hide resolved
@patryk4815 patryk4815 changed the title Draft: basic darwin support for shellcrafter basic darwin support for shellcrafter Apr 9, 2023
@patryk4815 patryk4815 changed the title basic darwin support for shellcrafter Draft: basic darwin support for shellcrafter Apr 9, 2023
@patryk4815 patryk4815 changed the title Draft: basic darwin support for shellcrafter basic darwin support for shellcrafter Jun 24, 2023
@Arusekk Arusekk linked an issue Oct 1, 2023 that may be closed by this pull request
@Arusekk Arusekk linked an issue Oct 2, 2023 that may be closed by this pull request
@Arusekk
Copy link
Member

Arusekk commented Dec 28, 2023

@patryk4815 What's the status on this?

pwnlib/asm.py Show resolved Hide resolved
@Arusekk
Copy link
Member

Arusekk commented Jan 3, 2024

Could you also rebase the commits before merging so that the auto-generated stuff goes into a separate commit?

pwnlib/elf/corefile.py Outdated Show resolved Hide resolved
@patryk4815
Copy link
Contributor Author

patryk4815 commented Feb 4, 2024

@Arusekk i think it is ready

Simple code works:

from pwn import *

context.os = 'darwin'
context.arch = 'amd64'

f = tempfile.mktemp()
write(f, 'This is the flag\n')

shellcode = shellcraft.cat2(f) + shellcraft.exit(1)
intr = asm(shellcode)

print(shellcode)
print(intr)

print(disasm(intr))
print(run_shellcode(intr).recv(0x100))
print(run_assembly(shellcode).recv(0x100))

@Arusekk Arusekk merged commit b2cba03 into Gallopsled:dev Feb 4, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants