예제 #1
0
        public static Panel add_Proxy_ActionsPanel(this O2_Web_Proxy o2WebProxy, Control topPanel)
        {
            var actionsPanel = topPanel.insert_Above(40, "actions");

            actionsPanel.add_Label("O2 Proxy")
            .append_Link("View Proxy Object", () => o2WebProxy.details())
            .append_Link("Proxy Start", () => o2WebProxy.startWebProxy())
            .append_Link("Proxy Stop", () => o2WebProxy.stopWebProxy())
            .append_Link("Set Browser Proxy", () => o2WebProxy.setBrowserProxy())
            .append_Link("Clear Browser Proxy", () => o2WebProxy.clearBrowserProxy())
            .append_Link("Stop Current Process", () => Processes.getCurrentProcess().stop());
            return(actionsPanel);
        }
예제 #2
0
        public static O2_Web_Proxy createGui_Proxy_SimpleView(this O2_Web_Proxy o2WebProxy, Control panel)
        {
            var topPanel = panel.clear().add_Panel();

            //topPanel.insert_LogViewer();
            o2WebProxy.stopOnFormClose(topPanel);
            var actions_Panel = topPanel.insert_Above(40, "");
            var requests      = topPanel.add_GroupBox("Requests").add_TableList().title("O2 Web Proxy");
            var properties    = requests.insert_Below(100, "Request & Response Object").add_PropertyGrid()
                                .helpVisible(false)
                                .toolBarVisible(false);
            //actions_Panel.insert_Right(40).add_Proxy_ToolsPanel();
            var showLiveRequests = false;

            var requestId = 0;

            requests.add_Columns("#", "Method", "Status", "Size", "Url");

            Action setColumnsWidth = () => requests.set_ColumnsWidth(30, 60, 60);

            setColumnsWidth();

            requests.onDoubleClick <RequestResponseData>(
                (requestResponseData) => {
                var responseCode = "Html for: {0}".format(requestResponseData.Request_Uri)
                                   .popupWindow()
                                   .add_GroupBox("Response Data")
                                   .add_SourceCodeViewer().maximizeViewer()
                                   .set_Text(requestResponseData.Response_String, ".html");
                if (requestResponseData.Request_PostString.valid())
                {
                    responseCode.parent()
                    .insert_Above(200, "Request Post Data")
                    .add_SourceCodeViewer().maximizeViewer()
                    .set_Text(requestResponseData.Request_PostString, ".html");
                }
            });

            Action <RequestResponseData> add_Row =
                (rrData) => {
                requests.add_Row(rrData,
                                 () => {
                    var rowData = new List <string>()
                    {
                        (++requestId).str(),
                        rrData.WebRequest.Method.str(),
                        rrData.WebResponse.StatusCode.str(),
                        rrData.Response_String.size().str(),
                        rrData.WebRequest.RequestUri.str()
                    };
                    return(rowData);
                });
            };

            requests.afterSelect <RequestResponseData>(
                (requestResponseData) => {
                properties.show(requestResponseData);
            });

            Action showPastRequests =
                () => {
                requests.clearRows();
                requests.title("Showing {0} web Requests".format(o2WebProxy.Proxy.requests().size()));
                foreach (var request in o2WebProxy.Proxy.requests())
                {
                    add_Row(request);
                }
                requests.setWidthToContent();
            };

            Action copySelectedUtlToClipboard =
                () => {
                var selected = requests.selected <RequestResponseData>();
                if (selected.notNull())
                {
                    selected.Request_Uri.str().clipboardText_Set();
                }
            };

            ProxyServer.OnResponseReceived =
                (requestResponseData) => add_Row(requestResponseData);

            requests.add_ContextMenu().add_MenuItem("Copy Utl to clipboard", true, () => copySelectedUtlToClipboard())
            .add_MenuItem("See Selected Row RequestResponseData Object Details", true, () => requests.tag().details())
            .add_MenuItem("Refresh request list ({0} at start)".format(o2WebProxy.Proxy.requests().size()), true, () => showPastRequests())
            .add_MenuItem("Clear list", true, () => requests.clearRows())
            .add_MenuItem("Reset Columns Width", () => { setColumnsWidth(); setColumnsWidth(); });

            actions_Panel.add_Label("Actions:")
            .append_Link("Proxy Start", () => o2WebProxy.startWebProxy())
            .append_Link("Proxy Stop", () => o2WebProxy.stopWebProxy())
            .append_CheckBox("Real-Time View", (value) => showLiveRequests        = value).@check()
            .append_CheckBox("Extra logging", (value) => ProxyServer.ExtraLogging = value);


            actions_Panel.add_Label("Test sites:", 20, 0)
            .append_Link("BBC", () => "http://news.bbc.co.uk".get_Html())
            .append_Link("OWASP", () => "http://www.owasp.org".get_Html())
            .append_Link("google", () => "http://www.google.com".get_Html())
            .append_Label("O2 Utils")
            .append_Link("O2 Log Viewer", () => "O2 Log Viewer".popupWindow().add_LogViewer());
            return(o2WebProxy);
        }
예제 #3
0
 public static O2_Web_Proxy stopOnFormClose(this O2_Web_Proxy o2WebProxy, Control topPanel)
 {
     topPanel.onClosed(() => o2WebProxy.stopWebProxy());
     return(o2WebProxy);
 }