Copy flash videos to disk the second encounter

As of Google discontinues the support of NPAPI in April 2014, I experimented with the new pepperflash. My old skript for saving flash videos to disk doesn't work anymore with this plugin. So I looked a bit around in proc and found out, that there is still a chance to get our videos back:

FPID=`lsof|grep Pepper|grep deleted|awk '{print $2}'|uniq` 
DATE=`date +%y%m%d`
HOME=/your/home/dir
USER=yourUser
GROUP=yourPrimaryGroup
VDIR="$HOME/video"

rc=1
count=1


while [ $rc -eq 1 ]
do
        mkdir $HOME/video/v-$DATE
        rc=$?
        if [ $rc -eq 1 ]
        then
                mkdir $VDIR/v-$DATE-$count
                rc=$?
                let count=count+1
        fi
                
done

CDIR=$VDIR/`ls -tr $HOME/video/|tail -1` 
chown $USER:$GROUP $CDIR

for FD in `ls -l /proc/$FPID/fd/|grep deleted|awk '{print $9}'`
do
        cat /proc/$FPID/fd/$FD > $CDIR/$FD.flv
        chown $USER:$GROUP $CDIR/$FD.flv
done


The disadvantage ist, you need root access. It looks like the file descriptors could only be accessed by root. I'm using sudo to execute this skript. Works like a charme for me.

Comments (0)

2014-01-19 13:38:22