溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Chisel是一款什么工具

發(fā)布時間:2021-12-24 17:12:44 來源:億速云 閱讀:223 作者:小新 欄目:網(wǎng)絡安全

這篇文章主要介紹Chisel是一款什么工具,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

關(guān)于Chisel

Chisel是一個快速穩(wěn)定的TCP/UDP隧道工具,該工具基于HTTP實現(xiàn)其功能,并通過SSH保證通信安全。Chisel是一個可執(zhí)行文件,其中包含了客戶端和服務器端,該工具基于Go(golang)語言開發(fā),因此具備較好的跨平臺特性。

Chisel主要可以用于繞過防火墻,但也可以用于向網(wǎng)絡中提供安全終端節(jié)點。

工具的運行機制如下圖所示:

Chisel是一款什么工具

功能介紹

易于使用;

高性能;

使用SSH協(xié)議對通信連接進行加密(通過crypto/SSH);

連接經(jīng)過身份驗證;

通過用戶配置文件進行身份驗證的客戶端;

通過用戶配置文件進行身份驗證的客戶端連接;

通過指紋匹配進行身份驗證的服務器連接;

客戶端使用指數(shù)回退自動重新連接;

客戶端可以通過一個TCP連接創(chuàng)建多個隧道端點;

客戶端可以選擇通過SOCKS或HTTP連接代理;

反向端口轉(zhuǎn)發(fā);

服務器反向代理;

服務器允許SOCKS5連接;

客戶端可以選擇允許從反向端口進行SOCKS5連接;

支持ssh-o ProxyCommand通過HTTP提供SSH加密;

工具安裝

源碼安裝

廣大研究人員可以點擊【https://github.com/jpillora/chisel/releases/latest】訪問該項目的Releases頁面下載并安裝該工具的最新版本,或運行下列命令:

curl https://i.jpillora.com/chisel! | bash

Docker安裝

docker run --rm -it jpillora/chisel --help

Fedora

該項目包目前由Fedora社區(qū)進行維護,如果你遇到了關(guān)于RPM使用的問題,可以使用這個問題跟蹤工具【https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&classification=Fedora&component=chisel&list_id=11614537&product=Fedora&product=Fedora%20EPEL】

sudo dnf -y install chisel

源安裝

$ go get -v github.com/jpillora/chisel

工具使用

$ chisel --help

 

  Usage: chisel [command] [--help]

 

  Version: X.Y.Z

 

  Commands:

    server - runs chisel in server mode

    client - runs chisel in client mode

 

  Read more:

https://github.com/jpillora/chisel
$ chisel server --help

 

  Usage: chisel server [options]

 

  Options:

 

    --host, Defines the HTTP listening host – the network interface

    (defaults the environment variable HOST and falls back to 0.0.0.0).

 

    --port, -p, Defines the HTTP listening port (defaults to the environment

    variable PORT and fallsback to port 8080).

 

    --key, An optional string to seed the generation of a ECDSA public

    and private key pair. All communications will be secured using this

    key pair. Share the subsequent fingerprint with clients to enable detection

    of man-in-the-middle attacks (defaults to the CHISEL_KEY environment

    variable, otherwise a new key is generate each run).

 

    --authfile, An optional path to a users.json file. This file should

    be an object with users defined like:

      {

        "<user:pass>": ["<addr-regex>","<addr-regex>"]

      }

    when <user> connects, their <pass> will be verified and then

    each of the remote addresses will be compared against the list

    of address regular expressions for a match. Addresses will

    always come in the form "<remote-host>:<remote-port>" for normal remotes

    and "R:<local-interface>:<local-port>" for reverse port forwarding

    remotes. This file will be automatically reloaded on change.

 

    --auth, An optional string representing a single user with full

    access, in the form of <user:pass>. It is equivalent to creating an

    authfile with {"<user:pass>": [""]}. If unset, it will use the

    environment variable AUTH.

 

    --keepalive, An optional keepalive interval. Since the underlying

    transport is HTTP, in many instances we'll be traversing through

    proxies, often these proxies will close idle connections. You must

    specify a time with a unit, for example '5s' or '2m'. Defaults

    to '25s' (set to 0s to disable).

 

    --backend, Specifies another HTTP server to proxy requests to when

    chisel receives a normal HTTP request. Useful for hiding chisel in

    plain sight.

 

    --socks5, Allow clients to access the internal SOCKS5 proxy. See

    chisel client --help for more information.

 

    --reverse, Allow clients to specify reverse port forwarding remotes

    in addition to normal remotes.

 

    --tls-key, Enables TLS and provides optional path to a PEM-encoded

    TLS private key. When this flag is set, you must also set --tls-cert,

    and you cannot set --tls-domain.

 

    --tls-cert, Enables TLS and provides optional path to a PEM-encoded

    TLS certificate. When this flag is set, you must also set --tls-key,

    and you cannot set --tls-domain.

 

    --tls-domain, Enables TLS and automatically acquires a TLS key and

    certificate using LetsEncypt. Setting --tls-domain requires port 443.

    You may specify multiple --tls-domain flags to serve multiple domains.

    The resulting files are cached in the "$HOME/.cache/chisel" directory.

    You can modify this path by setting the CHISEL_LE_CACHE variable,

    or disable caching by setting this variable to "-". You can optionally

    provide a certificate notification email by setting CHISEL_LE_EMAIL.

 

    --tls-ca, a path to a PEM encoded CA certificate bundle or a directory

    holding multiple PEM encode CA certificate bundle files, which is used to

    validate client connections. The provided CA certificates will be used

    instead of the system roots. This is commonly used to implement mutual-TLS.

 

    --pid Generate pid file in current working directory

 

    -v, Enable verbose logging

 

    --help, This help text

 

  Signals:

    The chisel process is listening for:

      a SIGUSR2 to print process stats, and

      a SIGHUP to short-circuit the client reconnect timer

 

  Version:

    X.Y.Z

 

  Read more:

    https://github.com/jpillora/chisel
$ chisel client --help

 

  Usage: chisel client [options] <server> <remote> [remote] [remote] ...

 

  <server> is the URL to the chisel server.

 

  <remote>s are remote connections tunneled through the server, each of

  which come in the form:

 

    <local-host>:<local-port>:<remote-host>:<remote-port>/<protocol>

 

    ■ local-host defaults to 0.0.0.0 (all interfaces).

    ■ local-port defaults to remote-port.

    ■ remote-port is required*.

    ■ remote-host defaults to 0.0.0.0 (server localhost).

    ■ protocol defaults to tcp.

 

  which shares <remote-host>:<remote-port> from the server to the client

  as <local-host>:<local-port>, or:

 

    R:<local-interface>:<local-port>:<remote-host>:<remote-port>/<protocol>

 

  which does reverse port forwarding, sharing <remote-host>:<remote-port>

  from the client to the server's <local-interface>:<local-port>.

 

    example remotes

 

      3000

      example.com:3000

      3000:google.com:80

      192.168.0.5:3000:google.com:80

      socks

      5000:socks

      R:2222:localhost:22

      R:socks

      R:5000:socks

      stdio:example.com:22

      1.1.1.1:53/udp

 

    When the chisel server has --socks5 enabled, remotes can

    specify "socks" in place of remote-host and remote-port.

    The default local host and port for a "socks" remote is

    127.0.0.1:1080. Connections to this remote will terminate

    at the server's internal SOCKS5 proxy.

 

    When the chisel server has --reverse enabled, remotes can

    be prefixed with R to denote that they are reversed. That

    is, the server will listen and accept connections, and they

    will be proxied through the client which specified the remote.

    Reverse remotes specifying "R:socks" will listen on the server's

    default socks port (1080) and terminate the connection at the

    client's internal SOCKS5 proxy.

 

    When stdio is used as local-host, the tunnel will connect standard

    input/output of this program with the remote. This is useful when

    combined with ssh ProxyCommand. You can use

      ssh -o ProxyCommand='chisel client chiselserver stdio:%h:%p' \

          user@example.com

    to connect to an SSH server through the tunnel.

 

  Options:

 

    --fingerprint, A *strongly recommended* fingerprint string

    to perform host-key validation against the server's public key.

Fingerprint mismatches will close the connection.

Fingerprints are generated by hashing the ECDSA public key using

SHA256 and encoding the result in base64.

Fingerprints must be 44 characters containing a trailing equals (=).

 

    --auth, An optional username and password (client authentication)

    in the form: "<user>:<pass>". These credentials are compared to

    the credentials inside the server's --authfile. defaults to the

    AUTH environment variable.

 

    --keepalive, An optional keepalive interval. Since the underlying

    transport is HTTP, in many instances we'll be traversing through

    proxies, often these proxies will close idle connections. You must

    specify a time with a unit, for example '5s' or '2m'. Defaults

    to '25s' (set to 0s to disable).

 

    --max-retry-count, Maximum number of times to retry before exiting.

    Defaults to unlimited.

 

    --max-retry-interval, Maximum wait time before retrying after a

    disconnection. Defaults to 5 minutes.

 

    --proxy, An optional HTTP CONNECT or SOCKS5 proxy which will be

    used to reach the chisel server. Authentication can be specified

    inside the URL.

    For example, http://admin:password@my-server.com:8081

            or: socks://admin:password@my-server.com:1080

 

    --header, Set a custom header in the form "HeaderName: HeaderContent".

    Can be used multiple times. (e.g --header "Foo: Bar" --header "Hello: World")

 

    --hostname, Optionally set the 'Host' header (defaults to the host

    found in the server url).

 

    --tls-ca, An optional root certificate bundle used to verify the

    chisel server. Only valid when connecting to the server with

    "https" or "wss". By default, the operating system CAs will be used.

 

    --tls-skip-verify, Skip server TLS certificate verification of

    chain and host name (if TLS is used for transport connections to

    server). If set, client accepts any TLS certificate presented by

    the server and any host name in that certificate. This only affects

    transport https (wss) connection. Chisel server's public key

    may be still verified (see --fingerprint) after inner connection

    is established.

 

    --tls-key, a path to a PEM encoded private key used for client

    authentication (mutual-TLS).

 

    --tls-cert, a path to a PEM encoded certificate matching the provided

    private key. The certificate must have client authentication

    enabled (mutual-TLS).

 

    --pid Generate pid file in current working directory

 

    -v, Enable verbose logging

 

    --help, This help text

 

  Signals:

    The chisel process is listening for:

      a SIGUSR2 to print process stats, and

      a SIGHUP to short-circuit the client reconnect timer

 

  Version:

    X.Y.Z

 

  Read more:

https://github.com/jpillora/chisel

工具使用Demo

我們提供了一個Demo應用程序(https://chisel-demo.herokuapp.com/),它會運行這個chisel server:

$ chisel server --port $PORT --proxy http://example.com

# listens on $PORT, proxy web requests to http://example.com

這個Demo應用程序還會運行一個簡單的文件服務器(端口為:3000),由于Heroku防火墻的存在,我們是無法直接訪問它的。但是,我們可以通過隧道來實現(xiàn)訪問:

$ chisel client https://chisel-demo.herokuapp.com 3000

# connects to chisel server at https://chisel-demo.herokuapp.com,

# tunnels your localhost:3000 to the server's localhost:3000

接下來,打開瀏覽器并訪問localhost:3000,此時我們將看到服務器的文件目錄。

安全性

通信連接始終啟用了加密。當你啟動Chisel服務器時,它將會在內(nèi)存中生成一個ECDSA公鑰/私鑰對。其中的公鑰指紋(Base64編碼的SHA256)將在服務器啟動時顯示。服務器可以選擇使用--key選項指定密鑰種子,而不是生成隨機密鑰,該選項將用于為密鑰生成種子。當客戶端連接時,它們還將顯示服務器的公鑰指紋??蛻舳丝梢允褂?-fingerprint選項指定特定的指紋。

身份驗證

使用--authfile選項,服務器可以選擇提供用戶.json配置文件以創(chuàng)建接受的用戶訪問列表。然后,客戶端使用--auth選項進行身份驗證。我們可以查看users.json以獲取認證配置文件樣例。使用--help查看更多幫助信息。

在內(nèi)部,這是使用SSH提供的密碼驗證方法實現(xiàn)的。點擊【http://blog.gopheracademy.com/go-and-ssh/?】了解更多關(guān)于SSH加密的信息。

Socks5指引

1、開啟你的Chisel服務器:

docker run \

  --name chisel -p 9312:9312 \

  -d --restart always \

  jpillora/chisel server -p 9312 --socks5 --key supersecret

2、連接你的Chisel客戶端(使用服務器的指紋信息):

chisel client --fingerprint 'rHb55mcxf6vSckL2AezFV09rLs7pfPpavVu++MF7AhQ=' <server-address>:9312 socks

3、指向你的Socks5客戶端:

<client-address>:1080

4、現(xiàn)在你的通信將被加密,并通過HTTP實現(xiàn)已認證的Socks5連接。

以上是“Chisel是一款什么工具”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI