mirror of
https://github.com/Schmenn/discord-exploits.git
synced 2024-12-22 16:05:29 +00:00
implemented core ffmpeg functions
[TODO] update README.md and clean code
This commit is contained in:
parent
24b1b9a48a
commit
2a9103af59
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -26,3 +26,7 @@ discord-exploits
|
||||||
discord-exploits-linux-32bit
|
discord-exploits-linux-32bit
|
||||||
|
|
||||||
discord-exploits-linux-64bit
|
discord-exploits-linux-64bit
|
||||||
|
|
||||||
|
*.mp4
|
||||||
|
|
||||||
|
*.jpeg
|
||||||
|
|
87
exploits.go
87
exploits.go
|
@ -2,10 +2,10 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Schmenn/discord-exploits/exploits"
|
|
||||||
"github.com/Schmenn/discord-exploits/modules"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"github.com/Schmenn/discord-exploits/exploits"
|
||||||
|
"github.com/Schmenn/discord-exploits/modules"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -27,6 +27,7 @@ func main() {
|
||||||
fmt.Println("mode: " + mode)
|
fmt.Println("mode: " + mode)
|
||||||
|
|
||||||
initCommand(inputFile, mode)
|
initCommand(inputFile, mode)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleArgs(args []string, quiet *bool) {
|
func handleArgs(args []string, quiet *bool) {
|
||||||
|
@ -64,7 +65,7 @@ func handleArgs(args []string, quiet *bool) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initCommand(inputFile string, mode string) {
|
/*func initCommand(inputFile string, mode string) {
|
||||||
inputFile = strings.ToLower(inputFile)
|
inputFile = strings.ToLower(inputFile)
|
||||||
switch strings.ToLower(mode) {
|
switch strings.ToLower(mode) {
|
||||||
case "e":
|
case "e":
|
||||||
|
@ -73,7 +74,7 @@ func initCommand(inputFile string, mode string) {
|
||||||
exploits.RunExpandingVideoTask(inputFile)
|
exploits.RunExpandingVideoTask(inputFile)
|
||||||
fmt.Println("completed task.")
|
fmt.Println("completed task.")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("File is not a webm, check -h")
|
fmt.Println("File is not a webm or mp4, check -h")
|
||||||
}
|
}
|
||||||
case "n":
|
case "n":
|
||||||
if strings.HasSuffix(inputFile, ".webm") {
|
if strings.HasSuffix(inputFile, ".webm") {
|
||||||
|
@ -101,3 +102,81 @@ func initCommand(inputFile string, mode string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
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.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
16
modules/ffmpeg-check.go
Normal file
16
modules/ffmpeg-check.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package modules
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CheckForFFmpeg looks for ffmpeg in the path
|
||||||
|
func CheckForFFmpeg() string {
|
||||||
|
path, err := exec.LookPath("ffmpeg")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return path
|
||||||
|
}
|
16
modules/transcode-to-webm.go
Normal file
16
modules/transcode-to-webm.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package modules
|
||||||
|
|
||||||
|
import(
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
//Transcode transcodes video to webm
|
||||||
|
func Transcode (input string, to string) string {
|
||||||
|
path := CheckForFFmpeg()
|
||||||
|
output := CreateName(to)
|
||||||
|
|
||||||
|
cmd := exec.Command(path, "-i", input, output)
|
||||||
|
err := cmd.Run()
|
||||||
|
Check(err)
|
||||||
|
return output
|
||||||
|
}
|
Loading…
Reference in a new issue