API安全测试工具Astra的使用介绍
API渗透测试工具Astra的使用介绍
Astra是2018年黑帽大会上公布的一款工具,专门用于对REST API的渗透测试。今天主要是带来它的使用介绍。
地址:
https://github.com/flipkart-incubator/Astra
看文档让我惊讶的是,Astra竟然使用的是Python2.7,那我就用docker来运行它。
首先,它依赖mango,先把mango跑起来。
$ docker pull mongo$ docker run —name astra-mongo -d mongo
然后build GUI版本的Astra
- -
- - ```
$ 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
浏览器打开 http://localhost:8094/

在URL中只能填入单个URL,效果如下:

结果页面:

Astra还有命令行模式,支持多个URL扫描,构建命令如下:
$ 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
查看可以根据下面的命令来查看各种参数的使用:
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- - ```
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
Astra可以使用postman导出的文件进行扫描,还可以设置http header之后,对指定的API就行扫描,还有就是登陆之后再扫描指定API,具体的操作方法可以参考官方文档。