Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlphaZiege/74d593e3aacc3ee05399aadbba3de705 to your computer and use it in GitHub Desktop.
Save AlphaZiege/74d593e3aacc3ee05399aadbba3de705 to your computer and use it in GitHub Desktop.
Snapchat Data Extractor
#!/bin/bash
if [[ $(id -u) -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if [ -z $(pm list packages | grep com.snapchat.android) ]; then
echo "Snapchat not found"
exit 1
fi
SDCARD=/storage/emulated/0
EXPORTDIR=$SDCARD/snapchat_exports
SNAPDATA=$(pm dump com.snapchat.android | grep dataDir= | head -n 1 | cut -d= -f2)
echo "Export folder: $EXPORTDIR"
echo "Snapchat data folder: $SNAPDATA"
rm -r $EXPORTDIR
mkdir -v $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/chat_snap $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/story_snap $EXPORTDIR
cp $SNAPDATA/files/file_manager/snap_first_frame/* $EXPORTDIR/story_snap
cp -r $SNAPDATA/files/file_manager/snap $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/posted_story_snap $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/memories_media $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/memories_thumbnail $EXPORTDIR
#cp -r $SNAPDATA/files/file_manager/memories_overlay $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/media_package_thumb $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/external_sticker $EXPORTDIR
cp -r $SNAPDATA/files/file_manager/non_user_bitmoji $EXPORTDIR
for folder in $EXPORTDIR/*/;
do
for file in $folder*;
do
if (file "$file" | grep text);
then mv "$file" "$file.txt";
else
if (head -n 1 "$file" | grep mp4);
then mv "$file" "$file.mp4";
else
if (head -n 1 "$file" | grep JFIF);
then mv "$file" "$file.jfif"
else
if (head -n 1 "$file" | grep WEBP);
then mv "$file" "$file.webp"
else
if (head -n 1 "$file" | grep PNG);
then mv "$file" "$file.png"
fi
fi
fi
fi
fi
done
for file in "$folder*.txt"; do rm "$file"; done
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment