Skip to content

Commit 2040dd5

Browse files
authored
Merge pull request #49 from CAPESandbox/7zz
7zz
2 parents 9f42986 + 69bb6f8 commit 2040dd5

File tree

7 files changed

+371
-57
lines changed

7 files changed

+371
-57
lines changed

.travis.yml

-40
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ following packages alongside sflock. It is currently not possible to run the
2222
unpackers that require native tooling support on non-Linux platforms.
2323

2424
```bash
25-
$ sudo apt-get install p7zip-full rar unace-nonfree cabextract lzip libjpeg8-dev zlib1g-dev zpaq gnupg
25+
$ sudo apt-get install rar unace-nonfree cabextract lzip libjpeg8-dev zlib1g-dev zpaq gnupg
2626
```
2727

2828
Installation of sflock itself may be done as follows.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[tool.poetry]
33
name = "SFlock2"
4-
version = "0.3.67"
4+
version = "0.3.69"
55
description = "Sample staging and detonation utility"
66
readme = "README.md"
77
license = "GPLv3"

sflock/config.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010

1111
def iter_passwords():
12-
import pkg_resources
12+
from importlib.resources import as_file
13+
from pathlib import Path
1314

14-
filepath = pkg_resources.resource_filename("sflock", "data/password.txt")
15-
for line in open(filepath, "rb"):
16-
yield line.strip()
15+
with as_file(Path("sflock/data/password.txt")) as passwd_file:
16+
for line in passwd_file.read_text().splitlines():
17+
yield line.strip()

sflock/data/7zz.elf

3.45 MB
Binary file not shown.

sflock/unpack/zip7.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import tempfile
88

99
from sflock.abstracts import Unpacker
10+
from sflock.misc import data_file
1011

12+
zip7_binary = data_file(b"7zz.elf")
1113

1214
class ZipFile(Unpacker):
1315
name = "zipfile"
14-
exe = "/usr/bin/7z"
16+
exe = zip7_binary
1517
exts = b".zip"
1618
magic = "Zip archive data"
1719

@@ -56,7 +58,7 @@ def unpack(self, password="infected", duplicates=None):
5658

5759
class Zip7File(Unpacker):
5860
name = "7zfile"
59-
exe = "/usr/bin/7z"
61+
exe = zip7_binary
6062
exts = b".7z", b".iso", b".udf", b".xz"
6163
# TODO Should we use "isoparser" (check PyPI) instead of 7z?
6264
magic = "7-zip archive", "ISO 9660", "UDF filesystem data", "XZ compressed data"
@@ -84,7 +86,7 @@ def unpack(self, password="infected", duplicates=None):
8486

8587
class GzipFile(Unpacker):
8688
name = "gzipfile"
87-
exe = "/usr/bin/7z"
89+
exe = zip7_binary
8890
exts = b".gzip", b".gz"
8991
magic = "gzip compressed data, was"
9092

@@ -110,7 +112,7 @@ def unpack(self, password=None, duplicates=None):
110112

111113
class LzhFile(Unpacker):
112114
name = "lzhfile"
113-
exe = "/usr/bin/7z"
115+
exe = zip7_binary
114116
exts = b".lzh", b".lha"
115117
magic = "LHa ("
116118

@@ -136,7 +138,7 @@ def unpack(self, password=None, duplicates=None):
136138

137139
class VHDFile(Unpacker):
138140
name = "vhdfile"
139-
exe = "/usr/bin/7z"
141+
exe = zip7_binary
140142
exts = b".vhd", b".vhdx"
141143
magic = " Microsoft Disk Image"
142144

@@ -163,7 +165,7 @@ def unpack(self, password=None, duplicates=None):
163165

164166
class WimFile(Unpacker):
165167
name = "wimfile"
166-
exe = "/usr/bin/7z"
168+
exe = zip7_binary
167169
exts = b".wim"
168170
magic = "Windows imaging (WIM) image"
169171

@@ -189,7 +191,7 @@ def unpack(self, password=None, duplicates=None):
189191

190192
class XZFile(Unpacker):
191193
name = "xzfile"
192-
exe = "/usr/bin/7z"
194+
exe = zip7_binary
193195
exts = b".xz"
194196
magic = "XZ compressed data"
195197

@@ -216,7 +218,7 @@ def unpack(self, password=None, duplicates=None):
216218

217219
class NSIS(Unpacker):
218220
name = "nsis"
219-
exe = "/usr/bin/7z"
221+
exe = zip7_binary
220222
exts = b".exe"
221223
magic = "Nullsoft Installer self-extracting archive"
222224

0 commit comments

Comments
 (0)