Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.6.8 #109

Merged
merged 35 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9146b99
update. README.md
blacknon Mar 14, 2022
3acb2f2
update. go-sshlib update
blacknon Jun 9, 2022
3a9a421
update. issue #98
blacknon Jul 25, 2022
56913c6
update. add lumaks command in lsftp
blacknon Aug 8, 2022
48e4404
update. add lsftp/ltree command...
blacknon Aug 11, 2022
5a60bd2
update. local tree command update.
blacknon Aug 12, 2022
8f06f0c
update. ltree create.
blacknon Aug 20, 2022
96d1779
update. lsftpの補完とかイロイロ修正
blacknon Aug 30, 2022
430adda
update. lsftpの補完とかイロイロ修正
blacknon Aug 30, 2022
f3accf0
update. lsftpの補完とかイロイロ修正
blacknon Aug 30, 2022
0edcfc3
update. ExpandRemotePathへ切り替え(lsftp/chgrp)
blacknon Aug 31, 2022
c99ed09
update. ExpandRemotePathへ切り替え(lsftp/chmod)
blacknon Aug 31, 2022
b138e66
update. ExpandRemotePathへ切り替え(lsftp/chown)
blacknon Aug 31, 2022
d805fcb
update. ExpandRemotePathへ切り替え(lsftp/get). 処理前.
blacknon Sep 1, 2022
ec3191a
update. get/putの処理でワイルドカード対応+bugfixの処理前
blacknon Sep 23, 2022
63d5f6f
update. とりあえずlsftpのgetのdebugはできたっぽい状態.
blacknon Sep 25, 2022
f5402a0
update. とりあえずlsftpのgetのdebugはできたっぽい状態. debug用のコメント削除
blacknon Sep 25, 2022
e2a3159
update. putでワイルドカードでのpushを行えるようにした.
blacknon Sep 26, 2022
5e2fb43
update.
blacknon Oct 30, 2022
7777b96
update.
blacknon Nov 7, 2022
fd3bd9c
comment update.
blacknon Jan 25, 2023
9251021
fixed single port forward remote setting
kuckjwi0928 Mar 13, 2023
aeefa71
Merge pull request #104 from kuckjwi0928/master
blacknon Jul 9, 2023
b1a9807
fixed ssh agent No AuthMethod error
kuckjwi0928 Dec 1, 2023
5c11c2e
Merge pull request #108 from kuckjwi0928/fix/ssh-agent-auth
blacknon Mar 4, 2024
0e6fa59
update. go-sshlib version 0.1.11
blacknon Apr 27, 2024
488e7be
Merge remote-tracking branch 'refs/remotes/origin/develop' into develop
blacknon Apr 27, 2024
3ee6c20
update. fix #74. -d option.
blacknon Apr 28, 2024
7493fbb
- lscp/lsftpにて、ファイル書き込み時に上書きの場合は0バイトファイルに置き換えしてから書き込みを開始させるように変更
blacknon Apr 29, 2024
01b320e
update
blacknon Apr 29, 2024
8004e35
update. #95.
blacknon Apr 30, 2024
aeee457
update. lscp update.
blacknon Apr 30, 2024
8488a7e
update. bugfix
blacknon Apr 30, 2024
c53a9fe
update.
blacknon May 3, 2024
2c24321
update README.md
blacknon May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 10 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# - https://github.com/motemen/lssh/blob/97d3745dcc8931a1d75217573d5ca60705be632f/.github/workflows/release.yml
# - https://github.com/greymd/teip/blob/master/.github/workflows/release.yml


name: Release Job.

on:
Expand Down Expand Up @@ -36,6 +35,10 @@ jobs:
goarch: amd64
os: macos-latest
ext: tar.gz
- goos: darwin
goarch: arm64
os: macos-latest
ext: tar.gz
- goos: windows
goarch: amd64
os: windows-latest
Expand All @@ -44,10 +47,10 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: Set up Go 1.17
- name: Set up Go 1.22
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.22

- name: Get version
id: package_version
Expand Down Expand Up @@ -198,6 +201,10 @@ jobs:
goarch: amd64
os: macos-latest
ext: tar.gz
- goos: darwin
goarch: arm64
os: macos-latest
ext: tar.gz
- goos: windows
goarch: amd64
os: windows-latest
Expand Down
28 changes: 20 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# Go コマンド
GOCMD=go
MODULE=GO111MODULE=on
GOBUILD=$(MODULE) $(GOCMD) build
GOBUILD=$(MODULE) $(GOCMD) build -ldflags -w
GOCLEAN=$(GOCMD) clean
GOTEST=$(MODULE) $(GOCMD) test -cover
GOGET=$(GOCMD) get
GOMOD=$(MODULE) $(GOCMD) mod
GOINSTALL=$(MODULE) $(GOCMD) install

# OS別にbuildのコマンド生成
UNAME_S=$(shell uname -s)
BUILDCMD_LSSH=$(GOBUILD) ./cmd/lssh
BUILDCMD_LSCP=$(GOBUILD) ./cmd/lscp
BUILDCMD_LSFTP=$(GOBUILD) ./cmd/lsftp

build:
# Remove unnecessary dependent libraries
$(GOMOD) tidy
# Place dependent libraries under vendor
$(GOMOD) vendor
# Build lssh
$(GOBUILD) ./cmd/lssh

# Build lsshgo
$(BUILDCMD_LSSH)
# Build lscp
$(GOBUILD) ./cmd/lscp
$(BUILDCMD_LSCP)
# Build lsftp
$(GOBUILD) ./cmd/lsftp
$(BUILDCMD_LSFTP)

clean:
$(GOCLEAN) ./...
Expand All @@ -27,12 +34,17 @@ clean:
rm -f lsftp

install:
# copy lssh binary to /usr/local/bin/
# rm old binary
rm /usr/local/bin/lssh
rm /usr/local/bin/lscp
rm /usr/local/bin/lsftp

# copy binary to /usr/local/bin/
cp lssh /usr/local/bin/
# copy lscp binary to /usr/local/bin/
cp lscp /usr/local/bin/
# copy lsftp binary to /usr/local/bin/
cp lsftp /usr/local/bin/

# copy template config file
cp -n example/config.tml ~/.lssh.conf || true

test:
Expand Down
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![TravisCI](https://travis-ci.org/blacknon/lssh.svg?branch=master)](https://travis-ci.org/blacknon/lssh)
[![Go Report Card](https://goreportcard.com/badge/github.com/blacknon/lssh)](https://goreportcard.com/report/github.com/blacknon/lssh)

lssh
Expand All @@ -20,14 +19,13 @@ Supported multiple ssh proxy, http/socks5 proxy, x11 forward, and port forwardin

## Features

* List selection type ssh client.
* List selection type Pure Go ssh client.
* It can run on **Linux**, **macOS** and **Windows**.
* Pure Go.
* Commands can be executed by ssh connection in **parallel**.
* There is a shell function that connects to multiple hosts in parallel for interactive operation and connects with local commands via pipes.
* Supported multiple proxy, **ssh**, **http**, and **socks5** proxy. It's supported multi-stage proxy.
* Supported **ssh-agent**.
* Supported **Local** and **Remote Port forward**, **Dynamic Forward**, **Reverse Dynamic Forward** and **x11 forward**.
* Supported **Local** and **Remote Port forward**, **Dynamic Forward(SOCKS5, http)**, **Reverse Dynamic Forward(SOCKS5)** and **x11 forward**.
* Can use bashrc of local machine at ssh connection destination.
* It supports various authentication methods. Password, Public key, Certificate and PKCS11(Yubikey etc.).
* Can read the OpenSSH config (~/.ssh/config) and use it as it is.
Expand Down Expand Up @@ -109,12 +107,14 @@ option(lssh)
--host servername, -H servername connect servername.
--file filepath, -F filepath config filepath. (default: "/Users/uesugi/.lssh.conf")
-L [bind_address:]port:remote_address:port Local port forward mode.Specify a [bind_address:]port:remote_address:port. Only single connection works.
-R [bind_address:]port:remote_address:port Remote port forward mode.Specify a [bind_address:]port:remote_address:port. Only single connection works.
-R [bind_address:]port:remote_address:port Remote port forward mode.Specify a [bind_address:]port:remote_address:port. If only one port is specified, it will operate as Reverse Dynamic Forward. Only single connection works.
-D port Dynamic port forward mode(Socks5). Specify a port. Only single connection works.
-d port HTTP Dynamic port forward mode. Specify a port. Only single connection works.
-w Displays the server header when in command execution mode.
-W Not displays the server header when in command execution mode.
--not-execute, -N not execute remote command and shell.
--x11, -X x11 forwarding(forward to ${DISPLAY}).
--X11, -X Enable x11 forwarding(forward to ${DISPLAY}).
-Y Enable trusted x11 forwarding(forward to ${DISPLAY}).
--term, -t run specified command at terminal.
--parallel, -p run command parallel node(tail -F etc...).
--localrc use local bashrc shell.
Expand All @@ -128,7 +128,7 @@ option(lssh)
blacknon(blacknon@orebibou.com)

VERSION:
0.6.7
0.6.8

USAGE:
# connect ssh
Expand All @@ -144,6 +144,7 @@ option(lssh)
lssh -s



### lscp

run command.
Expand All @@ -169,7 +170,7 @@ option(lscp)
blacknon(blacknon@orebibou.com)

VERSION:
0.6.7
0.6.8

USAGE:
# local to remote scp
Expand Down Expand Up @@ -204,11 +205,12 @@ option(lsftp)
blacknon(blacknon@orebibou.com)

VERSION:
0.6.7
0.6.8

USAGE:
# start lsftp shell
lsftp
# start lsftp shell
lsftp



If you specify a command as an argument, you can select multiple hosts. Select host <kbd>Tab</kbd>, select all displayed hosts <kbd>Ctrl</kbd> + <kbd>a</kbd>.
Expand Down
6 changes: 2 additions & 4 deletions cmd/lscp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main
import (
"fmt"
"os"
"os/user"
"sort"
"strings"

Expand All @@ -21,8 +20,7 @@ import (

func Lscp() (app *cli.App) {
// Default config file path
usr, _ := user.Current()
defConf := usr.HomeDir + "/.lssh.conf"
defConf := common.GetDefaultConfigPath()

// Set help templete
cli.AppHelpTemplate = `NAME:
Expand Down Expand Up @@ -60,7 +58,7 @@ USAGE:
app.Name = "lscp"
app.Usage = "TUI list select and parallel scp client command."
app.Copyright = "blacknon(blacknon@orebibou.com)"
app.Version = "0.6.7"
app.Version = "0.6.8"

// options
// TODO(blacknon): オプションの追加(0.7.0)
Expand Down
Empty file removed cmd/lsftp/.gitkeep
Empty file.
11 changes: 5 additions & 6 deletions cmd/lsftp/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ package main
import (
"fmt"
"os"
"os/user"
"sort"

"github.com/blacknon/lssh/common"
"github.com/blacknon/lssh/conf"
"github.com/blacknon/lssh/list"
"github.com/blacknon/lssh/sftp"
Expand All @@ -18,8 +18,7 @@ import (

func Lsftp() (app *cli.App) {
// Default config file path
usr, _ := user.Current()
defConf := usr.HomeDir + "/.lssh.conf"
defConf := common.GetDefaultConfigPath()

// Set help templete
cli.AppHelpTemplate = `NAME:
Expand All @@ -42,16 +41,16 @@ VERSION:
{{.Version}}
{{end}}
USAGE:
# start lsftp shell
{{.Name}}
# start lsftp shell
{{.Name}}
`
// Create app
app = cli.NewApp()
// app.UseShortOptionHandling = true
app.Name = "lsftp"
app.Usage = "TUI list select and parallel sftp client command."
app.Copyright = "blacknon(blacknon@orebibou.com)"
app.Version = "0.6.7"
app.Version = "0.6.8"

app.Flags = []cli.Flag{
cli.StringFlag{Name: "file,F", Value: defConf, Usage: "config file path"},
Expand Down
Empty file removed cmd/lssh/.gitkeep
Empty file.
28 changes: 19 additions & 9 deletions cmd/lssh/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.

// TODO: dynamic port forwarding風に http proxyを生やすオプションの追加

package main

import (
"fmt"
"os"
"os/user"
"regexp"
"sort"

Expand All @@ -23,8 +20,7 @@ import (

func Lssh() (app *cli.App) {
// Default config file path
usr, _ := user.Current()
defConf := usr.HomeDir + "/.lssh.conf"
defConf := common.GetDefaultConfigPath()

// Set help templete
cli.AppHelpTemplate = `NAME:
Expand Down Expand Up @@ -66,7 +62,7 @@ USAGE:
app.Name = "lssh"
app.Usage = "TUI list select and parallel ssh client command."
app.Copyright = "blacknon(blacknon@orebibou.com)"
app.Version = "0.6.7"
app.Version = "0.6.8"

// TODO(blacknon): オプションの追加
// -f ... バックグラウンドでの接続(X11接続やport forwardingをバックグラウンドで実行する場合など)。
Expand All @@ -86,14 +82,17 @@ USAGE:

// port forward option
cli.StringSliceFlag{Name: "L", Usage: "Local port forward mode.Specify a `[bind_address:]port:remote_address:port`. Only single connection works."},
cli.StringSliceFlag{Name: "R", Usage: "Remote port forward mode.Specify a `[bind_address:]port:remote_address:port`. Only single connection works."},
cli.StringSliceFlag{Name: "R", Usage: "Remote port forward mode.Specify a `[bind_address:]port:remote_address:port`. If only one port is specified, it will operate as Reverse Dynamic Forward. Only single connection works."},
cli.StringFlag{Name: "D", Usage: "Dynamic port forward mode(Socks5). Specify a `port`. Only single connection works."},
cli.StringFlag{Name: "d", Usage: "HTTP Dynamic port forward mode. Specify a `port`. Only single connection works."},
// cli.StringFlag{Name: "r", Usage: "HTTP Reverse Dynamic port forward mode. Specify a `port`. Only single connection works."},

// Other bool
cli.BoolFlag{Name: "w", Usage: "Displays the server header when in command execution mode."},
cli.BoolFlag{Name: "W", Usage: "Not displays the server header when in command execution mode."},
cli.BoolFlag{Name: "not-execute,N", Usage: "not execute remote command and shell."},
cli.BoolFlag{Name: "x11,X", Usage: "x11 forwarding(forward to ${DISPLAY})."},
cli.BoolFlag{Name: "X11,X", Usage: "Enable x11 forwarding(forward to ${DISPLAY})."},
cli.BoolFlag{Name: "Y", Usage: "Enable trusted x11 forwarding(forward to ${DISPLAY})."},
cli.BoolFlag{Name: "term,t", Usage: "run specified command at terminal."},
cli.BoolFlag{Name: "parallel,p", Usage: "run command parallel node(tail -F etc...)."},
cli.BoolFlag{Name: "localrc", Usage: "use local bashrc shell."},
Expand Down Expand Up @@ -180,7 +179,15 @@ USAGE:
r.IsParallel = c.Bool("parallel")

// x11 forwarding
r.X11 = c.Bool("x11")
enableX11 := c.Bool("X11")
enableTrustedX11 := c.Bool("Y")

if enableX11 || enableTrustedX11 {
r.X11 = true
}
if enableTrustedX11 {
r.X11Trusted = true
}

// is tty
r.IsTerm = c.Bool("term")
Expand Down Expand Up @@ -239,6 +246,9 @@ USAGE:
// Dynamic port forwarding port
r.DynamicPortForward = c.String("D")

// HTTP Dynamic port forwarding port
r.HTTPDynamicPortForward = c.String("d")

r.Start()
return nil
}
Expand Down
32 changes: 28 additions & 4 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func IsExist(filename string) bool {
return err == nil
}

//
func Contains(list interface{}, elem interface{}) bool {
listV := reflect.ValueOf(list)

Expand Down Expand Up @@ -335,9 +334,9 @@ func GetNameFromId(file string, id uint32) (name string, err error) {
// ParseForwardPort return forward address and port from string.
//
// ex.)
// - `localhost:8000:localhost:18000` => local: "localhost:8000", remote: "localhost:18000"
// - `8080:localhost:18080` => local: "localhost:8080", remote: "localhost:18080"
// - `localhost:2222:12222` => local: "localhost:2222", remote: "localhost:12222"
// - `localhost:8000:localhost:18000` => local: "localhost:8000", remote: "localhost:18000"
// - `8080:localhost:18080` => local: "localhost:8080", remote: "localhost:18080"
// - `localhost:2222:12222` => local: "localhost:2222", remote: "localhost:12222"
func ParseForwardPort(value string) (local, remote string, err error) {
// count column
count := strings.Count(value, ":")
Expand Down Expand Up @@ -488,3 +487,28 @@ func StringCompression(mode int, data []byte) (result []byte, err error) {

return
}

func GetDefaultConfigPath() (path string) {
// get XDG_CONFIG_HOME
xdgConfigHome := os.Getenv("XDG_CONFIG_HOME")

// get user
usr, _ := user.Current()

// get home dir
home := usr.HomeDir

// get config path
homeConfigPath := filepath.Join(home, ".lssh.conf")
xdgConfigPath := filepath.Join(xdgConfigHome, "lssh", "lssh.conf")

if _, err := os.Stat(homeConfigPath); os.IsExist(err) {
return homeConfigPath
}

if _, err := os.Stat(xdgConfigPath); os.IsExist(err) {
return xdgConfigPath
}

return homeConfigPath
}
Loading