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

Output in JSON format #224

Closed
david942j opened this issue Oct 3, 2024 · 1 comment · Fixed by #225
Closed

Output in JSON format #224

david942j opened this issue Oct 3, 2024 · 1 comment · Fixed by #225

Comments

@david942j
Copy link
Owner

ref: Gallopsled/pwntools#932 (comment)

Output in a more parsable format sounds a good idea to make one_gadget be more usable across different tools.

@david942j
Copy link
Owner Author

david942j commented Oct 3, 2024

Example output (detailed field names might be changed during implementation, will update this comment once I have a PR):

$ one_gadget /lib/x86_64-linux-gnu/libc.so.6 -o json

{
"gadgets": [
    {
      "value": 932606,
      "effect": "execve('/bin/sh', r15, r12)",
      "constraints": ["[r15] == NULL || r15 == NULL || r15 is a valid argv", "[r12] == NULL || r12 == NULL || r12 is a valid envp"]
    },
    {
      ...
    }
  ]
}

For the case of --near provided, output would become an array on the top level:
$ one_gadget /lib/x86_64-linux-gnu/libc.so.6 --near exit,mkdir -o json

[
  {
    "near": "exit",
    "near_offset": <offset of exit in libc>,
    "gadgets": [
       { ... }
    ]
  },
  {
    "near": "mkdir",
    "near_offset": <offset of mkdir in libc>,
    "gadgets": [
       { ... }
    ]
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant