추가 출력 형식
일반 텍스트, only-* 필터, markdown-table, TOML, Postman 컬렉션 형식입니다.
일반 텍스트 (기본값)
-f 없이 실행하면 엔드포인트마다 파라미터를 함께 출력합니다. 파라미터는 요청에서 실리는 위치별로 묶입니다.
noir scan . --no-log
GET /
○ headers:
└── x-api-key
POST /query
○ cookies:
└── my_auth
○ body:
└── query
--include로 엔드포인트별 정보를 더 볼 수 있습니다. path(소스 파일과 줄 번호), techs(분석기), callee(핸들러가 호출하는 함수) 중에서 고르세요. --verbose를 쓰면 --include path(그리고 모든 태거)가 자동으로 켜집니다.
noir scan . --no-log --include path,techs
GET /
○ headers:
└── x-api-key
○ tech: crystal_kemal
○ file: ./src/testapp.cr (line 3)
only-* 형식으로 필터링
한 종류의 값만 한 줄에 하나씩 출력합니다. 다른 도구로 파이프로 넘길 때 편합니다.
URL만
쿼리 파라미터는 URL 뒤에 ?name= 형태로 붙습니다.
noir scan . -f only-url
/
/paren?kind=
/query
/token
/socket
/api/v1/users/:id
파라미터만
noir scan . -f only-param
kind
query
client_id
redirect_url
grant_type
헤더만
noir scan . -f only-header
x-api-key
Cookie
쿠키만
noir scan . -f only-cookie
my_auth
태그만
태그는 태거가 붙이므로 -T를 함께 쓰세요.
noir scan . -f only-tag -T
oauth
ssrf
websocket
idor
마크다운 테이블
noir scan . -f markdown-table
| Endpoint | Protocol | Params |
| -------- | -------- | ------ |
| `GET /` | http | `x-api-key (header)` |
| `POST /query` | http | `my_auth (cookie)` `query (form)` |
| `GET /token` | http | `client_id (form)` `redirect_url (form)` `grant_type (form)` |
| `GET /socket` | ws | - |
TOML
noir scan . -f toml
[[endpoints]]
callees = []
url = "/"
method = "GET"
internal = false
details = { code_paths = [{ path = "./src/testapp.cr", line = 3 }], technology = "crystal_kemal" }
protocol = "http"
kind = ""
tags = []
params = [{ name = "x-api-key", value = "", param_type = "header", tags = [] }]
[[endpoints]]
callees = []
url = "/query"
method = "POST"
internal = false
details = { code_paths = [{ path = "./src/testapp.cr", line = 17 }], technology = "crystal_kemal" }
protocol = "http"
kind = ""
tags = []
params = [{ name = "my_auth", value = "", param_type = "cookie", tags = [] }, { name = "query", value = "", param_type = "form", tags = [] }]
설정 파일 같은 형식이라 터미널에서 훑어보기 좋고, 프로젝트 설정에 붙여넣기도 쉽습니다. 엔드포인트 모델 전체를 담으며, --include callee와 --ai-context 플래그를 켜면 그 필드도 들어갑니다. TOML은 빈 테이블 배열을 쓸 수 없어서 passive_results와 errors는 항목이 있을 때만 나옵니다. diff 모드(--diff-path 또는 --diff-ref)에서 -f toml을 쓰면 diff 결과도 같은 형식으로 나옵니다.
JSON Lines (JSONL)
JSONL(-f jsonl)은 JSON 및 JSONL 페이지에서 JSON과 함께 다룹니다.
Postman 컬렉션
noir scan . -f postman -u https://api.example.com
Postman Collection v2.1 형식의 JSON 파일을 만듭니다. 출력을 저장해서 Postman으로 가져오면 됩니다. 컬렉션에는 -u 값으로 채운 baseUrl 변수가 들어갑니다(-u가 없으면 http://localhost). -u 없이 만들면 요청 URL이 {{baseUrl}}/path 형태라서 Postman 안에서 대상을 바꿀 수 있습니다.
요청 본문은 Noir가 기록한 파라미터 타입을 따릅니다.
json은 raw JSON 본문이 됩니다.form은urlencoded가 됩니다.file(같이 있는 form 필드 포함)은type: file인formdata가 됩니다.xml은Content-Type: application/xml인 raw 본문이 되고, Postman raw language는xml로 설정됩니다.
값이 비어 있는 xml 파라미터는 파라미터 이름을 딴 self-closing 태그가 됩니다(이름이 body이면 <body/>). 그래서 Postman raw 편집기가 비지 않고 필드가 보입니다. 이런 본문 타입이 없으면 아래 예시처럼 헤더와 URL만 있는 요청이 됩니다.
{
"info": {
"name": "Generated by Noir",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "GET api.example.com/",
"request": {
"method": "GET",
"header": [
{
"key": "x-api-key",
"value": ""
}
],
"url": {
"raw": "https://api.example.com/",
"host": ["api", "example", "com"],
"path": [],
"protocol": "https"
}
}
}
],
"variable": [
{
"key": "baseUrl",
"value": "https://api.example.com"
}
]
}