Advanced 5-7 hours · 3 APIs

Build a URL Security Scanner

Check URLs against threat databases and capture visual screenshots for security auditing. Identify malicious sites before visiting them.

APIs Used

Data Flow

USER User submits a URL to scan API Check URL against threat database via Google Safe Browsing API Scan URL with multiple antivirus engines via VirusTotal API Capture visual screenshot of the page via Screenshotlayer PROCESS Compile security report with threat status OUTPUT Display security report with screenshot
User Action
API Call
Transform
Output

How It Works

1

User submits a URL to scan for security threats

2

Check the URL against Google Safe Browsing threat lists

3

Submit the URL to VirusTotal for multi-engine scanning

4

Capture a screenshot of the page via Screenshotlayer for visual inspection

5

Compile a security report with threat status, scan results, and screenshot

Code Outline

Pseudocode / JavaScript
// 1. User submits URL to scan
const targetUrl = 'https://suspicious-site.example.com';

// 2. Check Google Safe Browsing
const safeBrowsingRes = await fetch(
  'https://safebrowsing.googleapis.com/v4/threatMatches:find?key=YOUR_API_KEY',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      client: { clientId: 'security-scanner', clientVersion: '1.0' },
      threatInfo: {
        threatTypes: ['MALWARE', 'SOCIAL_ENGINEERING', 'UNWANTED_SOFTWARE'],
        platformTypes: ['ANY_PLATFORM'],
        threatEntryTypes: ['URL'],
        threatEntries: [{ url: targetUrl }]
      }
    })
  }
);
const safeBrowsingData = await safeBrowsingRes.json();
const isSafe = !safeBrowsingData.matches;

// 3. Scan with VirusTotal
const vtScanRes = await fetch('https://www.virustotal.com/api/v3/urls', {
  method: 'POST',
  headers: { 'x-apikey': 'YOUR_VT_KEY', 'Content-Type': 'application/x-www-form-urlencoded' },
  body: `url=${encodeURIComponent(targetUrl)}`
});
const vtScan = await vtScanRes.json();
const analysisId = vtScan.data.id;

// 4. Get VirusTotal analysis results
const vtResultRes = await fetch(`https://www.virustotal.com/api/v3/analyses/${analysisId}`, {
  headers: { 'x-apikey': 'YOUR_VT_KEY' }
});
const vtResult = await vtResultRes.json();
const malicious = vtResult.data.attributes.stats.malicious;

// 5. Capture screenshot
const screenshotUrl = `https://api.screenshotlayer.com/api/capture?access_key=YOUR_KEY&url=${encodeURIComponent(targetUrl)}&viewport=1280x720`;

console.log(`URL: ${targetUrl}`);
console.log(`Safe Browsing: ${isSafe ? 'SAFE' : 'THREATS FOUND'}`);
console.log(`VirusTotal: ${malicious} engines flagged as malicious`);
console.log(`Screenshot: ${screenshotUrl}`);

Note: These recipes are AI-generated suggestions based on API capabilities. Actual implementation may vary. Always refer to official API documentation for the latest specifications.