ChromeSessionParser语法问题

时间:2016-01-23 16:19:41

标签: python function google-chrome syntax sqlite

我遇到了部分代码的问题,我在底部添加了错误。问题出现在sqllite3.operationError部分周围。我试图删除它,但当我做另一个错误发生在第68行'def getpath():',我不知道为什么错误出现任何和所有的帮助,一如既往的感谢。我的代码通常用于从我的数据库中取出登录数据并显示在csv文件中

 Traceback (most recent call last):
  File "C:/Users/Lewis Collins/Python Project/ChromeDB's/ChromeSessionParser.py", line 90, in <module>
    args_parser()
  File "C:/Users/Lewis Collins/Python Project/ChromeDB's/ChromeSessionParser.py", line 19, in args_parser
    for data in main():
  File "C:/Users/Lewis Collins/Python Project/ChromeDB's/ChromeSessionParser.py", line 35, in main
    for information in value:
TypeError: 'builtin_function_or_method' object is not iterable

错误

string params = "";

params+= CheckBox1.Checked ? "param1=true":"";
params+= CheckBox2.Checked ? "param2=true":"";
params+= CheckBox3.Checked ? "param3=true":"";

string url = "default.aspx"

url += params != "" ? "?" + params: "";
Response.Redirect(url);

1 个答案:

答案 0 :(得分:0)

正确的方法是:

except sqlite3.OperationalError as e:

main()应该是这样的:

def main():
    info_list = []
    path = getpath()
    try:
        connection = sqlite3.connect(path + "Login Data")
        with connection:
            cursor = connection.cursor()
            v = cursor.execute('SELECT action_url, username_value, password_value FROM logins')
            value = v.fetchall


        for information in value:
            if os.name == 'nt':
                password = win32crypt.CryptUnprotectData(information[2], None, None, None, 0)[1]
                if password:
                    info_list.append({
                        'origin_url': information[0],
                        'username': information[1],
                        'password': str(password)
                    })



    except sqlite3.OperationalError as e:
        e = str(e)
        if (e == 'database is locked'):
            print '[!] Make sure Google Chrome is not running in the background'
            sys.exit(0)
        elif (e == 'no such table: logins'):
            print '[!] Something wrong with the database name'
            sys.exit(0)
        elif (e == 'unable to open database file'):
            print '[!] Something wrong with the database path'
            sys.exit(0)
        else:
            print e
            sys.exit(0)



    return info_list