mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-23 20:31:25 +00:00
update readme and doc
This commit is contained in:
parent
4be5aa8954
commit
3022f1de18
@ -22,7 +22,7 @@ AnyProxy是一个基于NodeJS的,可供插件配置的HTTP/HTTPS代理服务
|
|||||||
|
|
||||||
主页:[AnyProxy.io](http://anyproxy.io)
|
主页:[AnyProxy.io](http://anyproxy.io)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
|||||||
* 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑
|
* 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑
|
||||||
* 支持Https的解析
|
* 支持Https的解析
|
||||||
* 提供GUI界面,用以观察请求
|
* 提供GUI界面,用以观察请求
|
||||||
|
|
||||||
相比3.x版本,AnyProxy 4.0的主要变化:
|
相比3.x版本,AnyProxy 4.0的主要变化:
|
||||||
|
|
||||||
* 规则文件(Rule)全面支持Promise和Generator
|
* 规则文件(Rule)全面支持Promise和Generator
|
||||||
@ -29,7 +30,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
|||||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
然后,安装AnyProxy
|
然后,安装AnyProxy
|
||||||
@ -223,19 +224,11 @@ AnyProxy提供了二次开发的能力,你可以用js编写自己的规则模
|
|||||||
```js
|
```js
|
||||||
// file: sample.js
|
// file: sample.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
summary: 'a rule to modify response',
|
summary: 'a rule to hack response',
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||||
const newResponse = responseDetail.response;
|
const newResponse = responseDetail.response;
|
||||||
newResponse.body += '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>';
|
newResponse.body += '- AnyProxy Hacked!';
|
||||||
|
|
||||||
newResponse.body += `<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`;
|
|
||||||
newResponse.header['Content-Type'] = 'text/html';
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => { // delay
|
setTimeout(() => { // delay
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
然后,安装AnyProxy
|
然后,安装AnyProxy
|
||||||
|
@ -14,6 +14,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
|||||||
* 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑
|
* 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑
|
||||||
* 支持Https的解析
|
* 支持Https的解析
|
||||||
* 提供GUI界面,用以观察请求
|
* 提供GUI界面,用以观察请求
|
||||||
|
|
||||||
相比3.x版本,AnyProxy 4.0的主要变化:
|
相比3.x版本,AnyProxy 4.0的主要变化:
|
||||||
|
|
||||||
* 规则文件(Rule)全面支持Promise和Generator
|
* 规则文件(Rule)全面支持Promise和Generator
|
||||||
@ -29,7 +30,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
|||||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
然后,安装AnyProxy
|
然后,安装AnyProxy
|
||||||
@ -223,19 +224,11 @@ AnyProxy提供了二次开发的能力,你可以用js编写自己的规则模
|
|||||||
```js
|
```js
|
||||||
// file: sample.js
|
// file: sample.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
summary: 'a rule to modify response',
|
summary: 'a rule to hack response',
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||||
const newResponse = responseDetail.response;
|
const newResponse = responseDetail.response;
|
||||||
newResponse.body += '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>';
|
newResponse.body += '- AnyProxy Hacked!';
|
||||||
|
|
||||||
newResponse.body += `<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`;
|
|
||||||
newResponse.header['Content-Type'] = 'text/html';
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => { // delay
|
setTimeout(() => { // delay
|
||||||
|
@ -29,7 +29,7 @@ Change Logs since 3.x:
|
|||||||
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
Then install the AnyProxy
|
Then install the AnyProxy
|
||||||
@ -222,20 +222,11 @@ Rule module could do the following stuff:
|
|||||||
```js
|
```js
|
||||||
// file: sample.js
|
// file: sample.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
summary: 'a rule to modify response',
|
summary: 'a rule to hack response',
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||||
const newResponse = responseDetail.response;
|
const newResponse = responseDetail.response;
|
||||||
|
newResponse.body += '- AnyProxy Hacked!';
|
||||||
newResponse.body += '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>';
|
|
||||||
|
|
||||||
newResponse.body += `<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`;
|
|
||||||
newResponse.header['Content-Type'] = 'text/html';
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => { // delay
|
setTimeout(() => { // delay
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
Then install the AnyProxy
|
Then install the AnyProxy
|
||||||
|
@ -29,7 +29,7 @@ Change Logs since 3.x:
|
|||||||
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
Then install the AnyProxy
|
Then install the AnyProxy
|
||||||
@ -222,20 +222,11 @@ Rule module could do the following stuff:
|
|||||||
```js
|
```js
|
||||||
// file: sample.js
|
// file: sample.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
summary: 'a rule to modify response',
|
summary: 'a rule to hack response',
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||||
const newResponse = responseDetail.response;
|
const newResponse = responseDetail.response;
|
||||||
|
newResponse.body += '- AnyProxy Hacked!';
|
||||||
newResponse.body += '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>';
|
|
||||||
|
|
||||||
newResponse.body += `<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`;
|
|
||||||
newResponse.header['Content-Type'] = 'text/html';
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => { // delay
|
setTimeout(() => { // delay
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
然后,安装AnyProxy
|
然后,安装AnyProxy
|
||||||
|
@ -755,11 +755,11 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>基于Node.js,开放二次开发能力,允许自定义请求处理逻辑</li>
|
<li>基于Node.js,开放二次开发能力,允许自定义请求处理逻辑</li>
|
||||||
<li>支持Https的解析</li>
|
<li>支持Https的解析</li>
|
||||||
<li><p>提供GUI界面,用以观察请求
|
<li>提供GUI界面,用以观察请求</li>
|
||||||
相比3.x版本,AnyProxy 4.0的主要变化:</p>
|
</ul>
|
||||||
</li>
|
<p>相比3.x版本,AnyProxy 4.0的主要变化:</p>
|
||||||
<li><p>规则文件(Rule)全面支持Promise和Generator</p>
|
<ul>
|
||||||
</li>
|
<li>规则文件(Rule)全面支持Promise和Generator</li>
|
||||||
<li>简化了规则文件内的接口</li>
|
<li>简化了规则文件内的接口</li>
|
||||||
<li>Web版界面重构</li>
|
<li>Web版界面重构</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -768,7 +768,7 @@
|
|||||||
<h2 id="作为全局模块">作为全局模块</h2>
|
<h2 id="作为全局模块">作为全局模块</h2>
|
||||||
<h3 id="安装">安装</h3>
|
<h3 id="安装">安装</h3>
|
||||||
<p>对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 <code>nodejs-legacy</code></p>
|
<p>对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 <code>nodejs-legacy</code></p>
|
||||||
<pre><code class="lang-bash">sudo apg-get install nodejs-legacy
|
<pre><code class="lang-bash">sudo apt-get install nodejs-legacy
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>然后,安装AnyProxy</p>
|
<p>然后,安装AnyProxy</p>
|
||||||
<pre><code class="lang-bash">npm install -g anyproxy
|
<pre><code class="lang-bash">npm install -g anyproxy
|
||||||
@ -974,19 +974,11 @@ anyproxy --intercept <span class="hljs-comment">#启动AnyProxy,
|
|||||||
<li><p>Step 1,编写规则</p>
|
<li><p>Step 1,编写规则</p>
|
||||||
<pre><code class="lang-js"><span class="hljs-comment">// file: sample.js</span>
|
<pre><code class="lang-js"><span class="hljs-comment">// file: sample.js</span>
|
||||||
<span class="hljs-built_in">module</span>.exports = {
|
<span class="hljs-built_in">module</span>.exports = {
|
||||||
summary: <span class="hljs-string">'a rule to modify response'</span>,
|
summary: <span class="hljs-string">'a rule to hack response'</span>,
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
<span class="hljs-keyword">if</span> (requestDetail.url === <span class="hljs-string">'http://httpbin.org/user-agent'</span>) {
|
<span class="hljs-keyword">if</span> (requestDetail.url === <span class="hljs-string">'http://httpbin.org/user-agent'</span>) {
|
||||||
<span class="hljs-keyword">const</span> newResponse = responseDetail.response;
|
<span class="hljs-keyword">const</span> newResponse = responseDetail.response;
|
||||||
newResponse.body += <span class="hljs-string">'<br/><span style="color:blue">-- AnyProxy Hacked! --</span>'</span>;
|
newResponse.body += <span class="hljs-string">'- AnyProxy Hacked!'</span>;
|
||||||
|
|
||||||
newResponse.body += <span class="hljs-string">`<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`</span>;
|
|
||||||
newResponse.header[<span class="hljs-string">'Content-Type'</span>] = <span class="hljs-string">'text/html'</span>;
|
|
||||||
|
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>((resolve, reject) => {
|
<span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>((resolve, reject) => {
|
||||||
setTimeout(() => { <span class="hljs-comment">// delay</span>
|
setTimeout(() => { <span class="hljs-comment">// delay</span>
|
||||||
@ -1632,7 +1624,7 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</spa
|
|||||||
<script>
|
<script>
|
||||||
var gitbook = gitbook || [];
|
var gitbook = gitbook || [];
|
||||||
gitbook.push(function() {
|
gitbook.push(function() {
|
||||||
gitbook.page.hasChanged({"page":{"title":"简介","level":"1.1","depth":1,"next":{"title":"快速开始","level":"1.2","depth":1,"anchor":"#快速开始","path":"README.md","ref":"README.md#快速开始","articles":[{"title":"安装","level":"1.2.1","depth":2,"anchor":"#安装","path":"README.md","ref":"README.md#安装","articles":[]},{"title":"启动","level":"1.2.2","depth":2,"anchor":"#启动","path":"README.md","ref":"README.md#启动","articles":[]},{"title":"其他命令","level":"1.2.3","depth":2,"anchor":"#其他命令","path":"README.md","ref":"README.md#其他命令","articles":[]},{"title":"作为npm模块启动","level":"1.2.4","depth":2,"anchor":"#作为npm模块使用","path":"README.md","ref":"README.md#作为npm模块使用","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"cn","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2017-12-01T13:25:56.899Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-12-01T13:25:58.040Z"},"basePath":".","book":{"language":"cn"}});
|
gitbook.page.hasChanged({"page":{"title":"简介","level":"1.1","depth":1,"next":{"title":"快速开始","level":"1.2","depth":1,"anchor":"#快速开始","path":"README.md","ref":"README.md#快速开始","articles":[{"title":"安装","level":"1.2.1","depth":2,"anchor":"#安装","path":"README.md","ref":"README.md#安装","articles":[]},{"title":"启动","level":"1.2.2","depth":2,"anchor":"#启动","path":"README.md","ref":"README.md#启动","articles":[]},{"title":"其他命令","level":"1.2.3","depth":2,"anchor":"#其他命令","path":"README.md","ref":"README.md#其他命令","articles":[]},{"title":"作为npm模块启动","level":"1.2.4","depth":2,"anchor":"#作为npm模块使用","path":"README.md","ref":"README.md#作为npm模块使用","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"cn","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2017-12-01T13:58:00.991Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-12-01T13:58:02.250Z"},"basePath":".","book":{"language":"cn"}});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -14,6 +14,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
|||||||
* 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑
|
* 基于Node.js,开放二次开发能力,允许自定义请求处理逻辑
|
||||||
* 支持Https的解析
|
* 支持Https的解析
|
||||||
* 提供GUI界面,用以观察请求
|
* 提供GUI界面,用以观察请求
|
||||||
|
|
||||||
相比3.x版本,AnyProxy 4.0的主要变化:
|
相比3.x版本,AnyProxy 4.0的主要变化:
|
||||||
|
|
||||||
* 规则文件(Rule)全面支持Promise和Generator
|
* 规则文件(Rule)全面支持Promise和Generator
|
||||||
@ -29,7 +30,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
|||||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
然后,安装AnyProxy
|
然后,安装AnyProxy
|
||||||
@ -223,19 +224,11 @@ AnyProxy提供了二次开发的能力,你可以用js编写自己的规则模
|
|||||||
```js
|
```js
|
||||||
// file: sample.js
|
// file: sample.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
summary: 'a rule to modify response',
|
summary: 'a rule to hack response',
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||||
const newResponse = responseDetail.response;
|
const newResponse = responseDetail.response;
|
||||||
newResponse.body += '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>';
|
newResponse.body += '- AnyProxy Hacked!';
|
||||||
|
|
||||||
newResponse.body += `<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`;
|
|
||||||
newResponse.header['Content-Type'] = 'text/html';
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => { // delay
|
setTimeout(() => { // delay
|
||||||
|
@ -736,7 +736,7 @@
|
|||||||
<h1 id="getting-start">Getting Start</h1>
|
<h1 id="getting-start">Getting Start</h1>
|
||||||
<h3 id="install">install</h3>
|
<h3 id="install">install</h3>
|
||||||
<p>To Debian and Ubuntu users, you may need to install <code>nodejs-legacy</code> at the same time</p>
|
<p>To Debian and Ubuntu users, you may need to install <code>nodejs-legacy</code> at the same time</p>
|
||||||
<pre><code class="lang-bash">sudo apg-get install nodejs-legacy
|
<pre><code class="lang-bash">sudo apt-get install nodejs-legacy
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Then install the AnyProxy</p>
|
<p>Then install the AnyProxy</p>
|
||||||
<pre><code class="lang-bash">npm install -g anyproxy@beta <span class="hljs-comment"># 4.x is in beta now</span>
|
<pre><code class="lang-bash">npm install -g anyproxy@beta <span class="hljs-comment"># 4.x is in beta now</span>
|
||||||
@ -1592,7 +1592,7 @@ You can change the request with rule of course. For this scenario, all you need
|
|||||||
<script>
|
<script>
|
||||||
var gitbook = gitbook || [];
|
var gitbook = gitbook || [];
|
||||||
gitbook.push(function() {
|
gitbook.push(function() {
|
||||||
gitbook.page.hasChanged({"page":{"title":"Getting-Start","level":"1.2","depth":1,"next":{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"doc.md","ref":"doc.md#install","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"doc.md","mtime":"2017-12-01T11:51:40.356Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-12-01T13:25:58.040Z"},"basePath":".","book":{"language":"en"}});
|
gitbook.page.hasChanged({"page":{"title":"Getting-Start","level":"1.2","depth":1,"next":{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"doc.md","ref":"doc.md#install","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"doc.md","mtime":"2017-12-01T13:39:03.080Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-12-01T13:58:02.250Z"},"basePath":".","book":{"language":"en"}});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
@ -754,7 +754,7 @@
|
|||||||
<h1 id="getting-start">Getting Start</h1>
|
<h1 id="getting-start">Getting Start</h1>
|
||||||
<h3 id="install">install</h3>
|
<h3 id="install">install</h3>
|
||||||
<p>To Debian and Ubuntu users, you may need to install <code>nodejs-legacy</code> at the same time</p>
|
<p>To Debian and Ubuntu users, you may need to install <code>nodejs-legacy</code> at the same time</p>
|
||||||
<pre><code class="lang-bash">sudo apg-get install nodejs-legacy
|
<pre><code class="lang-bash">sudo apt-get install nodejs-legacy
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>Then install the AnyProxy</p>
|
<p>Then install the AnyProxy</p>
|
||||||
<pre><code class="lang-bash">npm install -g anyproxy
|
<pre><code class="lang-bash">npm install -g anyproxy
|
||||||
@ -957,20 +957,11 @@ anyproxy --intercept <span class="hljs-comment">#launch anyproxy and intercept a
|
|||||||
<li><p>Step 1,Write the rule file, save as sample.js</p>
|
<li><p>Step 1,Write the rule file, save as sample.js</p>
|
||||||
<pre><code class="lang-js"><span class="hljs-comment">// file: sample.js</span>
|
<pre><code class="lang-js"><span class="hljs-comment">// file: sample.js</span>
|
||||||
<span class="hljs-built_in">module</span>.exports = {
|
<span class="hljs-built_in">module</span>.exports = {
|
||||||
summary: <span class="hljs-string">'a rule to modify response'</span>,
|
summary: <span class="hljs-string">'a rule to hack response'</span>,
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
<span class="hljs-keyword">if</span> (requestDetail.url === <span class="hljs-string">'http://httpbin.org/user-agent'</span>) {
|
<span class="hljs-keyword">if</span> (requestDetail.url === <span class="hljs-string">'http://httpbin.org/user-agent'</span>) {
|
||||||
<span class="hljs-keyword">const</span> newResponse = responseDetail.response;
|
<span class="hljs-keyword">const</span> newResponse = responseDetail.response;
|
||||||
|
newResponse.body += <span class="hljs-string">'- AnyProxy Hacked!'</span>;
|
||||||
newResponse.body += <span class="hljs-string">'<br/><span style="color:blue">-- AnyProxy Hacked! --</span>'</span>;
|
|
||||||
|
|
||||||
newResponse.body += <span class="hljs-string">`<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`</span>;
|
|
||||||
newResponse.header[<span class="hljs-string">'Content-Type'</span>] = <span class="hljs-string">'text/html'</span>;
|
|
||||||
|
|
||||||
<span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>((resolve, reject) => {
|
<span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>((resolve, reject) => {
|
||||||
setTimeout(() => { <span class="hljs-comment">// delay</span>
|
setTimeout(() => { <span class="hljs-comment">// delay</span>
|
||||||
@ -1620,7 +1611,7 @@ You can change the request with rule of course. For this scenario, all you need
|
|||||||
<script>
|
<script>
|
||||||
var gitbook = gitbook || [];
|
var gitbook = gitbook || [];
|
||||||
gitbook.push(function() {
|
gitbook.push(function() {
|
||||||
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Getting-Start","level":"1.2","depth":1,"anchor":"#getting-start","path":"doc.md","ref":"doc.md#getting-start","articles":[{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"doc.md","ref":"doc.md#install","articles":[]},{"title":"Launch","level":"1.2.2","depth":2,"anchor":"#launch","path":"doc.md","ref":"doc.md#launch","articles":[]},{"title":"Options","level":"1.2.3","depth":2,"anchor":"#options","path":"doc.md","ref":"doc.md#options","articles":[]},{"title":"As Node Module","level":"1.2.4","depth":2,"anchor":"#use-anyproxy-as-an-npm-module","path":"doc.md","ref":"doc.md#use-anyproxy-as-an-npm-module","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2017-12-01T13:25:56.899Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-12-01T13:25:58.040Z"},"basePath":".","book":{"language":"en"}});
|
gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"Getting-Start","level":"1.2","depth":1,"anchor":"#getting-start","path":"doc.md","ref":"doc.md#getting-start","articles":[{"title":"Install","level":"1.2.1","depth":2,"anchor":"#install","path":"doc.md","ref":"doc.md#install","articles":[]},{"title":"Launch","level":"1.2.2","depth":2,"anchor":"#launch","path":"doc.md","ref":"doc.md#launch","articles":[]},{"title":"Options","level":"1.2.3","depth":2,"anchor":"#options","path":"doc.md","ref":"doc.md#options","articles":[]},{"title":"As Node Module","level":"1.2.4","depth":2,"anchor":"#use-anyproxy-as-an-npm-module","path":"doc.md","ref":"doc.md#use-anyproxy-as-an-npm-module","articles":[]}]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"AnyProxy","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AnyProxy","language":"en","gitbook":"*","description":"A fully configurable http/https proxy in NodeJS"},"file":{"path":"README.md","mtime":"2017-12-01T13:58:00.991Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-12-01T13:58:02.250Z"},"basePath":".","book":{"language":"en"}});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@ Change Logs since 3.x:
|
|||||||
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
To Debian and Ubuntu users, you may need to install `nodejs-legacy` at the same time
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apg-get install nodejs-legacy
|
sudo apt-get install nodejs-legacy
|
||||||
```
|
```
|
||||||
|
|
||||||
Then install the AnyProxy
|
Then install the AnyProxy
|
||||||
@ -222,20 +222,11 @@ Rule module could do the following stuff:
|
|||||||
```js
|
```js
|
||||||
// file: sample.js
|
// file: sample.js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
summary: 'a rule to modify response',
|
summary: 'a rule to hack response',
|
||||||
*beforeSendResponse(requestDetail, responseDetail) {
|
*beforeSendResponse(requestDetail, responseDetail) {
|
||||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||||
const newResponse = responseDetail.response;
|
const newResponse = responseDetail.response;
|
||||||
|
newResponse.body += '- AnyProxy Hacked!';
|
||||||
newResponse.body += '<br/><span style="color:blue">-- AnyProxy Hacked! --</span>';
|
|
||||||
|
|
||||||
newResponse.body += `<script>
|
|
||||||
setTimeout(
|
|
||||||
function (){
|
|
||||||
window.alert("Sorry, You Are Hacked...")
|
|
||||||
}, 300);
|
|
||||||
</script>`;
|
|
||||||
newResponse.header['Content-Type'] = 'text/html';
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => { // delay
|
setTimeout(() => { // delay
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user