Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add framework for testing protocol scanners #111

Closed
wants to merge 1 commit into from
Closed

Add framework for testing protocol scanners #111

wants to merge 1 commit into from

Conversation

laanwj
Copy link
Contributor

@laanwj laanwj commented Nov 12, 2016

This adds a mock SOCKS5 proxy to be able to test protocol scanners. It creates a single-threaded SOCKS5 proxy on localhost which processes connection requests and dispatches them to a test-specific
interface (it makes no actual outgoing connections), which can do further testing of the protocol specifics.

Currently this just tests available/not available for all protocols. This is not great, but it gives surprisingly much test coverage at the moment. This will likely go down once more protocols scanners do deeper
probing, however.

This adds a mock SOCKS5 proxy to be able to test protocol
scanners. It creates a single-threaded SOCKS5 proxy on localhost
which processes connection requests and dispatches them to a test-specific
interface, which can do further testing of the protocol specifics.

Currently this just tests available/not available for all protocols.
This is not great, but it gives surprisingly much test coverage at the
moment. This will likely go down once more protocols scanners do deeper
probing, however.
@coveralls
Copy link

coveralls commented Nov 12, 2016

Coverage Status

Coverage increased (+22.4%) to 53.519% when pulling e583191 on laanwj:2016_10_test_protocol_framework into 302e3a4 on s-rah:onionscan-0.3.

@s-rah
Copy link
Owner

s-rah commented Nov 14, 2016

Awesome! I really like the testing interface! And the obvious jump in coverage...

The one thing that concerns me about this is the amount of code in the test bed dedicated to mocking the socks5 connection - I feel that we should be able to wrap around that interface and not have to worry about it when testing protocols - ideally there should be no need to launch actual networking code at all.

This likely means abstracting out some of the networking, but I think the overall result will be cleaner, and minimize the amount of testing code needed.

I also think there is an awful lot of commonality in these current protocol scans that we can factor out (e.g. simply connected to a server and checking availability is applicable to a large number of current scans. So is scraping the software banner.) - too offbeat for this PR, but probably worth mentioning.

On a similar testing front @emanchado cooked up a potential integration test base: https://github.com/emanchado/onionscan-test - when it comes to testing tricky edge cases like weird redirects, or oddly served certificates, I think having a real test server implementing these things might be an easier option - which would leave the jobs of these unit tests to sanity check port correctness, server hangs (and maybe a tiny bit of application layer stuff).

@laanwj laanwj closed this May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants