티스토리 뷰
Wireshark를 설치하면 mergecap 파일이 설치되어 있다.
mergecap을 통해 pcap 파일을 결합해보자.
$ mergecap -h
Mergecap 1.10.6 (v1.10.6 from master-1.10)
Merge two or more capture files into one.
See http://www.wireshark.org for more information.
Usage: mergecap [options] -w <outfile>|- <infile> [<infile> ...]
Output:
-a concatenate rather than merge files.
default is to merge based on frame timestamps.
-s <snaplen> truncate packets to <snaplen> bytes of data.
-w <outfile>|- set the output filename to <outfile> or '-' for stdout.
-F <capture type> set the output file type; default is pcapng.
an empty "-F" option will list the file types.
-T <encap type> set the output file encapsulation type;
default is the same as the first input file.
an empty "-T" option will list the encapsulation types.
Miscellaneous:
-h display this help and exit.
-v verbose output.
ex)
$mergecap -v -w result.pcap file1 file2 file3 file....
참조 : 패킷인사이드
$ mergecap -v -w output.pcap input1.pcap input2.pcap
패킷 파일 이어붙이기
기본적으로 패킷파일들이 하나로 합쳐질 때는 패킷 프레임의 시간에 기준하여 합쳐지게 된다. 이러한 방법이 아니라 끝에다 이어붙이기를 할 수도 있는데, -a 옵션을 사용하면 된다. 첫번째 입력으로 주어진 파일 뒤쪽에 두번째 주어진 패킷파일이 이어진다.
$ mergecap -v -w output.pcap input1.pcap input2.pcap -a
특정 길이로 한정해서 합치기
패킷 덤프를 할 경우에도 snaplen 길이를 정의하여 패킷의 얼마만큼을 볼 것인지 정의할 수 있었다. 합치는 경우에도 -s 로 snaplen 을 정의하여 지정된 바이트 만큼으로 패킷을 잘라낸다.
$ mergecap -v -w output.pcap input1.pcap input2.pcap -s 1000
캡슐화 타입 정의하기
합쳐질 패킷파일의 캡슐화 타입을 정의할 수 있다. -T 옵션 다음에 정의해 주면 되고, 인자값 없이 -T 만 사용하면 캡슐화로 사용가능한 목록을 살펴볼 수 있다. 기본적으로는 처음 입력으로 들어오는 패킷파일의 타입을 사용하게 된다.
$ mergecap -v -w output.pcap -T ether input1.pcap input2.pcap
캡슐화에 대해 궁금한 분들은 다음 포스팅을 참고해 보기 바란다.
"패킷을 보다 자주 접하는 캡슐화(Encapsulation)는 무엇이지?"
http://www.packetinside.com/2011/03/encapsulation.html
와이어샤크에서 제공해주는 mergecap 파일외 파이썬으로 제작된 FLAG(Forensic and Log Analysis GUI)에서 제공해주는 mergecap.py 파일을 이용해 볼 수도 있다.
http://code.google.com/p/pyflag/source/browse/utilities/mergecap.py
'Study > Network' 카테고리의 다른 글
| tshark 기본 포맷 (0) | 2014.07.02 |
|---|---|
| tshark를 통해 csv 형식으로 출력하기 (0) | 2014.04.16 |
| PCAP File Signature (0) | 2014.04.09 |
| tshark 사용하기 (2) | 2014.02.21 |
| 대용량 패킷 분석 #3 - tshark 통계 생성 (0) | 2014.02.10 |
- Total
- Today
- Yesterday
- recovery file on linux
- NX ASLR
- capinfos
- tcpdstat
- pcapng
- filesystem check
- megacli
- bash parameter
- editcap
- metasploitable3
- dvwa_bruteforce
- webhack
- dvwa
- 리눅스 버전
- docker
- text2pcap
- ${1##*.}
- mergecap
- tshark
- docker_dvwa
- bash modification
- ssl decrypt
- dvwa_command
- history timestamp
- 윈도우 패스워드 복구
- oracle 11gr2
- excel_aton
- MySQL csv
- 도커
- cisco ssh
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
