Esempio n. 1
0
 def test_log_SQLi_data(self, logger):
     xss.log_SQLi_data(None)
     assert logger.args == []
     xss.log_SQLi_data(
         xss.SQLiData('https://example.com', 'Location', 'Oracle.*Driver',
                      'Oracle'))
     assert logger.args[0] == '===== SQLi Found ====='
     assert logger.args[1] == 'SQLi URL: https://example.com'
     assert logger.args[2] == 'Injection Point: Location'
     assert logger.args[3] == 'Regex used: Oracle.*Driver'
Esempio n. 2
0
 def test_get_SQLi_data(self):
     sqli_data = xss.get_SQLi_data("<html>SQL syntax MySQL</html>",
                                   "<html></html>", "https://example.com",
                                   "End of URL")
     expected_sqli_data = xss.SQLiData("https://example.com", "End of URL",
                                       "SQL syntax.*MySQL", "MySQL")
     assert sqli_data == expected_sqli_data
     sqli_data = xss.get_SQLi_data("<html>SQL syntax MySQL</html>",
                                   "<html>SQL syntax MySQL</html>",
                                   "https://example.com", "End of URL")
     assert sqli_data is None
Esempio n. 3
0
 def test_log_SQLi_data(self, monkeypatch, logger):
     logger.args = []
     monkeypatch.setattr("mitmproxy.ctx.log", logger)
     xss.log_SQLi_data(None)
     assert logger.args == []
     xss.log_SQLi_data(
         xss.SQLiData('https://example.com', 'Location', 'Oracle.*Driver',
                      'Oracle'))
     assert logger.args[0] == '===== SQLi Found ====='
     assert logger.args[1] == 'SQLi URL: https://example.com'
     assert logger.args[2] == 'Injection Point: Location'
     assert logger.args[3] == 'Regex used: Oracle.*Driver'
Esempio n. 4
0
 def test_data_equals(self):
     xssData = xss.XSSData("a", "b", "c", "d")
     sqliData = xss.SQLiData("a", "b", "c", "d")
     assert xssData == xssData
     assert sqliData == sqliData