diff --git a/.gitignore b/.gitignore index 349a46f..83c4e68 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ discord-exploits-linux-64bit *.mp4 *.jpeg + +*.jpg diff --git a/README.md b/README.md index 441e004..ada9e16 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ -

- [![GitHub stars](https://img.shields.io/github/stars/Schmenn/discord-exploits?color=FFFFFF&label=stars&style=flat-square)](https://github.com/Schmenn/discord-exploits/stargazers) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Schmenn/discord-exploits?color=FFFFFF&style=flat-square) ![GitHub issues](https://img.shields.io/github/issues/Schmenn/discord-exploits?color=FFFFFF&style=flat-square) [![GitHub forks](https://img.shields.io/github/forks/Schmenn/discord-exploits?color=FFFFFF&style=flat-square)](https://github.com/Schmenn/discord-exploits/network) ![Made with](https://img.shields.io/badge/made%20with-Go-29BEB0?style=flat-square) -

- # Discord-Exploits A program for creating exploited media files for discord written in Go. @@ -33,9 +29,11 @@ the mode `v` stands for virus image The Program only supports `webm` files for video and `png` files for images ##### The file will be saved with a random file name in the directory in which you ran the command -##### You can use [ffmpeg](https://ffmpeg.org) to convert a video to .webm or to convert an image to png (better than online converters) -##### The image may get flagged by windows defender and will get removed. to restore the file, go to Settings > Update & Security > Windows Security > Virus & Threat protection and restore the file +##### You can use [FFmpeg](https://ffmpeg.org) to convert a video to .webm or to convert an image to png (better than online converters) +##### The "virus" image may get flagged by windows defender and will get removed. to restore the file, go to Settings > Update & Security > Windows Security > Virus & Threat protection and restore the file +### Other file formats +If you want to run this program with other file types like `mp4` and `jpg` directly, make sure you have FFmpeg installed and on your path as the program uses it to transcode the file in those cases. ## Installation ### Via releases @@ -61,7 +59,7 @@ linux-32-bit` `cd discord-exploits` -3. Compile it +3. Build it `go build` @@ -73,6 +71,7 @@ linux-32-bit` * Feature for creating a video that, when played on discord, will look like it has got a huge negative duration * Feature for creating a video that, when played on discord, will look like it has got a constant duration of 0 * Feature for creating an image then triggers other users' windows defender after being cached +* Transcoding from `mp4` to `webm` and from `jpeg` and `jpg` to `png` ([requires FFmpeg](https://github.com/Schmenn/discord-exploits#other-file-formats)) ### Upcoming Features are: not yet decided. diff --git a/exploits.go b/exploits.go index 1da6c3b..39ca90e 100644 --- a/exploits.go +++ b/exploits.go @@ -12,13 +12,11 @@ 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() } @@ -32,24 +30,18 @@ func main() { func handleArgs(args []string, quiet *bool) { - /*if skipArg > 0 { - skipArg = skipArg - 1 - return - }*/ for i, s := range args { switch s { - // quiet + // 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 @@ -118,7 +110,7 @@ func initCommand(inputFile string, mode string) { fmt.Println("editing video.") exploits.RunNegativeVideoTask(inputFile) fmt.Println("completed task.") - case "0", "v": + case "0", "z": fmt.Println("editing video.") exploits.RunZeroVideoTask(inputFile) fmt.Println("completed task.") @@ -147,7 +139,7 @@ func initCommand(inputFile string, mode string) { fmt.Println("completed task.") os.Remove(out) - case "0", "v": + 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") @@ -160,11 +152,12 @@ func initCommand(inputFile string, mode string) { fmt.Println("the mode doesn't match the file") } - } else if strings.HasSuffix(inputFile, "png") { + } else if strings.HasSuffix(inputFile, ".png") { fmt.Println("editing photo.") exploits.RunVirusImageTask(inputFile) fmt.Println("completed task.") - } else if strings.HasSuffix(inputFile, "jpg") { + + } 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") @@ -172,7 +165,11 @@ func initCommand(inputFile string, mode string) { exploits.RunVirusImageTask(out) fmt.Println("completed task.") os.Remove(out) - } else if strings.HasSuffix(inputFile, "jpeg") { + + } 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") @@ -180,5 +177,9 @@ func initCommand(inputFile string, mode string) { exploits.RunVirusImageTask(out) fmt.Println("completed task.") os.Remove(out) + } else { + if inputFile == "no input file provided" { + return + } } } diff --git a/modules/ffmpeg-check.go b/modules/ffmpeg-check.go index 0ed9832..5c5ab48 100644 --- a/modules/ffmpeg-check.go +++ b/modules/ffmpeg-check.go @@ -8,9 +8,7 @@ import ( func CheckForFFmpeg() string { path, err := exec.LookPath("ffmpeg") - if err != nil { - panic(err) - } + Check(err) return path } diff --git a/modules/help.go b/modules/help.go index baf36c6..127f938 100644 --- a/modules/help.go +++ b/modules/help.go @@ -9,7 +9,7 @@ func Help(progName string) { fmt.Println("Discord-Exploits Help") fmt.Println(" Usage: " + progName + " -i -m [-q]") fmt.Println("") - fmt.Println("--quiet -q doesn't show welcome screen") + fmt.Println("--quiet -q don't show welcome screen") fmt.Println("-i provide input file") fmt.Println("-m specify mode") fmt.Println("") diff --git a/modules/name.go b/modules/name.go index 16c2333..8a4c852 100644 --- a/modules/name.go +++ b/modules/name.go @@ -8,8 +8,8 @@ import ( // CreateName generates a random file name func CreateName(extension string) string { charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - b := make([]byte, 6) - rand.Seed(time.Now().Unix()) + b := make([]byte, 8) + rand.Seed(time.Now().UnixNano()) for i := range b { b[i] = charset[rand.Intn(len(charset))] } diff --git a/modules/transcode-to-webm.go b/modules/transcode-to-webm.go deleted file mode 100644 index 5258f46..0000000 --- a/modules/transcode-to-webm.go +++ /dev/null @@ -1,16 +0,0 @@ -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 -} diff --git a/modules/transcode.go b/modules/transcode.go new file mode 100644 index 0000000..2eb3038 --- /dev/null +++ b/modules/transcode.go @@ -0,0 +1,22 @@ +package modules + +import ( + "fmt" + "os/exec" +) + +//Transcode transcodes videos and images +func Transcode(input string, to string) string { + path := CheckForFFmpeg() + output := CreateName(to) + + out, err := exec.Command(path, "-i", input, output).CombinedOutput() + + Check(err) + + fmt.Println("temporarily saving transcoded file to " + output) + + fmt.Println(string(out)) + + return output +}