From d134587f001771d532235ab72000f75617fdcb19 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Sat, 10 Aug 2024 02:29:34 +0500 Subject: [PATCH 1/4] layout of history panel Signed-off-by: Moeez Ahmed --- .../src/main/pocs/reactWebUI/src/App.js | 8 ++++--- .../src/Components/History/History.jsx | 23 +++++++++++++++++++ .../Request-Response/Req-Resp-Bar.jsx | 7 +++--- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js index b688a08e7c0..93f89740a14 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js @@ -18,10 +18,11 @@ const App = () => {
-
+ +
- ID | Method | Host | Path | URI + History Bar
@@ -37,7 +38,8 @@ const App = () => {
- + +
); diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx new file mode 100644 index 00000000000..b123cb63edb --- /dev/null +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx @@ -0,0 +1,23 @@ +import { react } from "react"; +const History = () => { + +return ( +
+
+
+
+
History Bar
+
+
+
+ + +
+
+
+
+
+ ); +}; + +export default History; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx index b357a81193a..63fe8e768b2 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/Request-Response/Req-Resp-Bar.jsx @@ -2,12 +2,11 @@ import React from 'react'; function ResponseBar() { return ( -
+
- -
+
Request
@@ -19,7 +18,7 @@ function ResponseBar() {
-
+
Response
From e54c6bd217357a48b30cff4905dfe2c4d9ef67ba Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Tue, 13 Aug 2024 20:06:51 +0500 Subject: [PATCH 2/4] webuipoc: handle other endpoints Signed-off-by: Moeez Ahmed --- .../main/java/org/zaproxy/addon/webuipoc/TestProxyServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/addOns/webuipoc/src/main/java/org/zaproxy/addon/webuipoc/TestProxyServer.java b/addOns/webuipoc/src/main/java/org/zaproxy/addon/webuipoc/TestProxyServer.java index 2e2c4c75887..80ba21f28dd 100644 --- a/addOns/webuipoc/src/main/java/org/zaproxy/addon/webuipoc/TestProxyServer.java +++ b/addOns/webuipoc/src/main/java/org/zaproxy/addon/webuipoc/TestProxyServer.java @@ -202,6 +202,7 @@ protected static boolean isApiRequest(HttpMessage msg) { String path = msg.getRequestHeader().getURI().getEscapedPath(); return path.startsWith("/UI/") || path.startsWith("/JSON/") + || path.startsWith("/OTHER/") || path.startsWith("/script.js"); } From e6b1f0aab9194deeed5223c1b46fe813b3d8abf1 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Thu, 15 Aug 2024 06:21:18 +0500 Subject: [PATCH 3/4] History Bar UI update and API integrate --- .../src/main/pocs/reactWebUI/src/App.js | 28 ++----- .../src/Components/History/History.jsx | 73 +++++++++++++++---- .../reactWebUI/src/Components/HistoryBar.js | 13 ---- .../pocs/reactWebUI/src/Utilities/history.js | 15 ++++ 4 files changed, 78 insertions(+), 51 deletions(-) delete mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js create mode 100644 addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/history.js diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js index 93f89740a14..2c08f23aaf8 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/App.js @@ -5,8 +5,9 @@ import Sidebar from "./Components/Sidebar/Sidebar"; import HeaderBase from "./Components/Header/HeaderBase"; import SideTree from "./Components/SitesTree/SitesTree"; import RequestBar from "./Components/Request-Response/Req-Resp-Bar"; -import { sendChildNode } from "./Utilities/requests"; import SearchBar from "./Components/SearchBar/SearchBar"; +import History from "./Components/History/History"; + const App = () => { @@ -19,29 +20,10 @@ const App = () => {
-
-
-
- History Bar -
-
-
-
-

- {/* {childNode && - childNode.map((node) => ( -

- {node.hrefId} -

- ))} */} -
-
-
+ - - -
-
+
+
); }; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx index b123cb63edb..10eae748690 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx @@ -1,22 +1,65 @@ -import { react } from "react"; +import React, { useState, useEffect } from "react"; +import {sendHistory} from "../../Utilities/history" + + const History = () => { + const [history, setHistory] = useState(null) + + + useEffect(() => { + const fetchData = async () => { + try { + const response = await sendHistory(); + setHistory(response); + } catch (error) { + console.error("Error fetching data:", error); + } + }; + + fetchData(); + }, []); return ( -
-
-
-
-
History Bar
-
-
-
- - -
-
-
-
+
+
+
+ History +
+
+
+
+ + + + + + + + + + + + + + + { + history?.log?.entries?.map((historyElement) => ( + + + + + + + + + + )) } + + +
IDMethodDate & TimeURLCodeReasonSize
{historyElement._zapMessageId}{historyElement.request?.method}{historyElement.startedDateTime}{historyElement.request?.url}{historyElement.response?.status}{historyElement.response?.statusText}{historyElement.response?.bodySize} bytes
+
+
); }; diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js deleted file mode 100644 index 2afd3004e58..00000000000 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/HistoryBar.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react' - -function HistoryBar() { - return ( -
- History -
- ) -} - -export default HistoryBar - -// WIP \ No newline at end of file diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/history.js b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/history.js new file mode 100644 index 00000000000..50933f7edf7 --- /dev/null +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Utilities/history.js @@ -0,0 +1,15 @@ +import axios from 'axios'; + +const sendHistory = async () => { + try { + const response = await axios.get('/OTHER/exim/other/exportHar/'); + return response.data; + } + catch (error) { + console.error('Error fetching data:', error); + throw error; + } + +}; + +export { sendHistory }; From ec57fd9bc8bb379ba7147720400f3fa0ecfe7460 Mon Sep 17 00:00:00 2001 From: Moeez Ahmed Date: Tue, 10 Sep 2024 15:54:14 +0500 Subject: [PATCH 4/4] fix header of histroy bar Signed-off-by: Moeez Ahmed --- .../pocs/reactWebUI/src/Components/History/History.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx index 10eae748690..9c3bc7b95c0 100644 --- a/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx +++ b/addOns/webuipoc/src/main/pocs/reactWebUI/src/Components/History/History.jsx @@ -26,10 +26,12 @@ return ( History
-
-
- - +
+
+
+ + +
ID Method