Telegram decoder plugin used by the IPED project to parse the serialized objects (blobs) stored in the database of Telegram for Android.
The parsing code is the org.telegram.tgnet package copied from the official client
DrKLO/Telegram, compiled against minimal stubs of
the Android/app classes it depends on.
Modules and licenses:
telegram-decoder-api: interfaces used by IPED — Apache v2telegram-decoder-impl: upstreamtgnetcode, stubs andDecoderTelegram— GNU GPL v3
Requires JDK 11+ and Maven:
mvn clean installmain: released code (upstreamtgnet+ local customizations).DrKLO/Telegram: pristine copy of upstreamtgnet. Never edit it by hand.update_1.0.x: branch whereDrKLO/Telegramis merged intomain.
Changes made to upstream files in org/telegram/tgnet (check them after each merge):
ConnectionsManager.javaremoved;TextUtils.javaadded.TLParseException.java: UI debug notification indoThrowOrLogcommented out (parse errors still throw whenexceptionis true;DecoderTelegramrelies on it to reject blobs it cannot fully decode).TLRPC.java: PotatoChat support (TL_user_potatoand message constructors0x41df7460,0x8c75c832);TranslateControllerusage removed.tl/TL_stars.java:PaidReactionPrivacy.getDialogId()returns0.tl/TL_stories.java:StoryPrivacyBottomSheetusage removed.
Prefer adding a stub over editing an upstream file: each edit is a future merge conflict.
- Clone or update the upstream project in a separate folder:
cd ..
git clone https://github.com/DrKLO/Telegram.git # or: cd Telegram && git pull origin master
cd Telegram
grep -E 'APP_VERSION_(NAME|CODE)' gradle.properties # version for the commit message
git log -1 --format=%h # commit for the commit message- Copy the upstream files into the
DrKLO/Telegrambranch:
cd ../telegram-decoder
git checkout DrKLO/Telegram
git pull origin DrKLO/Telegram
rm -rf telegram-decoder-impl/src/main/java/org/telegram/tgnet/*
cp -r ../Telegram/TMessagesProj/src/main/java/org/telegram/tgnet/* telegram-decoder-impl/src/main/java/org/telegram/tgnet/
git add -A
git commit -m "update to x.x.x (xxxx) DrKLO/Telegram@xxxxxxx"
git push origin DrKLO/Telegram- Merge it into a new branch and set the version
1.0.xx-SNAPSHOTin the threepom.xml:
git checkout main
git pull origin main
git checkout -b update_1.0.xx
git merge DrKLO/Telegram-
Resolve the conflicts, keeping the upstream code and re-applying the local customizations listed above. Before committing:
- delete merge leftovers (
*.orig,*_BACKUP_*,*_BASE_*,*_LOCAL_*,*_REMOTE_*): they break the build; - run
mvn clean compile. For each new class referenced by upstream code (cannot find symbol), add a stub with the same package and signature undertelegram-decoder-impl/src/main/java, keeping upstream values for flags/helpers used while parsing.
- delete merge leftovers (
-
Test with IPED, commit, push and open a pull request to
main.