ValueError when OWTF is run without postgresql properly configured #414

Closed
DePierre opened this Issue Apr 15, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@DePierre
Contributor

DePierre commented Apr 15, 2015

When running OWTF with a DB not properly configured, a ValueError is thrown.

root@kali32:~/owtf# python2 owtf.py 

 _____ _ _ _ _____ _____
|     | | | |_   _|   __|
|  |  | | | | | | |   __|
|_____|_____| |_| |__|

        @owtfp
    http://owtf.org

Traceback (most recent call last):
  File "owtf.py", line 300, in <module>
    main(sys.argv)
  File "owtf.py", line 263, in main
    ComponentInitialiser.initialisation_phase_1(root_dir, owtf_pid)
  File "/root/owtf/framework/dependency_management/component_initialiser.py", line 55, in initialisation_phase_1
    DB()
  File "/root/owtf/framework/db/db.py", line 68, in __init__
    self.create_session()
  File "/root/owtf/framework/db/db.py", line 97, in create_session
    self.Session = self.CreateScopedSession()
  File "/root/owtf/framework/db/db.py", line 146, in CreateScopedSession
    self.engine = self.CreateEngine(models.Base)
  File "/root/owtf/framework/db/db.py", line 133, in CreateEngine
    poolclass=NullPool)  # TODO: Fix for forking
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/__init__.py", line 346, in create_engine
    return strategy.create(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 49, in create
    u = url.make_url(name_or_url)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/url.py", line 164, in make_url
    return _parse_rfc1738_args(name_or_url)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/url.py", line 210, in _parse_rfc1738_args
    return URL(name, **components)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/url.py", line 60, in __init__
    self.port = int(port)
ValueError: invalid literal for int() with base 10: ''

OWTF should instead indicate that the DB is not configured.

@DePierre DePierre added the Bug label Apr 15, 2015

DePierre added a commit that referenced this issue Jun 30, 2015

More verbose error when corrupted db config file (Fix #414)
Would output the following when misconfigured DATABASE_PORT in db.cfg:

    ERROR:root:Aborted by Framework: Database configuration file is potentially corrupted. Please check ~/.owtf/db.cfg
    [DB] invalid literal for int() with base 10: '5432b'

@DePierre DePierre closed this Jun 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment