1JRD(1) java-runtime-decompiler JRD(1)
2
3
4
6 JRD - Java Runtime Decompiler
7
9 (./start.sh|start.bat) [-verbose] # launches GUI
10
11 (./start.sh|start.bat) [-verbose] (-help|-h|-comple‐
12 tion|-R|-hex|BOOT|SYSTEM|-overwrite|-init|-removeoverrides|-add‐
13 class|-addclasses|-addjar|-listoverrides <PUC>)
14
15 (./start.sh|start.bat) [-verbose] (-listclasses|-listde‐
16 tails|-bytes|-base64bytes|-deps|-compile|-decom‐
17 pile|-patch|-api|-listjvms|-listplugins|-listbytecodeversions|-listde‐
18 tailsversions|-search) [-saveas [-savelike]]
19
20 (./start.sh|start.bat) [-hex] [file, file...] launches standalone hex
21 (or text) editor/diff. Mighty diff. -hex suggests, how to open `file,
22 file...`
23
25 Standard options
26 -help, -h
27 Print this help text.
28
29 -verbose
30 All exceptions and some debugging strings will be printed to
31 standard error.
32
33 -version
34 Print version project name, version and build timestamp.
35
36 -config
37 Print path to main config file. In verbose mode prints file it‐
38 self..
39
40 -hex
41 Switch all binary operations to work in hex-readbale format
42 (including patching...)
43
44 -listjvms
45 List all local Java processes and their PIDs.
46
47 -listplugins
48 List all currently configured decompiler plugins and their sta‐
49 tuses.
50
51 -listagents
52 JRD keeps record off all local agents, dropping them once inac‐
53 cessible.Use this to list known agents.
54
55 You can append -versions to get also version of agent (may be
56 incompatible or not ours at all)
57
58 -listoverrides <PUC>
59 List all currently overwritten classes
60
61 -removeoverrides <PUC> removalRegex
62 remove all matching overwrittes of classes
63
64 -listclasses <PUC> [<CLASS REGEX>...]
65 List all loaded classes of a process, optionally filtering
66 them.
67
68 Only '-savelike exact' or '-savelike default' are allowed as
69 saving modifiers.
70
71 -listdetails <PUC> [<CLASS REGEX>...]
72 Similar to -listclasses, only more details are printed about
73 classes.
74
75 -listbytecodeversions <PUC> [<CLASS REGEX>...]
76 list all classes with bytecode version (slow!)
77
78 -listdetailsversions <PUC> [<CLASS REGEX>...]
79 list all classes with details and bytecode version (slow!)
80
81 -search <PUC> <CLASS REGEX>... searchedSubstring true/false (with/with‐
82 out details)
83 Will search ascii/utf8 substring in regex-subset binaries in
84 remote vm.
85
86 To search in decompiled classes use grep.You can misuses -hex
87 to include bytecode level
88
89 -base64bytes <PUC> <CLASS REGEX>...
90 Print Base64 encoded binary form of requested classes of a
91 process.
92
93 -bytes <PUC> <CLASS REGEX>...
94 Print binary form of requested classes of a process
95
96 -deps <PUC> <CLASS REGEX>...
97 Print all deps of the selected class(es).
98
99 -patch <PUC> <PLUGIN>xor<ADDITIONAL-SOURCE/CLASS-PATH (-hex) (-R)
100 You may ignore plugin/path param in -hex mode.You can apply
101 patch from STD-IN to classes in <PUC>. The patch can be on
102 source, or on binary if -hex is provided
103
104 The header (+++/---) must contain dot-delimited FQN of class.
105 All before / (or \) is stripped. .class$/.java$ is omitted.
106
107 See gui for the examples.
108
109 If plugin is specified, runtime classpath is decompiled,
110 patched, compiled (is not (de)compiled with -hex) and uploaded.
111
112 If plugin is not specified, then source from additional-
113 source-path is patched, compiled and uploaded.
114
115 If -hex is set, then binary from additional-class-path is
116 patched and uploaded. In both cases, class is INIT before all.
117
118 This is a bit different from gui, where patch is patching just
119 one file.
120
121 In cli can contain several files, and is moreover direct short‐
122 cut to init, bytes, (decompile,) patch,( detect bytecode level,
123 compile,) upload.
124
125 As patch tool, -R will invert the patch
126
127 For debugging -savelike dir can be used to save patched and
128 compiled output. -savelike fqn can be used to save patched
129 sources
130
131 -compile [-p <PLUGIN>] [-cp <PUC>] [-r] <PATH>...
132 Compile local files against runtime classpath, specified by
133 -cp.
134
135 Use -p to utilize some plugins' (like jasm or jcoder) bundled
136 compilers.
137
138 Use -r for recursive search if <PATH> is a directory.
139
140 If the argument of '-saveas' is a valid PID or URL, the com‐
141 piled code will be attempted to be injected into that process.
142
143 If multiple PATHs were specified, but no '-saveas', the process
144 fails.
145
146 use: -D of io.github.mkoncek.cplc.log-to-provider= any subset
147 of ADDING_CLASS,IGNORE_ARRAYS,IGNORE_LAMBDAS,INTERESTING,SKIP‐
148 PING_OVER
149
150 to see what is CPLC reolver doing. Warning, CPLC have issues
151 with default (none).
152
153 -decompile <PUC> <PLUGIN> <CLASS REGEX>...
154 Decompile and print classes of a process with the specified de‐
155 compiler plugin.
156
157 Javap can be passed options by appending them without spaces:
158 'javap-v-public ...' executes as 'javap -v -public ...'
159
160 -overwrite <PUC> <FQN> [<CLASS FILE>]
161 Overwrite class of a process with new bytecode. If <CLASS FILE>
162 is not set, standard input is used.
163
164 -addclass <PUC> <FQN> <CLASS FILE>
165 Add class is currently unable to add class, unless all its de‐
166 pendencies are already in running vm. Stdin used if no file.
167
168 -addjar <PUC> <JAR FILE> [BOOT]
169 Will add all classes from jar into selected VM. If you are
170 adding system classes, yo have to specify BOOT
171
172 -addclasses <PUC> (<CLASS FILE1>)^n [BOOT]
173 Will add all classes into jar, guess theirs FQN, and sent them
174 into selected VM. If you are adding system classes, yo have to
175 specify BOOT
176
177 -addclasses <PUC> (<FQN1> <CLASS FILE1>)^n [BOOT]
178 Will add all classes into jar, set theirs FQN, and sent them
179 into selected VM. If you are adding system classes, yo have to
180 specify BOOT
181
182 -init <PUC> <FQN>
183 Try to initialize a class in a running JVM (has no effect in FS
184 VMs). Because class loading is lazy, the class you need might be
185 missing, eg. java.lang.Override.
186
187 -attach <PID>
188 Will only attach the agent to selected pid. Prints out the port
189 for future usage.
190
191 -agent <AgentLiveliness> <AgentLoneliness> <port>
192 Control how agent is attached. Have sense only in operations
193 attaching to PID. Possible values of AgentLiveliness:
194
195 ONE_SHOT - Agent will connect, do its job and disconnect.
196
197 SESSION - Agent will connect and will remain connected untill
198 end of session.
199
200 PERMANENT - Agent will attach, and will disconnect only manu‐
201 ally or on death of target process
202
203 optional, defaults to SESSION for -overwrite, -patch, -attach
204 and -compile with upload to VM.
205
206 to ONE_SHOT for read. Followed one of AgentLoneliness:
207
208 SINGLE_INSTANCE - Agent be allowed to attach to each process
209 only once, unless FORCING is put to following attachment
210
211 ANONYMOUS - Agent will attach, but will not set the flag
212 about its presence. Still, the property will be set.
213
214 FORCING - Agent will attach, but will skip the check for sin‐
215 gle instance
216
217 AF - Agent will attach, but will skip the check for single
218 instanceand will not set the flag about its presence. Still, the
219 property will be set.
220
221 optional, defaults to SINGLE_INSTANCE
222
223 You can also specify port where the agent will listen, other‐
224 wise default port is calculated.
225
226 JRD keep record of all permanent and session agents, so they
227 can be listed/reused/removed.
228
229 This list is still checked for consistency.
230
231 File is /tmp/jrdAgents
232
233 The -addclass, -addclasses, -addjar is not SESSION or PERMANENT
234 because there is no way to unload them
235
236 -detach URL xor PORT xor PID
237 Will close and detach PERMANENT agent from given localhost:port
238 or url. To detach from PID, a valid mapping in /tmp/jrdAgents
239 file is needed
240
241 -api <PUC>
242 Will print out dynamic, real-to-time api which can be used to
243 insert fields/methods to running vm
244
245 -completion [<completion1, completion2,...>]
246 Without parameter Will print available code completions. With
247 parameter ofcoded completion names(delimited by ',' or ' '),
248 will print details of that exact set of completion.
249
250 Saving modifiers
251 -saveas <PATH>
252 All outputs will be written to PATH instead of to standard out‐
253 put.
254
255 -savelike <SAVE METHOD>
256 Specify how saving will behave.
257
259 All options can be with either one or two leading slashes ('-').
260
261
262 When using <CLASS REGEX>, escape dollar signs '$' of inner classes to
263 '\$'; otherwise they mean the end-of-line.
264
265
266 <FQN> is the fully qualified name of a class as per the Java Language
267 Specification ?6.7.
268
269
270 <PUC>, short for PidUrlClasspath, can be one of:
271
272 • local process PID
273
274 • remote process URL, in the format of 'hostname:port'
275
276 • classpath of JAR on the filesystem (classpath separator is
277 ':')
278
279
280 <SAVE METHOD> can be one of:
281
282 • 'dir' - Result will be saved as '<PATH>/fully/quali‐
283 fied/name.class'. Default for .class binaries.
284
285 • 'fqn' - Result will be saved as '<PATH>/fully.quali‐
286 fied.name.java'. Default for .java sources.
287
288 • 'exact' - Result will be saved exactly to '<PATH>'. Default
289 for everything else.
290
291 • 'default' - Saving uses the defaults mentioned above.
292
293
294 WARNING:
295
296 • JRD wa designed to overwrite existing classed, with all limits
297 hot swap have.
298
299 • And to add new, not yet present, classes.
300
301 • You can try to add add already existing class, to workaround
302 hotswap limitations, but there is no guarantee, such class will
303 be ever picked up.
304
305
306
307
308 2023-07-11 JRD(1)