Giter Club home page Giter Club logo

proxyframework's Introduction

ProxyFramework

一个代理框架,可以自定义篡改收到的或者请求的数据。基于Titanium.Web.Proxy。

特点

  1. 自动解密HTTPS,同时提供手机证书下载,在手机上面访问【ip:6066/ssl】进入下载页面下载证书并安装。
  2. 使用注入的方式进行代理添加和移除。

存在的问题

  1. 目前来看性能不是很好,只能说勉强够用。后续继续调优...

How to start

下载并引入ProxyFramework,编写代理类(以修改Baidu首页为例):

class BaiduProxy : IProxyFramework
{
    public override async Task<bool> Rule(SessionEventArgs e)
    {
        string url = e.HttpClient.Request.Url.ToString().ToLower();
        if (url.Contains("baidu.com"))  //如果URL中匹配到baidu.com,那么启用修改
        {
            return true;
        }
        return false;
    }

    public override async Task Response()
    {
        EventArgs.SetResponseBodyString("想百度一下?没门!!");
    }
}

继承抽象类IProxyFramework,并重写Rule和选择重写Response或Request方法。如上面代码所示,重写Response后,使用EventArgs中的SetResponseBodyString方法将网页修改为"想百度一下?没门!!"。
然后在Main方法中启动代理。

static void Main(string[] args)
{
    //初始化
    Proxy proxy = new Proxy(9527);
    //注入
    proxy.Add(new BaiduProxy());
    //启动
    proxy.Start();

    while (true)
    {
        if (Console.ReadKey(true).Key == ConsoleKey.Q)
        {
            Console.Write("确认退出代理工具吗?(y退出,任意键取消)");
            if (Console.ReadKey().Key == ConsoleKey.Y)
            {
                proxy.Stop();
                return;
            }
        }
    }
}

然后在浏览器中输入baidu.com,查看效果吧~

proxyframework's People

Contributors

withsalt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

1nformation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.