操作环境为Kali虚拟机

root@kali:~# apt-get install postgresql

启动服务

root@kali:~# service postgresql start
[ ok ] Starting PostgreSQL 9.1 database server: main.

修改postgresql密码为toor:

root@kali:~# sudo -u postgres psql postgres
postgres=# alter user postgres with password 'toor';
ALTER ROLE

启动msf:

root@kali:~# msfconsole

使用msf链接到postgresql:

msf > db_status
[*] postgresql connected to postgres
msf > db_disconnect
msf >
msf > db_status
[*] postgresql selected, no connection
msf > db_connect
[*] Usage: db_connect <user:pass>@<host:port>/<database>
[*] OR: db_connect -y [path/to/database.yml]
[*] Examples:
[*] db_connect user@metasploit3
[*] db_connect user:pass@192.168.0.2/metasploit3
[*] db_connect user:pass@192.168.0.2:1500/metasploit3
msf > db_connect postgres:toor@127.0.0.1/postgres
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 "clients_pkey" for table "clients"
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"
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"
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"
NOTICE: CREATE TABLE will create implicit sequence "notes_id_seq" for serial column "notes.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "notes_pkey" for table "notes"
NOTICE: CREATE TABLE will create implicit sequence "wmap_targets_id_seq" for serial column "wmap_targets.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "wmap_targets_pkey" for table "wmap_targets"
NOTICE: CREATE TABLE will create implicit sequence "wmap_requests_id_seq" for serial column "wmap_requests.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "wmap_requests_pkey" for table "wmap_requests"
NOTICE: CREATE TABLE will create implicit sequence "workspaces_id_seq" for serial column "workspaces.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "workspaces_pkey" for table "workspaces"
NOTICE: CREATE TABLE will create implicit sequence "events_id_seq" for serial column "events.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "events_pkey" for table "events"
NOTICE: CREATE TABLE will create implicit sequence "loots_id_seq" for serial column "loots.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "loots_pkey" for table "loots"
NOTICE: CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
NOTICE: CREATE TABLE will create implicit sequence "reports_id_seq" for serial column "reports.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "reports_pkey" for table "reports"
NOTICE: CREATE TABLE will create implicit sequence "tasks_id_seq" for serial column "tasks.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tasks_pkey" for table "tasks"
NOTICE: CREATE TABLE will create implicit sequence "creds_id_seq" for serial column "creds.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "creds_pkey" for table "creds"
NOTICE: CREATE TABLE will create implicit sequence "exploited_hosts_id_seq" for serial column "exploited_hosts.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "exploited_hosts_pkey" for table "exploited_hosts"
NOTICE: CREATE TABLE will create implicit sequence "report_templates_id_seq" for serial column "report_templates.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "report_templates_pkey" for table "report_templates"
NOTICE: CREATE TABLE will create implicit sequence "campaigns_id_seq" for serial column "campaigns.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "campaigns_pkey" for table "campaigns"
NOTICE: CREATE TABLE will create implicit sequence "email_templates_id_seq" for serial column "email_templates.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "email_templates_pkey" for table "email_templates"
NOTICE: CREATE TABLE will create implicit sequence "attachments_id_seq" for serial column "attachments.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "attachments_pkey" for table "attachments"
NOTICE: CREATE TABLE will create implicit sequence "email_addresses_id_seq" for serial column "email_addresses.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "email_addresses_pkey" for table "email_addresses"
NOTICE: CREATE TABLE will create implicit sequence "web_templates_id_seq" for serial column "web_templates.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "web_templates_pkey" for table "web_templates"
NOTICE: CREATE TABLE will create implicit sequence "web_sites_id_seq" for serial column "web_sites.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "web_sites_pkey" for table "web_sites"
NOTICE: CREATE TABLE will create implicit sequence "web_pages_id_seq" for serial column "web_pages.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "web_pages_pkey" for table "web_pages"
NOTICE: CREATE TABLE will create implicit sequence "web_forms_id_seq" for serial column "web_forms.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "web_forms_pkey" for table "web_forms"
NOTICE: CREATE TABLE will create implicit sequence "web_vulns_id_seq" for serial column "web_vulns.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "web_vulns_pkey" for table "web_vulns"
NOTICE: CREATE TABLE will create implicit sequence "imported_creds_id_seq" for serial column "imported_creds.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "imported_creds_pkey" for table "imported_creds"
NOTICE: CREATE TABLE will create implicit sequence "tags_id_seq" for serial column "tags.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tags_pkey" for table "tags"
NOTICE: CREATE TABLE will create implicit sequence "sessions_id_seq" for serial column "sessions.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "sessions_pkey" for table "sessions"
NOTICE: CREATE TABLE will create implicit sequence "session_events_id_seq" for serial column "session_events.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "session_events_pkey" for table "session_events"
NOTICE: CREATE TABLE will create implicit sequence "routes_id_seq" for serial column "routes.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "routes_pkey" for table "routes"
NOTICE: CREATE TABLE will create implicit sequence "api_keys_id_seq" for serial column "api_keys.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "api_keys_pkey" for table "api_keys"
NOTICE: CREATE TABLE will create implicit sequence "macros_id_seq" for serial column "macros.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "macros_pkey" for table "macros"
NOTICE: CREATE TABLE will create implicit sequence "listeners_id_seq" for serial column "listeners.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"
NOTICE: CREATE TABLE will create implicit sequence "mod_refs_id_seq" for serial column "mod_refs.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "mod_refs_pkey" for table "mod_refs"
NOTICE: CREATE TABLE will create implicit sequence "vuln_details_id_seq" for serial column "vuln_details.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "vuln_details_pkey" for table "vuln_details"
NOTICE: CREATE TABLE will create implicit sequence "host_details_id_seq" for serial column "host_details.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "host_details_pkey" for table "host_details"
NOTICE: CREATE TABLE will create implicit sequence "vuln_attempts_id_seq" for serial column "vuln_attempts.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "vuln_attempts_pkey" for table "vuln_attempts"
NOTICE: CREATE TABLE will create implicit sequence "module_details_id_seq" for serial column "module_details.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_details_pkey" for table "module_details"
NOTICE: CREATE TABLE will create implicit sequence "module_authors_id_seq" for serial column "module_authors.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_authors_pkey" for table "module_authors"
NOTICE: CREATE TABLE will create implicit sequence "module_mixins_id_seq" for serial column "module_mixins.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_mixins_pkey" for table "module_mixins"
NOTICE: CREATE TABLE will create implicit sequence "module_targets_id_seq" for serial column "module_targets.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_targets_pkey" for table "module_targets"
NOTICE: CREATE TABLE will create implicit sequence "module_actions_id_seq" for serial column "module_actions.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_actions_pkey" for table "module_actions"
NOTICE: CREATE TABLE will create implicit sequence "module_refs_id_seq" for serial column "module_refs.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_refs_pkey" for table "module_refs"
NOTICE: CREATE TABLE will create implicit sequence "module_archs_id_seq" for serial column "module_archs.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_archs_pkey" for table "module_archs"
NOTICE: CREATE TABLE will create implicit sequence "module_platforms_id_seq" for serial column "module_platforms.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "module_platforms_pkey" for table "module_platforms"
NOTICE: CREATE TABLE will create implicit sequence "exploit_attempts_id_seq" for serial column "exploit_attempts.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "exploit_attempts_pkey" for table "exploit_attempts"
[*] Rebuilding the module cache in the background...

 在MSF终端中运行Nmap,

msf > db_connect postgres:toor@127.0.0.1/postgres
[*] Rebuilding the module cache in the background...
msf > db_nmap
[*] Usage: db_nmap [nmap options]

  成功链接到数据库后,可以用db_nmap命令,这个命令能够在MSF终端中运行nmap,并自动将nmap结果存储在数据库中。

msf > db_nmap -sS -A 192.168.119.132
[*] Nmap: Starting Nmap 6.25 ( http://nmap.org ) at 2014-07-12 10:42 EDT
[*] Nmap: Nmap scan report for 192.168.119.132
[*] Nmap: Host is up (0.00051s latency).
[*] Nmap: Not shown: 993 closed ports
[*] Nmap: PORT STATE SERVICE VERSION
[*] Nmap: 80/tcp open http Apache httpd 2.2.21 ((Win32) PHP/5.3.10)
[*] Nmap: |_http-methods: No Allow or Public header in OPTIONS response (status code 403)
[*] Nmap: |_http-title: 403 Forbidden
[*] Nmap: 135/tcp open msrpc Microsoft Windows RPC
[*] Nmap: 139/tcp open netbios-ssn
[*] Nmap: 1433/tcp open ms-sql-s Microsoft SQL Server 2005 9.00.1399.00; RTM
[*] Nmap: 2383/tcp open ms-olap4?
[*] Nmap: 3306/tcp open mysql MySQL (unauthorized)
[*] Nmap: 3389/tcp open ms-wbt-server Microsoft Terminal Service
[*] Nmap: MAC Address: 00:0C:29:5D:F3:E7 (VMware)
[*] Nmap: No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).
[*] Nmap: TCP/IP fingerprint:
[*] Nmap: OS:SCAN(V=6.25%E=4%D=7/12%OT=80%CT=1%CU=32534%PV=Y%DS=1%DC=D%G=Y%M=000C29%T
[*] Nmap: OS:M=53C14991%P=i686-pc-linux-gnu)SEQ(SP=108%GCD=1%ISR=10D%TI=I%CI=I%II=I%S
[*] Nmap: OS:S=S%TS=0)OPS(O1=M5B4NW3NNT00NNS%O2=M5B4NW3NNT00NNS%O3=M5B4NW3NNT00%O4=M5
[*] Nmap: OS:B4NW3NNT00NNS%O5=M5B4NW3NNT00NNS%O6=M5B4NNT00NNS)WIN(W1=FFFF%W2=FFFF%W3=
[*] Nmap: OS:FFFF%W4=FFFF%W5=FFFF%W6=FFFF)ECN(R=Y%DF=N%T=40%W=FFFF%O=M5B4NW3NNS%CC=N%
[*] Nmap: OS:Q=)T1(R=Y%DF=N%T=40%S=O%A=S+%F=AS%RD=0%Q=)T2(R=Y%DF=N%T=40%W=0%S=Z%A=S%F
[*] Nmap: OS:=AR%O=%RD=0%Q=)T3(R=Y%DF=N%T=40%W=FFFF%S=O%A=S+%F=AS%O=M5B4NW3NNT00NNS%R
[*] Nmap: OS:D=0%Q=)T4(R=Y%DF=N%T=40%W=0%S=A%A=O%F=R%O=%RD=0%Q=)T5(R=Y%DF=N%T=40%W=0%
[*] Nmap: OS:S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=N%T=40%W=0%S=A%A=O%F=R%O=%RD=0%Q=)T7(
[*] Nmap: OS:R=Y%DF=N%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T=40%IPL=B0%UN=0%
[*] Nmap: OS:RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=S%T=40%CD=Z)
[*] Nmap: Network Distance: 1 hop
[*] Nmap: Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
[*] Nmap: Host script results:
[*] Nmap: | ms-sql-info:
[*] Nmap: | [192.168.119.132:1433]
[*] Nmap: | Version: Microsoft SQL Server 2005 RTM
[*] Nmap: | Version number: 9.00.1399.00
[*] Nmap: | Product: Microsoft SQL Server 2005
[*] Nmap: | Service pack level: RTM
[*] Nmap: | Post-SP patches applied: No
[*] Nmap: |_ TCP port: 1433
[*] Nmap: |_nbstat: NetBIOS name: PC-201403241103, NetBIOS user: <unknown>, NetBIOS MAC: 00:0c:29:5d:f3:e7 (VMware)
[*] Nmap: | smb-os-discovery:
[*] Nmap: | OS: Windows XP (Windows 2000 LAN Manager)
[*] Nmap: | OS CPE: cpe:/o:microsoft:windows_xp::-
[*] Nmap: | Computer name: PC-201403241103
[*] Nmap: | NetBIOS computer name: PC-201403241103
[*] Nmap: | Workgroup: WORKGROUP
[*] Nmap: |_ System time: 2014-07-12T22:43:29+08:00
[*] Nmap: | smb-security-mode:
[*] Nmap: | Account that was used for smb scripts: guest
[*] Nmap: | User-level authentication
[*] Nmap: | SMB Security: Challenge/response passwords supported
[*] Nmap: |_ Message signing disabled (dangerous, but default)
[*] Nmap: |_smbv2-enabled: Server doesn't support SMBv2 protocol
[*] Nmap: TRACEROUTE
[*] Nmap: HOP RTT ADDRESS
[*] Nmap: 1 0.51 ms 192.168.119.132
[*] Nmap: OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
[*] Nmap: Nmap done: 1 IP address (1 host up) scanned in 45.97 seconds

  我们会注意到扫描结果中包含一系列开放的端口、软件版本、对目标系统类型的猜测、系统时间MAC地址等信息。

Metasploit连接postgres数据库的更多相关文章

  1. kaili 2.0 metasploit连接postgres数据库

    第一步:使用命令 db_init 初始化数据库

  2. pgadmin(IDE)工具连接postgres数据库

    1. 下载软件        软件地址:http://www.pgadmin.org/download/pgagent.php   2.安装软件    安装过程:略    打开软件64位会出现  “无 ...

  3. Actix-web Rust连接Postgres数据库

    Actix-web Rust连接Postgres数据库 ​ Rust1.39支持了异步async,await,Actix-web在2.0.0-alpha支持了原生异步写法,所以本文中使用的Actix- ...

  4. ArcGIS连接Postgres 数据库

    ArcGIS连接Postgres 数据库 此前在使用ArcGIS的过程中,一般使用文件方式对数据进行管理,后面也有使用 GeoDatabase 数据库对数据进行管理,但是这种管理方式也存在一些弊端,特 ...

  5. shell编程连接postgres数据库(数据备份)

    第一步:通过xshell或者其他工具连接到linux服务, 第二步:创建一个脚本:touch se.sh 第三步:输入i,代表开始输入内容 输入以下命令: 脚本如下:(sql语句可以是任何复杂的sql ...

  6. Kali2017 Metasploit连接postgresql数据库

    msfdb:msf数据库管理命令 1.查看msf数据库连接状态 msf > db_status [*] postgresql selected, no connection //未连接 2.ms ...

  7. bt5 r3下metasploit连接postgresql数据库

    一.查看PostgreSQL使用的端口,默认为7337 #: netstat -tnpl |grep postgres 二.查看Msf配置,里面有默认的用户名和密码 默认配置文件:/opt/metas ...

  8. kali 2.0中msf连接postgres数据库

    装好kali 2.0后直接运行msfconsole msf> db_status postgres selected, no connection 百度到的解决方法多是针对BT和kali 1.0 ...

  9. [Kong 与 Konga与postgres数据库] 之 Kuberneres 部署

    1.Kong的概述 Kong是一个clould-native.快速的.可扩展的.分布式的微服务抽象层(也称为API网关.API中间件或在某些情况下称为服务网格)框架.Kong作为开源项目在2015年推 ...

随机推荐

  1. Spring学习笔记之整合hibernate

    1.web.xml里边要配置好对应的springxml的路径 <context-param> <param-name>contextConfigLocation</par ...

  2. 自定义的dialog

    自定义的dialog  其中包含置顶 删除 和取消 下面的是BaseDialog package com.free.csdn.view.dialog; import android.app.Dialo ...

  3. 发布Restful服务时出现IIS 指定了身份验证方案错误时的解决方案(IIS specified authentication schemes)

    发布RESTful服务,当访问.svc文件时出现如下错误时: IIS 指定了身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持一种身份验 ...

  4. 添加Sql作业,新建步骤出现:从IClassFactory为CLSID为{AA40D1D6-CAEF-4A56-B9BB-D0D3DC976BA2}的COM组件创建实例失败,原因是出现以下错误:c001f011。的解决方法

    32位操作系统: 打开运行(命令提示符), 一.输入 cd c:\windows\system32 进入到c:\windows\system32路径中 二.输入 regsvr32 "C:\P ...

  5. Mysql 基本操作连接数据库读取信息内容

    <?php header("content-type:text/html; charset=utf-8"); // 数据库配置信息 define("DB_HOST& ...

  6. GSM Hacking:如何对GSM/GPRS网络测试进行测试

    写在前面 这里需要介绍的是GSM / GPRS网络测试的一些方法,随着现在硬件设备连网现象的普遍存在,例如智能电表.自动变速箱控制单元(TCU).POS机.报警系统等.这些设备通常需要与网络连接,GS ...

  7. php大力力 [004节]PHP常量MAMP环境下加载网页

    我的问题是:“让mamp加载PHP文件”. 这个特别简单的问题,刚才也把我憋了几个钟头,唉....土啊,新学一个东西,学习成本就是高. 刚刚吃了好吃的南邵小龙虾,以及美味的八里桥大螃蟹,痛苦了半天,终 ...

  8. ajax 提交成功页面跳转问题

    jsx/ajax提交成功后采用以下方式跳转:1.本页面跳转:"window.location.href"."location.href" 2.上一层页面跳转:& ...

  9. 我与python3擦肩而过(一)—— Dict与collections.OrderredDict邂逅

    最近一直在撸Python Data Analysis上的代码(书是基于Python2的,小白我用的python3),所以我下的时候多少有些改动. 这是9.4中的nltk词频分析关于Dict_key的问 ...

  10. MySQL内置函数

    MySQL中的内置系统函数 用在SELECT语句,以及字句where  order by   having 中UPDTE   DELETE 函数中可以将字段名作为变量来用,变量的值就是这个列对应的每一 ...