Three issues raised by ultrareview on top of the previous review pass:
1. (regression) findPidByLocalTcpPort accepted any TCP socket whose
insi_lport matched, including LISTEN sockets. The original
`lsof | grep "${port}->"` excluded LISTEN entries implicitly via the
"->" filter (LISTEN renders as `*:port (LISTEN)`, no `->`). When a
long-running daemon LISTENs on a port that coincides with a client's
ephemeral source port, proc_listpids hits the lower-PID daemon first
and misattributes the request; with the new 30s pid cache the wrong
PID stuck for 30s of follow-up requests. Now skip sockets with
insi_fport == 0 (the LISTEN signature) to mirror the old grep filter
exactly.
2. (pre-existing) getProcess in the macOS path unconditionally appended
".app" to the executable path, producing non-existent paths like
"/usr/bin/curl.app" for non-bundle binaries. This poisoned the icon
cache with empty bytes for 5 minutes. Now only append when the path
actually contains ".app/"; standalone binaries use the executable
path verbatim.
3. (nit) pidBuf/sockBuf were allocated before the outer try, leaking on
the (extremely rare) case that the second calloc throws. Moved both
allocations inside the try with null-aware free in finally, matching
the pattern the inner fdBuf loop already uses.
Verified:
- LISTEN-only port -> FFI returns null (matches lsof+grep behavior)
- ESTABLISHED outbound -> FFI returns the correct client PID
- 500 concurrent curl through proxy -> single ProxyPin process, no
fork leaks (original #763 fix preserved)
ProxyPin
English | 中文
Open source free traffic capture HTTP(S),Support Windows、Mac、Android、IOS、Linux Full platform system
You can use it to intercept, inspect & rewrite HTTP(S) traffic, Support capturing Flutter app traffic, ProxyPin is based on Flutter develop, and the UI is beautiful and easy to use.
Features
- Mobile scan code connection: no need to manually configure WiFi proxy, including configuration synchronization. All terminals can scan codes to connect and forward traffic to each other.
- Domain name filtering: Only intercept the traffic you need, and do not intercept other traffic to avoid interference with other applications.
- Search: Search requests according to keywords, response types and other conditions
- Script: Support writing JavaScript scripts to process requests or responses.
- Request Rewrite: Support redirection, support replacement of request or response message, and can also modify request or response according to the increase.
- Request Mapping: Do not request remote services, use local configuration or scripts for response
- Request Decryption: Configure AES decryption key to automatically decrypt HTTP message body
- Request Blocking: Support blocking requests according to URL, and do not send requests to the server.
- History: Automatically save the captured traffic data for easy backtracking and viewing. Support HAR format export and import.
- Others: Favorites, toolbox, common encoding tools, as well as QR codes, regular expressions, etc.
Mac will prompt untrusted developers when first opened, you need to go to System Preferences-Security & Privacy-Allow any source.
Sponsors
If ProxyPin is helpful to you, you are welcome to support us in the following ways to help the project develop in the long term:
- Buy Me A Coffee
- AFDIAN
- Submit feedback and suggestions to help us improve
- Contribute code or documentation to the project
Your support will be used for project maintenance, feature development, and user experience optimization. Thank you very much!
Downloads
Github Releases: https://github.com/wanghongenpin/proxypin/releases
iOS App Store:https://apps.apple.com/app/proxypin/id6450932949
Android Google Play:https://play.google.com/store/apps/details?id=com.network.proxy
We will continue to improve the features and experience, as well as optimize the UI.