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

Cast int target pid to str in ssh-gdb context #2012

Merged
merged 1 commit into from
Apr 20, 2022
Merged

Cast int target pid to str in ssh-gdb context #2012

merged 1 commit into from
Apr 20, 2022

Conversation

0x3c3e
Copy link
Contributor

@0x3c3e 0x3c3e commented Dec 23, 2021

Pwntools Pull Request

Currently files like are generated:

import os

os.execve(
    "/usr/bin/ssh",
    [
        "ssh",
        "-C",
        "-t",
        "-p",
        "22",
        "-l",
        "0x3c3e",
        "host",
        "gdb",
        "-q",
        "/usr/bin/bash",
        6913, # int here, instead of str
        "-x",
        b"/tmp/tmp.JqkTMT5Sxw",
    ],
    os.environ,
)

If I use code below:

from pwn import *

context.arch = "amd64"
context.terminal = "/Applications/iTerm.app/Contents/MacOS/iTerm2"

ssh_session = ssh(host="host", user="0x3c3e")

p = ssh_session.process(["bash"])
# p.pid = str(p.pid) that line fixes it
gdb.attach(p)

p.interactive()

Results in:
TypeError: expected str, bytes or os.PathLike object, not int

@0x3c3e 0x3c3e changed the title Cast int target pid to str Cast int target pid to str in ssh context Dec 23, 2021
@0x3c3e 0x3c3e changed the title Cast int target pid to str in ssh context Cast int target pid to str in ssh-gdb context Dec 23, 2021
@Arusekk
Copy link
Member

Arusekk commented Dec 28, 2021

Great catch!

@Arusekk Arusekk enabled auto-merge (squash) December 28, 2021 13:57
@0x3c3e
Copy link
Contributor Author

0x3c3e commented Jan 25, 2022

@Arusekk should I change destination branch to dev? As the PR can't pass the checks rn for some reason.

@Arusekk
Copy link
Member

Arusekk commented Jan 25, 2022

No no, the dev branch is broken by #1828 now. Please amend the commit with something irrelevant, like git commit --amend --date=now and do a force push.

@Arusekk Arusekk merged commit 15efc3f into Gallopsled:stable Apr 20, 2022
gogo2464 pushed a commit to gogo2464/pwntools that referenced this pull request Sep 10, 2023
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 this pull request may close these issues.

2 participants