Metasploit 使用篇
文章目录
- 前言
- 一、msfconsole
- 启动msfconsole
- 命令分类
- 核心命令
- 模块命令
- 作业命令
- 资源脚本命令
- 后台数据库命令
- 二、使用案例
- 更改提示和提示字符
- 运行shell命令
- 信息收集:HTTP头检测
前言
理解了Meatasploit框架架构、原理之后,自然就很好理解它的使用逻辑
- find relevant exploits ----> 寻找相关的
EXP
- set parameters ----> 设置参数(payloads、目标参数等)
- exploit vulnerable services ----> 攻击/利用 存在漏洞的服务
MSF被称为一个渗透测试框架,而不单单是一个漏洞利用框架,这就说明我们还可以使用MSF做信息收集、后渗透等许多事情。所以的使用逻辑是这样:
- find relevant modules ----> 寻找相关的模块
- set parameters ----> 设置参数(payloads、目标参数等)
- run ----> 运行(发送数据包,输出回显信息)
一、msfconsole
msfconsole
是MSF的一个使用接口,提供了集中式的控制台使你可以高效地访问MSF中的可用选项。刚开始使用msfconsole时可能会有点疑惑:这到底是个啥?他是怎样工作的?我们已经清楚地知道了框架地底层逻辑,第一个问题解决了。至于第二个问题,可以这样理解:msfconsole就是一个“控制台接口”,像Linux 的shell 一样,接收输入,显示输出。既然msfconsole是一个“命令行”,那么就有它支持的命令、选项等,这就是我们接下来要学习的
启动msfconsole
在命令行输入msfconsole
即可以正常模式启动,我们会看到一堆欢迎信息,也就是软件的banner
,banner信息是随机的,每次都不一样
如果输入msfconsole -q
,即可以静默模式启动
,静默模式不会显示错误、警告和banner信息。
进入到MSF的“控制台”之后干什么,没学过msfconsole支持的命令就会一脸茫然心生畏惧。
命令分类
进入msfconsole后,输入help
或者?
,可以看到开发团队为我们梳理好的命令分类
核心命令
最常用和通用的命令
Core Commands
=============Command Description------- -----------? Help menubanner Display an awesome metasploit bannercd Change the current working directorycolor Toggle colorconnect Communicate with a hostdebug Display information useful for debuggingexit Exit the consolefeatures Display the list of not yet released features that can be opted in toget Gets the value of a context-specific variablegetg Gets the value of a global variablegrep Grep the output of another commandhelp Help menuhistory Show command historyload Load a framework pluginquit Exit the consolerepeat Repeat a list of commandsroute Route traffic through a sessionsave Saves the active datastoressessions Dump session listings and display information about sessionsset Sets a context-specific variable to a valuesetg Sets a global variable to a valuesleep Do nothing for the specified number of secondsspool Write console output into a file as well the screenthreads View and manipulate background threadstips Show a list of useful productivity tipsunload Unload a framework pluginunset Unsets one or more context-specific variablesunsetg Unsets one or more global variablesversion Show the framework and console library version numbers
模块命令
编辑、加载、使用Msf模块
Module Commands
===============Command Description------- -----------advanced Displays advanced options for one or more modulesback Move back from the current contextclearm Clear the module stackfavorite Add module(s) to the list of favorite modulesinfo Displays information about one or more moduleslistm List the module stackloadpath Searches for and loads modules from a pathoptions Displays global options or for one or more modulespopm Pops the latest module off the stack and makes it activeprevious Sets the previously loaded module as the current modulepushm Pushes the active or list of modules onto the module stackreload_all Reloads all modules from all defined module pathssearch Searches module names and descriptionsshow Displays modules of a given type, or all modulesuse Interact with a module by name or search term/index
作业命令
处理MSF模块的作业操作,例如创建作业、列出后台运行的作业、取消和重命名作业
Job Commands
============Command Description------- -----------handler Start a payload handler as jobjobs Displays and manages jobskill Kill a jobrename_job Rename a job
资源脚本命令
Resource Script Commands
========================Command Description------- -----------makerc Save commands entered since start to a fileresource Run the commands stored in a file
后台数据库命令
Database Backend Commands
=========================Command Description------- -----------analyze Analyze database information about a specific address or address rangedb_connect Connect to an existing data servicedb_disconnect Disconnect from the current data servicedb_export Export a file containing the contents of the databasedb_import Import a scan result file (filetype will be auto-detected)db_nmap Executes nmap and records the output automaticallydb_rebuild_cache Rebuilds the database-stored module cache (deprecated)db_remove Remove the saved data service entrydb_save Save the current data service connection as the default to reconnect on startupdb_status Show the current data service statushosts List all hosts in the databaseloot List all loot in the databasenotes List all notes in the databaseservices List all services in the databasevulns List all vulnerabilities in the databaseworkspace Switch between database workspaces
二、使用案例
更改提示和提示字符
进入到msfconsole,我们不知道做什么,或者说我们不知道目前有什么选项可以使用。可以输入show options
或者options
,显示如下:
Global Options:
===============Option Current Setting Description------ --------------- -----------ConsoleLogging false Log all console input and outputLogLevel 0 Verbosity of logs (default 0, max 3)MeterpreterPrompt meterpreter The meterpreter prompt stringMinimumRank 0 The minimum rank of exploits that will run without explicit confirmationPrompt msf6 The prompt stringPromptChar > The prompt characterPromptTimeFormat %Y-%m-%d %H:%M:%S Format for timestamp escapes in promptsSessionLogging false Log all input and output for sessionsSessionTlvLogging false Log all incoming and outgoing TLV packetsTimestampOutput false Prefix all console output with a timestamp
我们使用set
可以设置这些选项,例如,更改提示和提示符号:
msf6 > set Prompt 辣鸡
Prompt => ▒辣鸡
▒辣鸡 > set PromptChar >>>
PromptChar => >>>
▒辣鸡 >>>
▒辣鸡 >>>msf6 > 变成了 ▒辣鸡 >>>
运行shell命令
可以在msfconsole中执行shell命令,因为Metasploit将这些命令作为参数传递给操作系统的shell
▒辣鸡 >>> whoami
[*] exec: whoamikali
▒辣鸡 >>> ls | grep burp
[*] exec: ls | grep burpburpsuiteP
从输出可以猜测,应该是ruby中使用了exec()函数
,将该字符串解析为系统命令并执行。
信息收集:HTTP头检测
相关文章:

Metasploit 使用篇
文章目录前言一、msfconsole启动msfconsole命令分类核心命令模块命令作业命令资源脚本命令后台数据库命令二、使用案例更改提示和提示字符运行shell命令信息收集:HTTP头检测前言 理解了Meatasploit框架架构、原理之后,自然就很好理解它的使用逻辑 find…...

Java岗面试题--Java并发(日积月累,每日三题)
目录面试题一:并行和并发有什么区别?面试题二:线程和进程的区别?追问:守护线程是什么?面试题三:创建线程的几种方式?1. 继承 Thread 类创建线程,重写 run() 方法2. 实现 …...

Prometheus监控案例之blackbox-exporter
blackbox-exporter简介 blackbox-exporter项目地址:https://github.com/prometheus/blackbox_exporter blackbox-exporter是Prometheus官方提供的一个黑盒监控解决方案,可以通过HTTP、HTTPS、DNS、ICMP、TCP和gRPC方式对目标实例进行检测。可用于以下使…...

Makefile基础使用和实战详解
Makefile基础使用和实战详解一、基础1.1、简单的Makefile1.2、多文件编译1.3、伪对象.PHONY二、变量2.1、自动变量2.2、特殊变量2.3、变量的类别2.4、变量及其值的来源2.5、变量引用的高级功能2.6、override 指令三、模式四、函数4.1、addprefix 函数4.2、filter函数4.3、filte…...
Go基础-变量
文章目录1 Go中的变量2 声明一个变量3 声明变量并初始化4 变量推断5 声明多个变量5.1 多个变量相同类型5.2 多个变量不同类型6 简短声明7 Go语言变量不能把一种类型赋值给其他类型1 Go中的变量 Go中变量指定了某存储单元的名称,该存储单元会存储特定类型的值&#…...

【算法】三道算法题目单词拆分,填充每个节点的下一个右侧节点指针以及组合总和
算法第一道算法题:单词拆分java解答参考第二道算法题:填充每个节点的下一个右侧节点指针java 解答参考第三道算法题:组合总和java解答参考大家好,我是小冷。 今天还是继续学习算法技术知识吧 第一道算法题:单词拆分 …...
【算法】刷题路线(系统+全面)
本系列基于当前各大公司对大公司的考察情况,给大家规划一条可行的算法刷题路线,大概会规划 200 道自认为有用的题,并且争取让初学者,能够刷起来更加丝滑,而且每个阶段都会进行相对应的说明。 当然,无论是面…...

Fiddler的报文分析
目录 1.Statistics请求性能数据 2.检测器(Inspectors) 3.自定义响应(AutoResponder) 1.Statistics请求性能数据 报文分析: Request Count: 1 请求数,该session总共发的请求数 Bytes …...

Spring 中,有两个 id 相同的 bean,会报错吗
我们知道,spring容器里面的bean默认是单例的,所以id是唯一的。但是需要注意,同一类型的bean可以有不同的id,比如有id1->bean,也可以有id2->bean。 下面再来详细回答一下文章的问题。 首先,在同一个…...
Mysql数据库的时间(4)一查询数据库时间注意点
一.select根据时间段查询 1.原始的sql根据时间段查询 select * from stu where time between "1998-09-01" and "1999-09-01"; //查询从1998-09-01到1999-09-01时间段的数据 等同于select * from stu where time >"1998-09-01" and time &l…...

一起学 pixijs(2):修改图形属性
大家好,我是前端西瓜哥。 我们做动画、游戏、编辑器,需要根据用户的交互等操作,去实时地改变图形的属性,比如位置,颜色等信息。今天西瓜哥带大家来看看在 pixijs 怎么修改图形的属性。 因为 pixijs 的底层维护了图形…...
LeetCode 121. 买卖股票的最佳时机
原题链接 难度:easy\color{Green}{easy}easy 题目描述 给定一个数组 pricespricesprices ,它的第 iii 个元素 prices[i]prices[i]prices[i] 表示一支给定股票第 iii 天的价格。 你只能选择 某一天 买入这只股票,并选择在 未来的某一个不同…...

shell脚本内调用另外一个shell脚本的几种方法
有时会在一个shell脚本(如test_call_other_shell.sh)中调用另外一个shell脚本(如parameter_usage.sh),这里总结几种可行的方法,这些方法在linux上和windows上(通过Git Bash)均适用: 1.通过source: 运行在相同的进程,在test_…...
Linux C++ 多进程下write写日志问题思考
文章目录多个进程(父子)同时通过write像日志文件中写,是否会出现数据混乱情况?需要满足以下条件: 1、通过open打开文件,子进程都是复制父进程的文件描述符去操作这个文件,不会造成文件混乱&…...

MySQL的四种事务隔离级别
目录一、事务的基本要素(ACID)1、原子性(Atomicity):2、一致性(Consistency):3、隔离性(Isolation):4、持久性(Durability)…...

方法区和元空间有什么关系?
一.什么是方法区? 方法区属于是 JVM 运行时数据区域的一块逻辑区域,是各个线程共享的内存区域。 《Java 虚拟机规范》只是规定了有方法区这么个概念和它的作用,方法区到底要如何实现那就是虚拟机自己要考虑的事情了。也就是说,在…...

2023VNCTF的两道(暂时)
from http://v2ish1yan.top/2023/02/19/%E6%AF%94%E8%B5%9Bwp/2023vnctf/ 比赛的时候在回学校的路上,所以没有打,听说质量挺高,赛后做一下 象棋王子 一个普通的js游戏,玩过关了就给flag,所以flag肯定在前端源码里 这…...

JDK版本区别
1. 泛型 ArrayList listnew ArrayList()------>ArrayList<Integer>listnew ArrayList<Integer>(); 2 自动装箱/拆箱 nt ilist.get(0).parseInt();-------->int ilist.get(0);原始类型与对应的包装类不用显式转换 3 for-each i0;i<a.length;i------------&…...

Android 基础知识4-2.8 TableLayout(表格布局)详解
一、TableLayout的概述 表格布局是以行数和列数来确定位置进行排列。就像一间教室,确定好行数与列数就能让同学有序入座。 注意:我们需要先添加<TableRow容器,每添加一个就会多一行,然后再往<TableRow容器中添加其它组件。…...

SQL代码编码原则和规范
目录1、先了解MySQL的执行过程2、数据库常见规范3、所有表必须使用Innodb存储引擎4、每个Innodb表必须有个主键5、数据库和表的字符集统一使用UTF86、查询SQL尽量不要使用select *,而是具体字段7、避免在where子句中使用 or 来连接条件8、尽量使用数值替代字符串类型…...
JSON解析崩溃原因及解决方案
问题记录: /************************************************| * 描述: 将ID124执行NFC操作-JSON解析为结构体* 函数名: cJSON_ID124_to_struct* 参数[ I]: *json_string 待解析的指针* 参数[II]: *wireless_rxd 结构体指针* 返回: 成功返回0 失…...
asp.net mvc如何简化控制器逻辑
在ASP.NET MVC中,可以通过以下方法简化控制器逻辑: ASP.NET——MVC编程_aspnet mvc-CSDN博客 .NET/ASP.NET MVC Controller 控制器(IController控制器的创建过程) https://cloud.tencent.com/developer/article/1015115 【转载…...

音频剪辑软件少之又少好用
我们平时见到的图片以及视频编辑工具非常多,但是音频剪辑软件却是少之又少,更不用说有没有好用的,今天,给大家带来一款非常专业的音频剪辑软件,而且是会员喔。 软件简介 一款手机号登录即可以享受会员的超专业音频剪…...

K8S认证|CKS题库+答案| 7. Dockerfile 检测
目录 7. Dockerfile 检测 免费获取并激活 CKA_v1.31_模拟系统 题目 开始操作: 1)、切换集群 2)、修改 Dockerfile 3)、 修改 deployment.yaml 7. Dockerfile 检测 免费获取并激活 CKA_v1.31_模拟系统 题目 您必须在以…...

AI架构师修炼之道
1 AI时代的架构革命 与传统软件开发和软件架构师相比,AI架构师面临着三重范式转换: 1.1 技术维度,需处理异构算力调度与模型生命周期管理的复杂性; 1.2 系统维度,需平衡实时性与资源约束的矛盾; 1.3 价…...

智能网卡之hinic3 WQE(Work Queue Element)结构梳理
hinic3 WQE(Work Queue Element)结构详解 本文基于 hinic3 驱动源码,对 WQE(Work Queue Element)做详细讲解。如需查阅完整源码和结构体定义可参考hinic3_nic_qp.h等文件。 1. WQE 的作用 WQE(Work Queue…...

web3-基于贝尔曼福特算法(Bellman-Ford )与 SMT 的 Web3 DeFi 套利策略研究
web3-基于贝尔曼福特算法(Bellman-Ford )与 SMT 的 Web3 DeFi 套利策略研究 如何找到Defi中的交易机会 把defi看做是一个完全开放的金融产品图表,可以看到所有的一切东西;我们要沿着这些金融图表找到一些最优的路径,就…...

c++ 静态成员变量
Student.h头文件内容: #pragma once #include <string> using namespace std;class Student { public:string name;int score;static int totalScore; // 静态局部变量声明Student(string name, int score);~Student();void print() const; };Student.cpp源文…...

Python训练营-Day22-Titanic - Machine Learning from Disaster
Description linkkeyboard_arrow_up 👋🛳️ Ahoy, welcome to Kaggle! You’re in the right place. This is the legendary Titanic ML competition – the best, first challenge for you to dive into ML competitions and familiarize yourself w…...
测试 FreeSWITCH 的 mod_loopback
bgapi originate loopback/answer,park/default/inline park inline show channels as xml show calls as xml 有 2 个 channels 有 2 个 calls 比较有意思 在 loopback-a 是播放 wav 在 loopback-b 上可以录音 这就是回环 有什么用呢? 除了做测试&#x…...