Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sunlulu427/httpinterceptor

A http/https interceptor via xposed framework, record http/https requests.
https://github.com/sunlulu427/httpinterceptor

android kotlin lsposed okhttp3 sqlite xposed

Last synced: 24 days ago
JSON representation

A http/https interceptor via xposed framework, record http/https requests.

Awesome Lists containing this project

README

        

[![Kotlin](https://img.shields.io/badge/Kotlin-1.7.21-blue.svg?style=flat&logo=kotlin)](https://kotlinlang.org) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit) ![Latest Release](https://img.shields.io/github/v/release/sunlulu427/HttpInterceptor?include_prereleases)

# Http Interceptor

This project is a http/https requests hook tool for apps with okhttp3.

## Features
- [x] Enable http/https requests hook for all the apps used okhttp3.
- [x] Support text/json/xml style requests, and save them to Android built-in SQLite.
- [x] Used BroadcastReceiver to receive instructions for controlling flow, such as start, stop, info, delete...
- [x] Support sticky events: before your send start instruction, the requests will be cached, and when you start with parameter "--ez sticky true", the cached requests will be saved to the database.

## Setup




  1. Get a rooted Android mobile phone.

  2. Installed Magisk and LSPosed Framework.

  3. Download the latest release apk and install it.

  4. Activate the apk as a plugin in LSPosed.

  5. Select apps you want to hook.

  6. Send instructions via abd shell to control flow.




select apps in lsposed

## How to use

### Instructions
This tool uses adb shell to send instructions to control the flow. For example, you can get started
via `adb shell am broadcast -a com.mato.http.interceptor.start`.

Supported instructions:


name
action
parameters
sample


start
com.mato.http.interceptor.start
sticky: bool






stop
com.mato.http.interceptor.stop
-



delete
com.mato.http.interceptor.delete
-



info
com.mato.http.interceptor.info
-

### Preview
1. Use the `info` instruction to show .db file location and basic info.
```sh
❯ adb shell am broadcast -a com.mato.http.interceptor.info
Broadcasting: Intent { act=com.mato.http.interceptor.info flg=0x400000 }
Broadcast completed: result=0
```
2. Then, you will get the output from console/logcat. (Filter: `LSPosed-Bridge`). In this case, the .db file path is `/data/user/0/com.xingin.xhs/databases/net_request.db`.
```text
10-22 16:32:47.988 17937 19077 I LSPosed-Bridge: onReceive: context=android.app.ContextImpl@958937e, intent=Intent { act=com.mato.http.interceptor.info flg=0x400010 }
10-22 16:32:47.990 17937 19077 I LSPosed-Bridge: DatabaseInfo(filePath=/data/user/0/com.xingin.xhs/databases/net_request.db, fileSize=20480, pageSize=4096, version=3, entries=0, cache=30)
```
3. Use adb to pull the file to PC. If the .db file cannot be pulled directly, copy it to other directory first.
```sh
❯ adb shell
earth:/ $ su root
earth:/ # cp /data/user/0/com.xingin.xhs/databases/net_request.db /sdcard/
earth:/ # ^D
earth:/ $ ^D
❯ adb pull /sdcard/net_request.db ~/Desktop
/sdcard/net_request.db: 1 file pulled, 0 skipped. 1.9 MB/s (20480 bytes in 0.010s)
```
4. Preview the .db file in [DB Broswer for SQLite](https://sqlitebrowser.org/). Click **[Open Database]**, **[Browse Data]** and select table **requests**.
![docs/preview_db.png](docs/preview_db.png)
5. Execute SQL on your demand.
![docs/sample_sql.png](docs/sample_sql.png)
## How it works
![workflow.png](docs/worflow.png)

## Contributors

Thank you all for your work! ❤️