P
P
Pavel2015-11-19 12:47:16
SSH
Pavel, 2015-11-19 12:47:16

Why doesn't the code for tunneling traffic through SSH work?

Wrote a little code:

const QString ssh_agent = "plink.exe";
    QWebView *window = new QWebView(this);
    QProcess *plink = new QProcess(window);
    QNetworkAccessManager *web_manager = new QNetworkAccessManager(window);
    plink->start(ssh_agent+" -ssh 1.1.1.1 -C -N -l root -pw 111 -D 127.0.0.1:62500");

    QNetworkProxy proxy;
    proxy.setHostName("127.0.0.1");
    proxy.setPort(62500);
    proxy.setCapabilities(QNetworkProxy::TunnelingCapability);
    proxy.setType(QNetworkProxy::Socks5Proxy);

    web_manager->setProxy(proxy);

    window->setGeometry(0,0,1280,960);
    window->load(QUrl("http://2ip.ru/"));
    window->page()->setNetworkAccessManager(web_manager);

But tunneling doesn't happen. SSH checked with the program, it seems to work.
Why it doesn't work I don't understand.
I noticed that there are settings for proxy abilities, you can set TunnelingCapability, so I think it will be possible to do this class without plink?
PS You can not take the tunnel, I wrote it from my head.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question