Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
dnsmonster — 수동 DNS 캡처 및 모니터링 툴킷 | Kitploit
도구/GitHubGitHub/fenkohq/dnsmonster
Packet Sniffing & AnalysisInformation GatheringNetwork SecurityThreat IntelligenceDNS AnalysisLog Analysis
GitHubfenkohq/dnsmonster

dnsmonster

수동 DNS 캡처 및 모니터링 툴킷

저장소 보기
3606067일 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
웹사이트
공유

빌드 상태 Go 버전 최신 버전 라이선스 열린 이슈

dnsmonster를 위한 관리형 SaaS 솔루션을 탐색 중입니다! 피드백과 요구 사항을 공유하여 패시브 DNS 모니터링의 미래를 함께 만들어 주세요: 간단한 설문 조사 참여

목차

  • Dnsmonster
  • 주요 기능
  • 설치
    • Linux
      • 컨테이너
      • 수동 빌드
      • 정적 빌드
    • Windows
    • FreeBSD 및 MacOS
  • 아키텍처
    • Docker를 사용한 올인원 설치
      • 올인원 데모
    • 엔터프라이즈 배포
  • 설정
    • 명령줄 옵션
    • 환경 변수
    • 설정 파일
    • 보존 정책은 무엇인가요?
  • 샘플링 및 스킵
    • 전처리 샘플링
    • 도메인 스킵
    • 도메인 허용
    • Clickhouse SELECT 쿼리의 SAMPLE
  • 지원되는 입력
  • 지원되는 출력
  • 로드맵
  • 관련 프로젝트

Dnsmonster

Golang 기반의 패시브 DNS 모니터링 프레임워크입니다. dnsmonster는 DNS 트래픽을 위한 패킷 스니퍼를 구현합니다. pcap 파일, 라이브 인터페이스 또는 dnstap 소켓에서 트래픽을 수락할 수 있으며, 일반 컴퓨터에서 초당 20만 개 이상의 DNS 쿼리를 인덱싱할 수 있는 것으로 입증된 바와 같이 초당 수십만 개의 DNS 쿼리를 인덱싱하고 저장하는 데 사용할 수 있습니다. 확장 가능하고 단순하며 사용하기 쉽도록 설계되어 보안 팀이 기업의 DNS 트래픽에 대한 세부 사항을 이해하는 데 도움을 줍니다. dnsmonster는 DNS 대화를 추적하지 않고, 들어오는 대로 DNS 패킷을 인덱싱하는 것을 목표로 합니다. 또한 최종 사용자의 프라이버시를 침해하지 않도록 설계되어, 레이어 3 IP(IPv4 및 IPv6)를 마스킹할 수 있어 팀이 개별 사용자에게 쿼리를 추적하지 않고 집계된 데이터에 대한 추세 분석을 수행할 수 있습니다. 블로그 게시물

1.x 이전 버전의 코드는 베타 품질로 간주되며 변경 사항이 있을 수 있습니다. 각 릴리스 간의 주요 변경 사항 목록과 잠재적 데이터 손실을 완화하는 방법을 확인하려면 각 태그의 릴리스 노트를 참조하십시오.```mermaid graph TD subgraph Input B1["network input"] B2["pcap file"] B3["dnstap socket"] end

root@kitploit:~
subgraph "Process"
    C1["Sampling based of ratio"]
    C2["Packet Process"]
    C3["Dispatcher"]
    O11["Output1"]
    O12["Domain Skip (optional)"]
    O13["Domain Allow (optional)"]
    O21["Output2"]
    O22["Domain Skip (optional)"]
    O23["Domain Allow (optional)"]
    O31["Output3"]
    O32["Domain Skip (optional)"]
    O33["Domain Allow (optional)"]
end

B1 --> Process
B2 --> Process
B3 --> Process

C1 --> C2
C2 --> C3
C3 --> O11
C3 --> O21
C3 --> O31

O11 --> O12 --> O13
O21 --> O22 --> O23
O31 --> O32 --> O33

subgraph Output
    Splunk
    Syslog
    H["ClickHouse"]
    Postgres
    Kafka
    I["JSON File"]
    Influx
    Elastic
    J["stdout"]
    Parquet
    Sentinel
end

O13 --> H
O23 --> I
O33 --> J
root@kitploit:~
# 주요 기능

- 리눅스의 `afpacket` 및 제로 카피 패킷 캡처 사용 기능.
- BPF 지원
- 개인정보 보호 강화를 위한 IP 주소 마스킹 기능
- 전처리 샘플링 비율 설정 기능
- 특정 도메인/접미사/접두사를 스토리지에 기록하지 않도록 '건너뛰기' `fqdn` 목록을 가질 수 있는 기능
- 특정 도메인에 대한 액세스를 기록하는 데 사용되는 '허용' 도메인 목록을 가질 수 있는 기능
- 건너뛰기 및 허용 도메인 파일/URL의 핫 리로드
- 출력 스트림별로 구성 가능한 로직을 갖춘 모듈식 출력.
- ClickHouse의 TTL 속성을 사용한 자동 데이터 보존 정책
- ClickHouse 출력용 내장 Grafana 대시보드.
- 단일 정적으로 링크된 바이너리로 배포 가능
- 환경 변수, 명령줄 옵션 또는 구성 파일을 사용하여 구성 가능
- ClickHouse의 SAMPLE 기능을 사용하여 출력 샘플링 가능
- `prometheus` 및 `statstd`를 사용하여 메트릭 전송 가능
- ClickHouse의 내장 LZ4 스토리지 덕분에 높은 압축률
- DNS Over TCP, 조각화된 DNS(udp/tcp) 및 IPv6 지원
- Unix 소켓 또는 TCP를 통한 [dnstap](https://github.com/dnstap/golang-dnstap) 지원
- Splunk 및 Microsoft Sentinel과의 내장 SIEM 통합

# 설치

## Linux

`dnsmonster`를 시작하는 가장 좋은 방법은 릴리스 섹션에서 바이너리를 다운로드하는 것입니다. 바이너리는 `musl`에 대해 정적으로 빌드되었으므로 대부분의 배포판에서 즉시 작동합니다. `afpacket` 지원을 위해서는 커널 3.x+를 사용해야 합니다. 최신 Linux 배포판(CentOS/RHEL 7+, Ubuntu 14.0.4.2+, Debian 7+)은 3.x+ 버전과 함께 제공되므로 즉시 작동합니다. 배포판이 사전 컴파일된 버전에서 작동하지 않는 경우, 세부 정보와 함께 이슈를 제출하고 이 섹션 [수동 빌드](#build-manually)를 사용하여 `dnsmonster`를 수동으로 빌드하세요.

### 컨테이너

`dnsmonster`는 원시 패킷 캡처 기능을 사용하므로 Docker/Podman 데몬은 컨테이너에 해당 기능을 부여해야 합니다.```
sudo docker run --rm -it --net=host --cap-add NET_RAW --cap-add NET_ADMIN --name dnsmonster ghcr.io/mosajjal/dnsmonster:latest --devName lo --stdoutOutputType=1

수동으로 빌드하기

  • libpcap 사용 시: go, libpcap-devel, linux-headers 패키지가 설치되어 있는지 확인하세요. 패키지 이름은 사용 중인 배포판에 따라 다를 수 있습니다. 그런 다음 저장소를 클론하고 go build ./cmd/dnsmonster를 실행하기만 하면 됩니다.```sh git clone https://github.com/mosajjal/dnsmonster --depth 1 /tmp/dnsmonster cd /tmp/dnsmonster go get go build -o dnsmonster ./cmd/dnsmonster
root@kitploit:~
- `libpcap` 없이:
`dnsmonster`는 `libpcap`에서 한 가지 함수만 사용하는데, 그것은 `tcpdump` 스타일 필터를 BPF 바이트코드로 변환하는 것입니다. BPF 지원 없이도 괜찮다면 `libpcap` 없이 `dnsmonster`를 빌드할 수 있습니다. 다른 모든 플랫폼에서는 패킷 캡처가 `libpcap`으로 대체되므로 하드 종속성이 됩니다. (*BSD, Windows, Darwin)```sh
git clone https://github.com/mosajjal/dnsmonster --depth 1 /tmp/dnsmonster 
cd /tmp/dnsmonster
go get
go build -o dnsmonster -tags nolibpcap ./cmd/dnsmonster

위 빌드는 ARMv7 (RPi4) 및 AArch64에서도 작동합니다.

정적 빌드

libpcap.a 사본이 있다면, 이를 dnsmonster에 정적으로 링크하여 완전히 정적으로 빌드할 수 있습니다. 아래 코드에서 /root/libpcap-1.9.1/libpcap.a를 사용자의 사본 위치로 변경하십시오.``` git clone https://github.com/mosajjal/dnsmonster --depth 1 /tmp/dnsmonster cd /tmp/dnsmonster/ go get go build --ldflags "-L /root/libpcap-1.9.1/libpcap.a -linkmode external -extldflags "-I/usr/include/libnl3 -lnl-genl-3 -lnl-3 -static"" -a -o dnsmonster ./cmd/dnsmonster

root@kitploit:~
정적으로 링크된 바이너리가 어떻게 만들어지는지에 대한 자세한 내용은 [이](https://github.com/fenkohq/dnsmonster/blob/main/Dockerfile) Dockerfile을 참조하세요.

## Windows

Windows에서 빌드하는 것은 Linux와 거의 동일합니다. `npcap`이 설치되어 있는지 확인하기만 하면 됩니다. 저장소를 클론하고 (`--history 1` 작동), `go get`과 `go build ./cmd/dnsmonster`를 실행하세요.

앞서 언급했듯이, Windows용 바이너리 릴리스는 [npcap](https://nmap.org/npcap/#download)이 설치되어 있어야 합니다. 설치 후 바이너리는 별도의 설정 없이 작동합니다. Windows 10 환경에서 테스트되었으며 문제 없이 실행되었습니다. `--devName` 매개변수에 제공할 인터페이스 이름을 찾고 스니핑을 시작하려면 다음을 수행해야 합니다:

  - 관리자 권한으로 cmd.exe를 열고 다음을 실행하세요: `getmac.exe`, 그러면 인터페이스의 MAC 주소와 Transport Name 열이 있는 테이블이 표시됩니다. 예: `\Device\Tcpip_{16000000-0000-0000-0000-145C4638064C}`
  - `cmd.exe`에서 `dnsmonster.exe`를 다음과 같이 실행하세요:```sh
dnsmonster.exe --devName \Device\NPF_{16000000-0000-0000-0000-145C4638064C}

참고로 getmac.exe에서 \Tcpip를 \NPF로 변경한 후 dnsmonster.exe에 전달해야 합니다.

FreeBSD 및 MacOS

Linux 및 Windows와 거의 동일하며, git, libpcap 및 go가 설치되어 있는지 확인한 후 동일한 지침을 따릅니다:```sh git clone https://github.com/mosajjal/dnsmonster --depth 1 /tmp/dnsmonster cd /tmp/dnsmonster go get go build -o dnsmonster ./cmd/dnsmonster

root@kitploit:~
# 아키텍처

## Docker를 사용한 올인원 설치

![기본 AIO 다이어그램](https://raw.githubusercontent.com/fenkohq/dnsmonster/HEAD/static/dnsmonster-basic.svg)

예제 다이어그램에서 DNS 서버 트래픽의 송신/수신을 캡처한 후, DNSMonster 서버에 도달하기 전에 선택적 패킷 집계 계층이 추가됩니다. DNS 서버에서 나가는 아웃바운드 데이터는 DNS 팜의 캐시 및 성능 분석을 수행하는 데 매우 유용합니다. 집계기를 사용할 수 없는 경우, 두 TAP을 DNSMonster에 직접 연결하고 두 개의 DNSMonster 에이전트가 트래픽을 감시하도록 할 수 있습니다.

`./autobuild.sh`를 실행하면 여러 컨테이너가 생성됩니다:

* `dnsmonster`의 여러 인스턴스가 모든 인터페이스에서 트래픽을 감시합니다. 인터페이스 목록은 `autobuild.sh` 실행 중에 입력하라는 메시지가 표시됩니다.
* `clickhouse` 인스턴스가 `dnsmonster`의 출력을 수집하고 모든 로그/데이터를 데이터 및 로그 디렉토리에 저장합니다. 두 디렉토리는 `autobuild.sh` 실행 중에 입력하라는 메시지가 표시됩니다.
* `grafana` 인스턴스가 `clickhouse` 데이터를 조회하고 미리 구축된 대시보드를 제공합니다.

### 올인원 데모

[![AIO 데모](https://raw.githubusercontent.com/fenkohq/dnsmonster/HEAD/static/aio_demo.svg)](static/aio_demo.svg)

## 엔터프라이즈 배포

![기본 AIO 다이어그램](https://raw.githubusercontent.com/fenkohq/dnsmonster/HEAD/static/dnsmonster-enterprise.svg)

# 구성

DNSMonster는 세 가지 방법으로 구성할 수 있습니다. 명령줄 옵션, 환경 변수 및 구성 파일입니다. 우선순위 순서:

- 명령줄 옵션 (대소문자 구분 안 함)
- 환경 변수 (항상 대문자)
- 구성 파일 (대소문자 구분, 소문자)
- 기본값 (구성 없음)

## 명령줄 옵션

명령줄 인수는 v0.9.5부터 대소문자를 구분하지 않습니다.

[//]: <> (명령줄 옵션 시작 부분)```sh
# [capture]
# Device used to capture
--devname=

# Pcap filename to run
--pcapfile=

# dnstap socket path. Example: unix:///tmp/dnstap.sock, tcp://127.0.0.1:8080
--dnstapsocket=

# Port selected to filter packets
--port=53

# Capture Sampling by a:b. eg sampleRatio of 1:100 will process 1 percent of the incoming packets
--sampleratio=1:1

# Cleans up packet hash table used for deduplication
--dedupcleanupinterval=1m0s

# Set the dnstap socket permission, only applicable when unix:// is used
--dnstappermission=755

# Number of routines used to handle received packets
--packethandlercount=2

# Size of the tcp assembler
--tcpassemblychannelsize=10000

# Size of the tcp result channel
--tcpresultchannelsize=10000

# Number of routines used to handle tcp packets
--tcphandlercount=1

# Size of the channel to send packets to be defragged
--defraggerchannelsize=10000

# Size of the channel where the defragged packets are returned
--defraggerchannelreturnsize=10000

# Size of the packet handler channel
--packetchannelsize=1000

# Afpacket Buffersize in MB
--afpacketbuffersizemb=64

# BPF filter applied to the packet stream. If port is selected, the packets will not be defragged.
--filter=((ip and (ip[9] == 6 or ip[9] == 17)) or (ip6 and (ip6[6] == 17 or ip6[6] == 6 or ip6[6] == 44)))

# Use AFPacket for live captures. Supported on Linux 3.0+ only
--useafpacket

# The PCAP capture does not contain ethernet frames
--noetherframe

# Deduplicate incoming packets, Only supported with --devName and --pcapFile. Experimental 
--dedup

# Do not put the interface in promiscuous mode
--nopromiscuous

# [clickhouse_output]
# Address of the clickhouse database to save the results. multiple values can be provided.
--clickhouseaddress=localhost:9000

# Username to connect to the clickhouse database
--clickhouseusername=

# Password to connect to the clickhouse database
--clickhousepassword=

# Database to connect to the clickhouse database
--clickhousedatabase=default

# Table which data will be stored on clickhouse database
--clickhousetable=DNS_LOG

# Interval between sending results to ClickHouse. If non-0, Batch size is ignored and batch delay is used
--clickhousedelay=0s

# Clickhouse connection LZ4 compression level, 0 means no compression
--clickhousecompress=0

# Debug Clickhouse connection
--clickhousedebug

# Use TLS for Clickhouse connection
--clickhousesecure

# Save full packet query and response in JSON format.
--clickhousesavefullquery

# Use DNSTap identity field instead of ServerName for the identity field in ClickHouse
--clickhouseusednstapidentity

# What should be written to clickhouse. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--clickhouseoutputtype=0

# Minimum capacity of the cache array used to send data to clickhouse. Set close to the queries per second received to prevent allocations
--clickhousebatchsize=100000

# Number of Clickhouse output Workers
--clickhouseworkers=1

# Channel Size for each Clickhouse Worker
--clickhouseworkerchannelsize=100000

# [elastic_output]
# What should be written to elastic. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--elasticoutputtype=0

# elastic endpoint address, example: http://127.0.0.1:9200. Used if elasticOutputType is not none
--elasticoutputendpoint=

# elastic index
--elasticoutputindex=default

# Send data to Elastic in batch sizes
--elasticbatchsize=1000

# Interval between sending results to Elastic if Batch size is not filled
--elasticbatchdelay=1s

# [file_output]
# What should be written to file. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--fileoutputtype=0

# Path to output folder. Used if fileoutputType is not none
--fileoutputpath=

# Interval to rotate the file in cron format
--fileoutputrotatecron=0 0 * * *

# Number of files to keep. 0 to disable rotation
--fileoutputrotatecount=4

# Output format for file. options:json, csv, csv_no_header, gotemplate. note that the csv splits the datetime format into multiple fields
--fileoutputformat=json

# Go Template to format the output as needed
--fileoutputgotemplate={{.}}

# [influx_output]
# What should be written to influx. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--influxoutputtype=0

# influx Server address, example: http://localhost:8086. Used if influxOutputType is not none
--influxoutputserver=

# Influx Server Auth Token
--influxoutputtoken=dnsmonster

# Influx Server Bucket
--influxoutputbucket=dnsmonster

# Influx Server Org
--influxoutputorg=dnsmonster

# Minimum capacity of the cache array used to send data to Influx
--influxoutputworkers=8

# Minimum capacity of the cache array used to send data to Influx
--influxbatchsize=1000

# [kafka_output]
# What should be written to kafka. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--kafkaoutputtype=0

# kafka broker address(es), example: 127.0.0.1:9092. Used if kafkaOutputType is not none
--kafkaoutputbroker=

# Kafka topic for logging
--kafkaoutputtopic=dnsmonster

# Minimum capacity of the cache array used to send data to Kafka
--kafkabatchsize=1000

# Output format. options:json, gob. 
--kafkaoutputformat=json

# Kafka connection timeout in seconds
--kafkatimeout=3

# Interval between sending results to Kafka if Batch size is not filled
--kafkabatchdelay=1s

# Compress Kafka connection
--kafkacompress

# Compression Type Kafka connection [snappy gzip lz4 zstd]; default(snappy).
--kafkacompressiontype=snappy

# Use TLS for kafka connection
--kafkasecure

# Path of CA certificate that signs Kafka broker certificate
--kafkacacertificatepath=

# Path of TLS certificate to present to broker
--kafkatlscertificatepath=

# Path of TLS certificate key
--kafkatlskeypath=

# [parquet_output]
# What should be written to parquet file. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--parquetoutputtype=0

# Path to output folder. Used if parquetoutputtype is not none
--parquetoutputpath=

# Number of records to write to parquet file before flushing
--parquetflushbatchsize=10000

# Number of workers to write to parquet file
--parquetworkercount=4

# Size of the write buffer in bytes
--parquetwritebuffersize=256000

# [psql_output]
# What should be written to Microsoft Psql. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--psqloutputtype=0

# Psql endpoint used. must be in uri format. example: postgres://username:password@hostname:port/database?sslmode=disable
--psqlendpoint=

# Psql table which data will be stored on database
--psqltable=DNS_LOG

# Number of PSQL workers
--psqlworkers=1

# Psql Batch Size
--psqlbatchsize=1

# Interval between sending results to Psql if Batch size is not filled. Any value larger than zero takes precedence over Batch Size
--psqlbatchdelay=0s

# Timeout for any INSERT operation before we consider them failed
--psqlbatchtimeout=5s

# Save full packet query and response in JSON format.
--psqlsavefullquery

# [sentinel_output]
# What should be written to Microsoft Sentinel. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--sentineloutputtype=0

# Sentinel Shared Key, either the primary or secondary, can be found in Agents Management page under Log Analytics workspace
--sentineloutputsharedkey=

# Sentinel Customer Id. can be found in Agents Management page under Log Analytics workspace
--sentineloutputcustomerid=

# Sentinel Output LogType
--sentineloutputlogtype=dnsmonster

# Sentinel Output Proxy in URI format
--sentineloutputproxy=

# Sentinel Batch Size
--sentinelbatchsize=100

# Interval between sending results to Sentinel if Batch size is not filled. Any value larger than zero takes precedence over Batch Size
--sentinelbatchdelay=0s

# [splunk_output]
# What should be written to HEC. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--splunkoutputtype=0

# splunk endpoint address, example: http://127.0.0.1:8088. Used if splunkOutputType is not none, can be specified multiple times for load balanace and HA
--splunkoutputendpoint=

# Splunk HEC Token
--splunkoutputtoken=00000000-0000-0000-0000-000000000000

# Splunk Output Index
--splunkoutputindex=temp

# Splunk Output Proxy in URI format
--splunkoutputproxy=

# Splunk Output Source
--splunkoutputsource=dnsmonster

# Splunk Output Sourcetype
--splunkoutputsourcetype=json

# Send data to HEC in batch sizes
--splunkbatchsize=1000

# Interval between sending results to HEC if Batch size is not filled
--splunkbatchdelay=1s

# [stdout_output]
# What should be written to stdout. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--stdoutoutputtype=0

# Output format for stdout. options:json,csv, csv_no_header, gotemplate. note that the csv splits the datetime format into multiple fields
--stdoutoutputformat=json

# Go Template to format the output as needed
--stdoutoutputgotemplate={{.}}

# Number of workers
--stdoutoutputworkercount=8

# [syslog_output]
# What should be written to Syslog server. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--syslogoutputtype=0

# Syslog endpoint address, example: udp://127.0.0.1:514, tcp://127.0.0.1:514. Used if syslogOutputType is not none
--syslogoutputendpoint=udp://127.0.0.1:514

# [victoria_output]
# Victoria Output Endpoint. example: http://localhost:9428/insert/jsonline?_msg_field=rcode_id&_time_field=time
--victoriaoutputendpoint=

# What should be written to Microsoft Victoria. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--victoriaoutputtype=0

# Victoria Output Proxy in URI format
--victoriaoutputproxy=

# Number of workers
--victoriaoutputworkers=8

# Victoria Batch Size
--victoriabatchsize=100

# Interval between sending results to Victoria if Batch size is not filled. Any value larger than zero takes precedence over Batch Size
--victoriabatchdelay=0s

# [zinc_output]
# What should be written to zinc. options:
#	0: Disable Output
#	1: Enable Output without any filters
#	2: Enable Output and apply skipdomains logic
#	3: Enable Output and apply allowdomains logic
#	4: Enable Output and apply both skip and allow domains logic
--zincoutputtype=0

# index used to save data in Zinc
--zincoutputindex=dnsmonster

# zinc endpoint address, example: http://127.0.0.1:9200/api/default/_bulk. Used if zincOutputType is not none
--zincoutputendpoint=

# zinc username, example: [email protected]. Used if zincOutputType is not none
--zincoutputusername=

# zinc password, example: password. Used if zincOutputType is not none
--zincoutputpassword=

# Send data to Zinc in batch sizes
--zincbatchsize=1000

# Interval between sending results to Zinc if Batch size is not filled
--zincbatchdelay=1s

# Zing request timeout
--zinctimeout=10s

# [general]
# Garbage Collection interval for tcp assembly and ip defragmentation
--gctime=10s

# Duration to calculate interface stats
--capturestatsdelay=1s

# Mask IPv4s by bits. 32 means all the bits of IP is saved in DB
--masksize4=32

# Mask IPv6s by bits. 32 means all the bits of IP is saved in DB
--masksize6=128

# Name of the server used to index the metrics.
--servername=default

# Set debug Log format
--logformat=text

# Set debug Log level, 0:PANIC, 1:ERROR, 2:WARN, 3:INFO, 4:DEBUG
--loglevel=3

# Size of the result processor channel size
--resultchannelsize=100000

# write cpu profile to file
--cpuprofile=

# write memory profile to file
--memprofile=

# GOMAXPROCS variable
--gomaxprocs=-1

# Limit of packets logged to clickhouse every iteration. Default 0 (disabled)
--packetlimit=0

# Skip outputing domains matching items in the CSV file path. Can accept a URL (http:// or https://) or path
--skipdomainsfile=

# Hot-Reload skipdomainsfile interval
--skipdomainsrefreshinterval=1m0s

# Allow Domains logic input file. Can accept a URL (http:// or https://) or path
--allowdomainsfile=

# Hot-Reload allowdomainsfile file interval
--allowdomainsrefreshinterval=1m0s

# Skip TLS verification when making HTTPS connections
--skiptlsverification

# [metric]
# Metric Endpoint Service
--metricendpointtype=

# Statsd endpoint. Example: 127.0.0.1:8125 
--metricstatsdagent=

# Prometheus Registry endpoint. Example: http://0.0.0.0:2112/metric
--metricprometheusendpoint=

# Format for  output.
--metricformat=json

# Interval between sending results to Metric Endpoint
--metricflushinterval=10s

환경 변수

모든 플래그는 환경 변수를 통해 설정할 수도 있습니다. 각 매개변수의 이름은 항상 대문자이며, 모든 변수의 접두사는 "DNSMONSTER"입니다.

예시:```shell $ export DNSMONSTER_PORT=53 $ export DNSMONSTER_DEVNAME=lo $ sudo -E dnsmonster

root@kitploit:~
## 구성 파일
다음 명령어를 사용하여 구성 파일을 통해 `dnsmonster`를 실행할 수 있습니다:```shell
$ sudo dnsmonster --config=dnsmonster.ini

# Or you can use environment variables to set the configuration file path
$ export DNSMONSTER_CONFIG=dnsmonster.ini
$ sudo -E dnsmonster

보존 정책이란 무엇인가요?

ClickHouse 테이블의 기본 보존 정책은 30일로 설정되어 있습니다. ./autobuild.sh를 사용하여 컨테이너를 빌드함으로써 이 기간을 변경할 수 있습니다. ClickHouse에는 내부 타임스탬프가 없기 때문에 TTL은 pcap 파일의 수신 패킷 날짜를 기준으로 합니다. 따라서 오래된 pcap 파일을 가져오는 동안 ClickHouse는 데이터가 기록될 때 자동으로 데이터를 제거하기 시작할 수 있으며, Grafana에서 실제 데이터를 볼 수 없게 됩니다. 이를 해결하려면 TTL을 PCAP 파일 내 가장 오래된 패킷보다 하루 더 이전 날짜로 변경하면 됩니다.

참고: 언제든지 TTL을 변경하려면 clickhouse 클라이언트를 사용하여 Clickhouse 서버에 직접 연결하고 다음 SQL 문을 실행해야 합니다 (이 예제는 30일에서 90일로 변경합니다):```sql ALTER TABLE DNS_LOG MODIFY TTL DnsDate + INTERVAL 90 DAY;`

root@kitploit:~
참고: 위 명령은 원시 DNS 로그 데이터의 TTL만 변경하며, 이는 대부분의 용량 소비를 차지합니다. 모든 집계 테이블에 대해 TTL을 조정하려면 다음을 실행하면 됩니다.```sql
ALTER TABLE DNS_LOG MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_DOMAIN_COUNT` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_DOMAIN_UNIQUE` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_PROTOCOL` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_GENERAL_AGGREGATIONS` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_EDNS` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_OPCODE` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_TYPE` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_CLASS` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_RESPONSECODE` MODIFY TTL DnsDate + INTERVAL 90 DAY;
ALTER TABLE `.inner.DNS_SRCIP_MASK` MODIFY TTL DnsDate + INTERVAL 90 DAY;

UPDATE: 최신 버전의 clickhouse에서는 .inner 테이블이 해당 집계 뷰와 동일한 이름을 가지지 않습니다. TTL을 수정하려면 SHOW TABLES를 사용하여 UUID 형식의 테이블 이름을 찾고, 해당 UUID로 ALTER 명령을 반복해야 합니다.

샘플링 및 건너뛰기

사전 처리 샘플링

dnsmonster는 간단한 매개변수 sampleRatio를 사용하여 패킷의 사전 처리 샘플링을 지원합니다. 이 매개변수는 1:2와 같은 "비율" 값을 허용합니다. 1:2는 도착하는 2개 패킷당 1개만 처리한다는 의미입니다(50% 샘플링). 이 샘플링은 bpf 필터 이후에 발생하며 그 이전이 아닙니다. DNS 트래픽 양을 따라잡는 데 문제가 있다면 2:10과 같이 설정하여 bpf 필터를 통과하는 패킷 중 20%만 dnsmonster에서 처리하도록 할 수 있습니다.

도메인 건너뛰기

dnsmonster는 반복적이고 잡음이 많은 데이터를 데이터베이스에 기록하지 않도록 사후 처리 도메인 건너뛰기 목록을 지원합니다. 도메인 건너뛰기 목록은 CSV 형식의 파일로, 두 개의 열만 있습니다: 문자열과 해당 문자열에 대한 논리(logic)입니다. dnsmonster는 세 가지 논리를 지원합니다: prefix, suffix, fqdn입니다. prefix와 suffix는 문자열로 시작하거나 끝나는 도메인만 데이터베이스에 기록되지 않도록 건너뛴다는 의미입니다. 이 과정이 DNS 질문에 대해 수행되므로, 문자열에 대부분 후행 .이 포함되어 있으며 이는 건너뛰기 목록 행에도 포함되어야 합니다(더 나은 이해를 위해 skipdomains.csv.sample을 참조하세요). 또한 전체 FQDN 일치를 지정하여 매우 잡음이 많은 FQDN이 데이터베이스에 기록되는 것을 방지할 수 있습니다.

도메인 허용

dnsmonster는 allowdomains의 개념을 가지고 있습니다. 이는 DNS 트래픽에 특정 FQDN, 접두사 또는 접미사가 있는지 감지하는 데 도움이 됩니다. dnsmonster가 각 출력 스트림에 대해 다른 로직을 가진 여러 출력 스트림을 지원한다는 점을 감안할 때, 동일한 dnsmonster 인스턴스에서 모든 DNS 트래픽을 ClickHouse에 수집하면서도 허용 목록에 있는 도메인만 stdout 또는 파일로 수집할 수 있습니다.

clickhouse SELECT 쿼리에서의 SAMPLE

기본적으로 tables.sql 파일(DNS_LOG)에서 생성된 기본 테이블은 각 DNS 질문에 반고유 UUID가 연결되어 있기 때문에 필요에 따라 결과를 다운샘플링할 수 있는 기능이 있습니다. Clickhouse의 SAMPLE 쿼리에 대한 자세한 내용은 이 문서를 참조하세요.

지원되는 입력

  • libpcap/ncap을 통한 실시간 캡처 (이더넷 및 raw IP 지원)
  • afpacket을 통한 실시간 캡처 (이더넷 및 raw IP 지원)
  • Dnstap 소켓 (리스닝 모드)
  • Pcap 파일 (이더넷 프레임)

참고: pcap 파일이 Linux 메타 인터페이스(예: tcpdump -i any)로 캡처된 경우, dnsmonster는 존재하지 않는 이더넷 프레임을 읽을 수 없습니다. tcprewrite와 같은 도구를 사용하여 pcap 파일을 이더넷 형식으로 변환할 수 있습니다.

지원되는 출력

  • ClickHouse
  • Kafka
  • Elasticsearch
  • Splunk HEC
  • Stdout
  • File
  • Syslog (Linux 전용)
  • Microsoft Sentinel
  • InfluxDB

로드맵

  • SELECT 쿼리를 위한 다운샘플링 기능
  • afpacket 지원 추가
  • 설정 파일 옵션
  • FQDN 인덱싱 제외
  • 특정 도메인만 기록하는 FQDN 화이트리스트
  • dnstap 지원
  • Kafka 출력 지원
  • HTTP(S) 엔드포인트에서 allowDomains 및 skipDomains 로드 기능
  • Elasticsearch 출력 지원
  • Splunk HEC 출력 지원
  • Syslog 출력 지원
  • Grafana 대시보드 성능 개선
  • 의존성 제거 및 패킷 처리를 위한 로 전환

관련 프로젝트

  • dnszeppelin
  • passivedns
  • gopassivedns
  • packetbeat

스폰서

SignPathWindows용 무료 코드 서명 제공: signpath.io, 인증서: SignPath Foundation
도구 다운로드
libpcap
pcapgo
  • ML 및 이상 탐지에 사용할 데이터 준비
  • 중복 제거 지원 (진행 중)
  • Clickhouse 선택적 SSL
  • statsd 및 Prometheus 지원
  • Splunk 대시보드
  • Kibana 대시보드
  • Clickhouse 버전 관리 및 마이그레이션 도구
  • 테스트 및 벤치마크