BLOG main image
분류 전체보기 (17)
궁시렁 (1)
리버싱 (0)
컴쟁이의 연구실 (11)
배워보자 (2)
좋은 곳 (0)
여행 (0)
독서 (1)
idea (0)
Visitors up to today!
Today hit, Yesterday hit
daisy rss
^0^range.net
2021. 9. 11. 21:57

사내에서 소규모로 관심있는 사람 대상으로 진행된 대회다.

이런저런 아쉬움이 많이 남아서 복습을 해보았다.

 

 

pcap파일에서 HTTP에서 전달된 오브젝트 추출

wireshark기능에서 실갱이하다 못 푼 문제가 있어 찾아보았다.

결론은 HTTP 오브젝트 추출 기능 사용시 POST로 업로드된 파일에 대해서 자동으로 완벽하게 추출할 수 없다.

그러므로 Client에서 Request된 스트림 데이터만을 raw형식으로 파일 저장후,

hxd 같은 툴로 boundary 문자열 이내의 영역을 카빙해서 사용 해야겠다.

한 두개는 이렇게 하겠다만, 여러개이라면 고민해볼만한 문제인것 같다.

 

network miner 라는 툴은 자동으로 object위주로 보여주므로 병행해서 사용하면 유용할 것 같다

 

 

hash값 구하기

HashMyFiles.exe 라는 도구를 주로 이용했는데 찾아보니 윈도우 기본 명령어로도 쉽게 해쉬를 구할 수 있다.

 

certutil 이용(알고리즘 명시가 없으면 sha1이 기본)

C:\Temp>type hello.txt
hello

C:\Temp>certutil -hashfile hello.txt
SHA1의 hello.txt 해시:
f58dcba483dda1773372c0cddcc702960404308b
CertUtil: -hashfile 명령이 성공적으로 완료되었습니다.

C:\Temp>certutil -hashfile hello.txt md5
MD5의 hello.txt 해시:
6dd4566eb245627b49f3abb7e4502dd6
CertUtil: -hashfile 명령이 성공적으로 완료되었습니다.

C:\Temp>certutil -hashfile hello.txt sha256
SHA256의 hello.txt 해시:
f873eef4f852e335da367d76ce7f1973c15b8ffebf532b064df4bc691cd51a87
CertUtil: -hashfile 명령이 성공적으로 완료되었습니다.

C:\Temp>

powershell 이용

PS C:\Temp> Get-FileHash -Algorithm sha1 hello.txt

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA1            F58DCBA483DDA1773372C0CDDCC702960404308B                               C:\Temp\hello.txt


PS C:\Temp> Get-FileHash -Algorithm md5 hello.txt

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
MD5             6DD4566EB245627B49F3ABB7E4502DD6                                       C:\Temp\hello.txt


PS C:\Temp> Get-FileHash -Algorithm sha256 hello.txt

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          F873EEF4F852E335DA367D76CE7F1973C15B8FFEBF532B064DF4BC691CD51A87       C:\Temp\hello.txt

 

참고:

https://lucidmaj7.tistory.com/232

https://jdh5202.tistory.com/357

https://godsman.tistory.com/entry/%EB%8F%84%EA%B5%AC-%ED%95%B4%EC%8B%9C%EA%B0%92-%EA%B5%AC%ED%95%98%EA%B8%B0-CertUtil

 

 

파일 다운로드(wget 대체)

리눅스에서는 편하게 wget이나 curl 사용이 가능하다. 윈도우에서는 다양하고 복잡한 방법이 있다.

가장 쉬워보이는게 certutil 을 이용하는 것 같다.

 

C:\Temp>certutil -urlcache -split -f "http://seyool.tistory.com/favicon.ico" "favicon.ico"
액세스가 거부되었습니다.

근데 디펜더가 뭐라뭐라하면서 차단한다.  이건 다음에 더 알아보자.

 

 

참고:

https://newbedev.com/how-can-i-download-a-file-with-batch-file-without-using-any-external-tools

https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Windows%20-%20Download%20and%20Execute.md

https://www.netspi.com/blog/technical/network-penetration-testing/15-ways-to-download-a-file/