YgorCosta
(usa Manjaro Linux)
Enviado em 06/11/2019 - 16:32h
Olá galera!
Estou iniciando na área do Ethical Hacking, e escolhi o Manjaro como minha principal para instalar os softwares que vou precisar para estudar.
Instalei o Metasploit pelo pacman:
sudo pacman -S metasploit
Porém quando fui inicializá-lo:
msfconsole
Obtive um erro relacionado a base de dados dele, chequei a db pelo msf:
db_status
Não apareceu nem que o Postgresql estava selecionado, ele foi instalado junto com as dependências do Metasploit.
Chequei o serviço dele, não estava nem habilitado e muito menos rodando, então o habilitei e o inicializei pelo systemctl, chequei o status dele pelo systemctl:
nov 06 16:07:52 ygor-pc systemd[1]: Starting PostgreSQL database server...
nov 06 16:07:53 ygor-pc postgres[3034]: 2019-11-06 16:07:53.077 -03 [3034] LOG: listening on IPv6 address "::1", port 5433
nov 06 16:07:53 ygor-pc postgres[3034]: 2019-11-06 16:07:53.077 -03 [3034] LOG: listening on IPv4 address "127.0.0.1", port 5433
nov 06 16:07:53 ygor-pc postgres[3034]: 2019-11-06 16:07:53.120 -03 [3034] LOG: listening on Unix socket "/run/postgresql/.s.PGSQL.5>
nov 06 16:07:53 ygor-pc postgres[3034]: 2019-11-06 16:07:53.388 -03 [3035] LOG: database system was shut down at 2019-11-06 16:07:52>
nov 06 16:07:53 ygor-pc postgres[3034]: 2019-11-06 16:07:53.436 -03 [3034] LOG: database system is ready to accept connections
nov 06 16:07:53 ygor-pc systemd[1]: Started PostgreSQL database server.
Esta foi a saída, ao que me aparenta está tudo ok, alterei a porta padrão dele temporariamente para fazer uns testes, o padrão era a porta 5432
Então fui configurar a DB do metasploit:
msfdb init
Estava tudo indo bem até chegar no:
Starting database at /home/ygor/.msf4/db...failed
Aí obtive um erro:
[!] Your database may be corrupt. Try reinitializing.
Creating database users
Writing client authentication configuration file /home/ygor/.msf4/db/pg_hba.conf
Database is no longer running at /home/ygor/.msf4/db
Starting database at /home/ygor/.msf4/db...failed
2019-11-06 16:12:35.494 -03 [3115] LOG: database system is shut down
[!] Your database may be corrupt. Try reinitializing.
Para mim tem algo barrando esse processo,detalhe, o pacman informou que eu estava instalando a versão 5 do Metasploit, porém o diretório onde está o log da DB é esse caminho:
.msf4/db
Detalhe: Já alterei a porta padrão do Postgres para a 5432
Chequei o arquivo log:
2019-11-06 16:23:46.488 -03 [3454] LOG: listening on IPv6 address "::1", port 5433
2019-11-06 16:23:46.488 -03 [3454] LOG: listening on IPv4 address "127.0.0.1", port 5433
2019-11-06 16:23:46.560 -03 [3454] FATAL: could not create lock file "/run/postgresql/.s.PGSQL.5433.lock": Permissão negada
2019-11-06 16:23:46.560 -03 [3454] LOG: database system is shut down
2019-11-06 16:23:49.118 -03 [3468] LOG: listening on IPv6 address "::1", port 5433
2019-11-06 16:23:49.118 -03 [3468] LOG: listening on IPv4 address "127.0.0.1", port 5433
2019-11-06 16:23:49.167 -03 [3468] FATAL: could not create lock file "/run/postgresql/.s.PGSQL.5433.lock": Permissão negada
2019-11-06 16:23:49.167 -03 [3468] LOG: database system is shut down
Para mim a DB está tentando se comunicar com a porta 5433, porém o Postgres não está escutando ela, por isso alterei a porta do postgres anteriormente para a 5433, e o erro que tinha recebido do msfconsole era: role msf does not exist
Agora o erro que recebo no msfconsole:
[-] * WARNING: No database support: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5433?
[-] ***
Saída do log msf-ws.log:
Writing PID to /home/ygor/.msf4/msf-ws.pid
Exiting!
/opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:268:in `load': cannot load such file -- documentation/api/v1/root_api_doc.rb (LoadError)
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:268:in `block in load'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:268:in `load'
from /opt/metasploit/lib/msf/core/web_services/servlet/api_docs_servlet.rb:2:in `<top (required)>'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require_with_backports'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `block in require'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require'
from /opt/metasploit/lib/msf/core/web_services/metasploit_api_app.rb:7:in `<top (required)>'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in `require_with_backports'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `block in require'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require'
from /opt/metasploit/msf-ws.ru:17:in `block in <main>'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/rack-1.6.11/lib/rack/builder.rb:55:in `instance_eval'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/rack-1.6.11/lib/rack/builder.rb:55:in `initialize'
from /opt/metasploit/msf-ws.ru:1:in `new'
from /opt/metasploit/msf-ws.ru:1:in `<main>'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/lib/rack/adapter/loader.rb:33:in `eval'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/lib/rack/adapter/loader.rb:33:in `load'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/lib/thin/controllers/controller.rb:182:in `load_rackup_config'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/lib/thin/controllers/controller.rb:72:in `start'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/lib/thin/runner.rb:203:in `run_command'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/lib/thin/runner.rb:159:in `run!'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/gems/thin-1.7.2/bin/thin:6:in `<top (required)>'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/bin/thin:23:in `load'
from /opt/metasploit/vendor/bundle/ruby/2.6.0/bin/thin:23:in `<main>'
Me ajudem, já faz dias que quebro a cabeça com isso, já pesquisei bastante, conferi a wiki do arch em relação a isso e nada!