use of jadx.core.utils.exceptions.JadxRuntimeException in project jadx by skylot.
the class DepthRegionTraversal method traverseIncludingExcHandlers.
public static void traverseIncludingExcHandlers(MethodNode mth, IRegionIterativeVisitor visitor) {
boolean repeat;
int k = 0;
int limit = ITERATIVE_LIMIT_MULTIPLIER * mth.getBasicBlocks().size();
do {
repeat = traverseIterativeStepInternal(mth, visitor, mth.getRegion());
if (!repeat) {
for (ExceptionHandler h : mth.getExceptionHandlers()) {
repeat = traverseIterativeStepInternal(mth, visitor, h.getHandlerRegion());
if (repeat) {
break;
}
}
}
if (k++ > limit) {
throw new JadxRuntimeException("Iterative traversal limit reached: " + "limit: " + limit + ", visitor: " + visitor.getClass().getName() + ", blocks count: " + mth.getBasicBlocks().size());
}
} while (repeat);
}
use of jadx.core.utils.exceptions.JadxRuntimeException in project jadx by skylot.
the class QuarkManager method installQuark.
private void installQuark() {
List<String> cmd = new ArrayList<>();
cmd.add(getCommand("pip3"));
cmd.add("install");
cmd.add("quark-engine");
cmd.add("--upgrade");
try {
runCommand(cmd);
} catch (Exception e) {
throw new JadxRuntimeException("Failed to install quark-engine", e);
}
}
use of jadx.core.utils.exceptions.JadxRuntimeException in project jadx by skylot.
the class QuarkManager method updateQuarkRules.
private void updateQuarkRules() {
List<String> cmd = new ArrayList<>();
cmd.add(getCommand("freshquark"));
try {
runCommand(cmd);
} catch (Exception e) {
throw new JadxRuntimeException("Failed to update quark rules", e);
}
}
use of jadx.core.utils.exceptions.JadxRuntimeException in project jadx by skylot.
the class QuarkManager method createVirtualEnv.
private void createVirtualEnv() {
if (Files.exists(getVenvPath("activate"))) {
return;
}
File directory = QUARK_DIR_PATH.toFile();
if (!directory.isDirectory()) {
if (!directory.mkdirs()) {
throw new JadxRuntimeException("Failed create directory: " + directory);
}
}
List<String> cmd = new ArrayList<>();
if (SystemInfo.IS_WINDOWS) {
cmd.add("python");
cmd.add("-m");
cmd.add("venv");
} else {
cmd.add("virtualenv");
}
cmd.add(VENV_PATH.toString());
try {
runCommand(cmd);
} catch (Exception e) {
throw new JadxRuntimeException("Failed to create virtual environment", e);
}
}
use of jadx.core.utils.exceptions.JadxRuntimeException in project jadx by skylot.
the class JadxDecompiler method convertNode.
@Nullable
JavaNode convertNode(Object obj) {
if (obj instanceof VarRef) {
VarRef varRef = (VarRef) obj;
MethodNode mthNode = varRef.getMth();
JavaMethod mth = getJavaMethodByNode(mthNode);
if (mth == null) {
return null;
}
return new JavaVariable(mth, varRef);
}
if (!(obj instanceof LineAttrNode)) {
return null;
}
LineAttrNode node = (LineAttrNode) obj;
if (node.contains(AFlag.DONT_GENERATE)) {
return null;
}
if (obj instanceof ClassNode) {
return convertClassNode((ClassNode) obj);
}
if (obj instanceof MethodNode) {
return getJavaMethodByNode(((MethodNode) obj));
}
if (obj instanceof FieldNode) {
return getJavaFieldByNode((FieldNode) obj);
}
throw new JadxRuntimeException("Unexpected node type: " + obj);
}
Aggregations