Giter VIP home page Giter VIP logo

shepherd's Introduction

前排提醒

项目有段时间没更新了,目前就fofa相关的模块应该是还能用的,其他的更新频率太高,个人开发者(其实就是懒)无暇顾及

吐槽

写工具好累,想弄一个真正看起来不错的得花好多时间,懒狗不想写了,欢迎有使用的大哥们提一下建议(例如运行到哪的时候有bug等)

介绍

  • 工具作用:
    • 将多个空间测绘引擎(目前为zoomeye、hunter、quake、fofa)的接口整合到一起,通过用户给定的domain参数自动化的将各个平台的结果(全字段)保存为xlsx,计划后续整个指纹识别。
    • icp备案和空间测绘聚合,省的你还得专门查备案然后手动添加
    • 获取的子域名会在ip结果中存在内网地址的时候进行host碰撞
    • 利用fofa搜全网无需认证的代理并验证,免费代理池get

脚本编写环境:

    • python3.8.3

使用方法

# 查询域名
python3 Elapse.py -d <domain> | python3 Elape.py -df <domain_file>
# 通过公司名查控股等
python3 Elapse.py -c <company_name> | python3 Elapse.py -cf <company_name_file>
# 或者查完域名跟着一起查公司信息
python3 Elapse.py -d <domain> -c <company_name> | python3 Elapse.py -d <domain> -cf <company_name_file>  等等
# 查代理并验证
python3 Elapse.py -p

使用前请先安装所需要的运行库

pip install -r requirements.txt

更新记录

    • 2022/05/11

1.加入了两个新的模块(hunter、zoomeye)
2.加入了-f,读取文件批量获取

    • 2022/07/01

1.部分模块写了异常处理,一个模块报错不影响了(之前发方便排错没写)
2.增加了利用fofa搜索全网无需验证的socks5代理,并输出.ppx文件(Proxifier代理转发工具的配置文件),为了方便配合gost,result目录下也会输出一份.txt
2.加入了icp备案模块、爱企查、host碰撞模块(censys、fofa)
3.icp备案模块和空间测绘搜索的进行了融合,假设-d参数只给了一个域名,在icp备案后发现存在其他域名时,会进行询问是否将同备案其他域名一起添加搜素
4.修复了我忘了什么的bug

    • 2022/08/02

1.我可真是个大傻呗,proxy.py写的这么垃圾居然都没反应过来,目前已把验证部分的wirte改成write了,不会一个ip即显示报错又显示成功了
2.同时文件名也改了,之前不知道脑子里装了什么,按时间戳当文件名居然还放到for里面

    • 2022/10/02

1.发现fofa这种如果搜大企业,太多资产,某一个环节出了问题,原先的程序就会报错,因为是所有数据跑完才保存,现在改为跑一页保存一页
2.icp目前有一些小bug,这个bug非程序上的问题,有时候第一次访问提示出错,但是重新访问的时候就显示正常了,目前的做法是加了一个重试一次的操作,不知道有没有用。。。
3.修复了爱企查同时查询多个企业的时候,保存的数据有问题的bug

    • 2023/08/13

1.感谢PENG-PLUS指出非会员无法使用fid字段,以及再出现errmsg后没有正确的处理错误的方法,在实际测试中,发现fid字段会员能正常使用并且能产出内容,所以在config.yaml中新增了vip的字段,自行选择是否带该fid字段
2.其他模块暂未测试,但是icp备案的功能还是能正常使用的,目前本地测试了两个域名正常

计划写的

    • 将其他平台也添加进来(shodan,搜索引擎,还有什么空间测绘可以用的也可以推荐一下)
    • 指纹识别
    • 没检测到config.yaml时,自动生成

参考项目:

shepherd's People

Contributors

ernket avatar

Stargazers

 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

Forkers

sakazulu

shepherd's Issues

fofa模块bug

fofa.py:61 应该改成这样,去掉了导出fid的字段,这个字段需要企业会员
fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)

如果不改的话,返回结果为:{'error': True, 'errmsg': '[820001] 没有权限搜索fid字段'}

在这种情况下会报
[-]fofa模块存在问题:
local variable 'result' referenced before assignment

原因是异常处理没做好,在以下片段的代码里头,当errmsg存在于res.text时,result不会被创建,但紧接着又使用了result['results'],就会报变量在没定义前使用

    while True:
        fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
        #print(fofa_search_url)
        res = requests.get(fofa_search_url, headers=header)
        if 'errmsg' not in res.text:
            result = json.loads(res.text)
        
        if len(result['results'])==0:           #如果当前页面返回的数据为0,说明已遍历完成,无需继续

可以改成

    while True:
        fofa_search_url = "https://fofa.info/api/v1/search/all?fields=ip,port,title,host,domain,country,province,city,country_name,header,server,protocol,banner,cert,isp,as_number,as_organization,latitude,longitude,icp,cname,type,jarm&page={}&email={}&key={}&qbase64={}&size=10".format(page_num,email,key,str_base64)
        #print(fofa_search_url)
        res = requests.get(fofa_search_url, headers=header)
        if 'errmsg' in res.text:
            print(res.text) #输出此时api返回结果
            continue #执行下次循环直到成功
        result = json.loads(res.text)
        
        if len(result['results'])==0:           #如果当前页面返回的数据为0,说明已遍历完成,无需继续

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.