dosbox
allows to mount the local file system, so that it can be altered using DOS commands. Note that the DOS filename convention ([8.3](https://en.wikipedia.org/wiki/8.3_filename)) is used. 从文件中读取数据。
LFILE='\path\to\要读取的文件路径'
dosbox -c 'mount c /' -c "type c:$LFILE"
The file is copied to a readable location. LFILE='\path\to\要读取的文件路径'
dosbox -c 'mount c /' -c "copy c:$LFILE c:\tmp\output" -c exit
cat '/tmp/OUTPUT'
将数据写入文件中。
FILE_TO_
. Also note that echo
terminates the string with a DOS-style line terminator (\r\n
), if that's a problem and your scenario allows it, you can create the file outside dosbox
, then use copy
to do the actual write. LFILE='\path\to\要写入的文件'
dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit
suid是一种授予文件的权限类型,它允许用户使用者以文件所有者的权限来执行文件。
FILE_TO_
. Also note that echo
terminates the string with a DOS-style line terminator (\r\n
), if that's a problem and your scenario allows it, you can create the file outside dosbox
, then use copy
to do the actual write. LFILE='\path\to\要写入的文件'
./dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit
如果二进制文件被 sudo 允许以超级用户身份运行,可能被用于访问文件系统、提升或维持特权访问。
FILE_TO_
. Also note that echo
terminates the string with a DOS-style line terminator (\r\n
), if that's a problem and your scenario allows it, you can create the file outside dosbox
, then use copy
to do the actual write. LFILE='\path\to\要写入的文件'
sudo dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit