-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
slackdump.1
379 lines (375 loc) · 11 KB
/
slackdump.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
.\" https://man.openbsd.org/mdoc.7
.\" macros:
.de BOOL
If set to
.Dq Ar true
(or any of
.Dq Ar 1
,
.Dq Ar t
or
.Dq Ar yes
),
..
.Dd $Mdocdate$
.Dt SLACKDUMP 1
.Os
.Sh NAME
.Nm slackdump
.Nd archive Slack workspace contents locally.
.Sh SYNOPSIS
.Nm slackdump
.Ar command Op Cm subcommand
.Op Fl flags
.Op Ar args ...
.Sh DESCRIPTION
The
.Nm
utility dumps Slack workspace contents. Currently it supports the
following Slack entities:
.Bl -tag -compact -width messages -offset ident
.It Em messages
Includes all messages in all channels, direct, and group messages.
.It Em replies
Includes all message replies or, in other words — threads.
.It Em files
Files are dumped along with messages they belong to.
.It Em emojis
Emojis are dumped along with their index which contains their names and aliases
as a JSON file.
.It Em users
Users include full profile information without custom fields.
.It Em channels
Channels, that are visible to the current authenticated user. This includes:
.Bl -dash -compact
.It
current and archive public channels including those that this user is not a
member of;
.It
private group conversations;
.It
direct messages (private conversations between two users).
.El
.It Em search
Searches for messages and/or files in the workspace.
.El
.Pp
If no command is given, on a dumb terminal, the
.Cm help
command is assumed. On an interactive terminal a list of options will
be presented, allowing the user to enter an interactive mode, display
help, or exit.
.Sh COMMANDS
The following commands are supported (listed in alphabetical order):
.Bl -tag -width workspace
.It Cm archive
Archive the workspace data in the Chunk format, that can be converted to
other formats, such as Slack Export or Dump.
.It Cm config Ar subcommand
Allows to perform different operations on the API limits configuration
files.
.It Cm convert
Convert between formats.
.It Cm dump
Dump selected channels or threads.
.It Cm emoji
Export Slack workspace emojis.
.It Cm export
Export workspace contents.
.It Cm format
Format the conversations, users, and channels as human readable files.
It supports TEXT and CSV formats.
.It Cm help Ar command
Display help. To get the subcommand help, use the combination of
.Cm main_command Cm help Ar subcommand
For example, to get help on the
.Ar new
subcommand of the
.Cm workspace
command, run the following:
.Bd -literal -offset indent
.Nm Cm workspace Cm help Ar new
.Ed
.It Cm list
List channels or users in the desired format
.Pq default output is text
.It Cm search Ar subcommand
Search for messages, files, or both in the workspace and save the results in
archive format. The discovered files are saved to disk as well.
.It Cm tools Ar subcommand
Contains various diagnostic and convenience utilities. Developers might ask
to run these commands to help with debugging. See TOOLS section for more
information.
.It Cm version
Display version information.
.It Cm workspace
Manage stored credentials for authenticated workspaces, or authenticates in a
new workspace.
.El
.\"
.Sh FLAGS
This section lists all available flags, availability of which depends on the
command. The flags are listed in alphabetical order.
.Bl -tag -width -base dir
.It Fl api-config Ar path
Use the specified API limits configuration file (see the
.Cm config
command).
.It Fl base Ar path
Specifies the base directory or zip file where all data will be stored.
If the path ends with
.Dq .zip ,
the data will be stored in the zip file, otherwise
it will be stored in the directory.
.Pp
If the flag is not specified, Slackdump defaults to creating a zip file in the
current directory using the following pattern:
.Dq slackdump_YYYYMMDD_HHMISS.zip ,
where
.Dq YYYYMMDD_HHMISS
is the current date and time. For example:
.Bd -literal -offset indent
slackdump_20201231_235959.zip
.Ed
.It Fl browser Ar firefox | chromium
Specifies the browser to use for the authentication. The default is Firefox.
.It Fl cache-dir Ar path
Specifies the directory where the authentication information and user/channel
cache is stored. If the flag is not specified, the cache is stored in the
system cache directory.
.It Fl cookie Ar cookie | cookie_file
.It Fl files=true|false
Enables or disables attachment files downloading. The default is enabled. To
disable downloading, use
.Dq Fl files=false .
.It Fl log Ar path
Specifies the log file path and or filename. If the flag is not specified, the
log is written to the error output (STDERR).
.It Fl log-json=true|false
Enables or disables JSON log format. The default is disabled.
.It Fl token Ar token
Specifies the token to use for the authentication. This flag is only used
with the manual authentication methods.
.It Fl no-user-cache
Disables caching of users for the subcommands of the
.Cm list
command.
.It Fl no-chunk-cache
Disables caching of chunks for the
.Cm convert
command. This may be useful on small archives. For big archives caching is
beneficial, as it allows to reduce the processing time.
.It Fl time-from Ar YYYY-MM-DDTHH:MI:SS
Allows to specify the start time. The time is specified in the format
.Dq YYYY-MM-DDTHH:MI:SS
where
.Sq T
is a literal character separating the date and time, for example
.Dq 2020-12-311T23:59:59
.It Fl time-to Ar YYYY-MM-DDTHH:MI:SS
Allows to specify the end time. See the
.Fl time-from
flag for the format.
.It Fl trace Ar filename
Enables tracing and writes the trace to the specified file.
.It Fl user-cache-retention Ar duration
Specifies the duration for which the user cache is kept. The default is
.Dq 1h
.Ns .
The duration is specified in the format accepted by the Go time package.
For example, to specify the duration of 1 hour 30 minutes and 55 seconds, use
.Dq 1h30m55s
.Ns .
.It Fl v
Enables verbose output, prints a lot of debugging information.
.It Fl workspace Ar name
Allows to override the currently selected workspace for the session.
See also the
.Cm workspace Ar select
command.
.El
.\"
.Sh USAGE
.Ss Quickstart
The quickest way to get started is to run the following command:
.Bl -enum -compact
.It
Authenticate in a new workspace using the
.Cm workspace
.Ar new
command;
.It
Run
.Cm dump
,
.Cm archive
or
.Cm export
, depending on your requirements.
.El
.Sh AUTHENTICATION
Slackdump supports multiple authentication methods listed below.
.Ss Automatic login (EZ-LOGIN 3000)
This is the default authentication mode, and so far is the most convenient one.
It requires no additional configuration and works out of the box. However, it
is not supported on all systems: it requires GUI and x64 architecture, and may
require some additional steps on CentOS and other Redhat derived systems.
If the automatic login does not work for some reason, you can try to use one of
the manual login methods, described in the next section.
This method works on Single-Sign-On enabled workspaces as well in most cases.
For Google Authentication, you must use the "User Browser" login method to
avoid bot detection algorithms.
.Ss Manual login methods
.Bl -tag -width token+cookie
.It Em token
This method requires Application
.Pq xoxa-
, Bot
.Pq xoxb-
or a Legacy
.Pq xoxp-
token. You can get these tokens (except Legacy) from the Slack
Workspace Administration page. See the
.Lk https://api.slack.com/authentication/token-types "Slack documentation"
for more details.
.Pp
.Sy Note:
You will not be able to access your DMs with the Application or Bot tokens, and
Legacy tokens are deprecated.
.It Em token+cookie
This is the pair of the Client Token
.Pq xoxc-
and a
.Dq d=
Browser Cookie
.Pq xoxd=
value that you can get from your browser manually following the instructions in
the documentation.
.It Em token+cookie file
This is the same as above, but it requires the
.Dq cookie.txt
file, exported from you Browser session in Mozilla format. On Firefox, you could use
.Lk https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/ "Cookies.txt"
extension.
.Sy Note:
Some browser extensions may be unsafe and may expose your private data, so use them at
your own risk. The authors of this utility do not endorse any of the
extensions mentioned above.
.El
.Pp
Read more on how to get the token and cookie from your logged-in browser
session by running
.Bd -literal -offset indent
.Nm Cm help Ar login
.Be
.\"
.Sh TOOLS
The following tools are available:
.Bl -tag -width uninstall
.It Em encrypt
encrypt files for secure transmission, i.e. encrypting trace.out before
posting it in Github Issues.
.It Em eztest
test the EZ-LOGIN 3000 method.
.It Em info
show information about Slackdump environment
.It Em obfuscate
obfuscate the sensitive data in Slackdump archive. Works only on
archive file format.
.It Em uninstall
uninstall Slackdump components or purge it from the system.
.It Em thread
thread utility, used to create threads in the Slack workspace for tests.
.El
.Sh ENVIRONMENT
.Bl -tag -width SLACK_WORKSPACE
.It Ev BASE_LOC
Contains path to a directory or zip file where all data will be stored. See
.Fl base
flag for more details.
.It Ev CACHE_DIR
Contains path to a directory where cache files will be stored. See flag
.Fl cache-dir
for more details.
.It Ev DEBUG
.BOOL
enables debug output and switches the viewer output to RAW (JSON) format.
.It Ev JSON_LOG
.BOOL
enables JSON log format.
.It Ev LOG_FILE
Contains path to a file where log output will be written.
.It Ev SLACK_COOKIE
Contains Slack cookie (for token+cookie-based authentication). See
.Sx Authentication
for more details.
.It Ev SLACK_TOKEN
Contains Slack token (for token-based authentication). See
.Sx Authentication
for more details.
.It Ev SLACK_WORKSPACE
Allows to specify Slack workspace name (overrides currently selected
workspace). See
.Ar workspace
command for more details.
.It Ev TRACE_FILE
Contains path to a file where trace output will be written.
.El
.\" For sections 1, 6, 7, and 8 only.
.Sh FILES
.Bl -tag -width secrets.txt -compact
.It Sy .env
Contains environment variables that will be loaded during the startup. These
variables override the environment variables set in the environment.
.It Sy .env.txt
See
.Em .env
.It Sy secrets.txt
See
.Em .env
.\" .Sh EXIT STATUS
.\" For sections 1, 6, and 8 only.
.Sh EXAMPLES
Getting help on a specific command:
.Bd -literal -offset indent
.Nm Cm help Ar <command>
.Ed
.Pp
Authenticate in a new workspace
.Lk https://myworkspace.slack.com
:
.Bd -literal -offset indent
.Nm Cm workspace Cm new Ar myworkspace
.Ed
.Pp
Run full workspace export:
.Bd -literal -offset indent
.Nm Cm export
.Ed
.Pp
Run full workspace export with debug output:
.Bd -offset indent
DEBUG=1
.Nm Cm export
.Ed
.\" .Sh DIAGNOSTICS
.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
.\" .Sh ERRORS
.\" For sections 2, 3, 4, and 9 errno settings only.
.\" .Sh SEE ALSO
.\" .Xr foobar 1
.\" .Sh STANDARDS
.Sh HISTORY
Slackdump was created as a tool to dump private messages from Slack in 2018, and
was released as an GPL-3 Open Source application to public in October 2021.
.Sh AUTHORS
The
.Nm
was written by
.An Lk https://github.com/rusq "@rusq"
with the help of a number of contributors listed on
.Lk https://github.com/rusq/slackdump "Slackdump Homepage"
.\" .Sh CAVEATS
.\" .Sh BUGS
.\" .Sh SECURITY CONSIDERATIONS
.\" Not used in OpenBSD.