Results 1 to 3 of 3

Thread: Problem with connecting database

  1. #1
    Just burned his ISO
    Join Date
    Aug 2011
    Posts
    3

    Default Problem with connecting database

    first i wanna thanks sickness for such a gr8 how to tutorial...
    well im new to bt...im using bt5 KDE
    i've read all the post realted to dis problem and i'm trying very hard to solve dis from past 1 week...but got no help
    plz help me to solve dis....
    i've followed instructions of sickness and got dis

    root@bt:~# /etc/init.d/postgresql-8.4 start
    * Starting PostgreSQL 8.4 database server [ OK ]
    root@bt:~# sudo su postgres -c psql
    could not change directory to "/root"
    psql (8.4.8)
    Type "help" for help.

    postgres=# ALTER USER postgres WITH PASSWORD 'suraj@kumar';
    ALTER ROLE
    postgres=# \q
    could not save history to file "/home/postgres/.psql_history": No such file or directory
    root@bt:~# sudo passwd -d postgres
    passwd: password expiry information changed.
    root@bt:~# sudo su postgres -c passwd
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    root@bt:~# msfconsole
    [-] Failed to connect to the database: could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 7175?
    {"adapter"=>"postgresql", "database"=>"msf3", "username"=>"msf3", "password"=>"7f878914", "host"=>"127.0.0.1", "port"=>7175, "pool"=>75, "timeout"=>5} ["/opt/framework3/msf3/lib/active_record/connection_adapters/postgresql_adapter.rb:968:in `initialize'", "/opt/framework3/msf3/lib/active_record/connection_adapters/postgresql_adapter.rb:968:in `new'", "/opt/framework3/msf3/lib/active_record/connection_adapters/postgresql_adapter.rb:968:in `connect'", "/opt/framework3/msf3/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'", "/opt/framework3/msf3/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'", "/opt/framework3/msf3/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `block (2 levels) in checkout'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `block in checkout'", "/opt/framework3/ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'", "/opt/framework3/msf3/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'", "/opt/framework3/msf3/lib/active_record/base.rb:1271:in `columns'", "/opt/framework3/msf3/lib/active_record/base.rb:1284:in `column_names'", "/opt/framework3/msf3/lib/active_record/base.rb:1297:in `column_methods_hash'", "/opt/framework3/msf3/lib/active_record/base.rb:1986:in `block in all_attributes_exists?'", "/opt/framework3/msf3/lib/active_record/base.rb:1986:in `each'", "/opt/framework3/msf3/lib/active_record/base.rb:1986:in `all?'", "/opt/framework3/msf3/lib/active_record/base.rb:1986:in `all_attributes_exists?'", "/opt/framework3/msf3/lib/active_record/base.rb:1842:in `method_missing'", "/opt/framework3/msf3/lib/msf/core/model/workspace.rb:69:in `default'", "/opt/framework3/msf3/lib/msf/core/db.rb:189:in `default_workspace'", "/opt/framework3/msf3/lib/msf/core/db_manager.rb:166:in `connect'", "/opt/framework3/msf3/lib/msf/ui/console/driver.rb:186:in `initialize'", "/opt/framework3/msf3/msfconsole:130:in `new'", "/opt/framework3/msf3/msfconsole:130:in `<main>'"]

    ######## #
    ################# #
    ###################### #
    ######################### #
    ############################
    ##############################
    ###############################
    ###############################
    ##############################
    # ######## #
    ## ### #### ##
    ### ###
    #### ###
    #### ########## ####
    ####################### ####
    #################### ####
    ################## ####
    ############ ##
    ######## ###
    ######### #####
    ############ ######
    ######## #########
    ##### ########
    ### #########
    ###### ############
    #######################
    # # ### # # ##
    ########################
    ## ## ## ##



    =[ metasploit v4.0.1-dev [core:4.0 api:1.0]
    + -- --=[ 721 exploits - 367 auxiliary - 74 post
    + -- --=[ 226 payloads - 27 encoders - 8 nops
    =[ svn r13543 updated yesterday (2011.08.12)

    msf > db_driver postgresql [*] Using database driver postgresql
    msf > db_connect postgres:"suraj@kumar"@127.0.0.1/metasploit
    [-] Error while running command db_connect: Failed to connect to the database: FATAL: Ident authentication failed for user "postgres"


    Call stack:
    /opt/framework3/msf3/lib/msf/ui/console/command_dispatcher/db.rb:1903:in `db_connect_postgresql'
    /opt/framework3/msf3/lib/msf/ui/console/command_dispatcher/db.rb:1711:in `cmd_db_connect'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:376:in `run_command'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:338:in `block in run_single'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:332:in `each'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:332:in `run_single'
    /opt/framework3/msf3/lib/rex/ui/text/shell.rb:199:in `run'
    /opt/framework3/msf3/msfconsole:130:in `<main>'
    msf >

    im ver sorry if im doing any silly mistakes.......as im new to bt
    plz help....im learning.......thankq

  2. #2
    Good friend of the forums zimmaro's Avatar
    Join Date
    Mar 2010
    Location
    milano
    Posts
    407

    Default Re: Problem with connecting database

    hi,
    I do not know if this is the right solution for your problem, it works for me !!!
    i'm working in this mode :

    root@bt:~# apt-get install postgresql
    root@bt:~# sudo apt-get install libpgsql-ruby
    root@bt:~# sudo su postgres
    sh-4.1$ createuser root -P
    could not change directory to "/root"
    Enter password for new role: "??????" your password
    Enter it again:"?????"
    Shall the new role be a superuser? (y/n) n
    Shall the new role be allowed to create databases? (y/n) n
    Shall the new role be allowed to create more new roles? (y/n) n
    sh-4.1$ createdb --owner=root metasploit
    could not change directory to "/root"
    exit
    sh-4.1$ exit
    exit
    update-alternatives --config ruby switch on 0
    ruby -v verificate version on ruby =ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
    /etc/init.d/postgresql-8.4 start
    root@bt:~# msfconsole
    msf > db_driver postgresql[*] Using database driver postgresql
    msf > db_connect root:toor@127.0.0.1:5432/metasploit
    workspace -a MyProject
    *] Added workspace: MyProject
    msf > db_nmap 192.168.1.165 -sS -O[*] Nmap: Starting Nmap 5.51SVN ( http://nmap.org ) at 2011-05-14 15:27 CEST[*] Nmap: Nmap scan report for hackdany-cecb3e.homenet.t
    msf > db_autopwn -p -e -q eccc....
    bye and good luck!

  3. #3
    Just burned his ISO
    Join Date
    Aug 2011
    Posts
    3

    Default Re: Problem with connecting database

    thank q zimmaro.

    its working......

    i'll show u the output what i got...


    root@bt:~# apt-get install postgresql
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    postgresql is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
    root@bt:~# sudo apt-get install libpgsql-ruby
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    libpgsql-ruby1.8
    Suggested packages:
    libpgsql-ruby-doc
    The following NEW packages will be installed:
    libpgsql-ruby libpgsql-ruby1.8
    0 upgraded, 2 newly installed, 0 to remove and 42 not upgraded.
    Need to get 38.3kB of archives.
    After this operation, 164kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 Index of / revolution/main libpgsql-ruby 0.8.0-1.1 [8,166B]
    Get:2 http://32.repository.backtrack-linux.org/ revolution/main libpgsql-ruby1.8 0.8.0-1.1 [30.2kB]
    Fetched 38.3kB in 1s (29.1kB/s)
    Selecting previously deselected package libpgsql-ruby1.8.
    (Reading database ... 224682 files and directories currently installed.)
    Unpacking libpgsql-ruby1.8 (from .../libpgsql-ruby1.8_0.8.0-1.1_i386.deb) ...
    Selecting previously deselected package libpgsql-ruby.
    Unpacking libpgsql-ruby (from .../libpgsql-ruby_0.8.0-1.1_all.deb) ...
    Setting up libpgsql-ruby1.8 (0.8.0-1.1) ...
    Setting up libpgsql-ruby (0.8.0-1.1) ...
    root@bt:~# sudo su postgres
    sh-4.1$ createuser root -p
    could not change directory to "/root"
    /usr/lib/postgresql/8.4/bin/createuser: option requires an argument -- 'p'
    Try "createuser --help" for more information.
    sh-4.1$ createuser root -P
    could not change directory to "/root"
    Enter password for new role:
    Enter it again:
    Shall the new role be a superuser? (y/n) n
    Shall the new role be allowed to create databases? (y/n) n
    Shall the new role be allowed to create more new roles? (y/n) n
    sh-4.1$ createdb --owner=root metasploit
    could not change directory to "/root"
    sh-4.1$ exit
    exit
    root@bt:~# update-alternatives --config ruby switch on 0
    update-alternatives: error: unknown argument `switch'
    root@bt:~# update-alternatives --config ruby switch on 0
    update-alternatives: error: unknown argument `switch'

    root@bt:~# update-alternatives --config ruby
    There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

    Selection Path Priority Status
    ------------------------------------------------------------
    0 /usr/bin/ruby1.8 500 auto mode
    1 /usr/bin/ruby1.8 500 manual mode
    * 2 /usr/bin/ruby1.9.2 400 manual mode

    Press enter to keep the current choice[*], or type selection number: 0
    update-alternatives: using /usr/bin/ruby1.8 to provide /usr/bin/ruby (ruby) in auto mode.
    root@bt:~# /etc/init.d/postgresql-8.4 start
    * Starting PostgreSQL 8.4 database server [ OK ]
    root@bt:~# msfconsole
    [-] Failed to connect to the database: could not connect to server: Connection refused
    Is the server running on host "127.0.0.1" and accepting
    TCP/IP connections on port 7175?


    msf > db_driver postgresql [*] Using database driver postgresql
    msf > db_connect root:toor@127.0.0.1:5432/metasploit
    [-] Error while running command db_connect: Failed to connect to the database: FATAL: password authentication failed for user "root"


    Call stack:
    /opt/framework3/msf3/lib/msf/ui/console/command_dispatcher/db.rb:1903:in `db_connect_postgresql'
    /opt/framework3/msf3/lib/msf/ui/console/command_dispatcher/db.rb:1711:in `cmd_db_connect'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:376:in `run_command'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:338:in `block in run_single'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:332:in `each'
    /opt/framework3/msf3/lib/rex/ui/text/dispatcher_shell.rb:332:in `run_single'
    /opt/framework3/msf3/lib/rex/ui/text/shell.rb:199:in `run'
    /opt/framework3/msf3/msfconsole:130:in `<main>'
    msf > db_connect root:?????@127.0.0.1:5432/metasploit
    NOTICE: CREATE TABLE will create implicit sequence "hosts_id_seq" for serial column "hosts.id"
    NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "hosts_pkey" for table "hosts"
    NOTICE: CREATE TABLE will create implicit sequence "clients_id_seq" for serial column "clients.id"

    NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "listeners_pkey" for table "listeners"
    NOTICE: CREATE TABLE will create implicit sequence "nexpose_consoles_id_seq" for serial column "nexpose_consoles.id"
    NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "nexpose_consoles_pkey" for table "nexpose_consoles"
    NOTICE: CREATE TABLE will create implicit sequence "profiles_id_seq" for serial column "profiles.id"
    NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "profiles_pkey" for table "profiles"
    msf > workspace -a MyProject[*] Added workspace: MyProject
    msf > db_nmap 124.123.243.* -n -sn[*] Nmap: Starting Nmap 5.51SVN ( http://nmap.org ) at 2011-08-15 09:15 IST
    .................................................. .................................................. .................................................. .................................................. ...................
    a small problem i'm still hveing.......every time i open msfconsole i hve to connect to PostgreSQL server manullay then enter my user name and password to connect database..... is there any way so that dis stuff will get done autometic...

    thnaks.......

Similar Threads

  1. database problem
    By askmelater in forum BackTrack 5 Fixes
    Replies: 4
    Last Post: 06-10-2011, 11:11 AM
  2. MYSQL database Problem
    By CeEe4 in forum Beginners Forum
    Replies: 6
    Last Post: 04-03-2011, 04:39 PM
  3. Problem with database
    By Paradigma in forum Beginners Forum
    Replies: 6
    Last Post: 03-27-2011, 12:01 PM
  4. Book like "The Database Hacker's Handbook: Defending Database Servers"
    By -=Renegade=- in forum OLD General IT Discussion
    Replies: 3
    Last Post: 01-01-2010, 04:18 AM
  5. Problem with Aicrack after Database Airolib
    By manulu in forum OLD BackTrack 4 (pre) Final
    Replies: 0
    Last Post: 10-15-2009, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •