Unverified Commit 6f8a8f10 by Marcin Bury Committed by GitHub

Adding tests for D-Link DCS930L Auth RCE module (#530)

parent aa483726
from unittest import mock
from routersploit.modules.exploits.routers.dlink.dcs_930l_auth_rce import Exploit
@mock.patch("routersploit.modules.exploits.routers.dlink.dcs_930l_auth_rce.shell")
def test_exploit_success(mocked_shell, target):
""" Test scenario - successful exploitation """
route_mock = target.get_route_mock("/setSystemCommand", methods=["POST"])
route_mock.return_value = (
"TEST"
"ConfigSystemCommand"
"TEST"
)
exploit = Exploit()
assert exploit.target == ""
assert exploit.port == 80
assert exploit.username == "admin"
assert exploit.password == ""
exploit.target = target.host
exploit.port = target.port
assert exploit.check()
assert exploit.run() is None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment