Skip to content

Commit 0170b38

Browse files
committed
feat: support sshpass basic functions
0 parents  commit 0170b38

File tree

8 files changed

+1021
-0
lines changed

8 files changed

+1021
-0
lines changed

.clang-format

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: true
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: true
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Empty
15+
AllowShortIfStatementsOnASingleLine: true
16+
AllowShortLoopsOnASingleLine: true
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: true
19+
AlwaysBreakTemplateDeclarations: true
20+
BinPackArguments: true
21+
BinPackParameters: true
22+
BreakBeforeBinaryOperators: None
23+
BreakBeforeBraces: Attach
24+
BreakBeforeTernaryOperators: true
25+
BreakConstructorInitializersBeforeComma: false
26+
ColumnLimit: 100
27+
CommentPragmas: '^ IWYU pragma:'
28+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
29+
ConstructorInitializerIndentWidth: 8
30+
ContinuationIndentWidth: 8
31+
Cpp11BracedListStyle: true
32+
DerivePointerAlignment: false
33+
PointerAlignment: Left
34+
DisableFormat: false
35+
ExperimentalAutoDetectBinPacking: false
36+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
37+
IndentCaseLabels: false
38+
IndentWidth: 4
39+
IndentWrappedFunctionNames: false
40+
KeepEmptyLinesAtTheStartOfBlocks: true
41+
MacroBlockBegin: ''
42+
MacroBlockEnd: ''
43+
MaxEmptyLinesToKeep: 1
44+
NamespaceIndentation: None
45+
ObjCBlockIndentWidth: 2
46+
ObjCSpaceAfterProperty: false
47+
ObjCSpaceBeforeProtocolList: false
48+
PenaltyBreakBeforeFirstCallParameter: 1
49+
PenaltyBreakComment: 300
50+
PenaltyBreakFirstLessLess: 120
51+
PenaltyBreakString: 1000
52+
PenaltyExcessCharacter: 1000000
53+
PenaltyReturnTypeOnItsOwnLine: 200
54+
PointerAlignment: Left
55+
SpaceAfterCStyleCast: true
56+
SpaceBeforeAssignmentOperators: true
57+
SpaceBeforeParens: ControlStatements
58+
SpaceInEmptyParentheses: false
59+
SpacesBeforeTrailingComments: 2
60+
SpacesInAngles: false
61+
SpacesInContainerLiterals: true
62+
SpacesInCStyleCastParentheses: false
63+
SpacesInParentheses: false
64+
SpacesInSquareBrackets: false
65+
Standard: Auto
66+
TabWidth: 8
67+
UseTab: Never
68+
...

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build
2+
on: [ push, pull_request ]
3+
jobs:
4+
build:
5+
runs-on: windows-latest
6+
7+
steps:
8+
- name: setenv
9+
run: echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV
10+
11+
- uses: actions/checkout@v3
12+
13+
- uses: jwlawson/[email protected]
14+
15+
- name: configure
16+
run: cmake -S . -B build -G"Visual Studio 17 2022"
17+
18+
- name: build
19+
run: cmake --build build --config release
20+
21+
- name: Release
22+
uses: softprops/action-gh-release@v1
23+
if: startsWith(github.ref, 'refs/tags/')
24+
with:
25+
files: build/Release/sshpass.exe

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.cache
2+
build

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(sshpass)
4+
5+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
6+
7+
add_executable(${PROJECT_NAME} main.c argparse.c)
8+
9+
set_property(TARGET ${PROJECT_NAME} PROPERTY
10+
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
11+
12+
13+

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# sshpass-win32
2+
3+
Like https://linux.die.net/man/1/sshpass
4+
5+
# Pre-Requirements
6+
7+
To run sshpass, you must install:
8+
9+
- Windows 10 Insider build 17733 or later
10+
11+
# Usage
12+
13+
```sh
14+
Usage: sshpass [ options ] command
15+
16+
-h, --help show this help message and exit
17+
18+
Password options: With no options - password will be taken from stdin
19+
-f=<str> Take password to use from file
20+
-d=<int> Use number as file descriptor for getting password
21+
-p=<str> Provide password as argument (security unwise)
22+
-e Password is passed as env-var "SSHPASS"
23+
24+
Other options:
25+
-P=<str> Which string should sshpass search for to detect a password prompt
26+
-v Be verbose about what you're doing
27+
```
28+
29+
# Examples
30+
31+
```sh
32+
sshpass.exe -p 12345 "ssh [email protected] ls"
33+
```

0 commit comments

Comments
 (0)