OWASP / OWASP/Nettacker

Add unit tests for socks_proxy.py

Open
#1,385 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
1.2k
Avg merge
1d 21h
Merged PRs (30d)
16

Description

Summary

nettacker/core/socks_proxy.py currently has zero unit tests.
This file is critical, it's called directly in app.py for
every single scan via set_socks_proxy().

Affected File

nettacker/core/socks_proxy.py

What Needs to Be Done

Write unit tests covering:

  • getaddrinfo() return format and structure
  • set_socks_proxy(None) — no proxy, returns default socket
  • set_socks_proxy("socks5://host:port") — SOCKS5 without auth
  • set_socks_proxy("socks4://host:port") — SOCKS4 without auth
  • set_socks_proxy("socks5://user:pass@host:port") — SOCKS5 with authentication

Place tests in tests/core/test_socks_proxy.py matching the existing pattern.

Acceptance Criteria

  • All calls to socks library must be mocked (no real connections)
  • 100% line coverage for socks_proxy.py
  • Tests run successfully with pytest tests/core/test_socks_proxy.py

Context

This is part of the GSoC 2026 goal to raise overall test coverage to 85%.
The existing tests/core/test_die.py and tests/core/test_ip.py serve
as reference implementations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nettacker/core/socks_proxy.py and compare the patterns in tests/core/test_die.py and tests/core/test_ip.py. Run pytest tests/core/test_socks_proxy.py while adding mocked coverage for getaddrinfo() and each set_socks_proxy() case listed in the issue. Done means all socks-library calls are mocked, the requested cases pass, and socks_proxy.py reaches 100% line coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking, testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.