Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/venv
58 changes: 58 additions & 0 deletions static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ body {
box-shadow: -6px 8px 10px rgba(81,41,10,0.1),0px 2px 2px rgba(81,41,10,0.2);
}

.button:hover,
.button:active {
background-color: #f3f4f6;
box-shadow: -1px 2px 5px rgba(81,41,10,0.15),0px 1px 1px rgba(81,41,10,0.15);
Expand All @@ -87,6 +88,16 @@ body {
box-shadow: rgba(72, 35, 7, .46) 0 0 0 4px, -6px 8px 10px rgba(81,41,10,0.1), 0px 2px 2px rgba(81,41,10,0.2);
}

.button.button-sec {
padding: .5rem;
margin-left: 8px;
border: 1px solid;
}

.button.button-sec:hover {
background: #482307;
color: #f8eedb;
}

.main-body{
display: flex;
Expand Down Expand Up @@ -156,6 +167,53 @@ body {
width: 300px;
}

.d-flex {
margin: 18px 0;
display: flex;
align-items: center;
}

.example-fake-url {
margin: 0;
font-size: 20px;
color: #f8eedb;
text-decoration: underline;
}

#cover-spin {
position:fixed;
width:100%;
left:0;right:0;top:0;bottom:0;
background-color: rgba(255,255,255,0.7);
z-index:9999;
display:none;
}

@-webkit-keyframes spin {
from {-webkit-transform:rotate(0deg);}
to {-webkit-transform:rotate(360deg);}
}

@keyframes spin {
from {transform:rotate(0deg);}
to {transform:rotate(360deg);}
}

#cover-spin::after {
content:'';
display:block;
position:absolute;
left:48%;top:40%;
width:40px;height:40px;
border-style:solid;
border-color:black;
border-top-color:transparent;
border-width: 4px;
border-radius:50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}

@media (max-width: 576px) {
.form {
width: 100%;
Expand Down
195 changes: 120 additions & 75 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -1,87 +1,132 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="This website is develop for identify the safety of url.">
<meta name="keywords" content="phishing url,phishing,cyber security,machine learning,classifier,python">
<meta name="author" content="VAIBHAV BICHAVE">

<!-- BootStrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link href="static/styles.css" rel="stylesheet">
<title>URL detection</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="This website is develop for identify the safety of url.">
<meta name="keywords" content="phishing url,phishing,cyber security,machine learning,classifier,python">
<meta name="author" content="VAIBHAV BICHAVE">

<!-- BootStrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

<link href="../static/styles.css" rel="stylesheet">
<title>URL detection</title>

</head>

<body>

<div class=" container">

<div class=" container">
<div id="cover-spin"></div>
<div class="row">
<div class="form col-md" id="form1">
<h2>PHISHING URL DETECTION</h2>

<br>
<form action="/" method ="post">
<input type="text" class="form__input" name ='url' id="url" placeholder="Enter URL" required="" />
<label for="url" class="form__label">URL</label>
<button class="button" role="button" >Check here</button>
</form>

</div>

<div class="col-md" id="form2">

<div class="form col-md" id="form1">
<h2>PHISHING URL DETECTION</h2>

<br>
<h6 class = "right "><a href= {{ url }} target="_blank">{{ url }}</a></h6>

<form action="/" method="post">
<div class="d-flex">
<p id="fakeUrl" class="example-fake-url">http://flipkart.hikhop.com/</p>
<button id="demo-button" class="button button-sec" type="button">Try Fake Website Check</button>
</div>
<input type="text" class="form__input" name="url" id="url" placeholder="Enter URL" required>
<label for="url" class="form__label">URL</label>
<button onclick="validate(event)" id="submit" class="button" role="button">Check here</button>
</form>

</div>

<div class="col-md" id="form2">

<br>
<h6 class="right"><a href={{ url }} target="_blank">{{ url }}</a></h6>

<br>
<h3 id="prediction"></h3>
<button class="button2" id="button2" role="button" onclick="window.open('{{url}}')" target="_blank" >Still want to Continue</button>
<button class="button1" id="button1" role="button" onclick="window.open('{{url}}')" target="_blank">Continue</button>
</div>
</div>
<br>
<p>©2021 VAIBHAV BICHAVE</p>
</div>

<!-- JavaScript -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"></script>


<script>

let x = '{{xx}}';
let num = x*100;
if (0<=x && x<0.50){
num = 100-num;
}
let txtx = num.toString();
if(x<=1 && x>=0.50){
var label = "Website is "+txtx +"% safe to use...";
document.getElementById("prediction").innerHTML = label;
document.getElementById("button1").style.display="block";
}
else if (0<=x && x<0.50){
var label = "Website is "+txtx +"% unsafe to use..."
document.getElementById("prediction").innerHTML = label ;
document.getElementById("button2").style.display="block";
}

</script>

</body>
<button class="button2" id="button2" role="button" onclick="window.open('{{url}}')" target="_blank">
Still want to Continue
</button>
<button class="button1" id="button1" role="button" onclick="window.open('{{url}}')" target="_blank">
Continue
</button>
</div>
</div>
<br>
<p>©2021 VAIBHAV BICHAVE</p>
</div>

<!-- JavaScript -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"></script>


<script>

let x = '{{xx}}';
let num = x * 100;
if (0 <= x && x < 0.50) {
num = 100 - num;
}
let txtx = num.toString();
if (x <= 1 && x >= 0.50) {
var label = "Website is " + txtx + "% safe to use...";
document.getElementById("prediction").innerHTML = label;
document.getElementById("button1").style.display = "block";
}
else if (0 <= x && x < 0.50) {
var label = "Website is " + txtx + "% unsafe to use..."
document.getElementById("prediction").innerHTML = label;
document.getElementById("button2").style.display = "block";
}

// Select DOM elements once to avoid repeated access
const fakeUrlEl = document.getElementById("fakeUrl");
const inputEl = document.getElementById("url");
const submitBtn = document.getElementById("submit");
const demoBtnEl = document.getElementById("demo-button");
const loaderEl = document.getElementById("cover-spin");

</html>
demoBtnEl.addEventListener('click', demoClick);

function demoClick() {
showLoader();
inputEl.value = fakeUrlEl.innerText; // Set input value to fake URL text
submitBtn.click(); // Simulate submit button click
}

function showLoader() {
loaderEl.style.display = "block"; // Show loader
}

function validate(event) {
const url = inputEl.value.trim();
const urlPattern = /^(https?:\/\/)?([a-zA-Z0-9.-]+)\.([a-zA-Z]{2,})(\/[^\s]*)?$/; // Basic regex for URL

if (!url) {
alert('URL is required');
} else if (!urlPattern.test(url)) {
alert('Please enter a valid URL');
} else {
inputEl.style.borderColor = 'transparent'; // Tone down input to normal border
showLoader(); // Show loader if URL is valid
return; // Exit the function if validation is successful
}
debugger
inputEl.style.borderColor = 'red'; // Highlight input with red border
event.preventDefault(); // Prevent form submission
}
</script>

</body>

</html>