mirror of
https://github.com/Schmenn/discord-exploits.git
synced 2024-12-23 02:25:31 +00:00
259 lines
45 KiB
Go
259 lines
45 KiB
Go
|
package exploits
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"compress/gzip"
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"io/ioutil"
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
"strings"
|
||
|
"time"
|
||
|
"github.com/Schmenn/discord-exploits/modules"
|
||
|
)
|
||
|
|
||
|
// RunTwiceAudioTask edits audio file so it plays a different track when played again
|
||
|
func RunTwiceAudioTask(fileName string) {
|
||
|
data, err := ioutil.ReadFile(fileName)
|
||
|
modules.Check(err)
|
||
|
|
||
|
twice, err := Asset("twice.ogg")
|
||
|
modules.Check(err)
|
||
|
|
||
|
twice = append(twice, data...)
|
||
|
|
||
|
name := modules.CreateName("ogg")
|
||
|
fmt.Println(name)
|
||
|
|
||
|
ioutil.WriteFile(name, twice, 0777)
|
||
|
}
|
||
|
|
||
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
||
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||
|
}
|
||
|
|
||
|
var buf bytes.Buffer
|
||
|
_, err = io.Copy(&buf, gz)
|
||
|
clErr := gz.Close()
|
||
|
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||
|
}
|
||
|
if clErr != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return buf.Bytes(), nil
|
||
|
}
|
||
|
|
||
|
type asset struct {
|
||
|
bytes []byte
|
||
|
info os.FileInfo
|
||
|
}
|
||
|
|
||
|
type bindataFileInfo struct {
|
||
|
name string
|
||
|
size int64
|
||
|
mode os.FileMode
|
||
|
modTime time.Time
|
||
|
}
|
||
|
|
||
|
// Name return file name
|
||
|
func (fi bindataFileInfo) Name() string {
|
||
|
return fi.name
|
||
|
}
|
||
|
|
||
|
// Size return file size
|
||
|
func (fi bindataFileInfo) Size() int64 {
|
||
|
return fi.size
|
||
|
}
|
||
|
|
||
|
// Mode return file mode
|
||
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||
|
return fi.mode
|
||
|
}
|
||
|
|
||
|
// Mode return file modify time
|
||
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||
|
return fi.modTime
|
||
|
}
|
||
|
|
||
|
// IsDir return file whether a directory
|
||
|
func (fi bindataFileInfo) IsDir() bool {
|
||
|
return fi.mode&os.ModeDir != 0
|
||
|
}
|
||
|
|
||
|
// Sys return file is sys mode
|
||
|
func (fi bindataFileInfo) Sys() interface{} {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var _twiceOgg = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7b\x77\x54\x93\x4f\x97\xff\x24\xf4\x6a\x40\xba\x80\x01\x42\x09\xa0\x52\x22\x5d\x0d\x48\x4b\xe8\xa1\x08\x28\x20\x55\x90\x22\x5d\x11\xd1\x80\x80\xf4\x66\x00\xe9\x88\x14\x01\x69\xd2\x04\xa5\x88\x48\xef\x1d\x69\x22\xbd\x23\x08\x0a\x08\xfc\x0e\xfa\x7d\x77\xdf\xf7\xdd\x73\x76\xcf\x9e\x7d\xff\xd8\xdf\x59\xef\x99\xcc\x73\x67\x72\xe7\xde\xcc\x7d\x9e\x67\xe6\x7e\x72\xe6\x6a\xdd\xba\xa5\x0b\xa0\xe0\x2f\x0a\x33\xfe\x7d\xbd\x1f\xd1\xe7\x0a\xe1\x84\x78\xde\x71\xb5\xb0\x73\x3b\xe9\x80\x2a\xbe\xfa\x4b\x64\xff\xf7\xe5\x0d\xe4\xd7\x48\xf0\xf7\x23\x21\x00\x00\xc5\x75\x59\x5b\x98\xec\xf1\x3f\xd0\x7b\xa2\xdf\x8a\x84\x00\x00\x86\x76\xce\xb6\xe7\xb5\x5c\x6f\xc1\x1d\xec\x2c\x0c\x7e\xf5\xc2\x31\x70\x31\x11\x51\x31\x11\x31\x11\x71\xb8\x80\x96\xa3\x93\x9d\xb3\xab\xb5\x9b\xb5\x93\x3b\xf2\x44\x2d\x84\xe4\xf7\x50\x2e\x85\xab\x06\x90\x13\x0b\x2c\x96\x7a\x48\xe5\x04\x5c\x1f\x36\x98\xd5\x8d\x20\xaa\x9c\x60\x11\x83\x0d\xce\xf2\x67\x52\x50\x4d\x71\x63\xd0\xcd\x95\x1e\x4e\xb6\x7f\x55\x55\x0e\xf7\x87\xb1\xe9\x6a\x23\x49\x12\x70\x11\x38\x3b\x56\xcb\xa8\x13\x0e\xa6\x86\xe1\x75\xa7\x97\xe1\x4f\xb1\x84\x5d\xc7\xbc\x1f\x7a\x66\x1f\x2a\x5f\xc1\xee\x4f\x93\x88\x53\x47\x36\x12\x70\x21\x0a\xe4\xac\xba\x61\xc8\x8f\x04\x1c\x56\x81\x8c\xd7\x9d\x56\x66\x9e\x5d\x37\x02\x2b\x20\xff\x26\xd9\x2d\xbf\x3c\x2e\xce\x32\x34\xd7\x3d\x06\xbb\x80\xb0\x52\x57\x50\x45\x06\xc4\x60\xc9\xb2\x74\x35\x15\x54\x2f\xc6\x0d\xe1\x90\x1c\x6e\x38\xdc\x6d\xf9\x45\xb8\x3f\x4c\xa1\x02\xee\x4f\xe3\xd7\x13\xa5\x7f\xf2\x3b\xeb\xd1\x30\xb6\xd7\x94\x40\x1b\x00\x58\xc8\x73\x96\x10\xa8\x7f\xe0\x2b\x28\x10\x03\x80\x38\x5d\x20\xe2\x8b\x40\x04\x8f\x74\x8c\x25\x86\xe9\x97\x08\x80\x02\x18\x00\xf5\xce\x0c\x98\x68\x86\xd6\x12\x84\x5a\x9f\xb0\x5a\xbf\xa2\x8e\xbe\xcf\xa0\x84\xbe\xfe\xae\x87\xc9\xf0\x49\x81\xa3\xac\x18\x4f\xb4\xa2\x55\x73\x12\xb2\xd8\xe0\x0d\xd4\x56\x2c\xe4\x34\x46\x24\x00\x0e\x00\x50\x16\x68\x80\x11\xfd\xcd\x3d\xc0\x42\x40\x3a\x88\xaf\x6c\xfe\x81\x5b\xc4\x63\x1b\x69\x5b\xc1\x8f\xf3\xee\xce\xdc\x83\xf3\x18\x27\xc1\xf9\xf9\x64\xb7\x2e\x69\xfe\x24\xb7\x26\xa9\x85\x64\xb7\x10\x57\x1b\x51\x5b\xbe\xb2\xf9\x64\x37\xfa\xc7\x36\xc8\xdf\x5c\x6a\xe3\xbc\xbc\x7d\xde\x09\xd7\x24\x9d\xf3\xd8\x45\x99\x65\x21\xd9\x2d\xb1\x6c\x5e\xfe\xb6\xc4\xd0\x7c\xb2\x1b\x53\x59\xb6\xf4\xed\xf3\x1f\xe7\x93\xdd\xb8\xe7\xe6\x31\x8e\xe7\x07\x7f\xe9\x5b\xf8\xab\xca\x63\xce\x71\x73\xd6\x3c\xd1\x9c\xb1\x3b\x6f\xec\xa4\xc0\xbc\x90\xec\x76\x99\x35\xc7\xdb\x4d\x41\x6a\xe1\xef\xe5\x7e\xbb\x07\x06\x80\x3c\x8b\x44\xa0\x4b\x0e\x5c\x35\xed\x85\x2f\x8b\x52\x90\x5d\x4b\x26\xd9\xc4\x8b\x0f\x08\x5b\x6a\x57\xca\x5c\x95\x17\x2f\xa2\x71\xcb\x70\x82\x5e\x13\x06\x99\xf2\x7b\xe6\xe4\x00\x70\xf9\x33\xe0\x54\xb9\x02\xfe\xaa\x82\xb8\x02\x59\x2c\x5a\x90\x39\xc9\x7e\x94\x82\xb9\x99\x19\x21\x62\x6d\xc2\xa5\x1d\x62\xed\x27\xd5\x4a\x71\x69\x97\xcc\xaa\x48\x23\xec\x2a\x75\x41\x19\xbd\x9a\x46\xf9\xa0\xa1\x65\x41\xd5\x42\xb2\x3d\x6d\x9f\xb1\x5d\x41\xf9\x10\x16\x99\x45\xc0\x61\x91\xbf\xfc\x87\x07\x00\x46\xce\x6a\x15\x25\xaf\xfc\x5b\x69\x76\xb2\x6b\x1b\xf2\x65\x3a\xf4\x97\x3b\xf1\xe0\xd7\x8b\x21\xd7\xea\xa6\xa8\xe2\xfe\xef\xa5\xd9\x4d\x4e\x85\xa0\x88\x21\x28\x62\xca\xd4\xdb\x07\xd4\xb5\x18\xf5\x07\x63\x4d\xae\x0f\x59\x4f\xec\x3a\x9a\x33\x7b\x4e\x7c\xf7\x98\xfa\xee\x31\x33\x1c\x60\x6e\x14\x67\xfd\x0f\xe5\xf7\xd4\xc9\x01\xc0\xc3\x14\xc8\x7f\x4f\x24\x8b\xc5\xb2\x43\x74\x21\xfd\xa9\xb6\xc2\xdf\xa6\x79\x72\x43\xeb\x75\xd8\x3f\xba\x20\x54\x5c\x11\xad\x31\xc2\x98\xa7\x28\xb5\x52\xb9\xce\x7e\x39\x8d\x6f\x8a\x3a\x0c\x1a\xfd\x7a\x4a\xd7\xdc\x95\x26\xca\x94\x46\x09\x1a\xc3\xee\x1a\xa3\xee\xfa\x46\xe5\x26\x46\x15\x8e\xa3\x43\x8e\x66\x71\x8e\x53\xdf\x7d\xfe\xae\x78\x70\xfc\x9a\xa2\x2a\x00\x8b\xaa\x11\x99\xaa\x21\x99\xaa\x11\x33\x52\x31\x08\xc8\x73\xae\x7c\x00\x58\x4f\x1e\x16\x81\x90\x17\x52\x11\x33\xaa\x31\x08\x4c\x5c\x26\x26\x75\xce\x28\xc3\xe6\x76\xf6\xad\xfb\x79\x2f\xa1\xbf\x44\xd0\xbf\x5f\x68\x00\x04\x12\xbf\x20\xb3\xbf\x20\x33\xbe\x48\x67\xf0\x60\x33\xac\x8d\x33\xb2\x6f\x17\x0a\x24\xbd\x5e\xa9\x2e\xfc\xaf\xca\xf9\x5f\x0f\x78\x14\x00\x3d\xd1\xec\xad\xd1\xec\x98\x68\x06\x4c\x34\x7b\x2b\xe4\x97\x77\xc5\x4
|
||
|
|
||
|
func twiceOggBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_twiceOgg,
|
||
|
"twice.ogg",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func twiceOgg() (*asset, error) {
|
||
|
bytes, err := twiceOggBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "twice.ogg", size: 19121, mode: os.FileMode(438), modTime: time.Unix(1610815204, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
// Asset loads and returns the asset for the given name.
|
||
|
// It returns an error if the asset could not be found or
|
||
|
// could not be loaded.
|
||
|
func Asset(name string) ([]byte, error) {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||
|
a, err := f()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||
|
}
|
||
|
return a.bytes, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
|
||
|
// MustAsset is like Asset but panics when Asset would return an error.
|
||
|
// It simplifies safe initialization of global variables.
|
||
|
func MustAsset(name string) []byte {
|
||
|
a, err := Asset(name)
|
||
|
if err != nil {
|
||
|
panic("asset: Asset(" + name + "): " + err.Error())
|
||
|
}
|
||
|
|
||
|
return a
|
||
|
}
|
||
|
|
||
|
// AssetInfo loads and returns the asset info for the given name.
|
||
|
// It returns an error if the asset could not be found or
|
||
|
// could not be loaded.
|
||
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||
|
a, err := f()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||
|
}
|
||
|
return a.info, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||
|
}
|
||
|
|
||
|
// AssetNames returns the names of the assets.
|
||
|
func AssetNames() []string {
|
||
|
names := make([]string, 0, len(_bindata))
|
||
|
for name := range _bindata {
|
||
|
names = append(names, name)
|
||
|
}
|
||
|
return names
|
||
|
}
|
||
|
|
||
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||
|
var _bindata = map[string]func() (*asset, error){
|
||
|
"twice.ogg": twiceOgg,
|
||
|
}
|
||
|
|
||
|
// AssetDir returns the file names below a certain
|
||
|
// directory embedded in the file by go-bindata.
|
||
|
// For example if you run go-bindata on data/... and data contains the
|
||
|
// following hierarchy:
|
||
|
// data/
|
||
|
// foo.txt
|
||
|
// img/
|
||
|
// a.png
|
||
|
// b.png
|
||
|
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||
|
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||
|
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||
|
// AssetDir("") will return []string{"data"}.
|
||
|
func AssetDir(name string) ([]string, error) {
|
||
|
node := _bintree
|
||
|
if len(name) != 0 {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
pathList := strings.Split(cannonicalName, "/")
|
||
|
for _, p := range pathList {
|
||
|
node = node.Children[p]
|
||
|
if node == nil {
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if node.Func != nil {
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
rv := make([]string, 0, len(node.Children))
|
||
|
for childName := range node.Children {
|
||
|
rv = append(rv, childName)
|
||
|
}
|
||
|
return rv, nil
|
||
|
}
|
||
|
|
||
|
type bintree struct {
|
||
|
Func func() (*asset, error)
|
||
|
Children map[string]*bintree
|
||
|
}
|
||
|
|
||
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||
|
"twice.ogg": &bintree{twiceOgg, map[string]*bintree{}},
|
||
|
}}
|
||
|
|
||
|
// RestoreAsset restores an asset under the given directory
|
||
|
func RestoreAsset(dir, name string) error {
|
||
|
data, err := Asset(name)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
info, err := AssetInfo(name)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// RestoreAssets restores an asset under the given directory recursively
|
||
|
func RestoreAssets(dir, name string) error {
|
||
|
children, err := AssetDir(name)
|
||
|
// File
|
||
|
if err != nil {
|
||
|
return RestoreAsset(dir, name)
|
||
|
}
|
||
|
// Dir
|
||
|
for _, child := range children {
|
||
|
err = RestoreAssets(dir, filepath.Join(name, child))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func _filePath(dir, name string) string {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||
|
}
|