├── doc ├── crarr.png ├── frames.html ├── index.html ├── toc-pype32.baseclasses-module.html ├── toc-pype32.datadirs-module.html ├── toc-pype32.utils-module.html ├── toc-pype32.pype32-module.html ├── toc.html ├── toc-pype32.datatypes-module.html ├── redirect.html ├── toc-pype32.excep-module.html ├── toc-pype32.directories-module.html ├── todo-index.html ├── module-tree.html └── pype32.baseclasses-module.html ├── html ├── crarr.png ├── frames.html ├── index.html ├── toc-pype32.baseclasses-module.html ├── toc-pype32.datadirs-module.html ├── toc-pype32.caching-module.html ├── toc-pype32.utils-module.html ├── toc-pype32.pype32-module.html ├── toc-pype32.datatypes-module.html ├── toc.html ├── toc-pype32.excep-module.html ├── redirect.html ├── toc-pype32.dotnet-module.html ├── todo-index.html ├── module-tree.html ├── toc-pype32.directories-module.html ├── pype32.baseclasses-module.html ├── pype32.excep.PEWarning-class.html ├── pype32.excep.PEException-class.html ├── pype32.excep.PyPe32Warning-class.html ├── pype32.excep.ArrayTypeException-class.html ├── pype32.excep.DataLengthException-class.html ├── pype32.excep.DataMismatchException-class.html ├── pype32.excep.NotValidPathException-class.html ├── pype32.excep.InvalidParameterException-class.html ├── pype32.excep.ReadDataOffsetException-class.html └── pype32.excep.InstanceErrorException-class.html ├── dist ├── pype32-0.1-alpha4.zip └── pype32-0.1-alpha5.zip ├── MANIFEST.in ├── THANKS ├── PKG-INFO ├── LICENSE ├── README.md ├── pype32 ├── caching.py ├── excep.py ├── datadirs.py └── __init__.py ├── setup.py └── MANIFEST /doc/crarr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crackinglandia/pype32/HEAD/doc/crarr.png -------------------------------------------------------------------------------- /html/crarr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crackinglandia/pype32/HEAD/html/crarr.png -------------------------------------------------------------------------------- /dist/pype32-0.1-alpha4.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crackinglandia/pype32/HEAD/dist/pype32-0.1-alpha4.zip -------------------------------------------------------------------------------- /dist/pype32-0.1-alpha5.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crackinglandia/pype32/HEAD/dist/pype32-0.1-alpha5.zip -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README 2 | include MANIFEST.in 3 | include THANKS 4 | include setup.py 5 | include tools/*.py 6 | include doc/*.* -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | I just want to say thanks to the following people/projects: 2 | 3 | - PECOFF documentation from Microsoft. 4 | - y0da for the original Binary Corpus project. 5 | - Ange Albertini & corkami project for the custom PE samples. 6 | - marciano and VortiCe for their help with the design of the library, bugfixing and support. 7 | - Daniel Pistelli for CFF Explorer Suite and his work with the .NET format. 8 | 9 | Special thanks to Sandor Nemes (@snemes) and Kevin Breen (@kevthehermit) for their support and contributions! 10 | -------------------------------------------------------------------------------- /html/frames.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | API Documentation 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | API Documentation 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/frames.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32 - Programming Reference 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32 - Programming Reference 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.1 2 | Name: pype32 3 | Version: 0.1-alpha5 4 | Author: Nahuel Riva 5 | Author-email: crackinglandia at gmail com 6 | Home-page: https://github.com/crackinglandia/pype32 7 | Download-url: https://github.com/crackinglandia/pype32/tarball/v0.1-alpha5 8 | Summary: Yet another Python library to read and write PE/PE+ files. 9 | License: BSD 3-Clause 10 | Description: What is pype32? 11 | ================== 12 | 13 | Yet another python library to parse PE/PE+ binary files. 14 | 15 | Where can I find pype32? 16 | =========================== 17 | 18 | https://github.com/crackinglandia/pype32 19 | 20 | Project homepage: 21 | ----------------- 22 | 23 | https://github.com/crackinglandia/pype32 24 | 25 | Download links: 26 | --------------- 27 | 28 | https://github.com/crackinglandia/pype32/releases 29 | 30 | 31 | Documentation: 32 | -------------- 33 | 34 | https://github.com/crackinglandia/pype32 35 | Keywords: pecoff,x86,x64,.net,parser 36 | Platform: Windows, Linux, Mac OSX 37 | Provides: pype32 38 | Classifier: Development Status :: 3 - Alpha 39 | 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The BSD 3-Clause license 2 | 3 | Copyright (c) 2013, Nahuel Riva 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice,this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | What's pype32? 2 | ====== 3 | 4 | Yet another Python library to read and write [PE/PE+](http://es.wikipedia.org/wiki/Portable_Executable) files. 5 | 6 | Installation 7 | ====== 8 | 9 | Using **pip**: just type **pip install --pre pype32** 10 | 11 | Download 12 | ====== 13 | 14 | You can download the current release from https://github.com/crackinglandia/pype32/releases 15 | 16 | 17 | Usage 18 | ====== 19 | 20 | ```python 21 | >>> import pype32 22 | >>> p = pype32.PE(r"C:\Windows\notepad.exe") 23 | >>> p.sectionHeaders 24 | [, , , ] 25 | >>> len(p.sectionHeaders) 26 | 4 27 | >>> len(p.sections) 28 | 4 29 | >>> p.addSection("\x90\x90\x90", name="newsec") 30 | >>> len(p.sectionHeaders) 31 | 5 32 | >>> len(p.sections) 33 | 5 34 | >>> p.sectionHeaders[4].name.value 35 | 'newsec' 36 | >>> p.sections[4] 37 | '\x90\x90\x90\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc 38 | ``` 39 | 40 | License 41 | ====== 42 | 43 | **pype32** is distributed under the [BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) License. 44 | 45 | Documentation 46 | ====== 47 | 48 | You can find the **Programming Reference** documentation generated with [epydoc](http://epydoc.sourceforge.net/) for **pype32** under the [doc](doc/index.html) folder. 49 | 50 | Projects using pype32 51 | ====== 52 | 53 | * http://malwareconfig.com/ by **Kevin Breen** 54 | 55 | Changelog 56 | ====== 57 | 58 | See https://github.com/crackinglandia/pype32/wiki/Changelog 59 | -------------------------------------------------------------------------------- /doc/toc-pype32.baseclasses-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | baseclasses 7 | 8 | 9 | 10 | 11 | 13 |

Module baseclasses

14 |
15 |

Classes

16 | 19 | 22 |

Variables

23 | 26 | 29 |
30 | [hide private] 32 | 33 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /html/toc-pype32.baseclasses-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | baseclasses 7 | 8 | 9 | 10 | 11 | 13 |

Module baseclasses

14 |
15 |

Classes

16 | 19 | 22 |

Variables

23 | 26 | 29 |
30 | [hide private] 32 | 33 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /doc/toc-pype32.datadirs-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | datadirs 7 | 8 | 9 | 10 | 11 | 13 |

Module datadirs

14 |
15 |

Classes

16 | 19 |
20 | Directory
22 |

Variables

23 | 26 | 29 |
30 | dirs
32 |
33 | [hide private] 35 | 36 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /html/toc-pype32.datadirs-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | datadirs 7 | 8 | 9 | 10 | 11 | 13 |

Module datadirs

14 |
15 |

Classes

16 | 19 |
20 | Directory
22 |

Variables

23 | 26 | 29 |
30 | dirs
32 |
33 | [hide private] 35 | 36 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /html/toc-pype32.caching-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | caching 7 | 8 | 9 | 10 | 11 | 13 |

Module caching

14 |
15 |

Classes

16 |
17 | Cache
19 |

Functions

20 |
21 | cached
23 |
24 | getCache
26 |

Variables

27 | 30 |
31 | caches
33 |
34 | [hide private] 36 | 37 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /doc/toc-pype32.utils-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | utils 7 | 8 | 9 | 10 | 11 | 13 |

Module utils

14 |
15 |

Classes

16 |
17 | ReadData
19 |
20 | WriteData
22 |

Functions

23 |
24 | allZero
26 |
27 | powerOfTwo
29 |

Variables

30 | 33 | 36 |
37 | [hide private] 39 | 40 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /html/toc-pype32.utils-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | utils 7 | 8 | 9 | 10 | 11 | 13 |

Module utils

14 |
15 |

Classes

16 |
17 | ReadData
19 |
20 | WriteData
22 |

Functions

23 |
24 | allZero
26 |
27 | powerOfTwo
29 |

Variables

30 | 33 | 36 |
37 | [hide private] 39 | 40 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /pype32/caching.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2015, Sandor Nemes 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice,this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the copyright holder nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | caches = {} 32 | 33 | class Cache(object): 34 | 35 | def __init__(self, name): 36 | self.name = name 37 | self.cache = {} 38 | 39 | def get(self, key): 40 | return self.cache.get(key) 41 | 42 | def put(self, key, value): 43 | self.cache.update({ key: value }) 44 | 45 | def getCache(name): 46 | cache = caches.get(name) 47 | if cache is None: 48 | cache = Cache(name) 49 | caches[name] = cache 50 | return cache 51 | 52 | def cached(*ids): 53 | def decorator(func): 54 | def decorated(self, *args): 55 | funcname = "#".join([func.__name__] + [str(_) for _ in ids]) 56 | cache = getCache(funcname) 57 | key = hash(args) 58 | result = cache.get(key) 59 | if result is None: 60 | result = func(self, *args) 61 | cache.put(key, result) 62 | return result 63 | return decorated 64 | return decorator 65 | -------------------------------------------------------------------------------- /doc/toc-pype32.pype32-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32 7 | 8 | 9 | 10 | 11 | 13 |

Module pype32

14 |
15 |

Classes

16 |
17 | DosHeader
19 |
20 | FileHeader
22 |
23 | NtHeaders
25 | 28 | 31 |
32 | PE
34 | 37 | 40 |
41 | Sections
43 |

Variables

44 | 47 | 50 |
51 | [hide private] 53 | 54 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /html/toc-pype32.pype32-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32 7 | 8 | 9 | 10 | 11 | 13 |

Module pype32

14 |
15 |

Classes

16 |
17 | DosHeader
19 |
20 | FileHeader
22 |
23 | NtHeaders
25 | 28 | 31 |
32 | PE
34 | 37 | 40 |
41 | Sections
43 |

Variables

44 | 47 | 50 |
51 | [hide private] 53 | 54 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Table of Contents 7 | 8 | 9 | 10 | 11 | 13 |

Table of Contents

14 |
15 | Everything 16 |
17 |

Modules

18 | pype32
22 | 25 | 28 | 31 | 34 | 37 | 40 | 43 |
44 | [hide private] 46 | 47 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /doc/toc-pype32.datatypes-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | datatypes 7 | 8 | 9 | 10 | 11 | 13 |

Module datatypes

14 |
15 |

Classes

16 | 19 |
20 | Array
22 |
23 | BYTE
25 |
26 | DWORD
28 |
29 | QWORD
31 |
32 | String
34 |
35 | WORD
37 |

Variables

38 |
39 | TYPE_ARRAY
41 |
42 | TYPE_BYTE
44 |
45 | TYPE_DWORD
47 |
48 | TYPE_QWORD
50 |
51 | TYPE_WORD
53 | 56 | 59 | 62 |
63 | [hide private] 65 | 66 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /html/toc-pype32.datatypes-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | datatypes 7 | 8 | 9 | 10 | 11 | 13 |

Module datatypes

14 |
15 |

Classes

16 | 19 |
20 | Array
22 |
23 | BYTE
25 |
26 | DWORD
28 |
29 | QWORD
31 |
32 | String
34 |
35 | WORD
37 |

Variables

38 |
39 | TYPE_ARRAY
41 |
42 | TYPE_BYTE
44 |
45 | TYPE_DWORD
47 |
48 | TYPE_QWORD
50 | 53 |
54 | TYPE_WORD
56 | 59 | 62 | 65 |
66 | [hide private] 68 | 69 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /html/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Table of Contents 7 | 8 | 9 | 10 | 11 | 13 |

Table of Contents

14 |
15 | Everything 16 |
17 |

Modules

18 | pype32
22 | 25 | 28 | 31 | 34 | 37 | 40 | 43 | 46 | 49 |
50 | [hide private] 52 | 53 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /doc/redirect.html: -------------------------------------------------------------------------------- 1 | Epydoc Redirect Page 2 | 3 | 4 | 5 | 6 | 7 | 8 | 18 | 19 |

Epydoc Auto-redirect page

20 | 21 |

When javascript is enabled, this page will redirect URLs of 22 | the form redirect.html#dotted.name to the 23 | documentation for the object with the given fully-qualified 24 | dotted name.

25 |

 

26 | 27 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /doc/toc-pype32.excep-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | excep 7 | 8 | 9 | 10 | 11 | 13 |

Module excep

14 |
15 |

Classes

16 | 19 | 22 | 25 | 28 | 31 | 34 | 37 | 40 | 43 |
44 | PEWarning
46 | 49 | 52 | 55 | 58 | 61 | 64 | 67 |

Variables

68 | 71 | 74 |
75 | [hide private] 77 | 78 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /html/toc-pype32.excep-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | excep 7 | 8 | 9 | 10 | 11 | 13 |

Module excep

14 |
15 |

Classes

16 | 19 | 22 | 25 | 28 | 31 | 34 | 37 | 40 | 43 |
44 | PEWarning
46 | 49 | 52 | 55 | 58 | 61 | 64 | 67 |

Variables

68 | 71 | 74 |
75 | [hide private] 77 | 78 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2013, Nahuel Riva 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice,this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the copyright holder nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | __revision__ = "$Id$" 32 | 33 | __all__ = ['metadata', 'setup'] 34 | 35 | from distutils.core import setup 36 | from distutils import version 37 | from warnings import warn 38 | 39 | import re 40 | import os 41 | import sys 42 | import glob 43 | 44 | # Distutils hack: in order to be able to build MSI installers with loose 45 | # version numbers, we subclass StrictVersion to accept loose version numbers 46 | # and convert them to the strict format. This works because Distutils will 47 | # happily reinstall a package even if the version number matches exactly the 48 | # one already installed on the system - so we can simply strip all extraneous 49 | # characters and beta/postrelease version numbers will be treated just like 50 | # the base version number. 51 | if __name__ == '__main__': 52 | StrictVersion = version.StrictVersion 53 | class NotSoStrictVersion (StrictVersion): 54 | def parse (self, vstring): 55 | components = [] 56 | for token in vstring.split('.'): 57 | token = token.strip() 58 | match = re.search('^[0-9]+', token) 59 | if match: 60 | number = token[ match.start() : match.end() ] 61 | components.append(number) 62 | vstring = '.'.join(components) 63 | return StrictVersion.parse(self, vstring) 64 | version.StrictVersion = NotSoStrictVersion 65 | 66 | # Get the base directory 67 | here = os.path.dirname(__file__) 68 | if not here: 69 | here = os.path.curdir 70 | 71 | # Text describing the module (reStructured text) 72 | try: 73 | readme = os.path.join(here, 'README') 74 | long_description = open(readme, 'r').read() 75 | except Exception: 76 | warn("README file not found or unreadable!") 77 | long_description = """pype32 is python library to read and write PE/PE+ binary files.""" 78 | 79 | # Get the list of scripts in the "tools" folder 80 | scripts = glob.glob(os.path.join(here, 'tools', '*.py')) 81 | 82 | # Set the parameters for the setup script 83 | metadata = { 84 | 85 | # Setup instructions 86 | 'provides' : ['pype32'], 87 | 'packages' : ['pype32'], 88 | 'scripts' : scripts, 89 | 90 | # Metadata 91 | 'name' : 'pype32', 92 | 'version' : '0.1-alpha5', 93 | 'description' : 'Yet another Python library to read and write PE/PE+ files.', 94 | 'long_description' : long_description, 95 | 'author' : 'Nahuel Riva', 96 | 'author_email' : 'crackinglandia'+chr(64)+'gmail'+chr(0x2e)+'com', 97 | 'url' : 'https://github.com/crackinglandia/pype32', 98 | 'keywords' : ['pecoff', 'x86', 'x64', '.net', 'parser'], 99 | 'download_url' : 'https://github.com/crackinglandia/pype32/tarball/v0.1-alpha5', 100 | } 101 | 102 | # Execute the setup script 103 | if __name__ == '__main__': 104 | setup(**metadata) 105 | -------------------------------------------------------------------------------- /html/redirect.html: -------------------------------------------------------------------------------- 1 | Epydoc Redirect Page 2 | 3 | 4 | 5 | 6 | 7 | 8 | 18 | 19 |

Epydoc Auto-redirect page

20 | 21 |

When javascript is enabled, this page will redirect URLs of 22 | the form redirect.html#dotted.name to the 23 | documentation for the object with the given fully-qualified 24 | dotted name.

25 |

 

26 | 27 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | MANIFEST.in 3 | README 4 | THANKS 5 | setup.py 6 | .\tools\readpe.py 7 | doc\api-objects.txt 8 | doc\class-tree.html 9 | doc\crarr.png 10 | doc\epydoc.css 11 | doc\epydoc.js 12 | doc\frames.html 13 | doc\help.html 14 | doc\identifier-index.html 15 | doc\index.html 16 | doc\module-tree.html 17 | doc\pype32-module.html 18 | doc\pype32-pysrc.html 19 | doc\pype32.baseclasses-module.html 20 | doc\pype32.baseclasses-pysrc.html 21 | doc\pype32.baseclasses.BaseStructClass-class.html 22 | doc\pype32.baseclasses.DataTypeBaseClass-class.html 23 | doc\pype32.consts-module.html 24 | doc\pype32.consts-pysrc.html 25 | doc\pype32.datadirs-module.html 26 | doc\pype32.datadirs-pysrc.html 27 | doc\pype32.datadirs.DataDirectory-class.html 28 | doc\pype32.datadirs.Directory-class.html 29 | doc\pype32.datatypes-module.html 30 | doc\pype32.datatypes-pysrc.html 31 | doc\pype32.datatypes.AlignedString-class.html 32 | doc\pype32.datatypes.Array-class.html 33 | doc\pype32.datatypes.BYTE-class.html 34 | doc\pype32.datatypes.DWORD-class.html 35 | doc\pype32.datatypes.QWORD-class.html 36 | doc\pype32.datatypes.String-class.html 37 | doc\pype32.datatypes.WORD-class.html 38 | doc\pype32.directories-module.html 39 | doc\pype32.directories-pysrc.html 40 | doc\pype32.directories.ExportTable-class.html 41 | doc\pype32.directories.ExportTableEntry-class.html 42 | doc\pype32.directories.ImageBaseRelocation-class.html 43 | doc\pype32.directories.ImageBaseRelocationEntry-class.html 44 | doc\pype32.directories.ImageBoundForwarderRef-class.html 45 | doc\pype32.directories.ImageBoundForwarderRefEntry-class.html 46 | doc\pype32.directories.ImageBoundImportDescriptor-class.html 47 | doc\pype32.directories.ImageBoundImportDescriptorEntry-class.html 48 | doc\pype32.directories.ImageDebugDirectories-class.html 49 | doc\pype32.directories.ImageDebugDirectory-class.html 50 | doc\pype32.directories.ImageExportTable-class.html 51 | doc\pype32.directories.ImageImportDescriptor-class.html 52 | doc\pype32.directories.ImageImportDescriptorEntry-class.html 53 | doc\pype32.directories.ImageImportDescriptorMetaData-class.html 54 | doc\pype32.directories.ImportAddressTable-class.html 55 | doc\pype32.directories.ImportAddressTableEntry-class.html 56 | doc\pype32.directories.ImportAddressTableEntry64-class.html 57 | doc\pype32.directories.NetDirectory-class.html 58 | doc\pype32.directories.NetMetaDataHeader-class.html 59 | doc\pype32.directories.NetMetaDataStreamEntry-class.html 60 | doc\pype32.directories.NetMetaDataStreams-class.html 61 | doc\pype32.directories.NetMetaDataTableHeader-class.html 62 | doc\pype32.directories.NetMetaDataTables-class.html 63 | doc\pype32.directories.TLSDirectory-class.html 64 | doc\pype32.directories.TLSDirectory64-class.html 65 | doc\pype32.excep-module.html 66 | doc\pype32.excep-pysrc.html 67 | doc\pype32.excep.ArrayTypeException-class.html 68 | doc\pype32.excep.DataLengthException-class.html 69 | doc\pype32.excep.DataMismatchException-class.html 70 | doc\pype32.excep.DirectoryEntriesLengthException-class.html 71 | doc\pype32.excep.DirectoryEntryException-class.html 72 | doc\pype32.excep.InstanceErrorException-class.html 73 | doc\pype32.excep.InvalidParameterException-class.html 74 | doc\pype32.excep.NotValidPathException-class.html 75 | doc\pype32.excep.PEException-class.html 76 | doc\pype32.excep.PEWarning-class.html 77 | doc\pype32.excep.PyPe32Exception-class.html 78 | doc\pype32.excep.PyPe32Warning-class.html 79 | doc\pype32.excep.ReadDataOffsetException-class.html 80 | doc\pype32.excep.SectionHeadersException-class.html 81 | doc\pype32.excep.TypeNotSupportedException-class.html 82 | doc\pype32.excep.WriteDataOffsetException-class.html 83 | doc\pype32.excep.WrongOffsetValueException-class.html 84 | doc\pype32.pype32-module.html 85 | doc\pype32.pype32-pysrc.html 86 | doc\pype32.pype32.DosHeader-class.html 87 | doc\pype32.pype32.FileHeader-class.html 88 | doc\pype32.pype32.NtHeaders-class.html 89 | doc\pype32.pype32.OptionalHeader-class.html 90 | doc\pype32.pype32.OptionalHeader64-class.html 91 | doc\pype32.pype32.PE-class.html 92 | doc\pype32.pype32.SectionHeader-class.html 93 | doc\pype32.pype32.SectionHeaders-class.html 94 | doc\pype32.pype32.Sections-class.html 95 | doc\pype32.utils-module.html 96 | doc\pype32.utils-pysrc.html 97 | doc\pype32.utils.ReadData-class.html 98 | doc\pype32.utils.WriteData-class.html 99 | doc\redirect.html 100 | doc\toc-everything.html 101 | doc\toc-pype32-module.html 102 | doc\toc-pype32.baseclasses-module.html 103 | doc\toc-pype32.consts-module.html 104 | doc\toc-pype32.datadirs-module.html 105 | doc\toc-pype32.datatypes-module.html 106 | doc\toc-pype32.directories-module.html 107 | doc\toc-pype32.excep-module.html 108 | doc\toc-pype32.pype32-module.html 109 | doc\toc-pype32.utils-module.html 110 | doc\toc.html 111 | doc\todo-index.html 112 | pype32\__init__.py 113 | pype32\baseclasses.py 114 | pype32\consts.py 115 | pype32\datadirs.py 116 | pype32\datatypes.py 117 | pype32\directories.py 118 | pype32\excep.py 119 | pype32\pype32.py 120 | pype32\utils.py 121 | tools\readpe.py 122 | -------------------------------------------------------------------------------- /html/toc-pype32.dotnet-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | dotnet 7 | 8 | 9 | 10 | 11 | 13 |

Module dotnet

14 |
15 |

Classes

16 | 19 | 22 | 25 |
26 | EventIndex
28 |
29 | FieldIndex
31 | 34 | 37 | 40 | 43 | 46 | 49 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 |
74 | ParamIndex
76 | 79 | 82 | 85 | 88 | 91 | 94 |

Functions

95 | 98 |

Variables

99 | 102 |
103 | __package__
105 |
106 | [hide private] 108 | 109 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /pype32/excep.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2013, Nahuel Riva 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice,this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the copyright holder nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | """ 32 | Exceptions used by the entire library. 33 | 34 | @group Base exceptions: 35 | PyPe32Exception, PyPe32Warning 36 | 37 | @group Warnings: 38 | PEWarning 39 | 40 | @group Exceptions: 41 | PEException,NotValidPathException,WrongOffsetValueException,DirectoryEntriesLengthException, 42 | TypeNotSupportedException,ArrayTypeException,DataLengthException,ReadDataOffsetException, 43 | WriteDataOffsetException,InstanceErrorException,DataMismatchException,SectionHeadersException, 44 | DirectoryEntryException,InvalidParameterException 45 | """ 46 | 47 | __revision__ = "$Id$" 48 | 49 | __all__ = [ 50 | "PyPe32Exception", 51 | "PyPe32Warning", 52 | "PEWarning", 53 | "PEException", 54 | "NotValidPathException", 55 | "WrongOffsetValueException", 56 | "DirectoryEntriesLengthException", 57 | "TypeNotSupportedException", 58 | "ArrayTypeException", 59 | "DataLengthException", 60 | "ReadDataOffsetException", 61 | "WriteDataOffsetException", 62 | "InstanceErrorException", 63 | "DataMismatchException", 64 | "SectionHeadersException", 65 | "DirectoryEntryException", 66 | "InvalidParameterException", 67 | ] 68 | 69 | class PyPe32Exception(Exception): 70 | """Base exception class.""" 71 | pass 72 | 73 | class PyPe32Warning(Exception): 74 | """Base warning class.""" 75 | pass 76 | 77 | class PEWarning(PyPe32Warning): 78 | """Raised when a suspicious value is found into the PE instance.""" 79 | pass 80 | 81 | class PEException(PyPe32Exception): 82 | """Raised when an invalid field on the PE instance was found.""" 83 | pass 84 | 85 | class NotValidPathException(PyPe32Exception): 86 | """Raised when a path wasn't found or it is an invalid path.""" 87 | pass 88 | 89 | class WrongOffsetValueException(PyPe32Exception): 90 | """ 91 | Used primary by the L{ReadData} and L{WriteData} object in read/write operations when an invalid 92 | offset value was used. 93 | """ 94 | pass 95 | 96 | class DirectoryEntriesLengthException(PyPe32Exception): 97 | """Raised when the the number of entries in a L{DataDirectory} object is different from L{consts.IMAGE_NUMBEROF_DIRECTORY_ENTRIES}.""" 98 | pass 99 | 100 | class TypeNotSupportedException(PyPe32Exception): 101 | """This exception must be used when an invalid data type is used within the library.""" 102 | pass 103 | 104 | class ArrayTypeException(PyPe32Exception): 105 | """Raised when creating an unsupported type of array.""" 106 | pass 107 | 108 | class DataLengthException(PyPe32Exception): 109 | """Raised when data lengths does not match.""" 110 | pass 111 | 112 | class ReadDataOffsetException(PyPe32Exception): 113 | """This exception must be raised when reading from an invalid offset.""" 114 | pass 115 | 116 | class WriteDataOffsetException(PyPe32Exception): 117 | """This exception must be raised when writing to an invalid offset.""" 118 | pass 119 | 120 | class InstanceErrorException(PyPe32Exception): 121 | """This exception is raised when an instance parameter was not specified.""" 122 | pass 123 | 124 | class DataMismatchException(PyPe32Exception): 125 | """Raised when two different types of data does not match.""" 126 | pass 127 | 128 | class SectionHeadersException(PyPe32Exception): 129 | """Raised when an error related to a L{pype32.SectionHeader} or L{pype32.SectionHeaders} is found.""" 130 | pass 131 | 132 | class DirectoryEntryException(PyPe32Exception): 133 | """This exception must be raised when an error with the L{Directory} is found.""" 134 | pass 135 | 136 | class InvalidParameterException(PyPe32Exception): 137 | """Raised when an invalid parameter is received.""" 138 | pass 139 | 140 | -------------------------------------------------------------------------------- /doc/toc-pype32.directories-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | directories 7 | 8 | 9 | 10 | 11 | 13 |

Module directories

14 |
15 |

Classes

16 | 19 | 22 | 25 | 28 | 31 | 34 | 37 | 40 | 43 | 46 | 49 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 |

Variables

95 | 98 | 101 |
102 | [hide private] 104 | 105 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /html/todo-index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | To Do List 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 50 | 51 |
  40 | 41 | 42 | 44 | 48 |
[hide private]
[frames] | no frames]
49 |
52 |
[ 53 | Identifiers 54 | | To Do 55 | ]

56 |

To Do List

57 |
58 |
59 |
64 |
65 |
69 |
70 |
75 |
76 |
81 |
82 |
89 |
90 | 92 | 93 | 94 | 96 | 97 | 98 | 100 | 101 | 102 | 104 | 105 | 106 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 117 | 121 | 122 |
123 | 124 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /html/module-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Module Hierarchy 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 50 | 51 |
  40 | 41 | 42 | 44 | 48 |
[hide private]
[frames] | no frames]
49 |
52 |
53 | [ Module Hierarchy 54 | | Class Hierarchy ] 55 |

56 |

Module Hierarchy

57 | 73 | 74 | 76 | 77 | 78 | 80 | 81 | 82 | 84 | 85 | 86 | 88 | 89 | 90 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 101 | 105 | 106 |
107 | 108 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /doc/todo-index.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | To Do List 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 55 | 56 |
  45 | 46 | 47 | 49 | 53 |
[hide private]
[frames] | no frames]
54 |
57 |
[ 58 | Identifiers 59 | | To Do 60 | ]

61 |

To Do List

62 |
63 |
64 |
69 |
70 |
74 |
75 |
80 |
81 |
88 |
89 | 91 | 92 | 93 | 95 | 96 | 97 | 99 | 100 | 101 | 103 | 104 | 105 | 107 | 108 | 109 | 114 | 115 | 116 | 117 | 118 | 121 | 125 | 126 |
127 | 128 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /pype32/datadirs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2013, Nahuel Riva 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice,this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the copyright holder nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | """ 32 | Data directory classes. 33 | """ 34 | 35 | __revision__ = "$Id$" 36 | 37 | __all__ = [ 38 | "Directory", 39 | "DataDirectory", 40 | ] 41 | 42 | import consts 43 | import excep 44 | import datatypes 45 | 46 | from struct import pack 47 | 48 | dirs = ["EXPORT_DIRECTORY","IMPORT_DIRECTORY","RESOURCE_DIRECTORY","EXCEPTION_DIRECTORY","SECURITY_DIRECTORY",\ 49 | "RELOCATION_DIRECTORY","DEBUG_DIRECTORY","ARCHITECTURE_DIRECTORY","RESERVED_DIRECTORY","TLS_DIRECTORY",\ 50 | "CONFIGURATION_DIRECTORY","BOUND_IMPORT_DIRECTORY","IAT_DIRECTORY","DELAY_IMPORT_DIRECTORY","NET_METADATA_DIRECTORY",\ 51 | "RESERVED_DIRECTORY"] 52 | 53 | class Directory(object): 54 | """Directory object.""" 55 | def __init__(self, shouldPack = True): 56 | """ 57 | Class representation of the C{IMAGE_DATA_DIRECTORY} structure. 58 | @see: U{http://msdn.microsoft.com/es-es/library/windows/desktop/ms680305%28v=vs.85%29.aspx} 59 | 60 | @type shouldPack: bool 61 | @param shouldPack: If set to C{True} the L{Directory} object will be packed. If set to C{False} the object won't be packed. 62 | """ 63 | self.name = datatypes.String("") 64 | self.rva = datatypes.DWORD(0) #: L{DWORD} rva. 65 | self.size = datatypes.DWORD(0) #: L{DWORD} size. 66 | self.info = None #: This variable holds the information of the directory. 67 | self.shouldPack = shouldPack 68 | 69 | def __str__(self): 70 | return str(self.rva) + str(self.size) 71 | 72 | def __len__(self): 73 | return len(str(self)) 74 | 75 | def __dir__(self): 76 | return sorted(self.__dict__.keys()) 77 | 78 | @staticmethod 79 | def parse(readDataInstance): 80 | """ 81 | Returns a L{Directory}-like object. 82 | 83 | @type readDataInstance: L{ReadData} 84 | @param readDataInstance: L{ReadData} object to read from. 85 | 86 | @rtype: L{Directory} 87 | @return: L{Directory} object. 88 | """ 89 | d = Directory() 90 | d.rva.value = readDataInstance.readDword() 91 | d.size.value = readDataInstance.readDword() 92 | return d 93 | 94 | def getType(self): 95 | """Returns a value that identifies the L{Directory} object.""" 96 | return consts.IMAGE_DATA_DIRECTORY 97 | 98 | class DataDirectory(list): 99 | """DataDirectory object.""" 100 | def __init__(self, shouldPack = True): 101 | """ 102 | Array of L{Directory} objects. 103 | 104 | @type shouldPack: bool 105 | @param shouldPack: If set to C{True} the L{DataDirectory} object will be packed. If set to C{False} the object won't packed. 106 | """ 107 | self.shouldPack = shouldPack 108 | 109 | for i in range(consts.IMAGE_NUMBEROF_DIRECTORY_ENTRIES): 110 | dir = Directory() 111 | dir.name.value = dirs[i] 112 | self.append(dir) 113 | 114 | def __str__(self): 115 | packedRvasAndSizes = "" 116 | for directory in self: 117 | packedRvasAndSizes += str(directory) 118 | return packedRvasAndSizes 119 | 120 | @staticmethod 121 | def parse(readDataInstance): 122 | """Returns a L{DataDirectory}-like object. 123 | 124 | @type readDataInstance: L{ReadData} 125 | @param readDataInstance: L{ReadData} object to read from. 126 | 127 | @rtype: L{DataDirectory} 128 | @return: The L{DataDirectory} object containing L{consts.IMAGE_NUMBEROF_DIRECTORY_ENTRIES} L{Directory} objects. 129 | 130 | @raise DirectoryEntriesLengthException: The L{ReadData} instance has an incorrect number of L{Directory} objects. 131 | """ 132 | if len(readDataInstance) == consts.IMAGE_NUMBEROF_DIRECTORY_ENTRIES * 8: 133 | newDataDirectory = DataDirectory() 134 | for i in range(consts.IMAGE_NUMBEROF_DIRECTORY_ENTRIES): 135 | newDataDirectory[i].name.value = dirs[i] 136 | newDataDirectory[i].rva.value = readDataInstance.readDword() 137 | newDataDirectory[i].size.value = readDataInstance.readDword() 138 | else: 139 | raise excep.DirectoryEntriesLengthException("The IMAGE_NUMBEROF_DIRECTORY_ENTRIES does not match with the length of the passed argument.") 140 | return newDataDirectory 141 | 142 | -------------------------------------------------------------------------------- /html/toc-pype32.directories-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | directories 7 | 8 | 9 | 10 | 11 | 13 |

Module directories

14 |
15 |

Classes

16 | 19 | 22 | 25 | 28 | 31 | 34 | 37 | 40 | 43 | 46 | 49 | 52 | 55 | 58 | 61 | 64 | 67 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 97 | 100 | 103 |

Variables

104 |
105 | __package__
107 |
108 | __revision__
110 |
111 | [hide private] 113 | 114 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /doc/module-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Module Hierarchy 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 55 | 56 |
  45 | 46 | 47 | 49 | 53 |
[hide private]
[frames] | no frames]
54 |
57 |
58 | [ Module Hierarchy 59 | | Class Hierarchy ] 60 |

61 |

Module Hierarchy

62 | 76 | 77 | 79 | 80 | 81 | 83 | 84 | 85 | 87 | 88 | 89 | 91 | 92 | 93 | 95 | 96 | 97 | 102 | 103 | 104 | 105 | 106 | 109 | 113 | 114 |
115 | 116 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /pype32/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright (c) 2013, Nahuel Riva 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # * Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above copyright 13 | # notice,this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # * Neither the name of the copyright holder nor the names of its 16 | # contributors may be used to endorse or promote products derived from 17 | # this software without specific prior written permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | """ 32 | Yet another Python library to work with PE32 and PE64 file formats. 33 | 34 | by Nahuel Riva (crackinglandia at gmail.com) 35 | 36 | Project: U{http://code.google.com/p/pype32} 37 | 38 | Blog: U{http://crackinglandia.blogspot.com} 39 | 40 | @group PE: 41 | PE, DosHeader, NtHeaders, OptionalHeader, SectionHeader, SectionHeaders, OptionalHeader64, FileHeader, Sections 42 | 43 | @group Data type objects: 44 | String, AlignedString, Array, BYTE, WORD, DWORD, QWORD 45 | 46 | @group Utilities: 47 | ReadData, WriteData 48 | 49 | @group Exceptions: 50 | PyPe32Exception,NotValidPathException,WrongOffsetValueException,DirectoryEntriesLengthException, 51 | TypeNotSupportedException,ArrayTypeException,DataLengthException,ReadDataOffsetException, 52 | WriteDataOffsetException,InstanceErrorException,DataMismatchException,SectionHeadersException, 53 | DirectoryEntryException,InvalidParameterException 54 | 55 | @group Directories: 56 | Directory, DataDirectory, ImageBoundForwarderRefEntry, ImageBoundForwarderRef, 57 | ImageBoundImportDescriptor, ImageBoundImportDescriptorEntry, TLSDirectory, TLSDirectory64, ImageBaseRelocationEntry, 58 | ImageBaseRelocation, ImageDebugDirectory, ImageDebugDirectories, ImageImportDescriptorMetaData, ImageImportDescriptorEntry, 59 | ImageImportDescriptor, ImportAddressTableEntry, ImportAddressTableEntry64, ImportAddressTable, ExportTable, ExportTableEntry, 60 | ImageExportTable, NETDirectory, NetDirectory, NetMetaDataHeader, NetMetaDataStreamEntry, NetMetaDataStreams, NetMetaDataTableHeader, 61 | NetMetaDataTables 62 | 63 | @type version: str 64 | @var version: This pype32 release version. 65 | """ 66 | 67 | __revision__ = "$Id$" 68 | 69 | __all__ = [ 70 | # Lirabry version 71 | "version", 72 | "version_number", 73 | 74 | # from pype32 import * 75 | "PE", 76 | "DosHeader", 77 | "NtHeaders", 78 | "OptionalHeader", 79 | "OptionalHeader64", 80 | "SectionHeader", 81 | "SectionHeaders", 82 | "FileHeader", 83 | "Sections", 84 | 85 | # from datatypes import * 86 | "String", 87 | "AlignedString", 88 | "Array", 89 | "BYTE", 90 | "WORD", 91 | "DWORD", 92 | "QWORD", 93 | 94 | # from utils import * 95 | "ReadData", 96 | "WriteData", 97 | 98 | # from excep import * 99 | "PyPe32Exception", 100 | "NotValidPathException", 101 | "WrongOffsetValueException", 102 | "DirectoryEntriesLengthException", 103 | "TypeNotSupportedException", 104 | "ArrayTypeException", 105 | "DataLengthException", 106 | "ReadDataOffsetException", 107 | "WriteDataOffsetException", 108 | "InstanceErrorException", 109 | "DataMismatchException", 110 | "SectionHeadersException", 111 | "DirectoryEntryException", 112 | "InvalidParameterException", 113 | 114 | # from datadirs import * 115 | "DataDirectory", 116 | "Directory", 117 | 118 | # from directories import * 119 | "Directory", 120 | "DataDirectory", 121 | "ImageImportDescriptor", 122 | "ImageBoundForwarderRefEntry", 123 | "ImageBoundForwarderRef", 124 | "ImageBoundImportDescriptor", 125 | "ImageBoundImportDescriptorEntry", 126 | "TLSDirectory", 127 | "TLSDirectory64", 128 | "ImageBaseRelocationEntry", 129 | "ImageBaseRelocation", 130 | "ImageDebugDirectory", 131 | "ImageDebugDirectories", 132 | "ImageImportDescriptorMetaData", 133 | "ImageImportDescriptorEntry", 134 | "ImageImportDescriptor", 135 | "ImportAddressTableEntry", 136 | "ImportAddressTableEntry64", 137 | "ImportAddressTable", 138 | "ExportTable", 139 | "ExportTableEntry", 140 | "ImageExportTable", 141 | "NETDirectory", 142 | "NetDirectory", 143 | "NetMetaDataHeader", 144 | "NetMetaDataStreamEntry", 145 | "NetMetaDataStreams", 146 | "NetMetaDataTableHeader", 147 | "NetMetaDataTables", 148 | ] 149 | 150 | from datadirs import Directory, DataDirectory 151 | from datatypes import String, AlignedString, Array, BYTE, WORD, DWORD, QWORD 152 | from directories import * 153 | from excep import * 154 | from utils import ReadData, WriteData 155 | from pype32 import * 156 | 157 | # Library version 158 | version_number = 0.1 159 | version = "Version %s" % version_number 160 | -------------------------------------------------------------------------------- /html/pype32.baseclasses-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.baseclasses 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 44 | 55 | 56 |
39 | 40 | Package pype32 :: 41 | Module baseclasses 42 | 43 | 45 | 46 | 47 | 49 | 53 |
[hide private]
[frames] | no frames]
54 |
57 | 58 |

Module baseclasses

source code

59 |

Base classes.

60 | 61 | 62 | 63 | 65 | 66 | 77 | 78 | 79 | 86 | 87 | 88 | 93 | 94 |
67 | 68 | 69 | 70 | 74 | 75 |
Classes[hide private]
76 |
80 |   81 | 82 | BaseStructClass
83 | Base class containing methods used by many others classes in the 84 | library. 85 |
89 |   90 | 91 | DataTypeBaseClass 92 |
95 | 96 | 97 | 99 | 100 | 111 | 112 | 113 | 118 | 119 | 120 | 126 | 127 |
101 | 102 | 103 | 104 | 108 | 109 |
Variables[hide private]
110 |
114 |   115 | 116 | __revision__ = '$Id$' 117 |
121 |   122 | 123 | __package__ = None
124 | hash(x) 125 |
128 | 129 | 131 | 132 | 133 | 135 | 136 | 137 | 139 | 140 | 141 | 143 | 144 | 145 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 156 | 160 | 161 |
162 | 163 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /doc/pype32.baseclasses-module.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.baseclasses 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 49 | 60 | 61 |
44 | 45 | Package pype32 :: 46 | Module baseclasses 47 | 48 | 50 | 51 | 52 | 54 | 58 |
[hide private]
[frames] | no frames]
59 |
62 | 63 |

Module baseclasses

source code

64 |

Base classes.

65 | 66 | 67 | 68 | 70 | 71 | 82 | 83 | 84 | 91 | 92 | 93 | 98 | 99 |
72 | 73 | 74 | 75 | 79 | 80 |
Classes[hide private]
81 |
85 |   86 | 87 | BaseStructClass
88 | Base class containing methods used by many others classes in the 89 | library. 90 |
94 |   95 | 96 | DataTypeBaseClass 97 |
100 | 101 | 102 | 104 | 105 | 116 | 117 | 118 | 123 | 124 | 125 | 131 | 132 |
106 | 107 | 108 | 109 | 113 | 114 |
Variables[hide private]
115 |
119 |   120 | 121 | __revision__ = '$Id$' 122 |
126 |   127 | 128 | __package__ = None
129 | hash(x) 130 |
133 | 134 | 136 | 137 | 138 | 140 | 141 | 142 | 144 | 145 | 146 | 148 | 149 | 150 | 152 | 153 | 154 | 159 | 160 | 161 | 162 | 163 | 166 | 170 | 171 |
172 | 173 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /html/pype32.excep.PEWarning-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.PEWarning 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class PEWarning 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class PEWarning

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                    PyPe32Warning --+
 68 |                                    |
 69 |                                   PEWarning
 70 | 
71 | 72 |
73 |

Raised when a suspicious value is found into the PE instance.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.PEException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.PEException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class PEException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class PEException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   PEException
 70 | 
71 | 72 |
73 |

Raised when an invalid field on the PE instance was found.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.PyPe32Warning-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.PyPe32Warning 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class PyPe32Warning 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class PyPe32Warning

source code

60 |
 61 |               object --+        
 62 |                        |        
 63 | exceptions.BaseException --+    
 64 |                            |    
 65 |         exceptions.Exception --+
 66 |                                |
 67 |                               PyPe32Warning
 68 | 
69 | 70 |
Known Subclasses:
71 |
72 | 74 |
75 | 76 |
77 |

Base warning class.

78 | 79 | 80 | 81 | 83 | 84 | 95 | 96 | 97 | 122 | 123 |
85 | 86 | 87 | 88 | 92 | 93 |
Instance Methods[hide private]
94 |
98 |

Inherited from exceptions.Exception: 99 | __init__, 100 | __new__ 101 |

102 |

Inherited from exceptions.BaseException: 103 | __delattr__, 104 | __getattribute__, 105 | __getitem__, 106 | __getslice__, 107 | __reduce__, 108 | __repr__, 109 | __setattr__, 110 | __setstate__, 111 | __str__, 112 | __unicode__ 113 |

114 |

Inherited from object: 115 | __format__, 116 | __hash__, 117 | __reduce_ex__, 118 | __sizeof__, 119 | __subclasshook__ 120 |

121 |
124 | 125 | 126 | 128 | 129 | 140 | 141 | 142 | 151 | 152 |
130 | 131 | 132 | 133 | 137 | 138 |
Properties[hide private]
139 |
143 |

Inherited from exceptions.BaseException: 144 | args, 145 | message 146 |

147 |

Inherited from object: 148 | __class__ 149 |

150 |
153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 185 | 186 |
187 | 188 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /html/pype32.excep.ArrayTypeException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.ArrayTypeException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class ArrayTypeException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class ArrayTypeException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   ArrayTypeException
 70 | 
71 | 72 |
73 |

Raised when creating an unsupported type of array.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.DataLengthException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.DataLengthException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class DataLengthException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class DataLengthException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   DataLengthException
 70 | 
71 | 72 |
73 |

Raised when data lengths does not match.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.DataMismatchException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.DataMismatchException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class DataMismatchException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class DataMismatchException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   DataMismatchException
 70 | 
71 | 72 |
73 |

Raised when two different types of data does not match.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.NotValidPathException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.NotValidPathException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class NotValidPathException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class NotValidPathException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   NotValidPathException
 70 | 
71 | 72 |
73 |

Raised when a path wasn't found or it is an invalid path.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.InvalidParameterException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.InvalidParameterException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class InvalidParameterException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class InvalidParameterException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   InvalidParameterException
 70 | 
71 | 72 |
73 |

Raised when an invalid parameter is received.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.ReadDataOffsetException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.ReadDataOffsetException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class ReadDataOffsetException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class ReadDataOffsetException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   ReadDataOffsetException
 70 | 
71 | 72 |
73 |

This exception must be raised when reading from an invalid offset.

74 | 75 | 76 | 77 | 79 | 80 | 91 | 92 | 93 | 118 | 119 |
81 | 82 | 83 | 84 | 88 | 89 |
Instance Methods[hide private]
90 |
94 |

Inherited from exceptions.Exception: 95 | __init__, 96 | __new__ 97 |

98 |

Inherited from exceptions.BaseException: 99 | __delattr__, 100 | __getattribute__, 101 | __getitem__, 102 | __getslice__, 103 | __reduce__, 104 | __repr__, 105 | __setattr__, 106 | __setstate__, 107 | __str__, 108 | __unicode__ 109 |

110 |

Inherited from object: 111 | __format__, 112 | __hash__, 113 | __reduce_ex__, 114 | __sizeof__, 115 | __subclasshook__ 116 |

117 |
120 | 121 | 122 | 124 | 125 | 136 | 137 | 138 | 147 | 148 |
126 | 127 | 128 | 129 | 133 | 134 |
Properties[hide private]
135 |
139 |

Inherited from exceptions.BaseException: 140 | args, 141 | message 142 |

143 |

Inherited from object: 144 | __class__ 145 |

146 |
149 | 150 | 152 | 153 | 154 | 156 | 157 | 158 | 160 | 161 | 162 | 164 | 165 | 166 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 177 | 181 | 182 |
183 | 184 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /html/pype32.excep.InstanceErrorException-class.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | pype32.excep.InstanceErrorException 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 45 | 56 | 57 |
39 | 40 | Package pype32 :: 41 | Module excep :: 42 | Class InstanceErrorException 43 | 44 | 46 | 47 | 48 | 50 | 54 |
[hide private]
[frames] | no frames]
55 |
58 | 59 |

Class InstanceErrorException

source code

60 |
 61 |               object --+            
 62 |                        |            
 63 | exceptions.BaseException --+        
 64 |                            |        
 65 |         exceptions.Exception --+    
 66 |                                |    
 67 |                  PyPe32Exception --+
 68 |                                    |
 69 |                                   InstanceErrorException
 70 | 
71 | 72 |
73 |

This exception is raised when an instance parameter was not 74 | specified.

75 | 76 | 77 | 78 | 80 | 81 | 92 | 93 | 94 | 119 | 120 |
82 | 83 | 84 | 85 | 89 | 90 |
Instance Methods[hide private]
91 |
95 |

Inherited from exceptions.Exception: 96 | __init__, 97 | __new__ 98 |

99 |

Inherited from exceptions.BaseException: 100 | __delattr__, 101 | __getattribute__, 102 | __getitem__, 103 | __getslice__, 104 | __reduce__, 105 | __repr__, 106 | __setattr__, 107 | __setstate__, 108 | __str__, 109 | __unicode__ 110 |

111 |

Inherited from object: 112 | __format__, 113 | __hash__, 114 | __reduce_ex__, 115 | __sizeof__, 116 | __subclasshook__ 117 |

118 |
121 | 122 | 123 | 125 | 126 | 137 | 138 | 139 | 148 | 149 |
127 | 128 | 129 | 130 | 134 | 135 |
Properties[hide private]
136 |
140 |

Inherited from exceptions.BaseException: 141 | args, 142 | message 143 |

144 |

Inherited from object: 145 | __class__ 146 |

147 |
150 | 151 | 153 | 154 | 155 | 157 | 158 | 159 | 161 | 162 | 163 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 178 | 182 | 183 |
184 | 185 | 194 | 195 | 196 | --------------------------------------------------------------------------------