From 6bf594654d9a442014eb6b7b1a64ef507c5210d2 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Thu, 29 Feb 2024 21:07:38 +0000 Subject: [PATCH] Writes componenent to display detailed website metrics of a given service --- .../things/WebsiteDetailedInfo.astro | 329 ++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 web/src/components/things/WebsiteDetailedInfo.astro diff --git a/web/src/components/things/WebsiteDetailedInfo.astro b/web/src/components/things/WebsiteDetailedInfo.astro new file mode 100644 index 0000000..e4d09cb --- /dev/null +++ b/web/src/components/things/WebsiteDetailedInfo.astro @@ -0,0 +1,329 @@ +--- + +import type { WebsiteData } from '@utils/fetch-website-info'; +import { analyzeSecurityChecks } from '@utils/security-check-mappings'; +import FontAwesome from "@components/form/FontAwesome.svelte" +import Button from '@components/form/Button.astro'; + +interface Props { + websiteInfo: WebsiteData; + url: string; +}; + +const { websiteInfo, url } = Astro.props; + +const categoryLabels: {[key: string]: string} = { + is_torrent: 'Torrenting', + is_vpn_provider: 'VPN Provider', + is_free_hosting: 'Free Hosting', + is_anonymizer: 'Anonymizer', + is_url_shortener: 'URL Shortner', + is_free_dynamic_dns: 'Free Dynamic DNS', + is_code_sandbox: 'Code Sandbox', + is_form_builder: 'Form Builder', + is_free_file_sharing: 'File Sharing', + is_pastebin: 'Pastebin' +}; + +const siteCategories = Object.entries(websiteInfo.site_category) + .filter(([key, value]) => value) + .map(([key]) => categoryLabels[key]); + +const securityChecks = analyzeSecurityChecks(websiteInfo.security_checks); + +const risk = websiteInfo.risk_score.result; +let riskText = 'unknown'; +if (risk < 5) riskText = 'safe'; +else if (risk < 15) riskText = 'moderately safe'; +else if (risk < 50) riskText = 'risky'; +else if (risk < 75) riskText = 'dangerous'; +else if (risk >= 75) riskText = 'very dangerous'; + + +const clientSideKey = 'cd02a8520c90410bbc32440950bd3b7e'; +const screenshotOptions = 'format=png&width=960&height=540&ttl=2419200&response_type=image&no_cookie_banners=true&no_ads=true'; +const screenshotEndpoint = 'https://api.apiflash.com/v1'; +const screenshotUrl = `${screenshotEndpoint}/urltoimage?access_key=${clientSideKey}&url=${encodeURIComponent(url)}&${screenshotOptions}`; + +--- + +
+
+

Website

+

+ + {websiteInfo.web_page.title} +

+

{websiteInfo.web_page.description}

+

Redirects

+ {websiteInfo.redirection.found ? ( +

+ + Redirects to {websiteInfo.redirection.url} +

+ ) : ( +

+ + Does not redirect +

+ )} +

Security Checks

+ { securityChecks.failedChecks.length > 0 ? ( + <> +

+ {securityChecks.failedChecks.length} security checks failed ({securityChecks.passedChecks.length} passed) +

+
    + {securityChecks.failedChecks.map((check) => ( +
  • + {check} +
  • + ))} +
+ + ) : ( +

+ + All {securityChecks.passedChecks.length} security checks passed +

+ )} +

Server Details

+
    +
  • + IP Address + {websiteInfo.server_details.ip} +
  • + {websiteInfo.server_details.hostname && ( +
  • + Hostname + {websiteInfo.server_details.hostname} +
  • + )} +
  • + Location + + {websiteInfo.server_details.city_name}, + {websiteInfo.server_details.region_name}, + {websiteInfo.server_details.country_name}, + {websiteInfo.server_details.continent_code} + +
  • +
  • + ISP + {websiteInfo.server_details.isp} +
  • +
  • + ASN + {websiteInfo.server_details.asn} +
  • +
+ + {siteCategories.length > 0 && ( +

Categories

+

Some proxies may block this service, as it falls into the following categories

+
    + {siteCategories.map((category) => ( +
  • {category}
  • + ))} +
+ )} +

Associated Countries

+
    + {websiteInfo.geo_location.countries.map((country) => ( +
  • + + {country} +
  • + ))} +
+

Saftey Score

+

Website marked as {riskText}

+
+

{100-risk}%

+
+
+
+

Blacklist Check

+

{websiteInfo.url_parts.host} was found on {websiteInfo.domain_blacklist.detections} blacklists

+
    + { + websiteInfo.domain_blacklist.engines + .sort((a, b) => Number(b.detected) - Number(a.detected)) + .map((engine) => ( + engine.detected ? ( +
  • + + {engine.name} +
  • + ) : ( +
  • + + {engine.name} +
  • + ) + ))} +
+

Website Preview

+ + + +
+
+ + +