2022-11-19 16:58:58 -08:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import atheris
|
2022-11-19 15:14:12 -08:00
|
|
|
from boddle import boddle
|
2022-11-19 16:58:58 -08:00
|
|
|
|
2022-11-19 15:14:12 -08:00
|
|
|
from groove import ondemand
|
|
|
|
|
|
|
|
|
2022-11-19 16:58:58 -08:00
|
|
|
def test_server():
|
2022-11-19 15:14:12 -08:00
|
|
|
with boddle():
|
|
|
|
assert ondemand.index() == 'Groovy.'
|
2022-11-19 16:06:23 -08:00
|
|
|
|
|
|
|
|
2022-11-19 16:58:58 -08:00
|
|
|
def test_auth_with_valid_credentials():
|
2022-11-19 16:06:23 -08:00
|
|
|
with boddle(auth=(os.environ.get('USERNAME'), os.environ.get('PASSWORD'))):
|
|
|
|
assert ondemand.admin() == 'Authenticated. Groovy.'
|
2022-11-19 16:58:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
def test_auth_random_input():
|
|
|
|
|
|
|
|
def auth(fuzzed_input):
|
|
|
|
with boddle(auth=(fuzzed_input, fuzzed_input)):
|
|
|
|
result = ondemand.admin()
|
|
|
|
assert result.body == 'Access denied'
|
|
|
|
|
|
|
|
atheris.Setup([sys.argv[0], "-atheris_runs=100000"], auth)
|
|
|
|
try:
|
|
|
|
atheris.Fuzz()
|
|
|
|
except SystemExit:
|
|
|
|
pass
|