Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
bcaca781
Commit
bcaca781
authored
Jan 21, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(gui): reformat code and fix some warnings
parent
ffedaea5
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
256 additions
and
289 deletions
+256
-289
JadxWrapper.java
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
+4
-4
BackgroundWorker.java
jadx-gui/src/main/java/jadx/gui/jobs/BackgroundWorker.java
+3
-8
DecompileJob.java
jadx-gui/src/main/java/jadx/gui/jobs/DecompileJob.java
+1
-6
JadxSettings.java
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
+0
-1
JadxSettingsAdapter.java
.../src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
+1
-1
JadxSettingsWindow.java
...i/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
+2
-4
ApkSignature.java
jadx-gui/src/main/java/jadx/gui/treemodel/ApkSignature.java
+23
-23
JSources.java
jadx-gui/src/main/java/jadx/gui/treemodel/JSources.java
+1
-1
AboutDialog.java
jadx-gui/src/main/java/jadx/gui/ui/AboutDialog.java
+1
-7
CommonSearchDialog.java
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
+3
-3
HeapUsageBar.java
jadx-gui/src/main/java/jadx/gui/ui/HeapUsageBar.java
+14
-19
HtmlPanel.java
jadx-gui/src/main/java/jadx/gui/ui/HtmlPanel.java
+6
-14
MainDropTarget.java
jadx-gui/src/main/java/jadx/gui/ui/MainDropTarget.java
+1
-1
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+12
-7
TabbedPane.java
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
+15
-23
LineNumbers.java
jadx-gui/src/main/java/jadx/gui/ui/codearea/LineNumbers.java
+7
-9
JadxUpdate.java
jadx-gui/src/main/java/jadx/gui/update/JadxUpdate.java
+13
-27
CertificateManager.java
...-gui/src/main/java/jadx/gui/utils/CertificateManager.java
+1
-1
CodeLinesInfo.java
jadx-gui/src/main/java/jadx/gui/utils/CodeLinesInfo.java
+1
-1
CodeUsageInfo.java
jadx-gui/src/main/java/jadx/gui/utils/CodeUsageInfo.java
+5
-6
JumpManager.java
jadx-gui/src/main/java/jadx/gui/utils/JumpManager.java
+1
-1
LangLocale.java
jadx-gui/src/main/java/jadx/gui/utils/LangLocale.java
+1
-1
Link.java
jadx-gui/src/main/java/jadx/gui/utils/Link.java
+1
-1
NLS.java
jadx-gui/src/main/java/jadx/gui/utils/NLS.java
+19
-10
Utils.java
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
+3
-4
Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+2
-2
TestStringRef.groovy
jadx-gui/src/test/groovy/jadx/gui/tests/TestStringRef.groovy
+1
-0
CertificateManagerTest.java
.../src/test/java/jadx/gui/utils/CertificateManagerTest.java
+114
-104
CERT.DSA
jadx-gui/src/test/resources/certificate-test/CERT.DSA
+0
-0
CERT.RSA
jadx-gui/src/test/resources/certificate-test/CERT.RSA
+0
-0
EMPTY.txt
jadx-gui/src/test/resources/certificate-test/EMPTY.txt
+0
-0
No files found.
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
View file @
bcaca781
...
@@ -67,7 +67,6 @@ public class JadxWrapper {
...
@@ -67,7 +67,6 @@ public class JadxWrapper {
/**
/**
* Get the complete list of classes
* Get the complete list of classes
* @return
*/
*/
public
List
<
JavaClass
>
getClasses
()
{
public
List
<
JavaClass
>
getClasses
()
{
return
decompiler
.
getClasses
();
return
decompiler
.
getClasses
();
...
@@ -75,20 +74,21 @@ public class JadxWrapper {
...
@@ -75,20 +74,21 @@ public class JadxWrapper {
/**
/**
* Get all classes that are not excluded by the excluded packages settings
* Get all classes that are not excluded by the excluded packages settings
* @return
*/
*/
public
List
<
JavaClass
>
getIncludedClasses
()
{
public
List
<
JavaClass
>
getIncludedClasses
()
{
List
<
JavaClass
>
classList
=
decompiler
.
getClasses
();
List
<
JavaClass
>
classList
=
decompiler
.
getClasses
();
String
excludedPackages
=
settings
.
getExcludedPackages
().
trim
();
String
excludedPackages
=
settings
.
getExcludedPackages
().
trim
();
if
(
excludedPackages
.
length
()
==
0
)
if
(
excludedPackages
.
length
()
==
0
)
{
return
classList
;
return
classList
;
}
String
[]
excluded
=
excludedPackages
.
split
(
"[ ]+"
);
String
[]
excluded
=
excludedPackages
.
split
(
"[ ]+"
);
return
classList
.
stream
().
filter
(
cls
->
{
return
classList
.
stream
().
filter
(
cls
->
{
for
(
String
exclude
:
excluded
)
{
for
(
String
exclude
:
excluded
)
{
if
(
cls
.
getFullName
().
startsWith
(
exclude
))
if
(
cls
.
getFullName
().
startsWith
(
exclude
))
{
return
false
;
return
false
;
}
}
}
return
true
;
return
true
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
...
...
jadx-gui/src/main/java/jadx/gui/jobs/BackgroundWorker.java
View file @
bcaca781
...
@@ -3,12 +3,12 @@ package jadx.gui.jobs;
...
@@ -3,12 +3,12 @@ package jadx.gui.jobs;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.util.concurrent.Future
;
import
java.util.concurrent.Future
;
import
jadx.gui.utils.NLS
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
jadx.gui.ui.ProgressPanel
;
import
jadx.gui.ui.ProgressPanel
;
import
jadx.gui.utils.CacheObject
;
import
jadx.gui.utils.CacheObject
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.search.TextSearchIndex
;
import
jadx.gui.utils.search.TextSearchIndex
;
...
@@ -27,12 +27,7 @@ public class BackgroundWorker extends SwingWorker<Void, Void> {
...
@@ -27,12 +27,7 @@ public class BackgroundWorker extends SwingWorker<Void, Void> {
if
(
isDone
())
{
if
(
isDone
())
{
return
;
return
;
}
}
SwingUtilities
.
invokeLater
(
new
Runnable
()
{
SwingUtilities
.
invokeLater
(()
->
progressPane
.
setVisible
(
true
));
@Override
public
void
run
()
{
progressPane
.
setVisible
(
true
);
}
});
addPropertyChangeListener
(
progressPane
);
addPropertyChangeListener
(
progressPane
);
execute
();
execute
();
}
}
...
@@ -46,7 +41,7 @@ public class BackgroundWorker extends SwingWorker<Void, Void> {
...
@@ -46,7 +41,7 @@ public class BackgroundWorker extends SwingWorker<Void, Void> {
}
}
@Override
@Override
protected
Void
doInBackground
()
throws
Exception
{
protected
Void
doInBackground
()
{
try
{
try
{
System
.
gc
();
System
.
gc
();
LOG
.
debug
(
"Memory usage: Before decompile: {}"
,
Utils
.
memoryInfo
());
LOG
.
debug
(
"Memory usage: Before decompile: {}"
,
Utils
.
memoryInfo
());
...
...
jadx-gui/src/main/java/jadx/gui/jobs/DecompileJob.java
View file @
bcaca781
...
@@ -11,12 +11,7 @@ public class DecompileJob extends BackgroundJob {
...
@@ -11,12 +11,7 @@ public class DecompileJob extends BackgroundJob {
protected
void
runJob
()
{
protected
void
runJob
()
{
for
(
final
JavaClass
cls
:
wrapper
.
getIncludedClasses
())
{
for
(
final
JavaClass
cls
:
wrapper
.
getIncludedClasses
())
{
addTask
(
new
Runnable
()
{
addTask
(
cls:
:
decompile
);
@Override
public
void
run
()
{
cls
.
decompile
();
}
});
}
}
}
}
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
View file @
bcaca781
...
@@ -150,7 +150,6 @@ public class JadxSettings extends JadxCLIArgs {
...
@@ -150,7 +150,6 @@ public class JadxSettings extends JadxCLIArgs {
return
true
;
return
true
;
}
}
public
boolean
isShowHeapUsageBar
()
{
public
boolean
isShowHeapUsageBar
()
{
return
showHeapUsageBar
;
return
showHeapUsageBar
;
}
}
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
View file @
bcaca781
...
@@ -21,7 +21,7 @@ public class JadxSettingsAdapter {
...
@@ -21,7 +21,7 @@ public class JadxSettingsAdapter {
private
static
final
Preferences
PREFS
=
Preferences
.
userNodeForPackage
(
JadxGUI
.
class
);
private
static
final
Preferences
PREFS
=
Preferences
.
userNodeForPackage
(
JadxGUI
.
class
);
private
static
ExclusionStrategy
EXCLUDE_FIELDS
=
new
ExclusionStrategy
()
{
private
static
final
ExclusionStrategy
EXCLUDE_FIELDS
=
new
ExclusionStrategy
()
{
@Override
@Override
public
boolean
shouldSkipField
(
FieldAttributes
f
)
{
public
boolean
shouldSkipField
(
FieldAttributes
f
)
{
return
JadxSettings
.
SKIP_FIELDS
.
contains
(
f
.
getName
())
return
JadxSettings
.
SKIP_FIELDS
.
contains
(
f
.
getName
())
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java
View file @
bcaca781
package
jadx
.
gui
.
settings
;
package
jadx
.
gui
.
settings
;
import
javax.swing.*
;
import
javax.swing.*
;
import
javax.swing.event.DocumentEvent
;
import
javax.swing.event.DocumentListener
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.ItemEvent
;
import
java.awt.event.ItemEvent
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseAdapter
;
...
@@ -245,11 +243,11 @@ public class JadxSettingsWindow extends JDialog {
...
@@ -245,11 +243,11 @@ public class JadxSettingsWindow extends JDialog {
});
});
JButton
editExcludedPackages
=
new
JButton
(
NLS
.
str
(
"preferences.excludedPackages.button"
));
JButton
editExcludedPackages
=
new
JButton
(
NLS
.
str
(
"preferences.excludedPackages.button"
));
editExcludedPackages
.
addActionListener
(
event
->
{
editExcludedPackages
.
addActionListener
(
event
->
{
String
result
=
JOptionPane
.
showInputDialog
(
this
,
NLS
.
str
(
"preferences.excludedPackages.editDialog"
),
String
result
=
JOptionPane
.
showInputDialog
(
this
,
NLS
.
str
(
"preferences.excludedPackages.editDialog"
),
settings
.
getExcludedPackages
());
settings
.
getExcludedPackages
());
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
settings
.
setExcludedPackages
(
result
);
settings
.
setExcludedPackages
(
result
);
}
}
});
});
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/ApkSignature.java
View file @
bcaca781
package
jadx
.
gui
.
treemodel
;
package
jadx
.
gui
.
treemodel
;
import
javax.swing.*
;
import
java.io.File
;
import
java.security.cert.Certificate
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.android.apksig.ApkVerifier
;
import
com.android.apksig.ApkVerifier
;
import
jadx.api.ResourceType
;
import
jadx.gui.JadxWrapper
;
import
jadx.gui.utils.CertificateManager
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.apache.commons.text.StringEscapeUtils
;
import
org.apache.commons.text.StringEscapeUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.swing.*
;
import
jadx.gui.JadxWrapper
;
import
java.io.File
;
import
jadx.gui.utils.CertificateManager
;
import
java.security.cert.Certificate
;
import
jadx.gui.utils.NLS
;
import
java.util.List
;
import
jadx.gui.utils.Utils
;
import
java.util.stream.Collectors
;
public
class
ApkSignature
extends
JNode
{
public
class
ApkSignature
extends
JNode
{
private
static
final
long
serialVersionUID
=
-
9121321926113143407L
;
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ApkSignature
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ApkSignature
.
class
);
private
static
final
ImageIcon
CERTIFICATE_ICON
=
Utils
.
openIcon
(
"certificate_obj"
);
private
static
final
ImageIcon
CERTIFICATE_ICON
=
Utils
.
openIcon
(
"certificate_obj"
);
private
final
transient
File
openFile
;
private
final
transient
File
openFile
;
private
String
content
=
null
;
private
String
content
;
public
static
ApkSignature
getApkSignature
(
JadxWrapper
wrapper
)
{
public
static
ApkSignature
getApkSignature
(
JadxWrapper
wrapper
)
{
// Only show the ApkSignature node if an AndroidManifest.xml is present.
// Only show the ApkSignature node if an AndroidManifest.xml is present.
// Without a manifest the Google ApkVerifier refuses to work.
// Without a manifest the Google ApkVerifier refuses to work.
if
(
!
wrapper
.
getResources
().
stream
().
any
Match
(
r
->
"AndroidManifest.xml"
.
equals
(
r
.
getName
())))
{
if
(
wrapper
.
getResources
().
stream
().
none
Match
(
r
->
"AndroidManifest.xml"
.
equals
(
r
.
getName
())))
{
return
null
;
return
null
;
}
}
File
openFile
=
wrapper
.
getOpenFile
();
File
openFile
=
wrapper
.
getOpenFile
();
...
@@ -56,8 +58,9 @@ public class ApkSignature extends JNode {
...
@@ -56,8 +58,9 @@ public class ApkSignature extends JNode {
@Override
@Override
public
String
getContent
()
{
public
String
getContent
()
{
if
(
content
!=
null
)
if
(
content
!=
null
)
{
return
this
.
content
;
return
this
.
content
;
}
ApkVerifier
verifier
=
new
ApkVerifier
.
Builder
(
openFile
).
build
();
ApkVerifier
verifier
=
new
ApkVerifier
.
Builder
(
openFile
).
build
();
try
{
try
{
ApkVerifier
.
Result
result
=
verifier
.
verify
();
ApkVerifier
.
Result
result
=
verifier
.
verify
();
...
@@ -80,7 +83,7 @@ public class ApkSignature extends JNode {
...
@@ -80,7 +83,7 @@ public class ApkSignature extends JNode {
writeIssues
(
builder
,
err
,
result
.
getErrors
());
writeIssues
(
builder
,
err
,
result
.
getErrors
());
writeIssues
(
builder
,
warn
,
result
.
getWarnings
());
writeIssues
(
builder
,
warn
,
result
.
getWarnings
());
if
(
result
.
getV1SchemeSigners
().
size
()
>
0
)
{
if
(
!
result
.
getV1SchemeSigners
().
isEmpty
()
)
{
builder
.
append
(
"<h2>"
);
builder
.
append
(
"<h2>"
);
builder
.
escape
(
String
.
format
(
result
.
isVerifiedUsingV1Scheme
()
?
sigSucc
:
sigFail
,
1
));
builder
.
escape
(
String
.
format
(
result
.
isVerifiedUsingV1Scheme
()
?
sigSucc
:
sigFail
,
1
));
builder
.
append
(
"</h2>\n"
);
builder
.
append
(
"</h2>\n"
);
...
@@ -101,7 +104,7 @@ public class ApkSignature extends JNode {
...
@@ -101,7 +104,7 @@ public class ApkSignature extends JNode {
}
}
builder
.
append
(
"</blockquote>"
);
builder
.
append
(
"</blockquote>"
);
}
}
if
(
result
.
getV2SchemeSigners
().
size
()
>
0
)
{
if
(
!
result
.
getV2SchemeSigners
().
isEmpty
()
)
{
builder
.
append
(
"<h2>"
);
builder
.
append
(
"<h2>"
);
builder
.
escape
(
String
.
format
(
result
.
isVerifiedUsingV2Scheme
()
?
sigSucc
:
sigFail
,
2
));
builder
.
escape
(
String
.
format
(
result
.
isVerifiedUsingV2Scheme
()
?
sigSucc
:
sigFail
,
2
));
builder
.
append
(
"</h2>\n"
);
builder
.
append
(
"</h2>\n"
);
...
@@ -121,7 +124,7 @@ public class ApkSignature extends JNode {
...
@@ -121,7 +124,7 @@ public class ApkSignature extends JNode {
}
}
this
.
content
=
builder
.
toString
();
this
.
content
=
builder
.
toString
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
LOG
.
error
(
e
.
getMessage
(),
e
);
StringEscapeUtils
.
Builder
builder
=
StringEscapeUtils
.
builder
(
StringEscapeUtils
.
ESCAPE_HTML4
);
StringEscapeUtils
.
Builder
builder
=
StringEscapeUtils
.
builder
(
StringEscapeUtils
.
ESCAPE_HTML4
);
builder
.
append
(
"<h1>"
);
builder
.
append
(
"<h1>"
);
builder
.
escape
(
NLS
.
str
(
"apkSignature.exception"
));
builder
.
escape
(
NLS
.
str
(
"apkSignature.exception"
));
...
@@ -147,7 +150,7 @@ public class ApkSignature extends JNode {
...
@@ -147,7 +150,7 @@ public class ApkSignature extends JNode {
}
}
private
void
writeIssues
(
StringEscapeUtils
.
Builder
builder
,
String
issueType
,
List
<
ApkVerifier
.
IssueWithParams
>
issueList
)
{
private
void
writeIssues
(
StringEscapeUtils
.
Builder
builder
,
String
issueType
,
List
<
ApkVerifier
.
IssueWithParams
>
issueList
)
{
if
(
issueList
.
size
()
>
0
)
{
if
(
!
issueList
.
isEmpty
()
)
{
builder
.
append
(
"<h3>"
);
builder
.
append
(
"<h3>"
);
builder
.
escape
(
issueType
);
builder
.
escape
(
issueType
);
builder
.
append
(
"</h3>"
);
builder
.
append
(
"</h3>"
);
...
@@ -155,7 +158,7 @@ public class ApkSignature extends JNode {
...
@@ -155,7 +158,7 @@ public class ApkSignature extends JNode {
// Unprotected Zip entry issues are very common, handle them separately
// Unprotected Zip entry issues are very common, handle them separately
List
<
ApkVerifier
.
IssueWithParams
>
unprotIssues
=
issueList
.
stream
().
filter
(
i
->
List
<
ApkVerifier
.
IssueWithParams
>
unprotIssues
=
issueList
.
stream
().
filter
(
i
->
i
.
getIssue
()
==
ApkVerifier
.
Issue
.
JAR_SIG_UNPROTECTED_ZIP_ENTRY
).
collect
(
Collectors
.
toList
());
i
.
getIssue
()
==
ApkVerifier
.
Issue
.
JAR_SIG_UNPROTECTED_ZIP_ENTRY
).
collect
(
Collectors
.
toList
());
if
(
unprotIssues
.
size
()
>
0
)
{
if
(
!
unprotIssues
.
isEmpty
()
)
{
builder
.
append
(
"<h4>"
);
builder
.
append
(
"<h4>"
);
builder
.
escape
(
NLS
.
str
(
"apkSignature.unprotectedEntry"
));
builder
.
escape
(
NLS
.
str
(
"apkSignature.unprotectedEntry"
));
builder
.
append
(
"</h4><blockquote>"
);
builder
.
append
(
"</h4><blockquote>"
);
...
@@ -167,7 +170,7 @@ public class ApkSignature extends JNode {
...
@@ -167,7 +170,7 @@ public class ApkSignature extends JNode {
}
}
List
<
ApkVerifier
.
IssueWithParams
>
remainingIssues
=
issueList
.
stream
().
filter
(
i
->
List
<
ApkVerifier
.
IssueWithParams
>
remainingIssues
=
issueList
.
stream
().
filter
(
i
->
i
.
getIssue
()
!=
ApkVerifier
.
Issue
.
JAR_SIG_UNPROTECTED_ZIP_ENTRY
).
collect
(
Collectors
.
toList
());
i
.
getIssue
()
!=
ApkVerifier
.
Issue
.
JAR_SIG_UNPROTECTED_ZIP_ENTRY
).
collect
(
Collectors
.
toList
());
if
(
remainingIssues
.
size
()
>
0
)
{
if
(
!
remainingIssues
.
isEmpty
()
)
{
builder
.
append
(
"<pre>\n"
);
builder
.
append
(
"<pre>\n"
);
for
(
ApkVerifier
.
IssueWithParams
issue
:
remainingIssues
)
{
for
(
ApkVerifier
.
IssueWithParams
issue
:
remainingIssues
)
{
builder
.
escape
(
issue
.
toString
());
builder
.
escape
(
issue
.
toString
());
...
@@ -177,8 +180,5 @@ public class ApkSignature extends JNode {
...
@@ -177,8 +180,5 @@ public class ApkSignature extends JNode {
}
}
builder
.
append
(
"</blockquote>"
);
builder
.
append
(
"</blockquote>"
);
}
}
}
}
}
}
jadx-gui/src/main/java/jadx/gui/treemodel/JSources.java
View file @
bcaca781
...
@@ -85,7 +85,7 @@ public class JSources extends JNode {
...
@@ -85,7 +85,7 @@ public class JSources extends JNode {
}
}
}
}
// use identity set for collect inner packages
// use identity set for collect inner packages
Set
<
JPackage
>
innerPackages
=
Collections
.
newSetFromMap
(
new
IdentityHashMap
<
JPackage
,
Boolean
>());
Set
<
JPackage
>
innerPackages
=
Collections
.
newSetFromMap
(
new
IdentityHashMap
<>());
for
(
JPackage
pkg
:
pkgMap
.
values
())
{
for
(
JPackage
pkg
:
pkgMap
.
values
())
{
innerPackages
.
addAll
(
pkg
.
getInnerPackages
());
innerPackages
.
addAll
(
pkg
.
getInnerPackages
());
}
}
...
...
jadx-gui/src/main/java/jadx/gui/ui/AboutDialog.java
View file @
bcaca781
...
@@ -2,8 +2,6 @@ package jadx.gui.ui;
...
@@ -2,8 +2,6 @@ package jadx.gui.ui;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.JadxDecompiler
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.NLS
;
...
@@ -42,11 +40,7 @@ class AboutDialog extends JDialog {
...
@@ -42,11 +40,7 @@ class AboutDialog extends JDialog {
textPane
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
0
,
20
)));
textPane
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
0
,
20
)));
JButton
close
=
new
JButton
(
NLS
.
str
(
"tabs.close"
));
JButton
close
=
new
JButton
(
NLS
.
str
(
"tabs.close"
));
close
.
addActionListener
(
new
ActionListener
()
{
close
.
addActionListener
(
event
->
dispose
());
public
void
actionPerformed
(
ActionEvent
event
)
{
dispose
();
}
});
close
.
setAlignmentX
(
0.5f
);
close
.
setAlignmentX
(
0.5f
);
Container
contentPane
=
getContentPane
();
Container
contentPane
=
getContentPane
();
...
...
jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
View file @
bcaca781
...
@@ -33,14 +33,14 @@ import jadx.gui.jobs.DecompileJob;
...
@@ -33,14 +33,14 @@ import jadx.gui.jobs.DecompileJob;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.ui.codearea.CodeArea
;
import
jadx.gui.ui.codearea.CodeArea
;
import
jadx.gui.utils.CacheObject
;
import
jadx.gui.utils.CacheObject
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.search.TextSearchIndex
;
import
jadx.gui.utils.search.TextSearchIndex
;
public
abstract
class
CommonSearchDialog
extends
JDialog
{
public
abstract
class
CommonSearchDialog
extends
JDialog
{
private
static
final
long
serialVersionUID
=
8939332306115370276L
;
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
CommonSearchDialog
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
CommonSearchDialog
.
class
);
private
static
final
long
serialVersionUID
=
8939332306115370276L
;
public
static
final
int
RESULTS_PER_PAGE
=
100
;
public
static
final
int
RESULTS_PER_PAGE
=
100
;
...
@@ -399,7 +399,7 @@ public abstract class CommonSearchDialog extends JDialog {
...
@@ -399,7 +399,7 @@ public abstract class CommonSearchDialog extends JDialog {
private
final
JLabel
emptyLabel
=
new
JLabel
();
private
final
JLabel
emptyLabel
=
new
JLabel
();
private
final
Color
codeSelectedColor
;
private
final
Color
codeSelectedColor
;
private
final
Color
codeBackground
;
private
final
Color
codeBackground
;
private
Map
<
Integer
,
Component
>
componentCache
=
new
HashMap
<>();
private
final
Map
<
Integer
,
Component
>
componentCache
=
new
HashMap
<>();
public
ResultsTableCellRenderer
()
{
public
ResultsTableCellRenderer
()
{
RSyntaxTextArea
area
=
CodeArea
.
getDefaultArea
(
mainWindow
);
RSyntaxTextArea
area
=
CodeArea
.
getDefaultArea
(
mainWindow
);
...
...
jadx-gui/src/main/java/jadx/gui/ui/HeapUsageBar.java
View file @
bcaca781
package
jadx
.
gui
.
ui
;
package
jadx
.
gui
.
ui
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ActionListener
;
public
class
HeapUsageBar
extends
JProgressBar
implements
ActionListener
{
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
private
static
final
double
TWO_TO_20
=
1048576
d
;
// 1024 * 1024
private
final
Color
GREEN
=
new
Color
(
0
,
180
,
0
);
private
final
Color
RED
=
new
Color
(
200
,
0
,
0
);
private
final
Runtime
r
;
public
class
HeapUsageBar
extends
JProgressBar
implements
ActionListener
{
private
static
final
long
serialVersionUID
=
-
8739563124249884967L
;
private
String
maxHeapStr
;
private
static
final
double
TWO_TO_20
=
1048576
d
;
private
final
Timer
timer
;
private
static
final
Color
GREEN
=
new
Color
(
0
,
180
,
0
);
private
static
final
Color
RED
=
new
Color
(
200
,
0
,
0
);
private
final
double
maxGB
;
private
final
transient
Runtime
runtime
=
Runtime
.
getRuntime
();
private
final
transient
Timer
timer
;
private
final
String
textFormat
;
private
final
String
textFormat
;
private
final
double
maxGB
;
public
HeapUsageBar
()
{
public
HeapUsageBar
()
{
super
();
this
.
textFormat
=
NLS
.
str
(
"heapUsage.text"
);
textFormat
=
NLS
.
str
(
"heapUsage.text"
);
r
=
Runtime
.
getRuntime
();
setBorderPainted
(
false
);
setBorderPainted
(
false
);
setStringPainted
(
true
);
setStringPainted
(
true
);
setValue
(
10
);
setValue
(
10
);
int
maxKB
=
(
int
)
(
r
.
maxMemory
()
/
1024
);
int
maxKB
=
(
int
)
(
r
untime
.
maxMemory
()
/
1024
);
setMaximum
(
maxKB
);
setMaximum
(
maxKB
);
maxGB
=
maxKB
/
TWO_TO_20
;
maxGB
=
maxKB
/
TWO_TO_20
;
update
();
update
();
...
@@ -40,12 +35,12 @@ public class HeapUsageBar extends JProgressBar implements ActionListener {
...
@@ -40,12 +35,12 @@ public class HeapUsageBar extends JProgressBar implements ActionListener {
}
}
public
void
update
()
{
public
void
update
()
{
long
used
=
r
.
totalMemory
()
-
r
.
freeMemory
();
long
used
=
r
untime
.
totalMemory
()
-
runtime
.
freeMemory
();
int
usedKB
=
(
int
)
(
used
/
1024
);
int
usedKB
=
(
int
)
(
used
/
1024
);
setValue
(
usedKB
);
setValue
(
usedKB
);
setString
(
String
.
format
(
textFormat
,
(
usedKB
/
TWO_TO_20
),
maxGB
));
setString
(
String
.
format
(
textFormat
,
(
usedKB
/
TWO_TO_20
),
maxGB
));
if
((
used
+
Utils
.
MIN_FREE_MEMORY
)
>
r
.
maxMemory
())
{
if
((
used
+
Utils
.
MIN_FREE_MEMORY
)
>
r
untime
.
maxMemory
())
{
setForeground
(
RED
);
setForeground
(
RED
);
}
else
{
}
else
{
setForeground
(
GREEN
);
setForeground
(
GREEN
);
...
...
jadx-gui/src/main/java/jadx/gui/ui/HtmlPanel.java
View file @
bcaca781
package
jadx
.
gui
.
ui
;
package
jadx
.
gui
.
ui
;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.ui.codearea.CodeArea
;
import
org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
;
import
javax.swing.*
;
import
javax.swing.*
;
import
javax.swing.event.DocumentEvent
;
import
javax.swing.event.DocumentListener
;
import
javax.swing.plaf.PanelUI
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.event.KeyEvent
;
import
java.awt.event.KeyListener
;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.treemodel.JNode
;
public
final
class
HtmlPanel
extends
ContentPanel
{
public
final
class
HtmlPanel
extends
ContentPanel
{
private
static
final
long
serialVersionUID
=
-
6251262855835426245L
;
private
static
final
long
serialVersionUID
=
-
6251262855835426245L
;
...
@@ -36,14 +29,14 @@ public final class HtmlPanel extends ContentPanel {
...
@@ -36,14 +29,14 @@ public final class HtmlPanel extends ContentPanel {
textArea
.
setFont
(
settings
.
getFont
());
textArea
.
setFont
(
settings
.
getFont
());
}
}
private
static
class
JHtmlPane
extends
JEditorPane
{
private
static
final
class
JHtmlPane
extends
JEditorPane
{
private
static
final
long
serialVersionUID
=
6886040384052136157L
;
boolean
antiAliasingEnabled
;
public
JHtmlPane
()
{
public
JHtmlPane
()
{
setContentType
(
"text/html"
);
setContentType
(
"text/html"
);
}
}
@Override
public
void
paint
(
Graphics
g
)
{
public
void
paint
(
Graphics
g
)
{
Graphics2D
g2d
=
(
Graphics2D
)
g
.
create
();
Graphics2D
g2d
=
(
Graphics2D
)
g
.
create
();
try
{
try
{
...
@@ -53,6 +46,5 @@ public final class HtmlPanel extends ContentPanel {
...
@@ -53,6 +46,5 @@ public final class HtmlPanel extends ContentPanel {
g2d
.
dispose
();
g2d
.
dispose
();
}
}
}
}
}
}
}
}
jadx-gui/src/main/java/jadx/gui/ui/MainDropTarget.java
View file @
bcaca781
...
@@ -59,7 +59,7 @@ public class MainDropTarget implements DropTargetListener {
...
@@ -59,7 +59,7 @@ public class MainDropTarget implements DropTargetListener {
try
{
try
{
Transferable
transferable
=
dtde
.
getTransferable
();
Transferable
transferable
=
dtde
.
getTransferable
();
List
<
File
>
transferData
=
(
List
<
File
>)
transferable
.
getTransferData
(
DataFlavor
.
javaFileListFlavor
);
List
<
File
>
transferData
=
(
List
<
File
>)
transferable
.
getTransferData
(
DataFlavor
.
javaFileListFlavor
);
if
(
transferData
!=
null
&&
transferData
.
size
()
>
0
)
{
if
(
!
transferData
.
isEmpty
()
)
{
dtde
.
dropComplete
(
true
);
dtde
.
dropComplete
(
true
);
// load first file
// load first file
mainWindow
.
openFile
(
transferData
.
get
(
0
));
mainWindow
.
openFile
(
transferData
.
get
(
0
));
...
...
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
bcaca781
...
@@ -9,7 +9,6 @@ import javax.swing.filechooser.FileNameExtensionFilter;
...
@@ -9,7 +9,6 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultMutableTreeNode
;
import
javax.swing.tree.DefaultTreeCellRenderer
;
import
javax.swing.tree.DefaultTreeCellRenderer
;
import
javax.swing.tree.DefaultTreeModel
;
import
javax.swing.tree.DefaultTreeModel
;
import
javax.swing.tree.ExpandVetoException
;
import
javax.swing.tree.TreeNode
;
import
javax.swing.tree.TreeNode
;
import
javax.swing.tree.TreePath
;
import
javax.swing.tree.TreePath
;
import
javax.swing.tree.TreeSelectionModel
;
import
javax.swing.tree.TreeSelectionModel
;
...
@@ -28,7 +27,6 @@ import java.util.Arrays;
...
@@ -28,7 +27,6 @@ import java.util.Arrays;
import
java.util.Timer
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
java.util.TimerTask
;
import
jadx.gui.treemodel.*
;
import
org.fife.ui.rsyntaxtextarea.Theme
;
import
org.fife.ui.rsyntaxtextarea.Theme
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -40,13 +38,20 @@ import jadx.gui.jobs.DecompileJob;
...
@@ -40,13 +38,20 @@ import jadx.gui.jobs.DecompileJob;
import
jadx.gui.jobs.IndexJob
;
import
jadx.gui.jobs.IndexJob
;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.settings.JadxSettingsWindow
;
import
jadx.gui.settings.JadxSettingsWindow
;
import
jadx.gui.treemodel.ApkSignature
;
import
jadx.gui.treemodel.JCertificate
;
import
jadx.gui.treemodel.JClass
;
import
jadx.gui.treemodel.JLoadableNode
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.treemodel.JResource
;
import
jadx.gui.treemodel.JRoot
;
import
jadx.gui.update.JadxUpdate
;
import
jadx.gui.update.JadxUpdate
;
import
jadx.gui.update.JadxUpdate.IUpdateCallback
;
import
jadx.gui.update.JadxUpdate.IUpdateCallback
;
import
jadx.gui.update.data.Release
;
import
jadx.gui.update.data.Release
;
import
jadx.gui.utils.CacheObject
;
import
jadx.gui.utils.CacheObject
;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.Link
;
import
jadx.gui.utils.Link
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
import
static
javax
.
swing
.
KeyStroke
.
getKeyStroke
;
import
static
javax
.
swing
.
KeyStroke
.
getKeyStroke
;
...
@@ -90,7 +95,6 @@ public class MainWindow extends JFrame {
...
@@ -90,7 +95,6 @@ public class MainWindow extends JFrame {
private
boolean
isFlattenPackage
;
private
boolean
isFlattenPackage
;
private
JToggleButton
flatPkgButton
;
private
JToggleButton
flatPkgButton
;
private
JCheckBoxMenuItem
flatPkgMenuItem
;
private
JCheckBoxMenuItem
flatPkgMenuItem
;
private
JCheckBoxMenuItem
heapUsageBarMenuItem
;
private
JToggleButton
deobfToggleBtn
;
private
JToggleButton
deobfToggleBtn
;
private
JCheckBoxMenuItem
deobfMenuItem
;
private
JCheckBoxMenuItem
deobfMenuItem
;
...
@@ -382,7 +386,7 @@ public class MainWindow extends JFrame {
...
@@ -382,7 +386,7 @@ public class MainWindow extends JFrame {
flatPkgMenuItem
=
new
JCheckBoxMenuItem
(
NLS
.
str
(
"menu.flatten"
),
ICON_FLAT_PKG
);
flatPkgMenuItem
=
new
JCheckBoxMenuItem
(
NLS
.
str
(
"menu.flatten"
),
ICON_FLAT_PKG
);
flatPkgMenuItem
.
setState
(
isFlattenPackage
);
flatPkgMenuItem
.
setState
(
isFlattenPackage
);
heapUsageBarMenuItem
=
new
JCheckBoxMenuItem
(
NLS
.
str
(
"menu.heapUsageBar"
));
JCheckBoxMenuItem
heapUsageBarMenuItem
=
new
JCheckBoxMenuItem
(
NLS
.
str
(
"menu.heapUsageBar"
));
heapUsageBarMenuItem
.
setState
(
settings
.
isShowHeapUsageBar
());
heapUsageBarMenuItem
.
setState
(
settings
.
isShowHeapUsageBar
());
heapUsageBarMenuItem
.
addActionListener
(
event
->
{
heapUsageBarMenuItem
.
addActionListener
(
event
->
{
settings
.
setShowHeapUsageBar
(!
settings
.
isShowHeapUsageBar
());
settings
.
setShowHeapUsageBar
(!
settings
.
isShowHeapUsageBar
());
...
@@ -589,7 +593,7 @@ public class MainWindow extends JFrame {
...
@@ -589,7 +593,7 @@ public class MainWindow extends JFrame {
});
});
tree
.
addTreeWillExpandListener
(
new
TreeWillExpandListener
()
{
tree
.
addTreeWillExpandListener
(
new
TreeWillExpandListener
()
{
@Override
@Override
public
void
treeWillExpand
(
TreeExpansionEvent
event
)
throws
ExpandVetoException
{
public
void
treeWillExpand
(
TreeExpansionEvent
event
)
{
TreePath
path
=
event
.
getPath
();
TreePath
path
=
event
.
getPath
();
Object
node
=
path
.
getLastPathComponent
();
Object
node
=
path
.
getLastPathComponent
();
if
(
node
instanceof
JLoadableNode
)
{
if
(
node
instanceof
JLoadableNode
)
{
...
@@ -598,7 +602,8 @@ public class MainWindow extends JFrame {
...
@@ -598,7 +602,8 @@ public class MainWindow extends JFrame {
}
}
@Override
@Override
public
void
treeWillCollapse
(
TreeExpansionEvent
event
)
throws
ExpandVetoException
{
public
void
treeWillCollapse
(
TreeExpansionEvent
event
)
{
// ignore
}
}
});
});
...
...
jadx-gui/src/main/java/jadx/gui/ui/TabbedPane.java
View file @
bcaca781
package
jadx
.
gui
.
ui
;
package
jadx
.
gui
.
ui
;
import
javax.swing.*
;
import
javax.swing.plaf.basic.BasicButtonUI
;
import
javax.swing.text.BadLocationException
;
import
java.awt.*
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
jadx.api.ResourceFile
;
import
jadx.api.ResourceFile
;
import
jadx.api.ResourceType
;
import
jadx.api.ResourceType
;
import
jadx.gui.treemodel.ApkSignature
;
import
jadx.gui.treemodel.ApkSignature
;
...
@@ -13,29 +28,6 @@ import jadx.gui.utils.JumpManager;
...
@@ -13,29 +28,6 @@ import jadx.gui.utils.JumpManager;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.JumpPosition
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
import
org.jetbrains.annotations.Nullable
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.swing.BorderFactory
;
import
javax.swing.ImageIcon
;
import
javax.swing.JButton
;
import
javax.swing.JLabel
;
import
javax.swing.JMenuItem
;
import
javax.swing.JPanel
;
import
javax.swing.JPopupMenu
;
import
javax.swing.JTabbedPane
;
import
javax.swing.SwingUtilities
;
import
javax.swing.plaf.basic.BasicButtonUI
;
import
javax.swing.text.BadLocationException
;
import
java.awt.Component
;
import
java.awt.FlowLayout
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
TabbedPane
extends
JTabbedPane
{
public
class
TabbedPane
extends
JTabbedPane
{
...
...
jadx-gui/src/main/java/jadx/gui/ui/codearea/LineNumbers.java
View file @
bcaca781
...
@@ -32,16 +32,16 @@ public class LineNumbers extends JPanel implements CaretListener {
...
@@ -32,16 +32,16 @@ public class LineNumbers extends JPanel implements CaretListener {
private
static
final
int
NUM_HEIGHT
=
Integer
.
MAX_VALUE
-
1000000
;
private
static
final
int
NUM_HEIGHT
=
Integer
.
MAX_VALUE
-
1000000
;
private
static
final
Map
<?,
?>
DESKTOP_HINTS
=
(
Map
<?,
?>)
Toolkit
.
getDefaultToolkit
().
getDesktopProperty
(
"awt.font.desktophints"
);
private
static
final
Map
<?,
?>
DESKTOP_HINTS
=
(
Map
<?,
?>)
Toolkit
.
getDefaultToolkit
().
getDesktopProperty
(
"awt.font.desktophints"
);
private
CodeArea
codeArea
;
private
final
CodeArea
codeArea
;
private
boolean
useSourceLines
=
true
;
private
boolean
useSourceLines
=
true
;
private
int
lastDigits
;
private
int
lastDigits
;
private
int
lastLine
;
private
int
lastLine
;
private
Map
<
String
,
FontMetrics
>
fonts
;
private
Map
<
String
,
FontMetrics
>
fonts
;
private
transient
final
Color
numberColor
;
private
final
transient
Color
numberColor
;
private
transient
final
Color
currentColor
;
private
final
transient
Color
currentColor
;
private
transient
final
Border
border
;
private
final
transient
Border
border
;
public
LineNumbers
(
CodeArea
component
)
{
public
LineNumbers
(
CodeArea
component
)
{
this
.
codeArea
=
component
;
this
.
codeArea
=
component
;
...
@@ -199,12 +199,10 @@ public class LineNumbers extends JPanel implements CaretListener {
...
@@ -199,12 +199,10 @@ public class LineNumbers extends JPanel implements CaretListener {
String
fontFamily
=
(
String
)
as
.
getAttribute
(
StyleConstants
.
FontFamily
);
String
fontFamily
=
(
String
)
as
.
getAttribute
(
StyleConstants
.
FontFamily
);
Integer
fontSize
=
(
Integer
)
as
.
getAttribute
(
StyleConstants
.
FontSize
);
Integer
fontSize
=
(
Integer
)
as
.
getAttribute
(
StyleConstants
.
FontSize
);
String
key
=
fontFamily
+
fontSize
;
String
key
=
fontFamily
+
fontSize
;
FontMetrics
fm
=
fonts
.
get
(
key
);
FontMetrics
fm
=
fonts
.
computeIfAbsent
(
key
,
k
->
{
if
(
fm
==
null
)
{
Font
font
=
new
Font
(
fontFamily
,
Font
.
PLAIN
,
fontSize
);
Font
font
=
new
Font
(
fontFamily
,
Font
.
PLAIN
,
fontSize
);
fm
=
codeArea
.
getFontMetrics
(
font
);
return
codeArea
.
getFontMetrics
(
font
);
fonts
.
put
(
key
,
fm
);
});
}
descent
=
Math
.
max
(
descent
,
fm
.
getDescent
());
descent
=
Math
.
max
(
descent
,
fm
.
getDescent
());
}
}
}
}
...
...
jadx-gui/src/main/java/jadx/gui/update/JadxUpdate.java
View file @
bcaca781
...
@@ -6,9 +6,8 @@ import java.io.Reader;
...
@@ -6,9 +6,8 @@ import java.io.Reader;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.
util.Collection
s
;
import
java.
nio.charset.StandardCharset
s
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -32,12 +31,8 @@ public class JadxUpdate {
...
@@ -32,12 +31,8 @@ public class JadxUpdate {
private
static
final
Type
RELEASES_LIST_TYPE
=
new
TypeToken
<
List
<
Release
>>()
{
private
static
final
Type
RELEASES_LIST_TYPE
=
new
TypeToken
<
List
<
Release
>>()
{
}.
getType
();
}.
getType
();
private
static
final
Comparator
<
Release
>
RELEASE_COMPARATOR
=
new
Comparator
<
Release
>()
{
private
static
final
Comparator
<
Release
>
RELEASE_COMPARATOR
=
(
o1
,
o2
)
->
@Override
VersionComparator
.
checkAndCompare
(
o1
.
getName
(),
o2
.
getName
());
public
int
compare
(
Release
o1
,
Release
o2
)
{
return
VersionComparator
.
checkAndCompare
(
o1
.
getName
(),
o2
.
getName
());
}
};
public
interface
IUpdateCallback
{
public
interface
IUpdateCallback
{
void
onUpdate
(
Release
r
);
void
onUpdate
(
Release
r
);
...
@@ -47,9 +42,7 @@ public class JadxUpdate {
...
@@ -47,9 +42,7 @@ public class JadxUpdate {
}
}
public
static
void
check
(
final
IUpdateCallback
callback
)
{
public
static
void
check
(
final
IUpdateCallback
callback
)
{
Runnable
run
=
new
Runnable
()
{
Runnable
run
=
()
->
{
@Override
public
void
run
()
{
try
{
try
{
Release
release
=
checkForNewRelease
();
Release
release
=
checkForNewRelease
();
if
(
release
!=
null
)
{
if
(
release
!=
null
)
{
...
@@ -58,7 +51,6 @@ public class JadxUpdate {
...
@@ -58,7 +51,6 @@ public class JadxUpdate {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
debug
(
"Jadx update error"
,
e
);
LOG
.
debug
(
"Jadx update error"
,
e
);
}
}
}
};
};
Thread
thread
=
new
Thread
(
run
);
Thread
thread
=
new
Thread
(
run
);
thread
.
setName
(
"Jadx update thread"
);
thread
.
setName
(
"Jadx update thread"
);
...
@@ -77,17 +69,11 @@ public class JadxUpdate {
...
@@ -77,17 +69,11 @@ public class JadxUpdate {
if
(
list
==
null
)
{
if
(
list
==
null
)
{
return
null
;
return
null
;
}
}
for
(
Iterator
<
Release
>
it
=
list
.
iterator
();
it
.
hasNext
();
)
{
list
.
removeIf
(
release
->
release
.
getName
().
equalsIgnoreCase
(
version
)
||
release
.
isPreRelease
());
Release
release
=
it
.
next
();
if
(
release
.
getName
().
equalsIgnoreCase
(
version
)
||
release
.
isPreRelease
())
{
it
.
remove
();
}
}
if
(
list
.
isEmpty
())
{
if
(
list
.
isEmpty
())
{
return
null
;
return
null
;
}
}
Collections
.
sort
(
list
,
RELEASE_COMPARATOR
);
list
.
sort
(
RELEASE_COMPARATOR
);
Release
latest
=
list
.
get
(
list
.
size
()
-
1
);
Release
latest
=
list
.
get
(
list
.
size
()
-
1
);
if
(
VersionComparator
.
checkAndCompare
(
version
,
latest
.
getName
())
>=
0
)
{
if
(
VersionComparator
.
checkAndCompare
(
version
,
latest
.
getName
())
>=
0
)
{
return
null
;
return
null
;
...
@@ -101,7 +87,7 @@ public class JadxUpdate {
...
@@ -101,7 +87,7 @@ public class JadxUpdate {
HttpURLConnection
con
=
(
HttpURLConnection
)
obj
.
openConnection
();
HttpURLConnection
con
=
(
HttpURLConnection
)
obj
.
openConnection
();
con
.
setRequestMethod
(
"GET"
);
con
.
setRequestMethod
(
"GET"
);
if
(
con
.
getResponseCode
()
==
200
)
{
if
(
con
.
getResponseCode
()
==
200
)
{
Reader
reader
=
new
InputStreamReader
(
con
.
getInputStream
(),
"UTF-8"
);
Reader
reader
=
new
InputStreamReader
(
con
.
getInputStream
(),
StandardCharsets
.
UTF_8
);
return
GSON
.
fromJson
(
reader
,
type
);
return
GSON
.
fromJson
(
reader
,
type
);
}
}
return
null
;
return
null
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/CertificateManager.java
View file @
bcaca781
...
@@ -21,8 +21,8 @@ public class CertificateManager {
...
@@ -21,8 +21,8 @@ public class CertificateManager {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
CertificateManager
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
CertificateManager
.
class
);
private
static
final
String
CERTIFICATE_TYPE_NAME
=
"X.509"
;
private
static
final
String
CERTIFICATE_TYPE_NAME
=
"X.509"
;
private
final
Certificate
cert
;
private
X509Certificate
x509cert
;
private
X509Certificate
x509cert
;
private
Certificate
cert
;
public
static
String
decode
(
InputStream
in
)
{
public
static
String
decode
(
InputStream
in
)
{
StringBuilder
strBuild
=
new
StringBuilder
();
StringBuilder
strBuild
=
new
StringBuilder
();
...
...
jadx-gui/src/main/java/jadx/gui/utils/CodeLinesInfo.java
View file @
bcaca781
...
@@ -9,7 +9,7 @@ import jadx.api.JavaMethod;
...
@@ -9,7 +9,7 @@ import jadx.api.JavaMethod;
import
jadx.api.JavaNode
;
import
jadx.api.JavaNode
;
public
class
CodeLinesInfo
{
public
class
CodeLinesInfo
{
private
NavigableMap
<
Integer
,
JavaNode
>
map
=
new
TreeMap
<>();
private
final
NavigableMap
<
Integer
,
JavaNode
>
map
=
new
TreeMap
<>();
public
CodeLinesInfo
(
JavaClass
cls
)
{
public
CodeLinesInfo
(
JavaClass
cls
)
{
addClass
(
cls
);
addClass
(
cls
);
...
...
jadx-gui/src/main/java/jadx/gui/utils/CodeUsageInfo.java
View file @
bcaca781
...
@@ -2,7 +2,6 @@ package jadx.gui.utils;
...
@@ -2,7 +2,6 @@ package jadx.gui.utils;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/JumpManager.java
View file @
bcaca781
...
@@ -5,7 +5,7 @@ import java.util.List;
...
@@ -5,7 +5,7 @@ import java.util.List;
public
class
JumpManager
{
public
class
JumpManager
{
private
List
<
JumpPosition
>
list
=
new
ArrayList
<>();
private
final
List
<
JumpPosition
>
list
=
new
ArrayList
<>();
private
int
currentPos
=
0
;
private
int
currentPos
=
0
;
public
void
addPosition
(
JumpPosition
pos
)
{
public
void
addPosition
(
JumpPosition
pos
)
{
...
...
jadx-gui/src/main/java/jadx/gui/utils/LangLocale.java
View file @
bcaca781
...
@@ -3,7 +3,7 @@ package jadx.gui.utils;
...
@@ -3,7 +3,7 @@ package jadx.gui.utils;
import
java.util.Locale
;
import
java.util.Locale
;
public
class
LangLocale
{
public
class
LangLocale
{
private
Locale
locale
;
private
final
Locale
locale
;
public
LangLocale
(
Locale
locale
)
{
public
LangLocale
(
Locale
locale
)
{
this
.
locale
=
locale
;
this
.
locale
=
locale
;
...
...
jadx-gui/src/main/java/jadx/gui/utils/Link.java
View file @
bcaca781
...
@@ -16,7 +16,7 @@ public class Link extends JLabel implements MouseListener {
...
@@ -16,7 +16,7 @@ public class Link extends JLabel implements MouseListener {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
Link
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
Link
.
class
);
private
String
url
;
private
final
String
url
;
public
Link
(
String
text
,
String
url
)
{
public
Link
(
String
text
,
String
url
)
{
super
(
text
);
super
(
text
);
...
...
jadx-gui/src/main/java/jadx/gui/utils/NLS.java
View file @
bcaca781
...
@@ -4,24 +4,29 @@ import java.io.IOException;
...
@@ -4,24 +4,29 @@ import java.io.IOException;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.Reader
;
import
java.io.Reader
;
import
java.net.URL
;
import
java.net.URL
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
java.util.Map
;
import
java.util.MissingResourceException
;
import
java.util.PropertyResourceBundle
;
import
java.util.ResourceBundle
;
import
java.util.Vector
;
import
org.jetbrains.annotations.NotNull
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
public
class
NLS
{
public
class
NLS
{
private
static
Vector
<
LangLocale
>
i18nLocales
=
new
Vector
<>();
private
static
final
Vector
<
LangLocale
>
i18nLocales
=
new
Vector
<>();
private
static
Map
<
LangLocale
,
ResourceBundle
>
i18nMessagesMap
=
new
HashMap
<>();
private
static
final
Map
<
LangLocale
,
ResourceBundle
>
i18nMessagesMap
=
new
HashMap
<>();
private
static
final
ResourceBundle
fallbackMessagesMap
;
private
static
final
LangLocale
localLocale
;
// Use these two fields to avoid invoking Map.get() method twice.
// Use these two fields to avoid invoking Map.get() method twice.
private
static
ResourceBundle
localizedMessagesMap
;
private
static
ResourceBundle
localizedMessagesMap
;
private
static
ResourceBundle
fallbackMessagesMap
;
private
static
LangLocale
currentLocale
;
private
static
LangLocale
currentLocale
;
private
static
LangLocale
localLocale
;
static
{
static
{
localLocale
=
new
LangLocale
(
Locale
.
getDefault
());
localLocale
=
new
LangLocale
(
Locale
.
getDefault
());
...
@@ -45,10 +50,13 @@ public class NLS {
...
@@ -45,10 +50,13 @@ public class NLS {
ClassLoader
classLoader
=
ClassLoader
.
getSystemClassLoader
();
ClassLoader
classLoader
=
ClassLoader
.
getSystemClassLoader
();
String
resName
=
String
.
format
(
"i18n/Messages_%s.properties"
,
locale
.
get
());
String
resName
=
String
.
format
(
"i18n/Messages_%s.properties"
,
locale
.
get
());
URL
bundleUrl
=
classLoader
.
getResource
(
resName
);
URL
bundleUrl
=
classLoader
.
getResource
(
resName
);
if
(
bundleUrl
==
null
)
{
throw
new
JadxRuntimeException
(
"Locale resource not found: "
+
resName
);
}
try
(
Reader
reader
=
new
InputStreamReader
(
bundleUrl
.
openStream
(),
StandardCharsets
.
UTF_8
))
{
try
(
Reader
reader
=
new
InputStreamReader
(
bundleUrl
.
openStream
(),
StandardCharsets
.
UTF_8
))
{
bundle
=
new
PropertyResourceBundle
(
reader
);
bundle
=
new
PropertyResourceBundle
(
reader
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"Failed to load "
+
resName
,
e
);
throw
new
Jadx
RuntimeException
(
"Failed to load "
+
resName
,
e
);
}
}
i18nMessagesMap
.
put
(
locale
,
bundle
);
i18nMessagesMap
.
put
(
locale
,
bundle
);
}
}
...
@@ -66,7 +74,8 @@ public class NLS {
...
@@ -66,7 +74,8 @@ public class NLS {
if
(
bundle
!=
null
)
{
if
(
bundle
!=
null
)
{
try
{
try
{
return
bundle
.
getString
(
key
);
return
bundle
.
getString
(
key
);
}
catch
(
MissingResourceException
e
)
{
}
catch
(
MissingResourceException
ignored
)
{
// use fallback string
}
}
}
}
return
fallbackMessagesMap
.
getString
(
key
);
// definitely exists
return
fallbackMessagesMap
.
getString
(
key
);
// definitely exists
...
...
jadx-gui/src/main/java/jadx/gui/utils/Utils.java
View file @
bcaca781
...
@@ -30,7 +30,7 @@ public class Utils {
...
@@ -30,7 +30,7 @@ public class Utils {
* The minimum about of memory in bytes we are trying to keep free, otherwise the application may run out of heap
* The minimum about of memory in bytes we are trying to keep free, otherwise the application may run out of heap
* which ends up in a Java garbage collector running "amok" (CPU utilization 100% for each core and the UI is
* which ends up in a Java garbage collector running "amok" (CPU utilization 100% for each core and the UI is
* not responsive).
* not responsive).
*
*
<p>
* We can calculate and store this value here as the maximum heap is fixed for each JVM instance
* We can calculate and store this value here as the maximum heap is fixed for each JVM instance
* and can't be changed at runtime.
* and can't be changed at runtime.
*/
*/
...
@@ -123,8 +123,7 @@ public class Utils {
...
@@ -123,8 +123,7 @@ public class Utils {
public
static
long
calculateMinFreeMemory
()
{
public
static
long
calculateMinFreeMemory
()
{
Runtime
runtime
=
Runtime
.
getRuntime
();
Runtime
runtime
=
Runtime
.
getRuntime
();
long
minFree
=
(
long
)
(
runtime
.
maxMemory
()
*
0.2
);
long
minFree
=
(
long
)
(
runtime
.
maxMemory
()
*
0.2
);
minFree
=
Math
.
min
(
minFree
,
512
*
1048576
);
return
Math
.
min
(
minFree
,
512
*
1024L
*
1024L
);
return
minFree
;
}
}
public
static
boolean
isFreeMemoryAvailable
()
{
public
static
boolean
isFreeMemoryAvailable
()
{
...
@@ -151,7 +150,7 @@ public class Utils {
...
@@ -151,7 +150,7 @@ public class Utils {
}
}
private
static
String
format
(
long
mem
)
{
private
static
String
format
(
long
mem
)
{
return
Long
.
toString
((
long
)
(
mem
/
1024
.
/
1024
.
))
+
"MB"
;
return
(
long
)
(
mem
/
(
double
)
(
1024L
*
1024L
))
+
"MB"
;
}
}
/**
/**
...
...
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
View file @
bcaca781
jadx-gui/src/test/groovy/jadx/gui/tests/TestStringRef.groovy
View file @
bcaca781
package
jadx.gui.tests
package
jadx.gui.tests
import
jadx.gui.utils.search.StringRef
import
jadx.gui.utils.search.StringRef
import
spock.lang.Specification
import
spock.lang.Specification
...
...
jadx-gui/src/test/java/jadx/gui/utils/CertificateManagerTest.java
View file @
bcaca781
package
jadx
.
gui
.
utils
;
package
jadx
.
gui
.
utils
;
import
org.junit.Assert
;
import
java.io.FileInputStream
;
import
org.junit.Before
;
import
java.io.IOException
;
import
org.junit.Test
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.io.*
;
import
java.security.cert.Certificate
;
import
java.security.cert.Certificate
;
import
java.util.Collection
;
import
java.util.Collection
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
CertificateManagerTest
{
public
class
CertificateManagerTest
{
private
static
final
String
CERTIFICATE_TEST_DIR
=
"certificate-test/"
;
private
static
final
String
DSA
=
"CERT.DSA"
;
private
static
final
String
DSA
=
"CERT.DSA"
;
private
static
final
String
RSA
=
"CERT.RSA"
;
private
static
final
String
RSA
=
"CERT.RSA"
;
private
static
final
String
EMPTY
=
"EMPTY.txt"
;
private
static
final
String
EMPTY
=
"EMPTY.txt"
;
private
String
emptyPath
;
private
String
emptyPath
;
CertificateManager
certificateManagerRSA
;
private
CertificateManager
certificateManagerRSA
;
CertificateManager
certificateManagerDSA
;
private
CertificateManager
certificateManagerDSA
;
private
CertificateManager
getCertificateManger
(
String
resName
)
private
CertificateManager
getCertificateManger
(
String
resName
)
{
{
String
certPath
=
getResourcePath
(
resName
);
String
sertPath
=
getClass
().
getClassLoader
().
getResource
(
resName
).
getPath
();
try
(
InputStream
in
=
new
FileInputStream
(
certPath
))
{
try
(
InputStream
in
=
new
FileInputStream
(
sertPath
))
{
Collection
<?
extends
Certificate
>
certificates
=
CertificateManager
.
readCertificates
(
in
);
Collection
<?
extends
Certificate
>
certificates
=
CertificateManager
.
readCertificates
(
in
);
Certificate
cert
=
(
Certificate
)
certificates
.
toArray
()[
0
]
;
Certificate
cert
=
certificates
.
iterator
().
next
()
;
return
new
CertificateManager
(
cert
);
return
new
CertificateManager
(
cert
);
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"Failed to create CertificateManager"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
}
}
@Before
@Before
public
void
setUp
()
{
public
void
setUp
()
{
emptyPath
=
getClass
().
getClassLoader
().
getResource
(
EMPTY
).
getPath
(
);
emptyPath
=
getResourcePath
(
EMPTY
);
certificateManagerRSA
=
getCertificateManger
(
RSA
);
certificateManagerRSA
=
getCertificateManger
(
RSA
);
certificateManagerDSA
=
getCertificateManger
(
DSA
);
certificateManagerDSA
=
getCertificateManger
(
DSA
);
}
}
@Test
@Test
public
void
decodeNotCertificateFile
()
{
public
void
decodeNotCertificateFile
()
throws
IOException
{
try
(
InputStream
in
=
new
FileInputStream
(
emptyPath
))
{
try
(
InputStream
in
=
new
FileInputStream
(
emptyPath
))
{
String
result
=
CertificateManager
.
decode
(
in
);
String
result
=
CertificateManager
.
decode
(
in
);
Assert
.
assertEquals
(
result
,
""
);
Assert
.
assertEquals
(
""
,
result
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
...
@@ -58,7 +53,6 @@ public class CertificateManagerTest {
...
@@ -58,7 +53,6 @@ public class CertificateManagerTest {
Assert
.
assertTrue
(
string
.
contains
(
"X.509"
));
Assert
.
assertTrue
(
string
.
contains
(
"X.509"
));
Assert
.
assertTrue
(
string
.
contains
(
"0x4bd68052"
));
Assert
.
assertTrue
(
string
.
contains
(
"0x4bd68052"
));
Assert
.
assertTrue
(
string
.
contains
(
"CN=test cert, OU=test unit, O=OOO TestOrg, L=St.Peterburg, ST=Russia, C=123456"
));
Assert
.
assertTrue
(
string
.
contains
(
"CN=test cert, OU=test unit, O=OOO TestOrg, L=St.Peterburg, ST=Russia, C=123456"
));
}
}
@Test
@Test
...
@@ -67,46 +61,62 @@ public class CertificateManagerTest {
...
@@ -67,46 +61,62 @@ public class CertificateManagerTest {
Assert
.
assertTrue
(
string
.
contains
(
"X.509"
));
Assert
.
assertTrue
(
string
.
contains
(
"X.509"
));
Assert
.
assertTrue
(
string
.
contains
(
"0x16420ba2"
));
Assert
.
assertTrue
(
string
.
contains
(
"0x16420ba2"
));
Assert
.
assertTrue
(
string
.
contains
(
"O=\"UJMRFVV CN=EDCVBGT C=TG\""
));
Assert
.
assertTrue
(
string
.
contains
(
"O=\"UJMRFVV CN=EDCVBGT C=TG\""
));
}
}
@Test
@Test
public
void
decodeRSAKeySignature
()
{
public
void
decodeRSAKeySignature
()
{
String
string
=
certificateManagerRSA
.
generateSignature
();
String
string
=
certificateManagerRSA
.
generateSignature
();
Assert
.
assertTrue
(
string
.
contains
(
"SHA256withRSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"SHA256withRSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"1.2.840.113549.1.1.11"
));
Assert
.
assertTrue
(
string
.
contains
(
"1.2.840.113549.1.1.11"
));
}
}
@Test
@Test
public
void
decodeDSAKeySignature
()
{
public
void
decodeDSAKeySignature
()
{
String
string
=
certificateManagerDSA
.
generateSignature
();
String
string
=
certificateManagerDSA
.
generateSignature
();
Assert
.
assertTrue
(
string
.
contains
(
"SHA1withDSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"SHA1withDSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"1.2.840.10040.4.3"
));
Assert
.
assertTrue
(
string
.
contains
(
"1.2.840.10040.4.3"
));
}
}
@Test
@Test
public
void
decodeRSAFingerprint
()
{
public
void
decodeRSAFingerprint
()
{
String
string
=
certificateManagerRSA
.
generateFingerprint
();
String
string
=
certificateManagerRSA
.
generateFingerprint
();
Assert
.
assertTrue
(
string
.
contains
(
"61 18 0A 71 3F C9 55 16 4E 04 E3 C5 45 08 D9 11"
));
Assert
.
assertTrue
(
string
.
contains
(
"61 18 0A 71 3F C9 55 16 4E 04 E3 C5 45 08 D9 11"
));
Assert
.
assertTrue
(
string
.
contains
(
"A0 6E A6 06 DB 2C 6F 3A 16 56 7F 75 97 7B AE 85 C2 13 09 37"
));
Assert
.
assertTrue
(
string
.
contains
(
"A0 6E A6 06 DB 2C 6F 3A 16 56 7F 75 97 7B AE 85 C2 13 09 37"
));
Assert
.
assertTrue
(
string
.
contains
(
"12 53 E8 BB C8 AA 27 A8 49 9B F8 0D 6E 68 CE 32 35 50 DE 55 A7 E7 8C 29 51 00 96 D7 56 F4 54 44"
));
Assert
.
assertTrue
(
string
.
contains
(
"12 53 E8 BB C8 AA 27 A8 49 9B F8 0D 6E 68 CE 32 35 50 DE 55 A7 E7 8C 29 51 00 96 D7 56 F4 54 "
+
"44"
));
}
}
@Test
@Test
public
void
decodeDSAFingerprint
()
{
public
void
decodeDSAFingerprint
()
{
String
string
=
certificateManagerDSA
.
generateFingerprint
();
String
string
=
certificateManagerDSA
.
generateFingerprint
();
Assert
.
assertTrue
(
string
.
contains
(
"D9 06 A6 2D 1F 79 8C 9D A6 EF 40 C7 2E C2 EA 0B"
));
Assert
.
assertTrue
(
string
.
contains
(
"D9 06 A6 2D 1F 79 8C 9D A6 EF 40 C7 2E C2 EA 0B"
));
Assert
.
assertTrue
(
string
.
contains
(
"18 E9 9C D4 A1 40 8F 63 FA EC 2E 62 A0 F2 AE B7 3F C3 C2 04"
));
Assert
.
assertTrue
(
string
.
contains
(
"18 E9 9C D4 A1 40 8F 63 FA EC 2E 62 A0 F2 AE B7 3F C3 C2 04"
));
Assert
.
assertTrue
(
string
.
contains
(
"74 F9 48 64 EE AC 92 26 53 2C 7A 0E 55 BE 5E D8 2F A7 D9 A9 99 F5 D5 21 2C 51 21 C4 31 AD 73 40"
));
Assert
.
assertTrue
(
string
.
contains
(
"74 F9 48 64 EE AC 92 26 53 2C 7A 0E 55 BE 5E D8 2F A7 D9 A9 99 F5 D5 21 2C 51 21 C4 31 AD 73 "
+
"40"
));
}
}
@Test
@Test
public
void
decodeRSAPubKey
()
{
public
void
decodeRSAPubKey
()
{
String
string
=
certificateManagerRSA
.
generatePublicKey
();
String
string
=
certificateManagerRSA
.
generatePublicKey
();
Assert
.
assertTrue
(
string
.
contains
(
"RSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"RSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"65537"
));
Assert
.
assertTrue
(
string
.
contains
(
"65537"
));
Assert
.
assertTrue
(
string
.
contains
(
"16819531290318044625546437357099080306019392752925688951114880688329201213180109168890384305768067101521914473763638669503560977521269328582980060332888147680193318231260043189411794465899645633586173494259691101582064441956032924396850221679489313043628562082670183392670094163371858684118480409374749790551473773845213427476236147328434427272177623018935282929152308753854314219987617604037468769472089902090243358285991739642170211970862773121939911777280101937073243006335384636193260583579409760790138329893534549366882523130765297472656435892831796545149793228897111760122091442123535919361963075454640516520743"
));
Assert
.
assertTrue
(
string
.
contains
(
"16819531290318044625546437357099080306019392752925688951114880688329201213180109168890384305768067101521914473763638669503560977521269328582980060332888147680193318231260043189411794465899645633586173494259691101582064441956032924396850221679489313043628562082670183392670094163371858684118480409374749790551473773845213427476236147328434427272177623018935282929152308753854314219987617604037468769472089902090243358285991739642170211970862773121939911777280101937073243006335384636193260583579409760790138329893534549366882523130765297472656435892831796545149793228897111760122091442123535919361963075454640516520743"
));
}
}
@Test
@Test
public
void
decodeDSAPubKey
()
{
public
void
decodeDSAPubKey
()
{
String
string
=
certificateManagerDSA
.
generatePublicKey
();
String
string
=
certificateManagerDSA
.
generatePublicKey
();
Assert
.
assertTrue
(
string
.
contains
(
"DSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"DSA"
));
Assert
.
assertTrue
(
string
.
contains
(
"19323367605058154682563301282345453222279312104889899001698209626254725581511375469963812461090495963838615773832867364330457010553974237985991904800958394169421485070378434746792379708805563793253282995274293621162504943287538455944652344378242226897507369146942411692220922477368782490423187845815262510366"
));
Assert
.
assertTrue
(
string
.
contains
(
"19323367605058154682563301282345453222279312104889899001698209626254725581511375469963812461090495963838615773832867364330457010553974237985991904800958394169421485070378434746792379708805563793253282995274293621162504943287538455944652344378242226897507369146942411692220922477368782490423187845815262510366"
));
}
}
private
String
getResourcePath
(
String
resName
)
{
URL
resource
=
getClass
().
getClassLoader
().
getResource
(
CERTIFICATE_TEST_DIR
+
resName
);
if
(
resource
==
null
)
{
throw
new
RuntimeException
(
"Resource not found: "
+
resName
);
}
return
resource
.
getPath
();
}
}
}
jadx-gui/src/test/resources/CERT.DSA
→
jadx-gui/src/test/resources/
certificate-test/
CERT.DSA
View file @
bcaca781
File moved
jadx-gui/src/test/resources/CERT.RSA
→
jadx-gui/src/test/resources/
certificate-test/
CERT.RSA
View file @
bcaca781
File moved
jadx-gui/src/test/resources/EMPTY.txt
→
jadx-gui/src/test/resources/
certificate-test/
EMPTY.txt
View file @
bcaca781
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment