V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
gatusokaka
V2EX  ›  Linux

折腾了几天 tsocks?

  •  
  •   gatusokaka · 2020-03-23 10:00:37 +08:00 · 4084 次点击
    这是一个创建于 1493 天前的主题,其中的信息可能已经有所发展或是发生改变。
    一直没通,下面是 tsocks_config,到底为什么没通?
    大家还有什么推荐的代理工具,还有就是这类工具是什么原理,感觉配置文件中也没看见配置代理服务器 IP 什么的?


    # Local networks
    # For this example this machine can directly access 192.168.0.0/255.255.255.0
    # (192.168.0.*) and 10.0.0.0/255.0.0.0 (10.*)

    local = 192.168.0.0/255.255.255.0
    local = 10.0.0.0/255.0.0.0

    # Paths
    # For this example this machine needs to access 150.0.0.0/255.255.0.0 as
    # well as port 80 on the network 150.1.0.0/255.255.0.0 through
    # the socks 5 server at 10.1.7.25 (if this machines hostname was
    # "socks.hello.com" we could also specify that, unless --disable-hostnames
    # was specified to ./configure).

    path {
    reaches = 150.0.0.0/255.255.0.0
    reaches = 150.1.0.0:80/255.255.0.0
    server = 10.1.7.25
    server_type = 5
    default_user = delius
    default_pass = hello
    }

    # Default server
    # For connections that aren't to the local subnets or to 150.0.0.0/255.255.0.0
    # the server at 192.168.0.1 should be used (again, hostnames could be used
    # too, see note above)

    server = 127.0.0.1
    # Server type defaults to 4 so we need to specify it as 5 for this one
    server_type = 5
    # The port defaults to 1080 but I've stated it here for clarity
    server_port = 1080
    16 条回复    2020-03-24 11:22:11 +08:00
    chuankoog
        1
    chuankoog  
       2020-03-23 10:52:11 +08:00
    sl0000
        2
    sl0000  
       2020-03-23 11:09:26 +08:00
    配置 apt 的 proxy?
    gatusokaka
        3
    gatusokaka  
    OP
       2020-03-23 12:40:38 +08:00 via iPhone
    @sl0000 对的
    felix021
        4
    felix021  
       2020-03-23 12:44:42 +08:00
    最后 5 行不就是 IP 和端口吗? RTFM
    sl0000
        5
    sl0000  
       2020-03-23 14:11:09 +08:00
    @gatusokaka 记得当时我用这个解决了 "Acquire::http::proxy "socks5h://server:port";"
    sarvatathagata
        6
    sarvatathagata  
       2020-03-23 15:21:45 +08:00
    原理是修改环境变量 LD_PRELOAD,使用自己的.so 覆盖掉系统自带的 connect 函数,所以不能用在 setuid 的程序等等情况下
    gatusokaka
        7
    gatusokaka  
    OP
       2020-03-23 15:25:53 +08:00
    @sl0000 你这种改法,还需要调用 tsocks 吗?
    sl0000
        8
    sl0000  
       2020-03-23 17:04:36 +08:00
    @gatusokaka 不需要, 用的 socks5
    imn1
        9
    imn1  
       2020-03-23 17:16:57 +08:00
    tsocks 印象中不能用在 apt,不过我试过一次不行就没再试(因为 tsocks 用在其他软件正常)
    我是用这种

    ------------
    sudo nano /etc/apt/apt.conf

    添加下列内容

    Acquire {
       http::proxy “http://user:pass@yourProxyAddress:port”
      }
    gatusokaka
        10
    gatusokaka  
    OP
       2020-03-23 17:33:56 +08:00 via iPhone
    @imn1 我路径下 /etc/apt/有一个 apt.conf.d 文件夹,apt.conf 需要在这个文件夹里创建吗?
    gatusokaka
        11
    gatusokaka  
    OP
       2020-03-23 17:34:11 +08:00 via iPhone
    @sl0000 好的,我试试
    imn1
        12
    imn1  
       2020-03-23 18:15:08 +08:00
    @gatusokaka #10
    不是,就在 apt 那层,我现在没开 linux 机器,看不了
    gatusokaka
        13
    gatusokaka  
    OP
       2020-03-23 18:45:55 +08:00 via iPhone
    @imn1 ok
    gatusokaka
        14
    gatusokaka  
    OP
       2020-03-23 21:16:10 +08:00 via iPhone
    @imn1 这个表达式的值哪些需要替换成真实值?
    gatusokaka
        15
    gatusokaka  
    OP
       2020-03-23 21:21:29 +08:00
    @sl0000 "Acquire::http::proxy "socks5h://server:port";"里面的 server 和 port 得用真实值替换吧?
    skies457
        16
    skies457  
       2020-03-24 11:22:11 +08:00 via iPhone
    proxychains4-ng 比较好用一点
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3355 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:34 · PVG 19:34 · LAX 04:34 · JFK 07:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.