DefensePointSecurity / threat_note

DPS' Lightweight Investigation Notebook
Apache License 2.0
423 stars 97 forks source link

Login / Registration Issue Following Latest PR's #125

Open christiancyint opened 8 years ago

christiancyint commented 8 years ago

Getting the following error when attempting to login:

Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Same error when attempting to re-register.

Login page also shows this: Error - Please log in to access this page.

Possibly just a local issue but seemed to pop up over the last 2 PR's or so. Will try and troubleshoot a little more to see if it's a local problem (may have nothing to do with the latest PR's)

Thanks!

christiancyint commented 8 years ago

FYI - This is on OSX Yosemite, Chrome 48

brianwarehime commented 8 years ago

I just pulled down the latest copy and didn't hit any issues when registering/logging in. OS X Yosemite 10.11.2 Google Chrome here as well.

christiancyint commented 8 years ago

Here's the debug / error output (thanks @sroberts for the initial troubleshooting - I can attach this output as TXT also if that's easier):

sqlalchemy.exc.OperationalError OperationalError: (sqlite3.OperationalError) no such column: users.password [SQL: u'SELECT users._id AS users__id, users.user AS users_user, users.email AS users_email, users.password AS users_password, users.apikey AS users_apikey \nFROM users \nWHERE users.password = ? AND users.user = ?\n LIMIT ? OFFSET ?'] [parameters: ('hashed_pw', u'email_address', 1, 0)]

File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Library/Python/2.7/site-packages/flask_restful/init.py", line 271, in error_router return original_handler(e) File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Library/Python/2.7/site-packages/flask_restful/init.py", line 271, in error_router return original_handler(e) File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functionsrule.endpoint File "/Users/Christian/Desktop/github_repos/threat_note/threat_note/threat_note.py", line 131, in login user = form.get_user() File "/Users/Christian/Desktop/github_repos/threat_note/threat_note/threat_note.py", line 84, in get_user self.password.data.encode('utf-8')).hexdigest()).first() File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2634, in first ret = list(self[0:1]) File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2457, in getitem return list(res) File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2736, in iter return self._execute_and_instances(context) File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2751, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/Library/Python/2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement compiled_sql, distilled_params File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception exc_info File "/Library/Python/2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause reraise(type(exception), exception, tb=exc_tb) File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/Library/Python/2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters)

christiancyint commented 8 years ago

Haven't fired up threat_note in a while. From my terminal I ran honcho start. The server started but I also encountered an error.

Christians-MBP:threat_note Christian$ honcho start
19:10:28 system | web.1 started (pid=3066)
19:10:28 web.1  | [2016-04-05 19:10:28 -0400] [3066] [INFO] Starting gunicorn 19.4.5
19:10:28 web.1  | [2016-04-05 19:10:28 -0400] [3066] [INFO] Listening at: http://0.0.0.0:5000 (3066)
19:10:28 web.1  | [2016-04-05 19:10:28 -0400] [3066] [INFO] Using worker: sync
19:10:28 web.1  | [2016-04-05 19:10:28 -0400] [3069] [INFO] Booting worker with pid: 3069
19:10:44 web.1  | [2016-04-05 19:10:44 -0400] [3069] [ERROR] Error handling request /login

When attempting to login in the web app, I received an "Internal Server Error." Here is the full log:

19:10:44 web.1  | Traceback (most recent call last):
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/gunicorn/workers/sync.py", line 130, in handle
19:10:44 web.1  |     self.handle_request(listener, req, client, addr)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/gunicorn/workers/sync.py", line 171, in handle_request
19:10:44 web.1  |     respiter = self.wsgi(environ, resp.start_response)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
19:10:44 web.1  |     return self.wsgi_app(environ, start_response)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
19:10:44 web.1  |     response = self.make_response(self.handle_exception(e))
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask_restful/__init__.py", line 271, in error_router
19:10:44 web.1  |     return original_handler(e)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
19:10:44 web.1  |     reraise(exc_type, exc_value, tb)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
19:10:44 web.1  |     response = self.full_dispatch_request()
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
19:10:44 web.1  |     rv = self.handle_user_exception(e)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask_restful/__init__.py", line 271, in error_router
19:10:44 web.1  |     return original_handler(e)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
19:10:44 web.1  |     reraise(exc_type, exc_value, tb)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
19:10:44 web.1  |     rv = self.dispatch_request()
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
19:10:44 web.1  |     return self.view_functions[rule.endpoint](**req.view_args)
19:10:44 web.1  |   File "/Users/Christian/desktop/github_repos/threat_note/threat_note/threat_note.py", line 124, in login
19:10:44 web.1  |     user = form.get_user()
19:10:44 web.1  |   File "/Users/Christian/desktop/github_repos/threat_note/threat_note/threat_note.py", line 77, in get_user
19:10:44 web.1  |     self.password.data.encode('utf-8')).hexdigest()).first()
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2634, in first
19:10:44 web.1  |     ret = list(self[0:1])
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2457, in __getitem__
19:10:44 web.1  |     return list(res)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2736, in __iter__
19:10:44 web.1  |     return self._execute_and_instances(context)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/orm/query.py", line 2751, in _execute_and_instances
19:10:44 web.1  |     result = conn.execute(querycontext.statement, self._params)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
19:10:44 web.1  |     return meth(self, multiparams, params)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
19:10:44 web.1  |     return connection._execute_clauseelement(self, multiparams, params)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
19:10:44 web.1  |     compiled_sql, distilled_params
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
19:10:44 web.1  |     context)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
19:10:44 web.1  |     exc_info
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
19:10:44 web.1  |     reraise(type(exception), exception, tb=exc_tb)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
19:10:44 web.1  |     context)
19:10:44 web.1  |   File "/Library/Python/2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
19:10:44 web.1  |     cursor.execute(statement, parameters)
19:10:44 web.1  | OperationalError: (sqlite3.OperationalError) no such column: users.password [SQL: u'SELECT users._id AS users__id, users.user AS users_user, users.email AS users_email, users.password AS users_password, users.apikey AS users_apikey \nFROM users \nWHERE users.password = ? AND users.user = ?\n LIMIT ? OFFSET ?'] [parameters: ('[hashed_pw', u'[email]', 1, 0)]
christiancyint commented 8 years ago

Something I'm doing wrong? Any work arounds are welcome! Thanks!

ktneely commented 8 years ago

I am receiving the same error as the post from Feb 4. The only difference is I have no errors when threat note starts, but I do receive similar output when attempting to login.

(sqlite3.OperationalError) no such column: settings.pt_pdns [SQL: u'SELECT settings._id AS settings__id, settings.apikey AS settings_apikey, settings.odnskey AS settings_odnskey, settings.vtinfo AS settings_vtinfo, settings.whoisinfo AS settings_whoisinfo, settings.odnsinfo AS settings_odnsinfo, settings.httpproxy AS settings_httpproxy, settings.httpsproxy AS settings_httpsproxy, settings.threatcrowd AS settings_threatcrowd, settings.vtfile AS settings_vtfile, settings.circlinfo AS settings_circlinfo, settings.circlusername AS settings_circlusername, settings.circlpassword AS settings_circlpassword, settings.circlssl AS settings_circlssl, settings.pt_pdns AS settings_pt_pdns, settings.pt_whois AS settings_pt_whois, settings.pt_pssl AS settings_pt_pssl, settings.pt_host_attr AS settings_pt_host_attr, settings.pt_username AS settings_pt_username, settings.pt_api_key AS settings_pt_api_key, settings.cuckoo AS settings_cuckoo, settings.cuckoohost AS settings_cuckoohost, settings.cuckooapiport AS settings_cuckooapiport, settings.farsightinfo AS settings_farsightinfo, settings.farsightkey AS settings_farsightkey, settings.shodaninfo AS settings_shodaninfo, settings.shodankey AS settings_shodankey \nFROM settings \nWHERE settings._id = ?\n LIMIT ? OFFSET ?'] [parameters: (1, 1, 0)]

brianwarehime commented 8 years ago

Hey guys, not sure what would be the issue in both of your cases. I just pulled the latest version down and started and registered/login with no issues. I would assume it boils down to the database you guys are using, since I believe one of the latest PR's updated the database. Try pulling down the latest copy in a separate directory with a clean database and try starting it/registering/logging in and see if you have any issues with it.

If so, then we can investigate further.

ktneely commented 8 years ago

Is there a way to migrate the data From the previous database?