Adding forgotten files

This commit is contained in:
Jiri Vanek 2019-09-03 19:39:20 +02:00
commit b49adb378f
10 changed files with 391 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/java-runtime-decompiler-2.0.tar.gz
/java-runtime-decompiler-3.0.tar.gz

19
fixDoclint.patch Normal file
View file

@ -0,0 +1,19 @@
diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java
index 86f9a87..18dce1a 100644
--- a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java
+++ b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/MainFrameView.java
@@ -174,11 +174,11 @@ public class MainFrameView {
welcomeJTextArea = new JTextArea(9, 40);
welcomeJTextArea.setText("Welcome to Java-Runtime-Decompiler\n" +
"\n" +
- "Before using the app, the Decompiler Agent's path needs to be selected in 'Configure → Decompiler Agent'.\n" +
+ "Before using the app, the Decompiler Agent's path needs to be selected in 'Configure -> Decompiler Agent'.\n" +
"It's a built-in project and can usually be found at '"+ ((isPortable())?"./libs/":"./decompiler_agent/target/") +"decompiler-agent-*.jar'.\n" +
"\n" +
"Internal javap decompiling tools are available by default.\n" +
- "You can also download an external decompiler, e.g. via 'mvn clean install -PdownloadPlugins', and set it up in 'Configure → Plugins'.\n" +
+ "You can also download an external decompiler, e.g. via 'mvn clean install -PdownloadPlugins', and set it up in 'Configure -> Plugins'.\n" +
"Currently supported decompilers are: Fernflower, Procyon.\n");
welcomeJTextArea.setFont(new Font(welcomeJTextArea.getFont().getFontName(), welcomeJTextArea.getFont().getStyle(), 20));
welcomeJTextArea.setLineWrap(true);

86
java-runtime-decompiler Normal file
View file

@ -0,0 +1,86 @@
#!/usr/bin/bash
# java runtime decompiler launch script
# JPackage Project <http://www.jpackage.org/>
# Source functions library
. /usr/share/java-utils/java-functions
# identify directory tree
JRD=`basename $0`
CONF_HOME=$XDG_CONFIG_HOME
if [ "$CONF_HOME" = "" ] ; then
CONF_HOME=$HOME/.config/$JRD
else
CONF_HOME=$CONF_HOME/$JRD
fi
LOG_DIR=$CONF_HOME/logs
CONF_DIR=$CONF_HOME/conf
# create directory tree
PLUGIN_HOME=$CONF_HOME/plugins
mkdir -p $LOG_DIR
mkdir -p $CONF_DIR
mkdir -p $PLUGIN_HOME
: ${MAIN_CLASS:=org.jrd.backend.data.Main}
# set java and jvm arguments
export _prefer_jre=false
_set_java_home
set_jvm
# all dependencies must be on classpath
set_classpath java-runtime-decompiler byteman google-gson
CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/tools.jar
# set path to agent automatically
AGENT="/usr/share/java/java-runtime-decompiler/decompiler-agent.jar"
CONFIG_FILE=$CONF_DIR/config.cfg
AGENT_PREFIX="AGENT_PATH==="
AGENT_STRING=$AGENT_PREFIX$AGENT
# copy json wrappers information to home so the users can edit
CP_FILES="$(ls /etc/$JRD/plugins/*.json)"
for cpfile in $CP_FILES; do
FILE_NAME="$(basename -- $cpfile)"
if [ ! -e "$PLUGIN_HOME/$FILE_NAME" ]
then
cp $cpfile $PLUGIN_HOME
else
echo "Configuration files were not copied for $FILE_NAME - the existing configuration would be overwritten." >&2
fi
done
# create config file and add agent default path
touch $CONFIG_FILE
if [ -e $AGENT ]
then
if grep -Fxq $AGENT_STRING $CONFIG_FILE
then
echo "Default agent path is already set in $CONFIG_FILE. Skipping agent path setting." >&2
elif grep -rq $AGENT_PREFIX $CONFIG_FILE
then
RESULT_OF_GREP="$(grep -rq $AGENT_PREFIX $CONFIG_FILE)"
echo "Agent path is already set in $CONFIG_FILE as ${RESULT_OF_GREP}. Skipping agent path setting." >&2
else
echo $AGENT_STRING >> $CONFIG_FILE
fi
else
echo "Agent was not found and agent path was not set correctly. This has to be done manually in the decompiler GUI, or set AGENT_PATH===path_to_agent_jar in the configuration file: $CONFIG_FILE" >&2
fi
run "$@"

32
java-runtime-decompiler.1 Normal file
View file

@ -0,0 +1,32 @@
.TH java-runtime-decompiler 1 "26 August 2019" "version 3.0"
.SH NAME
java-runtime-decompiler \- launch java-runtime decompiler GUI
.SH SYNOPSIS
java-runtime-decompiler
.SH DESCRIPTION
It is used for extraction of bytecode from running JVM and decompilation of the bytecode with an external decompiler. Paths to the decompiler need to be specified in .json configuration file located in /etc/java-runtime-decompiler
.SH OPTIONS
.IP -verbose
Print out all exceptions and debugging strings in stdout.
.IP -help
Print out help and exits.
.IP -listjvms
List available local JVMs.
.IP -listplugins
List currently configured plugins with their status.
.IP "-listclasses pid-xor-url"
List loaded classes from JVM with given PID/URL.
.IP "-bytes pid class-name"
Print on stdout binary form of given class loaded in JVM with given PID/URL.
.IP "-base64bytes pid-xor-url class-name"
Print on stdout binary form encoded in base64 of given class loaded in JVM with given PID/URL.
.IP "-decompile pid-xor-url class-name config-file"
Print on stdout decompiled class, needs PID/URL of JVM, class name and name/file with decompiler configuration, can use javap disassembler. To pass arguments to the disassembler, add them to javap without spaces (e.g. javap-v).
.IP "-overwrite pid/urlOfJVM classToOverwrite fileWithNewBytecode"
three args - pid or url of JVM and class to overwrite and file with new bytecode
.SH AUTHOR
Petra Alice Mikova (petra.alice.mikova@gmail.com)
Jiri Vanek (judovana@email.com)
Radek Manak (Radek.Manak@protonmail.com)
Ondrej Hrdlicka (ondra.ondrah@seznam.cz)

View file

@ -0,0 +1,124 @@
Summary: Application for extraction and decompilation of JVM byte code
Name: java-runtime-decompiler
Version: 3.0
Release: 4%{?dist}
License: GPLv3
URL: https://github.com/pmikova/java-runtime-decompiler
Source0: https://github.com/pmikova/%{name}/archive/%{name}-%{version}.tar.gz
Source1: java-runtime-decompiler
Source2: java-runtime-decompiler.1
Source3: jrd.desktop
Patch0: remove_rsyntaxtextarea.patch
Patch1: systemFernflower.patch
Patch2: systemProcyon.patch
Patch3: fixDoclint.patch
BuildArch: noarch
BuildRequires: maven-local
BuildRequires: byteman
BuildRequires: junit
BuildRequires: ant-junit
BuildRequires: maven-surefire-provider-junit
BuildRequires: maven-surefire
BuildRequires: maven-surefire-plugin
# depends on devel, not runtime (needs tools.jar)
BuildRequires: java-devel = 1:1.8.0
BuildRequires: google-gson
BuildRequires: desktop-file-utils
Requires: java-devel = 1:1.8.0
Recommends: fernflower
Recommends: procyon-decompiler
%description
This application can access JVM memory at runtime,
extract byte code from the JVM and decompile it.
%package javadoc
Summary: Javadoc for %{name}
Requires: %{name} = %{version}-%{release}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0 -p1
%patch1
%patch2
%patch3 -p1
%build
pushd runtime-decompiler
%pom_remove_dep com.sun:tools
%pom_add_dep com.sun:tools
%pom_remove_plugin :maven-jar-plugin
popd
export JAVA_TOOL_OPTIONS="-Dadditionalparam=-Xdoclint:none -DadditionalJOption=-Xdoclint:none"
%mvn_build -f
%install
%mvn_install
install -d -m 755 $RPM_BUILD_ROOT%{_mandir}/man1/
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/
cp -r %{_builddir}/%{name}-%{name}-%{version}/runtime-decompiler/src/plugins/ $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor="fedora" \
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE3}
%files -f .mfiles
%attr(755, root, -) %{_bindir}/java-runtime-decompiler
%{_mandir}/man1/java-runtime-decompiler.1*
# wrappers for decompilers
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/plugins
%config %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.java
%config(noreplace) %{_sysconfdir}/%{name}/plugins/FernflowerDecompilerWrapper.json
%config %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.java
%config(noreplace) %{_sysconfdir}/%{name}/plugins/ProcyonDecompilerWrapper.json
%license LICENSE
%dir %{_datadir}/applications
%{_datadir}/applications/fedora-jrd.desktop
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog
* Tue Aug 27 2019 Jiri Vanek <jvanek@redhat.com> - 3.0-3
- all stdouts from customlauncher moved to stderr
* Mon Aug 26 2019 Jiri Vanek <jvanek@redhat.com> - 3.0-0
- moved to usptream version 3.0
- adjusted configs, removed lambda patch
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jan 17 2019 Jiri Vanek <jvanek@redhat.com> - 2.0-5
- improved Patch3, includeLambdas.patch to sort the lamdas t the bottom
* Thu Jan 17 2019 Jiri Vanek <jvanek@redhat.com> - 2.0-4
- added depndence of procyon decompiler (currenlty under review
- added and applied Patch2, systemProcyon.patch to enable system procyon out of thebox
- added and applied Patch3, includeLambdas.patch to at least list lamdas untill fixed in upstream
* Thu Jan 10 2019 Jiri Vanek <jvanek@redhat.com> - 2.0-3
- added depndence of fernflower decompiler
- added and applied Patch1, systemFernflower.patch to enable system fernflower
* Wed Nov 28 2018 Petra Mikova <petra.alice.mikova@gmail.com> - 2.0-2
- fixed changelog
* Mon Nov 19 2018 Petra Mikova <petra.alice.mikova@gmail.com> - 2.0-1
- fixed issues listed in review (rhbz#1636019)
- added installation of desktop file
* Wed Jun 06 2018 Petra Mikova <petra.alice.mikova@gmail.com> - 1.1-1
- initial commit

8
jrd.desktop Normal file
View file

@ -0,0 +1,8 @@
[Desktop Entry]
Encoding=UTF-8
Type=Application
Categories=Development;Profiling;Java;
Version=1.0
Name=Java Runtime Decompiler
Exec=java-runtime-decompiler
Terminal=false

View file

@ -0,0 +1,85 @@
diff --git a/runtime-decompiler/pom.xml b/runtime-decompiler/pom.xml
index 26a416e..e6e2425 100644
--- a/runtime-decompiler/pom.xml
+++ b/runtime-decompiler/pom.xml
@@ -131,11 +131,6 @@
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
- <dependency>
- <groupId>com.fifesoft</groupId>
- <artifactId>rsyntaxtextarea</artifactId>
- <version>2.6.1</version>
- </dependency>
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-install</artifactId>
@@ -144,24 +139,6 @@
</dependency>
<!-- For tests -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>5.5.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>5.5.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>5.5.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
diff --git a/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java b/runtime-decompiler/src/main/java/org/jrd/frontend/BytecodeDecompilerView.java
index 9c19e2c..8d17775 100644
--- a/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java
+++ b/runtime-decompiler/src/main/java/org/jrd/frontend/MainFrame/BytecodeDecompilerView.java
@@ -2,9 +2,9 @@ package org.jrd.frontend.MainFrame;
import org.jrd.backend.core.OutputController;
import org.jrd.backend.decompiling.DecompilerWrapperInformation;
-import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
-import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
-import org.fife.ui.rtextarea.RTextScrollPane;
+//import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
+//import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
+//import org.fife.ui.rtextarea.RTextScrollPane;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
@@ -30,8 +30,8 @@ public class BytecodeDecompilerView {
private JPanel rightMainPanel;
private JScrollPane leftScrollPanel;
private JList<String> filteredClassesJlist;
- private RTextScrollPane bytecodeScrollPane;
- private RSyntaxTextArea bytecodeSyntaxTextArea;
+ private JScrollPane bytecodeScrollPane;
+ private JTextArea bytecodeSyntaxTextArea;
private ActionListener bytesActionListener;
private ActionListener classesActionListener;
private ActionListener rewriteActionListener;
@@ -147,10 +147,10 @@ public class BytecodeDecompilerView {
}
});
- bytecodeSyntaxTextArea = new RSyntaxTextArea();
- bytecodeSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
- bytecodeSyntaxTextArea.setCodeFoldingEnabled(true);
- bytecodeScrollPane = new RTextScrollPane(bytecodeSyntaxTextArea);
+ bytecodeSyntaxTextArea = new JTextArea();
+ //bytecodeSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
+ //bytecodeSyntaxTextArea.setCodeFoldingEnabled(true);
+ bytecodeScrollPane = new JScrollPane(bytecodeSyntaxTextArea);
leftMainPanel = new JPanel();
leftMainPanel.setLayout(new BorderLayout());

1
sources Normal file
View file

@ -0,0 +1 @@
SHA512 (java-runtime-decompiler-3.0.tar.gz) = 329184689763b7777ef0bad1c0f787aa649f855692b52bd843cacd424d5d2c0caadad328f80cd7f229031a151b6414c712bd770abd285412055c5d34d932875c

16
systemFernflower.patch Normal file
View file

@ -0,0 +1,16 @@
--- runtime-decompiler/src/plugins/FernflowerDecompilerWrapper.json
+++ runtime-decompiler/src/plugins/FernflowerDecompilerWrapper.json
@@ -1,9 +1,8 @@
{
"Name": "Fernflower",
- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/FernflowerDecompilerWrapper.java",
+ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/FernflowerDecompilerWrapper.java",
"DependencyURL": [
- "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/decompiler-fernflower/4.2.1.Final/decompiler-fernflower-4.2.1.Final.jar",
- "file://${HOME}/.m2/repository/org/jboss/windup/decompiler/fernflower/windup-fernflower/1.0.0.20171018/windup-fernflower-1.0.0.20171018.jar"
+ "file:///usr/share/java/fernflower.jar"
],
"DecompilerDownloadURL": "https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine"
-}
\ No newline at end of file
+}

18
systemProcyon.patch Normal file
View file

@ -0,0 +1,18 @@
--- runtime-decompiler/src/plugins/ProcyonDecompilerWrapper.json 2018-11-12 15:25:47.000000000 +0100
+++ runtime-decompiler/src/plugins/ProcyonDecompilerWrapper.json 2019-01-16 12:13:37.317778036 +0100
@@ -1,9 +1,10 @@
{
"Name": "Procyon",
- "WrapperURL": "file://${XDG_CONFIG_HOME}/plugins/ProcyonDecompilerWrapper.java",
+ "WrapperURL": "file:///etc/java-runtime-decompiler/plugins/ProcyonDecompilerWrapper.java",
"DependencyURL": [
- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-core/0.5.35/procyon-core-0.5.35.jar",
- "file://${HOME}/.m2/repository/org/bitbucket/mstrobel/procyon-compilertools/0.5.35/procyon-compilertools-0.5.35.jar"
+ "/usr/share/java/procyon/procyon-core.jar",
+ "/usr/share/java/procyon/procyon-compilertools.jar",
+ "/usr/share/java/procyon/procyon-decompiler.jar"
],
"DecompilerDownloadURL": "https://bitbucket.org/mstrobel/procyon/downloads/"
-}
\ No newline at end of file
+}