codemanki / cloudscraper

--DEPRECATED -- 🛑 🛑 Node.js library to bypass cloudflare's anti-ddos page
MIT License
599 stars 139 forks source link

Error: 140325664393088:error:14215076:SSL routines:tls12_copy_sigalgs:no suitable signature algorithm #303

Closed lbenicio closed 4 years ago

lbenicio commented 4 years ago
process {
  version: 'v13.4.0',
  versions: {
    node: '13.4.0',
    v8: '7.9.317.25-node.23',
    uv: '1.34.0',
    zlib: '1.2.11',
    brotli: '1.0.7',
    ares: '1.15.0',
    modules: '79',
    nghttp2: '1.40.0',
    napi: '5',
    llhttp: '2.0.1',
    openssl: '1.1.1d',
    cldr: '36.0',
    icu: '65.1',
    tz: '2019c',
    unicode: '12.1'
  },
  arch: 'x64',
  platform: 'linux',
  release: {
    name: 'node',
    sourceUrl: 'https://nodejs.org/download/release/v13.4.0/node-v13.4.0.tar.gz',
    headersUrl: 'https://nodejs.org/download/release/v13.4.0/node-v13.4.0-headers.tar.gz'
  },
  _rawDebug: [Function: _rawDebug],
  moduleLoadList: [
    'Internal Binding native_module',
    'Internal Binding errors',
    'Internal Binding buffer',
    'NativeModule internal/errors',
    'Internal Binding config',
    'Internal Binding constants',
    'Internal Binding util',
    'Internal Binding types',
    'NativeModule internal/util',
    'NativeModule internal/util/types',
    'NativeModule internal/assert',
    'NativeModule internal/util/inspect',
    'NativeModule events',
    'Internal Binding string_decoder',
    'NativeModule internal/validators',
    'NativeModule internal/buffer',
    'Internal Binding icu',
    'NativeModule buffer',
    'NativeModule internal/process/per_thread',
    'NativeModule internal/process/main_thread_only',
    'Internal Binding process_methods',
    'Internal Binding credentials',
    'NativeModule internal/process/stdio',
    'Internal Binding async_wrap',
    'Internal Binding task_queue',
    'NativeModule internal/async_hooks',
    'NativeModule internal/process/promises',
    'NativeModule internal/fixed_queue',
    'NativeModule internal/process/task_queues',
    'Internal Binding trace_events',
    'NativeModule internal/console/constructor',
    'NativeModule internal/console/global',
    'NativeModule internal/util/inspector',
    'Internal Binding inspector',
    'NativeModule internal/querystring',
    'NativeModule internal/constants',
    'NativeModule path',
    'Internal Binding url',
    'NativeModule internal/url',
    'NativeModule internal/encoding',
    'Internal Binding timers',
    'NativeModule internal/linkedlist',
    'NativeModule internal/priority_queue',
    'NativeModule internal/util/debuglog',
    'NativeModule internal/timers',
    'NativeModule timers',
    'NativeModule internal/process/execution',
    'NativeModule internal/process/warning',
    'Internal Binding options',
    'NativeModule internal/options',
    'NativeModule internal/bootstrap/pre_execution',
    'NativeModule internal/idna',
    'NativeModule url',
    'NativeModule internal/modules/cjs/helpers',
    'NativeModule internal/inspector_async_hook',
    'Internal Binding fs',
    'NativeModule internal/fs/utils',
    'Internal Binding fs_dir',
    'NativeModule internal/fs/dir',
    'NativeModule fs',
    'NativeModule internal/source_map/source_map_cache',
    'Internal Binding contextify',
    'NativeModule vm',
    'Internal Binding module_wrap',
    'NativeModule internal/modules/esm/module_job',
    'NativeModule internal/modules/esm/module_map',
    'NativeModule internal/modules/esm/default_resolve',
    'NativeModule internal/modules/esm/create_dynamic_module',
    'NativeModule internal/modules/esm/translators',
    'NativeModule internal/modules/esm/loader',
    'NativeModule internal/vm/module',
    'NativeModule internal/process/esm_loader',
    'NativeModule internal/modules/cjs/loader',
    'NativeModule internal/modules/run_main',
    'NativeModule internal/streams/pipeline',
    'NativeModule internal/streams/end-of-stream',
    'NativeModule internal/streams/legacy',
    'NativeModule internal/streams/buffer_list',
    'NativeModule internal/streams/destroy',
    'NativeModule internal/streams/state',
    'NativeModule _stream_readable',
    'NativeModule _stream_writable',
    'NativeModule _stream_duplex',
    'NativeModule _stream_transform',
    'NativeModule _stream_passthrough',
    'NativeModule stream',
    'NativeModule internal/net',
    'Internal Binding uv',
    'Internal Binding stream_wrap',
    'Internal Binding tcp_wrap',
    'Internal Binding pipe_wrap',
    'NativeModule internal/stream_base_commons',
    'NativeModule internal/dtrace',
    'NativeModule net',
    'Internal Binding tty_wrap',
    'NativeModule internal/tty',
    'NativeModule tty',
    'Internal Binding signal_wrap'
  ],
  binding: [Function: binding],
  _linkedBinding: [Function: _linkedBinding],
  _events: [Object: null prototype] {
    warning: [Function: onWarning],
    newListener: [Function: startListeningIfSignal],
    removeListener: [Function: stopListeningIfSignal],
    SIGWINCH: [Function (anonymous)]
  },
  _eventsCount: 4,
  _maxListeners: undefined,
  domain: null,
  _exiting: false,
  config: {
    target_defaults: {
      cflags: [],
      default_configuration: 'Release',
      defines: [],
      include_dirs: [],
      libraries: []
    },
    variables: {
      asan: 0,
      build_v8_with_gn: false,
      coverage: false,
      debug_nghttp2: false,
      enable_lto: false,
      enable_pgo_generate: false,
      enable_pgo_use: false,
      force_dynamic_crt: 0,
      gas_version: '2.27',
      host_arch: 'x64',
      icu_data_in: '../../deps/icu-tmp/icudt65l.dat',
      icu_endianness: 'l',
      icu_gyp_path: 'tools/icu/icu-generic.gyp',
      icu_path: 'deps/icu-small',
      icu_small: false,
      icu_ver_major: '65',
      is_debug: 0,
      llvm_version: '0.0',
      napi_build_version: '5',
      node_byteorder: 'little',
      node_debug_lib: false,
      node_enable_d8: false,
      node_install_npm: true,
      node_module_version: 79,
      node_no_browser_globals: false,
      node_prefix: '/',
      node_release_urlbase: 'https://nodejs.org/download/release/',
      node_report: true,
      node_shared: false,
      node_shared_cares: false,
      node_shared_http_parser: false,
      node_shared_libuv: false,
      node_shared_nghttp2: false,
      node_shared_openssl: false,
      node_shared_zlib: false,
      node_tag: '',
      node_target_type: 'executable',
      node_use_bundled_v8: true,
      node_use_dtrace: false,
      node_use_etw: false,
      node_use_large_pages: false,
      node_use_large_pages_script_lld: false,
      node_use_node_code_cache: true,
      node_use_node_snapshot: true,
      node_use_openssl: true,
      node_use_v8_platform: true,
      node_with_ltcg: false,
      node_without_node_options: false,
      openssl_fips: '',
      openssl_is_fips: false,
      shlib_suffix: 'so.79',
      target_arch: 'x64',
      v8_enable_31bit_smis_on_64bit_arch: 0,
      v8_enable_gdbjit: 0,
      v8_enable_i18n_support: 1,
      v8_enable_inspector: 1,
      v8_enable_pointer_compression: 0,
      v8_no_strict_aliasing: 1,
      v8_optimized_debug: 1,
      v8_promise_internal_field_count: 1,
      v8_random_seed: 0,
      v8_trace_maps: 0,
      v8_use_siphash: 1,
      want_separate_host_toolset: 0
    }
  },
  abort: [Function: abort],
  umask: [Function: umask],
  chdir: [Function: chdir],
  cwd: [Function: cwd],
  _debugProcess: [Function: _debugProcess],
  _debugEnd: [Function: _debugEnd],
  _startProfilerIdleNotifier: [Function: _startProfilerIdleNotifier],
  _stopProfilerIdleNotifier: [Function: _stopProfilerIdleNotifier],
  dlopen: [Function: dlopen],
  uptime: [Function: uptime],
  _getActiveRequests: [Function: _getActiveRequests],
  _getActiveHandles: [Function: _getActiveHandles],
  reallyExit: [Function: reallyExit],
  _kill: [Function: _kill],
  hrtime: [Function: hrtime] { bigint: [Function: hrtimeBigInt] },
  cpuUsage: [Function: cpuUsage],
  resourceUsage: [Function: resourceUsage],
  memoryUsage: [Function: memoryUsage],
  kill: [Function: kill],
  exit: [Function: exit],
  getuid: [Function: getuid],
  geteuid: [Function: geteuid],
  getgid: [Function: getgid],
  getegid: [Function: getegid],
  getgroups: [Function: getgroups],
  initgroups: [Function: initgroups],
  setgroups: [Function: setgroups],
  setegid: [Function (anonymous)],
  seteuid: [Function (anonymous)],
  setgid: [Function (anonymous)],
  setuid: [Function (anonymous)],
  stdout: [Getter],
  stderr: [Getter],
  stdin: [Getter],
  openStdin: [Function (anonymous)],
  allowedNodeEnvironmentFlags: [Getter/Setter],
  assert: [Function: deprecated],
  features: {
    inspector: true,
    debug: false,
    uv: true,
    ipv6: true,
    tls_alpn: true,
    tls_sni: true,
    tls_ocsp: true,
    tls: true,
    cached_builtins: true
  },
  _fatalException: [Function (anonymous)],
  setUncaughtExceptionCaptureCallback: [Function: setUncaughtExceptionCaptureCallback],
  hasUncaughtExceptionCaptureCallback: [Function: hasUncaughtExceptionCaptureCallback],
  emitWarning: [Function: emitWarning],
  nextTick: [Function: nextTick],
  _tickCallback: [Function: runNextTicks],
  env: {
    LC_TERMINAL_VERSION: '3.3.8beta3',
    LC_TERMINAL: 'iTerm2',
    USER: 'root',
    LOGNAME: 'root',
    HOME: '/root',
    PATH: '/root/.nvm/versions/node/v13.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games',
    MAIL: '/var/mail/root',
    SHELL: '/bin/zsh',
    SSH_CLIENT: '187.74.126.231 56916 22',
    SSH_CONNECTION: '187.74.126.231 56916 51.68.124.109 22',
    SSH_TTY: '/dev/pts/0',
    TERM: 'xterm-256color',
    XDG_SESSION_ID: '370',
    XDG_RUNTIME_DIR: '/run/user/0',
    LANG: 'en_US.UTF-8',
    SHLVL: '1',
    PWD: '/root',
    OLDPWD: '/root',
    ZSH: '/root/.oh-my-zsh',
    PAGER: 'less',
    LESS: '-R',
    LSCOLORS: 'Gxfxcxdxbxegedabagacad',
    LS_COLORS: 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:',
    NVM_DIR: '/root/.nvm',
    NVM_CD_FLAGS: '-q',
    NVM_BIN: '/root/.nvm/versions/node/v13.4.0/bin',
    LC_ALL: 'en_US.UTF-8',
    LC_CTYPE: 'UTF-8',
    _: '/root/.nvm/versions/node/v13.4.0/bin/node'
  },
  title: 'node',
  argv: [ '/root/.nvm/versions/node/v13.4.0/bin/node' ],
  execArgv: [ '-p', 'process' ],
  pid: 13669,
  ppid: 1056,
  execPath: '/root/.nvm/versions/node/v13.4.0/bin/node',
  debugPort: 9229,
  argv0: 'node',
  _eval: 'process',
  _print_eval: true,
  _preload_modules: [],
  [Symbol(kCapture)]: false
}

Please share a minimal working code snippet that reproduces the problem.

Code snippet ```js const cloudscraper = require('cloudscraper'); cloudscraper.defaultParams.agentOptions.ciphers += ':@SECLEVEL=5:@STRENGTH'; cloudscraper.defaultParams.agentOptions.sigalgs = 'ECDSA+SHA256'; const headers = Object.assign({}, cloudscraper.defaultParams.headers); const jar = cloudscraper.defaultParams.jar; cloudscraper.debug = true; const uri = 'https://secure.tibia.com'; // Visiting the page to simulate real user behavior and to get cookies cloudscraper.get({ uri, headers }).then(body => { // Log the cookies, should have `x-token` now console.log(jar); let token; jar.getCookies(uri).forEach(cookie => { if (cookie.key.startsWith('x-token')) { token = cookie.value; } }) if (!token) throw new Error('Failed to get token'); // Updating the headers to reflect the previous request Object.assign(headers, { 'Referer': uri, // This request is normally made via XHR, let's blend in. 'X-Requested-With': 'XMLHttpRequest' }); // The server sends the JSON with HTTP status 302 so disable automatic redirects // The request is not simple since it can end with a non-2xx response const options = { uri, headers, followRedirect: true, followAllRedirects: true, simple: false, followOriginalHttpMethod: true }; return cloudscraper.get(options) .then(body => { console.log(body) }).catch(console.error); }).catch(console.error); ```
program output ```js REQUEST { requester: [Function: request] { get: [Function (anonymous)], head: [Function (anonymous)], options: [Function (anonymous)], post: [Function (anonymous)], put: [Function (anonymous)], patch: [Function (anonymous)], del: [Function (anonymous)], delete: [Function (anonymous)], jar: [Function (anonymous)], cookie: [Function (anonymous)], defaults: [Function (anonymous)], forever: [Function (anonymous)], Request: [Function: Request] { debug: true, defaultProxyHeaderWhiteList: [Array], defaultProxyHeaderExclusiveList: [Array] }, initParams: [Function: initParams], debug: [Getter/Setter], bindCLS: [Function: RP$bindCLS] }, jar: RequestJar { _jar: CookieJar { enableLooseMode: true, store: { idx: {} } } }, headers: { Host: Symbol(host), Connection: 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36', Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, br' }, cloudflareMaxTimeout: 30000, followAllRedirects: true, challengesToSolve: 3, decodeEmails: false, gzip: true, agentOptions: { ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA:!ECDHE+SHA:!AES128-SHA:@SECLEVEL=5:@STRENGTH', sigalgs: 'ECDSA+SHA256' }, uri: 'https://secure.tibia.com', method: 'GET', realEncoding: 'utf8', encoding: null, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false } REQUEST make request https://secure.tibia.com/ RequestError: Error: 139724139898752:error:14215076:SSL routines:tls12_copy_sigalgs:no suitable signature algorithm:../deps/openssl/openssl/ssl/t1_lib.c:1689: 139724139898752:error:141DD044:SSL routines:tls_construct_ctos_sig_algs:internal error:../deps/openssl/openssl/ssl/statem/extensions_clnt.c:284: at onRequestResponse (/root/node_modules/cloudscraper/index.js:165:21) at Request. (/root/node_modules/cloudscraper/index.js:144:7) at Object.onceWrapper (events.js:411:26) at Request.emit (events.js:304:20) at Request.onRequestError (/root/node_modules/request/request.js:881:8) at ClientRequest.emit (events.js:304:20) at TLSSocket.socketErrorListener (_http_client.js:421:9) at TLSSocket.emit (events.js:304:20) at emitErrorNT (internal/streams/destroy.js:84:8) at processTicksAndRejections (internal/process/task_queues.js:84:21) { name: 'RequestError', message: 'Error: 139724139898752:error:14215076:SSL routines:tls12_copy_sigalgs:no suitable signature algorithm:../deps/openssl/openssl/ssl/t1_lib.c:1689:\n' + '139724139898752:error:141DD044:SSL routines:tls_construct_ctos_sig_algs:internal error:../deps/openssl/openssl/ssl/statem/extensions_clnt.c:284:\n' } ```
codemanki commented 4 years ago

Frankly speaking I'm not sure that I can help with this as you are using custom ciphers. Nevertheless leaving this PR open so someone else might find a solution

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.