sqlite3 error “attempt to write a readonly database”

a 夏天 提交于 2019-12-13 17:24:06

问题


I'm sure this will be a silly question for those who know python but I'm trying to debug a python script and I can't find out something.

I'm getting the following error:

(sqlite3.OperationalError) attempt to write a readonly database [SQL: u'INSERT INTO samples (file_size, file_type, md5, crc32, sha1, sha256, sha512, ssdeep) VALUES (?, ?, ?, ?, ?, ?, ?, ?)']

I know that to fix this what I have to do is to change the DB access to write, but I don't know where this DB is located. The DB is created in the script this way:

db = Database()

And these are the imports:

import argparse
import fnmatch
import logging
import os
import random
import sys

try:
    import requests
    HAVE_REQUESTS = True
except ImportError:
    HAVE_REQUESTS = False

And the line in which I'm getting the error is the following one

db.add_path(...);

This file is part of the Cuckoo Droid project, specifically is the script to submit a APK to be analyzed. I don't know if the DB is located in the Android emulator or in the host machine. If so, I would like to know where that DB could be located in order to change the privileges of the DB to give write access. Any help would be grate, thanks.


回答1:


The DB I was looking for is located inside cuckoo/ directory. Specifically inside db/ folder. To fix my problem what I made was to change privileges of the folder recursively:

sudo chmod 777 -R db


来源:https://stackoverflow.com/questions/43698188/sqlite3-error-attempt-to-write-a-readonly-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!