xiecat / fofax

FOFAX是一个基于fofa.info的API命令行查询工具
https://fofax.xiecat.fun/
GNU General Public License v3.0
719 stars 74 forks source link

关于fofax在Windows系统上的使用问题 #18

Open 0xf4n9x opened 2 years ago

0xf4n9x commented 2 years ago

通过管道查询

Windows上通过管道进行查询,这种方式是优先推荐使用的,因为无需任何转义。

CMD

echo app="APACHE-Solr" | fofax.exe -fs 3

PowerShell

echo 'app="APACHE-Solr"' | fofax.exe -fs 5

通过参数指定查询

在 Windows 下使用一定要注意转义,Windows 终端中输入 " 不加转义会消失,所以这种查询方式稍显麻烦

fofax.exe -q 'app="APACHE-Solr"'        # 输入的内容
FoFa input Query of: app=Grafana        # 程序实际接收的内容

解决这个问题需要转义,可以添加 -debug 开启详细调试模式。并且在 Windows 系统上,使用不同的终端软件,命令也是有所不同。

在CMD终端上,-q 后面不可以添加单引号 '

fofax.exe -q app=\"APACHE-Solr\" -fs 5

而在 PowerShell 上,-q 后面不仅需要添加单引号,而且对于双引号也要进行转义。

fofax.exe -q 'app=\"APACHE-Solr\"' -fs 5

复杂的查询

当查询语句中存在一些特殊符号(例如 & 或者 |),此时在原生 CMD 终端中无法完成正常的查询,但在 PowerShell 中可以通过管道正常查询。

echo 'app="APACHE-Solr" && country="CN"' | .\fofax.exe -fs 5
echo 'app="APACHE-Solr" && (country="FR" || country="CN")' | .\fofax.exe -fs 5

除此之外,如果有更复杂的查询语句,可以考虑使用文本查询的方式。

.\fofax.exe -qf .\query.txt -fs 5
nabs-XM commented 1 year ago

在powershell中复杂查询无法查询中文: echo '(title="中文") && domain="xx.com" && status_code="200"' | .\fofax.exe -fs 100 -ffi -fto -debug Fofa Api Query: (title="??") && domain="xx.com" && status_code="200"

Becivells commented 1 year ago

改。windows下的命令问题太多。暂时可以把语句放到文件中比如1.txt 使用fofax.exe -qf 1.txt选项 https://www.zhihu.com/question/54724102 这里也有一些其他选项