ronnieman / pyrit

Automatically exported from code.google.com/p/pyrit
0 stars 0 forks source link

Pyrit Can't Connect To Remote MySQL Database But Can COnnect To Local MySQL Database #386

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use Ubuntu 10.10 and MySQL to create a database on a remote computer (SSH or 
otherwise) 
2. Make a 'pyrit' user in MySQL with no password (or use the 'root' user; same 
problem occurs)
3. Attempt to use pyrit -u mysql://user:password@host/pyrit

What is the expected output? What do you see instead?
Via SSH into the server using the locally running MySQL server (out of the 
default /var/lib/mysql/ folder) I get:
chris@chris-server:~$ pyrit -u mysql://pyrit:@localhost/pyrit eval
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+

Connecting to storage at 'mysql://localhost/pyrit'...  connected.
Passwords available: 0

As expected, however, from my computer with the GPU in it, I get (the IP of 
chris-server is 192.168.1.80) :
chris@chris-desktop:~$ pyrit -u mysql://pyrit:@192.168.1.80/pyrit eval
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com
This code is distributed under the GNU General Public License v3+

Connecting to storage at 'mysql://192.168.1.80/pyrit'...  Traceback (most 
recent call last):
  File "/usr/local/bin/pyrit", line 9, in <module>
    pyrit_cli.Pyrit_CLI().initFromArgv()
  File "/usr/local/lib/python2.6/dist-packages/pyrit_cli.py", line 114, in initFromArgv
    options['storage'] = self._getStorage(storage_url)
  File "/usr/local/lib/python2.6/dist-packages/pyrit_cli.py", line 229, in _getStorage
    storage = cpyrit.storage.getStorage(url)
  File "/usr/local/lib/python2.6/dist-packages/cpyrit/storage.py", line 132, in getStorage
    return SQLStorage(url)
  File "/usr/local/lib/python2.6/dist-packages/cpyrit/storage.py", line 997, in __init__
    metadata.create_all(self.engine)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/schema.py", line 2013, in create_all
    bind.create(self, checkfirst=checkfirst, tables=tables)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1647, in create
    connection=connection, **kwargs)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1677, in _run_visitor
    conn = self.contextual_connect(close_with_result=False)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/base.py", line 1742, in contextual_connect
    self.pool.connect(), 
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 158, in connect
    return _ConnectionFairy(self).checkout()
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 329, in __init__
    rec = self._connection_record = pool.get()
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 177, in get
    return self.do_get()
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 692, in do_get
    con = self.create_connection()
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 138, in create_connection
    return _ConnectionRecord(self)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 213, in __init__
    self.connection = self.__connect()
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 279, in __connect
    connection = self.__pool._creator()
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/strategies.py", line 76, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/lib/python2.6/dist-packages/sqlalchemy/engine/default.py", line 238, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/lib/pymodules/python2.6/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 170, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (OperationalError) (2003, "Can't connect to 
MySQL server on '192.168.1.80' (111)") None None

I don't have a good enough grasp on Python to dive in and debug what is going 
on, but I know that it works on the local machine (both my desktop and server 
can connect to their own respective MySQL process) so I feel it's a network 
issue but I'm not sure where to start.

What version of the product are you using? On what operating system?
Both are 0.4.0 with SQLAlchemy and all the libraries installed (both machines 
have the same libraries and everything; that's why I think it's a networking 
issue because I've been trying to cross-network them all day)

Please provide any additional information below.
chris-server - Ubuntu 10.10 2.6.35-22-generic x86/i686
chris-desktop - Ubuntu 10.10 2.6.35-32-generic x86_64

Original issue reported on code.google.com by chrisrod...@gmail.com on 19 Feb 2012 at 11:23

GoogleCodeExporter commented 8 years ago
its because your using an old version of python-sqlalchemy that is known to 
have this issue, download, compile and install the latest version of sqlalchemy 
from the sourceforge site, I had this issue too, that is exactly what will fix 
this issue.

Original comment by MrNicho...@gmail.com on 4 Apr 2012 at 3:38