redsecc/website

GitHub: redsecc/website

RedSec 是一个免费、无追踪的开源红队安全学习中心,基于 Astro 静态站点构建,提供课程、实验和参考资料的本地化学习体验。

Stars: 0 | Forks: 0

# RedSec 一个免费、开源的红队学习中心。静态网站,**没有账号,没有后端,没有追踪器** —— 任何人只需点击一次即可开始学习。 - **技术栈:** [Astro](https://astro.build)(静态输出),MDX 内容集合,用于代码块的 [Expressive Code](https://expressive-code.com),自托管字体([Inter](https://fontsource.org/fonts/inter) + [JetBrains Mono](https://fontsource.org/fonts/jetbrains-mono))。 - **无第三方请求:** 没有 Google Fonts CDN,没有分析工具,没有 cookies。 - **学习者状态:** 进度仅存储在 `localStorage` 中(键为 `redsec:progress`)且基于设备本地 —— 永远不会同步到服务器。 ## 前置条件 - **Node.js 20 或更高版本**(推荐 Node 22) - npm(随 Node 一起提供) ## 本地开发 ``` npm install # install dependencies npm run dev # start the dev server (http://localhost:4321) npm run build # build the static site to ./dist npm run preview # preview the production build locally ``` ## 内容 所有内容都以 Astro 内容集合的形式存放在 `src/content/` 中: | 集合 | 位置 | 格式 | 说明 | | ----------- | -------------------------- | ------ | ----- | | `paths` | `src/content/paths/` | YAML | 学习路径元数据(`title`、`slug`、`summary`、`order`、`icon`)。 | | `lessons` | `src/content/lessons/` | MDX | `title`、`path`(路径别名)、`order`、`difficulty`、`summary`、`tags`。 | | `labs` | `src/content/labs/` | MDX | `title`、`objective`、`difficulty`,可选的 `targetUrl`/`download`。提示和解答通过正文中的 `
` 展现。 | | `reference` | `src/content/reference/` | MDX | `title`、`summary`、`order`。 | Schema 在 `src/content.config.ts` 中定义并进行验证。 要添加课程:将 `.mdx` 文件放入 `src/content/lessons/` 中,将其 frontmatter 的 `path` 设置为一个已存在的路径别名,它就会自动出现在该路径中(按 `order` 排序),并附带上一页/下一页导航以及进度追踪。 ## 部署(GitHub Pages) 本仓库附带了一个位于 `.github/workflows/deploy.yml` 的工作流,它使用 `withastro/action` 进行构建并通过 GitHub Pages 发布。 1. 推送至 **`main`** 分支(该工作流也支持手动触发 `workflow_dispatch`)。 2. 在仓库中,转到 **Settings → Pages → Build and deployment → Source: GitHub Actions**。 3. 站点将部署到 `astro.config.mjs` 中配置的 URL。 ### `site` / `base` 配置 `astro.config.mjs` 目前配置为使用**自定义域名**: ``` site: 'https://redsec.cc', base: '/', ``` 还有一个包含 `redsec.cc` 的 `public/CNAME` 文件。在 **Settings → Pages → Custom domain** 中,设置 `redsec.cc`,并在您的域名注册商处创建以下 DNS 记录: | 类型 | 主机 | 值 | | ------- | ----- | ----- | | `A` | `@` | `185.199.108.153`, `185.199.109.153`, `185.199.110.153`, `185.199.111.153` | | `CNAME` | `www` | `.github.io` | (这四条 `A` 记录是 GitHub Pages 的顶点 IP。)证书签发后,请启用 **Enforce HTTPS**。 #### 部署到 `redsec.cc` 以外的位置 `site`/`base` 的值取决于您**部署的位置**: - **自定义域名**(当前设置):`site: 'https://your-domain'`,`base: '/'`,并且 `public/CNAME` 包含您的域名。 - **用户/组织页面**(`https://.github.io`):`site: 'https://.github.io'`,`base: '/'`,并**删除** `public/CNAME`。 - **项目页面**(`https://.github.io/`):`site: 'https://.github.io'`,`base: '/'`,并**删除** `public/CNAME`。 由于 `base` 可能是子路径,**所有内部链接和资源都会经过 `src/lib/base.ts` 中的 `withBase()` 助手函数**(它会读取 `import.meta.env.BASE_URL`)。 请继续在新链接中使用它,这样在项目子路径下就不会出现任何问题。 包含 `public/.nojekyll` 是为了让 GitHub Pages 能够提供以 `_` 开头的文件/文件夹(Astro 的 `_astro/` 构建输出),而无需经过 Jekyll 处理。 ## 项目结构 ``` . ├─ .github/workflows/deploy.yml # GitHub Pages build + deploy ├─ astro.config.mjs # site/base, integrations, EC theme ├─ public/ │ ├─ CNAME # custom domain (redsec.cc) │ ├─ .nojekyll │ └─ favicon.svg # derived from the logo mark └─ src/ ├─ assets/redsec_logo.svg # the brand mark (see note below) ├─ components/ # Header, Footer, cards, Callout, TOC, islands ├─ content/ # paths / lessons / labs / reference ├─ content.config.ts # collection schemas ├─ layouts/BaseLayout.astro ├─ lib/base.ts # withBase() helper ├─ pages/ # routes ├─ scripts/progress.ts # localStorage progress (no server) └─ styles/global.css # design tokens + base styles ``` ## 需要填补的内容 - **Logo:** `src/assets/redsec_logo.svg` 目前是一个生成的占位符,颜色为品牌红(`#B01927`)。将真正的 `redsec_logo.svg` 放入该路径中,即可替换所有位置(页眉和 `public/favicon.svg`)的图标。 - **社区链接:** 页脚链接到 `https://github.com/redsecc/website` 和 `https://discord.gg/asm` —— 请在 `src/components/Footer.astro` 中编辑它们。 ## 许可证 [MIT](./LICENSE)。教育内容仅供**授权测试使用**。
标签:Astro, MDX, MITM代理, 安全教育, 数据展示, 红队, 静态网站