Example #1
0
 def setUp(self):
     self.uri_opener = ExtendedUrllib()
     
     # Start the proxy daemon
     self._proxy = Proxy('127.0.0.2', 0, ExtendedUrllib(), ProxyHandler)
     self._proxy.start()
     self._proxy.wait_for_start()
     
     port = self._proxy.get_port()
     
     # Configure the proxy
     settings = OpenerSettings()
     options = settings.get_options()
     proxy_address_opt = options['proxy_address']
     proxy_port_opt = options['proxy_port']
     
     proxy_address_opt.set_value('127.0.0.2')
     proxy_port_opt.set_value(port)
     
     settings.set_options(options)
     self.uri_opener.settings = settings
Example #2
0
    def setUp(self):
        self.uri_opener = ExtendedUrllib()

        # Start the proxy daemon
        self._proxy = Proxy('127.0.0.2', 0, ExtendedUrllib(), ProxyHandler)
        self._proxy.start()
        self._proxy.wait_for_start()

        port = self._proxy.get_port()

        # Configure the proxy
        settings = OpenerSettings()
        options = settings.get_options()
        proxy_address_opt = options['proxy_address']
        proxy_port_opt = options['proxy_port']

        proxy_address_opt.set_value('127.0.0.2')
        proxy_port_opt.set_value(port)

        settings.set_options(options)
        self.uri_opener.settings = settings
Example #3
0
    def test_ntlm_auth_valid_creds(self):
        self.uri_opener = ExtendedUrllib()

        settings = OpenerSettings()
        options = settings.get_options()
        ntlm_domain = options['ntlm_auth_domain']
        ntlm_user = options['ntlm_auth_user']
        ntlm_pass = options['ntlm_auth_passwd']
        ntlm_url = options['ntlm_auth_url']

        ntlm_domain.set_value('moth')
        ntlm_user.set_value('admin')
        ntlm_pass.set_value('admin')
        ntlm_url.set_value('http://moth/w3af/core/ntlm_auth/ntlm_v1/')

        settings.set_options(options)
        self.uri_opener.settings = settings

        url = URL("http://moth/w3af/core/ntlm_auth/ntlm_v1/")
        http_response = self.uri_opener.GET(url, cache=False)
        self.assertIn('You are admin from MOTH/', http_response.body)
Example #4
0
 def test_ntlm_auth_valid_creds(self):
     
     self.uri_opener = ExtendedUrllib()
     
     settings = OpenerSettings()
     options = settings.get_options()
     ntlm_domain = options['ntlm_auth_domain'] 
     ntlm_user = options['ntlm_auth_user']
     ntlm_pass = options['ntlm_auth_passwd']
     ntlm_url = options['ntlm_auth_url']
     
     ntlm_domain.set_value('moth') 
     ntlm_user.set_value('admin')
     ntlm_pass.set_value('admin')
     ntlm_url.set_value('http://moth/w3af/core/ntlm_auth/ntlm_v1/')
     
     settings.set_options(options)
     self.uri_opener.settings = settings
     
     url = URL("http://moth/w3af/core/ntlm_auth/ntlm_v1/")
     http_response = self.uri_opener.GET(url, cache=False)
     self.assertIn('You are admin from MOTH/', http_response.body)
Example #5
0
class TestOpenerSettings(unittest.TestCase):
    def setUp(self):
        self.os = OpenerSettings()

    def test_options(self):
        opt_lst = self.os.get_options()
        self.os.set_options(opt_lst)

        for opt in opt_lst:
            self.assertIn(opt.get_type(), OPTION_TYPES)
            self.assertTrue(opt.get_name())
            self.assertEqual(opt, opt)

            # Just verify that this doesn't crash and that the types
            # are correct
            self.assertIsInstance(opt.get_name(), basestring)
            self.assertIsInstance(opt.get_desc(), basestring)
            self.assertIsInstance(opt.get_type(), basestring)
            self.assertIsInstance(opt.get_help(), basestring)
            self.assertIsInstance(opt.get_value_str(), basestring)

    def test_desc(self):
        self.os.get_desc()
Example #6
0
class TestOpenerSettings(unittest.TestCase):

    def setUp(self):
        self.os = OpenerSettings()

    def test_options(self):
        opt_lst = self.os.get_options()
        self.os.set_options(opt_lst)

        for opt in opt_lst:
            self.assertIn(opt.get_type(), OPTION_TYPES)
            self.assertTrue(opt.get_name())
            self.assertEqual(opt, opt)

            # Just verify that this doesn't crash and that the types
            # are correct
            self.assertIsInstance(opt.get_name(), basestring)
            self.assertIsInstance(opt.get_desc(), basestring)
            self.assertIsInstance(opt.get_type(), basestring)
            self.assertIsInstance(opt.get_help(), basestring)
            self.assertIsInstance(opt.get_value_str(), basestring)

    def test_desc(self):
        self.os.get_desc()
Example #7
0
 def setUp(self):
     self.os = OpenerSettings()
Example #8
0
 def setUp(self):
     self.os = OpenerSettings()