靶机-basic_pentesting_2

basic_pentesting_2

arp-scan -l查找靶机IP

masscan 192.168.253.154 --ports 0-65535 --rate=10000 端口扫描

nmap扫描nmap -T5 -A -p- 192.168.253.154

目录扫描80端口

http://192.168.253.154/development/dev.txt
2018-04-23: I’ve been messing with that struts stuff, and it’s pretty cool! I think it might be neat
to host that on this server too. Haven’t made any real web apps yet, but I have tried that example
you get to show off how it works (and it’s the REST version of the example!). Oh, and right now I’m
using version 2.5.12, because other versions were giving me trouble. -K

2018-04-22: SMB has been configured. -K

2018-04-21: I got Apache set up. Will put in our content later. -J
http://192.168.253.154/development/j.txt
For J:

I’ve been auditing the contents of /etc/shadow to make sure we don’t have any weak credentials,
and I was able to crack your hash really easily. You know our password policy, so please follow
it? Change that password ASAP.

-K
两个文档大概意思是:
struts是2.5.12版本,并且密码/etc/shadow 里的容易破解
访问8080端口,没找到东西
主页的登录http://192.168.253.154:8080/是tomcat

有提到 three samba服务获取数据。
可以使用enum4linux工具枚举Windows和samba中的数据
enum4linux —扫描共享文件
使用方法: enum4linux 192.168.253.154
Windows 访问共享文件:
\ip\文件夹名称

发现用户Kay,Jan
九头蛇爆破ssh密码
hydra -l jan -P /usr/share/wordlists/rockyou.txt.gz 192.168.236.138 ssh
得到密码 armando 用户 jan

ssh登录jan

发现kay目录下有密钥文件,没权限

vim读取kay密码
heresareallystrongpasswordthatfollowsthepasswordpolicy$$
sudo -l 发现kay 权限为 ALL 直接sudo su切换为root用户,在根目录下得到flag

ssh公钥私钥获取身份登录凭据

/home/kay/.ssh目录下,有ssh的公钥和私钥信息
复制 RSA 密钥

在kali中创建个key文件,将私钥内容复制到其中保存
使用 ssh2john 将密钥转换为 John the Ripper 的可破解文件
python ssh2john.py key > ssh_login
可以将key创建到ssh2hohn.py文件的目录下
ssh2hohn.py目录在 /usr/share/john

得到了密钥的哈希值
然后使用命令 john --wordlist=/usr/share/wordlists/rockyou.txt ssh_login 破解
成功拿到密码 beeswax

获得密码后,回到以 jan 的身份 ssh 包含 RSA 密钥的文件夹,然后使用以下命令将用户切换到 kay
ssh -i id_rsa kay@192.168.253.154

在使用john进行shadow文件破解时,如果已经开了一个john的进程,这回提示以下错误:
Crash recovery file is locked: /root/.john/john.rec
意思是/root/.john/john.rec文件被锁定。
通过测试只要把 /root/.john/john.rec这个文件删除就不会报错了。
所以可以通过 watch rm -rf /root/.john/john.rec 命令。每两秒删除一次这个文件。
再开多个进程进行shadow文件批量破解即可。建议一次不要开太多。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值