1 Commits
v0.4 ... v0.4.1

Author SHA1 Message Date
Rustem Kamalov
d8c3700252 Stealth browser as option. Update default config 2025-08-18 22:49:45 +03:00
5 changed files with 15 additions and 3 deletions

View File

@@ -12,7 +12,7 @@ import (
)
const (
version = "0.3"
version = "0.4.1"
defaultConfigFilename = "config"
envPrefix = "OPENSERP"
)
@@ -42,6 +42,7 @@ type AppConfig struct {
IsRawRequests bool `mapstructure:"raw_requests"`
ProxyURL string `mapstructure:"proxy"`
Insecure bool `mapstructure:"insecure"`
IsStealth bool `mapstructure:"stealth"`
}
var config = Config{}
@@ -136,5 +137,5 @@ func init() {
RootCmd.PersistentFlags().BoolVarP(&config.App.IsLeaveHead, "leave", "", false, "Leave browser and tabs opened after search is made")
RootCmd.PersistentFlags().StringVarP(&config.Config2Capcha.ApiKey, "2captcha_key", "", "", "2 captcha api key")
RootCmd.PersistentFlags().StringVarP(&config.App.ProxyURL, "proxy", "x", "", "HTTP or Socks5 proxy URL (e.g. http://user:pass@127.0.0.1:8080)")
RootCmd.PersistentFlags().BoolVarP(&config.App.Insecure, "insecure", "k", false, "Allow insecure TLS connections")
RootCmd.PersistentFlags().BoolVarP(&config.App.IsStealth, "stealth", "s", false, "Use stealth browser plugin")
}

View File

@@ -63,6 +63,7 @@ func searchBrowser(engineType string, query core.Query) ([]core.SearchResult, er
CaptchaSolverApiKey: config.Config2Capcha.ApiKey,
ProxyURL: config.App.ProxyURL,
Insecure: config.App.Insecure,
UseStealth: config.App.IsStealth,
}
if config.App.IsDebug {

View File

@@ -80,6 +80,7 @@ func serve(cmd *cobra.Command, args []string) {
CaptchaSolverApiKey: config.Config2Capcha.ApiKey,
ProxyURL: config.App.ProxyURL,
Insecure: config.App.Insecure,
UseStealth: config.App.IsBrowserHead,
}
if config.App.IsDebug {

View File

@@ -7,6 +7,8 @@ app:
head: false
leakless: false
leave_head: false
stealth: false
insecure: false
2captcha:
apikey: "123123123123123"

View File

@@ -23,6 +23,7 @@ type BrowserOpts struct {
CaptchaSolverApiKey string // 2Captcha api key
ProxyURL string // Proxy URL
Insecure bool // Allow insecure TLS connections
UseStealth bool // Use go-rod stealth plugin
}
@@ -123,7 +124,13 @@ func (b *Browser) Navigate(URL string) (*rod.Page, error) {
b.browser.MustIgnoreCertErrors(true)
}
page := stealth.MustPage(b.browser)
var page *rod.Page
if b.UseStealth {
page = stealth.MustPage(b.browser)
} else {
page = b.browser.MustPage(URL)
}
page.MustEmulate(devices.Device{
AcceptLanguage: b.LanguageCode,
})