sudo apt install sharutils
提供四个命令:
- shar: create a shell archive
- unshar: unpack a shar archive
- uudecode: decode an encoded file
- uuencode: encode a file into email friendly text
uuencode 是一种二进制转文本编码,类似 Base64
没想到还有些包依赖这个上世纪遗留下来的编码(包括 gcc):
apt rdepends sharutils
sharutils
Reverse Depends:
建议: file-roller
依赖: wide-dhcpv6-client
推荐: speechd-el
建议: patool
推荐: mgp
建议: lxqt-archiver
推荐: ldapscripts
依赖: kpatch-build
依赖: knews
建议: git-dpm
依赖: gcc-9-source
依赖: gcc-12-source
依赖: gcc-11-source
依赖: gcc-10-source
建议: engrampa
依赖: biabam
推荐: aespipe
python uuencode
import uu
uu.encode('/etc/passwd', '-')
注意:3.11 开始,python Deprecated 了这个 uu 模块, 可以改用 binascii.b2a_uu
代替。
import binascii
s = b''
with open('/etc/passwd', 'rb') as f:
buf = f.read(45)
while len(buf) > 0:
s += binascii.b2a_uu(buf, backtick=False)
buf = f.read(45)
print(s)