IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 网络协议 -> 网络安全人员一定要知道的Metasploit渗透框架! -> 正文阅读

[网络协议]网络安全人员一定要知道的Metasploit渗透框架!

简介

Metasploit是一款开源安全漏洞检测工具,附带数百个已知的软件漏洞,并保持频繁更新。被安全社区冠以“可以黑掉整个宇宙”之名的强大渗透测试框架。

Metasploit官网:https://www.metasploit.com/

MetasploitGithub仓库地址:https://github.com/rapid7/metasploit-framework

在这里插入图片描述

框架和相关术语简介:

Vulnerability:允许攻击者入侵或危害系统安全性的弱点称为漏洞,漏洞可能存在于操作系统,应用软件甚至网络协议中。

Exploit:攻击代码或程序,它允许攻击者利用易受攻击的系统并危害其安全性。每个漏洞都有对应的漏洞利用程序。Metasploit有超过 1700 个漏洞利用程序。

Payload:攻击载荷。它主要用于建立攻击者和受害者机器直接的连接,Metasploit有超过 500个有效攻击载荷。

Module:模块是一个完整的构件,每个模块执行特定的任务,并通过几个模块组成一个单元运行。这种架构的好处是可以很容易的将自己写的利用程序和工具集成到框架中。

使用方法

在MSF里面msfconsole可以说是最流行的一个接口程序。很多人一开始碰到msfconsole的时候就害怕了。那么多复杂的命令语句需要学习,但是msfconsole真的是一个强大的接口程序。Msfconsole提供了一个一体化的集中控制台。通过msfconsole,你可以访问和使用所有的metasploit的插件,payload,利用模块,post模块等等。Msfconsole还有第三方程序的接口,比如nmap,sqlmap等,可以直接在msfconsole里面使用。

image-20210731121233931

大家可以直接在命令行窗口输入msfconsole,然后回车。这样就打开了msfconsole。Msfconsole的系统文件和用户文件位于/usr/share/metasploit-framework/目录下。

image-20210731123822325

msf5 > help
Core Commands
=============

    Command       Description
    -------       -----------
    ?             Help menu
    banner        Display an awesome metasploit banner
    cd            Change the current working directory
    color         Toggle color
    connect       Communicate with a host
    exit          Exit the console
    get           Gets the value of a context-specific variable
    getg          Gets the value of a global variable
    grep          Grep the output of another command
    help          Help menu
    history       Show command history
    load          Load a framework plugin
    quit          Exit the console
    repeat        Repeat a list of commands
    route         Route traffic through a session
    save          Saves the active datastores
    sessions      Dump session listings and display information about sessions
    set           Sets a context-specific variable to a value
    setg          Sets a global variable to a value
    sleep         Do nothing for the specified number of seconds
    spool         Write console output into a file as well the screen
    threads       View and manipulate background threads
    tips          Show a list of useful productivity tips
    unload        Unload a framework plugin
    unset         Unsets one or more context-specific variables
    unsetg        Unsets one or more global variables
    version       Show the framework and console library version numbers


Module Commands
===============

    Command       Description
    -------       -----------
    advanced      Displays advanced options for one or more modules
    back          Move back from the current context
    clearm        Clear the module stack
    info          Displays information about one or more modules
    listm         List the module stack
    loadpath      Searches for and loads modules from a path
    options       Displays global options or for one or more modules
    popm          Pops the latest module off the stack and makes it active
    previous      Sets the previously loaded module as the current module
    pushm         Pushes the active or list of modules onto the module stack
    reload_all    Reloads all modules from all defined module paths
    search        Searches module names and descriptions
    show          Displays modules of a given type, or all modules
    use           Interact with a module by name or search term/index


Job Commands
============

    Command       Description
    -------       -----------
    handler       Start a payload handler as job
    jobs          Displays and manages jobs
    kill          Kill a job
    rename_job    Rename a job
    
Database Backend Commands
=========================

    Command           Description
    -------           -----------
    analyze           Analyze database information about a specific address or address range
    db_connect        Connect to an existing data service
    db_disconnect     Disconnect from the current data service
    db_export         Export a file containing the contents of the database
    db_import         Import a scan result file (filetype will be auto-detected)
    db_nmap           Executes nmap and records the output automatically
    db_rebuild_cache  Rebuilds the database-stored module cache (deprecated)
    db_remove         Remove the saved data service entry
    db_save           Save the current data service connection as the default to reconnect on startup
    db_status         Show the current data service status
    hosts             List all hosts in the database
    loot              List all loot in the database
    notes             List all notes in the database
    services          List all services in the database
    vulns             List all vulnerabilities in the database
    workspace         Switch between database workspaces

search参数

你使用msfconsole的时候,你会用到各种漏洞模块、各种插件等等。所以search命令就很重要。

先查看search的帮助信息

msf5 > search -h
Usage: search [<options>] [<keywords>:<value>]

Prepending a value with '-' will exclude any matching results.
If no options or keywords are provided, cached results are displayed.

OPTIONS:
  -h                Show this help information
  -o <file>         Send output to a file in csv format
  -S <string>       Regex pattern used to filter search results
  -u                Use module if there is one result

Keywords:
  aka         :  Modules with a matching AKA (also-known-as) name
  author      :  Modules written by this author
  arch        :  Modules affecting this architecture
  bid         :  Modules with a matching Bugtraq ID
  cve         :  Modules with a matching CVE ID
  edb         :  Modules with a matching Exploit-DB ID
  check       :  Modules that support the 'check' method
  date        :  Modules with a matching disclosure date
  description :  Modules with a matching description
  fullname    :  Modules with a matching full name
  mod_time    :  Modules with a matching modification date
  name        :  Modules with a matching descriptive name
  path        :  Modules with a matching path
  platform    :  Modules affecting this platform
  port        :  Modules with a matching port
  rank        :  Modules with a matching rank (Can be descriptive (ex: 'good') or numeric with comparison operators (ex: 'gte400'))
  ref         :  Modules with a matching ref
  reference   :  Modules with a matching reference
  target      :  Modules affecting this target
  type        :  Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)

Examples:
  search cve:2009 type:exploit
  search cve:2009 type:exploit platform:-linux

通过名称查找

查找名称含有mysql的漏洞

msf5 > search name:sql 

image-20210731125308481

通过模块查找

Metasploit上只有三中模块可以利用:

  • 第一种是exploit模块,也就是利用模块,包含主流的漏洞利用脚本,通常是对某些可能存在漏洞的目标进行漏洞利用。命名规则:操作系统/各种应用协议分类

  • 第二种是auxiliary模块,辅助模块,辅助渗透(端口扫描、登录密码爆破、漏洞验证等)。

  • 第三种是post模块,后渗透阶段模块,漏洞利用成功获得meterpreter之后,向目标发送的一些功能性指令,如:提权等。

search name:mysql type:exploit

image-20210731125436544

使用一个模块

通过search查找到模块之后,就可以使用use去使用这个模块

image-20210731130503792

info查看模块的信息

image-20210731135505930

使用完一个模块之后,可以使用set设置模块参数

rhosts是设置攻击目标,threads是设置线程数

image-20210731131257223

再次使用info查看信息

image-20210731135213725

使用show options也可以查看我们设置的参数

image-20210731132956700

run执行模块

image-20210731131637436

run -j可以让进程后台运行

image-20210731141649232

jobs查看后台进程 ,根据提供的编号配合kill杀死进程

image-20210731141836027

setg这个和set有些类似,但是不同的是这个是一个全局变量设置。设置一次后再保存,那么以后,这个漏洞模块你就不用重复设置。

image-20210731140120139

unset取消设置的参数 unsetg取消设置的全局参数

image-20210731135937409

back取消选择的模块

image-20210731132750096

connect参数主要用于远程连接主机。一般用于内网渗透。参数一般为IP地址加上端口号。

image-20210731133606982

edit使用vim去编辑当前的模块

image-20210731134736794

exit是退出msfconsole的命令。可以完全退出msfconsole,并且回到linux终端界面。

image-20210731134849932

msfconsole中依旧可以执行shell命令

image-20210731141121018

参考文档

metasploit msfconsole 命令参数

metasploit介绍及使用

  网络协议 最新文章
使用Easyswoole 搭建简单的Websoket服务
常见的数据通信方式有哪些?
Openssl 1024bit RSA算法---公私钥获取和处
HTTPS协议的密钥交换流程
《小白WEB安全入门》03. 漏洞篇
HttpRunner4.x 安装与使用
2021-07-04
手写RPC学习笔记
K8S高可用版本部署
mySQL计算IP地址范围
上一篇文章      下一篇文章      查看所有文章
加:2021-08-01 14:49:27  更:2021-08-01 14:50:16 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/3 6:08:55-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码