mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-08-01 19:49:01 +00:00
update readme and doc
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||
|
||||
```bash
|
||||
sudo apg-get install nodejs-legacy
|
||||
sudo apt-get install nodejs-legacy
|
||||
```
|
||||
|
||||
然后,安装AnyProxy
|
||||
|
@@ -755,11 +755,11 @@
|
||||
<ul>
|
||||
<li>基于Node.js,开放二次开发能力,允许自定义请求处理逻辑</li>
|
||||
<li>支持Https的解析</li>
|
||||
<li><p>提供GUI界面,用以观察请求
|
||||
相比3.x版本,AnyProxy 4.0的主要变化:</p>
|
||||
</li>
|
||||
<li><p>规则文件(Rule)全面支持Promise和Generator</p>
|
||||
</li>
|
||||
<li>提供GUI界面,用以观察请求</li>
|
||||
</ul>
|
||||
<p>相比3.x版本,AnyProxy 4.0的主要变化:</p>
|
||||
<ul>
|
||||
<li>规则文件(Rule)全面支持Promise和Generator</li>
|
||||
<li>简化了规则文件内的接口</li>
|
||||
<li>Web版界面重构</li>
|
||||
</ul>
|
||||
@@ -768,7 +768,7 @@
|
||||
<h2 id="作为全局模块">作为全局模块</h2>
|
||||
<h3 id="安装">安装</h3>
|
||||
<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>
|
||||
<p>然后,安装AnyProxy</p>
|
||||
<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>
|
||||
<pre><code class="lang-js"><span class="hljs-comment">// file: sample.js</span>
|
||||
<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) {
|
||||
<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;
|
||||
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>;
|
||||
newResponse.body += <span class="hljs-string">'- AnyProxy Hacked!'</span>;
|
||||
|
||||
<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>
|
||||
@@ -1632,7 +1624,7 @@ newResponse.body += <span class="hljs-string">'--from anyproxy--'</spa
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
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>
|
||||
</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,开放二次开发能力,允许自定义请求处理逻辑
|
||||
* 支持Https的解析
|
||||
* 提供GUI界面,用以观察请求
|
||||
|
||||
相比3.x版本,AnyProxy 4.0的主要变化:
|
||||
|
||||
* 规则文件(Rule)全面支持Promise和Generator
|
||||
@@ -29,7 +30,7 @@ Github主页:https://github.com/alibaba/anyproxy/tree/4.x
|
||||
对于Debian或者Ubuntu系统,在安装AnyProxy之前,可能还需要安装 `nodejs-legacy`
|
||||
|
||||
```bash
|
||||
sudo apg-get install nodejs-legacy
|
||||
sudo apt-get install nodejs-legacy
|
||||
```
|
||||
|
||||
然后,安装AnyProxy
|
||||
@@ -223,19 +224,11 @@ AnyProxy提供了二次开发的能力,你可以用js编写自己的规则模
|
||||
```js
|
||||
// file: sample.js
|
||||
module.exports = {
|
||||
summary: 'a rule to modify response',
|
||||
summary: 'a rule to hack response',
|
||||
*beforeSendResponse(requestDetail, responseDetail) {
|
||||
if (requestDetail.url === 'http://httpbin.org/user-agent') {
|
||||
const newResponse = responseDetail.response;
|
||||
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';
|
||||
newResponse.body += '- AnyProxy Hacked!';
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => { // delay
|
||||
|
Reference in New Issue
Block a user