facades

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LDAPMsgFlag         = "ldap_flag"
	RMIMsgFlag          = "rmi"
	RMIHandshakeMsgFlag = "rmi-handshake"
)
View Source
const (
	FileResponseHeader = `` /* 140-byte string literal not displayed */

	BodyResponseHeader = `HTTP/1.1 200 OK
Connection: close
Accept-Ranges: bytes
Content-Encoding: identity
Content-Length: 0

`
)

Variables

View Source
var FacadesExports = map[string]interface{}{
	"NewFacadeServer": NewFacadeServer,
	"Serve":           Serve,

	"javaClassName":     SetJavaClassName,
	"javaCodeBase":      SetJavaCodeBase,
	"objectClass":       SetObjectClass,
	"javaFactory":       SetjavaFactory,
	"httpResource":      SetHttpResource,
	"ldapResourceAddr":  SetLdapResourceAddr,
	"rmiResourceAddr":   SetRmiResourceAddr,
	"evilClassResource": SetRmiResourceAddr,
}

Functions

func DeleteFacadeServer added in v1.3.2

func DeleteFacadeServer(token string)

func MockDNSServer added in v1.2.4

func MockDNSServer(ctx context.Context, rootDomain string, port int, h func(record string, domain string) string) string

func MockDNSServerDefault added in v1.2.4

func MockDNSServerDefault(domain string, h func(record string, domain string) string) string

func MockDNSServerEx added in v1.2.4

func MockDNSServerEx(ctx context.Context, noTcp, noUdp bool, rootDomain string, port int, h func(record string, domain string) string) string

func MockTCPDNSServerDefault added in v1.2.4

func MockTCPDNSServerDefault(domain string, h func(record string, domain string) string) string

func RegisterFacadeServer added in v1.3.2

func RegisterFacadeServer(ctx context.Context, token string, server *FacadeServer)

func Serve

func Serve(host string, port int, configs ...FacadeServerConfig) error

Types

type DNSServer

type DNSServer struct {
	// contains filtered or unexported fields
}

func NewDNSServer

func NewDNSServer(domain, dnsLogIP, serveIPRaw string, port int) (*DNSServer, error)

func (*DNSServer) Serve

func (d *DNSServer) Serve(ctx context.Context) error

func (*DNSServer) ServeDNS

func (d *DNSServer) ServeDNS(w dns.ResponseWriter, r *dns.Msg)

func (*DNSServer) SetAddrConvertor

func (d *DNSServer) SetAddrConvertor(i func(string) string)

func (*DNSServer) SetCallback

func (d *DNSServer) SetCallback(f FacadeCallback)

type FacadeCallback

type FacadeCallback func(i *VisitorLog)

type FacadeConnectionHandler

type FacadeConnectionHandler func(conn *utils.BufferedPeekableConn) error

type FacadeResourceType added in v1.3.2

type FacadeResourceType interface {
	[]byte | map[string]any | *HttpResource
}

type FacadeServer

type FacadeServer struct {
	Host         string
	Port         int
	ExternalHost string
	//反连地址
	ReverseAddr string

	RemoteAddrConvertorHandler func(string) string
	// contains filtered or unexported fields
}

func GetFacadeServer added in v1.3.2

func GetFacadeServer(token string) *FacadeServer

func NewFacadeServer

func NewFacadeServer(host string, port int, configs ...FacadeServerConfig) *FacadeServer

func (*FacadeServer) CancelServe added in v1.3.2

func (f *FacadeServer) CancelServe()

func (*FacadeServer) Config

func (f *FacadeServer) Config(configs ...FacadeServerConfig)

func (*FacadeServer) ConvertRemoteAddr

func (F *FacadeServer) ConvertRemoteAddr(addr string) string

func (*FacadeServer) GetAddr

func (f *FacadeServer) GetAddr() string

func (*FacadeServer) GetAllResourcesInfo added in v1.3.2

func (f *FacadeServer) GetAllResourcesInfo() []*ResourcesInfo

func (*FacadeServer) OnHandle

func (f *FacadeServer) OnHandle(h func(n *Notification))

func (*FacadeServer) RemoveHTTPResource

func (f *FacadeServer) RemoveHTTPResource(pattern string)

func (*FacadeServer) SaveHttpRoute

func (f *FacadeServer) SaveHttpRoute(pattern string, resource *HttpResource)

如果路由已经存在,则覆盖原有的路由

func (*FacadeServer) Serve

func (f *FacadeServer) Serve() error

func (*FacadeServer) ServeWithContext

func (f *FacadeServer) ServeWithContext(ctx context.Context) error

func (*FacadeServer) SetHttpRawResource added in v1.3.2

func (f *FacadeServer) SetHttpRawResource(pattern string, resource []byte)

func (*FacadeServer) SetRawResourceEx

func (f *FacadeServer) SetRawResourceEx(pattern string, resource []byte, disableNotify bool)

func (*FacadeServer) SetResource added in v1.3.2

func (f *FacadeServer) SetResource(protocol string, name string, token string, resource any) error

type FacadeServerConfig

type FacadeServerConfig func(f *FacadeServer)

func SetHttpResource

func SetHttpResource(name string, resource []byte) FacadeServerConfig

func SetJavaClassName

func SetJavaClassName(name string) FacadeServerConfig

func SetJavaCodeBase

func SetJavaCodeBase(codeBase string) FacadeServerConfig

func SetLdapResourceAddr

func SetLdapResourceAddr(name string, addr string) FacadeServerConfig

func SetLdapResponseEntry added in v1.3.2

func SetLdapResponseEntry(token string, data map[string]any, verbose string) FacadeServerConfig

func SetObjectClass

func SetObjectClass(obj string) FacadeServerConfig

func SetReverseAddress

func SetReverseAddress(address string) FacadeServerConfig

func SetRmiResource added in v1.3.2

func SetRmiResource(name string, resource []byte, verbose string) FacadeServerConfig

func SetRmiResourceAddr

func SetRmiResourceAddr(name string, rmiResourceAddr string) FacadeServerConfig

func SetjavaFactory

func SetjavaFactory(factory string) FacadeServerConfig

type FacadeServerResource added in v1.3.2

type FacadeServerResource[T FacadeResourceType] struct {
	Resources map[string]*resourceAndVerbose[T]
	// contains filtered or unexported fields
}

func NewFacadeServerResource added in v1.3.2

func NewFacadeServerResource[T FacadeResourceType]() *FacadeServerResource[T]

func (*FacadeServerResource[T]) DeleteResource added in v1.3.2

func (f *FacadeServerResource[T]) DeleteResource(token string)

func (*FacadeServerResource[T]) ForEachResource added in v1.3.2

func (f *FacadeServerResource[T]) ForEachResource(fun func(token string, resource T, verbose string) error) error

func (*FacadeServerResource[T]) GetResource added in v1.3.2

func (f *FacadeServerResource[T]) GetResource(token string) (T, string, bool)

func (*FacadeServerResource[T]) SetResource added in v1.3.2

func (f *FacadeServerResource[T]) SetResource(token string, data T, verbose string)

type FactoryFun

type FactoryFun func() string

type HttpResource

type HttpResource struct {
	// contains filtered or unexported fields
}

func NewHttpFileResource added in v1.3.2

func NewHttpFileResource(data []byte) *HttpResource

func NewHttpRawResource added in v1.3.2

func NewHttpRawResource(data []byte) *HttpResource

type HttpResourceType

type HttpResourceType string

var HttpRoutes sync.Map

const (
	HttpResourceType_File HttpResourceType = "file"
	HttpResourceType_Body HttpResourceType = "body"
	HttpResourceType_Raw  HttpResourceType = "raw"
)

type Notification

type Notification struct {
	// dns
	// http/s
	// rmi
	Type         string `json:"type"`
	RemoteAddr   string `json:"remote_addr"`
	Raw          []byte `json:"raw"`
	Token        string `json:"token"`
	Uuid         string `json:"uuid"`
	ResponseInfo string `json:"response_info"`
	ConnectHash  string `json:"connect_hash"`
}

func NewNotification

func NewNotification(t string, remoteAddr string, raw []byte, token string) *Notification

func (*Notification) String

func (n *Notification) String() string

type PortListener added in v1.2.5

type PortListener struct {
	AvailablePorts string
}

type ResourcesInfo added in v1.3.2

type ResourcesInfo struct {
	Protocol    string
	Url         string
	Data        any
	DataVerbose string
}

type VisitorLog

type VisitorLog struct {
	// dns
	Type string

	Details map[string]interface{}
}

func NewVisitorLog

func NewVisitorLog(t string) *VisitorLog

func (*VisitorLog) GetDomain

func (v *VisitorLog) GetDomain() string

func (*VisitorLog) Set

func (v *VisitorLog) Set(k string, val interface{})

func (*VisitorLog) SetDNSType

func (v *VisitorLog) SetDNSType(dnsType string)

func (*VisitorLog) SetDomain

func (v *VisitorLog) SetDomain(domain string)

func (*VisitorLog) SetRemoteIP

func (v *VisitorLog) SetRemoteIP(remoteAddr string)

func (*VisitorLog) SetTimestampNow

func (v *VisitorLog) SetTimestampNow()

Directories

Path Synopsis
ldap

Jump to

Keyboard shortcuts

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