Skip to content

Commit

Permalink
Merge pull request #1 from miladnouri/init
Browse files Browse the repository at this point in the history
Init
  • Loading branch information
miladnouri authored Dec 10, 2023
2 parents b829610 + cd6e3f1 commit 03a2193
Show file tree
Hide file tree
Showing 15 changed files with 224 additions and 0 deletions.
15 changes: 15 additions & 0 deletions assets/css/payment-gateway-verify.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#motmaenBashCornerSign {
position: fixed !important;
box-sizing: border-box;
overflow-y:scroll;
overflow-x:hidden;
top: 0px !important;
left: 0;
opacity: 0.95;
z-index: 999999999 !important;
}

#motmaenBashCornerSign img#motmaenBashCornerSignLogo{
width: 160px !important;
max-width: 160px !important;
}
88 changes: 88 additions & 0 deletions assets/css/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
@font-face {
font-family: Shabnam;
font-weight: normal;
src: url('../fonts/Shabnam.eot');
src: url('../fonts/Shabnam.eot?#iefix') format('embedded-opentype'),
url('../fonts/Shabnam.woff') format('woff'),
url('../fonts/Shabnam.ttf') format('truetype');
}

body {
background: #fff;
font-family: "Shabnam";
font-size: 12px;
width: 330px;
padding: 2px 6px;
}

a, a:visited{
text-decoration: none;
}

hr{
clear: both;
margin: 0;
border-top: 1px dashed #e6e6e6;
border-bottom: 0px;
}

.footer-box{
margin: 10px 0 6px 0;
color: gray;
font-size: 11px;
}

.footer-box a{
color: #ff7200;
font-size: 10px;
}

#status_icon {
margin: 20px auto 6px auto;
display: block;
max-width: 80px;
/* max-height: 76px; */
}

.status_title_ok, .status_title_nok {
margin-bottom: 16px;
text-align: center;
}

.status_title_ok{
color: #26bfa6;
font-size: 18px;
}

.status_title_nok{
color: #f44336;
font-size: 13px;
font-weight: bold;
line-height: 28px;
}

.button-link, .button-link:visited {
float: right;
background: #f7f7f7;
margin: 6px 2px;
text-align: center;
width: calc(50% - 4px);
font-size: 13px;
color: gray;
border-radius: 4px;
box-sizing: border-box;
border: 1px solid gray;
padding: 4px 4px;
}

.button-link:hover, .button-link:visited:hover {
background: #f4f4f4;
}

.right {
float: right;
}

.left {
float: left;
}
Binary file added assets/fonts/Shabnam.eot
Binary file not shown.
Binary file added assets/fonts/Shabnam.ttf
Binary file not shown.
Binary file added assets/fonts/Shabnam.woff
Binary file not shown.
Binary file added assets/images/icon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/icon_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/icon_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/icon_ok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions assets/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Listen for any changes to the URL of any tab.
chrome.tabs.onUpdated.addListener(checkForValidUrl);

// Called when the url of a tab changes.
function checkForValidUrl(tabId, changeInfo, tab) {
if (tab.url != undefined && changeInfo.status == "complete") {
//show the page action.
chrome.pageAction.show(tabId);
var url = new URL(tab.url);
if( url.hostname.match(/\.shaparak\.ir$/i) && url.protocol == "https:" ){
// chrome.pageAction.show(tabId);
chrome.pageAction.setIcon({
tabId: tabId,
path: {
128: "/assets/images/icon_ok.png"
}
});
chrome.pageAction.setTitle({
tabId: tabId,
title: "درگاه پرداخت امن، مطمئن باش"
});
}else{

// Do Nothing
}

}


};
16 changes: 16 additions & 0 deletions assets/js/content-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var url = new URL(location.href);
if( (url.hostname=='ipg.cbinasim.ir' || url.hostname.match(/\.shaparak\.ir$/i) ) && url.protocol == "https:" ){

var overlayDiv=document.createElement("div");
overlayDiv.id = "motmaenBashCornerSign";
overlayDiv.innerHTML = '<a id="motmaenBashCornerSignLink" href="https://tookan.tech/?utm_source=firefox&utm_medium=motmaenbash&utm_campaign=extensions&utm_term=sign_logo" target="_blank"></a>'
document.body.insertBefore(overlayDiv, document.body.firstChild);

var motmaenBashLogoImg = document.createElement("img");
motmaenBashLogoImg.setAttribute("src", chrome.runtime.getURL('assets/images/sign.png'));
motmaenBashLogoImg.setAttribute("title", "این درگاه پرداخت معتبر و امن است");
motmaenBashLogoImg.setAttribute("target", "_blank");
motmaenBashLogoImg.id = "motmaenBashCornerSignLogo";
document.getElementById('motmaenBashCornerSignLink').appendChild(motmaenBashLogoImg);

}
18 changes: 18 additions & 0 deletions assets/js/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var statusIcon, statusTitle;
chrome.tabs.query({
active: true,
currentWindow: true
}, function(tabs) {
var url = new URL(tabs[0].url);
statusIcon = document.getElementById('status_icon');
statusTitle = document.getElementById('status_title');
if( url.hostname.match(/\.shaparak\.ir$/i) && url.protocol == "https:" ){
statusTitle.className = "status_title_ok";
statusTitle.innerHTML = 'درگاه پرداخت امن، مطمئن باش';
statusIcon.src = 'assets/images/icon_ok.png';
}else{
statusTitle.className = "status_title_nok";
statusTitle.innerHTML = 'این صفحه یک درگاه پرداخت نیست. تنها در صورت مشاهده تیک سبز رنگ، مطمئن باش که یک درگاه امن و معتبر است.';
statusIcon.src = 'assets/images/icon_128.png';
}
});
35 changes: 35 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"manifest_version": 2,
"name": "MotmaenBash | مطمئن باش",
"description": "مطمئن باش | بررسی اصلالت درگاه‌های پرداخت ایرانی",
"version": "1.0.2",
"author": "Milad Nouri",
"homepage_url": "https://motmaenbash.tookan.tech",
"background":{
"scripts":["assets/js/background.js"]
},
"content_scripts": [
{
"matches": ["https://*.shaparak.ir/*", "https://*.cbinasim.ir/*"],
"exclude_globs": ["*://www.shaparak.ir/*", "*://shaparak.ir/*"],
"css": ["assets/css/payment-gateway-verify.css"],
"js": ["assets/js/content-script.js"]
}
],
"page_action": {
"default_icon": "assets/images/icon_128.png",
"default_title": "MotmaenBash",
"default_popup": "popup.html"
},

"icons": { "16": "assets/images/icon_16.png",
"48": "assets/images/icon_48.png",
"128": "assets/images/icon_128.png" },

"permissions": [
"tabs"
],

"web_accessible_resources": ["assets/images/sign.png"]

}
22 changes: 22 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html dir="rtl">
<head>
<meta charset="UTF-8">
<title>MotmaenBash</title>
<script src="assets/js/popup.js"></script>
<link rel="stylesheet" type="text/css" href="assets/css/popup.css">
</head>
<body>
<div class="page">
<img src="assets/images/icon_128.png" id="status_icon" />
<br>
<div id="status_title" class="status_title_ok"></div>
<hr>
<a href="https://motmaenbash.milad.nu/help/phishing" target="_blank" class="button-link">آشنایی با فیشینگ</a>
<a href="https://milad.nu/page/donate" target="_blank" class="button-link">حمایت مالی</a>
<hr>
</div>
<div class="footer-box right">هدیه‌ای به تمام ایرانیان</div>
<div class="footer-box left"><a href="https://milad.nu" target="_blank">https://milad.nu</a></div>
</body>
</html>

0 comments on commit 03a2193

Please sign in to comment.