winappdbg icon indicating copy to clipboard operation
winappdbg copied to clipboard

sql code is broken

Open arkkors opened this issue 4 years ago • 4 comments

when importing the winappdbg.sql module I get an crash:

    __all__ = ['CrashDAO']
    
    import sqlite3
    import datetime
    import warnings
    
    from sqlalchemy import create_engine, Column, ForeignKey, Sequence
    from sqlalchemy.engine.url import URL
    from sqlalchemy.ext.compiler import compiles
    from sqlalchemy.ext.declarative import declarative_base
>   from sqlalchemy.interfaces import PoolListener
E   ImportError: No module named interfaces

I installed the winappdbg version from current head, running on python 2.7 and sqlalchemy is present (SQLAlchemy==1.4.13)

arkkors avatar May 05 '21 16:05 arkkors

Looks like SQLAlchemy has changed their interface a bit: https://docs.sqlalchemy.org/en/13/core/interfaces.html#sqlalchemy.interfaces.PoolListener

For the time being I recommend installing an older version of SQLAlchemy until I port the code to the latest version.

MarioVilas avatar May 07 '21 17:05 MarioVilas

Alright, a quick look at the code shows that PoolListener was used as a hack for detecting certain features of sqlite. So another option is to just remove the offending code, that is, the broken import, the definition of the _SQLitePatch class and the line where that class is used.

I have no idea if anything else is broken too, down the road. I wrote this back when SQLAlchemy was still below 1.0 so more features could be gone. :(

MarioVilas avatar May 07 '21 17:05 MarioVilas

The PoolListener logic is roughly equivalent to the Event system now, as far as I see it. The code snippet from here should do the same thing like your _SQLitePatch class, for example. As for CrashDAO / BaseDAO, I'm not sure. I think the mapper functionality would the similar to the logic, however I have never used it.

arkkors avatar May 08 '21 09:05 arkkors

Another workaround for now would also be using an older version of SQLAlchemy.

pip install sqlalchemy==1.3.24

retpoline avatar Sep 10 '21 17:09 retpoline