diff --git a/annotation.html b/annotation.html index 34c9957..4b07f6a 100644 --- a/annotation.html +++ b/annotation.html @@ -22,6 +22,7 @@

Highlight the name in the description

${description}
+
${spans}
@@ -43,6 +44,16 @@

Highlight the name in the de

+ +
+
+
+ + +
+
+
+
diff --git a/annotation.js b/annotation.js index fc1be2b..fb9faa9 100644 --- a/annotation.js +++ b/annotation.js @@ -12,6 +12,7 @@ var key; // --------------------------------------------------------- var raw = $('#raw'); +var spans = $('#spans'); var well = $('#well'); var submit = $('#submit'); var choice = $('#choice'); @@ -51,6 +52,7 @@ var makeChoice = function(key) { .text(fieldName[key]) .append(input) .attr({'title': "Shortcut: " + shortcutKey[key]}) + .attr('hidden') ); return label; } @@ -329,8 +331,19 @@ trigger.click(function(){ // --------------------------------------------------------- +var spansStrToAns = function(spansStrToAns) { + var annList = _.map(spansStrToAns.split(","), function(el) {return parseInt(el)}); + var i = 2, list = _.groupBy(annList, function(a, b){ + return Math.floor(b/i); + }); + return _.toArray(list); +} + key = keys[0]; radios[key].click(); var tokens = raw.text().split(">>"); raw.hide(); +spans.hide(); +annotations['answer'] = spansStrToAns(spans.text()); +console.log(annotations); show(); diff --git a/config.js b/config.js index 92eeb0a..65aeda0 100644 --- a/config.js +++ b/config.js @@ -3,23 +3,15 @@ // --------------------------------------------------------- var fieldName = { - "name": "Product name", - "version": "Product version", - "protocol": "Protocol", + "answer": "Answer", } var shortName = { - "name": "name", - "version": "version", - "protocol": "protocol", + "answer": "answer", } var longDesc = { - "name": "Product name. Name of the software/device/library that is affected by this vulnerability ", - "version": 'Version or versions of the product that is affected. E.g. "1.3.0" or "through 2.7"', - "protocol": "Form in which the input is given to exploit the vulnerability", + "answer": "Answer", } var shortcutKey = { - "name": "a", - "version": "e", - "protocol": "r", + "answer": "a", } diff --git a/input.csv b/input.csv index 4aefd79..d998e7c 100644 --- a/input.csv +++ b/input.csv @@ -1,2 +1,2 @@ -cveid,description -2018-11013,"Stack-based>>buffer>>overflow>>in>>the>>websRedirect>>function>>in>>GoAhead>>on>>D-Link>>DIR-816>>A2>>(CN)>>routers>>with>>firmware>>version>>1.10B05>>allows>>unauthenticated>>remote>>attackers>>to>>execute>>arbitrary>>code>>via>>a>>request>>with>>a>>long>>HTTP>>Host>>header." +description,question,spans +"Stack-based>>buffer>>overflow>>in>>the>>websRedirect>>function>>in>>GoAhead>>on>>D-Link>>DIR-816>>A2>>(CN)>>routers>>with>>firmware>>version>>1.10B05>>allows>>unauthenticated>>remote>>attackers>>to>>execute>>arbitrary>>code>>via>>a>>request>>with>>a>>long>>HTTP>>Host>>header.","What is the answer?","4,8" diff --git a/style.css b/style.css index ab4383e..f0efcf6 100644 --- a/style.css +++ b/style.css @@ -53,6 +53,8 @@ .annotation { font-weight: normal; background-color: #EAD379; + border-style: solid; + border-width: 2px; } .btn-ann {