Giter VIP home page Giter VIP logo

bayonet's People

Contributors

ctf-missfeng 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bayonet's Issues

数据库连接字符问题

师傅, 请问下关于数据库连接字符:
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:qazxsw@[email protected]/bayonet'
其中postgresql postgres qazxsw@123 bayonet这几个参数各自代表什么?
新手查了半天资料无获,谢谢~

建议加个心跳检测

一段时间使用之后发现那几个python进程偶尔会一些原因退出,或者假死
建议加一个心跳检测之类的模块,减少一些命令行运维的操作

好像有些问题

image
image
如上图,显示扫描完成,并且查看oneforall的日志也显示扫描完成,发现231个子域,但是在web端显示为空,一个都没有。(docker搭建并且添加了一下api接口)

app.py里面PORT端口是指多少

app.py里面port端口是多少,这个端口,我看用于xray的webhook输出,想确认一下是多少。
我想是否可以在服务器里面搭建一个把漏洞推送到微信那边,通过server酱。
image

Nmap程序未找到

我已经在config.py 里指定了具体路径,但是仍然提示nmap路径未找到。

image

建议每次读取数据库前做一下缓存刷新

实际使用中,有时候我会手动想让OneForALL 某些域名,urlscan对某些端口再跑一次。我会直接修改数据库的flag, 这个时候需要手动重启Run.py,因为缓存问题。所以,建议在扫描之前的读取数据库的时候刷新一下缓存。比如下面的地方,加一行代码commit一下。
比如:

def ReadPort():
    # 刷新缓存
    DB.session.commit()

docker运行,无法执行除子域名以外的所有动作

环境:使用docker环境,已经替换了最新的代码文件。

添加主域名以后,扫描完毕以后。tools.log就不再滚动了,端口扫描等动作也都不执行。

已经添加了shodan 的api,fofa的,zoomeye的都添加了。

tools.log最后的日志就是
02:13:19,629 [INFOR] resolve:170 - 完成异步查询子域的A记录
02:13:19,651 [INFOR] dbexport:65 - 开始进行子域名入库
02:13:20,232 [INFOR] dbexport:77 - 子域名入库完成
02:13:20,242 [INFOR] oneforall:206 - 结束运行OneForAll

w13scan.log中的日志一直在提示
不存在results目录

后续所有的动作都未执行。
请问这个应该怎么处理。

提一些小建议

1.添加域名-->2.获取子域名(添加企查查、备案信息等)[支持自行导入域名list]-->3.子域名解析ip的c段所有ip1-65535端口-->4.实时监控子域名列表,定期获取子域名。
结果支持导出功能

端口入库SQL错误

17:18:40,606 [ALERT] Run:63 - 端口入库SQL错误:(psycopg2.errors.ForeignKeyViolation) insert or update on table "src_ports" violates foreign key constraint "src_ports_subdomain_fkey"
DETAIL: Key (subdomain)=(xxx.com) is not present in table "src_subdomain".

[SQL: INSERT INTO src_ports (subdomain_ip, subdomain, port, service, product, version, flag, brute, port_time) VALUES (%(subdomain_ip)s, %(subdomain)s, %(port)s, %(service)s, %(product)s, %(version)s, %(flag)s, %(brute)s, %(port_time)s) RETURNING src_ports.id]
[parameters: {'subdomain_ip': '110.110.110.110', 'subdomain': 'xxx.com', 'port': 80, 'service': 'http', 'product': '', 'version': '', 'flag': False, 'brute': False, 'port_time': '2020-03-24 17:18:40'}]
(Background on this error at: http://sqlalche.me/e/gkpj)
Traceback (most recent call last):
File "run_portscan.py", line 4, in
tools.portscan.Run.port_main()
File "/root/bayonet/tools/portscan/Run.py", line 91, in port_main
WriteSubDomain(results)
File "/root/bayonet/tools/portscan/Run.py", line 40, in WriteSubDomain
sql_subdomain = SrcSubDomain.query.filter(SrcSubDomain.subdomain_ip == results.subdomain_ip).all()
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 282, in get
return self.impl.get(instance_state(instance), dict_)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 705, in get
value = state._load_expired(state, passive)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 660, in _load_expired
self.manager.deferred_scalar_loader(self, toload)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/loading.py", line 987, in load_scalar_attributes
raise orm_exc.ObjectDeletedError(state)
sqlalchemy.orm.exc.ObjectDeletedError: Instance '<SrcSubDomain at 0x7fd6ae270370>' has been deleted, or its row is otherwise not present.

docker postgresql start Error

root@e41801b31c12:/etc/init.d# ./postgresql start

  • Starting PostgreSQL 10 database server * Error: /usr/lib/postgresql/10/bin/pg_ctl /usr/lib/postgresql/10/bin/pg_ctl start -D /var/lib/postgresql/10/main -l /var/log/postgresql/postgresql-10-main.log -s -o -c config_file="/etc/postgresql/10/main/postgresql.conf" exited with status 1:
    2020-03-13 18:01:15.189 HKT [344] LOG: could not create IPv6 socket for address "::1": Permission denied
    2020-03-13 18:01:15.189 HKT [344] LOG: could not create IPv4 socket for address "127.0.0.1": Permission denied
    2020-03-13 18:01:15.189 HKT [344] WARNING: could not create listen socket for "localhost"
    2020-03-13 18:01:15.189 HKT [344] FATAL: could not create any TCP/IP sockets
    2020-03-13 18:01:15.189 HKT [344] LOG: database system is shut down
    pg_ctl: could not start server
    Examine the log output.
    [fail]

是否考虑搭建多台服务器分布式任务

第一版:
将子域名扫描、爬虫、漏洞扫描,分布布置到不同服务器进行工作,然后把数据统一返回web界面。
第二版:
然后在考虑,多节点形式,比如同时用3个w13scan扫描漏洞,然后在推送到web界面。

子域名数据接口请求异常

image

web日志:

[2020-03-25 14:10:54,477] ERROR in app: Exception on /api/src/subdomain [GET]
Traceback (most recent call last):
  File "/usr/local/bin/python3/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/bin/python3/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/bin/python3/lib/python3.8/site-packages/flask_restful/__init__.py", line 468, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/bin/python3/lib/python3.8/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/bin/python3/lib/python3.8/site-packages/flask_restful/__init__.py", line 583, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/root/bayonet/web/route/src/api.py", line 271, in get
    data1['loudong_count'] = len(i.src_vulnerabilitie)
AttributeError: 'SrcSubDomain' object has no attribute 'src_vulnerabilitie'
222.209.84.125 - - [25/Mar/2020 14:10:54] "GET /api/src/subdomain?page=1&limit=20&searchParams=%7B%22subdomain%22%3A%22%22%2C%22subdomain_ip%22%3A%22%22%7D HTTP/1.1" 500 -

数据库连接问题

SQLALCHEMY_DATABASE_URI = 'postgresql://bayonet:aCymcibCp8RN@localhost:5432/bayonet'
我的数据库配置连接没问题呀!但是就是在插入数据库的时候报错!我数据库版本为11版本

一些建议

可以增加扫ip段,敏感信息搜集模块,git、bing、google、百度等

在云服务器上docker部署后,宿主机无法访问

用两台机器分别拉取了容器下来,配置分别为阿里云轻量服务器ubuntu18.04.4和腾讯云服务器ubuntu18.04.1,
docker run -itd --name bayonet -p 5000:5000 missfeng/bayonet:v1.2
我是讲端口映射放到5000的。
在容器内部执行curl http://127.0.0.1能够正常返回页面内容,但是在宿主机执行curl http://127.0.0.1:5000返回的则是Empty reply from server

关于使用的疑问?

您好,我使用docker的方式搭建起来环境,添加域名扫描。
添加之后,过一会可以看到域名的扫描结果,但是端口和漏洞数据没有。
请问,添加任务之后是会进行自动的端口 & 漏洞扫描吗?
个人感觉端口数据应该是可以出来的。

另外,是否能给个任务进度提示,我也不知道是不是任务没有跑完?反正等了蛮久的

一个小建议

在创建任务的时候,增加一栏用用于填写黑名单来排除不在奖励范围内的域名。
如:*.test.qq.com ,排除test.qq.com下的子域名。对于一些资产比较多src还是可以减少挺多不在范围内的域名,不用再去扫描这些域名的端口和目录等,也有助于提升速度

是否有统一的proxy管理或设置

开源聚合大卡车啊!已经推荐到到我的项目
感谢开发,感谢开源!
开发不易,还没有阅读源码的,想问一下是不是有统一的proxy/proxy池支持、设置或管理,还是需要单独去每个工具里面设置,或者是在主机上设置所有的出口流量.因为现在遍地WAF...估计没怎么扫描IP就挂了.

docker中更新最新版本跑不起来

更新了最新的v1.2的代码包,按照README中在docker中运行会遇到些问题

第一步会遇到文件头没有加utf8的报错,需要自己添加文件头 ,这儿反馈下
image

后面我在config文件里shodan_api 和shodan_api_key里都添加了值但是还是会报错,
image
image

docker 运行报错

执行docker run -itd --name bayonet -p 5000:80 missfeng/bayonet:v1.1
后继报错如下
docker: Error response from daemon: driver failed programming external connectivity on endpoint bayonet (0d2c5853b4bc91e0e2fae7b5c4e6c493915be166a0b421c308c4517c80cb2bb5): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 5000 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).

crawlergo代理

crawlergo有一个可以设置代理的选项--push-to-proxy
建议可以直接用这个代理上xray,不然爬取的流量还要用python再放一遍

Spyse API Key (Update)

We noticed that you used the API of one of Spyse's products most likely it was Findsubdomains, Cert DB or DNS table. We want to notify you about the release of a new and improved API key which you can find in your personal account at spyse.com. 
Unfortunately, we should stop supporting the old API a few weeks earlier, starting from Monday. Thanks for being with us.

如何修改默认访问

我已经本地搭建成功,但是不能设置外网访问。
对5000端口已经防火墙开放成功。
想问一下大佬,如何设置。

检测的域名的ip有问题

不能准确查询到域名对应的正确的ip,和dig出来的ip不一样,我也对同一个域名用oneforall跑,得到的域名也不一致

建议:OneForAll的结果可以直接取实例对象one的属性datas

OneForAll的结果可以直接取one.datas,不用写得这么复杂的哦。

def subdomain_result(self):
sub_file = pathlib.Path(__file__).parent.resolve().joinpath('results', self.domain + '_subdomain.json')
if not sub_file.is_file():
logger.log('ALERT', '子域名文件:%s未发现' % sub_file)
return None
with open(sub_file, 'r', encoding='utf-8') as file:
tmp_str = file.read()
try:
tmp_dict = json.loads(tmp_str)
except:
logger.log('ALERT', '子域名文件:%s解析json格式错误' % sub_file)
return None

datas的结构长这样:

[{"id": null, "url": "http://freebuf.com:80", "subdomain": "freebuf.com", "port": 80, "ips": "'182.254.150.199'", "status": 200, "reason": "OK", "valid": 1, "new": 0, "title": "FreeBuf互联网安全新媒体平台", "banner": "'Server': 'Apache/2.2.21', 'Via': None, 'X-Powered-By': None"},{...}]

另外现在OneForAll支持传path参数了,对OneForAll有其他问题欢迎交流:P

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.