180 Commits

Author SHA1 Message Date
Alessandro Gario
0d0ca1861c Squash (#56)
- CMake: Refactor, added more warnings.
- Refactor
- Added Windows support
- Added a missing include file for linux.
- Do not set CMAKE_CXX_STANDARD on Windows
- Always initialize the stat struct
- CMake: update the required version, request C++11, disable GNU extensions
- CMake: Add default switch cases, fix GCC warnings.
- Prefer assignment from an empty object when initializing
2017-10-19 12:13:35 -04:00
Marwan Burelle
4d34d91333 Adding support for python3 (#51)
* Adapt wrapper to support python3

This seems to work with either python3 and python2.

* converted test file

* Testing better get_byte implem

* Clean and working get_bytes wrapper

* Correct bytearray display method

* Documents macros for python 2/3 support

* Remove useless typedef

This is C++ code, typedefed struct is useless (and probably bad style
C++).

* Add some comments and C++ style cast.

* Replace new[] with nothrow version

* Update error message to indicate allocation failure
2017-07-22 11:25:27 -04:00
Dan Guido
27e6f70bc6 Merge pull request #49 from jkolek/master
Fixed memory leaks
2017-04-23 17:52:58 -04:00
Jozef Kolek
b85c4225ad Fixed memory leaks 2017-04-18 14:20:40 +02:00
Dan Guido
fac3826677 Merge pull request #48 from jkolek/cpp11_flags
Issue #47 - Add C++11 flags
2017-04-18 02:32:27 -04:00
Jozef Kolek
35057f6270 Issue #47 - Add C++11 flags 2017-04-17 16:32:28 +02:00
Dan Guido
7dd1b15f5e Update README.md 2017-04-12 17:54:54 -04:00
Peter Goodman
05869b0c00 Merge pull request #46 from jkolek/constexpr
Constexpr
2017-04-12 12:28:15 -04:00
Jozef Kolek
974494f622 const replaced by constexpr in nt-headers.h 2017-04-12 17:39:59 +02:00
Jozef Kolek
9f74016e0d Perform endian swap as needed 2017-04-12 00:24:03 +02:00
Peter Goodman
f2e38505fb Merge pull request #42 from jkolek/master
Fixed some memory leaks
2017-04-06 16:23:01 -04:00
Jozef Kolek
aca0344abb Fixed some memory leaks 2017-04-06 20:47:23 +02:00
Peter Goodman
9510a71648 Merge pull request #41 from jkolek/master
Added clang-format spec - issue #35
2017-03-31 11:51:56 -04:00
Jozef Kolek
cb2fd5736f Added clang-format spec - issue #35 2017-03-31 17:01:20 +02:00
Peter Goodman
e3f63e11cb Merge pull request #40 from jkolek/clang_tidy_review
Clang tidy review
2017-03-30 18:44:53 -04:00
Jozef Kolek
1183047cbb Changes made according to clang-tidy review.
* NULL is replaced by nullptr
* Added parameter std::nothrow to operator new so in case of
  failure it returns nullptr instead of throwing exception
  std::bad_alloc. This is important due to check that follows
  the statement. Example:
  parsed_pe *p = new(std::nothrow) parsed_pe();
  if (p == nullptr) {
    ...
  }
* Using range-based for loops.
* Removed redundant boolean literals.
  Example: if (readWord(...) == false) => if (!readWord(...))
* Resolved implicit casts.
  Example: if (!ch) => if (ch == 0u)
* Created functions getImports, getExports, getRelocations from
  parts of ParsePEFromFile to make it smaller and more readable.
* Using reinterpret_cast instead of C-style cast to convert
  between unrelated types.
* Added braces around statements to improve readability.
2017-03-31 00:21:20 +02:00
Dan Guido
0ed5779ba9 Don't allow failures on macOS travis builds 2017-03-30 16:43:13 -04:00
Peter Goodman
418cbfdb9a Merge pull request #39 from jkolek/master
Bugfix - parse all possible relocation blocks
2017-03-30 16:25:39 -04:00
Jozef Kolek
29106a75e0 Bugfix - parse all possible relocation blocks
PE file can contain any number of base relocation blocks, where
each of the blocks can contain any number of Type/Offset entries
beside of PageRVA and BlockSize fields. Without this fix only
first base relocation block is parsed.

Also fixes the issue #32.
2017-03-24 22:16:57 +01:00
Peter Goodman
563b4c1a62 Merge pull request #38 from jkolek/master
Fix UNIX/Windows build issue
2017-03-22 18:09:45 -04:00
Jozef Kolek
dcc79b5237 Fix UNIX/Windows build issue 2017-03-22 22:54:56 +01:00
Peter Goodman
50d54d2415 Merge pull request #34 from jkolek/master
Symbol table parsing
2017-03-21 11:26:47 -04:00
Jozef Kolek
1459fec319 lookupVA clang warning resolved
lookupVA is initialized to 0. Also, if it remains 0 after the two
ifs, then ParsePEFromFile() returns NULL, since the section
lookup at the virtual address 0 is invalid.
2017-03-17 12:46:55 +01:00
Jozef Kolek
326ca41bc6 Symbol table parsing 2017-03-16 22:18:08 +01:00
Dan Guido
6e1e2a99b5 Remove boost from README 2017-03-11 19:25:58 -05:00
Peter Goodman
cf1991b1f3 Merge pull request #31 from hobo-ru/no-boost-travis
Removed all the dependencies on Boost.
2017-03-11 15:56:14 -05:00
hobo-ru
0ddd2f6684 Fix AppleCLang build issue(s) 2017-03-11 23:10:33 +03:00
hobo-ru
f325d6da09 Instruct Travis to use modern C++ standard 2017-03-11 23:08:11 +03:00
hobo-ru
7ab4f77b86 Remove dependency on boost from .travis.yml 2017-03-09 20:05:57 +03:00
hobo-ru
465ed4ba6e Make the sources MS VC compatible (define the macro for __typeof__) 2017-03-09 19:25:20 +03:00
hobo-ru
d067641bf0 Get rid of boost at all 2017-03-09 19:11:41 +03:00
hobo-ru
1a5455e06b Get rid of boost integer types 2017-03-09 19:10:17 +03:00
hobo-ru
7f4152f310 Remove dependency on boost case conversion function(s) 2017-03-09 18:59:37 +03:00
artemdinaburg
a8ccfb9df3 Put all of peparse in the peparse namespace. (#26)
* Put all of peparse in the peparse namespace.
* Fixes dupicate symbol problems when using the library inside other applications, namely Python
* Closes #25
2017-03-03 14:41:14 -05:00
Peter Goodman
6d1b49b74a Merge pull request #22 from gsauthof/speedup-cstring-copy
LGTM
2016-09-08 12:18:36 -04:00
Peter Goodman
e09f4a9e52 Fixes Issue #23 2016-09-08 12:00:05 -04:00
Georg Sauthoff
094dff7d38 Speedup copying of C-strings
Also, the copy functionality is now inside an extra function,
thus easier to maintain.
2016-02-28 00:01:01 +01:00
gaasedelen
8505e15e3f Merge pull request #20 from armbues/master
Checking for NumberOfRvaAndSizes to avoid DataDirectory overflow
2016-01-20 19:50:45 -08:00
armbues
73ca478788 Checking for NumberOfRvaAndSizes to avoid DataDirectory overflow 2016-01-19 17:17:37 -08:00
armbues
65c9454e5c Checking for NumberOfRvaAndSizes to avoid DataDirectory overflow 2016-01-19 17:05:32 -08:00
doom
e203466e9c fixed some resource leaks 2015-05-12 17:07:16 -07:00
gaasedelen
0e1cedef1d Merge pull request #18 from Arbiv/Arbiv-patch-2
Added share for read, write and delete
2015-05-12 18:31:04 -04:00
gaasedelen
2262cfd50a Merge pull request #19 from Arbiv/Arbiv-patch-1-1
Fixed buffer leak
2015-05-12 18:30:43 -04:00
Arbiv
6b8aae18e0 Added share for read, write and delete
Opening the file with share enables other processes to use this file while the pe-parse object is still open
2015-05-07 13:27:20 +03:00
Arbiv
19eb5b4f4f Fixed buffer leak
Added a call to deleteBuffer in DestructParsedPE .
Without the buffer leaks.
2015-05-07 13:05:56 +03:00
Dan Guido
436457493e Merge pull request #16 from wxsBSD/issue_15
Fix crash.
2015-03-02 16:24:58 -05:00
Wesley Shields
684156c51c Fix crash.
Fixes #15.
2015-03-02 16:14:31 -05:00
Andrew Ruef
d822731466 zero-init this structure, the uninit reads will at least be predictable until someone can look at the parser logic and figure out which fields should be populated 2015-01-16 11:24:34 -08:00
Dan Guido
0dae935114 better 2015-01-16 12:33:31 -05:00
Dan Guido
df1309eb98 exclude osx/gcc from travis 2015-01-16 12:31:27 -05:00