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

when pasting in term I donot get full line echo #109

Closed
drforbin opened this issue Oct 22, 2021 · 9 comments · Fixed by #110
Closed

when pasting in term I donot get full line echo #109

drforbin opened this issue Oct 22, 2021 · 9 comments · Fixed by #110
Assignees
Labels
bug Something isn't working

Comments

@drforbin
Copy link

When I paste in shell created with pwncat I donot get full line echo?
Any idea what's wrong?
great tool by the way

@drforbin drforbin added the bug Something isn't working label Oct 22, 2021
@cytopia
Copy link
Owner

cytopia commented Oct 27, 2021

Can you add some more info so that I can try to reprocude, e.g.: Remote binary/version and pwncat commands

@drforbin
Copy link
Author

Sure! Thank you for answering. When I use pwncat in -l port mode or --self-inject (either way) and I get a shell, I upgrade (i.e. get a pty, change stty settings etc) after that everthing is fine except when I paste something in the shell window I donot get an echo of pasted items until after I hit return. Using nc or ncat everthing works fine. Also I do get character by character echo.
Which is the say as I type the characters are echoed. Only when I paste does it NOT show until I hit a CR.
Really hard to do pentesting without pasting ability.

@cytopia cytopia self-assigned this Oct 27, 2021
@cytopia
Copy link
Owner

cytopia commented Oct 27, 2021

I was able to reproduce this behaviour. It might take some time to dig into the root of this issue. In the meantime what you could do in order to make your life a bit easier is to simply hit <space> after pasting (instead of <return>).

Good catch and thanks for reporting 👍

Edit: As verbose logging of pwncat on local side reflects this behaviour I would already assume that it is missing a flush somewhere.

@drforbin
Copy link
Author

Thank you for making such a great tool. Are you going to produce any binaries or will it alway be python?
I think your tool can be as great as chisel. But chisel has windows and unix* bins which would help alot.
As for the reason for bug. I seems to me to be a buffering issue. Try flushing.

Please me know when you find the cause, I'm curious.

@cytopia
Copy link
Owner

cytopia commented Oct 29, 2021

@drforbin can you give the branch release-0.1.2 a try: See PR here: #110

@cytopia
Copy link
Owner

cytopia commented Nov 1, 2021

@drforbin any chance you can try out the above posted branch and let me know if this fixes the issues on all the use-cases you were facing this?

@drforbin
Copy link
Author

drforbin commented Nov 1, 2021

Hi..I'll do it tonight

@drforbin
Copy link
Author

drforbin commented Nov 1, 2021

It seems to be working fine.
I only did a quick ncat <-> pwncat check.
What was wrong?

@cytopia
Copy link
Owner

cytopia commented Nov 2, 2021

The error was non trivial and I was doing a lot of trial&error to figure it out.

In the end I removed the non-blocking select call on stdin in terminal raw mode: https://github.com/cytopia/pwncat/pull/110/files#diff-70eb7791158dc5e238921ef7dc25ce6a6924dbb39ad728461816c8501b90da7fR3531

I made it blocking again (which doesn't really matter, as it runs in its own thread anyway).

Also not really 100% sure about the fix, but I guess the behaviour previously was as follows:

  • The input select call only reacted on key strokes
  • A paste from clipboard showed only the very first character (because of clicking the paste button on keyboard/mouse)
  • If you then pressed any key on the keyboard, it returned everything else from stdin

Without the non-blocking call, it now shows everything and does not just wait, until the select call sees new entries (which it only did after key presses)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants