2021-01-10 20:18:44 +00:00
|
|
|
package exploits
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
2021-01-11 11:21:44 +00:00
|
|
|
"github.com/Schmenn/discord-exploits/modules"
|
2021-01-10 20:18:44 +00:00
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RunZeroVideoTask edits file so it has got a duration of 0
|
2021-01-11 11:21:44 +00:00
|
|
|
func RunZeroVideoTask(fileName string) {
|
2021-01-10 20:18:44 +00:00
|
|
|
|
2021-03-23 11:45:20 +00:00
|
|
|
data, err := os.ReadFile(fileName)
|
2021-01-10 20:18:44 +00:00
|
|
|
modules.Check(err)
|
|
|
|
index := bytes.Index(data, []byte("\x44\x89\x88"))
|
2021-01-11 11:21:44 +00:00
|
|
|
if index == -1 {
|
2021-01-10 20:18:44 +00:00
|
|
|
fmt.Println("could not find the part of the file that needs to be modified, exiting")
|
|
|
|
fmt.Println("are you sure the file is actually a webm?")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
data[index+3] = 0
|
|
|
|
data[index+4] = 0
|
|
|
|
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 := modules.CreateName("webm")
|
|
|
|
|
2021-03-30 12:04:30 +00:00
|
|
|
fmt.Println("Saved video to: "+name)
|
2021-01-10 20:18:44 +00:00
|
|
|
|
2021-03-23 11:45:20 +00:00
|
|
|
err = os.WriteFile(name, data, os.FileMode(0777))
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-01-10 20:18:44 +00:00
|
|
|
}
|