first commit

This commit is contained in:
momenbasel
2019-08-07 07:37:01 +02:00
commit a9f7a03c45
18 changed files with 482 additions and 0 deletions
+7
View File
File diff suppressed because one or more lines are too long
+4
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

+106
View File
@@ -0,0 +1,106 @@
/*
* Globals
*/
/* Links */
a,
a:focus,
a:hover {
color: #fff;
}
/* Custom default button */
.btn-secondary,
.btn-secondary:hover,
.btn-secondary:focus {
color: #333;
text-shadow: none; /* Prevent inheritance from `body` */
background-color: #fff;
border: .05rem solid #fff;
}
/*
* Base structure
*/
html,
body {
height: 100%;
background-color: #333;
}
body {
display: -ms-flexbox;
display: flex;
color: #fff;
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, .5);
box-shadow: inset 0 0 5rem rgba(0, 0, 0, .5);
}
.cover-container {
max-width: 42em;
}
/*
* Header
*/
.masthead {
margin-bottom: 2rem;
}
.masthead-brand {
margin-bottom: 0;
}
.nav-masthead .nav-link {
padding: .25rem 0;
font-weight: 700;
color: rgba(255, 255, 255, .5);
background-color: transparent;
border-bottom: .25rem solid transparent;
}
.nav-masthead .nav-link:hover,
.nav-masthead .nav-link:focus {
border-bottom-color: rgba(255, 255, 255, .25);
}
.nav-masthead .nav-link + .nav-link {
margin-left: 1rem;
}
.nav-masthead .active {
color: #fff;
border-bottom-color: #fff;
}
@media (min-width: 48em) {
.masthead-brand {
float: left;
}
.nav-masthead {
float: right;
}
}
/*
* Cover
*/
.cover {
padding: 0 1.5rem;
}
.cover .btn-lg {
padding: .75rem 1.25rem;
font-weight: 700;
}
/*
* Footer
*/
.mastfoot {
color: rgba(255, 255, 255, .5);
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB

Submodule https---github.com-momenbasel-keyFinder.git added at cdb33c2c23
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

+14
View File
@@ -0,0 +1,14 @@
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
if (request.method == "getStatus")
sendResponse({status: localStorage});
else
sendResponse({});
});
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
if (request.getter)
console.log(request.getter);
localStorage.setItem(request.getter,request.getter);
});
+7
View File
File diff suppressed because one or more lines are too long
+59
View File
@@ -0,0 +1,59 @@
console.log("keyFinder🔑 is working!");
//custom searches
let js = document.getElementsByTagName('script');
chrome.runtime.sendMessage({method: "getStatus"}, function(response) {
var savedSearch = response.status;
for (var key in savedSearch) {
if (savedSearch.hasOwnProperty(key)) {
for(src in js){
var url = js[src].src;
let regex = new RegExp(key,'i');
try {
if(url.search(regex) !== -1) {
chrome.runtime.sendMessage({getter: url}, function(response) {
});
console.log(`KeyFinder: a potential API key found: ${url} it matched your search ${key}`);
}
} catch(err) {
//do nothing
}
}
}
}
});
// for GoogleMaps API key
for (src in js) {
let url = js[src].src;
try {
if(url.search(/key/i) !== -1) {
console.log(`KeyFinder: a potential API key found: ${url}`)
//saving the results
chrome.runtime.sendMessage({getter: url}, function(response) {
});
}
} catch (err) {
//console.log(err)
}
}
View File
+2
View File
File diff suppressed because one or more lines are too long
+5
View File
File diff suppressed because one or more lines are too long
+48
View File
@@ -0,0 +1,48 @@
var save = document.getElementById('save');
save.onclick = function() {
var keyword = document.getElementById("keyword").value;
if(keyword == "key") {
alert("already exist!");
}
if(keyword === ""){
alert("cannot be empty");
}
if(keyword == localStorage.getItem(keyword)){
alert("you can't add the same word twice!")
}
else
{
keyword.trim();
//setting key value to keyword for easy lopping
localStorage.setItem(keyword,keyword);
}
}
var i;
for(i=0; i < localStorage.length; i++) {
//regex to filter keywords from localStorage and showing URLS
if(!/(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(localStorage.key(i))){
if(localStorage.key(i) !== 'undefined')
{
$('body').append(`<li>${localStorage.key(i)}<button value=${localStorage.key(i)} class="btn"><i class="fa fa-trash"></i></button></li>`)
}
}
}
$('.btn').click(function() {
var selectedItem = $(this).val();
localStorage.removeItem(selectedItem);
location.reload();
alert(`${selectedItem} removed`);
})
+87
View File
@@ -0,0 +1,87 @@
//Searching localStorage for URL
var i;
for(i=0; i < localStorage.length; i++) {
//regex to filter keywords from localStorage and showing URLS
if(/(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(localStorage.key(i))){
$('.table').append(`
<tr>
<td scope="row"></td>
<td>${extractHostname(localStorage.key(i))}</td>
<td> <a href='${localStorage.key(i)}'>${localStorage.key(i)}</a> <button value=${localStorage.key(i)} class="btn"><i class="fa fa-trash"></i></button> </td>
<td>${searchKeywordOnURL(localStorage.key(i))}</td>
<tr>
<style>
`)
}
}
function searchKeywordOnURL(key) {
let i;
var keyword;
for(i=0; i < localStorage.length; i++) {
//regex to filter keywords from localStorage and showing URLS
if(!/(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(localStorage.key(i))){
if(key.indexOf(localStorage.key(i)) !== -1) {
return localStorage.key(i);
}
}
}
}
//numbering results && self-inovking the function
(function(cl){
var table = document.querySelector('table.' + cl)
var trs = table.querySelectorAll('tr')
var counter = 1
Array.prototype.forEach.call(trs, function(x,i){
var firstChild = x.children[0]
if (firstChild.tagName === 'TD') {
var cell = document.createElement('td')
cell.textContent = counter ++
x.insertBefore(cell,firstChild)
} else {
firstChild.setAttribute('colspan',2)
}
})
})("table");
//delete
$('.btn').click(function() {
var selectedItem = $(this).val();
localStorage.removeItem(selectedItem);
location.reload();
alert(`${selectedItem} removed`);
})
//extract domain name from URL
function extractHostname(url) {
var hostname;
//find & remove protocol (http, ftp, etc.) and get hostname
if (url.indexOf("//") > -1) {
hostname = url.split('/')[2];
}
else {
hostname = url.split('/')[0];
}
//find & remove port number
hostname = hostname.split(':')[0];
//find & remove "?"
hostname = hostname.split('?')[0];
return hostname;
}
+23
View File
@@ -0,0 +1,23 @@
{
"name": "KeyFinder",
"description": "a browser extension that searches the DOM for leaked keys🔑.",
"version":"1.0.0",
"manifest_version": 2,
"browser_action":{
"default_icon":"./css/icon.png",
"default_popup":"popup.html"
},
"content_scripts": [
{
"matches":[
"<all_urls>"
],
"js": ["./js/results.js","./js/jquery.js","./js/content.js"]
}
],
"background": {
"scripts":["./js/background.js"]
}
,
"permissions": ["activeTab","storage"]
}
+52
View File
@@ -0,0 +1,52 @@
<!--
▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░▌ ▐░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░▌░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌
▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░▌░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌
▐░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░▌░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀█░█▀▀
▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▄▄▄▄█░█▄▄▄▄ ▐░▌ ▐░▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌
▐░▌ ▐░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌
▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀
by @momenbassel
!-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compitble" content="ie=edge">
<title>KeyFinder</title>
<link rel="stylesheet" herf="https://fonts.googleapis.com/css?family=Open+Sans" type="text/css">
<link rel="stylesheet" href="./css/font-awesome.min.css" type="text/css">
</head>
<body>
<div class="modal-header">
<h1 class="logo">
<img src="./css/icon.png" alt="keyFinder Logo" class="logo-icon"> Key Finder <span class="version">1.00</span>
</h1>
</div>
<div class="modal-content">
<p> Grab keys from the DOM scripts<p>
</div>
<form>
<label for="keyword">Search:</label>
<input type="text" id="keyword" aria-describedby="keyword" style="width:50px" placeholder="API">
<button id="save" type="submit">add</button>
<br>
<small id="keywordDetails">add a keyword to search the DOM scripts for.</small>
<script src="./js/jquery.js"></script>
<script src="./js/popup.js"></script>
<script src="./js/content.js"> </script>
</div>
</form>
<ul>
</ul>
<a href="/results.html" target="_blank">Result/s</a>
</body>
</html>
+67
View File
@@ -0,0 +1,67 @@
<!--
▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░▌ ▐░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░▌░▌ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌
▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░▌░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌
▐░░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░▌░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▀▀▀▀█░█▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀█░█▀▀
▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌
▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌ ▄▄▄▄█░█▄▄▄▄ ▐░▌ ▐░▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌
▐░▌ ▐░▌▐░░░░░░░░░░░▌ ▐░▌ ▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌
▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀
by @momenbassel
!-->
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compitble" content="ie=edge">
<title>KeyFinder Results</title>
<!-- requiring/importing bootstrap -->
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="./css/font-awesome.min.css">
<script src="./js/jquery.js"></script>
<script src="./js/popper.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/results.js"></script>
</head>
<body class="text-center">
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
<h3 class="masthead-brand">KeyFinder🔑</h3>
</header>
<main role="main" class="inner cover">
<h1 class="cover-heading">Result/s:</h1>
<p class="lead">Keyfinder🔑 is a tool that let you find keys while surfing the web!</p>
<p class="lead">
</p>
</main>
<main role="main" class="inner cover">
<table class="table table-dark" cellpadding="3" width="50%" height="50%">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Domain</th>
<th scope="col">URL</th>
<th scope="col">Search Word</th>
</tr>
</thead>
<tbody>
</table>
<footer class="mastfoot mt-auto">
<div class="inner">keyFinder🔑 by <a href="https://twitter.com/momenbassel" target="_blank">@momenbassel </a>
</div>
</footer>
<script src="./js/results.js"></script>
</body>
</html>