Coder Social home page Coder Social logo

xiecat / fofax Goto Github PK

View Code? Open in Web Editor NEW
715.0 15.0 74.0 35.57 MB

fofax is a command line query tool based on the API of https://fofa.info/, simple is the best!

Home Page: http://fofax.xiecat.fun/

License: GNU General Public License v3.0

Go 96.63% Makefile 1.73% Shell 0.42% ANTLR 1.21%
fofa fofa-cli fofadump rule survey

fofax's People

Contributors

0xf4n9x avatar becivells avatar binganao avatar go0p avatar jweny avatar tardc avatar v4ni11a avatar zhzyker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fofax's Issues

fx规则-ss命令使用建议

fx规则使用-ss查看详情时会列出与所有规则的匹配过程,看起来不是很友好。还有就是不支持模糊查询,记不住名称或编号得挨个翻。

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

通过管道查询

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

输入源去重

在队列输入处进行检查。有重复的语句跳过。
适用场景:
批量 url 中进行 favico.ico 验证
批量 url 中进行 cert 验证

windows报错:

1、执行命令:fofax -q 'app="APACHE-Solr"'
2、报错如下
2022/03/05 21:25:53 [INFO] The currently used fofax is the latest version
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/xiecat/fofax/internal/cli.updateFoFaXVersionToLatest()
/home/runner/work/fofax/fofax/internal/cli/update.go:60 +0x45f
github.com/xiecat/fofax/internal/cli.updateTips({0x11a2100, 0x14})
/home/runner/work/fofax/fofax/internal/cli/update.go:24 +0xc5
github.com/xiecat/fofax/internal/cli.checkUpdateInfo()
/home/runner/work/fofax/fofax/internal/cli/parser.go:415 +0x1f9
github.com/xiecat/fofax/internal/cli.ParseOptions()
/home/runner/work/fofax/fofax/internal/cli/parser.go:318 +0x33e
main.main()
/home/runner/work/fofax/fofax/cmd/fofax/fofax.go:11 +0x19

这是啥问题啊?fofa的邮箱和key都添加了的

一些建议

第一二条适合新旧会员,第三条更加有助于老版会员。
1、fofaapi给出了各个等级的用户可以通过获取哪些字段,同时fofaapi提供了返回账户信息的api,建议师傅不要直接删除lastupdatetime字段,有些时候当数据超过这个值的时候,大家有个参考,知道通过api查询的最后一条数据日期是什么时候,可以通过web加上before after字段去查看未通过api获取的资产。便于大家获取未通过api获取到的资产,或者根据before after字段,再次通过fofax进行查询,获取第一次未获取到的数据。
实现方法:下面的第二条的的方法,判断用户是否是专业及以上会员,以此来判断是否结果输出lastupdatetime字段。
fofatapi获取账户信息,包括会员等级:
image
fofa对各个等级会员支持的查询字段和输出字段:
image

2、建议fofax添加一个获取全字段的参数,比如--all-fields,方便有需要lastupdatetime或其他字段的用户获取所需数据。
实现方法:fofax代码中添加各等级会员支持查询和返回的字段的代码,fofax每次查询之前先检查userinfo.json是否存在,如果不存在则fofax先通过api https://fofa.info/api/v1/info/my查询用户的信息(如图1),并将用户信息存到userinfo.json文件中。当查询时,如果用户使用了--all-fields参数,则根据已存在的userinfo.json的会员等级level字段判断用户等级,并返回该等级会员所能返回的所有字段。
这一条针对老版会员的帮助很大。

3、建议fofax添加--dumpall(-dl)或者--report-all(-rl)参数并结合-fs参数,通过自动添加before after参数来导出所有查询数据,这一条针对至少高级会员。
原因:对于老版会员,每次api查询是有数量限制的,超过需要付费,但是可以通过添加before after参数来获取所有查询数据。
实现方法:先获取历史记录的条数总数,然后根据使用的-fs参数自动截断获取指定的条数,然后根据最后一条的日期加一(可以通过转成时间戳加1天再转成时间,就不用担心跨月份之类的问题。同时加一也是为了防止后面还有这一天的数据,而漏掉),拼接上语句&& before="这个日期"再获取-fs参数指定的条数,最后去重合并,输出结果。

一些建议,再此万分感谢师傅已开发的fofax。

翻页功能

目前可以选择指定查询数量,然后会显示比如 10/100,那我怎么查询11-20呢,看了一下文档没找到(也有可能我看的不仔细,手动狗头)

按时间段查询会报语法错误

比如说:
echo 'after="2017-01-01" && before="2017-10-01"' | fofax.exe --debug
结果:
2022/07/18 11:45:38 [DEBUG] FoFa Size : 100
2022/07/18 11:45:38 [DEBUG] FoFa input Query of: after="2017-01-01" && before="2017-10-01"
2022/07/18 11:45:38 [DEBUG] https://fofa.info/api/v1/search/all?email=*****@*************&key=********************************&qbase64=YWZ0ZXI9IjIwMTctMDEtMDEiICYmIGJlZm9yZT0iMjAxNy0xMC0wMSI=&size=100&page=1&fields=host,port,ip,lastupdatetime
2022/07/18 11:45:38 [DEBUG] Resp Time: 343.00/millis
2022/07/18 11:45:38 [ERRO] FoFa Response ErrMsg: [820000] FOFA Query Syntax Incorrect

bug反馈

搜索语句带有中文的时候,似乎不能正确的搜索。
.\fofax.exe -q 'app="张三-camera"' -ffi -fs 5 -fe -debug

实际搜索结果如下:
2023/06/03 14:39:04 [DEBUG] FoFa Size : 5
2023/06/03 14:39:04 [DEBUG] FoFa input Query of: app=
2023/06/03 14:39:04 [DEBUG] https://fofa.info/api/v1/search/all?email=*****@*************&key=9161************************b720&qbase64=YXBwPQ==&size=5&page=1&fields=protocol,ip,port,host,type
2023/06/03 14:39:06 [DEBUG] Resp Time: 1398.00/millis
2023/06/03 14:39:06 [DEBUG] Fofa Api Query: "app"
2023/06/03 14:39:06 [SUCC] Fetch Data From FoFa: [5/363027531]
image

增加查询缓存

在限定时间内(3天)进行同一语法查询直接从缓存中读取
定期缓存清理(不会每次使用都进行清理)
增加 --no-cache 参数来手动忽略缓存(同时会替换缓存内容)
增加 -disable-cache-clean 参数关闭
思路1:查询时发送所有字段。获取结果的时候进行字段选择输出。可以排除因字段不同需要二次请求。同时对于请求数据的个数如果小于库中记录的个数则直接获取其中数据。暂时不对查询语句进行解析
思路2: 暴力缓存。不考虑其他直对 get参数进行hash 然后缓存结果。方便快捷代码少

mac下无法使用 timeout

尝试了 v0.1.17 和 v0.1.15,都是提示 timeout,排除了网络的问题

于是把源码下载了下来编译,发现CGO_ENABLED=1下编译,是不会有问题的,不知道是不是这个导致的?

image

Xiecat & FOFA 活动投稿地址

1.提交的内容:

  • 你觉得有意思的、不限于红队或者安全的FOFA查询语法

2.提交模板:

rule_name: 规则名称
description: 规则描述
author: 作者 <FOFA id> 可以不用填写邮箱
fofa_query: fofa语句

举例:

rule_name: jupyter 未授权
description: 可以未授权登录的 jupyter 设备
author: xiecat
fofa_query: body="ipython-main-app" && title="Home Page - Select or create a notebook"

注意:需认真填写自己正确的FOFA账号ID,可在fofa.so官网个人中心页面查看,否则会影响奖项的发放


FOFA语法大比拼活动及奖品发放延期通知

诸位表哥/表姐好:

感谢大家参与我们的语法大比拼活动,目前我们已收到44条语法,最高个人贡献条数:8,其中一些未授权漏洞以及SRC挖洞搜索技巧的等查询方式让我们审核人员直呼“好家伙”“学到了”。因FOFA升级维护无法使用,为保证语法的有效性及活动的公平性,本次语法大比拼活动也顺应推迟,我们已记录并整理好收到的信息,已提交语法的表哥/表姐请放心~

转发中奖的表哥请微信联系XiecatBot,发送收奖地址,我们将在春节开工后寄出。(可在“活动抽奖”小程序查看自己是否中奖)

祝归途中的表哥/表姐一切顺利,虎年暴富!


保存功能问题

师傅保存功能是哪个参数呢请问,保存为txt或者xlsx文件,谢谢了。

“有趣”的FOFA查询语句收集计划

收集一些针对有意思的、不限于红队或者安全的FOFA查询搜集语句。

目前已经收集一部分,详见:“有趣”的FOFA查询语句收集计划

大家有好的或者有意思的查询语句欢迎来此Issue下面贡献,后期会将这些所有的“有趣”的FOFA查询语句整合之fofaX中,让fofaX变得更好玩。

提交格式如下:

```yaml
id: fx-2021-01
query: 查询的字符串用于fx="jupyter Unauth" eg:(jupyter Unauth)
rule_name: 规则名称 eg:(jupyter 未授权)
rule_english: jupyter unauthorized
description: 规则描述
author: 作者<邮箱>eg:(becivells)
fofa_query: fofa语句 eg:(body="ipython-main-app" && title="Home Page - Select or create
  a notebook")"
tag:
- 标签1 eg(unauthorized)
- 标签2
source: 语句来源


```

提交例子

```yaml
id: fx-2021-01
query: jupyter Unauth
rule_name: jupyter 未授权
rule_english: jupyter unauthorized
description: jupyter 适用于科学计算场景。如果没有设置账号密码很容易通过web界面直接托管机器
author: becivells
fofa_query: body="ipython-main-app" && title="Home Page - Select or create  a notebook")"
tag:
- unauthorized
source: 

```

如何显示所有结果

首先,fofax是很强大的工具,有个小问题,哪个参数可以显示这个all的数据吗,如下图,我没找到这个参数,还是暂时没这个功能?

image
image

联动案例

  1. xray
echo 'login' | fofax -fs 100 -e -ec | httpx -o 123.txt && xray ws ss --uf 123.txt

@荋丶 提供

xray ws ss --uf <(echo 'login' | fofax -fs 100 -e -ec -ffi )

bug

查询10000条数据的时候,碰到一种协议无法解析应该是。
参数:-fto -fs 10000

报错信息:
url.Parse parse "mc_nmf://124.xxxxxx:10001": first path segment in URL cannot contain colon

Mac m1 运行报错

fofax -q 'app="APACHE-Solr"'

      ____        ____       _  __
     / __/____   / __/____ _| |/ /
    / /_ / __ \ / /_ / __ `/|   /
   / __// /_/ // __// /_/ //   |
  /_/   \____//_/   \__,_//_/|_|
                 	v0.1.43
			https://fofax.xiecat.fun

2023/04/15 15:58:13 [INFO] No new updates found for fofax engine!
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104c41150]

goroutine 1 [running]:
github.com/xiecat/fofax/internal/cli.updateTips({0x104c48c23?, 0x14?})
	/Users/ksc/go/pkg/mod/github.com/xiecat/[email protected]/internal/cli/update.go:29 +0xe0
github.com/xiecat/fofax/internal/cli.checkUpdateInfo()
	/Users/ksc/go/pkg/mod/github.com/xiecat/[email protected]/internal/cli/parser.go:427 +0x248
github.com/xiecat/fofax/internal/cli.ParseOptions()
	/Users/ksc/go/pkg/mod/github.com/xiecat/[email protected]/internal/cli/parser.go:330 +0x37c
main.main()
	/Users/ksc/go/pkg/mod/github.com/xiecat/[email protected]/cmd/fofax/fofax.go:11 +0x1c

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.