feat: Add randomize for name and user-agent
Co-Authored-By: zcb22 <263202030+zcb22@users.noreply.github.com>
This commit is contained in:
1 parent
37656256ba
commit
6305087c7c
3 files changed
+118
-10
No files matched your search
+21
-10
@@ -371,9 +371,13 @@ func callCaptchaNotRobot(ctx context.Context, sessionToken, hash string, dialer
|
|||||||
// endregion automatic captcha solver
|
// endregion automatic captcha solver
|
||||||
|
|
||||||
func getVkCreds(link string, dialer *dnsdialer.Dialer) (string, string, string, error) {
|
func getVkCreds(link string, dialer *dnsdialer.Dialer) (string, string, string, error) {
|
||||||
|
profile := getRandomProfile()
|
||||||
|
name := generateName()
|
||||||
|
escapedName := neturl.QueryEscape(name)
|
||||||
|
|
||||||
|
log.Printf("Connecting Identity - Name: %s | User-Agent: %s", name, profile.UserAgent)
|
||||||
|
|
||||||
doRequest := func(data string, url string) (resp map[string]interface{}, err error) {
|
doRequest := func(data string, url string) (resp map[string]interface{}, err error) {
|
||||||
|
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Timeout: 20 * time.Second,
|
Timeout: 20 * time.Second,
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
@@ -384,12 +388,13 @@ func getVkCreds(link string, dialer *dnsdialer.Dialer) (string, string, string,
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
defer client.CloseIdleConnections()
|
defer client.CloseIdleConnections()
|
||||||
|
|
||||||
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(data)))
|
req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(data)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0")
|
req.Header.Add("User-Agent", profile.UserAgent)
|
||||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
|
||||||
httpResp, err := client.Do(req)
|
httpResp, err := client.Do(req)
|
||||||
@@ -439,7 +444,7 @@ func getVkCreds(link string, dialer *dnsdialer.Dialer) (string, string, string,
|
|||||||
return "", "", "", fmt.Errorf("missing access_token in response: %v", resp)
|
return "", "", "", fmt.Errorf("missing access_token in response: %v", resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
data = fmt.Sprintf("vk_join_link=https://vk.com/call/join/%s&name=123&access_token=%s", link, token1)
|
data = fmt.Sprintf("vk_join_link=https://vk.com/call/join/%s&name=%s&access_token=%s", link, escapedName, token1)
|
||||||
url = "https://api.vk.ru/method/calls.getAnonymousToken?v=5.274&client_id=6287487"
|
url = "https://api.vk.ru/method/calls.getAnonymousToken?v=5.274&client_id=6287487"
|
||||||
|
|
||||||
var token2 string
|
var token2 string
|
||||||
@@ -522,7 +527,9 @@ func getYandexCreds(link string) (string, string, string, error) {
|
|||||||
const debug = false
|
const debug = false
|
||||||
const telemostConfHost = "cloud-api.yandex.ru"
|
const telemostConfHost = "cloud-api.yandex.ru"
|
||||||
telemostConfPath := fmt.Sprintf("%s%s%s", "/telemost_front/v2/telemost/conferences/https%3A%2F%2Ftelemost.yandex.ru%2Fj%2F", link, "/connection?next_gen_media_platform_allowed=false")
|
telemostConfPath := fmt.Sprintf("%s%s%s", "/telemost_front/v2/telemost/conferences/https%3A%2F%2Ftelemost.yandex.ru%2Fj%2F", link, "/connection?next_gen_media_platform_allowed=false")
|
||||||
const userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0"
|
profile := getRandomProfile()
|
||||||
|
userAgent := profile.UserAgent
|
||||||
|
name := generateName()
|
||||||
|
|
||||||
type ConferenceResponse struct {
|
type ConferenceResponse struct {
|
||||||
URI string `json:"uri"`
|
URI string `json:"uri"`
|
||||||
@@ -636,13 +643,14 @@ func getYandexCreds(link string) (string, string, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
endpoint := "https://" + telemostConfHost + telemostConfPath
|
endpoint := "https://" + telemostConfHost + telemostConfPath
|
||||||
client := &http.Client{
|
tr := &http.Transport{
|
||||||
Timeout: 20 * time.Second,
|
|
||||||
Transport: &http.Transport{
|
|
||||||
MaxIdleConns: 100,
|
MaxIdleConns: 100,
|
||||||
MaxIdleConnsPerHost: 100,
|
MaxIdleConnsPerHost: 100,
|
||||||
IdleConnTimeout: 90 * time.Second,
|
IdleConnTimeout: 90 * time.Second,
|
||||||
},
|
}
|
||||||
|
client := &http.Client{
|
||||||
|
Timeout: 20 * time.Second,
|
||||||
|
Transport: tr,
|
||||||
}
|
}
|
||||||
defer client.CloseIdleConnections()
|
defer client.CloseIdleConnections()
|
||||||
req, err := http.NewRequest("GET", endpoint, nil)
|
req, err := http.NewRequest("GET", endpoint, nil)
|
||||||
@@ -701,14 +709,14 @@ func getYandexCreds(link string) (string, string, string, error) {
|
|||||||
UID: uuid.New().String(),
|
UID: uuid.New().String(),
|
||||||
Hello: HelloPayload{
|
Hello: HelloPayload{
|
||||||
ParticipantMeta: PartMeta{
|
ParticipantMeta: PartMeta{
|
||||||
Name: "Гость",
|
Name: name,
|
||||||
Role: "SPEAKER",
|
Role: "SPEAKER",
|
||||||
Description: "",
|
Description: "",
|
||||||
SendAudio: false,
|
SendAudio: false,
|
||||||
SendVideo: false,
|
SendVideo: false,
|
||||||
},
|
},
|
||||||
ParticipantAttributes: PartAttrs{
|
ParticipantAttributes: PartAttrs{
|
||||||
Name: "Гость",
|
Name: name,
|
||||||
Role: "SPEAKER",
|
Role: "SPEAKER",
|
||||||
Description: "",
|
Description: "",
|
||||||
},
|
},
|
||||||
@@ -836,6 +844,7 @@ func dtlsFunc(ctx context.Context, conn net.PacketConn, peer *net.UDPAddr) (net.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func oneDtlsConnection(ctx context.Context, peer *net.UDPAddr, listenConn net.PacketConn, connchan chan<- net.PacketConn, okchan chan<- struct{}, c chan<- error) {
|
func oneDtlsConnection(ctx context.Context, peer *net.UDPAddr, listenConn net.PacketConn, connchan chan<- net.PacketConn, okchan chan<- struct{}, c chan<- error) {
|
||||||
|
time.Sleep(time.Duration(rand.Intn(400)+100) * time.Millisecond)
|
||||||
var err error = nil
|
var err error = nil
|
||||||
defer func() { c <- err }()
|
defer func() { c <- err }()
|
||||||
dtlsctx, dtlscancel := context.WithCancel(ctx)
|
dtlsctx, dtlscancel := context.WithCancel(ctx)
|
||||||
@@ -970,6 +979,7 @@ type turnParams struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func oneTurnConnection(ctx context.Context, turnParams *turnParams, peer *net.UDPAddr, conn2 net.PacketConn, c chan<- error) {
|
func oneTurnConnection(ctx context.Context, turnParams *turnParams, peer *net.UDPAddr, conn2 net.PacketConn, c chan<- error) {
|
||||||
|
time.Sleep(time.Duration(rand.Intn(400)+100) * time.Millisecond)
|
||||||
var err error = nil
|
var err error = nil
|
||||||
defer func() { c <- err }()
|
defer func() { c <- err }()
|
||||||
user, pass, url, err1 := turnParams.getCreds(turnParams.link)
|
user, pass, url, err1 := turnParams.getCreds(turnParams.link)
|
||||||
@@ -1251,6 +1261,7 @@ func poolCreds(f getCredsFunc, poolSize int) getCredsFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() { //nolint:cyclop
|
func main() { //nolint:cyclop
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
signalChan := make(chan os.Signal, 1)
|
signalChan := make(chan os.Signal, 1)
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
)
|
||||||
|
|
||||||
|
// firstNames contains Russian first names. Add or remove names as needed.
|
||||||
|
var firstNames = []string{
|
||||||
|
"Александр", "Дмитрий", "Максим", "Сергей", "Андрей", "Алексей", "Артём", "Илья",
|
||||||
|
"Кирилл", "Михаил", "Никита", "Матвей", "Роман", "Егор", "Арсений", "Иван",
|
||||||
|
"Денис", "Даниил", "Тимофей", "Владислав", "Игорь", "Павел", "Руслан", "Марк",
|
||||||
|
"Анна", "Мария", "Елена", "Дарья", "Анастасия", "Екатерина", "Виктория", "Ольга",
|
||||||
|
"Наталья", "Юлия", "Татьяна", "Светлана", "Ирина", "Ксения", "Алина", "Елизавета",
|
||||||
|
}
|
||||||
|
|
||||||
|
// lastNames contains Russian last names. Add or remove names as needed.
|
||||||
|
var lastNames = []string{
|
||||||
|
"Иванов", "Смирнов", "Кузнецов", "Попов", "Васильев", "Петров", "Соколов", "Михайлов",
|
||||||
|
"Новиков", "Федоров", "Морозов", "Волков", "Алексеев", "Лебедев", "Семенов", "Егоров",
|
||||||
|
"Павлов", "Козлов", "Степанов", "Николаев", "Орлов", "Андреев", "Макаров", "Никитин",
|
||||||
|
"Захаров", "Зайцев", "Соловьев", "Борисов", "Яковлев", "Григорьев", "Романов", "Воробьев",
|
||||||
|
}
|
||||||
|
|
||||||
|
// generateName generates a random Russian name.
|
||||||
|
// 30% chance to generate only first name, 70% chance first + last name.
|
||||||
|
// For female names (ending in 'а' or 'я'), adds 'а' to the last name.
|
||||||
|
func generateName() string {
|
||||||
|
if rand.Float32() < 0.3 {
|
||||||
|
return firstNames[rand.Intn(len(firstNames))]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn := firstNames[rand.Intn(len(firstNames))]
|
||||||
|
ln := lastNames[rand.Intn(len(lastNames))]
|
||||||
|
|
||||||
|
// add 'a' to the last name for females
|
||||||
|
lastChar := fn[len(fn)-2:] // 2 bytes for cyrillic
|
||||||
|
if lastChar == "а" || lastChar == "я" {
|
||||||
|
return fmt.Sprintf("%s %sа", fn, ln)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s %s", fn, ln)
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Profile struct {
|
||||||
|
UserAgent string
|
||||||
|
}
|
||||||
|
|
||||||
|
// profiles contains realistic user-agent strings for different browsers and platforms.
|
||||||
|
// Add or remove profiles as needed.
|
||||||
|
var profiles = []Profile{
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"},
|
||||||
|
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145.0.0.0"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0"},
|
||||||
|
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 YaBrowser/24.1.0.0 Yowser/2.5 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 YaBrowser/24.1.2.0 Yowser/2.5 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 YaBrowser/23.12.0.0 Yowser/2.5 Safari/537.36"},
|
||||||
|
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 OPR/112.0.0.0"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 OPR/111.0.0.0"},
|
||||||
|
|
||||||
|
{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0"},
|
||||||
|
|
||||||
|
{"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"},
|
||||||
|
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"},
|
||||||
|
{"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// getRandomProfile returns a random user-agent profile.
|
||||||
|
func getRandomProfile() Profile {
|
||||||
|
return profiles[rand.Intn(len(profiles))]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user