Пример #1
0
    def test_sanitise(self):
        """Tests the sql.sanitise function"""

        self.assertEqual('', sql.sanitise(None))
        self.assertEqual('', sql.sanitise(''))
        self.assertEqual(
            "''); select 1; --",
            sql.sanitise("'); select 1; --")
        )
Пример #2
0
    def execute(self):
        options = self.options

        options.pattern = sanitise(options.pattern)

        cons = Source.connections()

        # search exact match of connection
        for connection in cons:
            opts = options.get(connection.dbms)
            if opts.show_code > 1 and connection.matches(opts):
                try:
                    connection.connect(opts.database)
                    return to_dto(map(
                        RowItem, opts.statement_activity(connection)))
                finally:
                    connection.close()

        raise Exception('Specify the complete URI of the connection')
Пример #3
0
    def test_sanitise(self):
        """Tests the sql.sanitise function"""

        self.assertEqual('', sql.sanitise(None))
        self.assertEqual('', sql.sanitise(''))
        self.assertEqual("''); select 1; --", sql.sanitise("'); select 1; --"))