added twice mode

This commit is contained in:
Schmenn 2021-01-25 10:52:39 +01:00
parent 5113344272
commit ef16b1b196
4 changed files with 323 additions and 1 deletions

6
.gitignore vendored
View file

@ -32,3 +32,9 @@ discord-exploits-linux-64bit
*.jpeg *.jpeg
*.jpg *.jpg
*.ogg
*.m4a
*.mp3

View file

@ -15,6 +15,7 @@ var (
) )
func main() { func main() {
args := os.Args[1:] args := os.Args[1:]
handleArgs(args, &quiet) handleArgs(args, &quiet)
if !quiet { if !quiet {
@ -26,6 +27,7 @@ func main() {
initCommand(inputFile, mode) initCommand(inputFile, mode)
//test()
} }
func handleArgs(args []string, quiet *bool) { func handleArgs(args []string, quiet *bool) {
@ -177,9 +179,53 @@ func initCommand(inputFile string, mode string) {
exploits.RunVirusImageTask(out) exploits.RunVirusImageTask(out)
fmt.Println("completed task.") fmt.Println("completed task.")
os.Remove(out) os.Remove(out)
} else if strings.HasSuffix(inputFile, ".ogg") {
if strings.ToLower(mode) != "t" || strings.ToLower(mode) == "no mode specified"{
fmt.Println("the mode is not compatible with the audio file, proceeding to run the play-twice task anyway")
}
fmt.Println("editing audio.")
exploits.RunTwiceAudioTask(inputFile)
fmt.Println("completed task.")
} else if strings.HasSuffix(inputFile, ".mp3") {
if strings.ToLower(mode) != "t" || strings.ToLower(mode) == "no mode specified"{
fmt.Println("the mode is not compatible with the audio file, proceeding to run the play-twice task anyway")
}
fmt.Println("transcoding audio from mp3 to ogg")
out := modules.Transcode(inputFile, "ogg")
fmt.Println("finished transcoding audio from mp3 to ogg")
fmt.Println("editing audio.")
exploits.RunTwiceAudioTask(out)
fmt.Println("completed task.")
os.Remove(out)
} else if strings.HasSuffix(inputFile, ".m4a") {
if strings.ToLower(mode) != "t" || strings.ToLower(mode) == "no mode specified"{
fmt.Println("the mode is not compatible with the audio file, proceeding to run the play-twice task anyway")
}
fmt.Println("transcoding audio from m4a to ogg")
out := modules.Transcode(inputFile, "ogg")
fmt.Println("finished transcoding audio from m4a to ogg")
fmt.Println("editing audio.")
exploits.RunTwiceAudioTask(out)
fmt.Println("completed task.")
os.Remove(out)
} else { } else {
if inputFile == "no input file provided" { if inputFile == "no input file provided" {
return return
} }
} }
} }
/*func test() {
data, err := twice.Asset("twice.ogg")
modules.Check(err)
testData, err := ioutil.ReadFile("test.ogg")
modules.Check(err)
data = append(data, testData...)
ioutil.WriteFile("testFinal.ogg", data, 0777)
}*/

258
exploits/twice.go Normal file

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@ package modules
import ( import (
"fmt" "fmt"
"os/exec" "os/exec"
"strings"
) )
//Transcode transcodes videos and images //Transcode transcodes videos and images
@ -10,6 +11,17 @@ func Transcode(input string, to string) string {
path := CheckForFFmpeg() path := CheckForFFmpeg()
output := CreateName(to) output := CreateName(to)
if strings.HasSuffix(input, ".ogg") || strings.HasSuffix(input, ".mp3") || strings.HasSuffix(input, ".m4a") {
out, err := exec.Command(path, "-i", input, "-ar", "44100", "-y", "-c:a", "libvorbis", output).CombinedOutput()
Check(err)
fmt.Println("temporarily saving transcoded file to " + output)
fmt.Println(string(out))
return output
}
out, err := exec.Command(path, "-i", input, output).CombinedOutput() out, err := exec.Command(path, "-i", input, output).CombinedOutput()
Check(err) Check(err)