lucviala / test-python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SOCKS5 Proxy Sockets tests

Creates a very simple infrastructure with:

  • client.py: Craft packet and implements SOCKS5 socket connection
  • main.py: Very simple dockerized socket listener
  • The SOCKS5 proxy docker is ghcr.io/httptoolkit/docker-socks-tunnel:latest

How to run

⚠️ Don't forget to change the server IPAddress in client.py

HOSTNAME$ docker inspect server | grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "",
                    "IPAddress": "172.18.0.3",
HOSTNAME$ pip install scapy PySocks
HOSTNAME$ docker-compose up -d
HOSTNAME$ python client.py

How to test

HOSTNAME$ pip install --user pytest
HOSTNAME$ pytest -sv tests
========================================= test session starts ==========================================
platform linux -- Python 3.9.9, pytest-7.3.1, pluggy-1.0.0 -- /home/fedora/.pyenv/versions/3.9.9/bin/python3
cachedir: .pytest_cache
rootdir: /home/fedora/Documents/git-repos/test-archi/endpoint
collected 1 item

tests/socks_test.py::test_server_response PASSED

========================================== 1 passed in 0.01s ===========================================

About


Languages

Language:Python 94.8%Language:Dockerfile 5.2%