discord-exploits/exploits.go
Schmenn 2a9103af59 implemented core ffmpeg functions
[TODO] update README.md and clean code
2021-01-13 15:25:45 +01:00

183 lines
4.3 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"
//skipArg int = 0
)
func main() {
args := os.Args[1:]
handleArgs(args, &quiet)
//fmt.Println(quiet)
if !quiet {
modules.Welcome()
}
fmt.Println("input file: " + inputFile)
fmt.Println("mode: " + mode)
initCommand(inputFile, mode)
}
func handleArgs(args []string, quiet *bool) {
/*if skipArg > 0 {
skipArg = skipArg - 1
return
}*/
for i, s := range args {
switch s {
// quiet
case "-q", "--quiet":
*quiet = true
// Input File
case "-i":
//skipArg++
inputFile = args[i+1]
// Mode Selection
case "-m":
//skipArg++
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", "v":
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", "v":
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.")
} else if strings.HasSuffix(inputFile, "jpeg") {
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.")
}
}