Exposing variables from connection plugin

Hello all

I have modified the psrp plugin, so when connecting, it also stablishes an SSH connection with a SOCKS proxy in a random port, so psrp connection is stablished using that SOCKS proxy. As this is a random number, I want to use that value, the SOCKS port number later, in the tasks, to make some tasks use that proxy. How can I “publish” a variable from the connection plugin, so it is accesible from the tasks?

Thanks!

Currently, there is no set way for connection plugins to return
variables, I have been thinking this would be a needed feature. There
are probably a few hacky ways of doing it, but i dont recommend that
approach as those are not guaranteed to continue working.

Thanks Brian, could you share those hacks? Would it be enough to set an environment variable (at least for delegate_to localhost tasks)?