dwipe 1.0.4__py3-none-any.whl → 1.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dwipe/main.py +8 -43
- {dwipe-1.0.4.dist-info → dwipe-1.0.5.dist-info}/METADATA +8 -10
- dwipe-1.0.5.dist-info/RECORD +8 -0
- {dwipe-1.0.4.dist-info → dwipe-1.0.5.dist-info}/WHEEL +1 -2
- dwipe-1.0.5.dist-info/entry_points.txt +3 -0
- dwipe-1.0.4.dist-info/RECORD +0 -9
- dwipe-1.0.4.dist-info/entry_points.txt +0 -2
- dwipe-1.0.4.dist-info/top_level.txt +0 -1
- {dwipe-1.0.4.dist-info → dwipe-1.0.5.dist-info/licenses}/LICENSE +0 -0
dwipe/main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"""
|
|
3
|
+
dwipe: curse based tool to wipe physical disks or partitions including
|
|
4
|
+
markers to know their state when wiped.
|
|
5
5
|
"""
|
|
6
6
|
# pylint: disable=too-many-branches,too-many-statements,import-outside-toplevel
|
|
7
7
|
# pylint: disable=too-many-instance-attributes,invalid-name
|
|
@@ -290,6 +290,7 @@ class DeviceInfo:
|
|
|
290
290
|
entry.fstype = device.get('fstype', '')
|
|
291
291
|
if entry.fstype is None:
|
|
292
292
|
entry.fstype = ''
|
|
293
|
+
entry.type = device.get('type', '')
|
|
293
294
|
entry.label = device.get('label', '')
|
|
294
295
|
if not entry.label:
|
|
295
296
|
entry.label=device.get('partlabel', '')
|
|
@@ -319,7 +320,7 @@ class DeviceInfo:
|
|
|
319
320
|
|
|
320
321
|
# Run the `lsblk` command and get its output in JSON format with additional columns
|
|
321
322
|
result = subprocess.run(['lsblk', '-J', '--bytes', '-o',
|
|
322
|
-
'NAME,MAJ:MIN,FSTYPE,LABEL,PARTLABEL,FSUSE%,SIZE,MOUNTPOINTS', ],
|
|
323
|
+
'NAME,MAJ:MIN,FSTYPE,TYPE,LABEL,PARTLABEL,FSUSE%,SIZE,MOUNTPOINTS', ],
|
|
323
324
|
stdout=subprocess.PIPE, text=True, check=False)
|
|
324
325
|
parsed_data = json.loads(result.stdout)
|
|
325
326
|
entries = {}
|
|
@@ -413,47 +414,10 @@ class DeviceInfo:
|
|
|
413
414
|
|
|
414
415
|
def get_disk_partitions(self, nss):
|
|
415
416
|
""" Determine which partitions we want some are bogus like zram """
|
|
416
|
-
|
|
417
|
-
def whitelisted(device_name):
|
|
418
|
-
"""Check if device_name matches any pattern in whitelist
|
|
419
|
-
which are the disk devices."""
|
|
420
|
-
WHITELIST = ['nvme*', 'sd*', 'hd*', 'mmcblk*']
|
|
421
|
-
for pattern in WHITELIST:
|
|
422
|
-
if fnmatch(device_name, pattern):
|
|
423
|
-
return True
|
|
424
|
-
return False
|
|
425
|
-
|
|
426
|
-
def blacklisted(device_name):
|
|
427
|
-
"""Check if device_name matches any pattern in black list
|
|
428
|
-
which are know not to be physical disks."""
|
|
429
|
-
BLACKLIST = ['zram*', 'ram*', 'dm-*', 'loop*', 'sr*']
|
|
430
|
-
for pattern in BLACKLIST:
|
|
431
|
-
if fnmatch(device_name, pattern):
|
|
432
|
-
return 'blkLst'
|
|
433
|
-
return ''
|
|
434
|
-
|
|
435
|
-
def writable(device_name):
|
|
436
|
-
"""Check if the device is writable."""
|
|
437
|
-
device_path = f'/dev/{device_name}'
|
|
438
|
-
try: # Check if the device file exists and is writable
|
|
439
|
-
return os.access(device_path, os.W_OK)
|
|
440
|
-
except FileNotFoundError:
|
|
441
|
-
return False
|
|
442
|
-
|
|
443
417
|
ok_nss = {}
|
|
444
418
|
for name, ns in nss.items():
|
|
445
|
-
if ns.
|
|
446
|
-
ok_nss[name] = ns
|
|
447
|
-
continue
|
|
448
|
-
if blacklisted(name):
|
|
449
|
-
continue
|
|
450
|
-
if writable(name):
|
|
451
|
-
if self.DB:
|
|
452
|
-
print(r'DB:include {repr(name)} [not white/black but writable]')
|
|
419
|
+
if ns.type in ('disk', 'part'):
|
|
453
420
|
ok_nss[name] = ns
|
|
454
|
-
continue
|
|
455
|
-
if self.DB:
|
|
456
|
-
print(r'DB:exclude {repr(name)} [not white/black but unwritable]')
|
|
457
421
|
return ok_nss
|
|
458
422
|
|
|
459
423
|
def compute_field_widths(self, nss):
|
|
@@ -858,7 +822,8 @@ class DiskWipe:
|
|
|
858
822
|
partition.state = pct
|
|
859
823
|
partition.mounts = [f'{elapsed} {rate} REM:{until}']
|
|
860
824
|
|
|
861
|
-
if partition.parent and
|
|
825
|
+
if partition.parent and partition.parent in self.partitions and (
|
|
826
|
+
self.partitions[partition.parent].state == 'Lock'):
|
|
862
827
|
continue
|
|
863
828
|
|
|
864
829
|
if wanted(name) or partition.job:
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dwipe
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: A tool to wipe disks and partitions for Linux
|
|
5
|
-
Author-email: Joe Defen <joedef@google.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/joedefen/dwipe
|
|
8
|
-
Project-URL: Bug Tracker, https://github.com/joedefen/dwipe/issues
|
|
9
5
|
Keywords: disk,partition,wipe,clean,scrub
|
|
6
|
+
Author-email: Joe Defen <joedef@google.com>
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
10
9
|
Classifier: Programming Language :: Python :: 3
|
|
11
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
11
|
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
-
Requires-Python: >=3.8
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
12
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
|
|
13
|
+
Requires-Dist: importlib-metadata; python_version<"3.8"
|
|
14
|
+
Project-URL: Bug Tracker, https://github.com/joedefen/dwipe/issues
|
|
15
|
+
Project-URL: Homepage, https://github.com/joedefen/dwipe
|
|
18
16
|
|
|
19
17
|
# dwipe
|
|
20
18
|
`dwipe` is tool to wipe disks and partitions for Linux helps secure you data. `dwipes` aims to reduce mistakes by providing ample information about your devices during selection.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
dwipe/PowerWindow.py,sha256=pQGXsAMeuiHn-vtEiVG0rgW1eCslh3ukC-VrPhH_j3k,28587
|
|
2
|
+
dwipe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
dwipe/main.py,sha256=MutcKcddLhBJeegULUwjHOzZRV2gR-QluA1UarRHyIU,33909
|
|
4
|
+
dwipe-1.0.5.dist-info/entry_points.txt,sha256=SZHFezmse2c-jxG-BJ0TXy_TZ8vVFf0lPJWs0cdxz6Y,41
|
|
5
|
+
dwipe-1.0.5.dist-info/licenses/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
|
|
6
|
+
dwipe-1.0.5.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
7
|
+
dwipe-1.0.5.dist-info/METADATA,sha256=hrmh76lFi0rfExxRmCzGSIeEWFTwy1DfLfko7DKofS8,4496
|
|
8
|
+
dwipe-1.0.5.dist-info/RECORD,,
|
dwipe-1.0.4.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
dwipe/PowerWindow.py,sha256=pQGXsAMeuiHn-vtEiVG0rgW1eCslh3ukC-VrPhH_j3k,28587
|
|
2
|
-
dwipe/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
dwipe/main.py,sha256=8QEm6xgyDDZ2HUA4BkbJE1DWe9GuyCcQMtsA9_8T1OY,35153
|
|
4
|
-
dwipe-1.0.4.dist-info/LICENSE,sha256=qB9OdnyyF6WYHiEIXVm0rOSdcf8e2ctorrtWs6CC5lU,1062
|
|
5
|
-
dwipe-1.0.4.dist-info/METADATA,sha256=JoYXNTP-HsJjHjN1YFK-nkYGbCaAIlH4V0IMpRrpf7E,4538
|
|
6
|
-
dwipe-1.0.4.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
7
|
-
dwipe-1.0.4.dist-info/entry_points.txt,sha256=s-gAs_OhS9lr-oVMKii2ZjsLfCSO4-oHV7Wa9oJe-2g,42
|
|
8
|
-
dwipe-1.0.4.dist-info/top_level.txt,sha256=nJT1SUDcOmULgmF9JmYwIIQLmXAIn6qAWW8EdWuxsAg,6
|
|
9
|
-
dwipe-1.0.4.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dwipe
|
|
File without changes
|