Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link bin #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
111 changes: 111 additions & 0 deletions static/linkbin/linkbin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* Set font, make stuff centered, set colors */
body {
font-family: Arial, sans-serif;
text-align: center;
margin: auto;
margin-top: 10%;
width: 60%;

color: black;
background-color: rgb(239, 239, 239);
}

/* Make logo big and have orange outline */
.logo {
user-select: none;
padding: 0;
margin: 0;
font-size: 70px;
font-weight: lighter;
text-shadow: 0 0 6px orangered;
}


.search-container {
margin: 20px;
}

.search-container button {
padding: 4px;
font-size: 24px;
}

/* Make search boxes look a bit better */
.search-container input {
border: 1px solid grey;
border-radius: 5px;
outline: 0;
background-color: #f5f5f5;
}
.search-container input:hover, .search-container input:focus {
border: 1.5px solid orange;
background-color: white;
}

/* Make the main search box big */
.big-input {
height: 20px;
font-size: 24px;
padding: 10px;
width: 100%;
}

/* Make the tag search box smaller and with a different font */
.small-input {
margin-top: 5px;
height: 10px;
font-size: 12px;
padding: 5px;
width: 64%;
font-family: 'Courier New', Courier, monospace;
}

/* Make each result box look nicer */
.result-box {
text-align: left;
border: 1px solid black;
border-radius: 5px;
background-color: #f5f5f5;
width: 100%;
margin: 8px auto 8px auto;
padding: 10px;
padding-top: 4px;
box-shadow: 2px 2px 5px black;
}
.result-box:hover {
background-color: white;
box-shadow: 1px 1px 8px orangered;
}

/* No margin on result title and have big font */
.result-title {
margin: 0;
font-size: 24px;
}

/* Make the link stick to the right side of the box */
.result-link {
position: relative;
float: right;
font-size: 24px;
}
/* Make the link have dotted underline and orange on hover */
.result-link a {
text-decoration-style: dotted;
}
.result-link a:hover {
color: orangered;
}

/* No margin on the description */
.result-description {
margin: 0;
}

/* Make tags grey and have no margin */
.result-tags {
margin: 0;
color: grey;
}


29 changes: 29 additions & 0 deletions static/linkbin/linkbin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="linkbin.css">
<title>OSUSEC Link Bin</title>
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js"
integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8="
crossorigin="anonymous"></script>
<script src="linkbin.js"></script>
</head>
<body>
<h1 class="logo">OSUSEC Link Bin</h1>
<div class="main-container">
<div class="search-container">
<input class="big-input" type="text" id="searchInput" placeholder="Search...">
<input class="small-input" type="text" id="tagsInput" placeholder="Tags separated by spaces...">
<label for="sort">Sort by:</label>
<select name="sort" id="sort">
<option value="none">None</option>
<option value="asc-nicheness">Nicheness (Asc)</option>
<option value="des-nicheness">Nicheness (Des)</option>
</select>
</div>
<div id="results-container"></div>
</div>
</body>
</html>
120 changes: 120 additions & 0 deletions static/linkbin/linkbin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Assume data.json has an array of objects like: [{name: 'Object 1'}, {name: 'Object 2'}, ...]
const fetchData = async () => {
const response = await fetch('links.json');
const data = await response.json();
return data;
};

const displayResults = (results) => {
const resultsContainer = document.getElementById('results-container');
resultsContainer.innerHTML = '';

if (results.length === 0) {
resultsContainer.innerHTML = 'No results found :(';
} else {
results.forEach((result) => {
// Container for each result
const resultDiv = document.createElement('div');
resultDiv.className = 'result-box';

// The link
const link = document.createElement('h3');
link.className = 'result-link';
link.innerHTML = '[<a href=' + result.link + ' target="_blank" rel="noopener noreferrer">link</a>]';
resultDiv.append(link);

// The title
const resultTitle = document.createElement('h3');
resultTitle.className = 'result-title';
resultTitle.textContent = result.title;
resultDiv.append(resultTitle);

// The description
const resultDescription = document.createElement('p');
resultDescription.className = 'result-description';
resultDescription.textContent = result.description;
resultDiv.append(resultDescription);

// The tags
const tags = document.createElement("p");
tags.className = 'result-tags';
tags.innerHTML = 'tags: <a style="font-family: \'Courier New\', Courier, monospace;">' + result.tags.join(', ') + '</a>';
resultDiv.append(tags);

// Add this result to the main results container
resultsContainer.appendChild(resultDiv);
});
}
};


// Weird sort function :sob:
function compareNicheness(a, b) {
const sortBy = document.getElementById('sort').value;

if(a.nicheness > b.nicheness) {
if (sortBy == 'asc-nicheness') {
return 1;
} else {
return -1;
}
} else if (a.nicheness < b.nicheness) {
if (sortBy == 'asc-nicheness') {
return -1;
} else {
return 1;
}
}

return 0;
}

const search = async () => {
// Get the data
const data = await fetchData();

// Get the search query
const query = document.getElementById('searchInput').value.toLowerCase();

// Get the tags
const tags = document.getElementById('tagsInput').value.toLowerCase().split(' ');

// Filter by tags if they were specified
var tagged = data;
tags.forEach((tag) => {
if(tag.length != 0) {
tagged = tagged.filter((item) => item.tags.includes(tag));
}
});

// Filter by search query
var filtered = tagged.filter((item) => item.title.toLowerCase().includes(query) || item.description.toLowerCase().includes(query));

// Sort if needed
if (document.getElementById('sort').value != 'none') {
filtered.sort(compareNicheness);
}

// Display the results
displayResults(filtered);
};


// Fetch data and display all results initially
fetchData().then((data) => displayResults(data));


// jQuery code called after web page loads
$(function() {

// Execute a search any time an input field changes
$('input').on('input', function() {
search();
});

// Also execute a search any time the sort by parameter changes
$('select').on('input', function() {
search();
});

});
30 changes: 30 additions & 0 deletions static/linkbin/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"link": "https://github.com/HACKE-RC/awesome-reversing",
"title": "GitHub | Awesome Reversing",
"description": "A github awesome list for reverse engineering",
"tags": ["awesome-list", "reversing", "github"],
"nicheness": 1
},
{
"link": "https://empyreal96.github.io/nt-info-depot/Windows-Internals-PDFs/Windows%20System%20Internals%207e%20Part%201.pdf",
"title": "Windows Internals E-Book PDF",
"description": "An e book about windows internals",
"tags": ["windows", "ebook"],
"nicheness": 5
},
{
"link": "https://secret.club/",
"title": "secret.club reverse engineering blog",
"description": "A blog with some really interesting reverse engineering posts. Many related to windows or anti-cheat bypass",
"tags": ["blog", "windows", "reversing"],
"nicheness": 3
},
{
"link": "https://www.unknowncheats.me/forum/rust-language-/588419-windows-uefi-bootkit-rust-codename-redlotus.html",
"title": "UEFI Bootkit in Rust (RedLotus) on UnknownCheats.me",
"description": "A UEFI bootkit written in rust, originally intended to assist in bypassing anti-cheats by getting code execution before the drivers for anti-cheats have loaded.",
"tags": ["bootkit", "rust", "UEFI", "github", "windows"],
"nicheness": 7
}
]