Giter Club home page Giter Club logo

Comments (7)

srd424 avatar srd424 commented on July 22, 2024

Yes, I'm using it in that mode.

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

microsocks/sockssrv.c

Lines 129 to 135 in c4b927b

case 3: /* dns name */
l = buf[4];
minlen = 4 + 2 + l + 1;
if(n < 4 + 2 + l + 1) return -EC_GENERAL_FAILURE;
memcpy(namebuf, buf+4+1, l);
namebuf[l] = 0;
break;

from microsocks.

hongyi-zhao avatar hongyi-zhao commented on July 22, 2024

I checked the corresponding code snippet, and it seems that it's the default and only supported work manner to resolve hostname with microsocks remotely. Is my understanding correct?

Regards,
HY

from microsocks.

srd424 avatar srd424 commented on July 22, 2024

It seems to work in both - looking at code, I guess the client tags the connect request with a type flag to say whether it's supply an IP address or a hostname.

from microsocks.

hongyi-zhao avatar hongyi-zhao commented on July 22, 2024

It seems to work in both - looking at code,

Can you tell me the specific code snippet? To be frank, I'm a newbie in C language.

I guess the client tags the connect request with a type flag to say whether it's supply an IP address or a hostname.

Do you mean that the working mechanism of microsocks is like the following?

This will trigger the local DNS resolution, i.e., by the DNS server set up on the computer where the curl command issues:

$ curl -4 -x socks5://microsocks-server:1080 URL

This will result in remote DNS resolution, that is, by the DNS server set up on the computer where microsocks resides:

$ curl -4 -x socks5h://microsocks-server:1080 URL

from microsocks.

rofl0r avatar rofl0r commented on July 22, 2024

try it out and use wireshark to see what's happening.

from microsocks.

hongyi-zhao avatar hongyi-zhao commented on July 22, 2024

Thank you very much for your suggestion. I confirmed the above conclusion with the following testings. For my case, the microsocks is runing on a remote machine with the FQDN pve.hyddns.xyz and listening on port 21080.

On the local machine runs the following:

werner@X10DAi:~$ curl -Iv -4 -x socks5h://pve.hyddns.xyz:21080 www.xpc.edu.cn

At the same time, on the remote computer running microsocks, issue the following command to check the progress of the dns query as noted here:

werner@M4600t:~$ sudo tshark -n  -f 'src port 53' -Y 'dns.qry.name contains "xpc.edu.cn"'
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp2s0'
    1 0.000000000  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xe697 A www.xpc.edu.cn A 10.8.10.4
    2 0.000027925  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x7d4f A www.xpc.edu.cn A 10.8.10.4
    3 0.004064578  10.8.10.244 → 192.168.1.100 DNS 102 Standard query response 0x04f4 AAAA www.xpc.edu.cn AAAA 240c:c0a8:2043:0:3c06:fea9::
    4 0.004093167  10.8.10.244 → 192.168.1.100 DNS 102 Standard query response 0x0b39 AAAA www.xpc.edu.cn AAAA 240c:c0a8:2043:0:3c06:fea9::
    5 0.004631451  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x4971 A www.xpc.edu.cn A 10.8.10.4
    6 0.006908930  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x70d1 A www.xpc.edu.cn A 10.8.10.4
    7 0.009648804  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x0e0e A www.xpc.edu.cn A 10.8.10.4
    8 0.012232869  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x03f6 A www.xpc.edu.cn A 10.8.10.4
    9 0.015005062  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xdb35 A www.xpc.edu.cn A 10.8.10.4
   10 0.017864612  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x035c A www.xpc.edu.cn A 10.8.10.4
   11 0.020866015  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x835f A www.xpc.edu.cn A 10.8.10.4
   12 0.023223518  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x5d75 A www.xpc.edu.cn A 10.8.10.4
   13 0.026063040  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x4e64 A www.xpc.edu.cn A 10.8.10.4
   14 0.029325483  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xad19 A www.xpc.edu.cn A 10.8.10.4
   15 0.032002892  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x4b24 A www.xpc.edu.cn A 10.8.10.4
   16 0.034743264  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x3107 A www.xpc.edu.cn A 10.8.10.4
   17 0.037462266  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xd3c0 A www.xpc.edu.cn A 10.8.10.4
   18 0.040122251  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x62f5 A www.xpc.edu.cn A 10.8.10.4
   19 0.043142885  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x9e45 A www.xpc.edu.cn A 10.8.10.4
   20 0.045292150  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x1204 A www.xpc.edu.cn A 10.8.10.4
   21 0.048582120  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xec09 A www.xpc.edu.cn A 10.8.10.4
   22 0.051130221  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x808b A www.xpc.edu.cn A 10.8.10.4
   23 0.054182229  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xc77f A www.xpc.edu.cn A 10.8.10.4
   24 0.056801180  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xe322 A www.xpc.edu.cn A 10.8.10.4
   25 0.060044573  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x22b5 A www.xpc.edu.cn A 10.8.10.4
   26 0.062758908  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x5a2e A www.xpc.edu.cn A 10.8.10.4
   27 0.065553641  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xd140 A www.xpc.edu.cn A 10.8.10.4
   28 0.068102505  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x1540 A www.xpc.edu.cn A 10.8.10.4
   29 0.070882644  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xc391 A www.xpc.edu.cn A 10.8.10.4
   30 0.073441378  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x5cff A www.xpc.edu.cn A 10.8.10.4
   31 0.077982558  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xfc4b A www.xpc.edu.cn A 10.8.10.4
   32 0.079565513  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x5e5c A www.xpc.edu.cn A 10.8.10.4
   33 0.081762394  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xf98a A www.xpc.edu.cn A 10.8.10.4
   34 0.084944696  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xa01a A www.xpc.edu.cn A 10.8.10.4
   35 0.087843132  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xc629 A www.xpc.edu.cn A 10.8.10.4
   36 0.090423306  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x6462 A www.xpc.edu.cn A 10.8.10.4
   37 0.093243495  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x46c7 A www.xpc.edu.cn A 10.8.10.4
   38 0.095705434  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x34fc A www.xpc.edu.cn A 10.8.10.4
   39 0.098526758  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x8b21 A www.xpc.edu.cn A 10.8.10.4
   40 0.101364186  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x9392 A www.xpc.edu.cn A 10.8.10.4
   41 0.103836608  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xb096 A www.xpc.edu.cn A 10.8.10.4
   42 0.106576904  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xabee A www.xpc.edu.cn A 10.8.10.4
   43 0.109804577  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x24ab A www.xpc.edu.cn A 10.8.10.4
   44 0.112679493  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x971a A www.xpc.edu.cn A 10.8.10.4
   45 0.115525409  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x2f6c A www.xpc.edu.cn A 10.8.10.4
   46 0.118266322  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0xd233 A www.xpc.edu.cn A 10.8.10.4
   47 0.120683031  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x507e A www.xpc.edu.cn A 10.8.10.4
   48 0.123660276  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x59e1 A www.xpc.edu.cn A 10.8.10.4
   49 0.126224437  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x0248 A www.xpc.edu.cn A 10.8.10.4
   50 0.128875924  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x5592 A www.xpc.edu.cn A 10.8.10.4
   51 5.000219565  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x8053 A www.xpc.edu.cn A 10.8.10.4
   52 5.000243913  10.8.10.244 → 192.168.1.100 DNS 90 Standard query response 0x24c4 A www.xpc.edu.cn A 10.8.10.4

from microsocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.