Skip to content

Commit

Permalink
Fix relative navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Dec 16, 2023
1 parent aac3c14 commit 0f26ad1
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 126 deletions.
26 changes: 24 additions & 2 deletions docs/sliver-docs/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import CodeViewer, { CodeSchema } from "@/components/code";
import { Themes } from "@/util/themes";
import { useTheme } from "next-themes";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import Markdown from "react-markdown";
import remarkGfm from "remark-gfm";

export type MarkdownProps = {
key?: string;
markdown: string;
};

const MarkdownViewer = (props: MarkdownProps) => {
const { theme } = useTheme();
const router = useRouter();

return (
<div
Expand All @@ -19,23 +23,41 @@ const MarkdownViewer = (props: MarkdownProps) => {
}
>
<Markdown
key={props.key || `${Math.random()}`}
remarkPlugins={[remarkGfm]}
components={{
a(props) {
const { href, children, ...rest } = props;
if (href?.startsWith("/")) {
return (
// @ts-ignore
<a
{...rest}
href={href}
className="text-primary hover:text-primary-dark"
onClick={(e) => {
e.preventDefault();
router.push(href);
}}
>
{children}
</a>
);
}
const url = new URL(href || "");
if (url.protocol !== "http:" && url.protocol !== "https:") {
return <></>;
}
if (url.host === "sliver.sh") {
return (
<a
// @ts-ignore
<Link
{...rest}
href={url.toString()}
className="text-primary hover:text-primary-dark"
>
{children}
</a>
</Link>
);
}
return (
Expand Down
2 changes: 1 addition & 1 deletion docs/sliver-docs/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function TopNavbar(props: TopNavbarProps) {
startContent={<FontAwesomeIcon icon={faSearch} />}
onKeyDown={(e) => {
if (e.key === "Enter") {
router.push(`/search`, { query: { search: query } });
router.push(`/search/`, { query: { search: query } });
setQuery("");
}
}}
Expand Down
22 changes: 13 additions & 9 deletions docs/sliver-docs/pages/docs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import MarkdownViewer from "@/components/markdown";
import { Docs } from "@/util/docs";
import { frags } from "@/util/frags";
import { Themes } from "@/util/themes";
import { faSearch } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
Expand All @@ -18,10 +17,13 @@ import { useQuery } from "@tanstack/react-query";
import Fuse from "fuse.js";
import { NextPage } from "next";
import { useTheme } from "next-themes";
import { useSearchParams } from "next/navigation";
import { useRouter } from "next/router";
import React from "react";

const DocsIndexPage: NextPage = () => {
const { theme } = useTheme();
const router = useRouter();

const { data: docs, isLoading } = useQuery({
queryKey: ["docs"],
Expand All @@ -31,11 +33,14 @@ const DocsIndexPage: NextPage = () => {
},
});

const [name, _setName] = React.useState(decodeURI(frags.get("name") || ""));
const setName = (name: string) => {
frags.set("name", name);
_setName(name);
};
const [name, setName] = React.useState("");
const urlName = useSearchParams().get("name");
React.useEffect(() => {
if (urlName) {
setName(urlName);
}
}, [urlName]);

const [markdown, setMarkdown] = React.useState(
name === ""
? docs?.docs[0].content
Expand Down Expand Up @@ -109,8 +114,7 @@ const DocsIndexPage: NextPage = () => {
key={doc.name}
value={doc.name}
onClick={() => {
setName(doc.name);
setMarkdown(doc.content);
router.push(`/docs`, { query: { name: doc.name } });
}}
>
{doc.name}
Expand All @@ -128,7 +132,7 @@ const DocsIndexPage: NextPage = () => {
</CardHeader>
<Divider />
<CardBody>
<MarkdownViewer markdown={markdown || ""} />
<MarkdownViewer key={name} markdown={markdown || ""} />
</CardBody>
</Card>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/sliver-docs/pages/docs/md/Aliases and Extensions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sliver allows an operator to extend the local client console and its features by adding new commands based on third party tools. The easiest way to install an alias or extension is using the [armory](https://github.com/BishopFox/sliver/wiki/Armory).
Sliver allows an operator to extend the local client console and its features by adding new commands based on third party tools. The easiest way to install an alias or extension is using the [armory](/docs?name=Armory).

#### Aliases Command Parsing

Expand Down Expand Up @@ -151,7 +151,7 @@ Sliver - 3rd Party extensions:

To write a new alias, one must either create a shared library or a .NET assembly, then write a manifest file compliant with the description above.

As the alias support relies on Sliver side loading capabilities, please make sure to read the [Using 3rd party tools](https://github.com/BishopFox/sliver/wiki/Using-3rd-party-tools) section, to understand how shared libraries are loaded on all platforms.
As the alias support relies on Sliver side loading capabilities, please make sure to read the [Using 3rd party tools](/docs?name=Using-3rd-party-tools) section, to understand how shared libraries are loaded on all platforms.

## Extensions

Expand Down
2 changes: 1 addition & 1 deletion docs/sliver-docs/pages/docs/md/Anti-virus Evasion.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The Sliver authors do not consider anti-virus evasion to be within the scope of the Sliver project; there is already a myriad of works in this area. That said, Sliver is designed to be interoperable with common techniques for bypassing anti-virus software such as packers, crypters, and [stagers](https://github.com/BishopFox/sliver/wiki/Stagers).
The Sliver authors do not consider anti-virus evasion to be within the scope of the Sliver project; there is already a myriad of works in this area. That said, Sliver is designed to be interoperable with common techniques for bypassing anti-virus software such as packers, crypters, and [stagers](/docs?name=Stagers).

Here are some external resources for anti-virus evasion:

Expand Down
4 changes: 0 additions & 4 deletions docs/sliver-docs/pages/docs/md/Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,3 @@ There are four major components to the Sliver ecosystem:
```

By implementing all functionality over this gRPC interface, and only differing the in-memory/mTLS connection types the client code doesn't "know" if it's running in the server console or the client console. Due to this, a single command implementation will work in both the server console and over the network in multiplayer mode.

## Sliver Server

WIP
2 changes: 1 addition & 1 deletion docs/sliver-docs/pages/docs/md/Armory.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ The armory is the Sliver Alias and Extension package manager (introduced in Sliv

The armory downloads packages from `github.com` and `api.github.com` so you'll need an internet connection in order for the command to work. The command does support proxies (see `--help`) and after an alias or extension is installed an internet connection is not required to execute the alias/extension.

Aliases and extensions are installed on the "sliver client"-side, and thus are not shared among operators in [multiplayer mode](https://github.com/BishopFox/sliver/wiki/Multiplayer-Mode).
Aliases and extensions are installed on the "sliver client"-side, and thus are not shared among operators in [multiplayer mode](/docs?name=Multi-player+Mode).

As of v1.5.14 you can also use `armory install all` to install _everything_ if you really want to.

Expand Down
2 changes: 1 addition & 1 deletion docs/sliver-docs/pages/docs/md/Audit Log.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Sliver keeps an audit log of every command and its arguments executed by the server (including commands executed by operators in multiplayer mode), as well as most events (such as a new session or beacon connecting to the server). The audit log's intended use is for after-action analysis; providing a detailed history of the entire engagement, including which commands were executed on which hosts when. This will include any commands executed by any operator on any session. Note some console commands only perform actions on the "client-side" and may not appear in the audit log, but will still appear in the client's command history. Additionally, interactive commands (e.g., `shell`) may not appear in the logs aside from the initial usage of the `shell` command.

By default the audit log is located on the server at: `~/.sliver/logs/audit.json`. However, this can be changed by modifying the [`SLIVER_ROOT_DIR`](https://github.com/BishopFox/sliver/wiki/Environment-Variables#assets) environment variable.
By default the audit log is located on the server at: `~/.sliver/logs/audit.json`. However, this can be changed by modifying the [`SLIVER_ROOT_DIR`](/docs?name=Environment-Variables#assets) environment variable.

#### Parsing Audit Logs

Expand Down
6 changes: 3 additions & 3 deletions docs/sliver-docs/pages/docs/md/BOF and COFF Support.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Sliver v1.5 and later support the loading and execution of BOFs and COFFs, gener

### BOF Extensions

BOF support is provided via the [COFF Loader](https://github.com/sliverarmory/COFFLoader) extension, you'll need it installed to run pretty much any BOF. However, the COFF Loader will be installed automatically if you install a BOF extension from the [armory](https://github.com/BishopFox/sliver/wiki/Armory).
BOF support is provided via the [COFF Loader](https://github.com/sliverarmory/COFFLoader) extension, you'll need it installed to run pretty much any BOF. However, the COFF Loader will be installed automatically if you install a BOF extension from the [armory](/docs?name=Armory).

The easiest way to install a BOF extension, for example [`nanodump`](https://github.com/sliverarmory/nanodump), is using the [armory](https://github.com/BishopFox/sliver/wiki/Armory) package manager:
The easiest way to install a BOF extension, for example [`nanodump`](https://github.com/sliverarmory/nanodump), is using the [armory](/docs?name=Armory) package manager:

**IMPORTANT:** BOF Extensions are installed per-sliver client, they are not stored on the server. Thus extensions are not shared across operators, each operator must install the extension to use it.

Expand Down Expand Up @@ -114,6 +114,6 @@ Looking at the script we can see the BOF requires a single integer argument. The

Once the manifest is defined load it into your client using `extensions load`, locally loaded extensions do not need to be cryptographically signed. The paths in the manifest should be relative to the manifest file, parent directories are not allowed.

More details can be found on the [Aliases & Extensions](https://github.com/BishopFox/sliver/wiki/Aliases-&-Extensions) page.
More details can be found on the [Aliases & Extensions](/docs?name=Aliases-&-Extensions) page.

**IMPORTANT:** For BOF extensions to be properly detected by the Sliver client, the `path` must use the `.o` file extension.
6 changes: 3 additions & 3 deletions docs/sliver-docs/pages/docs/md/Configuration Files.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### General Server Configuration

Starting in version 1.0.0 the Sliver server has a configuration file located the `configs` sub-directory of the [`SLIVER_ROOT_DIR`](https://github.com/BishopFox/sliver/wiki/Environment-Variables#assets), by default this will be `~/.sliver/configs/server.json`. If no configuration file exists, a default configuration will be generated and written to disk on startup. The default configuration is shown below:
Starting in version 1.0.0 the Sliver server has a configuration file located the `configs` sub-directory of the [`SLIVER_ROOT_DIR`](/docs?name=Environment-Variables#assets), by default this will be `~/.sliver/configs/server.json`. If no configuration file exists, a default configuration will be generated and written to disk on startup. The default configuration is shown below:

#### Default Server Config

Expand All @@ -21,7 +21,7 @@ Starting in version 1.0.0 the Sliver server has a configuration file located the

#### Configuration Options

- `daemon_mode` - Enable [daemon mode](https://github.com/BishopFox/sliver/wiki/Daemon-Mode)
- `daemon_mode` - Enable [daemon mode](/docs?name=Daemon-Mode)
- `daemon` - An object containing options related to `daemon_mode`, these values are only used when `daemon_mode` is set to `true`.
- `host` - What network interface to bind the `daemon_mode` client listener to. By default this is an empty string, which indicates binding to all interfaces.
- `port` - TCP port to bind the `deamon_mode` client listener to.
Expand Down Expand Up @@ -68,7 +68,7 @@ Starting in version v1.1.0 Sliver supports SQL database configurations, by defau

### Operator

Client configurations must be generated by the server (they contain per-user key pairs). For more details see [multiplayer mode](https://github.com/BishopFox/sliver/wiki/Multiplayer-Mode), and example configuration is shown below. Client configuration files can be copied into `~/.sliver-client/configs/`:
Client configurations must be generated by the server (they contain per-user key pairs). For more details see [multiplayer mode](/docs?name=Multi-player+Mode), and example configuration is shown below. Client configuration files can be copied into `~/.sliver-client/configs/`:

```json
{
Expand Down
8 changes: 4 additions & 4 deletions docs/sliver-docs/pages/docs/md/Cross-compiling Implants.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Sliver can tell you which platforms it can likely target based on the server's platform and available cross-compilers by running the `generate info` command in the console.

Sliver v1.5.30 and later also support [External Builders](https://github.com/BishopFox/sliver/wiki/External-Builders), which can be used to easily cross-compile implants.
Sliver v1.5.30 and later also support [External Builders](/docs?name=External-Builders), which can be used to easily cross-compile implants.

## From Linux to MacOS/Windows

Expand All @@ -12,7 +12,7 @@ To compile Windows shared library and shellcode implants from Linux, install min
sudo apt install mingw-w64
```

To compile MacOS shared library implants from Linux, we recommend using https://github.com/tpoechtrager/osxcross by default Sliver will look in `/opt/osxcross` but you can override this via [environment variables](https://github.com/BishopFox/sliver/wiki/Environment-Variables). If you do not have a MacOS based machine you can use GitHub Actions' MacOS instances to build OSXCross.
To compile MacOS shared library implants from Linux, we recommend using https://github.com/tpoechtrager/osxcross by default Sliver will look in `/opt/osxcross` but you can override this via [environment variables](/docs?name=Environment-Variables). If you do not have a MacOS based machine you can use GitHub Actions' MacOS instances to build OSXCross.

**NOTE:** Sliver expects the root of the osxcross git repo to be located at `/opt/osxcross` and the actual binaries in `/opt/osxcross/target/bin`.

Expand All @@ -26,7 +26,7 @@ cd /opt/osxcross
UNATTENDED=1 ./build.sh
```

Sliver automatically looks in the default paths for these cross compilers, once installed simply use the `generate` command with the desired `--os` and `--arch`, check `~/.sliver/logs/sliver.log` for build errors. You can override any cross compiler location via the appropriate [environment variables](https://github.com/BishopFox/sliver/wiki/Environment-Variables).
Sliver automatically looks in the default paths for these cross compilers, once installed simply use the `generate` command with the desired `--os` and `--arch`, check `~/.sliver/logs/sliver.log` for build errors. You can override any cross compiler location via the appropriate [environment variables](/docs?name=Environment-Variables).

## From MacOS to Linux/Windows

Expand All @@ -43,7 +43,7 @@ brew install FiloSottile/musl-cross/musl-cross
brew install mingw-w64
```

I'm not aware of any good options to target 32-bit Linux from MacOS. Sliver automatically looks in the default paths for these cross compilers, once installed simply use the `generate` command with the desired `--os` and `--arch`, check `~/.sliver/logs/sliver.log` for build errors. You can override any cross compiler location via the appropriate [environment variables](https://github.com/BishopFox/sliver/wiki/Environment-Variables).
I'm not aware of any good options to target 32-bit Linux from MacOS. Sliver automatically looks in the default paths for these cross compilers, once installed simply use the `generate` command with the desired `--os` and `--arch`, check `~/.sliver/logs/sliver.log` for build errors. You can override any cross compiler location via the appropriate [environment variables](/docs?name=Environment-Variables).

## From Windows to MacOS/Linux

Expand Down
2 changes: 1 addition & 1 deletion docs/sliver-docs/pages/docs/md/DNS C2.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ nameserver 8.8.8.8

# Under the Hood

**NOTE:** This describes the v1.5+ implementation of DNS C2. Also, I'm not going to cover the cryptographic key exchange, which you can read about [here](https://github.com/BishopFox/sliver/wiki/Transport-Encryption), this is just about how do we move bytes back and forth.
**NOTE:** This describes the v1.5+ implementation of DNS C2. Also, I'm not going to cover the cryptographic key exchange, which you can read about [here](/docs?name=Transport-Encryption), this is just about how do we move bytes back and forth.

### Design Goals

Expand Down
4 changes: 2 additions & 2 deletions docs/sliver-docs/pages/docs/md/Daemon Mode.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Starting in v1.0.0 Sliver supports running in "daemon mode," which automatically starts a client listener (but not an interactive console). In order to connect to a server running in daemon mode you'll need to use [multiplayer mode](https://github.com/BishopFox/sliver/wiki/Multiplayer-Mode).
Starting in v1.0.0 Sliver supports running in "daemon mode," which automatically starts a client listener (but not an interactive console). In order to connect to a server running in daemon mode you'll need to use [multiplayer mode](/docs?name=Multi-player+Mode).

There are two ways to start the server in daemon mode:

Expand All @@ -25,4 +25,4 @@ $ cat ~/.sliver/configs/server.json

#### systemd

With this config you can easily setup a [systemd service](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) or init script. See the [Linux install script](https://github.com/BishopFox/sliver/wiki/Linux-Install-Script) for an example.
With this config you can easily setup a [systemd service](https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/) or init script. See the [Linux install script](/docs?name=Linux-Install-Script) for an example.
4 changes: 2 additions & 2 deletions docs/sliver-docs/pages/docs/md/External Builders.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ External builders can also be used to create custom modifications to the implant

#### Setup

Any `sliver-server` binary can be started as a builder process using [operator configuration files from multiplayer-mode](https://github.com/BishopFox/sliver/wiki/Multiplayer-Mode) from the server you want to connect the builder to, for example:
Any `sliver-server` binary can be started as a builder process using [operator configuration files from multiplayer-mode](/docs?name=Multi-player+Mode) from the server you want to connect the builder to, for example:

```
./sliver-server builder -c operator-multiplayer.cfg
Expand Down Expand Up @@ -86,7 +86,7 @@ You are welcome to customize the implant source code under the terms of Sliver's

1. Fork the main Sliver Github repository
1. Make modifications to the source code
1. [Compile a Sliver server binary](https://github.com/BishopFox/sliver/wiki/Compile-From-Source)
1. [Compile a Sliver server binary](/docs?name=Compile-From-Source)
1. Connect the customized Sliver server binary to any other C2 server (including mainline servers) as an external builder
1. Operators can generate the customized implant builds via the `generate --external-builder` flag
1. Avoid making any changes to `/server` to make merging upstream easier if changes are introduced to the builder APIs
Loading

0 comments on commit 0f26ad1

Please sign in to comment.