{"id":15292057,"url":"https://github.com/pythonzm/sshpro","last_synced_at":"2025-09-02T11:41:01.753Z","repository":{"id":96962632,"uuid":"214366390","full_name":"pythonzm/sshpro","owner":"pythonzm","description":"批量管理工具，阉割版ansible，支持批量执行命令以及批量复制文件和文件夹","archived":false,"fork":false,"pushed_at":"2020-08-10T10:59:23.000Z","size":21,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-13T04:40:35.403Z","etag":null,"topics":["ansible","ssh"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythonzm.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,"publiccode":null,"codemeta":null}},"created_at":"2019-10-11T07:00:56.000Z","updated_at":"2024-08-01T13:27:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8782833-619c-473d-935a-fa5ce2e1151f","html_url":"https://github.com/pythonzm/sshpro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pythonzm/sshpro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2Fsshpro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2Fsshpro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2Fsshpro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2Fsshpro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonzm","download_url":"https://codeload.github.com/pythonzm/sshpro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2Fsshpro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273279546,"owners_count":25077317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ansible","ssh"],"created_at":"2024-09-30T16:16:20.849Z","updated_at":"2025-09-02T11:41:01.708Z","avatar_url":"https://github.com/pythonzm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sshpro\n批量管理工具，阉割版ansible，支持批量执行命令以及批量复制文件和文件夹\n\n主机与被管理机器无需安装任何依赖，也不用配置互信，直接使用即可\n\n## 使用\n1. git clone https://github.com/pythonzm/sshpro.git\n2. 生成可执行文件\n\n```bash\ncd sshpro\ngo mod init\ngo build\nln -sv $PWD/sshpro /bin/sshpro  # 将可执行文件链接到/bin目录下，可选\n```\n\n3. （可选，如果需要使用配置文件则需要配置）将配置文件模板复制到$HOME下 `cp .sshpro.yaml $HOME`，然后根据自己的情况修改模板\n\n### 查看使用帮助\n\n```shell\n[root@test sshpro]# sshpro -h\nansible的阉割版。。。\n\nUsage:\n  sshpro [flags]\n  sshpro [command]\n\nAvailable Commands:\n  copy        传输本地文件到远程主机\n  help        Help about any command\n\nFlags:\n  -c, --command string      执行命令\n      --config string       指定配置文件 (default is $HOME/.sshpro.yaml)\n      --go-num int          并发数 (default 5)\n  -g, --group string        根据配置文件指定某个组执行命令,多个组用','隔开\n  -h, --help                help for sshpro\n      --host-net string     主机段，例如：192.168.1.0/24\n      --host-range string   主机范围，例如：10.1.1.1-10.1.1.254\n      --hosts string        远程主机IP, 可以是一个或多个，多个用主机用','隔开\n  -k, --key string          主机密钥位置，使用绝对路径\n  -P, --password string     远程用户密码\n  -p, --port string         远程端口 (default \"22\")\n  -u, --username string     远程使用用户 (default \"root\")\n      --version             version for sshpro\n\nUse \"sshpro [command] --help\" for more information about a command.\n```\n\n## 部分使用案例\n\n### 批量执行命令（不使用配置文件）\n```shell\n[root@test sshpro]# sshpro --hosts 10.1.7.239,10.1.7.240 -u root -P 123456 -c uptime\n10.1.7.239 | SUCCESS =\u003e \n 15:49:08 up 3 days,  5:52,  3 users,  load average: 0.00, 0.01, 0.05\n\n10.1.7.240 | FAILED =\u003e dial tcp 10.1.7.240:22: i/o timeout\n```\n\n### 批量执行命令（使用配置文件，需要使用-g参数）\n```shell\n[root@test sshpro]# sshpro -g centos -c uptime    # centos组内主机全部执行uptime命令\n10.1.7.239 | SUCCESS =\u003e \n 15:52:23 up 3 days,  5:56,  3 users,  load average: 0.00, 0.01, 0.05\n\n10.1.7.198 | SUCCESS =\u003e \n 15:52:22 up 93 days,  3:49,  4 users,  load average: 0.05, 0.03, 0.00\n\n10.1.7.199 | UNREACHABLE =\u003e dial tcp 10.1.7.199:22: connect: no route to host\n```\n\n### 批量复制文件（传递文件夹需要-r参数，不使用配置文件）\n```\n[root@test sshpro]# sshpro copy --hosts 10.1.7.239,10.1.7.238 -u root -P 123456 -s /tmp/aa/a.log -d /tmp/\n10.1.7.239 | SUCCESS =\u003e \n/tmp/aa/a.log 传输完成\n\n10.1.7.238 | UNREACHABLE =\u003e dial tcp 10.1.7.238:22: connect: no route to host\n```\n\n### 批量复制文件（传递文件夹需要-r参数，使用配置文件）\n```shell\n[root@test sshpro]# sshpro copy -g centos -s /tmp/aa/a.log -d /tmp/                                                 \n10.1.7.198 | SUCCESS =\u003e \n/tmp/aa/a.log 传输完成\n\n10.1.7.239 | SUCCESS =\u003e \n/tmp/aa/a.log 传输完成\n\n10.1.7.199 | UNREACHABLE =\u003e dial tcp 10.1.7.199:22: connect: no route to host\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonzm%2Fsshpro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonzm%2Fsshpro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonzm%2Fsshpro/lists"}