Skip to content
This repository has been archived by the owner on Mar 27, 2018. It is now read-only.

Commit

Permalink
[cli] Move regression owtf/owtf#390 to CLI tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
DePierre committed Apr 19, 2016
1 parent 3a6b1b6 commit ac04066
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 33 deletions.
55 changes: 55 additions & 0 deletions tests_functional/cli/test_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import mock
from hamcrest import *

from owtf_testing.utils.owtftest import OWTFCliWebPluginTestCase


class OWTFCliTypeTest(OWTFCliWebPluginTestCase):

categories = ['cli', 'fast']

def test_cli_type_web_default_active(self):
"""Test OWTF WEB active plugins run by default if no '-g' option specified (regression #390)."""
self.run_owtf('-s', '-t', 'active', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
self.assert_is_in_logs('(web/active', name='Worker', msg='Web active plugins should have been run!')
self.assert_is_not_in_logs('(web/passive', name='Worker', msg='Web passive plugins should not have been run!')
self.assert_is_not_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

def test_cli_type_web_default_passive(self):
"""Test OWTF WEB passive plugins run by default if no '-g' option specified (regression #390)."""
self.run_owtf('-s', '-t', 'passive', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
self.assert_is_in_logs('(web/passive', name='Worker', msg='Web passive plugins should have been run!')
self.assert_is_not_in_logs('(web/active', name='Worker', msg='Web active plugins should not have been run!')
self.assert_is_not_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

def test_cli_type_web_default_semi_passive(self):
"""Test OWTF WEB semi passive plugins run by default if no '-g' option specified (regression #390)."""
self.run_owtf('-s', '-t', 'semi_passive', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
self.assert_is_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should have been run!')
self.assert_is_not_in_logs('(web/active', name='Worker', msg='Web active plugins should not have been run!')
self.assert_is_not_in_logs('(web/passive', name='Worker', msg='Web passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

def test_cli_type_net_default_bruteforce(self):
"""Test OWTF NET bruteforce plugins run by default if no '-g' option specified and target is IP (regression #390)."""
self.run_owtf('-s', '-t', 'bruteforce', "%s:%s" % (self.IP, self.PORT))
self.assert_is_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should have been run!')
self.assert_is_not_in_logs('(web/active', name='Worker', msg='Web active plugins should not have been run!')
self.assert_is_not_in_logs('(web/passive', name='Worker', msg='Web passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')


33 changes: 0 additions & 33 deletions tests_functional/plugins/web/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,3 @@ def test_web_grep(self):
self.run_owtf('-g', 'web', '-t', 'grep', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

def test_web_default_active(self):
"""Test OWTF WEB active plugins run by default if no '-g' option specified (regression #390)."""
self.run_owtf('-s', '-t', 'active', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
self.assert_is_in_logs('(web/active', name='Worker', msg='Web active plugins should have been run!')
self.assert_is_not_in_logs('(web/passive', name='Worker', msg='Web passive plugins should not have been run!')
self.assert_is_not_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

def test_web_default_passive(self):
"""Test OWTF WEB passive plugins run by default if no '-g' option specified (regression #390)."""
self.run_owtf('-s', '-t', 'passive', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
self.assert_is_in_logs('(web/passive', name='Worker', msg='Web passive plugins should have been run!')
self.assert_is_not_in_logs('(web/active', name='Worker', msg='Web active plugins should not have been run!')
self.assert_is_not_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

def test_web_default_semi_passive(self):
"""Test OWTF WEB semi passive plugins run by default if no '-g' option specified (regression #390)."""
self.run_owtf('-s', '-t', 'semi_passive', "%s://%s:%s" % (self.PROTOCOL, self.IP, self.PORT))
self.assert_is_in_logs('(web/semi_passive', name='Worker', msg='Web semi passive plugins should have been run!')
self.assert_is_not_in_logs('(web/active', name='Worker', msg='Web active plugins should not have been run!')
self.assert_is_not_in_logs('(web/passive', name='Worker', msg='Web passive plugins should not have been run!')
self.assert_is_not_in_logs('(auxiliary/', name='Worker', msg='Aux plugins should not have been run!')
self.assert_is_not_in_logs('(network/', name='Worker', msg='Net plugins should not have been run!')
# Test OWTF exited cleanly.
self.assert_is_in_logs('All jobs have been done. Exiting.', name='MainProcess')

0 comments on commit ac04066

Please sign in to comment.