Check a Game Server ZIP Archive Before Extracting
Check a ZIP archive’s source, integrity, paths and size before extracting it to a separate test folder. A readable archive or matching CRC does not establish its origin or safety.
Before extracting, check the archive’s origin, any expected SHA-256 value, file list, paths and total uncompressed size. A readable ZIP file is not necessarily a safe or suitable save. After checking it, first extract it to an empty, separate folder on your own computer. This reduces accidental overwrites in the production directory; the paths still need to be checked.
Record the original file and its source
Leave the downloaded archive unchanged and note who sent it and when. If the source provides a SHA-256 value, compare it with a value obtained through a trusted, separate channel. Without a known comparison value, a hash you calculate yourself only identifies the specific file you have; it does not confirm the sender or the trustworthiness of the contents. Python provides SHA-256 through hashlib. Python: hashlib
import hashlib
archive = "server-backup.zip"
digest = hashlib.sha256()
with open(archive, "rb") as file:
for chunk in iter(lambda: file.read(1024 * 1024), b""):
digest.update(chunk)
print(digest.hexdigest(), archive)
The next command lists the names in the archive, provided its ZIP directory can be read. It does not extract anything:
python3 -m zipfile -l server-backup.zip
The ZIP specification calls for relative file paths using / as the separator; drive or device letters and a leading slash do not belong in a stored file path. Python warns against extracting uninspected archives because absolute paths or .. components could land outside the selected destination folder. PKWARE ZIP File Format Specification · Python: zipfile
Check paths, the top level and size
A list alone does not always make unusual paths or an extra folder easy to spot. The following example reads only ZIP metadata. It shows the entry count, total uncompressed size, top-level entries and suspicious absolute or parent paths. It does not write any archive files:
import stat
from pathlib import PurePosixPath, PureWindowsPath
from zipfile import ZipFile
archive = "server-backup.zip"
with ZipFile(archive) as zip_file:
entries = zip_file.infolist()
files = [item for item in entries if not item.filename.endswith("/")]
expanded = sum(item.file_size for item in files)
top_level = set()
unsafe = []
unix_flags = []
for item in entries:
raw = item.filename
posix = PurePosixPath(raw.replace("\\", "/"))
windows = PureWindowsPath(raw)
bad = (posix.is_absolute() or windows.is_absolute() or windows.drive
or ".." in posix.parts or ".." in windows.parts)
if bad:
unsafe.append(raw)
elif posix.parts:
top_level.add(posix.parts[0])
if item.create_system == 3:
mode = item.external_attr >> 16
flags = []
if stat.S_ISLNK(mode):
flags.append("Symlink")
if mode & 0o111:
flags.append("Ausführungsbit gesetzt")
if flags:
unix_flags.append((raw, ", ".join(flags)))
print("Einträge:", len(entries))
print("Unkomprimierte Dateidaten:", expanded, "Bytes")
print("Oberste Ebene:", sorted(top_level))
print("Auffällige Pfade:", unsafe)
print("Unix-Symlink-/Ausführungsmerkmale:", unix_flags)
for item in sorted(files, key=lambda entry: entry.file_size, reverse=True)[:10]:
print(item.file_size, "Bytes; komprimiert:", item.compress_size, "Bytes;", item.filename)
The additional list reads only file metadata. ZIP attributes depend on the operating system that created the archive; the display therefore detects Unix markings, but does not reliably identify executable contents. An empty list does not prove that files are harmless. Inspect unknown entries and unexpected program or script files further, without running them.
Compare the top level with the format expected by your backup tool. An extra folder such as backup-2026/ could mean the save is one level deeper. A single file directly at the archive root could instead indicate different contents or an incomplete package. Do not remove the folder blindly or move files until you know what structure the destination expects.
The sum of file_size estimates the file data after extraction; it does not precisely state the actual storage required and comes from the archive itself. Before a full CRC test and extraction, set your own limits for total size, largest individual file and entry count. Base them on the expected backup and available storage, with room to spare. If the archive metadata exceeds those limits or its size is implausible, stop and clarify the source. A very large ratio between file_size and compress_size, an unexpectedly large file or many entries are additional reasons to check. There is no universal safe threshold; metadata is not a hard limit on the amount of data actually produced. Python explicitly lists insufficient storage and so-called ZIP bombs among decompression risks. Therefore, do not perform the inspection or CRC test on the active game server.
Test readability without extracting
python3 -m zipfile -t server-backup.zip checks whether Python can process the archive. The underlying ZipFile.testzip() method reads all members and checks their CRC values and file headers; it does not write files. CRC is an error check in the ZIP format, not a cryptographic proof of origin. A successful CRC test shows neither who created the archive nor whether its contents are harmless. A matching SHA-256 shows that the file matches the separately obtained trusted comparison value; it also does not make the contents safe. Run the CRC test only after checking the source, size and your own size limit, because it processes the compressed contents. A returned filename or read error means: do not overwrite anything, keep the original and request a new copy from the trusted sender. Python: zipfile · Python: hashlib
Extract to a separate copy first
If the source, structure and size are consistent and an available expected SHA-256 value matches, extract to an empty test folder outside the active server directory. The separate folder reduces accidental file collisions, but it is not a sandbox and does not limit storage use or all risks from an uninspected archive. Make enough free space available and do not run unexpected programs or scripts from the archive. Then check that the expected saves, configuration files and extensions are actually present and that the top-level folder structure is correct.
Before a real replacement, make a current backup of the destination server, follow the stop procedure in the game or panel documentation, and define the exact scope: which data will be replaced and which will be kept. Do not extract into the running world, the production directory or over the only available backup. Clarify first if the source, destination or replacement behavior is unclear. The Minecraft backup guide explains backup and restore; a game server test restore checks the process in a separate instance. See also the restart procedure for stopping before file changes.
Sources
Did this guide help? We are happy to help personally.