{ "cells": [ { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from sklearn.decomposition import PCA\n", "from sklearn.cluster import KMeans\n", "import pandas as pd\n", "import numpy as np\n", "from sklearn.preprocessing import StandardScaler\n", "from sklearn import preprocessing\n", "import matplotlib.pyplot as plt\n" ] }, { "cell_type": "code", "execution_count": 10, "outputs": [], "source": [ "data1 = pd.DataFrame(pd.read_json(r\"E:\\pythonProject_open\\data\\SIR_dataset_processed.json\"))\n", "category_replacement = {'HIGH':0.14950673891899402, 'MEDIUM':0.37487842156454076, 'CRITICAL':0.2908850910101431, 'LOW':0.18472974850632207}\n", "# data1['severity'] = data1['severity'].replace(category_replacement)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 11, "outputs": [ { "data": { "text/plain": " CVE_ID Issue_Url_old \\\n0 CVE-2011-4116 https://github.com/Perl-Toolchain-Gang/File-Te... \n1 CVE-2013-4891 https://github.com/bcit-ci/CodeIgniter/issues/... \n2 CVE-2013-7447 https://github.com/mate-desktop/eom/issues/93 \n3 CVE-2013-7458 https://github.com/antirez/redis/issues/3284 \n4 CVE-2013-7458 https://github.com/antirez/linenoise/issues/121 \n5 CVE-2013-7459 https://github.com/dlitz/pycrypto/issues/176 \n6 CVE-2013-7489 https://github.com/bbangert/beaker/issues/191 \n7 CVE-2014-0087 https://github.com/ManageIQ/manageiq/issues/1581 \n8 CVE-2014-5002 https://github.com/panthomakos/lynx/issues/3 \n9 CVE-2014-7919 https://github.com/alexpark07/Bookmark/issues/1 \n\n Issue_Url_new \\\n0 https://github.com/perl-toolchain-gang/file-te... \n1 https://github.com/bcit-ci/codeigniter/issues/... \n2 https://github.com/mate-desktop/eom/issues/93 \n3 https://github.com/redis/redis/issues/3284 \n4 https://github.com/antirez/linenoise/issues/121 \n5 https://github.com/pycrypto/pycrypto/issues/176 \n6 https://github.com/bbangert/beaker/issues/191 \n7 https://github.com/manageiq/manageiq/issues/1581 \n8 https://github.com/panthomakos/lynx/issues/3 \n9 https://github.com/alexpark07/bookmark/issues/1 \n\n Repo_new Issue_Created_At \\\n0 perl-toolchain-gang/file-temp 2016-04-03 03:41:22+00:00 \n1 bcit-ci/codeigniter 2015-08-04 08:48:37+00:00 \n2 mate-desktop/eom 2015-07-26 22:46:13+00:00 \n3 redis/redis 2016-05-30 15:35:38+00:00 \n4 antirez/linenoise 2016-06-18 01:24:57+00:00 \n5 pycrypto/pycrypto 2015-12-14 23:33:48+00:00 \n6 bbangert/beaker 2020-05-14 18:02:40+00:00 \n7 manageiq/manageiq 2015-02-05 08:32:09+00:00 \n8 panthomakos/lynx 2018-01-12 00:12:50+00:00 \n9 alexpark07/bookmark 2016-07-12 17:28:56+00:00 \n\n description \\\n0 APITAG allows unsafe traversal of symlinks API... \n1 APITAG security and CVE database. Hello APITAG... \n2 EOM crashes when trying to open a large PNG fi... \n3 redis cli: permissions when opening history fi... \n4 Function to save history as private file by de... \n5 AES.new with invalid parameter crashes python.... \n6 Insecure data serialization method by default ... \n7 Hardening of the RBAC check. The current code ... \n8 CVE: APITAG password exposed on the command li... \n9 can you match up one of your disclosures?. FIL... \n\n vectorString severity baseScore \\\n0 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N HIGH 7.5 \n1 CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N MEDIUM 6.1 \n2 CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H MEDIUM 6.5 \n3 CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N LOW 3.3 \n4 CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N LOW 3.3 \n5 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H CRITICAL 9.8 \n6 CVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H MEDIUM 6.8 \n7 CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H HIGH 8.8 \n8 CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H HIGH 7.8 \n9 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H HIGH 7.5 \n\n impactScore exploitabilityScore \n0 3.6 3.9 \n1 2.7 2.8 \n2 3.6 2.8 \n3 1.4 1.8 \n4 1.4 1.8 \n5 5.9 3.9 \n6 5.9 0.9 \n7 5.9 2.8 \n8 5.9 1.8 \n9 3.6 3.9 ", "text/html": "
| \n | CVE_ID | \nIssue_Url_old | \nIssue_Url_new | \nRepo_new | \nIssue_Created_At | \ndescription | \nvectorString | \nseverity | \nbaseScore | \nimpactScore | \nexploitabilityScore | \n
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \nCVE-2011-4116 | \nhttps://github.com/Perl-Toolchain-Gang/File-Te... | \nhttps://github.com/perl-toolchain-gang/file-te... | \nperl-toolchain-gang/file-temp | \n2016-04-03 03:41:22+00:00 | \nAPITAG allows unsafe traversal of symlinks API... | \nCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N | \nHIGH | \n7.5 | \n3.6 | \n3.9 | \n
| 1 | \nCVE-2013-4891 | \nhttps://github.com/bcit-ci/CodeIgniter/issues/... | \nhttps://github.com/bcit-ci/codeigniter/issues/... | \nbcit-ci/codeigniter | \n2015-08-04 08:48:37+00:00 | \nAPITAG security and CVE database. Hello APITAG... | \nCVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N | \nMEDIUM | \n6.1 | \n2.7 | \n2.8 | \n
| 2 | \nCVE-2013-7447 | \nhttps://github.com/mate-desktop/eom/issues/93 | \nhttps://github.com/mate-desktop/eom/issues/93 | \nmate-desktop/eom | \n2015-07-26 22:46:13+00:00 | \nEOM crashes when trying to open a large PNG fi... | \nCVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H | \nMEDIUM | \n6.5 | \n3.6 | \n2.8 | \n
| 3 | \nCVE-2013-7458 | \nhttps://github.com/antirez/redis/issues/3284 | \nhttps://github.com/redis/redis/issues/3284 | \nredis/redis | \n2016-05-30 15:35:38+00:00 | \nredis cli: permissions when opening history fi... | \nCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | \nLOW | \n3.3 | \n1.4 | \n1.8 | \n
| 4 | \nCVE-2013-7458 | \nhttps://github.com/antirez/linenoise/issues/121 | \nhttps://github.com/antirez/linenoise/issues/121 | \nantirez/linenoise | \n2016-06-18 01:24:57+00:00 | \nFunction to save history as private file by de... | \nCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | \nLOW | \n3.3 | \n1.4 | \n1.8 | \n
| 5 | \nCVE-2013-7459 | \nhttps://github.com/dlitz/pycrypto/issues/176 | \nhttps://github.com/pycrypto/pycrypto/issues/176 | \npycrypto/pycrypto | \n2015-12-14 23:33:48+00:00 | \nAES.new with invalid parameter crashes python.... | \nCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | \nCRITICAL | \n9.8 | \n5.9 | \n3.9 | \n
| 6 | \nCVE-2013-7489 | \nhttps://github.com/bbangert/beaker/issues/191 | \nhttps://github.com/bbangert/beaker/issues/191 | \nbbangert/beaker | \n2020-05-14 18:02:40+00:00 | \nInsecure data serialization method by default ... | \nCVSS:3.1/AV:A/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H | \nMEDIUM | \n6.8 | \n5.9 | \n0.9 | \n
| 7 | \nCVE-2014-0087 | \nhttps://github.com/ManageIQ/manageiq/issues/1581 | \nhttps://github.com/manageiq/manageiq/issues/1581 | \nmanageiq/manageiq | \n2015-02-05 08:32:09+00:00 | \nHardening of the RBAC check. The current code ... | \nCVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | \nHIGH | \n8.8 | \n5.9 | \n2.8 | \n
| 8 | \nCVE-2014-5002 | \nhttps://github.com/panthomakos/lynx/issues/3 | \nhttps://github.com/panthomakos/lynx/issues/3 | \npanthomakos/lynx | \n2018-01-12 00:12:50+00:00 | \nCVE: APITAG password exposed on the command li... | \nCVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | \nHIGH | \n7.8 | \n5.9 | \n1.8 | \n
| 9 | \nCVE-2014-7919 | \nhttps://github.com/alexpark07/Bookmark/issues/1 | \nhttps://github.com/alexpark07/bookmark/issues/1 | \nalexpark07/bookmark | \n2016-07-12 17:28:56+00:00 | \ncan you match up one of your disclosures?. FIL... | \nCVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H | \nHIGH | \n7.5 | \n3.6 | \n3.9 | \n
| \n | 0 | \n1 | \n
|---|---|---|
| 0 | \n0.022365 | \n1.330027 | \n
| 1 | \n-0.863975 | \n0.597988 | \n
| 2 | \n-0.454437 | \n0.162479 | \n
| 3 | \n-2.372864 | \n-0.154303 | \n
| 4 | \n-2.372864 | \n-0.154303 | \n
| 5 | \n1.539811 | \n0.528399 | \n
| 6 | \n0.138943 | \n-2.722275 | \n
| 7 | \n1.063009 | \n-0.639149 | \n
| 8 | \n0.596053 | \n-1.722707 | \n
| 9 | \n0.022365 | \n1.330027 | \n