def test_minimal_socat(self): command = construct_proxy_commands({ 'hostname': 'aaa', 'proxy_type': 'socat', 'port': 42, }) self.assertEqual(command, [['socat', 'STDIN', 'TCP:aaa:42']])
def test_minimal_nc(self): command = construct_proxy_commands({ 'hostname': 'aaa', 'proxy_type': 'nc', 'port': 42, }) self.assertEqual(command, [['nc', '-w', 180, '-G', 5, 'aaa', 42], ['nc', 'aaa', 42]])
def test_minimal_socat_socks(self): command = construct_proxy_commands({ 'hostname': 'aaa', 'proxy_type': 'socat_socks', 'socks_host': 'bbb', 'socks_port': 43, 'port': 42, }) self.assertEqual(command, [['socat', 'STDIN', 'SOCKS:bbb:aaa:42,socksport=43']])
def test_minimal_socat_http_proxy(self): command = construct_proxy_commands({ 'hostname': 'aaa', 'proxy_type': 'socat_http_proxy', 'http_proxy_host': 'bbb', 'http_proxy_port': 43, 'port': 42, }) self.assertEqual(command, [['socat', 'STDIN', 'PROXY:bbb:aaa:42,proxyport=43']])
def test_full_nc(self): command = construct_proxy_commands({ 'hostname': 'aaa', 'port': 42, 'verbose': True, 'proxy_type': 'nc', 'timeout': 45, }) self.assertEqual(command, [['nc', '-v', '-w', 45, '-G', 5, 'aaa', 42], ['nc', 'aaa', 42]])