This is a simple command-line archivator that can compress and decompress files using the zlib library.
- Compress and decompress files.
- Supports basic options:
-v(verbose): Show more information during compression/decompression.-b(blocksize): Define the block size (default is 16 KB).
zip [-v] [-b BLOCKSIZE] <input_file> <output_file>
- -v: Enables verbose mode, showing progress information.
- -b: Specifies the block size for compression (in bytes). The default is 16 KB.
unzip [-v] <archive_file> <output_file>
- -v: Enables verbose mode, showing progress information.
- Compress a file:
zip -v -b 32768 myfile.txt myfile.zip - Decompress a file:
unzip -v myfile.zip myfile.txt
-
Prerequisites:
- GCC compiler
- Zlib library
-
Options:
OUTPUT_DIR: Directory, where will be result of buildingBINARY_DIR: Directory, where will be result binariesCC: C compiler(gcc by default)CXX: C++ compiler(g++ by default)ARGP_LIB_DIRS: Directory, where argp library placed in format -L(direcory)Z_LIB_DIRS: Directory, where zlib library placed in format -L(direcory)ARGP_INCLUDE_DIRS: Directory, where argp include files placed in format -L(direcory)Z_INCLUDE_DIRS: Directory, where zlib include files placed in format -L(direcory)sanitize: If defined builds with sinitizer options
-
Build:
make
-
Run:
./zipfor compression./unzipfor decompression
Run the tests:
make tests- Generate coverage report:
make coverage
- Open the report:
out/index.html
- Generate coverage report:
make analyze
- Open the report:
out/static-anlyze.txt
Функции-антиотдладчики
- SEH_handler - выполняется в случае получения SIGTRAP, который вызывается, когда флаг trap установлен
- is_ptraced_proc - проверяет /proc/self/status на запись трассировщика
- is_ptraced_syscall - проверяет, соовпадают ли родительский PID, полученный с помощью getppid и полученный с помощью прямого системного вызова
Опции компилятора
- -fstack-protector-strong - добавляет канарейку во все функции, в которых происходит присваивание локальной переменной
- -fPIE - рандомизирует расположение секций в памяти, что усложняет злоумышленнику нахождение необходимой информации