facades

package
v1.2.9-sp7 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

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 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 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 FacadeServer

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

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

func NewFacadeServer

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

func (*FacadeServer) AddFileResource

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

func (*FacadeServer) AddHttpRoute

func (f *FacadeServer) AddHttpRoute(pattern string, rsc *HttpResource)

如果路由已存在,则跳过

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) GetHTTPHandler

func (f *FacadeServer) GetHTTPHandler(isHttps bool) FacadeConnectionHandler

func (*FacadeServer) OnHandle

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

func (*FacadeServer) OverwriteFileResource

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

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) SetRawResource

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

func (*FacadeServer) SetRawResourceEx

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

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 SetObjectClass

func SetObjectClass(obj string) FacadeServerConfig

func SetReverseAddress

func SetReverseAddress(address string) FacadeServerConfig

func SetRmiResourceAddr

func SetRmiResourceAddr(name string, rmiResourceAddr string) FacadeServerConfig

func SetjavaFactory

func SetjavaFactory(factory string) FacadeServerConfig

type FactoryFun

type FactoryFun func() string

type HttpResource

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

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 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