Why is axios not finding onion addresses while using SocksProxyAgent?

98 Views Asked by At

I'm currently trying to crawl a .onion website, but axios refuses to find .onion sites. Error: getaddrinfo ENOTFOUND onionamev33r7w4zckyttobq3vrt725iuyr6xessihxifhxrhupixqad.onion

In my Server.js file:

const axios = require('axios');
const SocksProxyAgent = require('socks-proxy-agent');

const targetUrl = 'http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion';
const proxyUrl = 'socks5://127.0.0.1:9051'; // Tor proxy address

const agent = new SocksProxyAgent(proxyUrl);

axios.get(targetUrl, { httpsAgent: agent })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });

typing to cmd: netstat -ano | find "127.0.0.1:9051" shows that the tor services are listening on the specified port

I made sure that axios is actually using the SocksProxyAgent:

httpsAgent: SocksProxyAgent {
      _events: [Object: null prototype] {},
      _eventsCount: 0,
      _maxListeners: undefined,
      callback: [Function: connect],
      secureEndpoint: false,
      proxy: [Object],
      [Symbol(kCapture)]: false
    },
    method: 'get',
    url: 'http://onionamev33r7w4zckyttobq3vrt725iuyr6xessihxifhxrhupixqad.onion'

Also tried different addresses, other packages like "socks" and ofc checked the "torrc" file:

ControlPort 9051

what do i have to do that axios finds the .onion page?

0

There are 0 best solutions below