Browse Source

add readme

master
s2 6 months ago
parent
commit
5754c5cdf3
3 changed files with 58 additions and 87 deletions
  1. 38
    1
      README.md
  2. 13
    83
      index.html
  3. 7
    3
      main.css

+ 38
- 1
README.md View File

@@ -1,3 +1,40 @@
1 1
 # sshenc.sh
2
+> bash script to encrypt data using a users ssh public key.
2 3
 
3
-Please see [https://sshenc.sh/](https://sshenc.sh/) (or the index.html file in this repository) for instructions.
4
+If you received a message from someone that was encrypted with this script, you can decrypt it with your ssh private key using the following command without installing anything:
5
+```
6
+bash <(curl -s https://sshenc.sh/sshenc.sh) -s ~/.ssh/id_rsa < file-containing-the-encrypted-text.txt
7
+```
8
+sshenc.sh uses openssl under the hood, so you need to have that installed in yout path to make it work.
9
+
10
+## Install
11
+```
12
+wget https://sshenc.sh/sshenc.sh
13
+chmod +x sshenc.sh
14
+```
15
+
16
+## Examples
17
+
18
+### encrypt a file using your own ssh public key
19
+```
20
+sshenc.sh -p ~/.ssh/id_rsa.pub < plain-text-file.txt > encrypted.txt
21
+```
22
+
23
+### encrypt a file using multiple recipients (broadcast encryption)
24
+```
25
+sshenc.sh -p ~/.ssh/id_rsa.pub -p id_rsa-alice.pub -p id_rsa-bob.pub < plain-text-file.txt > encrypted.txt
26
+```
27
+
28
+### encrypt a file using the public key of a github user
29
+```
30
+sshenc.sh -p <(curl -sf "https://github.com/S2-.keys" | grep ssh-rsa | tail -n1) < plain-text-file.txt
31
+```
32
+this line fetches the first public key for the github user S2- and encrypts the file plain-text-file.txt using this key.
33
+
34
+### dedecrypt a file
35
+```
36
+sshenc.sh -s ~/.ssh/id_rsa < encrypted.txt
37
+```
38
+
39
+## License
40
+[MIT](https://opensource.org/licenses/MIT)

+ 13
- 83
index.html View File

@@ -15,7 +15,6 @@
15 15
 
16 16
 		<!-- my own stuff -->
17 17
 		<link href="main.css" rel="stylesheet">
18
-
19 18
 	</head>
20 19
 
21 20
 	<body>
@@ -55,93 +54,24 @@
55 54
 		<!-- Page Content -->
56 55
 		<div class="container">
57 56
 			<div class="row">
58
-				<div class="col-lg-12">
59
-					<h1 class="mt-5">sshenc.sh</h1>
60
-					<hr>
61
-					<p class="lead">bash script to encrypt data using a users ssh public key.</p>
62
-					<hr>
63
-					<div class="bd-callout bd-callout-info">
64
-						If you received a message from someone that was encrypted with this script, you can decrypt it with your ssh private key using the following command without installing anything:<br>
65
-						<code>bash <(curl -s https://sshenc.sh/sshenc.sh) -s ~/.ssh/id_rsa < file-containing-the-encrypted-text.txt</code>
66
-					</div>
67
-					<p>sshenc.sh uses openssl under the hood, so you need to have that installed in yout path to make it work.</p>
68
-				</div>
69
-			</div>
70
-
71
-			<div class="row">
72
-				<div class="col-lg-12">
73
-					<h2>Install</h2>
74
-					<hr>
75
-					<h3>Install locally</h3>
76
-					<div class="bd-callout bd-callout-info">
77
-						<code>wget https://sshenc.sh/sshenc.sh<br>
78
-						chmod +x sshenc.sh</code>
79
-					</div>
80
-					<!--
81
-
82
-					<h3>Run it from remote every time</h3>
83
-					If you are
84
-					<ul>
85
-					<li>really brave, and</li>
86
-					<li>want to be sure to run the latest version every time, or</li>
87
-					<li>maybe don't want/can't install files</li>
88
-					</ul>
89
-					you can use an alias that downloads and executes the script every time:<br>
90
-					<code>alias sshenc.sh='bash <(curl -s https://sshenc.sh/sshenc.sh)'</code>
91
-					<br>
92
-					<br>
93
-					To add it to your environment permanently:<br>
94
-					<code>echo "alias sshenc.sh='bash <(curl -s https://sshenc.sh/sshenc.sh)'" >> ~/.bashrc</code>
95
-					<br>
96
-					Be careful: if you do this you trust https://sshenc.sh/ to always return the same script. It's actually a remote code execution if someone hacks https://sshenc.sh/ or the server becomes malicious.
97
-					<br>
98
-					<br>
99
-					-->
100
-				</div>
101
-			</div>
102
-
103
-			<div class="row">
104
-				<div class="col-lg-12">
105
-					<h2 id="examples">Examples</h2>
106
-					<hr>
107
-
108
-					<h3 id="encrypt-own">encrypt a file using your own ssh public key</h3>
109
-					<div class="bd-callout bd-callout-info">
110
-						<code>sshenc.sh -p ~/.ssh/id_rsa.pub < plain-text-file.txt > encrypted.txt</code>
111
-					</div>
112
-
113
-					<h3 id="encrypt-multi">encrypt a file using multiple recipients (broadcast encryption)</h3>
114
-					<div class="bd-callout bd-callout-info">
115
-						<code>sshenc.sh -p ~/.ssh/id_rsa.pub -p id_rsa-alice.pub -p id_rsa-bob.pub < plain-text-file.txt > encrypted.txt</code>
116
-					</div>
117
-
118
-					<h3 id="encrypt-gh">encrypt a file using the public key of a github user</h3>
119
-					<div class="bd-callout bd-callout-info">
120
-						<code>sshenc.sh -p <(curl -sf "https://github.com/S2-.keys" | grep ssh-rsa | tail -n1) < plain-text-file.txt</code>
121
-					</div>
122
-					<p>this line fetches the first public key for the github user S2- and encrypts the file plain-text-file.txt using this key.</p>
123
-
124
-					<h3 id="decrypt">dedecrypt a file</h3>
125
-					<div class="bd-callout bd-callout-info">
126
-						<code>sshenc.sh -s ~/.ssh/id_rsa < encrypted.txt</code>
127
-					</div>
128
-				</div>
129
-			</div>
130
-
131
-			<div class="row">
132
-				<div class="col-lg-12">
133
-					<h2>License</h2>
134
-					<hr>
135
-					<a href="https://opensource.org/licenses/MIT">MIT</a>
136
-				</div>
57
+				<div id="md"></div>
137 58
 			</div>
138 59
 		</div>
139 60
 
140
-
141
-
142 61
 		<!-- Bootstrap core JavaScript -->
143
-		<script src="vendor/jquery/jquery.min.js"></script>
144 62
 		<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
63
+		<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.4.2/markdown-it.min.js"></script>
64
+
65
+		<script>
66
+			var md = window.markdownit();
67
+			fetch('README.md')
68
+			.then((r) => {
69
+				return r.text();
70
+			})
71
+			.then((r) => {
72
+				document.getElementById('md').innerHTML = md.render(r);
73
+			});
74
+		</script>
145 75
 
146 76
 	</body>
147 77
 

+ 7
- 3
main.css View File

@@ -1,7 +1,5 @@
1
-.bd-callout-info {
1
+pre {
2 2
 	border-left-color: #5bc0de;
3
-}
4
-.bd-callout {
5 3
 	padding: 1.25rem;
6 4
 	margin-top: 1.25rem;
7 5
 	margin-bottom: 1.25rem;
@@ -11,3 +9,9 @@
11 9
 	border-left-width: .25rem;
12 10
 	border-radius: .25rem;
13 11
 }
12
+
13
+pre code {
14
+	font-size: inherit;
15
+	color: #e83e8c;
16
+	word-break: normal;
17
+}

Loading…
Cancel
Save