ProxymanApp / ProxymanApp/Proxyman
Scripting Feature
Open
@NghiaTranUIT is already working on this.
Since Jul 19, 2020.
✅ Done
Feature request
- Dominant language
- No language data
- Stars
- 7k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Description
Description
It's time to implement the Scripting feature on Proxyman, which allows Proxyam-ers to write JS Scripting code to inject to Proxyman and manipulate the Request and Response on the fly.
It's designed to replace the UI Rewrite tools from Charles Proxy since the UI is complicated and hard to use.
There are three hooks to write JS:
- Matching
/// Determine if the flow is matched
/// The matched requested will trigger the `onRequest()` or `onResponse()` function
function isMatching(request) {
// You can use Regex or simple if statement
// requests contains host, header and body
if (request.url.host == "proxyman.io") {
return true;
}
return false
}
- On Request
/// Return true will trigger the OnRequest()
function isHookRequest(request) {
return false;
}
/// This func is called if isHookRequest returns true
/// You can manipulate the request's header, body, query or host, path here
function onRequest(request) {
// add new header
request.headers["New-Header"] = "New-Value";
// Change Query param
request.query["name"] = nghia;
// Done
return request;
}
- On Response
/// Return true will trigger the onResponse()
function isHookResponse(response) {
return false;
}
/// This func is called if isHookRequest returns true
/// You can manipulate the request's header, body, query or host, path here
function onResponse(response) {
// Update new content-type
request.headers["Content-Type"] = "application/json";
// Done
return request;
}
Acceptance Criteria
- Allow creating Scripting Rule
- Support Scripting UI, has the Rule panel, Rule List and the Editor (Like Map Local)
- Able to run JS
- Able to hook into the Proxyman's core
- Save scripting locally
- ...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.