Don't print the full stack trace. Too confusing for most people.
This commit is contained in:
parent
9b9e692947
commit
f6db11ac09
|
@ -79,9 +79,18 @@ namespace de4dot.cui {
|
||||||
exitCode = 1;
|
exitCode = 1;
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
if (printFullStackTrace()) {
|
||||||
printStackTrace(ex);
|
printStackTrace(ex);
|
||||||
Log.e("\nTry the latest version before reporting this problem!");
|
Log.e("\nTry the latest version before reporting this problem!");
|
||||||
Log.e("Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues");
|
Log.e("Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.e("\n\n");
|
||||||
|
Log.e("Hmmmm... something didn't work. Try the latest version. ({0})", ex.GetType());
|
||||||
|
Log.e("If it's a supported obfuscator, it could be a bug or a new obfuscator version.");
|
||||||
|
Log.e("If it's an unsupported obfuscator, make sure the methods are decrypted!");
|
||||||
|
Log.e("Send bug reports to de4dot@gmail.com or go to https://github.com/0xd4d/de4dot/issues");
|
||||||
|
}
|
||||||
exitCode = 1;
|
exitCode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +106,30 @@ namespace de4dot.cui {
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isN00bUser() {
|
static bool printFullStackTrace() {
|
||||||
var env = Environment.GetEnvironmentVariables();
|
if (Log.isAtLeast(Log.LogLevel.verbose))
|
||||||
if (env["VisualStudioDir"] != null)
|
return true;
|
||||||
|
if (hasEnv("STACKTRACE"))
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
return env["windir"] != null && env["PROMPT"] == null;
|
}
|
||||||
|
|
||||||
|
static bool hasEnv(string name) {
|
||||||
|
foreach (var tmp in Environment.GetEnvironmentVariables().Keys) {
|
||||||
|
var env = tmp as string;
|
||||||
|
if (env == null)
|
||||||
|
continue;
|
||||||
|
if (string.Equals(env, name, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isN00bUser() {
|
||||||
|
if (hasEnv("VisualStudioDir"))
|
||||||
|
return false;
|
||||||
|
return hasEnv("windir") && !hasEnv("PROMPT");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printStackTrace(Exception ex, Log.LogLevel logLevel = Log.LogLevel.error) {
|
public static void printStackTrace(Exception ex, Log.LogLevel logLevel = Log.LogLevel.error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user