{"id":23415990,"url":"https://github.com/3th1nk/easyshell","last_synced_at":"2026-04-26T12:31:18.867Z","repository":{"id":154177323,"uuid":"631960936","full_name":"3th1nk/easyshell","owner":"3th1nk","description":"simple and efficient interactive shell","archived":false,"fork":false,"pushed_at":"2024-04-12T09:34:12.000Z","size":208,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-12T16:48:50.120Z","etag":null,"topics":["automation","cli","go","rpa","shell","ssh","telnet"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3th1nk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-04-24T12:28:39.000Z","updated_at":"2024-04-15T02:38:44.919Z","dependencies_parsed_at":"2023-11-21T10:27:57.969Z","dependency_job_id":"6f55d18b-db9b-4a3f-bfe2-619e15601fcb","html_url":"https://github.com/3th1nk/easyshell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/3th1nk/easyshell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3th1nk%2Feasyshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3th1nk%2Feasyshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3th1nk%2Feasyshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3th1nk%2Feasyshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3th1nk","download_url":"https://codeload.github.com/3th1nk/easyshell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3th1nk%2Feasyshell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32297893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","cli","go","rpa","shell","ssh","telnet"],"created_at":"2024-12-22T22:11:37.861Z","updated_at":"2026-04-26T12:31:18.853Z","avatar_url":"https://github.com/3th1nk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyShell\n* 支持本地执行命令(windows/linux)\n* 支持通过SSH/TELNET协议在主机、网络设备上远程执行交互式命令\n* 支持自定义提示符匹配规则，大多数情况下使用默认提示符规则即可，使用默认提示符规则时可开启自动纠正(基于默认规则首次匹配结果，默认关闭)\n* 支持自定义解码器，默认自动识别GB18030编码并转换成UTF8\n* 支持自定义字符过滤器，默认自动处理退格、CRLF自动转换为LF，并剔除CSI控制字符(部分情况未处理，如：ISO 8613-3和ISO 8613-6中24位前景色和背景色设置)\n* 支持自定义内容拦截器，内置拦截器包括密码交互(Password)、选项交互(Yes/No)、网络设备自动翻页(More)、网络设备继续执行(Continue)\n* 支持延迟返回输出内容，可指定超过一定时间 或 内容大小 后返回\n* 支持记录原始输出内容和回放，用于调试\n\n## 代码片段\n- 本地执行命令\n```\n    s := NewCmdShell(\"ping www.baidu.com\")\n    if err := s.ReadAll(time.Minute, func(lines []string) {\n        // handle lines\n    }); err != nil {\n        return err\n    }\n    \n    ...\n    \n    s2 := NewCmdShell(\"cmd /K\")\n    for _, cmd := range []string{\"c:\", \"dir\"} {\n        s2.Write(cmd)\n        if err := s2.ReadToEndLine(time.Minute, func(lines []string) {\n            // handle lines\n        }); err != nil {\n            return err\n        }\n    }\n```\n\n- 远程(SSH)执行命令\n```\n    cred := SshCredential{\n        Host:       \"192.168.1.2\",\n        Port:       22,\n        User:       \"zhangsan\",\n        Password:   \"123456\",\n        PrivateKey: \"\",\n        InsecureAlgorithms: true,\n        Timeout:    5,\n    }\n    s, err := NewSshShell(\u0026SshShellConfig{\n        Credential: \u0026cred,\n    })\n    if err != nil {\n        return\n    }\n    defer s.Close()\n    \n    for _, line := range s.HeadLine() {\n        fmt.Println(line)\n    }\n\t\n    // match 'password' prompt and enter the password automatically\n    s.Write(\"su root\")\n    if err := s.ReadToEndLine(time.Minute, func(lines []string) {\n        // handle lines\n    }, interceptor.Password(\"password:\", \"123456\", true)); err != nil {\n        return err\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3th1nk%2Feasyshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3th1nk%2Feasyshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3th1nk%2Feasyshell/lists"}