mirror of
https://github.com/Kkevsterrr/geneva
synced 2024-12-22 01:29:33 +01:00
added test_compression_strategy from dev
This commit is contained in:
parent
57e19c2d4c
commit
f759e9c938
@ -3,6 +3,7 @@ import os
|
||||
import pytest
|
||||
import tempfile
|
||||
|
||||
import dns.resolver
|
||||
import actions.tree
|
||||
import actions.drop
|
||||
import actions.tamper
|
||||
@ -24,3 +25,17 @@ def test_compression_strategy(logger):
|
||||
with engine.Engine(53, "[UDP:dport:53]-tamper{DNS:qd:compress}-|", server_side=False, environment_id="compress_test", output_directory=actions.utils.RUN_DIRECTORY, log_level=actions.utils.CONSOLE_LOG_LEVEL):
|
||||
os.system("dig @8.8.8.8 google.com")
|
||||
|
||||
def test_compression_strategy(logger):
|
||||
"""
|
||||
Tests dns compression strategy.
|
||||
"""
|
||||
with engine.Engine(53, "[UDP:dport:53]-tamper{DNS:qd:compress}-|", server_side=False, environment_id="compress_test", output_directory=actions.utils.RUN_DIRECTORY, log_level=actions.utils.CONSOLE_LOG_LEVEL):
|
||||
resolver = dns.resolver.Resolver()
|
||||
resolver.nameservers = ["8.8.8.8"]
|
||||
resolver.lifetime = 3
|
||||
answer = resolver.query("google.com", "A")
|
||||
|
||||
assert answer, "Resolver query returned None"
|
||||
assert len(answer) > 0, "No answers"
|
||||
assert answer[0], "No answer to DNS query"
|
||||
print("Got answer: %s" % str(answer[0]))
|
||||
|
Loading…
Reference in New Issue
Block a user