提供HTTPS代理

时间:2017-06-06 10:45:25

标签: https proxy

好的,正如管理员要求的那样,我改进了我的问题:

我正在寻找可以调整HTTPS / HST网站的本地Proxie解决方案。他们应该能够调整网站的内容和标题。你知道这样的代理吗?我更喜欢Python解决方案,因为它们是可以破解的。

是的,有一些解决方案适用于浏览器插件,我发布了一个包含使用Yarip的示例的答案,但问题是:一旦浏览器开发人员决定删除API,就不会有任何人愿意这样做,插件停止工作。

因此,我希望有一个适用于协议级别的解决方案。那么,Proxies可以做到这一点,调整HTTPS / HST网站?我不关心性能,无论如何我的互联网很慢,我不赶时间。还请举例说明如何使用您的解决方案调整网站内容以及如何调整标题的小示例。

希望我的问题现在很明确。

1 个答案:

答案 0 :(得分:0)

好的,这是我解决这个问题的方法。 AJAX with bottle.pyjQuery Docs很有帮助。

  • 使用Firefox(开发人员版),版本52.更高版本的Firefox不支持Yarip,这是我将Javascript注入文档并调整Content-Security-Policy响应头的方法,如果有的话。我对以后的Firefoxes / Chromes /无论如何解决方案感兴趣。

  • 阻止Firefox阻止混合内容(从https网站加载http资源)。这对localhost来说是无稽之谈。根据{{​​3}}和this Discussion,从Firefox 55开始,localhost默认最终列入白名单。但是,由于我需要Yarip,因此无法使用Firefox 55,我仍然需要手动禁用此策略。 这可以通过将about.config -> security.mixed_content.block_active_content设置为 false 来实现全局,这是懒惰和严重的危险,因为它影响每个网站,或者通过这样做this Wiki Entry这不是那么懒惰但是

  • 安装Python 3

  • pip install bottle

  • 使用以下内容创建文件 server.py

    import os, json
    from bottle import request, response, route, static_file, debug, run

    @route('/inc') # this handles the ajax calls
    def inc():
        # only needed when you pass parameters to the ajax call.
        response.set_header('Access-Control-Allow-Origin', '*')

        number = request.params.get('number', 0, type=int)
        return json.dumps({'increased_number': number + 1})

    @route('/static/<filename:path>') # this serves the two static javascript files
    def send_static(filename):
        return static_file(filename, root=os.path.dirname(__file__))

    debug(True)
    run(port=9030, reloader=True)
  • 运行

  • jquery.js 的副本放入同一目录

  • 使用以下内容在同一目录中创建文件 logic.js

    // http://api.jquery.com/jQuery.noConflict/
    var my = {};
    my.$ = $.noConflict(true);

    // http://api.jquery.com/ready/
    my.$(function() {
        var target = my.$(
            '<div id="my-ajax-result" style="position:absolute; padding:1em; background:'
            + 'white; cursor:pointer; border:3px solid blue; z-index:999;">0</div>'
        );
        my.$('body').prepend(target);

        function ajaxcall(){
            // http://api.jquery.com/jQuery.getJSON/
            my.$.getJSON(
                "http://localhost:9030/inc",
                {
                    number : target.text() // parameters
                },
                function(result) {
                    target.text(result.increased_number);
                }
            );
        }

        // http://api.jquery.com/click/
        target.click(function(event) {
            ajaxcall();
            return false;
        });

        ajaxcall();
    });
  • 安装temporarily per-page

  • 将以下xml保存到文件中,然后从Yarips manage pages 对话框中导入它。这应该为en.wikipedia.org创建一个新规则。我现在太懒了解释yarip是如何工作的,但是值得学习它。此规则将在正文末尾注入 jquery.js logic.js ,它将调整 Content-Security-Policy 响应标题,如果有的话。

    <?xml version="1.0" encoding="UTF-8"?>
    <yarip version="0.3.5">
        <page id="{56b07a5d-e2df-41f2-9ca8-34b4ecb04af8}" name="wikipedia.org" allowScript="true" created="1496845936929">
            <page>
                <header>
                    <response>
                        <item created="1496845998973">
                            <regexp flags="i"><![CDATA[.*wikipedia\.org.*]]></regexp>
                            <name><![CDATA[Content-Security-Policy]]></name>
                            <script><![CDATA[function (value) {
        return "Content-Security-Policy: connect-src *";
    }]]></script>
                        </item>
                    </response>
                </header>
                <stream>
                    <item created="1496845985382">
                        <regexp flags="i"><![CDATA[.*wikipedia\.org.*]]></regexp>
                        <stream_regexp flags="gim"><![CDATA[</body>]]></stream_regexp>
                        <script><![CDATA[function (match, p1, offset, string) {
        return '<script type="text/javascript" src="http://localhost:9030/static/jquery.js"></script><script type="text/javascript" src="http://localhost:9030/static/logic.js"></script></body>';
    }
    ]]></script>
                    </item>
                </stream>
            </page>
        </page>
    </yarip>
  • 确保已启用yarip

  • 导航至Yarip。你应该看到左上角有一个蓝色矩形,里面有一个数字。如果单击它,将对localhost进行ajax调用,并且将使用该调用的结果结果替换蓝色矩形的内容 - 数字增加1.屏幕截图:

en.wikipedia.org

  • 玩这个并按照您想要的方式调整网页,包括HTTPS网站。使用Python对您的计算机具有读/写访问权限。吃这个,Firefox Nanny devs。