Crack

7z2john example.7z > hash.txt
# or
/usr/share/john/7z2john.pl example.7z > hash.txt

john --wordlist=wordlist.txt hash.txt

If we got the error “Can't locate Compress/Raw/Lzma.pm in @INC...”, we need to install libcompress-raw-lzma-perl package so try:

sudo apt install libcompress-raw-lzma-perl