Last active
November 4, 2024 12:26
-
-
Save programminghoch10/fa37e0da8b2efc5cb8077e59d000771d to your computer and use it in GitHub Desktop.
Snapchat Data Extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Loving your work on this. Curl: Inaccessible or fine not found.
What's the solution?
Hi,
I couldn't replicate files saved in the folder /data/data/com.snapchat.android/files/file_manager/snap no matter how I tried to send and receive snaps. I tried this on Snapchat version 12.56.0.57 on an Android 13.0.
Would this work for saved voice chats? @programminghoch10
Thanks in advance dude.
hi i am new here just want help i want to extract conversation details of that file i have downloded snapchat data but this conversation shows only stamp date name no details really important plz help me out
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snapchat Data Extractor
A script to quickly copy and analyze photos and videos from Snapchat.
Story
After I had managed to make Snapchat unable to detect screenshots,
I thought Snapchat must save the original photos and videos it receives in some way.
So with the root access I have, I went through Snapchats saved data.
I found a lot of files named with some random characters and file extensions
.0
.1
.2
.I noticed the files were actually mostly
.jpg
and.mp4
files.So after finding some more folders with interesting data I decided to automate the extraction and analysis.
How the script works
This script automatically copies all interesting data from Snapchats data folders and analyses the files to repair their file extensions.
It will copy the following data from Snapchat:
Data gets copied from this snapchat folder:
/data/data/com.snapchat.android/files/file_manager
.The folders in the resulting copy are named the same.
chat_snap
story_snap
snap_first_frame
story_snap
.snap
posted_story_snap
memories_media
memories_overlay
memories_thumbnail
memories_media
.media_package_thumb
external_sticker
non_user_bitmoji
It is currently able to analyze and repair following files:
txt
mp4
jfif
webp
png
The script automatically deletes all
txt
files afterwards, as they are only metadata files and not interesting at all.Additional Info on how snapchat saves the data in
chat_snap
:There are 3 types of files:
.0
,.1
,.2
.When only an
.0
file exists, this file is either an image or a video. Afaik this is only determinable via file headers.When
.0
,.1
and.2
files with the same name exist, the.0
file is a text file containing metadata. This metadata is irrelevant, as its basically the same for all. The.1
file then is a video and the according picture in.2
is used as an overlay.How to use it
The script is written in a way, such that it can be run completely on the phone.
You need superuser / root privileges for this to work!
adb shell
su
to elevate to root privilegescd /sdcard
orcd /storage/emulated/0
curl https://gist.githubusercontent.com/programminghoch10/fa37e0da8b2efc5cb8077e59d000771d/raw/61181d13cf3e45cfddcd3e9b0e6bea492d6189ab/snapchat_data_extractor.sh > snapchat_data_extractor.sh
bash snapchat_data_extractor.sh
snapchat_exports
Be aware:
The script deletes all contents in the folder
snapchat_exports
before copying the new data into it.Before running the script, make sure you have saved all data within this folder.
To download the extracted data to your computer:
adb pull /storage/emulated/0/snapchat_exports
snapchat_exports