Skip to content

fix: repair broken ssh and tcp-proxy tools - #10

Merged
brett-buskirk merged 1 commit into
mainfrom
fix/repair-broken-tools
Jul 4, 2026
Merged

fix: repair broken ssh and tcp-proxy tools#10
brett-buskirk merged 1 commit into
mainfrom
fix/repair-broken-tools

Conversation

@brett-buskirk

Copy link
Copy Markdown
Owner

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 by
actually 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.pyclient - paramiko.SSHClient() (assignment
    typo) and if __name__ = '__main__': (invalid syntax — the file could not
    even be parsed); also cast the entered port to int.
  • ssh/reverse-shell/ssh-rcmd.pyport = import('Enter port: ')
    (import is a keyword — SyntaxError); shell=True on a list argument to
    subprocess.check_output (silently ran only the first token instead of the
    full command); mixed str/bytes on channel sends.
  • ssh/server/ssh-server.py_init_ instead of __init__ (so
    self.event was never set); socket.SQL_SOCKET (no such attribute —
    AttributeError on every run; should be SOL_SOCKET); server = server()
    called the IP-string variable instead of instantiating the Server class;
    check_auth_password fell through to None instead of AUTH_FAILED on
    rejected credentials.
  • tcp/proxy/tcp-proxy.pyreceieve_from typo (called under the
    correct spelling everywhere else — NameError); remote_buffer was read
    unconditionally right after a block that only assigns it conditionally —
    UnboundLocalError whenever receive_first was False.

netcat.py, tcp-client.py, tcp-server.py, udp-client.py, and
packet-sniffer were read in full — no bugs found.

Test plan

All verified end-to-end on loopback:

  • netcat.py — listen/connect, -c shell, -u upload, -e execute
  • tcp-server.py / tcp-client.py — loopback round trip
  • udp-client.py — loopback round trip
  • tcp-proxy.py — proxied traffic with receive_first both True and False
  • ssh-server.py + ssh-cmd.py — paramiko client authenticates successfully
  • ssh-server.py + ssh-rcmd.py — reverse-shell command execution round trip
  • packet-sniffer — existing 134-test pytest suite passes unchanged
  • packet-sniffer live raw-socket capture — needs root; not available in
    this sandbox, not exercised here (code was read in full, no bugs found)

🤖 Generated with Claude Code

- 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>
@brett-buskirk brett-buskirk self-assigned this Jul 4, 2026
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

✅ AgentGate: Passed

4 files changed  ·  +16 -15 lines

No issues found.

Generated by AgentGate

@brett-buskirk
brett-buskirk merged commit eb7b1d7 into main Jul 4, 2026
2 checks passed
@brett-buskirk
brett-buskirk deleted the fix/repair-broken-tools branch July 4, 2026 12:41
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.

1 participant