1. A method comprising: (a) establishing, by a network device, a connection with a client requesting access to a network via the network device; (b) transmitting, by the network device, a first program to the client for automatic installation and execution thereon in response to the establishment; (c) installing, by the first program upon execution, a second program in a network stack of the client, the second program redirecting to the first program a packet from a client application destined for the network; (d) encapsulating, by the first program, payload from the redirected packet; and (e) transmitting, by the first program, the encapsulated payload to the network device.