112 lines
3.3 KiB
JavaScript
112 lines
3.3 KiB
JavaScript
const yaml = require('js-yaml');
|
|
const fs = require('fs');
|
|
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
|
|
const sass = require('eleventy-plugin-sass');
|
|
|
|
module.exports = function(eleventyConfig) {
|
|
// Plugins
|
|
eleventyConfig.addPlugin(syntaxHighlight);
|
|
eleventyConfig.addPlugin(sass, {
|
|
compileOptions: {
|
|
permalink: function(contents, inputPath) {
|
|
return (data) => data.page.filePathStem.replace(/^\/scss\//, "/css/") + ".css";
|
|
}
|
|
},
|
|
sass: {
|
|
style: "compressed",
|
|
sourceMap: true
|
|
}
|
|
});
|
|
|
|
// Copy static assets
|
|
eleventyConfig.addPassthroughCopy("src/js");
|
|
eleventyConfig.addPassthroughCopy("src/images");
|
|
eleventyConfig.addPassthroughCopy("src/icons");
|
|
|
|
// Watch for changes
|
|
eleventyConfig.addWatchTarget("src/scss/");
|
|
eleventyConfig.addWatchTarget("src/js/");
|
|
eleventyConfig.addWatchTarget("src/_data/");
|
|
|
|
// Custom YAML data loader
|
|
eleventyConfig.addDataExtension("yaml", contents => yaml.load(contents));
|
|
eleventyConfig.addDataExtension("yml", contents => yaml.load(contents));
|
|
|
|
// Filters
|
|
eleventyConfig.addFilter("filterByDomain", function(tools, domain) {
|
|
if (!domain) return tools;
|
|
return tools.filter(tool => tool.domains && tool.domains.includes(domain));
|
|
});
|
|
|
|
eleventyConfig.addFilter("filterByPhase", function(tools, phase) {
|
|
if (!phase) return tools;
|
|
return tools.filter(tool => tool.phases && tool.phases.includes(phase));
|
|
});
|
|
|
|
eleventyConfig.addFilter("filterByType", function(tools, type) {
|
|
if (!type) return tools;
|
|
return tools.filter(tool => tool.type === type);
|
|
});
|
|
|
|
eleventyConfig.addFilter("searchTools", function(tools, searchTerm) {
|
|
if (!searchTerm) return tools;
|
|
const term = searchTerm.toLowerCase();
|
|
return tools.filter(tool =>
|
|
tool.name.toLowerCase().includes(term) ||
|
|
tool.description.toLowerCase().includes(term) ||
|
|
(tool.tags && tool.tags.some(tag => tag.toLowerCase().includes(term)))
|
|
);
|
|
});
|
|
|
|
// Collection for tools by domain and phase (for matrix view)
|
|
eleventyConfig.addCollection("toolMatrix", function(collectionApi) {
|
|
const tools = collectionApi.getAll()[0].data.tools || [];
|
|
const domains = ['Filesystem Forensics', 'Network Forensics', 'Memory Forensics', 'Live Forensics', 'Malware Analysis', 'Cryptocurrency'];
|
|
const phases = ['Data Collection', 'Examination', 'Analysis', 'Reporting'];
|
|
|
|
const matrix = {};
|
|
domains.forEach(domain => {
|
|
matrix[domain] = {};
|
|
phases.forEach(phase => {
|
|
matrix[domain][phase] = tools.filter(tool =>
|
|
tool.domains && tool.domains.includes(domain) &&
|
|
tool.phases && tool.phases.includes(phase) &&
|
|
tool.type === 'FOSS'
|
|
);
|
|
});
|
|
});
|
|
|
|
return matrix;
|
|
});
|
|
|
|
// Global data
|
|
eleventyConfig.addGlobalData("domains", [
|
|
'Filesystem Forensics',
|
|
'Network Forensics',
|
|
'Memory Forensics',
|
|
'Live Forensics',
|
|
'Malware Analysis',
|
|
'Cryptocurrency'
|
|
]);
|
|
|
|
eleventyConfig.addGlobalData("phases", [
|
|
'Data Collection',
|
|
'Examination',
|
|
'Analysis',
|
|
'Reporting'
|
|
]);
|
|
|
|
// Configuration
|
|
return {
|
|
dir: {
|
|
input: "src",
|
|
output: "_site",
|
|
includes: "_includes",
|
|
layouts: "_layouts",
|
|
data: "_data"
|
|
},
|
|
templateFormats: ["md", "njk", "html"],
|
|
markdownTemplateEngine: "njk",
|
|
htmlTemplateEngine: "njk"
|
|
};
|
|
}; |