├── settings.gradle
├── app
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── resources.properties
│ │ │ ├── drawable
│ │ │ │ ├── dump_modes.jpg
│ │ │ │ ├── firewall_block.jpg
│ │ │ │ ├── http_inspection.jpg
│ │ │ │ ├── drawer_background.png
│ │ │ │ ├── malware_notification.jpg
│ │ │ │ ├── ic_arrow_drop_down.xml
│ │ │ │ ├── ic_media_stop.xml
│ │ │ │ ├── ic_play_arrow.xml
│ │ │ │ ├── ic_add.xml
│ │ │ │ ├── ic_expand_more.xml
│ │ │ │ ├── ic_short_text.xml
│ │ │ │ ├── reply.xml
│ │ │ │ ├── ic_sort.xml
│ │ │ │ ├── ic_stacked_bar_chart.xml
│ │ │ │ ├── ic_close.xml
│ │ │ │ ├── ic_hourglass_top.xml
│ │ │ │ ├── ic_info.xml
│ │ │ │ ├── splash_screen.xml
│ │ │ │ ├── ic_save_alt_small.xml
│ │ │ │ ├── rounded_bg.xml
│ │ │ │ ├── ic_image.xml
│ │ │ │ ├── ic_apps.xml
│ │ │ │ ├── ic_filter.xml
│ │ │ │ ├── ic_save.xml
│ │ │ │ ├── ic_content_copy.xml
│ │ │ │ ├── ic_external.xml
│ │ │ │ ├── ic_content_copy_small.xml
│ │ │ │ ├── ic_reset.xml
│ │ │ │ ├── ic_text_snippet.xml
│ │ │ │ ├── ic_refresh.xml
│ │ │ │ ├── ic_check_solid.xml
│ │ │ │ ├── ic_search.xml
│ │ │ │ ├── ic_location_dot.xml
│ │ │ │ ├── ic_lock_open_alt.xml
│ │ │ │ ├── ic_baseline_javascript.xml
│ │ │ │ ├── ic_telegram.xml
│ │ │ │ ├── ic_help.xml
│ │ │ │ ├── ic_select_all.xml
│ │ │ │ ├── ic_money.xml
│ │ │ │ ├── ic_copyright.xml
│ │ │ │ ├── ic_lock.xml
│ │ │ │ ├── ic_shopping_cart.xml
│ │ │ │ ├── ic_bug.xml
│ │ │ │ ├── ic_share.xml
│ │ │ │ ├── ic_lock_open.xml
│ │ │ │ ├── ic_exclamation_triangle_solid.xml
│ │ │ │ ├── ic_file_export.xml
│ │ │ │ ├── ic_launcher_background.xml
│ │ │ │ ├── ic_skull.xml
│ │ │ │ ├── ic_file_import.xml
│ │ │ │ ├── ic_shield.xml
│ │ │ │ ├── ic_block.xml
│ │ │ │ ├── ic_settings.xml
│ │ │ │ └── ic_book.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── banner.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── banner.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── banner.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── font
│ │ │ │ └── sourcecodepro_regular.ttf
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-television-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── arrays.xml
│ │ │ ├── values-sw600dp
│ │ │ │ └── dimens.xml
│ │ │ ├── anim
│ │ │ │ ├── slide_in_left.xml
│ │ │ │ ├── slide_out_left.xml
│ │ │ │ ├── slide_out_right.xml
│ │ │ │ └── slide_in_right.xml
│ │ │ ├── layout
│ │ │ │ ├── malware_detection_blacklists.xml
│ │ │ │ ├── choice_chip.xml
│ │ │ │ ├── dropdown_item.xml
│ │ │ │ ├── scrollable_dialog.xml
│ │ │ │ ├── active_filter_chip.xml
│ │ │ │ ├── logview_fragment.xml
│ │ │ │ ├── apps_stats.xml
│ │ │ │ ├── simple_list.xml
│ │ │ │ ├── simple_list_activity.xml
│ │ │ │ ├── connection_payload.xml
│ │ │ │ ├── main_activity.xml
│ │ │ │ ├── rule_item.xml
│ │ │ │ ├── fragment_activity.xml
│ │ │ │ ├── apps_selector.xml
│ │ │ │ ├── quick_settings_item.xml
│ │ │ │ ├── app_installed_item.xml
│ │ │ │ ├── app_selection_item.xml
│ │ │ │ ├── mitm_wizard_activity.xml
│ │ │ │ ├── tabs_activity.xml
│ │ │ │ ├── tabs_activity_fixed.xml
│ │ │ │ ├── port_mapping_item.xml
│ │ │ │ └── add_rule_dialog.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── menu
│ │ │ │ ├── edit_filter_menu.xml
│ │ │ │ ├── hint_menu.xml
│ │ │ │ ├── docs_menu.xml
│ │ │ │ ├── blacklists_menu.xml
│ │ │ │ ├── search_menu.xml
│ │ │ │ ├── copy_share_menu.xml
│ │ │ │ ├── list_edit_cab.xml
│ │ │ │ ├── port_mapping_menu.xml
│ │ │ │ ├── connection_payload.xml
│ │ │ │ ├── about_menu.xml
│ │ │ │ ├── ctrl_permissions_menu.xml
│ │ │ │ ├── log_menu.xml
│ │ │ │ ├── app_overview_menu.xml
│ │ │ │ ├── app_context_menu.xml
│ │ │ │ ├── firewall_menu.xml
│ │ │ │ ├── apps_menu.xml
│ │ │ │ ├── connections_menu.xml
│ │ │ │ ├── main_menu.xml
│ │ │ │ └── nav_items.xml
│ │ │ ├── drawable-v23
│ │ │ │ └── splash_screen.xml
│ │ │ ├── values-night-v8
│ │ │ │ ├── styles.xml
│ │ │ │ └── colors.xml
│ │ │ ├── xml
│ │ │ │ ├── geoip_preferences.xml
│ │ │ │ ├── locales_config.xml
│ │ │ │ ├── dns_preferences.xml
│ │ │ │ └── socks5_preferences.xml
│ │ │ └── navigation
│ │ │ │ └── mitm_wizard_graph.xml
│ │ ├── jni
│ │ │ ├── tests
│ │ │ │ ├── pcap
│ │ │ │ │ ├── metadata.pcap
│ │ │ │ │ ├── http_proxy.pcap
│ │ │ │ │ ├── two_flows.pcap
│ │ │ │ │ ├── invalid_or_unsupported.pcap
│ │ │ │ │ └── crash-593ec6ead7a1bf23faa96d03cbd74c315bcf67fc
│ │ │ │ ├── fuzz
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ ├── fuzz_pcapd.c
│ │ │ │ │ └── fuzz_capture.c
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── Makefile
│ │ │ │ ├── test
│ │ │ │ │ ├── CMakeLists.txt
│ │ │ │ │ └── root_capture.c
│ │ │ │ ├── fuzz_utils.c
│ │ │ │ └── test_utils.h
│ │ │ ├── common
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── uid_lru.h
│ │ │ │ ├── uid_resolver.h
│ │ │ │ └── jni_utils.h
│ │ │ ├── core
│ │ │ │ ├── log_writer.h
│ │ │ │ ├── ushark_dll.h
│ │ │ │ ├── errors.h
│ │ │ │ ├── port_map.h
│ │ │ │ ├── ip_lru.h
│ │ │ │ └── CMakeLists.txt
│ │ │ ├── CMakeLists.txt
│ │ │ └── pcapd
│ │ │ │ ├── nl_utils.h
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── pcapd.h
│ │ └── java
│ │ │ └── com
│ │ │ └── emanuelef
│ │ │ └── remote_capture
│ │ │ ├── interfaces
│ │ │ ├── TextAdapter.java
│ │ │ ├── BlacklistsStateListener.java
│ │ │ ├── CaptureStartListener.java
│ │ │ ├── DrawableLoader.java
│ │ │ ├── AppStateListener.java
│ │ │ ├── FragmentViewCreatedListener.java
│ │ │ ├── AppsLoadListener.java
│ │ │ ├── MitmListener.java
│ │ │ ├── ConnectionsListener.java
│ │ │ └── PcapDumper.java
│ │ │ ├── model
│ │ │ ├── AppState.java
│ │ │ ├── AppStats.java
│ │ │ └── PayloadChunk.java
│ │ │ ├── activities
│ │ │ ├── MitmSetupWizard.java
│ │ │ ├── AppsActivity.java
│ │ │ ├── prefs
│ │ │ │ └── PortMapActivity.java
│ │ │ └── ConnectionsActivity.java
│ │ │ ├── fragments
│ │ │ ├── mitmwizard
│ │ │ │ ├── Done.java
│ │ │ │ └── Intro.java
│ │ │ └── prefs
│ │ │ │ ├── SettingsSubFragment.java
│ │ │ │ └── DnsSettings.java
│ │ │ ├── pcap_dump
│ │ │ └── FileDumper.java
│ │ │ └── ActionReceiver.java
│ ├── debug
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── emanuelef
│ │ └── remote_capture
│ │ ├── TestPCAPdroid.java
│ │ ├── Whitebox.java
│ │ └── UtilsTest.java
└── proguard-rules.pro
├── fastlane
└── metadata
│ └── android
│ ├── ko-KR
│ ├── short_description.txt
│ └── full_description.txt
│ ├── ar
│ ├── short_description.txt
│ └── full_description.txt
│ ├── de
│ ├── short_description.txt
│ └── full_description.txt
│ ├── en-US
│ ├── short_description.txt
│ ├── images
│ │ ├── icon.png
│ │ ├── featureGraphic.png
│ │ ├── tvScreenshots
│ │ │ ├── 1.png
│ │ │ └── 2.png
│ │ └── phoneScreenshots
│ │ │ ├── 1.jpg
│ │ │ ├── 2.jpg
│ │ │ ├── 3.jpg
│ │ │ └── 4.jpg
│ └── full_description.txt
│ ├── es
│ ├── short_description.txt
│ └── full_description.txt
│ ├── it
│ ├── short_description.txt
│ └── full_description.txt
│ ├── tr
│ ├── short_description.txt
│ └── full_description.txt
│ ├── nb-NO
│ ├── short_description.txt
│ └── full_description.txt
│ ├── pt-BR
│ ├── short_description.txt
│ └── full_description.txt
│ ├── uk
│ ├── short_description.txt
│ └── full_description.txt
│ ├── id
│ ├── short_description.txt
│ └── full_description.txt
│ ├── ru
│ ├── short_description.txt
│ └── full_description.txt
│ ├── vi
│ └── short_description.txt
│ └── pl-PL
│ ├── short_description.txt
│ └── full_description.txt
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── ICONS_LICENSE
├── app_icon
│ ├── Attribution.txt
│ └── LICENSE.txt
└── FontAwesome
│ └── LICENSE.txt
├── generated
├── README.md
└── refresh.sh
├── .github
├── workflows
│ ├── gradle-wrapper-validation.yml
│ ├── native-tests.yml
│ ├── windows-build.yml
│ └── debug-build.yml
└── dependabot.yml
├── .gitignore
├── .gitmodules
├── docs
├── languages.md
├── work_profiles.md
└── how_it_works.md
└── gradle.properties
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/src/main/res/resources.properties:
--------------------------------------------------------------------------------
1 | unqualifiedResLocale=en-US
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/ko-KR/short_description.txt:
--------------------------------------------------------------------------------
1 | 안드로이드 기기용 루트 권한이 불필요한 네트워크 모니터 및 트래픽 덤프 도구
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/ar/short_description.txt:
--------------------------------------------------------------------------------
1 | أداة مراقبة الشبكة بدون جذر (root) وتفريغ حركة المرور لأجهزة أندرويد
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/de/short_description.txt:
--------------------------------------------------------------------------------
1 | No-Root Netzwerk Monitor und Traffic Dump Tool für Android Geräte
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/short_description.txt:
--------------------------------------------------------------------------------
1 | No-root network monitor and traffic dump tool for Android devices
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/es/short_description.txt:
--------------------------------------------------------------------------------
1 | Supervise y capture el tráfico de dispositivos Android no rooteados
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/it/short_description.txt:
--------------------------------------------------------------------------------
1 | Monitora e cattura il traffico di dispositivi Android senza root
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/fastlane/metadata/android/tr/short_description.txt:
--------------------------------------------------------------------------------
1 | Android aygıtlar için root gerektirmeyen ağ izleme ve trafik dökümü aracı
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nb-NO/short_description.txt:
--------------------------------------------------------------------------------
1 | Hold øye med nettverksbruk på din Android-enhet uten å trenge rot-tilgang
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/pt-BR/short_description.txt:
--------------------------------------------------------------------------------
1 | Ferramenta de monitoramento e despejo de tráfego para dispositivos Android
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/uk/short_description.txt:
--------------------------------------------------------------------------------
1 | Інструмент моніторингу мережі та дампу трафіку без рут для пристроїв Android
2 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/pcap/metadata.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/jni/tests/pcap/metadata.pcap
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dump_modes.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/drawable/dump_modes.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-hdpi/banner.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-mdpi/banner.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xhdpi/banner.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/id/short_description.txt:
--------------------------------------------------------------------------------
1 | Monitor jaringan tanpa root dan alat pembuangan lalu lintas untuk perangkat Android
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/ru/short_description.txt:
--------------------------------------------------------------------------------
1 | Инструмент мониторинга и записи сетевого трафика для Android-устройств без root
2 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/vi/short_description.txt:
--------------------------------------------------------------------------------
1 | Công cụ giám sát mạng và lưu lượng truy cập không cần root cho thiết bị Android
2 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/pcap/http_proxy.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/jni/tests/pcap/http_proxy.pcap
--------------------------------------------------------------------------------
/app/src/main/jni/tests/pcap/two_flows.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/jni/tests/pcap/two_flows.pcap
--------------------------------------------------------------------------------
/fastlane/metadata/android/pl-PL/short_description.txt:
--------------------------------------------------------------------------------
1 | Monitor sieci bez roota i narzędzie do zrzutu ruchu dla urządzeń z systemem Android
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/firewall_block.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/drawable/firewall_block.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/http_inspection.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/drawable/http_inspection.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/drawable/drawer_background.png
--------------------------------------------------------------------------------
/app/src/main/res/font/sourcecodepro_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/font/sourcecodepro_regular.ttf
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/icon.png
--------------------------------------------------------------------------------
/app/src/debug/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | PCAPdroid (beta)
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/malware_notification.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/drawable/malware_notification.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/jni/tests/pcap/invalid_or_unsupported.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/jni/tests/pcap/invalid_or_unsupported.pcap
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-television-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/res/mipmap-television-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 170dp
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/jni/common/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(common C)
2 |
3 | ADD_LIBRARY(common STATIC uid_lru.c utils.c jni_utils.c uid_resolver.c
4 | ../third_party/libchash.c)
5 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/featureGraphic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/featureGraphic.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/tvScreenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/tvScreenshots/1.png
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/tvScreenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/tvScreenshots/2.png
--------------------------------------------------------------------------------
/ICONS_LICENSE/app_icon/Attribution.txt:
--------------------------------------------------------------------------------
1 | APP Icon from Freepik
2 |
3 | https://www.flaticon.com/free-icon/search-code-interface-symbol-of-a-magnifier-with-binary-code-numbers_36191
--------------------------------------------------------------------------------
/app/src/main/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 225dp
4 |
5 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/phoneScreenshots/1.jpg
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/phoneScreenshots/2.jpg
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/phoneScreenshots/3.jpg
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/images/phoneScreenshots/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/fastlane/metadata/android/en-US/images/phoneScreenshots/4.jpg
--------------------------------------------------------------------------------
/app/src/main/jni/tests/pcap/crash-593ec6ead7a1bf23faa96d03cbd74c315bcf67fc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/emanuele-f/PCAPdroid/HEAD/app/src/main/jni/tests/pcap/crash-593ec6ead7a1bf23faa96d03cbd74c315bcf67fc
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/TextAdapter.java:
--------------------------------------------------------------------------------
1 | package com.emanuelef.remote_capture.interfaces;
2 |
3 | public interface TextAdapter {
4 | String getItemText(int pos);
5 | int getCount();
6 | }
7 |
--------------------------------------------------------------------------------
/generated/README.md:
--------------------------------------------------------------------------------
1 | The subfolders in this directory contain pre-generated autotools files. Using these files removes the need to install autotools and allows to build PCAPdroid in Windows.
2 | To update the files, run `./refresh.sh` in this folder.
3 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/fuzz/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_executable(fuzz_pcapd fuzz_pcapd.c)
2 | target_link_libraries(fuzz_pcapd libpcapd.so)
3 |
4 | add_executable(fuzz_capture ../test_utils.c fuzz_capture.c)
5 | target_link_libraries(fuzz_capture capture pcap)
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
--------------------------------------------------------------------------------
/.github/workflows/gradle-wrapper-validation.yml:
--------------------------------------------------------------------------------
1 | name: "Validate Gradle Wrapper"
2 | on: [push, pull_request]
3 |
4 | jobs:
5 | validation:
6 | name: "Validation"
7 | runs-on: ubuntu-latest
8 | if: false
9 | steps:
10 | - uses: actions/checkout@v4
11 | - uses: gradle/wrapper-validation-action@v2
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_drop_down.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | -keepattributes LineNumberTable,SourceFile
2 | -renamesourcefileattribute SourceFile
3 | -dontobfuscate
4 |
5 | # some classes are required by the native code, keep them all for now
6 | -keep class com.emanuelef.remote_capture.** { *; }
7 | -keep class com.pcapdroid.mitm.** { *; }
8 | -keep class com.maxmind.db.** { *; }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_media_stop.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_play_arrow.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_expand_more.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.github/workflows/native-tests.yml:
--------------------------------------------------------------------------------
1 | name: Test native code
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | test:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v4
10 | with:
11 | submodules: 'recursive'
12 |
13 | - name: Run native tests
14 | working-directory: ./app/src/main/jni/tests
15 | run: make run_tests
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/malware_detection_blacklists.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_short_text.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reply.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/choice_chip.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dropdown_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/jni/core/log_writer.h:
--------------------------------------------------------------------------------
1 | #ifndef PCAPDROID_LOG_WRITER_H
2 | #define PCAPDROID_LOG_WRITER_H
3 |
4 | #include "common/utils.h"
5 |
6 | #define PD_DEFAULT_LOGGER 0
7 | #define PD_DEFAULT_LOGGER_LEVEL ANDROID_LOG_INFO
8 |
9 | int pd_init_logger(const char *path, int min_lvl);
10 | int pd_log_write(int logger, int lvl, const char *msg);
11 | void pd_close_loggers();
12 |
13 | #endif //PCAPDROID_LOG_WRITER_H
14 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/edit_filter_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_sort.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_stacked_bar_chart.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_close.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_hourglass_top.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_info.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/hint_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/docs_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
2 |
3 | # Generated files
4 | .idea/
5 | .gradle
6 |
7 | # Gradle and Maven with auto-import
8 | *.iml
9 | *.ipr
10 |
11 | # Other
12 | local.properties
13 | .DS_Store
14 | build/
15 | captures/
16 | pcap/
17 | .externalNativeBuild
18 | .cxx
19 | app/release/
20 | app/debug/
21 | app/standard/
22 | app/withoutUshark/
23 | keystore
24 |
25 | # Python
26 | __pycache__
27 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/blacklists_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_save_alt_small.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_image.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_apps.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_filter.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.github/workflows/windows-build.yml:
--------------------------------------------------------------------------------
1 | name: Windows build
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | runs-on: windows-latest
8 | if: github.ref != 'refs/heads/playstore'
9 | steps:
10 | - uses: actions/checkout@v4
11 | with:
12 | submodules: 'recursive'
13 |
14 | - uses: actions/setup-java@v4
15 | with:
16 | java-version: '17'
17 | distribution: 'temurin'
18 |
19 | - run: ./gradlew.bat assembleStandardDebug
20 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_save.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_content_copy.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_external.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_content_copy_small.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_reset.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v23/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/search_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.github/workflows/debug-build.yml:
--------------------------------------------------------------------------------
1 | name: Debug build
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 | if: github.ref != 'refs/heads/playstore'
9 | steps:
10 | - uses: actions/checkout@v4
11 | with:
12 | submodules: 'recursive'
13 |
14 | - uses: actions/setup-java@v4
15 | with:
16 | java-version: '17'
17 | distribution: 'temurin'
18 |
19 | - run: ./gradlew test
20 | - run: ./gradlew assembleStandardDebug -PdoNotStrip
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_text_snippet.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_refresh.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_check_solid.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/scrollable_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/active_filter_chip.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_location_dot.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # Please see the documentation for all configuration options:
2 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3 |
4 | version: 2
5 | updates:
6 | - package-ecosystem: gradle
7 | directory: "/"
8 | schedule:
9 | interval: daily
10 | target-branch: "master"
11 | open-pull-requests-limit: 0
12 |
13 | - package-ecosystem: github-actions
14 | directory: "/"
15 | schedule:
16 | interval: daily
17 | target-branch: "master"
18 | open-pull-requests-limit: 0
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_lock_open_alt.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night-v8/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_javascript.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "submodules/nDPI"]
2 | path = submodules/nDPI
3 | url = https://github.com/emanuele-f/nDPI
4 | [submodule "submodules/zdtun"]
5 | path = submodules/zdtun
6 | url = https://github.com/emanuele-f/zdtun
7 | [submodule "submodules/libpcap"]
8 | path = submodules/libpcap
9 | url = https://github.com/the-tcpdump-group/libpcap
10 | [submodule "submodules/MaxMind-DB-Reader-java"]
11 | path = submodules/MaxMind-DB-Reader-java
12 | url = https://github.com/emanuele-f/MaxMind-DB-Reader-java
13 | [submodule "submodules/PCAPdroid-ushark-bin"]
14 | path = submodules/PCAPdroid-ushark-bin
15 | url = https://github.com/emanuele-f/PCAPdroid-ushark-bin
16 |
--------------------------------------------------------------------------------
/app/src/main/jni/core/ushark_dll.h:
--------------------------------------------------------------------------------
1 | #ifndef _USHARK_H_
2 | #define _USHARK_H_
3 |
4 | #include "pcapdroid.h"
5 |
6 | typedef struct ushark ushark_t;
7 | struct pcap_pkthdr;
8 |
9 | bool ushark_init(pcapdroid_t *pd);
10 | void ushark_cleanup();
11 |
12 | ushark_t* ushark_new(int pcap_encap, const char *dfilter);
13 | void ushark_destroy(ushark_t *sk);
14 | void ushark_set_pref(const char *name, const char *val);
15 |
16 | typedef void (*ushark_tls_data_callback)(const unsigned char *plain_data, unsigned int data_len);
17 | void ushark_dissect_tls(ushark_t *sk, const unsigned char *buf, const struct pcap_pkthdr *hdr, ushark_tls_data_callback cb);
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_telegram.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_help.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/logview_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_select_all.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_money.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/copy_share_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/list_edit_cab.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/port_mapping_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_copyright.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_lock.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_shopping_cart.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_bug.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/test/java/com/emanuelef/remote_capture/TestPCAPdroid.java:
--------------------------------------------------------------------------------
1 | package com.emanuelef.remote_capture;
2 |
3 | import org.robolectric.TestLifecycleApplication;
4 |
5 | import java.lang.reflect.Method;
6 |
7 | // NOTE: this class must be named "TestPCAPdroid"
8 | // https://robolectric.org/custom-test-runner
9 | public class TestPCAPdroid extends PCAPdroid implements TestLifecycleApplication {
10 | @Override
11 | public void onCreate() {
12 | PCAPdroid.isUnderTest = true;
13 | super.onCreate();
14 | }
15 |
16 | @Override
17 | public void beforeTest(Method method) {}
18 |
19 | @Override
20 | public void prepareTest(Object test) {}
21 |
22 | @Override
23 | public void afterTest(Method method) {}
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_lock_open.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_exclamation_triangle_solid.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_export.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
7 |
11 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/jni/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project("PCAPdroid")
2 | cmake_minimum_required(VERSION 3.18.1)
3 |
4 | set(CMAKE_VERBOSE_MAKEFILE ON)
5 | set(ROOTDIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
6 |
7 | # Add debug symbols
8 | # See packagingOptions.doNotStrip in build.gradle to avoid stripping
9 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fPIC")
10 |
11 | # zdtun
12 | set(ZDTUN_ROOT ${ROOTDIR}/submodules/zdtun)
13 | include_directories(${ZDTUN_ROOT})
14 | add_subdirectory(${ZDTUN_ROOT} zdtun_build)
15 |
16 | # nDPI
17 | set(NDPI_ROOT ${ROOTDIR}/submodules/nDPI)
18 | include_directories(${NDPI_ROOT}/src/include ${NDPI_ROOT}/src/lib/third_party/include)
19 |
20 | # base
21 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
22 |
23 | add_subdirectory(common)
24 | add_subdirectory(pcapd)
25 | add_subdirectory(core)
26 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/connection_payload.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/about_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/ctrl_permissions_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
18 |
19 |
24 |
--------------------------------------------------------------------------------
/app/src/main/jni/core/errors.h:
--------------------------------------------------------------------------------
1 | #ifndef __PCAPDROID_ERRORS_H__
2 | #define __PCAPDROID_ERRORS_H__
3 |
4 | // This file contains a set of error strings which may be returned from the native code.
5 | // These should be translated in CaptureService.reportError
6 |
7 | #define PD_ERR_UNSUPPORTED_PCAP_FILE "Unsupported PCAP/Pcapng file"
8 | #define PD_ERR_INVALID_PCAP_FILE "Invalid PCAP/Pcapng file"
9 | #define PD_ERR_INTERFACE_OPEN_ERROR "Could not open the capture interface"
10 | #define PD_ERR_UNSUPPORTED_DATALINK "Unsupported datalink"
11 | #define PD_ERR_PCAP_DOES_NOT_EXIST "The specified PCAP/Pcapng file does not exist"
12 | #define PD_ERR_PCAPD_START "pcapd daemon start failure"
13 | #define PD_ERR_PCAPD_NOT_SPAWNED "pcapd daemon did not spawn"
14 | #define PD_ERR_PCAP_READ "PCAP/Pcapng read error"
15 |
16 | #endif
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_skull.xml:
--------------------------------------------------------------------------------
1 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night-v8/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #5A458D
4 | @android:color/secondary_text_dark
5 | @android:color/primary_text_dark
6 | #6C52AB
7 | #24144D
8 | #121212
9 | #03DAC6
10 | #BCEBE7
11 | #1CFFFFFF
12 | #FF202020
13 | @color/background_material_dark
14 | @android:color/primary_text_dark
15 | #FFFFFF
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_import.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.18.1)
2 | project(tests)
3 |
4 | option(FUZZING "Build for Fuzz Testing" OFF)
5 |
6 | if(FUZZING)
7 | if(NOT DEFINED "LIB_FUZZING_ENGINE")
8 | set(LIB_FUZZING_ENGINE "-fsanitize=fuzzer")
9 | endif()
10 |
11 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFUZZING -g -O1 ${LIB_FUZZING_ENGINE} -fsanitize=address,undefined,leak -fno-sanitize=alignment")
12 | endif()
13 |
14 | #set(CMAKE_VERBOSE_MAKEFILE ON)
15 | set(ROOTDIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)
16 |
17 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/main)
18 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
19 | include_directories(${ROOTDIR}/submodules/zdtun)
20 | include_directories(${ROOTDIR}/submodules/nDPI/src/include)
21 | include_directories(.)
22 |
23 | if(FUZZING)
24 | add_subdirectory(fuzz)
25 | else()
26 | add_subdirectory(test)
27 | endif()
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_shield.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
14 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/log_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
19 |
20 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/app_overview_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
19 |
20 |
26 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: clean run_tests fuzz fuzz_pcapd fuzz_capture
2 |
3 | clean:
4 | rm -rf build /tmp/pcapdroid_test*
5 |
6 | run_tests:
7 | mkdir -p build/test
8 | cd build/test && \
9 | cmake -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-fsanitize=address,leak -DHAVE_GNU_STRERROR_R -fno-omit-frame-pointer -O1" ../.. && \
10 | $(MAKE) run_tests
11 |
12 | fuzz:
13 | # Note: corpus should be specific of a single target
14 | mkdir -p build/${FUZZ_TARGET}
15 | cd build/${FUZZ_TARGET} && \
16 | cmake -DFUZZING=1 -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-DHAVE_GNU_STRERROR_R" ../.. && \
17 | $(MAKE) ${FUZZ_TARGET}
18 | cd build/${FUZZ_TARGET}/fuzz && \
19 | mkdir -p CORPUS && \
20 | ./${FUZZ_TARGET} CORPUS ../../../../../../../../submodules/nDPI/tests/pcap ../../../pcap ${FUZZ_OPTS}
21 |
22 | fuzz_pcapd:
23 | $(MAKE) FUZZ_TARGET=fuzz_pcapd fuzz
24 |
25 | fuzz_capture:
26 | $(MAKE) FUZZ_TARGET=fuzz_capture fuzz
27 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/geoip_preferences.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
10 |
11 |
13 |
14 |
15 |
20 |
21 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/locales_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/dns_preferences.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
12 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_block.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
14 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/apps_stats.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/ko-KR/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid는 다른 앱에 의해 생성된 커넥션을 추적하고 분석할 수 있는 프라이버시 친화적인 앱입니다.
2 | 또한 트래픽을 PCAP 덤프로 추출하거나, HTTP를 검사하고, TLS 트래픽 복호화 등을 할 수 있습니다.
3 |
4 | PCAPdroid는 루트 권한 없이 네트워크 트래픽을 캡처하기 위해서 VPN을 시뮬레이션합니다. 원격 VPN 서버를 사용하지 않습니다. 모든 데이터는 디바이스 내에서 처리됩니다.
5 |
6 | 기능들:
7 |
8 | * 사용자와 시스템 앱에 의해 만들어진 커넥션을 기록하고 검사합니다.
9 | * SNI, DNS 쿼리, HTTP URL 및 원격 IP 주소를 추출합니다.
10 | * 내장된 디코더를 이용해 HTTP 요청 및 응답을 확인합니다.
11 | * 모든 커넥션 페이로드를 16진수 또는 텍스트로 확인합니다.
12 | * HTTPS/TLS 트래픽을 해독하고 SSLKEYLOGFILE을 내보냅니다.
13 | * 트래픽을 PCAP 파일로 덤프하거나, 브라우저에서 다운로드 하거나, 실시간 분석을 위해원격 리시버(와이어샤크 등)로 보냅니다.
14 | * 정상 트래픽을 필터링하고 이상 징후를 쉽게 찾아내는 규칙을 생성합니다.
15 | * 오프라인 DB 조회로 원격 서버의 국가 및 ASN을 식별합니다.
16 | * 루팅된 기기에서는 다른 VPN이 실행되는 동안 트래픽을 캡처할 수 있습니다.
17 |
18 | PCAPdroid를 사용하여 패킷 분석을 하려는 경우, 설명서의 특정 섹션을 확인하세요.
19 |
20 | 텔레그램 또는 매트릭스를 통해 전세계 커뮤니팅에 가입하세요.
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/BlacklistsStateListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | public interface BlacklistsStateListener {
23 | void onBlacklistsStateChanged();
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/CaptureStartListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | public interface CaptureStartListener {
23 | void onCaptureStartResult(boolean success);
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/DrawableLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | import android.graphics.drawable.Drawable;
23 |
24 | public interface DrawableLoader {
25 | Drawable getDrawable();
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/simple_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
15 |
16 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/AppStateListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | import com.emanuelef.remote_capture.model.AppState;
23 |
24 | public interface AppStateListener {
25 | void appStateChanged(AppState state);
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/model/AppState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.model;
21 |
22 | /* App state handling: ready -> starting -> running -> stopping -> ready */
23 | public enum AppState {
24 | ready,
25 | starting,
26 | running,
27 | stopping
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/app_context_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
14 |
18 |
19 |
22 |
25 |
28 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/simple_list_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
22 |
24 |
--------------------------------------------------------------------------------
/ICONS_LICENSE/app_icon/LICENSE.txt:
--------------------------------------------------------------------------------
1 | License
2 | =======
3 |
4 | Icons generated with the Android Material Icon Generator are licensed under the Creative Commons Attribution-NonCommercial 3.0 License (https://creativecommons.org/licenses/by-nc/3.0/).
5 |
6 | For commercial usage, please submit a request under https://goo.gl/forms/zX8GZ3Jz89SRyHdJ2 or send us an email to material-icons@bitdroid.de.
7 |
8 |
9 | Google Material Icons License
10 | =============================
11 |
12 | This license applies to the Google Material Icons, which can be seen on the front page of the Android Material icon generator.
13 |
14 | (Copied from https://github.com/google/material-design-icons)
15 | We have made these icons available for you to incorporate them into your
16 | products under the Creative Common Attribution 4.0 International License (CC-BY
17 | 4.0, https://creativecommons.org/licenses/by/4.0/). Feel free to remix and
18 | re-share these icons and documentation in your products. We'd love attribution
19 | in your app's *about* screen, but it's not required. The only thing we ask is
20 | that you not re-sell the icons themselves.
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/FragmentViewCreatedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-24 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | import android.view.View;
23 |
24 | import androidx.annotation.NonNull;
25 |
26 | public interface FragmentViewCreatedListener {
27 | void onFragmentViewCreated(@NonNull View view);
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/connection_payload.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/AppsLoadListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | import com.emanuelef.remote_capture.model.AppDescriptor;
23 |
24 | import java.util.List;
25 |
26 | public interface AppsLoadListener {
27 | // uid -> AppDescriptor
28 | void onAppsInfoLoaded(List apps);
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/firewall_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
19 |
20 |
26 |
27 |
33 |
--------------------------------------------------------------------------------
/app/src/main/jni/core/port_map.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | #ifndef PCAPDROID_PORTMAP_H
21 | #define PCAPDROID_PORTMAP_H
22 |
23 | #include
24 | #include "zdtun.h"
25 |
26 | bool pd_add_port_map(int ipver, int ipproto, int orig_port, int redirect_port, const zdtun_ip_t *redirect_ip);
27 | bool pd_check_port_map(zdtun_conn_t *conn);
28 | void pd_reset_port_map();
29 |
30 | #endif //PCAPDROID_PORTMAP_H
31 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/apps_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | -
10 |
11 |
12 |
14 |
16 |
18 |
20 |
21 |
22 |
23 |
24 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/main_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
16 |
17 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/jni/core/ip_lru.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | #ifndef __IP_LRU_H__
21 | #define __IP_LRU_H__
22 |
23 | #include "zdtun.h"
24 |
25 | typedef struct ip_lru ip_lru_t;
26 |
27 | ip_lru_t* ip_lru_init(int max_size);
28 | void ip_lru_destroy(ip_lru_t *lru);
29 | void ip_lru_add(ip_lru_t *lru, const zdtun_ip_t *ip, const char *hostname);
30 | char* ip_lru_find(ip_lru_t *lru, const zdtun_ip_t *ip);
31 | int ip_lru_size(ip_lru_t *lru);
32 |
33 | #endif // __IP_LRU_H__
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/MitmListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | import org.jetbrains.annotations.Nullable;
23 |
24 | public interface MitmListener {
25 | // NOTE: for fragments, this may be called when their context is null
26 | void onMitmGetCaCertificateResult(@Nullable String ca_pem);
27 |
28 | void onMitmServiceConnect();
29 | void onMitmServiceDisconnect();
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(CTest)
2 |
3 | # Target to run tests and build them if necessary
4 | add_custom_target(build_tests)
5 | add_custom_target(run_tests COMMAND CTEST_OUTPUT_ON_FAILURE=1 ${CMAKE_CTEST_COMMAND})
6 | add_dependencies(run_tests build_tests)
7 |
8 | # test_source(target)
9 | macro(test_source)
10 | add_executable(${ARGV0} ${ARGV0}.c ../test_utils.c)
11 | add_dependencies(${ARGV0} libpcapd.so)
12 | add_dependencies(build_tests ${ARGV0})
13 |
14 | target_link_libraries(${ARGV0} capture)
15 | endmacro()
16 |
17 | # Tests
18 | test_source(pcap_reader)
19 |
20 | test_source(dpi)
21 | add_test(NAME dpi_extract COMMAND ./dpi extract)
22 | add_test(NAME dpi_extract_proxy COMMAND ./dpi extract_proxy)
23 |
24 | test_source(blacklist)
25 | add_test(NAME blacklist_match COMMAND ./blacklist match)
26 | add_test(NAME blacklist_detection COMMAND ./blacklist detection)
27 |
28 | test_source(dump_api)
29 | add_test(NAME dump_api_snaplen COMMAND ./dump_api snaplen)
30 | add_test(NAME dump_api_max_pkts_flow COMMAND ./dump_api max_pkts_per_flow)
31 | add_test(NAME dump_api_max_size COMMAND ./dump_api max_dump_size)
32 |
33 | test_source(root_capture)
34 | add_test(NAME root_capture COMMAND ./root_capture invalid_pkts)
35 |
--------------------------------------------------------------------------------
/docs/languages.md:
--------------------------------------------------------------------------------
1 | To provide a consistent user experience, languages with missing translations are excluded from the app build.
2 | Usually this means languages with 5% or more untranslated strings. Such languages may still be present in the resources folder, however they won't be usable by the users.
3 |
4 | The languages currently included into the app need to be specified in 2 places:
5 |
6 | - `resourceConfigurations` in `app/build.gradle`: specifies the folder names of the actual translations to include
7 | - `app/src/main/res/xml/locales_config.xml`: specifies the locales which are displayed in the Android own language selector
8 |
9 | Note: the locale name in `locales_config.xml` can differ from the language specified in `resourceConfigurations`, see
10 | https://developer.android.com/guide/topics/resources/app-languages#sample-config for some examples
11 |
12 | ## Adding a new language
13 |
14 | Here is a summary of the steps needed to add a new language:
15 |
16 | 1. The language translation first needs to be completed on [Weblate](https://hosted.weblate.org/projects/pcapdroid)
17 | 2. The language related commits are cherry-picked to `master`, and possibly squashed
18 | 3. `build.gradle` and `locales_config.xml` is updated as explained about
19 |
--------------------------------------------------------------------------------
/app/src/main/jni/common/uid_lru.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | #ifndef __UID_LRU_H__
21 | #define __UID_LRU_H__
22 |
23 | #include "zdtun.h"
24 |
25 | typedef struct uid_lru uid_lru_t;
26 |
27 | uid_lru_t* uid_lru_init(int max_size);
28 | void uid_lru_destroy(uid_lru_t *lru);
29 | void uid_lru_add(uid_lru_t *lru, const zdtun_5tuple_t *tuple, int uid);
30 | int uid_lru_find(uid_lru_t *lru, const zdtun_5tuple_t *tuple);
31 | int uid_lru_size(uid_lru_t *lru);
32 |
33 | #endif // __UID_LRU_H__
34 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/connections_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
16 |
17 | -
23 |
24 |
25 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 | android.javaCompile.suppressSourceTargetDeprecationWarning=true
22 | android.nonTransitiveRClass=false
23 | android.nonFinalResIds=false
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/ConnectionsListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.interfaces;
21 |
22 | import com.emanuelef.remote_capture.model.ConnectionDescriptor;
23 |
24 | public interface ConnectionsListener {
25 | void connectionsChanges(int num_connetions);
26 | void connectionsAdded(int start, ConnectionDescriptor []conns);
27 | void connectionsRemoved(int start, ConnectionDescriptor []conns);
28 | void connectionsUpdated(int[] positions);
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/activities/MitmSetupWizard.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.activities;
21 |
22 | import android.os.Bundle;
23 |
24 | import com.emanuelef.remote_capture.R;
25 |
26 | public class MitmSetupWizard extends BaseActivity {
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | setContentView(R.layout.mitm_wizard_activity);
31 | setTitle(R.string.mitm_setup_wizard);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_book.xml:
--------------------------------------------------------------------------------
1 |
5 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
19 |
20 |
26 |
27 |
32 |
33 |
38 |
39 |
--------------------------------------------------------------------------------
/generated/refresh.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 | set -e
3 |
4 | # Set this to your NDK path
5 | # Should match the ndkVersion in app/build.gradle
6 | ANDROID_NDK="${ANDROID_NDK:-${HOME}/Android/Sdk/ndk}/26.3.11579264"
7 |
8 | # https://developer.android.com/ndk/guides/other_build_systems
9 | export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
10 | export TARGET=x86_64-linux-android21
11 | export ANDROID_NATIVE_API_LEVEL=21
12 | export AR=$TOOLCHAIN/bin/llvm-ar
13 | export CC=$TOOLCHAIN/bin/$TARGET$API-clang
14 | export AS=$CC
15 | export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
16 | export LD=$TOOLCHAIN/bin/ld
17 | export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
18 | export STRIP=$TOOLCHAIN/bin/llvm-strip
19 |
20 | SUBMODULES_PATH=../submodules
21 |
22 | # libpcap
23 | ( cd $SUBMODULES_PATH/libpcap && \
24 | rm -f scanner.c grammar.h scanner.c scanner.h config.h && \
25 | ./autogen.sh && \
26 | ac_cv_netfilter_can_compile=no ./configure --host $TARGET --without-libnl --enable-usb=no --enable-netmap=no --enable-bluetooth=no --enable-dbus=no --enable-rdma=no && \
27 | make scanner.h grammar.h )
28 | cp $SUBMODULES_PATH/libpcap/{grammar.c,grammar.h,scanner.c,scanner.h,config.h} ./libpcap
29 |
30 | # nDPI
31 | ( cd $SUBMODULES_PATH/nDPI && ./autogen.sh || true; ./configure --host $TARGET --enable-slim --with-only-libndpi )
32 | cp $SUBMODULES_PATH/nDPI/src/include/{ndpi_api.h,ndpi_config.h,ndpi_define.h} ./nDPI
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rule_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/fuzz/fuzz_pcapd.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2021-22 - Emanuele Faranda
18 | */
19 |
20 | #include "pcapd/pcapd_priv.h"
21 |
22 | /* ******************************************************* */
23 |
24 | #include "fuzz_utils.c"
25 |
26 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
27 | pcapd_conf_t conf;
28 | char *pcap_path;
29 |
30 | if(!(pcap_path = buffer_to_tmpfile(Data, Size)))
31 | return -1;
32 |
33 | init_conf(&conf);
34 | conf.ifnames[0] = strdup(pcap_path);
35 | conf.num_interfaces = 1;
36 | conf.no_client = 1;
37 | conf.quiet = 1;
38 |
39 | run_pcap_dump(&conf);
40 |
41 | unlink(pcap_path);
42 | free(pcap_path);
43 |
44 | return 0;
45 | }
46 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/ar/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid هو تطبيق صديق للخصوصية يتيح لك تتبع وتحليل الاتصالات التي تجريها التطبيقات الأخرى في جهازك.
2 | كما يسمح لك بتصدير تفريغ PCAP لحركة المرور، وفحص HTTP، وفك تشفير حركة مرور TLS، وغير ذلك الكثير.
3 |
4 | يحاكي PCAPdroid شبكة VPN لالتقاط حركة مرور الشبكة دون الحاجة إلى الجذر. ولا يستخدم خادم VPN عن بعد، وبدلاً من ذلك تتم معالجة البيانات محليًا على الجهاز.
5 |
6 | الميزات:
7 |
8 | * تسجيل وفحص الاتصالات التي أجراها المستخدم وتطبيقات النظام
9 | * استخرج SNI واستعلام DNS وعنوان URL HTTP وعنوان IP البعيد
10 | * فحص طلبات HTTP والردود بفضل وحدات فك التشفير المضمنة
11 | * فحص حمولة الاتصالات الكاملة كـ hexdump/text
12 | * فك تشفير حركة مرور HTTPS/TLS وتصدير ملف SSLKEYLOGFILE
13 | * تفريغ حركة المرور إلى ملف PCAP، أو تنزيله من متصفح، أو بثه إلى جهاز استقبال بعيد لتحليله في الوقت الفعلي (مثل Wireshark)
14 | * إنشاء قواعد لتصفية حركة المرور الجيدة واكتشاف الحالات الشاذة بسهولة
15 | * تحديد البلد ورقم ASN للخادم البعيد عبر عمليات البحث في قاعدة البيانات دون اتصال بالإنترنت
16 | * على الأجهزة ذات الجذور، يمكنك التقاط حركة المرور أثناء تشغيل تطبيقات VPN الأخرى
17 |
18 | إذا كنت تخطط لاستخدام PCAPdroid لإجراء تحليل الحزم، فيُرجى مراجعة القسم المحدّد من الدليل.
19 |
20 | انضم إلى مجتمع PCAPdroid الدولي على تيليجرام أو على ماتركس.
21 |
--------------------------------------------------------------------------------
/app/src/main/jni/common/uid_resolver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | #ifndef __UID_RESOLVER_H__
21 | #define __UID_RESOLVER_H__
22 |
23 | #include "jni_utils.h"
24 | #include "zdtun.h"
25 |
26 | #define UID_UNKNOWN -1
27 | #define UID_ROOT 0
28 | #define UID_PHONE 1001
29 | #define UID_NETD 1051
30 |
31 | typedef struct uid_resolver uid_resolver_t;
32 |
33 | #ifdef ANDROID
34 | uid_resolver_t* init_uid_resolver(jint sdk_version, JNIEnv *env, jobject vpn);
35 | #endif
36 |
37 | uid_resolver_t* init_uid_resolver_from_proc();
38 | void destroy_uid_resolver(uid_resolver_t *resolver);
39 | int get_uid(uid_resolver_t *resolver, const zdtun_5tuple_t *conn_info);
40 |
41 | #endif // __UID_RESOLVER_H__
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
22 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/fuzz/fuzz_capture.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2021-22 - Emanuele Faranda
18 | */
19 |
20 | #include
21 | #include "core/pcapdroid.h"
22 | #include "common/utils.h"
23 | #include "pcapd/pcapd.h"
24 | #include "test_utils.h"
25 |
26 | /* ******************************************************* */
27 |
28 | #include "fuzz_utils.c"
29 |
30 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
31 | char *pcap_path;
32 |
33 | if(!(pcap_path = buffer_to_tmpfile(Data, Size)))
34 | return -1;
35 |
36 | pcapdroid_t *pd = pd_init_test(pcap_path);
37 |
38 | loglevel = ANDROID_LOG_FATAL;
39 | pd_run(pd);
40 |
41 | pd_free_test(pd);
42 | unlink(pcap_path);
43 | free(pcap_path);
44 |
45 | return 0;
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #7A5EBC
4 | @android:color/tertiary_text_light
5 | @android:color/secondary_text_light
6 | #4527a0
7 | #4D3294
8 | #4527a0
9 | #D81B60
10 | #D8ADBD
11 | #2C000000
12 | @color/design_default_color_surface
13 | @color/background_material_light
14 | #404040
15 | #28BC36
16 | #AAAAAA
17 | #F20015
18 | #0CB350
19 | #FF9800
20 | #F80013
21 | #29b6f6
22 | #000000
23 | #FBEDED
24 | #7F0000
25 | #EDEDFB
26 | #00007F
27 | #aaa
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/interfaces/PcapDumper.java:
--------------------------------------------------------------------------------
1 | package com.emanuelef.remote_capture.interfaces;
2 |
3 | import java.io.IOException;
4 |
5 | /** A dumper implements the ability to dump PCAP data.
6 | * It has the following lifecycle:
7 | *
8 | * startDumper -> ... dumpData ... -> stopDumper
9 | *
10 | * In order to avoid monitoring the dumper traffic (which would cause a loop), a dumper must implement
11 | * the following policy:
12 | * - for root capture, the getBpf method must return a BPF filter to exclude the traffic. This will
13 | * be set at the start of the catpure.
14 | * - for non-root capture, the dumper must pass each socket it opens to the CaptureService.protect
15 | * method.
16 | */
17 | public interface PcapDumper {
18 | /**
19 | * Starts the dumper.
20 | * @throws IOException
21 | */
22 | void startDumper() throws IOException;
23 |
24 | /**
25 | * Terminates the dumper.
26 | * @throws IOException
27 | */
28 | void stopDumper() throws IOException;
29 |
30 | /** Get a BPF to use to ignore the connections made by the dumper.
31 | *
32 | * @return the BPF string
33 | */
34 | String getBpf();
35 |
36 | /**
37 | * Dump an unspecified number of PCAP records. The dumper must check if this is the first data
38 | * sent, in which case it should send the Utils.PCAP_HEADER bofore the PCAP records data.
39 | * @throws IOException
40 | */
41 | void dumpData(byte[] data) throws IOException;
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/apps_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
19 |
20 |
24 |
25 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/en-US/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid is a privacy-friendly app which lets you track and analyze the connections made by the other apps in your device.
2 | It also allows you to export a PCAP dump of the traffic, inspect HTTP, decrypt TLS traffic and much more.
3 |
4 | PCAPdroid simulates a VPN in order to capture the network traffic without root. It does not use a remote VPN server, instead data is processed locally on the device.
5 |
6 | Features:
7 |
8 | * Log and examine the connections made by user and system apps
9 | * Extract the SNI, DNS query, HTTP URL and the remote IP address
10 | * Inspect HTTP requests and replies thanks to the built-in decoders
11 | * Inspect the full connections payload as hexdump/text
12 | * Decrypt the HTTPS/TLS traffic and export the SSLKEYLOGFILE
13 | * Dump the traffic to a PCAP file, download it from a browser, or stream it to a remote receiver for real-time analysis (e.g. Wireshark)
14 | * Create rules to filter out the good traffic and easily spot anomalies
15 | * Identify the country and ASN of remote server via offline DB lookups
16 | * On rooted devices, capture the traffic while other VPN apps are running
17 |
18 | If you plan to use PCAPdroid to perform packet analysis, please check out the specific section of the manual.
19 |
20 | Join the PCAPdroid international community on Telegram or on Matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/Done.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.fragments.mitmwizard;
21 |
22 | import android.os.Bundle;
23 | import android.view.View;
24 |
25 | import androidx.annotation.NonNull;
26 | import androidx.annotation.Nullable;
27 |
28 | import com.emanuelef.remote_capture.MitmAddon;
29 | import com.emanuelef.remote_capture.R;
30 |
31 | public class Done extends StepFragment {
32 | @Override
33 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
34 | super.onViewCreated(view, savedInstanceState);
35 | mStepLabel.setText(R.string.mitm_setup_wizard_done);
36 |
37 | MitmAddon.setDecryptionSetupDone(requireContext(), true);
38 | nextStep(0);
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/activities/AppsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.activities;
21 |
22 | import android.os.Bundle;
23 | import com.emanuelef.remote_capture.R;
24 | import com.emanuelef.remote_capture.fragments.AppsFragment;
25 |
26 | public class AppsActivity extends BaseActivity {
27 | private static final String TAG = "AppsActivity";
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | setTitle(R.string.apps);
34 | setContentView(R.layout.fragment_activity);
35 |
36 | getSupportFragmentManager().beginTransaction()
37 | .replace(R.id.fragment, new AppsFragment())
38 | .commit();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/jni/pcapd/nl_utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2021 - Emanuele Faranda
18 | */
19 |
20 | #ifndef __NL_UTILS_H__
21 | #define __NL_UTILS_H__
22 |
23 | #include
24 | #include
25 |
26 | /* >= 8192 to avoid truncation, see "man 7 netlink" */
27 | #define NL_BUFFER_SIZE 8192
28 |
29 | typedef struct {
30 | union {
31 | uint32_t v4;
32 | uint8_t v6[8];
33 | };
34 | } __attribute__((packed)) addr_t;
35 |
36 | typedef struct {
37 | zdtun_ip_t addr;
38 | uint16_t port;
39 | } pd_sockaddr_t;
40 |
41 | typedef struct {
42 | addr_t gateway;
43 | int ifidx;
44 | int gw_len;
45 | } route_info_t;
46 |
47 | int nl_get_route(int af, const addr_t *addr, route_info_t *out);
48 | int nl_route_socket(uint32_t groups);
49 | int nl_is_diag_working();
50 | int nl_get_uid(int nlsock, const zdtun_5tuple_t *tuple);
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/nb-NO/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid er et personvernsvennlig program som lar deg spore og analysere tilkoblinger godt av andre programmer på enheten din.
2 | Det lar deg også eksportere en PCAP-dump av trafikken, inspisere HTTP, dekryptere TLS-trafikk og mye mer.
3 |
4 | PCAPdroid simulerer en VPN-kanal for å fange nettverkstilgang uten rot-tilgang. Det bruker ikke en VPN-tjener annensteds hen. All data behandles lokalt på enheten.
5 |
6 | Funksjoner:
7 |
8 | * Loggfør og inspiser tilkoblinger gjort av brukeren og systemprogrammer
9 | * Utled SNI, DNS-spørringer, HTTP-nettadresser, og ekstern IP-adresse
10 | * Inspiser HTTP-forespørsler og svar takket være innebygde dekodere
11 | * Inspiser hele nyttelasten til tilkoblinger som heksadesimal dump/tekst
12 | * Dekrypter HTTPS/TLS-trafikk og eksporter SSLKEYLOGFILE
13 | * Dump trafikken til en PCAP-fil, last den ned fra en nettleser, eller strøm den til en fjernmottager for sanntidsanalyse (f.eks. Wireshark)
14 | * Opprett regler for å filtrere ut den legitime trafikken og fang opp unormaliteter
15 | * Indentifiser land og ASN tilhørende tjenere annensteds hen via frakoblede databaseoppslag
16 | * På enheter med rot-tilgang kan du fange trafikk mens andre VPN-programmer kjører
17 |
18 | Hvis du vil bruke PCAPdroid til pakkeanalyse kan du sjekke denne delen av manualen.
19 |
20 | Ta del i gemenskapen på Telegram eller på Matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/pcap_dump/FileDumper.java:
--------------------------------------------------------------------------------
1 | package com.emanuelef.remote_capture.pcap_dump;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | import com.emanuelef.remote_capture.CaptureService;
7 | import com.emanuelef.remote_capture.Log;
8 | import com.emanuelef.remote_capture.interfaces.PcapDumper;
9 |
10 | import java.io.IOException;
11 | import java.io.OutputStream;
12 |
13 | public class FileDumper implements PcapDumper {
14 | public static final String TAG = "FileDumper";
15 | private final Context mContext;
16 | private final Uri mPcapUri;
17 | private boolean mSendHeader;
18 | private OutputStream mOutputStream;
19 |
20 | public FileDumper(Context ctx, Uri pcap_uri) {
21 | mContext = ctx;
22 | mPcapUri = pcap_uri;
23 | mSendHeader = true;
24 | }
25 |
26 | @Override
27 | public void startDumper() throws IOException {
28 | Log.d(TAG, "PCAP URI: " + mPcapUri);
29 | mOutputStream = mContext.getContentResolver().openOutputStream(mPcapUri, "rwt");
30 | }
31 |
32 | @Override
33 | public void stopDumper() throws IOException {
34 | mOutputStream.close();
35 | }
36 |
37 | @Override
38 | public String getBpf() {
39 | return "";
40 | }
41 |
42 | @Override
43 | public void dumpData(byte[] data) throws IOException {
44 | if(mSendHeader) {
45 | mSendHeader = false;
46 | mOutputStream.write(CaptureService.getPcapHeader());
47 | }
48 |
49 | mOutputStream.write(data);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/activities/prefs/PortMapActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-22 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.activities.prefs;
21 |
22 | import android.os.Bundle;
23 |
24 | import com.emanuelef.remote_capture.R;
25 | import com.emanuelef.remote_capture.activities.BaseActivity;
26 | import com.emanuelef.remote_capture.fragments.prefs.PortMapFragment;
27 |
28 | public class PortMapActivity extends BaseActivity {
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setTitle(R.string.port_mapping);
33 | setContentView(R.layout.fragment_activity);
34 |
35 | getSupportFragmentManager().beginTransaction()
36 | .replace(R.id.fragment, new PortMapFragment())
37 | .commit();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/socks5_preferences.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
12 |
18 |
19 |
25 |
26 |
32 |
33 |
38 |
39 |
44 |
45 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/pl-PL/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid to przyjazna dla prywatności aplikacja, która pozwala śledzić i analizować połączenia nawiązywane przez inne aplikacje na Twoim urządzeniu.
2 | Pozwala także eksportować zrzut ruchu PCAP, sprawdzać HTTP, odszyfrowywać ruch TLS i wiele więcej.
3 |
4 | PCAPdroid symuluje VPN w celu przechwytywania ruchu sieciowego bez rootowania. Nie korzysta ze zdalnego serwera VPN, zamiast tego dane są przetwarzane lokalnie na urządzeniu.
5 |
6 | Funkcje:
7 |
8 | * Rejestruj i sprawdzaj połączenia wykonane przez użytkownika i aplikacje systemowe
9 | * Wyodrębnij SNI, zapytanie DNS, adres URL HTTP i zdalny adres IP
10 | * Sprawdzaj żądania i odpowiedzi HTTP dzięki wbudowanym dekoderom
11 | * Sprawdź payload połączeń jako zrzut szesnastkowy/tekst
12 | * Odszyfruj ruch HTTPS/TLS i wyeksportuj SSLKEYLOGFILE
13 | * Zrzuć ruch do pliku PCAP, pobierz go z przeglądarki lub przesyłaj strumieniowo do zdalnego odbiornika w celu analizy w czasie rzeczywistym (np. Wireshark)
14 | * Twórz reguły, aby odfiltrować dobry ruch i łatwo wykryć anomalie
15 | * Zidentyfikuj kraj i ASN zdalnego serwera za pomocą wyszukiwania w bazie danych offline
16 | * Na zrootowanych urządzeniach przechwytuj ruch, gdy działają inne aplikacje VPN
17 |
18 | Jeśli planujesz używać PCAPdroid do przeprowadzania analizy pakietów, sprawdź konkretną sekcję instrukcja.
19 |
20 | Dołącz do międzynarodowej społeczności PCAPdroid na Telegram lub na Matrix.
21 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/pt-BR/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid é um app que respeita sua privacidade, permite rastrear e analisar as conexões feitas pelos apps no seu dispositivo.
2 | Também permite que você exporte o PCAP dump do tráfego, inspecione HTTP, decodifique o tráfego TLS e muito mais.
3 |
4 | PCAPdroid simula uma VPN a fim de capturar o tráfego da rede sem acesso root. Não utiliza nenhum servidor remoto da VPN. Todos os dados são processados localmente no dispositivo.
5 |
6 | Funcionalidades:
7 |
8 | * Regista e examina conexões feitas pelo usuário e apps do sistema
9 | * Extrai SNI, consultas do DNS, URLs e endereços IP remotos
10 | * Inspeciona solicitações e respostas HTTP graças aos decodificadores integrados
11 | * Inspeciona payload completo de conexões via hexdump/texto
12 | * Descriptografa o tráfego HTTPS/TLS e exporta o SSLKEYLOGFILE
13 | * Despeja o tráfego a um arquivo PCAP, pode baixá-lo de um navegador ou transmiti-lo para um receptor remoto para análise em tempo real (p.ex. wireshark)
14 | * Cria regras para filtrar o bom tráfego e detectar facilmente as anomalias
15 | * Identifica o país e o ASN do servidor remoto via buscas offline de db
16 | * Em dispositivos com acesso root, pode capturar o tráfego enquanto outros apps da VPN estão em execução
17 |
18 | Se você planeja usar o PCAPdroid para realizar análise de pacotes, verifique a seção específica do manual.
19 |
20 | Junte-se à comunidade internacional do PCAPdroid no telegram ou no matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/model/AppStats.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.model;
21 |
22 | import androidx.annotation.NonNull;
23 |
24 | public class AppStats implements Cloneable {
25 | private final int uid;
26 | public long sentBytes;
27 | public long rcvdBytes;
28 | public int numConnections;
29 | public int numBlockedConnections;
30 |
31 | public AppStats(int _uid) {
32 | uid = _uid;
33 | }
34 |
35 | public int getUid() {
36 | return uid;
37 | }
38 |
39 | @NonNull
40 | public AppStats clone() {
41 | AppStats rv = new AppStats(uid);
42 | rv.sentBytes = sentBytes;
43 | rv.rcvdBytes = rcvdBytes;
44 | rv.numConnections = numConnections;
45 | rv.numBlockedConnections = numBlockedConnections;
46 |
47 | return rv;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/uk/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid це безпечний для конфіденційності додаток, який дозволяє відстежувати та аналізувати з'єднання, здійснені додатками на вашому пристрої.
2 | Крім того, він дозволяє експортувати PCAP дамп трафіку, перевіряти HTTP, дешифрувати трафік TLS та багато іншого.
3 |
4 | PCAPdroid імітує VPN, щоб перехоплювати мережевий трафік без рут. Він не використовує віддалений сервер VPN, натомість дані обробляються локально на пристрої.
5 |
6 | Можливості:
7 |
8 | * Логувати та досліджувати з'єднання здійснені користувачем і системними додатками
9 | * Витягати SNI, запит DNS, посилання HTTP та віддалену адресу IP
10 | * Перевіряти HTTP запити і відповіді завдяки вбудованим декодерам
11 | * Перевіряти повне корисне навантаження з'єднань як hexdump/текст
12 | * Дешифрувати трафік HTTPS/TLS та експортувати SSLKEYLOGFILE
13 | * Дампувати трафік до файлу PCAP, завантажити його з браузера, чи транслювати його до віддаленого приймача для аналізу в реальному часі (наприклад, Wireshark)
14 | * Створити правила для фільтрування хорошого трафіку і легко визначати ненормальний
15 | * Визначати країну та ASN віддаленого сервера за допомогою офлайн пошуків
16 | * На рутованих пристроях, захоплювати трафік коли виконуються інші додатки VPN
17 |
18 | Якщо ви плануєте використовувати PCAPdroid для аналізування пакету, будь ласка, ознайомтесь з відповідним розділом посібника.
19 |
20 | Приєднуйтесь до міжнародної спільноти PCAPdroid у Telegram чи на Matrix.
21 |
--------------------------------------------------------------------------------
/docs/work_profiles.md:
--------------------------------------------------------------------------------
1 | ## Running in work profiles
2 |
3 | Work profiles allows users to isolate apps. They also allow running multiple VPN at the same time, as each work profile can run a VPNService.
4 |
5 | When PCAPdroid runs in a work profile in VPN mode, it can only capture the traffic of the work profile.
6 |
7 | You can install [Island](https://play.google.com/store/apps/details?id=com.oasisfeng.island) to manage work profiles
8 |
9 | ## Root support
10 |
11 | When running with root, PCAPdroid still captures the traffic of the whole device, regardless if it's installed in the main profile or in the work profile.
12 | To properly map UIDs of apps installed into different profiles, it uses the [INTERACT_ACROSS_USERS permission](https://source.android.com/devices/tech/admin/multiuser-apps),
13 | which is granted on the first root capture start. Apps installed in both the main profile and a work profile will have two different UIDs, and are reported
14 | by PCAPdroid as two different apps.
15 |
16 | In order to properly grant root privileges to PCAPdroid when installed in a work profile, follow these steps:
17 |
18 | 1. In the Magisk manager settings, set Multiuser-mode to "User independent"
19 | 2. Clone the Magisk manager app to the work profile
20 | 3. Start the root capture and grant the root request from magisk dialog
21 |
22 | ## Debugging
23 |
24 | To easily debug PCAPdroid in work profile, create a new run configuration which installs and runs the app into the specific work profile.
25 |
26 | First get the work profile user ID from `adb shell pm list users` (e.g. 10). Then add the `--user 10` parameter to the "Install flags" and "Launch flags" of the new configuration.
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/fragments/mitmwizard/Intro.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.fragments.mitmwizard;
21 |
22 | import android.os.Bundle;
23 | import android.view.View;
24 |
25 | import androidx.annotation.NonNull;
26 | import androidx.annotation.Nullable;
27 |
28 | import com.emanuelef.remote_capture.R;
29 | import com.emanuelef.remote_capture.Utils;
30 | import com.emanuelef.remote_capture.activities.MainActivity;
31 |
32 | public class Intro extends StepFragment {
33 | @Override
34 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
35 | super.onViewCreated(view, savedInstanceState);
36 | mStepIcon.setVisibility(View.GONE);
37 | Utils.setTextUrls(mStepLabel, R.string.mitm_setup_wizard_intro, MainActivity.TLS_DECRYPTION_DOCS_URL);
38 |
39 | nextStep(R.id.navto_install_addon);
40 | }
41 | }
--------------------------------------------------------------------------------
/ICONS_LICENSE/FontAwesome/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Font Awesome Free License
2 | -------------------------
3 |
4 | Font Awesome Free is free, open source, and GPL friendly. You can use it for
5 | commercial projects, open source projects, or really almost whatever you want.
6 | Full Font Awesome Free license: https://fontawesome.com/license/free.
7 |
8 | # Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
9 | In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
10 | packaged as SVG and JS file types.
11 |
12 | # Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
13 | In the Font Awesome Free download, the SIL OFL license applies to all icons
14 | packaged as web and desktop font files.
15 |
16 | # Code: MIT License (https://opensource.org/licenses/MIT)
17 | In the Font Awesome Free download, the MIT license applies to all non-font and
18 | non-icon files.
19 |
20 | # Attribution
21 | Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
22 | Awesome Free files already contain embedded comments with sufficient
23 | attribution, so you shouldn't need to do anything additional when using these
24 | files normally.
25 |
26 | We've kept attribution comments terse, so we ask that you do not actively work
27 | to remove them from files, especially code. They're a great way for folks to
28 | learn about Font Awesome.
29 |
30 | # Brand Icons
31 | All brand icons are trademarks of their respective owners. The use of these
32 | trademarks does not indicate endorsement of the trademark holder by Font
33 | Awesome, nor vice versa. **Please do not use brand logos for any purpose except
34 | to represent the company, product, or service to which they refer.**
35 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/id/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid adalah aplikasi yang ramah privasi yang memungkinkan Anda melacak dan menganalisis koneksi yang dibuat oleh aplikasi lain di perangkat anda.
2 | Ini juga memungkinkan Aada untuk mengekspor PCAP dump dari lalu lintas, memeriksa lalu lintas HTTP, mendekripsi lalu lintas TLS, dan banyak lagi.
3 |
4 | PCAPdroid mensimulasikan VPN untuk menangkap lalu lintas jaringan tanpa perlu akses root. Ini tidak menggunakan server VPN jarak jauh, sebaliknya data diproses secara lokal di perangkat.
5 |
6 | Fitur:
7 |
8 | * Merekam dan memeriksa koneksi yang dibuat oleh aplikasi pengguna dan sistem
9 | * Ekstrak SNI, pertanyaan DNS, URL HTTP, dan alamat IP jarak jauh
10 | * Memeriksa permintaan dan balasan HTTP berkat decoder bawaan
11 | * Memeriksa muatan koneksi lengkap sebagai hexdump/teks
12 | * Mendekripsi lalu lintas HTTPS/TLS dan mengekspor SSLKEYLOGFILE
13 | * Dump lalu lintas ke file PCAP, unduh dari browser, atau alirkan ke penerima jarak jauh untuk analisis waktu nyata (misalnya Wireshark)
14 | * Buat aturan untuk menyaring lalu lintas yang baik dan dengan mudah menemukan anomali
15 | * Identifikasi negara dan ASN dari server jarak jauh melalui pencarian database offline
16 | * Pada perangkat yang sudah di-root, tangkap lalu lintas saat aplikasi VPN lain berjalan
17 |
18 | Jika Anda berencana menggunakan PCAPdroid untuk melakukan analisis paket, silakan cek bagian khusus di manual.
19 |
20 | Bergabunglah dengan komunitas internasional PCAPdroid di Telegram atau di Matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/jni/pcapd/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(pcapd C)
2 |
3 | # libpcap
4 | set(LIBPCAP_ROOT ${ROOTDIR}/submodules/libpcap)
5 | include_directories(${LIBPCAP_ROOT})
6 |
7 | set(LIBPCAP_GEN ${ROOTDIR}/generated/libpcap)
8 | configure_file(${LIBPCAP_GEN}/config.h ${LIBPCAP_ROOT}/config.h)
9 | configure_file(${LIBPCAP_GEN}/grammar.c ${LIBPCAP_ROOT}/grammar.c)
10 | configure_file(${LIBPCAP_GEN}/grammar.h ${LIBPCAP_ROOT}/grammar.h)
11 | configure_file(${LIBPCAP_GEN}/scanner.c ${LIBPCAP_ROOT}/scanner.c)
12 | configure_file(${LIBPCAP_GEN}/scanner.h ${LIBPCAP_ROOT}/scanner.h)
13 |
14 | ADD_LIBRARY(pcap STATIC
15 | ${LIBPCAP_ROOT}/pcap.c
16 | ${LIBPCAP_ROOT}/pcap-common.c
17 | ${LIBPCAP_ROOT}/pcap-util.c
18 | ${LIBPCAP_ROOT}/sf-pcap.c
19 | ${LIBPCAP_ROOT}/sf-pcapng.c
20 | ${LIBPCAP_ROOT}/pcap-linux.c
21 | ${LIBPCAP_ROOT}/fad-gifc.c
22 | ${LIBPCAP_ROOT}/nametoaddr.c
23 | ${LIBPCAP_ROOT}/etherent.c
24 | ${LIBPCAP_ROOT}/savefile.c
25 | ${LIBPCAP_ROOT}/fmtutils.c
26 | ${LIBPCAP_ROOT}/gencode.c
27 | ${LIBPCAP_ROOT}/grammar.c
28 | ${LIBPCAP_ROOT}/scanner.c
29 | ${LIBPCAP_ROOT}/bpf_filter.c
30 | ${LIBPCAP_ROOT}/optimize.c
31 | ${LIBPCAP_ROOT}/missing/strlcpy.c)
32 |
33 | if(FUZZING)
34 | add_library(libpcapd.so SHARED pcapd.c nl_utils.c)
35 | else()
36 | # Executables must be names as libraries to be stored into corresponding native folder
37 | # NOTE: only works if extractNativeLibs is true
38 | add_executable(libpcapd.so pcapd.c nl_utils.c)
39 | endif()
40 |
41 | # Better to link static libs to avoid changing the library path
42 | target_link_libraries(libpcapd.so pcap zdtun common)
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/quick_settings_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
25 |
26 |
36 |
37 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/fuzz_utils.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | /* ******************************************************* */
27 |
28 | /* Creates a temporary file to hold the specified buffer data.
29 | * Returns the file name string. The string must be freed. */
30 | char* buffer_to_tmpfile(const uint8_t *buf, size_t size) {
31 | char fname[] = "/tmp/pcapdroid_testXXXXXX";
32 |
33 | int filedes = mkstemp(fname);
34 | if(filedes < 0) {
35 | perror("mkstemp failed");
36 | return NULL;
37 | }
38 |
39 | FILE *fd = fdopen(filedes, "wb");
40 | if(!fd) {
41 | perror("fdopen failed");
42 | return NULL;
43 | }
44 |
45 | int success = (fwrite(buf, 1, size, fd) == size);
46 |
47 | fclose(fd);
48 | close(filedes);
49 |
50 | if(!success)
51 | return NULL;
52 |
53 | return strdup(fname);
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/activities/ConnectionsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-21 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.activities;
21 |
22 | import android.os.Bundle;
23 |
24 | import com.emanuelef.remote_capture.R;
25 | import com.emanuelef.remote_capture.fragments.ConnectionsFragment;
26 |
27 | public class ConnectionsActivity extends BaseActivity {
28 | private static final String TAG = "ConnectionsActivity";
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setTitle(R.string.connections_view);
34 | displayBackAction(); // Use explicit back to restore the AppDetailsActivity state
35 | setContentView(R.layout.fragment_activity);
36 |
37 | getSupportFragmentManager().beginTransaction()
38 | .replace(R.id.fragment, new ConnectionsFragment())
39 | .commit();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/test/root_capture.c:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | #include "test_utils.h"
21 |
22 | #define NUM_PKTS 15
23 |
24 | /* ******************************************************* */
25 |
26 | /* Tests that invalid/unsupported IP packets are still dumped by PCAPdroid */
27 | static void invalid_pkts() {
28 | pcap_hdr_t hdr;
29 | pcap_rec_t rec;
30 | pcapdroid_t *pd = pd_init_test(PCAP_PATH "/invalid_or_unsupported.pcap");
31 | int num_pkts = 0;
32 |
33 | // Run
34 | pd_dump_to_file(pd);
35 | pd_run(pd);
36 | pd_done_dump();
37 |
38 | // Verify
39 | assert_pcap_header(&hdr);
40 |
41 | while(next_pcap_record(&rec))
42 | num_pkts++;
43 |
44 | assert(num_pkts == NUM_PKTS);
45 | pd_free_test(pd);
46 | }
47 |
48 | /* ******************************************************* */
49 |
50 | int main(int argc, char **argv) {
51 | add_test("invalid_pkts", invalid_pkts);
52 |
53 | run_test(argc, argv);
54 | return 0;
55 | }
56 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/tr/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid, aygıtınızdaki diğer uygulamalar tarafından yapılan bağlantıları izlemenizi ve incelemenizi sağlayan gizlilik dostu bir uygulamadır.
2 | Ayrıca trafiğin PCAP dökümünü dışa aktarmanıza, HTTP'yi incelemenize, TLS trafiğinin şifresini çözmenize ve çok daha fazlasına olanak tanır.
3 |
4 | PCAPdroid, ağ trafiğini root olmadan yakalamak için bir VPN gibi davranır. Uzak bir VPN sunucusu kullanmaz, bunun yerine tüm veriler aygıt üzerinde yerel olarak işlenir.
5 |
6 | Özellikler:
7 |
8 | * Kullanıcı ve sistem uygulamaları tarafından yapılan bağlantıları günlüğe kaydedin ve inceleyin
9 | * SNI, DNS sorgusu, HTTP URL'si ve uzak IP adresini ayıklayın
10 | * Yerleşik kod çözücüler sayesinde HTTP isteklerini ve yanıtlarını inceleyin
11 | * Tam bağlantı yükünü onaltılık dökümü/metin olarak inceleyin
12 | * HTTPS/TLS trafiğinin şifresini çözün ve SSLKEYLOGFILE dosyasını dışa aktarın
13 | * Trafiği bir PCAP dosyasına aktarın, bir tarayıcıdan indirin veya gerçek zamanlı inceleme için uzak bir alıcıya aktarın (örn. Wireshark)
14 | * İyi trafiği filtrelemek ve anormallikleri kolayca tespit etmek için kurallar oluşturun
15 | * Çevrim dışı veri tabanı aramaları aracılığıyla uzak sunucunun ülkesini ve ASN'sini belirleyin
16 | * Root yapılmış aygıtlarda, diğer VPN uygulamaları çalışırken trafiği yakalayın
17 |
18 | Paket incelemesi yapmak için PCAPdroid kullanmayı düşünüyorsanız, lütfen kılavuzun ilgili bölümüne göz atın.
19 |
20 | PCAPdroid uluslararası topluluğuna Telegram veya Matrix üzerinden katılın.
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_installed_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
14 |
19 |
20 |
25 |
32 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/es/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid es una aplicación respetuosa con la privacidad que le permite rastrear y analizar las conexiones realizadas por otras aplicaciones en su dispositivo.
2 | También le permite exportar un volcado PCAP del tráfico, inspeccionar HTTP, descifrar el tráfico TLS y mucho más.
3 |
4 | PCAPdroid simula una VPN para capturar el tráfico de red sin root. No utiliza un servidor VPN remoto, sino que los datos se procesan localmente en el dispositivo.
5 |
6 | Características:
7 |
8 | * Registrar y examinar las conexiones realizadas por el usuario y las aplicaciones del sistema
9 | * Extraiga el SNI, la consulta DNS, la URL HTTP y la dirección IP remota
10 | * Inspeccione las solicitudes y respuestas HTTP gracias a los decodificadores incorporados
11 | * Inspeccionar la carga útil de conexiones completas como hexdump/text
12 | * Descifrar el tráfico HTTPS/TLS y exportar el SSLKEYLOGFILE
13 | * Vuelque el tráfico a un archivo PCAP, descárguelo desde un navegador o transmítalo a un receptor remoto para un análisis en tiempo real (por ejemplo, Wireshark)
14 | * Cree reglas para filtrar el buen tráfico y detectar anomalías fácilmente
15 | * Identifique el país y el ASN del servidor remoto a través de búsquedas de base de datos fuera de línea
16 | * En dispositivos rooteados, capture el tráfico mientras se ejecutan otras aplicaciones VPN
17 |
18 | Si planea usar PCAPdroid para realizar análisis de paquetes, consulte la sección específica de el manual.
19 |
20 | Únase a la comunidad internacional de PCAPdroid enTelegramao enMatrix.
21 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/it/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid è un'app privacy-friendly che ti permette di tracciare e analizzare le connessioni di rete effetuate dalle app nel tuo dispositivo.
2 | Ti permette inoltre di salvare il traffico in formato PCAP, ispezionare l'HTTP, decritta il traffico TLS e molto altro.
3 |
4 | Per funzionare senza root, PCAPdroid simula una connessione VPN. Non viene usato alcun server di VPN remoto. Al contrario, il traffico è processato localmente al dispositivo.
5 |
6 | Funzionalità:
7 |
8 | * Registra ed esamina le connessioni effuttuate dalle app utente e di sistema
9 | * Estrae SNI, query DNS, URL HTTP e l'indirizzo IP del server remoto
10 | * Ispeziona le richieste e le risposte HTTP grazie ai decodificatori integrati
11 | * Ispeziona l'intero contenuto delle connessioni di rete, in formato esadecimale/di testo
12 | * Decritta il traffico HTTPS/TLS ed esporta lo SSLKEYLOGFILE
13 | * Esporta il traffico in un file PCAP, scaricalo tramite un browser o effettuane lo streaming a un collettore remoto per l'analisi in tempo reale (es. Wireshark)
14 | * Crea regole per filtrare il traffico buono e rilevare in maniera semplice possibili anomalie
15 | * Identifica la nazione e l'ASN dei server remoti tramite ricerche in database locali
16 | * Su dispositivi con root, cattura il traffico mentre altre app di VPN sono in esecuzione
17 |
18 | Se utilizzi PCAPdroid per effettuare l'analisi dei pacchetti di rete, fai riferimento alla sezione specifica del manuale.
19 |
20 | Unisciti alla community internazionale di PCAPdroid su telegram o su matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/jni/common/jni_utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | #ifndef __JNI_UTILS_H__
21 | #define __JNI_UTILS_H__
22 |
23 | #ifdef ANDROID
24 |
25 | #include
26 |
27 | jclass jniFindClass(JNIEnv *env, const char *name);
28 | jmethodID jniGetMethodID(JNIEnv *env, jclass cls, const char *name, const char *signature);
29 | jmethodID jniGetStaticMethodID(JNIEnv *env, jclass cls, const char *name, const char *signature);
30 | jfieldID jniFieldID(JNIEnv *env, jclass cls, const char *name, const char *type);
31 | jobject jniEnumVal(JNIEnv *env, const char *class_name, const char *enum_key);
32 | int jniCheckException(JNIEnv *env);
33 | void jniDumpReferences(JNIEnv *env);
34 |
35 | #else // if ANDROID
36 |
37 | #include
38 |
39 | // https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html
40 | typedef uint8_t jboolean;
41 | typedef int8_t jbyte;
42 | typedef int32_t jint;
43 | typedef uint64_t jlong;
44 |
45 | #endif // ANDROID
46 |
47 | #endif // __JNI_UTILS_H__
48 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/ru/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid - это приложение ориентированное на конфиденциальность, которое дает вам возможность отслеживать и анализировать соединения, производимые другими приложениями на вашем устройстве.
2 | Так же, оно позволяет экспортировать PCAP-дамп траффика, анализировать HTTP, дешифровывать TLS и многое другое.
3 |
4 | PCAPdroid симулирует VPN чтобы производить захват траффика без использования root-прав. Он не использует каких-либо удаленных VPN серверов, вместо этого данные обрабатываются локально на устройстве.
5 |
6 | Особенности:
7 |
8 | * Запись и проверка подключений, сделанных пользовательскими и системными приложениями
9 | * Извлечение SNI, DNS-запроса, HTTP-запроса, URL-адреса и удалённого IP-адреса
10 | * Изучение HTTP запросов и ответов благодаря встроенным декодерам
11 | * Изучение полного содержимого соединений в форматах текста или HEX
12 | * Дешифрование HTTPS/TLS траффика и экспорт SSLKEYLOGFILE
13 | * Записывайте траффик в PCAP-файл, скачивайте его браузером или отправляйте потоком на внешний приемник для анализа в реальном времени (например в Wireshark)
14 | * Создание правил для скрытия "хорошего" траффика, чтобы легче было засечь аномалии
15 | * Идентификация стран и ASN удаленных серверов с помощью локальных проверок по базе данных
16 | * На устройствах с root-правами, траффик можно захватывать не прерывая работу другого VPN
17 |
18 | Если вы планируете заниматься анализом пакетов, пожалуйста ознакомьтесь с соответствующим разделом в руководстве пользователя.
19 |
20 | Вы можете присоединиться к международному сообществу PCAPdroid в Telegram или в Matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/fragments/prefs/SettingsSubFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-24 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.fragments.prefs;
21 |
22 | import android.os.Bundle;
23 | import android.view.View;
24 |
25 | import androidx.annotation.NonNull;
26 | import androidx.annotation.Nullable;
27 | import androidx.preference.PreferenceFragmentCompat;
28 |
29 | import com.emanuelef.remote_capture.interfaces.FragmentViewCreatedListener;
30 |
31 | public abstract class SettingsSubFragment extends PreferenceFragmentCompat {
32 | @Override
33 | public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
34 | super.onViewCreated(view, savedInstanceState);
35 |
36 | // insets handling logic
37 | view.setFitsSystemWindows(true);
38 |
39 | // fix for missing insets dispatching
40 | if (getActivity() instanceof FragmentViewCreatedListener)
41 | ((FragmentViewCreatedListener) requireActivity()).onFragmentViewCreated(view);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/jni/pcapd/pcapd.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * You are allowed to distribute this file with your proprietary app
5 | * as long as you provide proper attribution to the PCAPdroid project.
6 | *
7 | * Copyright 2021 - Emanuele Faranda
8 | */
9 |
10 | #ifndef __PCAPD_H__
11 | #define __PCAPD_H__
12 |
13 | #define PCAPD_SOCKET_PATH "pcapsock"
14 | #define PCAPD_PID "pcapd.pid"
15 |
16 | #define PCAPD_FLAG_TX (1 << 0)
17 |
18 | #include
19 | #include
20 |
21 | // Using a snaplen large enough to avoid truncating packets even with TSO/GRO. Size is currently
22 | // limited to 16 bits by pcapd_hdr_t.len
23 | #define PCAPD_SNAPLEN 65535
24 |
25 | // pcap/dlt.h
26 | #define PCAPD_DLT_ETHERNET 1
27 | #define PCAPD_DLT_RAW 12
28 | #define PCAPD_DLT_LINUX_SLL 113
29 | #define PCAPD_DLT_LINUX_SLL2 276
30 |
31 | typedef struct {
32 | struct timeval ts; // the packet timestamp
33 | u_int pkt_drops; // number of dropped packets on this interface
34 | uid_t uid; // the UID of the process which sent/received the packet
35 | uint16_t len; // the packet length
36 | uint16_t linktype; // the link type, see PCAPD_DLT_*
37 | uint8_t flags; // packet flags, see PCAPD_FLAG_*
38 | uint8_t ifid; // the interface id, which is the interface position in the -i args
39 | uint8_t pad[2]; // padding for 64bit alignment of the payload
40 | } __attribute__((packed)) pcapd_hdr_t;
41 |
42 | typedef enum {
43 | PCAPD_OK = 0,
44 | PCAPD_ERROR,
45 | PCAPD_INTERFACE_OPEN_FAILED,
46 | PCAPD_NETLINK_ERROR,
47 | PCAPD_PCAP_READ_ERROR,
48 | PCAPD_SOCKET_WRITE_ERROR,
49 | PCAPD_UNSUPPORTED_DATALINK,
50 | PCAPD_EOF
51 | } pcapd_rv;
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/fastlane/metadata/android/de/full_description.txt:
--------------------------------------------------------------------------------
1 | PCAPdroid ist eine datenschutzfreundliche App, mit der Sie die von anderen Apps auf Ihrem Gerät hergestellten Verbindungen verfolgen und analysieren können.
2 | Es ermöglicht Ihnen auch, einen PCAP-Dump des Datenverkehrs zu exportieren, HTTP zu untersuchen, TLS-Datenverkehr zu entschlüsseln und vieles mehr.
3 |
4 | PCAPdroid simuliert ein VPN, um den Netzwerkverkehr ohne Root abzufangen. Es wird kein Remote-VPN-Server verwendet, sondern die Daten werden lokal auf dem Gerät verarbeitet.
5 |
6 | Eigenschaften:
7 |
8 | * Protokollieren und untersuchen Sie die Verbindungen, die von Benutzer- und System-Apps hergestellt wurden
9 | * Extrahieren Sie SNI, DNS-Abfrage, HTTP-URL und die Remote-IP-Adresse
10 | * Untersuchen Sie HTTP-Anforderungen und -Antworten dank der eingebauten Decoder
11 | * Überprüfen Sie die vollständige Verbindungsnutzlast als Hexdump/Text
12 | * Entschlüsseln Sie den HTTPS/TLS-Verkehr und exportieren Sie die SSLKEYLOGFILE
13 | * Dump den Datenverkehr in eine PCAP-Datei, lade ihn von einem Browser herunter oder streame ihn zur Echtzeitanalyse an einen entfernten Empfänger (z. B. Wireshark)
14 | * Erstellen Sie Regeln, um den guten Verkehr herauszufiltern und Anomalien leicht zu erkennen
15 | * Identifizieren Sie das Land und die ASN des Remote-Servers über Offline-DB-Lookups
16 | * Erfassen Sie auf gerooteten Geräten den Datenverkehr, während andere VPN-Apps ausgeführt werden
17 |
18 | Wenn Sie planen, PCAPdroid zur Durchführung von Paketanalysen zu verwenden, lesen Sie bitte den spezifischen Abschnitt im Handbuch.
19 |
20 | Treten Sie der internationalen PCAPdroid-Community auf Telegram oder auf Matrix.
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_selection_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
26 |
33 |
39 |
40 |
41 |
46 |
47 |
--------------------------------------------------------------------------------
/docs/how_it_works.md:
--------------------------------------------------------------------------------
1 | This document complements the [Packet Analysis](https://emanuele-f.github.io/PCAPdroid/quick_start#14-packet-analysis) section of the user manual to explain how the traffic is managed by PCAPdroid in non-root mode.
2 |
3 | PCAPdroid uses the VPNService to capture the network traffic. When the VPNService is active, the traffic is routed to the PCAPdroid app,
4 | which implements a L4 proxy to connect it back to the Internet. The VPNService alone alters the traffic because it uses a different subnet and network interface.
5 | Moreover, what you see in PCAPdroid or in the generated PCAP file is the traffic which goes from the app to the VPNService, but you cannot see the traffic which goes from the VPNService to the Internet.
6 |
7 | When the app makes a connection, `saddr1:sport1 -> daddr:dport` (the original), PCAPdroid creates a new connection `saddr2:sport2 -> daddr:dport` (the proxied) which goes over the Internet.
8 | The PCAP generated by PCAPdroid only shows the original connection, but if you capture the data on your router you will capture the proxied connection instead.
9 | The obvious difference between the two is that the source IP address and port are different. Actually, since the L4 proxy works by using L4 sockets, the whole IP and TCP header may also be different (apart from the destination IP address and port, which is the same).
10 |
11 | In fact PCAPdroid needs to emulate the TCP features like the TCP window, SEQ and ACK numbers by building fake IP/L4 headers. It does this well enough to trick the app into thinking that it's talking to the remote site, whereas in reality it's talking to the L4 proxy.
12 |
13 | ```
14 | What app thinks:
15 | app <-> Internet
16 |
17 | The reality:
18 | app <-> PCAPDroid (VPNService) <-> Internet
19 | ```
20 |
21 | The L4 proxy cannot determine if the data received from the L4 socket was sent as a single packet or multiple packets from the remote site. This is why you cannot reliably use the generated PCAP to perform per-packet analysis.
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - none
5 | - http_server
6 | - pcap_file
7 | - udp_exporter
8 | - tcp_exporter
9 |
10 |
11 | - @string/no_dump
12 | - @string/http_server
13 | - @string/pcap_file
14 | - @string/udp_exporter
15 | - @string/tcp_exporter
16 |
17 |
18 | - @string/no_dump_info
19 | - @string/http_server_info
20 | - @string/pcap_file_info
21 | - @string/udp_exporter_info
22 | - @string/tcp_exporter_info
23 |
24 |
25 |
26 | - system
27 | - english
28 |
29 |
30 | - @string/system_default
31 | - @string/lang_english
32 |
33 |
34 |
35 | - ipv4
36 | - ipv6
37 | - both
38 |
39 |
40 | - @string/ipv4_only
41 | - @string/ipv6_only
42 | - @string/ip_both
43 |
44 |
45 |
46 | - never
47 | - always
48 | - to_decrypt
49 |
50 |
51 | - @string/never
52 | - @string/always
53 | - @string/for_connections_to_decrypt
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/mitm_wizard_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
21 |
22 |
23 |
28 |
29 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tabs_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
22 |
27 |
28 |
37 |
38 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tabs_activity_fixed.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
20 |
21 |
22 |
27 |
28 |
37 |
38 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/fragments/prefs/DnsSettings.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-22 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.fragments.prefs;
21 | import android.os.Bundle;
22 |
23 | import androidx.annotation.Nullable;
24 | import androidx.preference.EditTextPreference;
25 |
26 | import com.emanuelef.remote_capture.R;
27 | import com.emanuelef.remote_capture.Utils;
28 | import com.emanuelef.remote_capture.model.Prefs;
29 |
30 | import java.util.Objects;
31 |
32 | public class DnsSettings extends SettingsSubFragment {
33 | @Override
34 | public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
35 | setPreferencesFromResource(R.xml.dns_preferences, rootKey);
36 |
37 | EditTextPreference p1 = Objects.requireNonNull(findPreference(Prefs.PREF_DNS_SERVER_V4));
38 | p1.setOnPreferenceChangeListener((preference, newValue) -> Utils.validateIpv4Address(newValue.toString()));
39 |
40 | EditTextPreference p2 = Objects.requireNonNull(findPreference(Prefs.PREF_DNS_SERVER_V6));
41 | p2.setOnPreferenceChangeListener((preference, newValue) -> {
42 | String ip = newValue.toString();
43 | return !ip.equals("::") && Utils.validateIpv6Address(ip);
44 | });
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/port_mapping_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
30 |
31 |
38 |
39 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/jni/core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(core)
2 |
3 | add_library(capture SHARED
4 | pcapdroid.c
5 | capture_vpn.c
6 | capture_pcap.c
7 | ip_lru.c
8 | ndpi_config.c
9 | crc32.c
10 | blacklist.c
11 | pcap_dump.c
12 | pcap_reader.c
13 | log_writer.c
14 | port_map.c
15 | ushark_dll.c
16 | jni_impl.c)
17 |
18 | # nDPI
19 | add_definitions(-DNDPI_LIB_COMPILATION)
20 | add_definitions(-D__bswap_64=bswap_64)
21 | AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib ndpiSources)
22 | AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib/third_party/src ndpiSources)
23 | AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib/third_party/src/hll ndpiSources)
24 | AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib/protocols ndpiSources)
25 |
26 | # slim build, see nDPI lib/Makefile.in
27 | add_definitions(-DNDPI_SLIM)
28 | list(REMOVE_ITEM ndpiSources
29 | ${NDPI_ROOT}/src/lib/third_party/src/libinjection_html5.c
30 | ${NDPI_ROOT}/src/lib/third_party/src/libinjection_xss.c
31 | ${NDPI_ROOT}/src/lib/third_party/src/libinjection_sqli.c
32 | ${NDPI_ROOT}/src/lib/third_party/src/roaring.c
33 | ${NDPI_ROOT}/src/lib/third_party/src/roaring_v2.c
34 | ${NDPI_ROOT}/src/lib/ndpi_bitmap.c
35 | ${NDPI_ROOT}/src/lib/ndpi_bitmap64_fuse.c
36 | ${NDPI_ROOT}/src/lib/ndpi_binary_bitmap.c
37 | ${NDPI_ROOT}/src/lib/ndpi_filter.c)
38 |
39 | set(NDPI_GEN ${ROOTDIR}/generated/nDPI)
40 | configure_file(${NDPI_GEN}/ndpi_api.h ${NDPI_ROOT}/src/include/ndpi_api.h)
41 | configure_file(${NDPI_GEN}/ndpi_config.h ${NDPI_ROOT}/src/include/ndpi_config.h)
42 | configure_file(${NDPI_GEN}/ndpi_define.h ${NDPI_ROOT}/src/include/ndpi_define.h)
43 |
44 | ADD_LIBRARY(ndpi SHARED ${ndpiSources} ${NDPI_ROOT}/src/include/ndpi_api.h)
45 |
46 | if(ANDROID)
47 | find_library(log-lib log)
48 | set(extra-libs ${log-lib})
49 | else()
50 | set(extra-libs "pthread" "m")
51 | endif()
52 |
53 | target_link_libraries(capture
54 | zdtun
55 | ndpi
56 | common
57 | ${extra-libs})
58 |
--------------------------------------------------------------------------------
/app/src/main/jni/tests/test_utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | #ifndef __TEST_UTILS_H__
21 | #define __TEST_UTILS_H__
22 |
23 | #include "core/pcapdroid.h"
24 | #include "core/pcap_dump.h"
25 | #include "common/memtrack.h"
26 | #include
27 |
28 | #define assert0(x) assert((x) == 0)
29 | #define assert1(x) assert((x) == 1)
30 | #define assert_ip_equal(ipver, a, b) assert(zdtun_cmp_ip((ipver), (a), (b)) == 0)
31 |
32 | #define PCAP_PATH "../../../pcap"
33 | #define PCAP_OUT_PATH "/tmp/pcapdroid_test_out.pcap"
34 |
35 | void add_test(const char *name, void (*test_cb)());
36 | void run_test(int argc, char **argv);
37 |
38 | typedef struct payload_chunk {
39 | u_char *payload;
40 | int size;
41 | bool is_tx;
42 | struct payload_chunk *next;
43 | } payload_chunk_t;
44 |
45 | pcapdroid_t* pd_init_test(const char *ifname);
46 | void pd_free_test(pcapdroid_t *pd);
47 |
48 | // PCAP dump
49 | void pd_dump_to_file(pcapdroid_t *pd);
50 | void pd_done_dump();
51 | void assert_pcap_header(pcap_hdr_t *hdr);
52 | u_char* next_pcap_record(pcap_rec_t *rec);
53 |
54 | // Callbacks
55 | bool dump_cb_payload_chunk(pcapdroid_t *pd, const pkt_context_t *pctx, const char *dump_data, int dump_size);
56 |
57 | conn_and_tuple_t* assert_conn(pcapdroid_t *pd, int ipproto, const char *dst_ip, uint16_t dst_port, const char *info);
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/model/PayloadChunk.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2020-22 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture.model;
21 |
22 | import java.io.Serializable;
23 |
24 | // A piece of payload. It may or may not correspond to a packet
25 | public class PayloadChunk implements Serializable {
26 | public byte[] payload;
27 | public boolean is_sent;
28 | public long timestamp;
29 | public ChunkType type;
30 | public String contentType;
31 | public String path;
32 |
33 | // Serializable need in ConnectionPayload fragment
34 | public enum ChunkType implements Serializable {
35 | RAW,
36 | HTTP,
37 | WEBSOCKET
38 | }
39 |
40 | public PayloadChunk(byte[] _payload, ChunkType _type, boolean _is_sent, long _timestamp) {
41 | payload = _payload;
42 | type = _type;
43 | is_sent = _is_sent;
44 | timestamp = _timestamp;
45 | }
46 |
47 | public PayloadChunk subchunk(int start, int size) {
48 | byte[] subarr = new byte[size];
49 | System.arraycopy(payload, start, subarr, 0, size);
50 | return new PayloadChunk(subarr, type, is_sent, timestamp);
51 | }
52 |
53 | public PayloadChunk withPayload(byte[] the_payload) {
54 | return new PayloadChunk(the_payload, type, is_sent, timestamp);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/test/java/com/emanuelef/remote_capture/Whitebox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007 Mockito contributors
3 | * This program is made available under the terms of the MIT License.
4 | */
5 | package com.emanuelef.remote_capture;
6 |
7 | import java.lang.reflect.Field;
8 |
9 | public class Whitebox {
10 |
11 | public static Object getInternalState(Object target, String field) {
12 | Class> c = target.getClass();
13 | try {
14 | Field f = getFieldFromHierarchy(c, field);
15 | f.setAccessible(true);
16 | return f.get(target);
17 | } catch (Exception e) {
18 | throw new RuntimeException("Unable to set internal state on a private field. Please report to mockito mailing list.", e);
19 | }
20 | }
21 |
22 | public static void setInternalState(Object target, String field, Object value) {
23 | Class> c = target.getClass();
24 | try {
25 | Field f = getFieldFromHierarchy(c, field);
26 | f.setAccessible(true);
27 | f.set(target, value);
28 | } catch (Exception e) {
29 | throw new RuntimeException("Unable to set internal state on a private field. Please report to mockito mailing list.", e);
30 | }
31 | }
32 |
33 | private static Field getFieldFromHierarchy(Class> clazz, String field) {
34 | Field f = getField(clazz, field);
35 | while (f == null && clazz != Object.class) {
36 | clazz = clazz.getSuperclass();
37 | f = getField(clazz, field);
38 | }
39 | if (f == null) {
40 | throw new RuntimeException(
41 | "You want me to set value to this field: '" + field +
42 | "' on this class: '" + clazz.getSimpleName() +
43 | "' but this field is not declared withing hierarchy of this class!");
44 | }
45 | return f;
46 | }
47 |
48 | private static Field getField(Class> clazz, String field) {
49 | try {
50 | return clazz.getDeclaredField(field);
51 | } catch (NoSuchFieldException e) {
52 | return null;
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/app/src/main/res/navigation/mitm_wizard_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
19 |
20 |
21 |
25 |
32 |
33 |
34 |
38 |
45 |
46 |
47 |
51 |
--------------------------------------------------------------------------------
/app/src/test/java/com/emanuelef/remote_capture/UtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture;
21 |
22 | import org.junit.Test;
23 |
24 | import static org.junit.Assert.assertTrue;
25 | import static org.junit.Assert.assertFalse;
26 |
27 | public class UtilsTest {
28 | @Test
29 | public void subnetContainsIpv4() {
30 | assertTrue(Utils.subnetContains("192.168.1.1", 24, "192.168.1.0"));
31 | assertTrue(Utils.subnetContains("192.168.1.20", 24, "192.168.1.255"));
32 | assertTrue(Utils.subnetContains("192.168.1.0", 24, "192.168.1.128"));
33 | assertTrue(Utils.subnetContains("10.0.0.0", 8, "10.0.2.0"));
34 | assertTrue(Utils.subnetContains("127.0.0.0", 8, "127.0.0.1"));
35 | assertTrue(Utils.subnetContains("192.168.1.123", 32, "192.168.1.123"));
36 |
37 | assertFalse(Utils.subnetContains("192.168.1.0", 24, "192.168.0.0"));
38 | assertFalse(Utils.subnetContains("192.168.1.0", 24, "192.168.0.255"));
39 | }
40 |
41 | @Test
42 | public void subnetContainsIpv6() {
43 | assertTrue(Utils.subnetContains("2001:0db8:85a3::8a2e:0370:7334", 128, "2001:0db8:85a3::8a2e:0370:7334"));
44 | assertTrue(Utils.subnetContains("2001:0db8:85a3::8a2e:0370:7334", 112, "2001:0db8:85a3::8a2e:0370:0001"));
45 | assertTrue(Utils.subnetContains("2001:0db8:85a3::8a2e:0370:7334", 64, "2001:0db8:85a3::8a2e:0370:0001"));
46 |
47 | assertFalse(Utils.subnetContains("2001:0db8:85a3::8a2e:0370:7334", 120, "2001:0db8:85a3::8a2e:0370:0001"));
48 | }
49 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/add_rule_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
23 |
24 |
31 |
32 |
33 |
42 |
43 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/emanuelef/remote_capture/ActionReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of PCAPdroid.
3 | *
4 | * PCAPdroid is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * PCAPdroid is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with PCAPdroid. If not, see .
16 | *
17 | * Copyright 2022 - Emanuele Faranda
18 | */
19 |
20 | package com.emanuelef.remote_capture;
21 |
22 | import android.content.BroadcastReceiver;
23 | import android.content.Context;
24 | import android.content.Intent;
25 |
26 | import androidx.core.app.NotificationManagerCompat;
27 |
28 | import com.emanuelef.remote_capture.model.AppDescriptor;
29 | import com.emanuelef.remote_capture.model.Blocklist;
30 |
31 | public class ActionReceiver extends BroadcastReceiver {
32 | public static final String EXTRA_UNBLOCK_APP = "unblock_app";
33 | private static final String TAG = "TAG";
34 |
35 | @Override
36 | public void onReceive(Context context, Intent intent) {
37 | String unblock_app = intent.getStringExtra(EXTRA_UNBLOCK_APP);
38 |
39 | if((unblock_app != null) && !unblock_app.isEmpty()) {
40 | Log.d(TAG, "unblock_app: " + unblock_app);
41 | Blocklist blocklist = PCAPdroid.getInstance().getBlocklist();
42 | blocklist.removeApp(unblock_app);
43 | blocklist.saveAndReload();
44 |
45 | // remove notification
46 | NotificationManagerCompat man = NotificationManagerCompat.from(context);
47 | man.cancel(CaptureService.NOTIFY_ID_APP_BLOCKED);
48 |
49 | AppDescriptor app = AppsResolver.resolveInstalledApp(context.getPackageManager(), unblock_app, 0);
50 | String label = (app != null) ? app.getName() : unblock_app;
51 | Utils.showToastLong(context, R.string.app_unblocked, label);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/nav_items.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
12 |
16 |
20 |
24 |
28 |
33 |
34 |
35 |
39 |
43 |
47 |
51 |
55 |
56 |
--------------------------------------------------------------------------------