Skip to content

Conversation

VakarisZ
Copy link
Contributor

What does this PR do?

Fixes #2216

Add any further explanations here.

PR Checklist

  • Have you added an explanation of what your changes do and why you'd like to include them?
  • Is the TravisCI build passing?
  • Was the CHANGELOG.md updated to reflect the changes?
  • Was the documentation framework updated to reflect the changes?
  • Have you checked that you haven't introduced any duplicate code?

Testing Checklist

  • Added relevant unit tests?

    Added tunneling test which goes through a grandparent

  • Have you successfully tested your changes locally? Elaborate:

    Tested by running tunneling tests (tunneling 4 hops, tunneling through a grandparent, PowerShell)

cakekoa and others added 30 commits August 30, 2022 20:08
'-' to 'infection-monkey-relay-control-message: -'
Add get_potential_users and remove pipe handling
Integrate TCPConnectionHandler and RelayUserHandler into TCPRelay
Remove TCPProxy
cakekoa and others added 28 commits September 12, 2022 11:59
If there's an uncaught error in the thread, the error won't propagate to the caller and we wouldn't know what went wrong from the logs. This fixes things and all uncaught errors get logged
If we were unsuccessful in starting the pipe, we don't want to sit
around and wait for a relay user to connect.
sock.recv takes two parameters instead of one
run() blocks, start() starts the run method on a different thread.
When a socket is closed, select.select() returns the socket in the
read_list. A closed socket can be detected by attempting to read from
it. If 0 data is read, then the socket is closed.

See below for more details:
> If a socket is in the output readable list, you can be
  as-close-to-certain-as-we-ever-get-in-this-business that a recv on
  that socket will return something.
https://docs.python.org/3/howto/sockets.html#non-blocking-sockets
https://stackoverflow.com/questions/17386487/python-detect-when-a-socket-disconnects-for-any-reason
https://stackoverflow.com/questions/17705239/is-there-a-way-to-detect-that-tcp-socket-has-been-closed-by-the-remote-peer-wit
Co-authored-by: Kekoa Kaaikala <kekoa.kaaikala@gmail.com>
Previously if the agent couldn't detect the OS, agent failed with errors
@VakarisZ VakarisZ merged commit b81f7ad into develop Sep 14, 2022
@VakarisZ VakarisZ deleted the 2216-tcp-relay branch September 30, 2022 13:19
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.

Replace tunnel/proxy with relay
5 participants