-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenshot_testing.py
More file actions
44 lines (38 loc) · 1.31 KB
/
screenshot_testing.py
File metadata and controls
44 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from selenium import webdriver
from exploit_price import vulrul
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
"""
DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)
url_a = "https://chandanbn.github.io/cvss/#CVSS:3.1/"
vulurl_results = vulrul("CVE-2010-3333")
url_b = vulurl_results[2]
url = url_a + url_b
# "https://chandanbn.github.io/cvss/#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
driver.get(url)
elem = driver.find_element_by_class_name("cvssjs")
elem.screenshot('Screenshots/Element.png')
driver.quit()
# screenshot = driver.save_screenshot('my_screenshot.png')
# driver.quit()
"""
def cvss_screenshot(cve_id):
DRIVER = 'chromedriver'
opt=Options()
opt.headless=True
driver = webdriver.Chrome(DRIVER,chrome_options=opt)
url_a = "https://chandanbn.github.io/cvss/#CVSS:3.1/"
vulurl_results = vulrul(cve_id)
url_b = vulurl_results[2]
url = url_a + url_b
driver.get(url)
# elem = driver.find_element_by_class_name("cvssjs")
elem = driver.find_element(By.CLASS_NAME, "cvssjs")
# screenshot_name = "Screenshots/"+ cve_id + "_cvss" + ".png"
screenshot_name = cve_id + "_cvss" + ".png"
screenshot_folder = "static/Screenshots/" + screenshot_name
elem.screenshot(screenshot_folder)
driver.quit()
return screenshot_name
# cvss_screenshot("CVE-2010-3333")