Problema gem pg [SOLVED]

Started by Ananke, April 17, 2012, 02:31:05 PM

Previous topic - Next topic

Ananke

Salve a tutti!
Dopo aver felicemente risolto con il vostro aiuto un problema riguardante le iptables mi sono ora scontrato con un altro problema riguardante, questa volta, il corretto funzionamento di MSF. Premetto che ho cercato di risolvere e ho torvato proprio qui sul forum una discussione inerente ma in cui, purtroppo, alla fine l'utente diceva di aver risolto ma senza spiegare come. Comunque ecco il link: http://forum.backbox.org/software-support/%28metasploit%29-installare-gemma-postgresql/

Quando avvio Metasploit dal menù mi appare questo messaggio:
[*] Processing /root/.msf4/msfconsole.rc for ERB directives.
resource (/root/.msf4/msfconsole.rc)> db_connect backbox:backbox@127.0.0.1:5432/metasploit4
[-] No database driver installed. Try 'gem install pg'
msf >


Provo allora a dare gem install pg
Ed ecco l'output:
msf > gem install pg
[*] exec: gem install pg

ERROR:  Error installing pg:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config


Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.13.2 for inspection.
Results logged to /var/lib/gems/1.8/gems/pg-0.13.2/ext/gem_make.out
Building native extensions.  This could take a while...
msf >


Purtroppo non sono un esperto e ne capsico poco, ecco quindi che vi chiedo: qualcuno di voi riesce, gentilmente, ad aiutarmi?
Grazie in anticipo,
a presto

ostendali

#1
Ma cosa fai, cerchi di installare pg dalla console msf?
prova dalla shell e vedi...se ti da lo stesso errore fai come sotto...
e' estremamente semplice e chiara la cosa, basta che leggi l'output...ti sta suggerendo anche la risposta se leggi.
il sistema non trova alcuna configurazione di pg...

sudo apt-get install libpq5 libpq-dev

riprova!

Ananke

#2
Stesso problema anche da console.
Appena torno su quel pc provo. Comunque lo strano è che ha sempre funzionato fino all'ultimo update di MSF fatto dal menù update.
Allora ti faccio sapere appena posso


EDIT:

libpq5 era gia installato.
lib-dev l'ho installato e si è portato dietro anche libssl-dev.
Successivamente ho installato con successo pg.
Rimane comunque un problema: sembra non riconoscere i comandi più basilari (ad esempio io ho usate workspace -d test) ecco l'outpout del mio terminale:
[*] Processing /root/.msf4/msfconsole.rc for ERB directives.
resource (/root/.msf4/msfconsole.rc)> db_connect backbox:backbox@127.0.0.1:5432/metasploit4
msf > workspace
* default
  test
msf > workspace -d test
[-] Error while running command workspace: PG::Error: ERROR:  relation "workspace_members" does not exist
LINE 1: SELECT DISTINCT "users".* FROM "users" INNER JOIN "workspace...
                                                          ^
: SELECT DISTINCT "users".* FROM "users" INNER JOIN "workspace_members" ON "users"."id" = "workspace_members"."user_id" WHERE "workspace_members"."workspace_id" = 9

Call stack:
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1139:in `async_exec'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1139:in `exec_no_cache'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:663:in `exec_query'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:662:in `exec_query'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1234:in `select'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:63:in `select_all'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/querying.rb:38:in `find_by_sql'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/explain.rb:25:in `logging_query_plan'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/querying.rb:37:in `find_by_sql'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation.rb:171:in `exec_queries'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation.rb:160:in `to_a'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/explain.rb:25:in `logging_query_plan'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation.rb:159:in `to_a'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb:159:in `all'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb:380:in `find_target'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb:333:in `load_target'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/collection_association.rb:157:in `delete_all_on_destroy'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/associations/builder/has_and_belongs_to_many.rb:21:in `destroy_associations'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/persistence.rb:129:in `destroy'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/locking/optimistic.rb:103:in `destroy'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/callbacks.rb:254:in `destroy'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:480:in `_run__572909229__destroy__4__callbacks'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `send'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `send'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/callbacks.rb:254:in `destroy'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb:236:in `destroy'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb:295:in `with_transaction_returning_status'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb:208:in `transaction'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/opt/msf/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/transactions.rb:236:in `destroy'
/opt/msf/lib/msf/ui/console/command_dispatcher/db.rb:126:in `cmd_workspace'
/opt/msf/lib/msf/ui/console/command_dispatcher/db.rb:111:in `each'
/opt/msf/lib/msf/ui/console/command_dispatcher/db.rb:111:in `cmd_workspace'
/opt/msf/lib/rex/ui/text/dispatcher_shell.rb:380:in `send'
/opt/msf/lib/rex/ui/text/dispatcher_shell.rb:380:in `run_command'
/opt/msf/lib/rex/ui/text/dispatcher_shell.rb:342:in `run_single'
/opt/msf/lib/rex/ui/text/dispatcher_shell.rb:336:in `each'
/opt/msf/lib/rex/ui/text/dispatcher_shell.rb:336:in `run_single'
/opt/msf/lib/rex/ui/text/shell.rb:199:in `run'
/usr/bin/msfconsole:140
msf >





EDIT 2:
Ho risolto anche questo avvaindo semplicemente gli update di metasploit.
Problemi risolti! Un'ultima curiosità, da quale parte del primo output avrei dovuto capire cosa mancava?
Grazie mille per l'aiuto :)

twisted87

semplice:

checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config


ciao!