peewee.OperationalError: attempt to write a readonly database
dhondta opened this issue · 1 comments
dhondta commented
#!/usr/bin/python3
# main.py
from sploitkit import FrameworkConsole
if __name__ == '__main__':
FrameworkConsole(
"MySploit",
# configure your console settings here
).start()
Result:
$ python3 main.py
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/components/store.py", line 33, in get
db = [_ for _ in self.__pool if _.path == path][0]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2957, in connect
self._state.set_connection(self._connect())
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3293, in _connect
self._add_conn_hooks(conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3303, in _add_conn_hooks
self._set_pragmas(conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3318, in _set_pragmas
cursor.execute('PRAGMA %s = %s;' % (pragma, value))
sqlite3.OperationalError: attempt to write a readonly database
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3019, in execute_sql
cursor = self.cursor(commit)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3003, in cursor
self.connect()
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2960, in connect
self._initialize_connection(self._state.conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2796, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2957, in connect
self._state.set_connection(self._connect())
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3293, in _connect
self._add_conn_hooks(conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3303, in _add_conn_hooks
self._set_pragmas(conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3318, in _set_pragmas
cursor.execute('PRAGMA %s = %s;' % (pragma, value))
peewee.OperationalError: attempt to write a readonly database
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 7, in <module>
"MySploit",
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/console.py", line 480, in __init__
super(FrameworkConsole, self).__init__(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/console.py", line 90, in __init__
self.__init(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/console.py", line 154, in __init
self.reset()
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/console.py", line 285, in reset
Console.store = Console._storage.get(p)
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/components/store.py", line 49, in get
db.create_tables(self.models, safe=True)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3206, in create_tables
model.create_table(**options)
File "/usr/local/lib/python3.6/dist-packages/sploitkit-0.3.2-py3.6.egg/sploitkit/core/model.py", line 50, in create_table
super(Model, cls).create_table(**options)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 6497, in create_table
cls._schema.create_all(safe, **options)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 5647, in create_all
self.create_table(safe, **table_options)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 5502, in create_table
self.database.execute(self._create_table(safe=safe, **options))
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3034, in execute
return self.execute_sql(sql, params, commit=commit)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3028, in execute_sql
self.commit()
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2796, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3019, in execute_sql
cursor = self.cursor(commit)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3003, in cursor
self.connect()
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2960, in connect
self._initialize_connection(self._state.conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2796, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 183, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2957, in connect
self._state.set_connection(self._connect())
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3293, in _connect
self._add_conn_hooks(conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3303, in _add_conn_hooks
self._set_pragmas(conn)
File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 3318, in _set_pragmas
cursor.execute('PRAGMA %s = %s;' % (pragma, value))
peewee.OperationalError: attempt to write a readonly database
dhondta commented
This occurs after having used main.py
with sudo
. In this case, store.db
has not the right permission anymore and the OperationalError
is raised when restarting main.py
without privileges.