discord-exploits/exploits.go
Schmenn 30aa09f720 Upgraded FFmpeg implementation
[^] README.md | for transcoding information
[-] exploits.go | removed skipArg completely as it's not needed at all
[^] exploits.go | changed mode handler because I made a mistake which  makes v the zero duration video mode
[^] .gitignore | added .jpg
[^] transcode-to-webm.go => transcode.go | fixed FFmpeg output and made it print the temporary file location
[^] name.go | made file name longer and changed Unix to UnixNano because the seed as Unix sometimes creates two identical file names when images are transcoded as it is really fast
[^] help.go | changed "doesn't" to "don't"
[^] ffmpeg-check.go | changed error checking function to the one already present in modules/error.go
2021-01-15 11:49:27 +01:00

186 lines
4.5 KiB
Go

package main
import (
"fmt"
"os"
"strings"
"github.com/Schmenn/discord-exploits/exploits"
"github.com/Schmenn/discord-exploits/modules"
)
var (
quiet bool = false
inputFile string = "no input file provided"
mode string = "no mode specified"
)
func main() {
args := os.Args[1:]
handleArgs(args, &quiet)
if !quiet {
modules.Welcome()
}
fmt.Println("input file: " + inputFile)
fmt.Println("mode: " + mode)
initCommand(inputFile, mode)
}
func handleArgs(args []string, quiet *bool) {
for i, s := range args {
switch s {
// Quiet
case "-q", "--quiet":
*quiet = true
// Input File
case "-i":
inputFile = args[i+1]
// Mode Selection
case "-m":
mode = args[i+1]
// Help Message
case "-h":
modules.Help(os.Args[0])
*quiet = true
return
default:
break
}
}
}
/*func initCommand(inputFile string, mode string) {
inputFile = strings.ToLower(inputFile)
switch strings.ToLower(mode) {
case "e":
if strings.HasSuffix(inputFile, ".webm") {
fmt.Println("editing video.")
exploits.RunExpandingVideoTask(inputFile)
fmt.Println("completed task.")
} else {
fmt.Println("File is not a webm or mp4, check -h")
}
case "n":
if strings.HasSuffix(inputFile, ".webm") {
fmt.Println("editing video.")
exploits.RunNegativeVideoTask(inputFile)
fmt.Println("completed task.")
} else {
fmt.Println("File is not a webm, check -h")
}
case "0", "z":
if strings.HasSuffix(inputFile, ".webm") {
fmt.Println("editing video.")
exploits.RunZeroVideoTask(inputFile)
fmt.Println("completed task.")
} else {
fmt.Println("File is not a webm, check -h")
}
case "v":
if strings.HasSuffix(inputFile, ".png") {
fmt.Println("editing photo.")
exploits.RunVirusImageTask(inputFile)
fmt.Println("completed task.")
} else {
fmt.Println("File is not a png, check -h")
}
}
}
*/
func initCommand(inputFile string, mode string) {
inputFile = strings.ToLower(inputFile)
if strings.HasSuffix(inputFile, ".webm") {
switch mode {
case "e":
fmt.Println("editing video.")
exploits.RunExpandingVideoTask(inputFile)
fmt.Println("completed task.")
case "n":
fmt.Println("editing video.")
exploits.RunNegativeVideoTask(inputFile)
fmt.Println("completed task.")
case "0", "z":
fmt.Println("editing video.")
exploits.RunZeroVideoTask(inputFile)
fmt.Println("completed task.")
default:
fmt.Println("the mode doesn't match the file")
}
} else if strings.HasSuffix(inputFile, ".mp4") {
switch mode {
case "e":
fmt.Println("transcoding video from mp4 to webm")
out := modules.Transcode(inputFile, "webm")
fmt.Println("finished transcoding video from mp4 to webm")
fmt.Println("editing video.")
exploits.RunExpandingVideoTask(out)
fmt.Println("completed task.")
os.Remove(out)
case "n":
fmt.Println("transcoding video from mp4 to webm")
out := modules.Transcode(inputFile, "webm")
fmt.Println("finished transcoding video from mp4 to webm")
fmt.Println("editing video.")
exploits.RunNegativeVideoTask(out)
fmt.Println("completed task.")
os.Remove(out)
case "0", "z":
fmt.Println("transcoding video from mp4 to webm")
out := modules.Transcode(inputFile, "webm")
fmt.Println("finished transcoding video from mp4 to webm")
fmt.Println("editing video.")
exploits.RunZeroVideoTask(out)
fmt.Println("completed task.")
os.Remove(out)
default:
fmt.Println("the mode doesn't match the file")
}
} else if strings.HasSuffix(inputFile, ".png") {
fmt.Println("editing photo.")
exploits.RunVirusImageTask(inputFile)
fmt.Println("completed task.")
} else if strings.HasSuffix(inputFile, ".jpg") {
fmt.Println("transcoding image from jpg to png")
out := modules.Transcode(inputFile, "png")
fmt.Println("finished transcoding image from jpg to png")
fmt.Println("editing photo.")
exploits.RunVirusImageTask(out)
fmt.Println("completed task.")
os.Remove(out)
} else if strings.HasSuffix(inputFile, ".jpeg") {
if strings.ToLower(mode) != "v" || strings.ToLower(mode) == "no mode specified"{
fmt.Println("the mode is not compatible with the image, proceeding to run the virus image task anyway")
}
fmt.Println("transcoding image from jpeg to png")
out := modules.Transcode(inputFile, "png")
fmt.Println("finished transcoding image from jpeg to png")
fmt.Println("editing photo.")
exploits.RunVirusImageTask(out)
fmt.Println("completed task.")
os.Remove(out)
} else {
if inputFile == "no input file provided" {
return
}
}
}