/usr/lib/python2.7/dist-packages/rekall/plugins/overlays/native_types.py is in python-rekall-core 1.6.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | """Data types for various compilers.
Different models:
http://www.unix.org/version2/whatsnew/lp64_wp.html
http://en.wikipedia.org/wiki/64-bit_computing
Python standard types:
http://docs.python.org/2/library/struct.html#format-characters
"""
from rekall import obj
# Model on 64 bit unix like operating systems.
LP64 = {
'bool' : obj.Curry(obj.Bool, type_name='bool', format_string='<c'),
# Char is 8 bits.
'char' : obj.Curry(obj.NativeType, type_name='char', format_string='<c'),
'unsigned char' : obj.Curry(
obj.NativeType, type_name='unsigned char', format_string='<B'),
'signed byte' : obj.Curry(
obj.NativeType, type_name='signed byte', format_string='<b'),
# Shorts are 16 bits.
'short' : obj.Curry(obj.NativeType, type_name='short', format_string='<h'),
'unsigned short' : obj.Curry(
obj.NativeType, type_name='unsigned short', format_string='<H'),
# ints are 32 bits.
'int' : obj.Curry(obj.NativeType, type_name='int', format_string='<i'),
'unsigned int' : obj.Curry(
obj.NativeType, type_name='unsigned int', format_string='<I'),
# Both long and long long are 64 bits.
'long': obj.Curry(obj.NativeType, type_name='long', format_string='<q'),
'unsigned long' : obj.Curry(
obj.NativeType, type_name='unsigned long', format_string='<Q'),
'long long': obj.Curry(
obj.NativeType, type_name='long long', format_string='<q'),
'unsigned long long' : obj.Curry(
obj.NativeType, type_name='unsigned long long', format_string='<Q'),
# Pointers are 64 bits.
'address' : obj.Curry(
obj.NativeType, type_name='address', format_string='<Q'),
'unsigned be short' : obj.Curry(
obj.NativeType, type_name='unsigned be short', format_string='>H'),
'unsigned be int' : obj.Curry(
obj.NativeType, type_name='unsigned be int', format_string='>I'),
}
# Model on 64 bit Windows.
LLP64 = {
'bool' : obj.Curry(obj.Bool, type_name='bool', format_string='<c'),
# Char is 8 bits.
'char' : obj.Curry(obj.NativeType, type_name='char', format_string='<c'),
'unsigned char' : obj.Curry(
obj.NativeType, type_name='unsigned char', format_string='<B'),
'signed byte' : obj.Curry(
obj.NativeType, type_name='signed byte', format_string='<b'),
# Shorts are 16 bits.
'short' : obj.Curry(obj.NativeType, type_name='short', format_string='<h'),
'unsigned short' : obj.Curry(
obj.NativeType, type_name='unsigned short', format_string='<H'),
# ints are 32 bits.
'int' : obj.Curry(obj.NativeType, type_name='int', format_string='<i'),
'unsigned int' : obj.Curry(
obj.NativeType, type_name='unsigned int', format_string='<I'),
# long is also 32 bits.
'long': obj.Curry(obj.NativeType, type_name='long', format_string='<i'),
'unsigned long' : obj.Curry(
obj.NativeType, type_name='unsigned long', format_string='<I'),
# But long long is 64 bits.
'long long': obj.Curry(
obj.NativeType, type_name='long long', format_string='<q'),
'unsigned long long' : obj.Curry(
obj.NativeType, type_name='unsigned long long', format_string='<Q'),
# Pointers are 64 bits.
'address' : obj.Curry(
obj.NativeType, type_name='address', format_string='<Q'),
'unsigned be short' : obj.Curry(
obj.NativeType, type_name='unsigned be short', format_string='>H'),
'unsigned be int' : obj.Curry(
obj.NativeType, type_name='unsigned be int', format_string='>I'),
}
# Model on 32 bit systems.
ILP32 = {
'bool' : obj.Curry(obj.Bool, type_name='bool', format_string='<c'),
# Char is 8 bits.
'char' : obj.Curry(obj.NativeType, type_name='char', format_string='<c'),
'unsigned char' : obj.Curry(
obj.NativeType, type_name='unsigned char', format_string='<B'),
'signed byte' : obj.Curry(
obj.NativeType, type_name='signed byte', format_string='<b'),
# Shorts are 16 bits.
'short' : obj.Curry(obj.NativeType, type_name='short', format_string='<h'),
'unsigned short' : obj.Curry(
obj.NativeType, type_name='unsigned short', format_string='<H'),
# ints are 32 bits.
'int' : obj.Curry(obj.NativeType, type_name='int', format_string='<i'),
'unsigned int' : obj.Curry(
obj.NativeType, type_name='unsigned int', format_string='<I'),
# long is also 32 bits.
'long': obj.Curry(obj.NativeType, type_name='long', format_string='<i'),
'unsigned long' : obj.Curry(
obj.NativeType, type_name='unsigned long', format_string='<I'),
# But long long is 64 bits.
'long long': obj.Curry(
obj.NativeType, type_name='long long', format_string='<q'),
'unsigned long long' : obj.Curry(
obj.NativeType, type_name='unsigned long long', format_string='<Q'),
# Pointers are 32 bits.
'address' : obj.Curry(
obj.NativeType, type_name='address', format_string='<I'),
'unsigned be short' : obj.Curry(
obj.NativeType, type_name='unsigned be short', format_string='>H'),
'unsigned be int' : obj.Curry(
obj.NativeType, type_name='unsigned be int', format_string='>I'),
}
# Model on 32 bit systems.
BE32 = {
'bool' : obj.Curry(obj.Bool, type_name='bool', format_string='>c'),
# Char is 8 bits.
'char' : obj.Curry(obj.NativeType, type_name='char', format_string='>c'),
'unsigned char' : obj.Curry(
obj.NativeType, type_name='unsigned char', format_string='>B'),
'signed byte' : obj.Curry(
obj.NativeType, type_name='signed byte', format_string='<b'),
# Shorts are 16 bits.
'short' : obj.Curry(obj.NativeType, type_name='short', format_string='>h'),
'unsigned short' : obj.Curry(
obj.NativeType, type_name='unsigned short', format_string='>H'),
# ints are 32 bits.
'int' : obj.Curry(obj.NativeType, type_name='int', format_string='>i'),
'unsigned int' : obj.Curry(
obj.NativeType, type_name='unsigned int', format_string='>I'),
# long is also 32 bits.
'long': obj.Curry(obj.NativeType, type_name='long', format_string='>i'),
'unsigned long' : obj.Curry(
obj.NativeType, type_name='unsigned long', format_string='>I'),
# But long long is 64 bits.
'long long': obj.Curry(
obj.NativeType, type_name='long long', format_string='>q'),
'unsigned long long' : obj.Curry(
obj.NativeType, type_name='unsigned long long', format_string='>Q'),
# Pointers are 32 bits.
'address' : obj.Curry(
obj.NativeType, type_name='address', format_string='>I'),
'unsigned be short' : obj.Curry(
obj.NativeType, type_name='unsigned be short', format_string='>H'),
'unsigned be int' : obj.Curry(
obj.NativeType, type_name='unsigned be int', format_string='>I'),
}
# These are aliases for the same things
for model in [LP64, ILP32, LLP64, BE32]:
for old, new in [
['char', 'signed char'],
['unsigned char', 'byte'],
['short', 'short int'],
['unsigned short', 'unsigned short int'],
['long', 'long int'],
['unsigned long', 'unsigned long int'],
['unsigned long', 'long unsigned int'],
['long long', 'long long int'],
['unsigned long long', 'unsigned long long int'],
# Some weird combinations we sometimes see.
['unsigned long long', 'long long unsigned int'],
['unsigned short', 'short unsigned int'],
]:
model[new] = model[old]
|