1
0
This commit is contained in:
Antonio Cheong 2023-04-02 11:44:06 +08:00
parent 11eb8acf77
commit 742c6f628b
2 changed files with 86 additions and 0 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
tools/authenticator/100-ACCOUNTS_COMPILED.txt tools/authenticator/100-ACCOUNTS_COMPILED.txt
tools/authenticator/accounts.txt
tools/authenticator/proxies.txt

View File

@ -1 +1,85 @@
package main package main
import (
"bufio"
"fmt"
"os"
"strings"
)
type Account struct {
Username string `json:"username"`
Password string `json:"password"`
}
type Proxy struct {
IP string `json:"ip"`
Port string `json:"port"`
User string `json:"user"`
Pass string `json:"pass"`
}
func (p Proxy) Socks5URL() string {
// Returns proxy URL (socks5)
return fmt.Sprintf("socks5h://%s:%s@%s:%s", p.User, p.Pass, p.IP, p.Port)
}
// Read accounts.txt and create a list of accounts
func readAccounts() []Account {
accounts := []Account{}
// Read accounts.txt and create a list of accounts
file, err := os.Open("accounts.txt")
if err != nil {
panic(err)
}
defer file.Close()
// Loop through each line in the file
scanner := bufio.NewScanner(file)
for scanner.Scan() {
// Split by :
line := strings.Split(scanner.Text(), ":")
// Create an account
account := Account{
Username: line[0],
Password: line[1],
}
// Append to accounts
accounts = append(accounts, account)
}
return accounts
}
// Read proxies from proxies.txt and create a list of proxies
func readProxies() []Proxy {
proxies := []Proxy{}
// Read proxies.txt and create a list of proxies
file, err := os.Open("proxies.txt")
if err != nil {
panic(err)
}
defer file.Close()
// Loop through each line in the file
scanner := bufio.NewScanner(file)
for scanner.Scan() {
// Split by :
line := strings.Split(scanner.Text(), ":")
// Create a proxy
proxy := Proxy{
IP: line[0],
Port: line[1],
User: line[2],
Pass: line[3],
}
// Append to proxies
proxies = append(proxies, proxy)
}
return proxies
}
func main() {
// Read accounts and proxies
accounts := readAccounts()
proxies := readProxies()
// Print accounts and proxies as test
fmt.Println(accounts)
fmt.Println(proxies)
}