forked from DidierStevens/DidierStevensSuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
decoder_ah.py
42 lines (30 loc) · 873 Bytes
/
decoder_ah.py
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
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
__description__ = '&H decoder for oledump.py'
__author__ = 'Didier Stevens'
__version__ = '0.0.1'
__date__ = '2014/12/19'
"""
Source code put in public domain by Didier Stevens, no Copyright
https://DidierStevens.com
Use at your own risk
History:
2014/12/19: start
Todo:
"""
import re
class cAmpersandHexDecoder(cDecoderParent):
name = '&H decoder'
def __init__(self, stream, options):
self.stream = stream
self.options = options
self.done = False
def Available(self):
return not self.done
def Decode(self):
decoded = ''.join([chr(int(s[2:], 16)) for s in re.compile('&H[0-9a-f]{2}', re.IGNORECASE).findall(self.stream)])
self.name = '&H decoder'
self.done = True
return decoded
def Name(self):
return self.name
AddDecoder(cAmpersandHexDecoder)