Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikhith221B authored Jul 18, 2024
1 parent 0e5a892 commit a06a9cc
Showing 1 changed file with 124 additions and 0 deletions.
124 changes: 124 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>URL Submit Form</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
.card {
margin-top: 20px;
}

pre {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>

<body>
<div class="container">
<div class="row justify-content-center mt-5">
<div class="col-md-8">
<div class="card">
<div class="card-body">
<h5 class="card-title text-center">Submit URL</h5>
<form id="urlForm">
<div class="form-group">
<label for="urlInput">Paste your URL(s) here (comma-separated for multiple URLs)</label>
<input type="text" class="form-control" id="urlInput"
placeholder="https://example.com, https://another.com" required>
</div>
<button type="submit" class="btn btn-primary btn-block">Submit</button>
</form>
</div>
</div>
<div id="result" class="mt-4"></div>
</div>
</div>
</div>

<!-- Bootstrap JS and dependencies -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
document.getElementById('urlForm').addEventListener('submit', async function (event) {
event.preventDefault();

const urlInput = document.getElementById('urlInput').value;
const urls = urlInput.split(',').map(url => url.trim());

const response = await fetch('https://phishing-url-hrid.onrender.com/check_urls', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ urls: urls })
});

const result = await response.json();
const resultDiv = document.getElementById('result');
resultDiv.innerHTML = '';

const predictions = result.predictions;
const urlInfoList = result.url_info;

urlInfoList.forEach((info, index) => {
const url = urls[index];
const prediction = predictions[url];
const card = document.createElement('div');
card.className = 'card';

const cardBody = document.createElement('div');
cardBody.className = 'card-body';

const cardTitle = document.createElement('h5');
cardTitle.className = 'card-title';
cardTitle.innerText = `URL: ${url}`;

const predictionText = document.createElement('p');
predictionText.className = 'card-text';
predictionText.innerHTML = `<strong>Prediction:</strong> ${prediction}`;

const domainName = info.domain_name || 'N/A';
const registrar = info.registrar || 'N/A';
const creationDate = Array.isArray(info.creation_date) ? info.creation_date.join(', ') : info.creation_date || 'N/A';
const emails = Array.isArray(info.emails) ? info.emails.join(', ') : info.emails || 'N/A';
const name = info.name || 'N/A';
const org = info.org || 'N/A';
const whoisServer = info.whois_server || 'N/A';
const ipAddress = info.ip_address || 'N/A';
const sslCertified = info.ssl_certified ? 'Yes' : 'No';
const sslInfo = JSON.stringify(info.ssl_info, null, 2) || 'N/A';

const urlInfoHtml = `
<p><strong>Domain Name:</strong> ${domainName}</p>
<p><strong>Registrar:</strong> ${registrar}</p>
<p><strong>Creation Date:</strong> ${creationDate}</p>
<p><strong>Emails:</strong> ${emails}</p>
<p><strong>Name:</strong> ${name}</p>
<p><strong>Organization:</strong> ${org}</p>
<p><strong>Whois Server:</strong> ${whoisServer}</p>
<p><strong>IP Address:</strong> ${ipAddress}</p>
<p><strong>SSL Certified:</strong> ${sslCertified}</p>
<div class="mt-4">
<h6>SSL Info</h6>
<pre>${sslInfo}</pre>
</div>
`;

cardBody.appendChild(cardTitle);
cardBody.appendChild(predictionText);
cardBody.innerHTML += urlInfoHtml;
card.appendChild(cardBody);
resultDiv.appendChild(card);
});
});
</script>
</body>

</html>

0 comments on commit a06a9cc

Please sign in to comment.