flipkart-incubator/Astra

GitHub: flipkart-incubator/Astra

Astra 是一个专注于 REST API 的自动化安全测试框架,支持通过 Postman 或 Swagger 集合批量检测常见 API 漏洞并可集成到 CI/CD 流水线中。

Stars: 2646 | Forks: 412

[![Github 发布版本](https://img.shields.io/badge/release-V1.0-blue.svg)](https://github.com/flipkart-incubator/Astra) [![Github 发布版本](https://img.shields.io/badge/python-2.7-blue.svg)](https://github.com/flipkart-incubator/Astra) [![BH 2018 USA](https://img.shields.io/badge/Black%20Hat%20Arsenal-USA%202018-blue.svg)](https://www.blackhat.com/us-18/arsenal/schedule/index.html#astra-automated-security-testing-for-rest-apis-11976) [![BH 2018 Europe](https://img.shields.io/badge/Black%20Hat%20Arsenal-Europe%202018-blue.svg)](https://www.blackhat.com/eu-18/arsenal/schedule/index.html#astra-automated-security-testing-for-rest-apis-13353) ## Astra ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/824032d574062545.png) 由于现有 API 的不断更改以及新增 API,REST API 渗透测试变得十分复杂。安全工程师或开发人员可以将 Astra 作为其流程中不可或缺的一部分,以便在开发周期早期发现并修补漏洞。Astra 能够自动检测并测试登录和注销(身份验证 API),因此任何人都可以轻松地将其集成到 CICD 流水线中。Astra 可以将 API 集合作为输入,因此也可用于在独立模式下测试 API。 - SQL 注入 - 跨站脚本攻击 - 信息泄露 - 身份验证和会话管理失效 - CSRF(包括 Blind CSRF) - 速率限制 - CORS 配置错误(包括 CORS 绕过技术) - JWT 攻击 - CRLF 检测 - Blind XXE 注入 - 服务端请求伪造 - 模板注入 ## 路线图 [https://www.astra-security.info/roadmap/](https://www.astra-security.info/roadmap/) ## 环境要求 - Linux 或 MacOS - Python 3.7+ - mongoDB - Celery - RabbitMQ ## 安装 ``` $ git clone https://github.com/flipkart-incubator/Astra $ cd Astra $ sudo pip install -r requirements.txt $ sudo rabbitmq-server $ celery -A worker -loglevel=INFO $ cd API $ python3 api.py ``` ## Docker 安装 ### 运行 Mongo 容器: ``` $ docker pull mongo $ docker run --name astra-mongo -d mongo ``` ### 安装 GUI Docker: ``` $ git clone https://github.com/flipkart-incubator/Astra.git $ cd Astra $ docker build -t astra . $ docker run --rm -it --link astra-mongo:mongo -p 8094:8094 astra ``` ### 安装 CLI Docker: ``` $ git clone -b docker-cli https://github.com/flipkart-incubator/Astra.git $ cd Astra $ docker build -t astra-cli . $ docker run --rm -it --link astra-mongo:mongo astra-cli ``` ## 依赖 ``` - requests - logger - pymongo - ConfigParser - pyjwt - flask - sqlmap - celery ``` ## 文档 [https://www.astra-security.info](https://www.astra-security.info) ## 用法:CLI ``` $ python astra.py --help _ /\ | | / \ ___| |_ _ __ __ _ / /\ \ / __| __| '__/ _` | / ____ \__ \ |_| | | (_| | /_/ \_\___/\__|_| \__,_| usage: astra.py [-h] [-c {Postman,Swagger}] [-n COLLECTION_NAME] [-u URL] [-headers HEADERS] [-method {GET,POST}] [-b BODY] [-l LOGINURL] [-H LOGINHEADERS] [-d LOGINDATA] REST API Security testing Framework optional arguments: -h, --help show this help message and exit -c {Postman,Swagger}, --collection_type {Postman,Swagger} Type of API collection -n COLLECTION_NAME, --collection_name COLLECTION_NAME Type of API collection -u URL, --url URL URL of target API -headers HEADERS, --headers HEADERS Custom headers.Example: {"token" : "123"} -method {GET,POST}, --method {GET,POST} HTTP request method -b BODY, --body BODY Request body of API -l LOGINURL, --loginurl LOGINURL URL of login API -H LOGINHEADERS, --loginheaders LOGINHEADERS Headers should be in a dictionary format. Example: {"accesstoken" : "axzvbqdadf"} -d LOGINDATA, --logindata LOGINDATA login data of API ``` ## 用法:Web 界面 运行 api.py 并通过 http://127.0.0.1:8094 访问 Web 界面 ``` $ cd API $ python api.py ``` 注意: 在 macOS 10.13+ 上,您必须使用标志 `OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES`,以防止扫描进程由于 `fork()` 和 `exec()` 的更改方式而被终止。有关更多信息,请参见[此处](http://www.sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html)。 ``` $ cd API $ OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES python api.py ``` ## 截图 ### 新建扫描 ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/11e556420b062546.png) ### 扫描报告 ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/65ed7fd244062547.png) ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/fde6bc0681062548.png) ### 详细报告 ![替代文本](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/93433de6a7062550.png) ## 首席开发者 - Sagar Popat (@popat_sagar) ## 贡献者 - Ankur Bhargava - Harsh Grover - Flipkart 安全团队 - Pardeep Battu - Rajasekar
标签:API 漏洞检测, Celery, CI/CD 集成, CISA项目, CORS 错误配置, CRLF 注入, CSRF, DAST, DevSecOps, Java RMI, JWT 攻击, LNA, MongoDB, Python, RabbitMQ, REST API 安全测试, SQL 注入, SSRF, Web 安全, XXE 注入, 上游代理, 信息泄露, 加密, 安全监控, 恶意软件分析, 无后门, 模板注入, 漏洞扫描器, 自动化渗透测试, 请求拦截, 跨站脚本攻击 (XSS), 身份验证绕过, 逆向工具, 黑盒测试