utilities

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpcodeDispatch = iota
	OpcodeHeartbeat
	OpcodeIdentify
	OpcodePresenceUpdate
	OpcodeVoiceStateUpdate
	OpcodeResume = iota + 1
	OpcodeReconnect
	OpcodeRequestGuildMembers
	OpcodeInvalidSession
	OpcodeHello
	OpcodeHeartbeatACK
)
View Source
const (
	EventNameMessageCreate = "MESSAGE_CREATE"
	EventNameMessageUpdate = "MESSAGE_UPDATE"
	EventNameReady         = "READY"
	EventNameResumed       = "RESUMED"
)
View Source
const UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0"
View Source
const Useragent = "" /* 143-byte string literal not displayed */
View Source
const XSuper = "" /* 520-byte string literal not displayed */
View Source
const XSuperProp = "" /* 292-byte string literal not displayed */
View Source
const XTrack = "" /* 516-byte string literal not displayed */

Variables

This section is empty.

Functions

func Bypass

func Bypass(client *http.Client, serverid string, token string, invite string) error

func CommonHeaders

func CommonHeaders(req *http.Request) *http.Request

func Contains

func Contains(s []string, e string) bool

func DecodeBr

func DecodeBr(data []byte) ([]byte, error)

Decoding brotli encrypted responses

func EncodeImg

func EncodeImg(pathToImage string) (string, error)

Encoding images to b64

func FindMessage

func FindMessage(channel string, messageid string, token string) (string, error)

func GetFiles

func GetFiles(dir string) ([]string, error)

Get all file paths in a directory

func GetReactions

func GetReactions(channel string, message string, token string, emoji string, after string) ([]string, error)

func HandleOutOfBounds

func HandleOutOfBounds()

func ProcessAvatar

func ProcessAvatar(av string, memberid string) error

func RandomResult

func RandomResult() []string

func ReadBody

func ReadBody(resp http.Response) ([]byte, error)

Function to handle all sorts of accepted-encryptions

func ReadLines

func ReadLines(filename string) ([]string, error)

func RegisterHeaders

func RegisterHeaders(req *http.Request) *http.Request

func RemoveDuplicateStr

func RemoveDuplicateStr(strSlice []string) []string

func RemoveSubset

func RemoveSubset(s []string, r []string) []string

Inputs 2 slices of strings and returns a slice of strings which does not contain elements from the second slice

func Ring

func Ring(httpClient *http.Client, auth string, snowflake string) (int, error)

func Scrape

func Scrape(ws *Connection, Guild string, Channel string, index int) error

func ScrapeOffline

func ScrapeOffline(c *Connection, guild string, query string) error

func Snowflake

func Snowflake() int64

func TruncateLines

func TruncateLines(filename string, line []string) error

func ValidateBios

func ValidateBios(bios []string) []string

func WriteLines

func WriteLines(filename string, line string) error

func XContextGen

func XContextGen(guildID string, channelID string, ChannelType float64) (string, error)

Types

type AvatarChange

type AvatarChange struct {
	Avatar string `json:"avatar"`
}

type CallData

type CallData struct {
	ChannelId string      `json:"channel_id"`
	GuildId   interface{} `json:"guild_id"`
	SelfDeaf  bool        `json:"self_deaf"`
	SelfMute  bool        `json:"self_mute"`
	SelfVideo bool        `json:"self_video"`
}

type CallEvent

type CallEvent struct {
	Op   int      `json:"op"`
	Data CallData `json:"d"`
}

type ClientState

type ClientState struct {
	HighestLastMessageID     string `json:"highest_last_message_id,omitempty"`
	ReadStateVersion         int    `json:"read_state_version,omitempty"`
	UserGuildSettingsVersion int    `json:"user_guild_settings_version,omitempty"`
}

type Config

type Config struct {
	Delay           int    `json:"individual_delay"`
	LongDelay       int    `json:"rate_limit_delay"`
	Offset          int    `json:"offset"`
	Skip            bool   `json:"skip_completed"`
	Proxy           string `json:"proxy"`
	Call            bool   `json:"call"`
	Remove          bool   `json:"remove_dead_tokens"`
	RemoveM         bool   `json:"remove_completed_members"`
	Stop            bool   `json:"stop_dead_tokens"`
	Mutual          bool   `json:"check_mutual"`
	Friend          bool   `json:"friend_before_DM"`
	Websocket       bool   `json:"online_tokens"`
	SleepSc         int    `json:"online_scraper_delay"`
	ProxyFromFile   bool   `json:"proxy_from_file"`
	ProxyProtocol   string `json:"proxy_protocol"`
	MaxDMS          int    `json:"max_dms_per_token"`
	Receive         bool   `json:"receive_messages"`
	GatewayProxy    bool   `json:"use_proxy_for_gateway"`
	Timeout         int    `json:"timeout"`
	SkipFailed      bool   `json:"skip_failed"`
	ClientKey       string `json:"captcha_api_key"`
	CaptchaAPI      string `json:"captcha_api"`
	MaxInvite       int    `json:"max_attempt_invite_rejoin"`
	DisableKL       bool   `json:"disable_keep_alives"`
	ScrapeUsernames bool   `json:"scrape_usernames"`
	ScrapeAvatars   bool   `json:"scrape_avatars"`
	ProxyForCaptcha bool   `json:"proxy_for_captcha"`
	Block           bool   `json:"block_after_dm"`
	Close           bool   `json:"close_dm_after_message"`
}

func GetConfig

func GetConfig() (Config, error)

type Connection

type Connection struct {
	Members       []string
	OfflineScrape chan []byte
	AllMembers    []string
	Messages      chan []byte
	Complete      bool
	Conn          *websocket.Conn
	// contains filtered or unexported fields
}

Define WebSocket connection struct

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Ping

func (c *Connection) Ping(interval time.Duration)

func (*Connection) ReadHello

func (c *Connection) ReadHello() (int, error)

Read Hello function to read hello message from websocket return 0 if next message is not a hello message or return the heartbeat interval

func (*Connection) WriteJSONe

func (c *Connection) WriteJSONe(e *Event) error

Function to write event

func (*Connection) WriteRaw

func (c *Connection) WriteRaw(e interface{}) error

Send interface to websocket

type Custom

type Custom struct {
	GuildID  interface{} `json:"guild_id"`
	Limit    int         `json:"limit"`
	Query    string      `json:"query"`
	Presence bool        `json:"presence"`
}

type CustomEvent

type CustomEvent struct {
	Op   int    `json:"op,omitempty"`
	Data Custom `json:"d,omitempty"`
}

type Data

type Data struct {
	Message
	Identify
	ClientState       ClientState            `json:"client_state,omitempty"`
	HeartbeatInterval int                    `json:"heartbeat_interval,omitempty"`
	SessionID         string                 `json:"session_id,omitempty"`
	Sequence          int                    `json:"seq,omitempty"` // For sending only
	GuildId           interface{}            `json:"guild_id,omitempty"`
	Channels          map[string]interface{} `json:"channels,omitempty"`
	Ops               []Ops                  `json:"ops,omitempty"`
	ChannelID         string                 `json:"channel_id,omitempty"`
	Members           []Member               `json:"members,omitempty"`
	Typing            bool                   `json:"typing,omitempty"`
	Threads           bool                   `json:"threads,omitempty"`
	Activities        bool                   `json:"activities,omitempty"`
	ThreadMemberLists interface{}            `json:"thread_member_lists,omitempty"`
}

type Embed

type Embed struct {
	Title string `json:"title,omitempty"`

	// The type of embed. Always EmbedTypeRich for webhook embeds.
	Type        string             `json:"type,omitempty"`
	Description string             `json:"description,omitempty"`
	URL         string             `json:"url,omitempty"`
	Image       *MessageEmbedImage `json:"image,omitempty"`

	// The color code of the embed.
	Color     int                    `json:"color,omitempty"`
	Footer    EmbedFooter            `json:"footer,omitempty"`
	Thumbnail *MessageEmbedThumbnail `json:"thumbnail,omitempty"`
	Provider  EmbedProvider          `json:"provider,omitempty"`
	Author    EmbedAuthor            `json:"author,omitempty"`
	Fields    []EmbedField           `json:"fields,omitempty"`
}

type EmbedAuthor

type EmbedAuthor struct {
	Name         string `json:"name,omitempty"`
	URL          string `json:"url,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

type EmbedField

type EmbedField struct {
	Name   string `json:"name,omitempty"`
	Value  string `json:"value,omitempty"`
	Inline bool   `json:"inline,omitempty"`
}

type EmbedFooter

type EmbedFooter struct {
	Text         string `json:"text,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

type EmbedProvider

type EmbedProvider struct {
	Name string `json:"name,omitempty"`
	URL  string `json:"url,omitempty"`
}

type Emoji

type Emoji struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Animated bool   `json:"animated,omitempty"`
}

type Event

type Event struct {
	Op        int    `json:"op"`
	Data      Data   `json:"d,omitempty"`
	Sequence  int    `json:"s,omitempty"`
	EventName string `json:"t,omitempty"`
}

type FormField

type FormField struct {
	FieldType   string   `json:"field_type"`
	Label       string   `json:"label"`
	Description string   `json:"description"`
	Required    bool     `json:"required"`
	Values      []string `json:"values"`
	Response    bool     `json:"response"`
}

type Guilds

type Guilds struct {
	ID string `json:"id"`
}

type Identify

type Identify struct {
	Token        string     `json:"token,omitempty"`
	Properties   Properties `json:"properties,omitempty"`
	Capabilities int        `json:"capabilities,omitempty"`
	Compress     bool       `json:"compress,omitempty"`
	Presence     Presence   `json:"presence,omitempty"`
}

type Instance

type Instance struct {
	Token        string
	Password     string
	Proxy        string
	Cookie       string
	Fingerprint  string
	Messages     []Message
	Count        int
	LastQuery    string
	LastCount    int
	Members      []User
	AllMembers   []User
	Rejoin       int
	ScrapeCount  int
	ID           string
	Receiver     bool
	Config       Config
	GatewayProxy string
	Client       *http.Client
	WG           *sync.WaitGroup
	Ws           *Connection
	// contains filtered or unexported fields
}

func (*Instance) AvatarChanger

func (in *Instance) AvatarChanger(avatar string) (http.Response, error)

@me Discord Patch request to change Avatar

func (*Instance) BioChanger

func (in *Instance) BioChanger(bios []string) error

func (*Instance) BlockUser

func (in *Instance) BlockUser(userid string) (int, error)

func (*Instance) Call

func (in *Instance) Call(snowflake string) error

func (*Instance) CheckToken

func (in *Instance) CheckToken() int

func (*Instance) CloseDMS

func (in *Instance) CloseDMS(snowflake string) (int, error)

func (*Instance) ContextProperties

func (in *Instance) ContextProperties(invite, cookie, fingerprint string) (string, error)

func (*Instance) Friend

func (in *Instance) Friend(Username string, Discrim int) (*http.Response, error)

func (*Instance) GetCfBm

func (in *Instance) GetCfBm(m, r, cookies string) (string, error)

func (*Instance) GetCookieString

func (in *Instance) GetCookieString() (string, error)

func (*Instance) GetFingerprintString

func (in *Instance) GetFingerprintString(cookie string) (string, error)

Getting Fingerprint to use in our requests for more legitimate seeming requests.

func (*Instance) Invite

func (in *Instance) Invite(Code string) error

func (*Instance) Inviter

func (in *Instance) Inviter(invitationCode string, mode int, cookie string, fingerprint string) (int, string, string, error)

New Invite joiner

func (*Instance) Leave

func (in *Instance) Leave(serverid string) int

func (*Instance) NameChanger

func (in *Instance) NameChanger(name string) (http.Response, error)

@me Discord Patch request to change Username

func (*Instance) NewConnection

func (in *Instance) NewConnection(fatalHandler func(err error)) (*Connection, error)

Input Discord token and start a new websocket connection

func (*Instance) OpenChannel

func (in *Instance) OpenChannel(recepientUID string) (string, error)

func (*Instance) React

func (in *Instance) React(channelID string, MessageID string, Emoji string) error

func (*Instance) SendMessage

func (in *Instance) SendMessage(channelSnowflake string, memberid string) (http.Response, error)

Inputs the Channel snowflake and sends them the message; outputs the response code for error handling.

func (*Instance) ServerCheck

func (in *Instance) ServerCheck(serverid string) (int, error)

func (*Instance) SolveCaptcha

func (in *Instance) SolveCaptcha(sitekey string, cookie string, rqData string, rqToken string) (string, error)

func (*Instance) SolveCaptcha2Captcha

func (in *Instance) SolveCaptcha2Captcha(sitekey string) (string, error)

func (*Instance) SolveCaptchaCapmonster

func (in *Instance) SolveCaptchaCapmonster(sitekey string, cookies string, rqdata string) (string, error)

Function to use a captcha solving service and return a solved captcha key

func (*Instance) SolveCaptchaDeathByCaptcha

func (in *Instance) SolveCaptchaDeathByCaptcha(sitekey string) (string, error)

Incomplete

func (*Instance) SolveCaptchaRucaptcha

func (in *Instance) SolveCaptchaRucaptcha(sitekey string, rqData string, rqToken string) (string, error)

func (*Instance) StartWS

func (in *Instance) StartWS() error

func (*Instance) UserInfo

func (in *Instance) UserInfo(userid string) (UserInf, error)

type Intent

type Intent int
const (
	IntentsGuilds                 Intent = 1 << 0
	IntentsGuildMembers           Intent = 1 << 1
	IntentsGuildBans              Intent = 1 << 2
	IntentsGuildEmojis            Intent = 1 << 3
	IntentsGuildIntegrations      Intent = 1 << 4
	IntentsGuildWebhooks          Intent = 1 << 5
	IntentsGuildInvites           Intent = 1 << 6
	IntentsGuildVoiceStates       Intent = 1 << 7
	IntentsGuildPresences         Intent = 1 << 8
	IntentsGuildMessages          Intent = 1 << 9
	IntentsGuildMessageReactions  Intent = 1 << 10
	IntentsGuildMessageTyping     Intent = 1 << 11
	IntentsDirectMessages         Intent = 1 << 12
	IntentsDirectMessageReactions Intent = 1 << 13
	IntentsDirectMessageTyping    Intent = 1 << 14

	IntentsAllWithoutPrivileged = IntentsGuilds |
		IntentsGuildBans |
		IntentsGuildEmojis |
		IntentsGuildIntegrations |
		IntentsGuildWebhooks |
		IntentsGuildInvites |
		IntentsGuildVoiceStates |
		IntentsGuildMessages |
		IntentsGuildMessageReactions |
		IntentsGuildMessageTyping |
		IntentsDirectMessages |
		IntentsDirectMessageReactions |
		IntentsDirectMessageTyping
	IntentsAll = IntentsAllWithoutPrivileged |
		IntentsGuildMembers |
		IntentsGuildPresences
	IntentsNone Intent = 0
)

Constants for the different bit offsets of intents

type Member

type Member struct {
	User User `json:"user,omitempty"`
}

type Message

type Message struct {
	Content   string     `json:"content,omitempty"`
	Embeds    []Embed    `json:"embeds,omitempty"`
	Reactions []Reaction `json:"reactions,omitempty"`
	Author    User       `json:"author,omitempty"`
	GuildID   string     `json:"guild_id,omitempty"`
}

func GetMessage

func GetMessage() ([]Message, error)

func GetRxn

func GetRxn(channel string, messageid string, token string) (Message, error)

type MessageEmbedImage

type MessageEmbedImage struct {
	URL      string `json:"url,omitempty"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Width    int    `json:"width,omitempty"`
	Height   int    `json:"height,omitempty"`
}

type MessageEmbedThumbnail

type MessageEmbedThumbnail struct {
	URL      string `json:"url,omitempty"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Width    int    `json:"width,omitempty"`
	Height   int    `json:"height,omitempty"`
}

type NameChange

type NameChange struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Ops

type Ops struct {
	Items []Userinfo  `json:"items,omitempty"`
	Range interface{} `json:"range,omitempty"`
	Op    string      `json:"op,omitempty"`
}

type Pload

type Pload struct {
	ClientKey string `json:"clientKey"`
	Task      Task   `json:"task"`
	ErrorID   int    `json:"ErrorId"`
	TaskID    int    `json:"taskId"`
}

type Presence

type Presence struct {
	Status     string   `json:"status,omitempty"`
	Since      int      `json:"since,omitempty"`
	Activities []string `json:"activities,omitempty"`
	AFK        bool     `json:"afk,omitempty"`
}

type Properties

type Properties struct {
	OS                     string `json:"os,omitempty"`
	Browser                string `json:"browser,omitempty"`
	Device                 string `json:"device,omitempty"`
	BrowserUserAgent       string `json:"browser_user_agent,omitempty"`
	BrowserVersion         string `json:"browser_version,omitempty"`
	OSVersion              string `json:"os_version,omitempty"`
	Referrer               string `json:"referrer,omitempty"`
	ReferringDomain        string `json:"referring_domain,omitempty"`
	ReferrerCurrent        string `json:"referrer_current,omitempty"`
	ReferringDomainCurrent string `json:"referring_domain_current,omitempty"`
	ReleaseChannel         string `json:"release_channel,omitempty"`
	ClientBuildNumber      int    `json:"client_build_number,omitempty"`
}

type Reaction

type Reaction struct {
	Emojis Emoji `json:"emoji,omitempty"`
	Count  int   `json:"count,omitempty"`
}

type Reactionx

type Reactionx struct {
	ID string `json:"id"`
}

type Resp

type Resp struct {
	TaskID    int    `json:"taskID"`
	ErrorID   int    `json:"ErrorId"`
	Status    string `json:"status"`
	Solution  Sol    `json:"solution"`
	ErrorCode string `json:"errorCode"`
	ErrorDesc string `json:"errorDescription"`
}

type RingData

type RingData struct {
	Recipients interface{} `json:"recipients"`
}

type Sol

type Sol struct {
	Ans string `json:"gRecaptchaResponse"`
}

type Task

type Task struct {
	Type          string `json:"type"`
	WebsiteURL    string `json:"websiteURL"`
	WebsiteKey    string `json:"websiteKey"`
	ProxyType     string `json:"proxyType"`
	ProxyAddress  string `json:"proxyAddress"`
	ProxyPort     int    `json:"proxyPort"`
	ProxyLogin    string `json:"proxyLogin"`
	Data          string `json:"data"`
	ProxyPassword string `json:"proxyPassword"`
	UserAgent     string `json:"userAgent"`
	Cookies       string `json:"cookies`
}

type User

type User struct {
	ID            string `json:"id"`
	Username      string `json:"username"`
	Discriminator string `json:"discriminator"`
	Avatar        string `json:"avatar"`
}

type UserInf

type UserInf struct {
	User   User     `json:"user"`
	Mutual []Guilds `json:"mutual_guilds"`
}

type Userinfo

type Userinfo struct {
	Member Member `json:"member,omitempty"`
}

type XContext

type XContext struct {
	Location            string  `json:"location"`
	LocationGuildID     string  `json:"location_guild_id"`
	LocationChannelID   string  `json:"location_channel_id"`
	LocationChannelType float64 `json:"location_channel_type"`
}

Jump to

Keyboard shortcuts

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