홈페이지 : http://www.ollydbg.de/

잠깐 써 봤는데, 괜찮은것 같습니다.
(이 쪽 관련 툴은 거의 써본적이 없어서 다른 것과 비교하긴 힘들지만요...)

홈페이지에 있는 설명을 간략히 옮겨보면...

OllyDbg 는 마이크로 소프트 윈도우에서 동작하는 32-bit 어셈블러 레벨의 분석이 가능한 디버거이다. 바이너리 코드 분석에 중점을 두어 소스코드를 볼 수 없을경우 특히 유용하다. OllyDbg 는 쉐어웨어이지만, 무료로 다운로드하여 사용할 수 있다.  특별한 점은 다음과 같다.
(... 특징은 대충 알아서 해석을....)
  • Intuitive user interface, no crypticalcommands
  • Code analysis - traces registers,recognizes procedures,loops, API calls, switches, tables, constants and strings
  • Directly loads and debugs DLLs
  • Object file scanning - locatesroutinesfrom objectfiles and libraries
  • Allows for user-defined labels,commentsand functiondescriptions
  • Understands debugging information inBorland®format
  • Saves patches between sessions, writesthem back to executable file and updatesfixups
  • Open architecture - manythird-partyplugins are available
  • No installation - no trash in registryorsystemdirectories
  • Debugs multithread applications
  • Attaches to running programs
  • Configurable disassembler, supports both MASM and IDEAL formats
  • MMX, 3DNow! and SSE data types and instructions, including Athlonextensions
  • Full UNICODE support
  • Dynamically recognizes ASCII and UNICODE strings - also in Delphiformat!
  • Recognizes complex code constructs, like call to jump to procedure
  • Decodes calls to more than 1900 standard API and 400 C functions
  • Gives context-sensitive help on API functions from external helpfile
  • Sets conditional, logging, memory and hardware breakpoints
  • Traces program execution, logs arguments of known functions
  • Shows fixups
  • Dynamically traces stack frames
  • Searches for imprecise commands and masked binary sequences
  • Searches whole allocated memory
  • Finds references to constant or address range
  • Examines and modifies memory, sets breakpoints and pauses programon-the-fly
  • Assembles commands into the shortest binary form
  • Starts from the floppy disk
and much, much more!


반응형

설정

트랙백

댓글

파이썬 튜토리얼을 대충 훓어본 후, 맨 처음 해 본것은
기존에 쉘 스크립트와 루비를 이용해 만든 유틸리티였습니다.

이 유틸중에 URL 주소로 부터 파일을 다운로드 하는 부분이 있는데
이 부분에 대해서 이야기 해볼까 합니다.

먼저, URL 주소로 부터 파일을 다운로드 받는 방법 입니다.
import urllib

URL = URL주소
urllib.urlretrieve(URL, URL.split('/')[-1])

요렇게 쓰면 파일을 다운로드 할 수 있습니다.
하지만 여기에서 문제가 발생했습니다. 어떤 서버내의 존재하지 않는 파일에 대해서
다운로드를 시도 할 때 exception 이 발생하지 않습니다.
구글님께 물어본 결과 저 현상이 당연하다는 글을 볼 수가 있었습니다.
왜냐하면 존재하지 않는 파일에 대해서 다운로드를 하게 되면
해당 파일이 아닌 다른 내용을 수신하게 되며, 네트웍으로 부터 정상적인
응답을 받았으므로 exception 이 아니라는 것입니다.

예를들면 http://www.naver.com/sdfa.jpg 파일을 위 코드를 사용하여 다운로드를 하게 되면
sdfa.jpg 라는 파일이 생성되며, 아무런 exception 이 발생하지 않습니다.
하지만 sdfa.jpg 라는 파일을 텍스트 에디터로 살펴보면 다음과 같습니다.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /sdfa.jpg was not found on this server.<P>
</BODY></HTML>

자, 그렇다면 어떻게 하면 다운로드 하려는 파일이 없다는 것을 알 수 있을까요?
머.. 여러 방법이 있겠지만, 제가 찾아낸 방법은 다음과 같습니다.
file = urllib.urlopen(URL)
   try:
       if file.headers.get("content-length") == None:
           raise
       else:
           file.close()
           urllib.urlretrieve(URL, URL.split('/')[-1])           
   except:
      (예외처리...)

이상 어제 삽질의 보고서였습니다. (--)(__)
반응형

설정

트랙백

댓글

2.2.3 Source Code Encoding
파이썬 소스 파일에서는 ASCII 와는 다른 인코딩을 사용할 수 있다. 가장 좋은 방법은 소스 파일의 인코딩을 방법을 정의하는 특별한 주석을 추가하는 것이다.

# -*- coding: encoding -*-

이 선언이 되어 있으면, 소스 파일내의 모든 문자는 encoding 타입으로 인코딩된 문자로 다루어질 것이다. 그리고 선택된 인코딩 타입으로 부터 직접적으로 유니코드를 쓸 수 있다. 사용가능한 인코딩 리스트는 이곳을 참고하라.

예를들어, 유로화 심벌을을 포함하는 유니코드 문자를 쓰기위해서, 유로화 심벌의 서수값(ordinal value) 164 인 ISO-8859-15 인코딩을 사용할 수 있다. 다음 스크립트는 8364 (유로화 심벌에 해당하는 유니코드 값) 를 출력한다.

# -*- coding: iso-8859-15 -*-

currency = u"€"
print ord(currency)


3.1.2 Strings
스트링을 표현하기 위해서 ` 나 " 를 사용할 수 있다.
` 내에서 ` 문자를 표시하기 위해서는 \` 사용하고 " 문자를 표시하기 위해서는 그냥 " 쓰면 된다.
반대로 마찬가지.


4.2 for Statements

>>> # Measure some strings:
... a = ['cat', 'window', 'defenestrate']
>>> for x in a:
... print x, len(x)
...
cat 3
window 6
defenestrate 12

반복문 내에서 리스트 a 의 내용을 바꿀 필요가 있을 때는,
위와 같이 쓰면 문제가 생길 수 있다. 이 경우에는 다음과 같은 표현으로
리스트 a 의 copy 를 사용한다.

>>> for x in a[:]: # make a slice copy of the entire list
... if len(x) > 6: a.insert(0, x)
...
>>> a
['defenestrate', 'cat', 'window', 'defenestrate']

4.1.7 Default Argument Values

i = 5

def f(arg=i):
print arg

i = 6
f()

default value 의 값은 defining scope 의 function definition 때 evaluate 된다.
즉 위의 코드의 결과는 5 가 출력된다.

주의! : default value 는 오직 한번 evaluate 된다. 이것이 list, dictionary 혹은 클래스의 객체와 같이 mutable(내용이 변할 수 있는) object 가 default 가 되는 경우 영향을 미친다.
예를들어, 아래의 코드는

def f(a, L=[]):
L.append(a)
return L

print f(1)
print f(2)
print f(3)

다음과 같은 결과를 출력한다.

[1]
[1, 2]
[1, 2, 3]

만약 연속적인 호출에서 default 를 공유하고 싶지 않다면, 함수 정의를 다음과 같이 해야 한다.

def f(a, L=None):
if L is None:
L = []
L.append(a)
return L


반응형

설정

트랙백

댓글