Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 46420da

Browse files
committed
Update app.py, background.js, override.html, overrideJs.js, and overrideStyles.css
1 parent 8deffee commit 46420da

File tree

7 files changed

+79
-46
lines changed

7 files changed

+79
-46
lines changed

backend/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ async def update(id: int, real: bool):
140140

141141

142142
# Get website details from whois
143+
143144
@app.get('/details')
144145
async def whois(url: str):
145146
domain = get_domain_name(url)

backend/db/db.sqlite3

4 KB
Binary file not shown.

frontend/background.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ chrome.tabs.onUpdated.addListener(async () => {
2626
let phishing_url = `${server_url}phishing?url=${activeTabUrl}`;
2727
phishing = await checkPhishing(phishing_url);
2828

29+
// In background.js
2930
if (phishing) {
30-
chrome.tabs.update({ url: "override.html" });
31+
var url = "override.html?url=" + encodeURIComponent(activeTabUrl);
32+
chrome.tabs.update({ url: url });
3133
}
3234
console.log(phishing);
3335
});
@@ -75,8 +77,8 @@ chrome.contextMenus.onClicked.addListener((clickData) => {
7577
iconUrl: "logo.png",
7678
title: "Review Validation",
7779
message: data.prediction
78-
? "The review is authentic"
79-
: "The review is likely fake (take it with a grain of salt)",
80+
? "The review is likely fake (take it with a grain of salt)"
81+
: "The review is authentic",
8082
priority: 1,
8183
});
8284
})

frontend/override.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,26 @@
1515
<body class="container">
1616
<div class="row">
1717
<div class="col">
18-
<h1>POSSIBLY A PHISING SITE</h1>
18+
<h1>POSSIBLY A PHISING , MALICIOUS OR PIRATING SITE</h1>
1919
</div>
2020
</div>
2121

22-
<div class="row justify-content-md-center">
23-
<div id="reportContainer" class="container">
24-
<div class="row">
25-
<div class="col align-self-center">
26-
<h3>Not a Phising site? Report below</h3>
27-
</div>
28-
<div class="col align-self-center">
29-
<textarea name="" id="reportBox"></textarea>
30-
</div>
31-
<div class="col">
32-
<button
33-
type="button"
34-
id="reportBtn"
35-
class="btn btn-outline-danger btn-lg"
36-
>
37-
Report!
38-
</button>
39-
</div>
22+
<div id="reportContainer" class="container">
23+
<div class="row">
24+
<div class="col align-self-center">
25+
<h3>Not a MALICIOUS site? Report below</h3>
26+
</div>
27+
<div class="col align-self-center">
28+
<textarea name="" id="reportBox"></textarea>
29+
</div>
30+
<div class="col">
31+
<button
32+
type="button"
33+
id="reportBtn"
34+
class="btn btn-outline-danger btn-lg"
35+
>
36+
Report!
37+
</button>
4038
</div>
4139
</div>
4240
</div>

frontend/overrideJs.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,34 @@ document.getElementById("proceedBtn").addEventListener("click", function () {
66
window.history.go(-1);
77
return false;
88
});
9+
let params = new URLSearchParams(window.location.search);
10+
let url = params.get("url");
11+
12+
if (url) {
13+
url = decodeURIComponent(url);
14+
} else {
15+
url = "https://www.google.com";
16+
}
17+
document.getElementById("reportBtn").addEventListener("click", function () {
18+
let report_url = `http://127.0.0.1:8000/report_mistake`;
19+
let reportData = {
20+
url: url,
21+
reason: document.getElementById("reportBox").value,
22+
};
23+
24+
fetch(report_url, {
25+
method: "POST",
26+
headers: {
27+
"Content-Type": "application/json",
28+
},
29+
body: JSON.stringify(reportData),
30+
})
31+
.then((response) => response.json())
32+
.then((data) => {
33+
document.getElementById("reportBox").value = "";
34+
document.getElementById("submitReport").innerText = `${data.result}`;
35+
let submitButton = document.getElementById("submitReport");
36+
submitButton.disabled = true;
37+
})
38+
.catch((error) => console.log(error));
39+
});

frontend/overrideStyles.css

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Lexend&display=swap');
1+
@import url("https://fonts.googleapis.com/css2?family=Lexend&display=swap");
22

33
:root {
4-
--accentColor: #001233;
5-
--primaryColor: #FF595A;
6-
--secondaryColor: #CAC0B3;
4+
--accentColor: #001233;
5+
--primaryColor: #ff595a;
6+
--secondaryColor: #cac0b3;
77
}
88

99
* {
10-
margin: 0;
11-
padding: 0;
12-
box-sizing: border-box;
10+
margin: 0;
11+
padding: 0;
12+
box-sizing: border-box;
1313
}
1414

1515
body {
16-
font-family: 'Lexend', 'Arial';
17-
background-color: #001233;
18-
color: var(--primaryColor);
19-
display: grid;
20-
justify-items: center;
21-
width: 70%;
22-
padding: 5rem;
16+
font-family: "Lexend", "Arial";
17+
background-color: #001233;
18+
color: var(--primaryColor);
19+
display: grid;
20+
justify-items: center;
21+
width: 70%;
22+
padding: 5rem;
2323
}
2424

25-
2625
#reportBtn {
27-
width: 20rem;
26+
width: 20rem;
2827
}
2928

3029
textarea {
31-
resize: none;
32-
width: 40rem;
33-
height: 15rem;
30+
resize: none;
31+
width: 40rem;
32+
height: 15rem;
3433
}
3534

3635
#reportContainer {
37-
padding: 2rem;
38-
width: 60%;
36+
padding: 2rem;
37+
width: 60%;
3938
}
4039

4140
#proceedBtn {
42-
margin-top: 2rem;
43-
}
41+
margin-top: 2rem;
42+
}
43+
#urlForReport {
44+
height: 1.8rem;
45+
}

frontend/popup.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ document.getElementById("submitReport").addEventListener("click", function () {
4141
"Content-Type": "application/json",
4242
},
4343
body: JSON.stringify(reportData),
44-
mode: "no-cors", // Add this line
4544
})
4645
.then((response) => response.json())
4746
.then((data) => {

0 commit comments

Comments
 (0)