mirror of
https://github.com/Lissy93/web-check.git
synced 2025-03-13 14:39:48 +01:00
Adds functionality for threats, malware, phishing, viruses
This commit is contained in:
parent
83c8d311b3
commit
759bb603df
@ -52,6 +52,9 @@ const handler = async (url) => {
|
||||
const urlHaus = await getUrlHausResult(url);
|
||||
const phishTank = await getPhishTankResult(url);
|
||||
const cloudmersive = await getCloudmersiveResult(url);
|
||||
if (urlHaus.error && phishTank.error && cloudmersive.error) {
|
||||
throw new Error(`All requests failed - ${urlHaus.error} ${phishTank.error} ${cloudmersive.error}`);
|
||||
}
|
||||
return JSON.stringify({ urlHaus, phishTank, cloudmersive });
|
||||
} catch (error) {
|
||||
throw new Error(error.message);
|
@ -33,8 +33,22 @@ const convertToDate = (dateString: string): string => {
|
||||
|
||||
const MalwareCard = (props: {data: any, title: string, actionButtons: any }): JSX.Element => {
|
||||
const urlHaus = props.data.urlHaus;
|
||||
const phishTank = props.data.phishTank;
|
||||
const cloudmersive = props.data.cloudmersive;
|
||||
return (
|
||||
<Card heading={props.title} actionButtons={props.actionButtons}>
|
||||
{ cloudmersive && !cloudmersive.error && (
|
||||
<Row lbl="Threat Type" val={cloudmersive.WebsiteThreatType} />
|
||||
)}
|
||||
{ phishTank && !phishTank.error && (
|
||||
<Row lbl="Phishing Status" val={phishTank.url0 ? '❌ Phishing Identified' : '✅ No Phishing Identified!'} />
|
||||
)}
|
||||
{ phishTank.url0 && phishTank.url0.phish_detail_page && (
|
||||
<Row lbl="" val="">
|
||||
<span className="lbl">Phish Info</span>
|
||||
<span className="val"><a href={phishTank.url0.phish_detail_page}>{phishTank.url0.phish_id}</a></span>
|
||||
</Row>
|
||||
)}
|
||||
{ urlHaus.query_status === 'no_results' && <Row lbl="Status" val="✅ Nothing Found!" />}
|
||||
{ urlHaus.query_status === 'ok' && (
|
||||
<>
|
@ -218,7 +218,7 @@ const jobNames = [
|
||||
'rank',
|
||||
'archives',
|
||||
'block-lists',
|
||||
'malware',
|
||||
'threats',
|
||||
] as const;
|
||||
|
||||
export const initialJobs = jobNames.map((job: string) => {
|
||||
|
@ -53,7 +53,7 @@ import FirewallCard from 'components/Results/Firewall';
|
||||
import ArchivesCard from 'components/Results/Archives';
|
||||
import RankCard from 'components/Results/Rank';
|
||||
import BlockListsCard from 'components/Results/BlockLists';
|
||||
import MalwareCard from 'components/Results/Malware';
|
||||
import ThreatsCard from 'components/Results/Threats';
|
||||
|
||||
import keys from 'utils/get-keys';
|
||||
import { determineAddressType, AddressType } from 'utils/address-type-checker';
|
||||
@ -450,11 +450,11 @@ const Results = (): JSX.Element => {
|
||||
});
|
||||
|
||||
// Check if a host is present on the URLHaus malware list
|
||||
const [malwareResults, updateMalwareResults] = useMotherHook({
|
||||
jobId: 'malware',
|
||||
const [threatResults, updateThreatResults] = useMotherHook({
|
||||
jobId: 'threats',
|
||||
updateLoadingJobs,
|
||||
addressInfo: { address, addressType, expectedAddressTypes: urlTypeOnly },
|
||||
fetchRequest: () => fetch(`${api}/malware?url=${address}`).then(res => parseJson(res)),
|
||||
fetchRequest: () => fetch(`${api}/threats?url=${address}`).then(res => parseJson(res)),
|
||||
});
|
||||
|
||||
/* Cancel remaining jobs after 10 second timeout */
|
||||
@ -512,7 +512,7 @@ const Results = (): JSX.Element => {
|
||||
{ id: 'linked-pages', title: 'Linked Pages', result: linkedPagesResults, Component: ContentLinksCard, refresh: updateLinkedPagesResults },
|
||||
{ id: 'txt-records', title: 'TXT Records', result: txtRecordResults, Component: TxtRecordCard, refresh: updateTxtRecordResults },
|
||||
{ id: 'block-lists', title: 'Block Lists', result: blockListsResults, Component: BlockListsCard, refresh: updateBlockListsResults },
|
||||
{ id: 'malware', title: 'Malware', result: malwareResults, Component: MalwareCard, refresh: updateMalwareResults },
|
||||
{ id: 'threats', title: 'Threats', result: threatResults, Component: ThreatsCard, refresh: updateThreatResults },
|
||||
{ id: 'features', title: 'Site Features', result: siteFeaturesResults, Component: SiteFeaturesCard, refresh: updateSiteFeaturesResults },
|
||||
{ id: 'sitemap', title: 'Pages', result: sitemapResults, Component: SitemapCard, refresh: updateSitemapResults },
|
||||
{ id: 'carbon', title: 'Carbon Footprint', result: carbonResults, Component: CarbonFootprintCard, refresh: updateCarbonResults },
|
||||
|
Loading…
Reference in New Issue
Block a user