CTempBuffer 라는게 있어서, 검색했지만 설명이
많지가 않았다.
CTempBuffer<TCHAR, MAX_PATH> strBuffer(MAX_PATH);
strBuffer[0] = _T('\0');
DWORD length = GetCurrentDirectory(MAX_PATH, strBuffer);
if (length > MAX_PATH)
{
// We need to reallocate the string => MAX_PATH wasn't space enough.
strBuffer.Reallocate(length);
strBuffer[0] = _T('\0');
GetCurrentDirectory(length, strBuffer);
}
64bit windows, python 3.9 환경에서 설치후 java관련 에러가 발생하여 해결법을
찾아보았다.
안되서 해결방법을 공유한 블로그들이 꽤 많이 보였다.
결론은 python 3.8환경 및 JPype1-1.1.2-cp38-cp38-win_amd64.whl 설치로 해결되었다.
JDK 설치 및 JAVA_HOME환경 변수는 사전 설정하고 아래처럼 하면 된다.
(JPype1-1.1.2-cp38-cp38-win_amd64.whl 는 사전빌드된 바이너리를 받아서 D:\에 저장하였음)
D:\>conda create -n dev python=3.8 D:\>activate dev (dev) D:\>pip install JPype1-1.1.2-cp38-cp38-win_amd64.whl (dev) D:\>pip install konlpy (dev) D:\tmp>pip install tweepy==3.10.0 (dev) D:\>python Python 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from konlpy.tag import Kkma >>> k = Kkma() |
참고)
hama : 순수 python으로 작성된 한글 처리 모듈, 모듈최적화가 진행되는 듯 하다.
이화여대 네트워크 교수님 동영상
쉽고 잘 설명하셨다.
http://kocw.net/home/cview.do?cid=e44bdd9b3a3f9bb5
틈틈이 전체 강의를 들어봐야겠다.
프로토콜에 대한 자세한 설명 문서
https://courses.cs.duke.edu//fall16/compsci356/DNS/DNS-primer.pdf
구글 웹 dig
https://toolbox.googleapps.com/apps/dig/
BIND설정시 실수하는 요소에 대한 자세한 설명
https://joungkyun.gitbook.io/annyung-3-user-guide/chapter5/chapter5-2-add-domain
인터넷 이용의 기반 DNS의 이해와 DNS 보안
https://www.kisa.or.kr/uploadfile/201310/201310071959231513.pdf
간단하게 DNS패킷 캡쳐 및 파싱하는 방법 소개
https://kit2013.tistory.com/345
Dissecting DNS Responses With Scapy
; scapy DNS 파싱결과가 재귀적 구성됨, 이를 Iterating하는 방법 제시
https://www.je-clark.com/posts/dissecting-dns-responses-with-scapy
https://github.com/je-clark/ScapyDNSDissection/blob/master/dnsdissection.py
사내에서 소규모로 관심있는 사람 대상으로 진행된 대회다.
이런저런 아쉬움이 많이 남아서 복습을 해보았다.
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
파일 다운로드(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://www.netspi.com/blog/technical/network-penetration-testing/15-ways-to-download-a-file/
배경 및 문제점
타인이 개발한 MFC프로그램 소스를 받아서 추가 기능을 구현 하고 있었다.
사전에 구현된 기능을 라이브러리로 만들고 헤더파일을 포함시켜 컴파일하는데,
Parse() 함수에서 에러가 나오고, IMyRecordBase를 상속받은 모든 함수에서 에러가
발생하였다.
class IMyRecordBase
{
public:
virtual BOOL Parse(CMyStreamReader* r) = 0; <<--- 컴파일 에러
virtual void Dump() = 0;
};
1>c:\project\...\hwprecordbase.h(9) : error C2143: syntax error : missing ')' before 'constant'
1>c:\project\...\hwprecordbase.h(9) : error C2143: syntax error : missing ';' before 'constant'
1>c:\project\...\hwprecordbase.h(9) : error C2059: syntax error : ')'
1>c:\project\...\hwprecordbase.h(9) : error C2238: unexpected token(s) preceding ';'
시도한 방법
1. 헤더파일 정리(중복으로 헤더를 인클루드할까봐 헤더파일을 정리)
2. 새로 나온 VS Service Pack 찾아서 설치
3. 헤더 파일 의존성 분석(/showIncludes 옵션)
4. CMyStreamReader 클래스 이름을 다른 이름으로 바꿔서 컴파일
5. 상속받는 인터페이스 클래스를 쪼물딱 거리면서 무한 컴파일 시도
해결된 방법
6. 전처리기 결과물 분석(/P)
--> Resource.h내 "#define r 32772" 로 정의되어 있었다
--> 그래서 위 Parse함수가 "Parse(CMyStreamReader* 32772)" 로 해석되었기 때문이였다.
더 시도해 볼뻔한 방법
7. 상위버전 VS 에서 빌드
8. Library 소스를 전면 재개편