mirror of
https://github.com/karust/openserp.git
synced 2026-08-26 01:32:07 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8c3700252 |
@@ -12,7 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "0.3"
|
version = "0.4.1"
|
||||||
defaultConfigFilename = "config"
|
defaultConfigFilename = "config"
|
||||||
envPrefix = "OPENSERP"
|
envPrefix = "OPENSERP"
|
||||||
)
|
)
|
||||||
@@ -42,6 +42,7 @@ type AppConfig struct {
|
|||||||
IsRawRequests bool `mapstructure:"raw_requests"`
|
IsRawRequests bool `mapstructure:"raw_requests"`
|
||||||
ProxyURL string `mapstructure:"proxy"`
|
ProxyURL string `mapstructure:"proxy"`
|
||||||
Insecure bool `mapstructure:"insecure"`
|
Insecure bool `mapstructure:"insecure"`
|
||||||
|
IsStealth bool `mapstructure:"stealth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = Config{}
|
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().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.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().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")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ func searchBrowser(engineType string, query core.Query) ([]core.SearchResult, er
|
|||||||
CaptchaSolverApiKey: config.Config2Capcha.ApiKey,
|
CaptchaSolverApiKey: config.Config2Capcha.ApiKey,
|
||||||
ProxyURL: config.App.ProxyURL,
|
ProxyURL: config.App.ProxyURL,
|
||||||
Insecure: config.App.Insecure,
|
Insecure: config.App.Insecure,
|
||||||
|
UseStealth: config.App.IsStealth,
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.App.IsDebug {
|
if config.App.IsDebug {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ func serve(cmd *cobra.Command, args []string) {
|
|||||||
CaptchaSolverApiKey: config.Config2Capcha.ApiKey,
|
CaptchaSolverApiKey: config.Config2Capcha.ApiKey,
|
||||||
ProxyURL: config.App.ProxyURL,
|
ProxyURL: config.App.ProxyURL,
|
||||||
Insecure: config.App.Insecure,
|
Insecure: config.App.Insecure,
|
||||||
|
UseStealth: config.App.IsBrowserHead,
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.App.IsDebug {
|
if config.App.IsDebug {
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ app:
|
|||||||
head: false
|
head: false
|
||||||
leakless: false
|
leakless: false
|
||||||
leave_head: false
|
leave_head: false
|
||||||
|
stealth: false
|
||||||
|
insecure: false
|
||||||
|
|
||||||
2captcha:
|
2captcha:
|
||||||
apikey: "123123123123123"
|
apikey: "123123123123123"
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ type BrowserOpts struct {
|
|||||||
CaptchaSolverApiKey string // 2Captcha api key
|
CaptchaSolverApiKey string // 2Captcha api key
|
||||||
ProxyURL string // Proxy URL
|
ProxyURL string // Proxy URL
|
||||||
Insecure bool // Allow insecure TLS connections
|
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)
|
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{
|
page.MustEmulate(devices.Device{
|
||||||
AcceptLanguage: b.LanguageCode,
|
AcceptLanguage: b.LanguageCode,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user