Skip to content

Commit e38821c

Browse files
committed
add: parse the issue's name from the xml file
1 parent 008cc91 commit e38821c

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h1 align="center">burp.js by <a href="https://turingsecure.com" target="_blank">turingsecure.</a></h1>
22
<p>
3-
<img alt="Version" src="https://img.shields.io/badge/version-0.1.1-blue.svg?cacheSeconds=2592000" />
3+
<img alt="Version" src="https://img.shields.io/badge/version-0.1.2-blue.svg?cacheSeconds=2592000" />
44
<a href="#" target="_blank">
55
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
66
</a>
@@ -50,6 +50,7 @@ An issue object has the following properties:
5050
| Property | Type |
5151
| ---------------------------- | ------------------ |
5252
| serialNumber | string |
53+
| name | string |
5354
| type | string |
5455
| host | string |
5556
| path | string |
@@ -78,5 +79,5 @@ Feel free to check out the [issues page](https://github.com/turingsecure/burp.js
7879

7980
## License
8081

81-
Copyright © 2021 [turingsecure](https://turingsecure.com).
82+
Copyright © 2025 [turingsecure](https://turingsecure.com).
8283
This project is [MIT](LICENSE) licensed.

package.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@turingsecure/burp.js",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Client side parser for Burp Suite XML output files.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -25,22 +25,12 @@
2525
"type": "git",
2626
"url": "https://github.com/turingsecure/burp.js.git"
2727
},
28-
"keywords": [
29-
"burp",
30-
"xml",
31-
"parser",
32-
"security",
33-
"javascript",
34-
"itsec"
35-
],
28+
"keywords": ["burp", "xml", "parser", "security", "javascript", "itsec"],
3629
"jest": {
3730
"transform": {
3831
"^.+\\.tsx?$": "ts-jest"
3932
},
40-
"moduleFileExtensions": [
41-
"ts",
42-
"js"
43-
],
33+
"moduleFileExtensions": ["ts", "js"],
4434
"testRegex": "^.+\\.spec\\.ts$"
4535
},
4636
"author": "turingsecure",

src/index.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ interface RequestResponse {
66

77
interface Issue {
88
serialNumber?: string;
9+
name?: string;
910
type?: string;
1011
host?: string;
1112
path?: string;
@@ -28,7 +29,10 @@ function getTextContent(nodes: Node[], property: string): string | undefined {
2829
return findChildNode(nodes, property)?.textContent;
2930
}
3031

31-
function parseRequestResponse(nodes: Node[], isBase64Encoded: boolean): RequestResponse[] {
32+
function parseRequestResponse(
33+
nodes: Node[],
34+
isBase64Encoded: boolean
35+
): RequestResponse[] {
3236
const requestResponseNodes = nodes.filter(
3337
(childNode: Node) => childNode.nodeName === "requestresponse"
3438
);
@@ -41,7 +45,8 @@ function parseRequestResponse(nodes: Node[], isBase64Encoded: boolean): RequestR
4145
const responseRequestObject: RequestResponse = {
4246
request: getTextContent(childNodes, "request"),
4347
response: getTextContent(childNodes, "response"),
44-
responseRedirected: getTextContent(childNodes, "responseRedirected") === "true"
48+
responseRedirected:
49+
getTextContent(childNodes, "responseRedirected") === "true",
4550
};
4651

4752
if (isBase64Encoded) {
@@ -63,6 +68,7 @@ function createIssueObject(node: ChildNode, isBase64Encoded: boolean): Issue {
6368

6469
const issueObject: Issue = {
6570
serialNumber: getTextContent(childNodes, "serialNumber"),
71+
name: getTextContent(childNodes, "name"),
6672
type: getTextContent(childNodes, "type"),
6773
host: getTextContent(childNodes, "host"),
6874
path: getTextContent(childNodes, "path"),
@@ -71,10 +77,13 @@ function createIssueObject(node: ChildNode, isBase64Encoded: boolean): Issue {
7177
confidence: getTextContent(childNodes, "confidence"),
7278
issueBackground: getTextContent(childNodes, "issueBackground"),
7379
remediationBackground: getTextContent(childNodes, "remediationBackground"),
74-
vulnerabilityClassifications: getTextContent(childNodes, "vulnerabilityClassifications"),
80+
vulnerabilityClassifications: getTextContent(
81+
childNodes,
82+
"vulnerabilityClassifications"
83+
),
7584
issueDetail: getTextContent(childNodes, "issueDetail"),
7685
references: getTextContent(childNodes, "references"),
77-
requestresponse: parseRequestResponse(childNodes, isBase64Encoded)
86+
requestresponse: parseRequestResponse(childNodes, isBase64Encoded),
7887
};
7988

8089
return issueObject;

test/index.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ const path = require("path");
33
const { BurpParser } = require("../src/index");
44

55
const xml = fs.readFileSync(path.join(__dirname, "__testdata__", "scan.xml"));
6-
const shortXml = fs.readFileSync(path.join(__dirname, "__testdata__", "short-scan.xml"));
6+
const shortXml = fs.readFileSync(
7+
path.join(__dirname, "__testdata__", "short-scan.xml")
8+
);
79
const shortXmlBase64 = fs.readFileSync(
810
path.join(__dirname, "__testdata__", "short-scan-base64.xml")
911
);
10-
const xmlBase64 = fs.readFileSync(path.join(__dirname, "__testdata__", "scan-base64.xml"));
12+
const xmlBase64 = fs.readFileSync(
13+
path.join(__dirname, "__testdata__", "scan-base64.xml")
14+
);
1115

1216
describe("BurpParser", () => {
1317
it("Should return a list of issues", () => {
@@ -22,6 +26,7 @@ describe("BurpParser", () => {
2226
const [firstIssue] = issues;
2327

2428
expect(firstIssue).toHaveProperty("serialNumber");
29+
expect(firstIssue).toHaveProperty("name");
2530
expect(firstIssue).toHaveProperty("type");
2631
expect(firstIssue).toHaveProperty("host");
2732
expect(firstIssue).toHaveProperty("path");

0 commit comments

Comments
 (0)