fix: repair broken ssh and tcp-proxy tools - #10
Merged
Conversation
- ssh/client/ssh-cmd.py: fix `client - paramiko.SSHClient()` assignment typo
and `if __name__ = '__main__':` invalid syntax (file could not be parsed
at all); cast the entered port to int.
- ssh/reverse-shell/ssh-rcmd.py: fix `port = import('Enter port: ')`
(SyntaxError, `import` is a keyword); drop `shell=True` on a list arg to
subprocess.check_output (silently ran only the first token); send bytes
consistently instead of mixing str/bytes on the channel.
- ssh/server/ssh-server.py: fix `_init_` (never called, `self.event` was
never set), `socket.SQL_SOCKET` (no such attribute, should be
`SOL_SOCKET`), and `server = server()` (called the IP-string variable
instead of instantiating the `Server` class); return AUTH_FAILED on
rejected credentials instead of falling through to `None`.
- tcp/proxy/tcp-proxy.py: fix `receieve_from` typo (called under the
correct spelling everywhere else -- NameError) and an UnboundLocalError
where `remote_buffer` was read unconditionally but only ever assigned
inside `if receive_first:`.
Verified end-to-end on loopback: netcat (listen/connect, -c, -u, -e),
tcp-server/tcp-client, udp-client, tcp-proxy (both receive_first values),
ssh-server+ssh-cmd (auth), and ssh-server+ssh-rcmd (reverse-shell command
exec). packet-sniffer's existing 134-test pytest suite passes unchanged;
its live raw-socket capture path requires root and could not be exercised
in this sandbox.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ AgentGate: Passed4 files changed · +16 -15 lines No issues found. Generated by AgentGate |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of Phase 1 (v0.1.0 — Structure & Naming, #2). Before restructuring the
raw-merge tools into a proper
src/layout, this repairs real bugs found byactually reading and running each tool (per CLAUDE.md's "verify & fix" mandate).
No renames or moves here — just behavior fixes at the current file paths, so
the diff is easy to review.
ssh/client/ssh-cmd.py—client - paramiko.SSHClient()(assignmenttypo) and
if __name__ = '__main__':(invalid syntax — the file could noteven be parsed); also cast the entered port to
int.ssh/reverse-shell/ssh-rcmd.py—port = import('Enter port: ')(
importis a keyword — SyntaxError);shell=Trueon a list argument tosubprocess.check_output(silently ran only the first token instead of thefull command); mixed
str/byteson channel sends.ssh/server/ssh-server.py—_init_instead of__init__(soself.eventwas never set);socket.SQL_SOCKET(no such attribute —AttributeErroron every run; should beSOL_SOCKET);server = server()called the IP-string variable instead of instantiating the
Serverclass;check_auth_passwordfell through toNoneinstead ofAUTH_FAILEDonrejected credentials.
tcp/proxy/tcp-proxy.py—receieve_fromtypo (called under thecorrect spelling everywhere else —
NameError);remote_bufferwas readunconditionally right after a block that only assigns it conditionally —
UnboundLocalErrorwheneverreceive_firstwasFalse.netcat.py,tcp-client.py,tcp-server.py,udp-client.py, andpacket-snifferwere read in full — no bugs found.Test plan
All verified end-to-end on loopback:
netcat.py— listen/connect,-cshell,-uupload,-eexecutetcp-server.py/tcp-client.py— loopback round tripudp-client.py— loopback round triptcp-proxy.py— proxied traffic withreceive_firstbothTrueandFalsessh-server.py+ssh-cmd.py— paramiko client authenticates successfullyssh-server.py+ssh-rcmd.py— reverse-shell command execution round trippacket-sniffer— existing 134-testpytestsuite passes unchangedpacket-snifferlive raw-socket capture — needs root; not available inthis sandbox, not exercised here (code was read in full, no bugs found)
🤖 Generated with Claude Code