首页 > 代码库 > Metasploit连接postgres数据库
Metasploit连接postgres数据库
操作环境为Kali虚拟机
1 | root@kali:~# apt-get install postgresql |
启动服务
1 2 | root@kali:~# service postgresql start [ ok ] Starting PostgreSQL 9.1 database server: main. |
修改postgresql密码为toor:
1 2 3 | root@kali:~# sudo -u postgres psql postgres postgres=# alter user postgres with password ‘toor‘; ALTER ROLE |
启动msf:
1 | root@kali:~# msfconsole |
使用msf链接到postgresql:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 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,
成功链接到数据库后,可以用db_nmap命令,这个命令能够在MSF终端中运行nmap,并自动将nmap结果存储在数据库中。
我们会注意到扫描结果中包含一系列开放的端口、软件版本、对目标系统类型的猜测、系统时间MAC地址等信息 |
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。