class文件替换模拟热部署

1、编译base加密

Program:
/bin/bash

Arguments:
-c "base64 -i $OutputPath$/$FileDirRelativeToSourcepath$/$FileNameWithoutExtension$.class -o $OutputPath$/$FileDirRelativeToSourcepath$/$FileNameWithoutExtension$.txt ; pbcopy < $OutputPath$/$FileDirRelativeToSourcepath$/$FileNameWithoutExtension$.txt ; cat $OutputPath$/$FileDirRelativeToSourcepath$/$FileNameWithoutExtension$.txt"

working directory:
$FileDir$

找到需要更换的类。选中->鼠标右击->External Tools->自己的脚本会生成一下命令

/bin/bash -c "\
# base64字符串
encoded_str=\"上一步生成的base64编码\"
# 文件名
filename=\"要替换的类名.class\"
# 指定文件生成目录
output_folder=\"./\"
# 解码字符串并输出到指定文件夹
echo \"\$encoded_str\" | base64 -d > \"\$output_folder/\$filename\" \
"

在服务端随便创建一个文件夹eg:

把命令粘贴下来执行

下载arthas

curl -L http://start.alibaba-inc.com/install.sh | sh

找到arthas脚本执行./as.sh

不需要重新部署。代码已生效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值