5 ms·
I would have tried running 'strings'on the process's memory instead of gdb. Ugly, but likely would have worked with some manual intervention. As to 'cp' vs 'ca
by Someone 12y ago
I would have tried running 'strings'on the process's memory instead of gdb. Ugly, but likely would have worked with some manual intervention.
As to 'cp' vs 'cat': neither is a builtin, so they both are risky. What if you also accidentally did a rm -rf / on that system?
Mac OS X doesn't have a /proc filesystem, so I cannot test it, but from reading the man page
read -N 1000000000 /proc/53165/exe $bash
should read all of bash into $bash, if it isn't ridiculously large, and
echo -nE $bash > myBash
should then complete the copy.
- michaelmior 12y agoWhy are cp and cat "risky"?
- sp332 12y agoIt's just that in some emergency situations, where for example someone deleted a lot of files on the disk, you might not have /bin/cat or /bin/cp anymore.
- cssandjs 12y agoI don't see how that ("rm -rf /") is relevant... The OP feared for a reboot that would make him recode his command line.
- michaelmior 12y agoAh, fair enough. Good point :)
- dietrichepp 12y agoread -N 1000000000 /proc/53165/exe $bash That shouldn't work, due to NUL bytes.
- deleted 12y ago[deleted]