Merge pull request #427 from linxon/app-forensics/pdf-parser

app-forensics/pdf-parser: bump version
This commit is contained in:
Anton Bolshakov 2019-03-19 02:46:52 +08:00 committed by GitHub
commit 7a53a59d65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 109 additions and 34 deletions

View file

@ -1,2 +1,2 @@
DIST pdf-parser_V0_6_8.zip 13039 BLAKE2B bc8defd726e46e83f32d83b3278420f846913c788a5233f5eae86cbf91edb629c302be1715f463d3d7a686d6730340e473546273b16f62f60b49817132d4511a SHA512 82250ccbed36d432fdf2fcecb42cc59025fc9a5ac2a0ce44970a415c2e590c2c5104d52fa82356287d3bfb385380ebfe1c42db4a2036583a2567e4c9cd8ffc86
DIST pdf-parser_V0_6_9.zip 13486 BLAKE2B 5456bf52e1ddf8935063e7621d10c7e0ae767c11744022bf4bfd7ae0ab951541a0a07bd7228648bb33974d706d0c9a2ae26d87e20850f585fe4c1d6208ef469d SHA512 6ad2a1df334e3dfdafb1cdeff7bfac056798c240d987f5fc8cb9bc6db698165b240000958979477bfe45a66a593b3b29e225c6b3f707dd0d5c3f3c42bbf16391
DIST pdf-parser_V0_7_1.zip 14070 BLAKE2B fd84eba59f6f748996bb7d56b203ca891107d573f1769be544b0d695673d070d6c3ba5a4f3bcf19e2eea7da377ce82ecb6cdce9ef845113de2699ab25f3996b2 SHA512 19daea3ba9ef26d0c843b2502c5e2b8aa27b67b4e31f96795b31ff4a7833401174d8bf71ab8badb76a2e47dbe2ecff971e017c6348f82ecb0557433df837ac37

View file

@ -0,0 +1,26 @@
diff -ur a/pdf-parser.py b/pdf-parser.py
--- a/pdf-parser.py 2019-03-18 11:04:30.022785000 +0300
+++ b/pdf-parser.py 2019-03-18 11:21:14.135237324 +0300
@@ -857,11 +857,11 @@
if options.hash:
streamContent = object.Stream(False, options.overridingfilters)
print(' unfiltered')
- print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent).hexdigest()))
+ print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent.encode('utf-8')).hexdigest()))
print(' %s' % HexAsciiDumpLine(streamContent))
streamContent = object.Stream(True, options.overridingfilters)
print(' filtered')
- print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent).hexdigest()))
+ print(' len: %6d md5: %s' % (len(streamContent), hashlib.md5(streamContent.encode('utf-8')).hexdigest()))
print(' %s' % HexAsciiDumpLine(streamContent))
streamContent = None
else:
@@ -1516,7 +1516,7 @@
elif options.hash:
print('obj %d %d' % (object.id, object.version))
rawContent = FormatOutput(object.content, True)
- print(' len: %d md5: %s' % (len(rawContent), hashlib.md5(rawContent).hexdigest()))
+ print(' len: %d md5: %s' % (len(rawContent), hashlib.md5(rawContent.encode('utf-8')).hexdigest()))
print('')
elif options.searchstream:
if object.StreamContains(options.searchstream, not options.unfiltered, options.casesensitive, options.regex, options.overridingfilters):

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<use>
<flag name="yara">Use <pkg>dev-python/yara-python</pkg> for YARA rules support</flag>
</use>
</pkgmetadata>

View file

@ -1,33 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 )
inherit python-single-r1
MY_P="${PN}_V${PV//./_}"
SRC_URI="http://www.didierstevens.com/files/software/${MY_P}.zip"
DESCRIPTION="This tool will parse a PDF document to identify the fundamental elements used"
HOMEPAGE="http://blog.didierstevens.com/programs/pdf-tools/"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="amd64 ~arm x86"
IUSE=""
RDEPEND=""
DEPEND="app-arch/unzip"
S="${WORKDIR}"
#FIXME add python3 support too
src_prepare() {
sed -e 's/TestPythonVersion(enforceMaximumVersion=True)/# REM/' -i pdf-parser.py
eapply_user
}
src_install() {
newbin "${PN}.py" "${PN}"
python_fix_shebang "${ED}"usr/bin
}

View file

@ -0,0 +1,45 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
inherit python-r1
DESCRIPTION="This tool will parse a PDF document to identify the fundamental elements used"
HOMEPAGE="http://blog.didierstevens.com/programs/pdf-tools/"
MY_P=${PN}_V$(ver_rs 1- '_')
SRC_URI="http://www.didierstevens.com/files/software/${MY_P}.zip"
LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="unicode yara"
RDEPEND="${PYTHON_DEPS}
yara? ( dev-python/yara-python[${PYTHON_USEDEP}] )"
DEPEND="${RDEPEND}"
S="${WORKDIR}"
src_prepare() {
# Enable check maximum version of the python3
sed -e 's/TestPythonVersion(enforceMaximumVersion=True)/# REM/' \
-i pdf-parser.py || die 'sed failed!'
# Fix encoding errors when reading files
use unicode && eapply "${FILESDIR}/${PV}_define_encoding_format.patch"
eapply_user
}
src_install() {
python_foreach_impl python_doscript pdf-parser.py
}
pkg_postinst() {
elog
elog "See more: https://blog.didierstevens.com/2008/04/09/quickpost-about-the-physical-and-logical-structure-of-pdf-files/"
elog
}

View file

@ -0,0 +1,26 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6,3_7} )
inherit distutils-r1
DESCRIPTION="Python interface for a malware identification and classification tool"
HOMEPAGE="https://github.com/VirusTotal/yara-python"
SRC_URI="https://github.com/virustotal/yara-python/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/virustotal/yara/archive/v${PV}.tar.gz -> yara-${PV}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
RDEPEND="${PYTHON_DEPS}
~app-forensics/yara-${PV}"
DEPEND="${RDEPEND}"
src_prepare() {
cp -r "${WORKDIR}/yara-${PV}/"* "${S}/yara/"
default
}