일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- ue4dumper
- 취약점
- CJ대한통운 #쿠팡 #통관번호오류 #통관고유번호오류 #안주원팀장 #모건인베스트
- 채팅환전사기
- intelmac
- speed-measure-webpack-plugin
- ssrf
- 척추관협착증
- 많다..
- NUGU
- Frida
- 변태는
- 네이버카페
- esbuild
- 중고나라
- 보이스피싱 #대검찰청 #명의도용 #비밀번호 #계좌번호 #공공기관 #가짜검찰청
- 안전결제
- CryptoJS
- 거래사기
- 허리디스크
- react
- 모의해킹
- open redirect
- Sequoia
- XSS
- shell_gpt
- 로맨스스캠
- MongoDB #NoSQL #CreateUser #DropUser #mongod #mognod.conf
- self-signed
- Malware Sample
Archives
- Today
- Total
annyoung
python ctypes GetFileVersion 본문
몇일 전부터 혼자 삽질해보려고 했는데 국방망이라서 할수도 없고... 열심히 기본적으로 제공해주는 모듈로도 할 수 있을꺼같아서 사지방에서 검색하고 또 검색해서 찾은 아웃풋..
import array
from ctypes import *
def get_file_info(filename, info):
size = windll.version.GetFileVersionInfoSizeA(filename, None)
if not size:
return ''
res = create_string_buffer(size)
windll.version.GetFileVersionInfoA(filename, None, size, res)
r = c_uint()
l = c_uint()
windll.version.VerQueryValueA(res, '\\VarFileInfo\\Translation',
byref(r), byref(l))
if not l.value:
return ''
codepages = array.array('H', string_at(r.value, l.value))
codepage = tuple(codepages[:2].tolist())
windll.version.VerQueryValueA(res, ('\\StringFileInfo\\%04x%04x\\'
+ info) % codepage,byref(r), byref(l))
return string_at(r.value, l.value)
print get_file_info(r'C:\WINDOWS\system32\calc.exe', 'FileVersion')
출처 : https://mail.python.org/pipermail//python-list/2006-November/402797.html
기본적으로 제공해주는 ctypes와 array 모듈... 처음에 API도 없다고 떠서 한참 고민했다.
get_file_info의 두번째 파라미터인 info에는 Comments, CompanyName, FileDescription, InternalName, LegalCopyright, OriginalFilename, ProductVersion, ProductName, FileVersion 등등이 들어갈 수 있다.
python Get File Version from binary
'프로그래밍' 카테고리의 다른 글
[javascript] calculate datetime (0) | 2018.04.24 |
---|---|
[javascript] get ip only using javascript (5) | 2018.04.19 |
python 윈도우 한글문제 (0) | 2016.04.26 |
python unicode unescape (html unescape) (0) | 2015.11.07 |
django standard install.. (0) | 2015.10.13 |
Comments