diff --git a/pom.xml b/pom.xml
index 557d15e..0838123 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
optic_fusion1
Kitsune
- 1.9
+ 1.10
diff --git a/src/main/java/optic_fusion1/kitsune/logging/CustomLogger.java b/src/main/java/optic_fusion1/kitsune/logging/CustomLogger.java
index 51304e1..545e87a 100644
--- a/src/main/java/optic_fusion1/kitsune/logging/CustomLogger.java
+++ b/src/main/java/optic_fusion1/kitsune/logging/CustomLogger.java
@@ -19,9 +19,10 @@
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
-import java.io.FileWriter;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.MessageFormat;
import java.time.LocalDate;
@@ -86,7 +87,7 @@ private void startAsyncWriter() {
private void createNewFileWriter() {
try {
- fileWriter = new BufferedWriter(new FileWriter(currentLogFile, true));
+ fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(currentLogFile), StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/src/main/java/optic_fusion1/kitsune/parser/vbs/StatementFactory.java b/src/main/java/optic_fusion1/kitsune/parser/vbs/StatementFactory.java
index 06afea0..6c32346 100644
--- a/src/main/java/optic_fusion1/kitsune/parser/vbs/StatementFactory.java
+++ b/src/main/java/optic_fusion1/kitsune/parser/vbs/StatementFactory.java
@@ -47,22 +47,25 @@ Public Property Set AutomationSecurity(objMsoAutomationSecurity)
Set p_Excel.AutomationSecurity = objMsoAutomationSecurity
End Property
-*/
+ */
public class StatementFactory {
-
- /*
- TODO: Implement support for
- Function FUNCTIONNAME
- // Statements
- End Function
- */
// TODO: Find a way to make a private static final Pattern variable for this classes's regex
// TODO: Add support for getting if the function is Public, Private, or neither
+ // TODO: Verify this works w/ every function statement possibility
public static Function buildFunctionStatements(int index, String line) {
Pattern pattern = Pattern.compile("( +.*?)\\(", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(line);
matcher.find();
+ if (matcher.groupCount() == 1) {
+ pattern = Pattern.compile("Function (.+)", Pattern.CASE_INSENSITIVE);
+ matcher = pattern.matcher(line);
+ matcher.find();
+ Function function = new Function(matcher.group(1));
+ function.setLineNumber(index);
+ function.setText(line);
+ return function;
+ }
Function func = new Function(matcher.group(1));
func.setLineNumber(index);
func.setText(line);
diff --git a/src/main/java/optic_fusion1/kitsune/parser/vbs/VBSParser.java b/src/main/java/optic_fusion1/kitsune/parser/vbs/VBSParser.java
index 164652d..84daca7 100644
--- a/src/main/java/optic_fusion1/kitsune/parser/vbs/VBSParser.java
+++ b/src/main/java/optic_fusion1/kitsune/parser/vbs/VBSParser.java
@@ -236,7 +236,7 @@ private List visitContainersAndExtractRecursively(List stmtList,
return parsedStmtList;
}
-
+
public ConstantPool getConstantPool() {
return CONSTANT_POOL;
}
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/IdFetcherTool.java b/src/main/java/optic_fusion1/kitsune/tool/impl/IdFetcherTool.java
index 74323ca..d28f09d 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/IdFetcherTool.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/IdFetcherTool.java
@@ -15,6 +15,7 @@
import static optic_fusion1.kitsune.Kitsune.LOGGER;
import optic_fusion1.kitsune.tool.Tool;
import static optic_fusion1.kitsune.util.I18n.tl;
+import optic_fusion1.kitsune.util.Utils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
@@ -96,7 +97,8 @@ private void handleFile(File file) {
// TODO: Handle nested entries
LOGGER.info(entry.getName() + " is actually a ZipFile.");
}
- LOGGER.info(entry.getName() + ": " + DigestUtils.sha1Hex(entry.getName()));
+ // Don't SHA1 the entry itself. While it's possible there'll be false-positives depending on how this is used, it'll at least stay consistent
+ LOGGER.info(entry.getName() + ": " + DigestUtils.sha1Hex(Utils.normalize(entry.getName())));
}
} catch (IOException ex) {
LOGGER.exception(ex);
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/JavaAnalyzer.java b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/JavaAnalyzer.java
index 7022a4f..30bedb6 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/JavaAnalyzer.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/JavaAnalyzer.java
@@ -112,7 +112,12 @@ public void analyze(File file) {
analyzer.analyze(file);
}
LOGGER.info(tl("ja_gathering_class_nodes", file.toPath()));
- List classNodes = getClassNodesFromFile(file);
+ List classNodes = new ArrayList<>();
+ try {
+ classNodes = getClassNodesFromFile(file);
+ } catch (Exception e) {
+
+ }
if (classNodes.isEmpty()) {
LOGGER.warn(tl("ja_class_nodes_not_found", file.toPath()));
return;
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/FilesCodeAnalyzer.java b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/FilesCodeAnalyzer.java
index 4a75788..45d65fc 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/FilesCodeAnalyzer.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/FilesCodeAnalyzer.java
@@ -38,15 +38,18 @@ public void analyze(ClassNode classNode, MethodNode methodNode, MethodInsnNode m
}
if (isMethodInsnNodeCorrect(methodInsnNode, "createFile", "(Ljava/nio/file/Path;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;")) {
log(classNode, methodNode, methodInsnNode, tl("fsca_creates_file"));
+ return;
}
if (isMethodInsnNodeCorrect(methodInsnNode, "setAttribute",
"(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/Object;[Ljava/nio/file/LinkOption;)Ljava/nio/file/Path;")) {
AbstractInsnNode minus5 = methodInsnNode.getPrevious().getPrevious().getPrevious().getPrevious().getPrevious();
if (!(isAbstractNodeString(minus5))) {
log(classNode, methodNode, methodInsnNode, tl("fsca_file_attribute_set"));
+ return;
}
String attribute = (String) ((LdcInsnNode) minus5).cst;
log(classNode, methodNode, methodInsnNode, tl("fsca_known_file_attribute_set", attribute));
+ return;
}
}
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/SQLCodeAnalyzer.java b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/SQLCodeAnalyzer.java
index 4daa538..af3f7e0 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/SQLCodeAnalyzer.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/SQLCodeAnalyzer.java
@@ -37,7 +37,7 @@ public void analyze(ClassNode classNode, MethodNode methodNode, MethodInsnNode m
if (isMethodInsnNodeCorrect(methodInsnNode, "prepareStatement", "(Ljava/lang/String;)Ljava/sql/PreparedStatement;")) {
AbstractInsnNode minus1 = methodInsnNode.getPrevious();
if (!isAbstractNodeString(minus1)) {
- log(classNode, methodNode, methodInsnNode, tl("sqlca_pa_credted"));
+ log(classNode, methodNode, methodInsnNode, tl("sqlca_ps_created"));
return;
}
String statement = (String) ((LdcInsnNode) minus1).cst;
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ThreadCodeAnalyzer.java b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ThreadCodeAnalyzer.java
index fa4ec93..72b63b4 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ThreadCodeAnalyzer.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ThreadCodeAnalyzer.java
@@ -35,6 +35,10 @@ public void analyze(ClassNode classNode, MethodNode methodNode, MethodInsnNode m
log(classNode, methodNode, methodInsnNode, tl("thread_interrupted"));
return;
}
+ if (!(minus1 instanceof MethodInsnNode)) {
+ log(classNode, methodNode, methodInsnNode, tl("thread_interrupted"));
+ return;
+ }
if (isMethodInsnNodeCorrect((MethodInsnNode) minus1, "currentThread", "()Ljava/lang/Thread;")) {
log(classNode, methodNode, methodInsnNode, tl("current_thread_interrupted"));
return;
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ZipEntryCodeAnalyzer.java b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ZipEntryCodeAnalyzer.java
index 41fea16..771af1c 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ZipEntryCodeAnalyzer.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/java/code/ZipEntryCodeAnalyzer.java
@@ -35,7 +35,7 @@ public void analyze(ClassNode classNode, MethodNode methodNode, MethodInsnNode m
return;
}
String zipEntryName = (String) ((LdcInsnNode) minus1).cst;
- log(classNode, methodNode, methodInsnNode, tl("zeca_named_zipentry_initalized", zipEntryName));
+ log(classNode, methodNode, methodInsnNode, tl("zeca_named_zipentry_initialized", zipEntryName));
return;
}
if (isMethodInsnNodeCorrect(methodInsnNode, "getName", "()Ljava/lang/String;")) {
diff --git a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/vbs/VBSAnalyzer.java b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/vbs/VBSAnalyzer.java
index 099b317..3d03600 100644
--- a/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/vbs/VBSAnalyzer.java
+++ b/src/main/java/optic_fusion1/kitsune/tool/impl/analyze/analyzer/vbs/VBSAnalyzer.java
@@ -31,7 +31,7 @@ public void analyze(File input) {
continue;
}
if (statement instanceof Comment comment) {
- LOGGER.info("Comment: " + comment.getText());
+ LOGGER.info("Comment: " + comment.value());
}
if (statement instanceof VariableInit stmnt) {
LOGGER.info("Name: " + stmnt.getName() + " Variable Type: " + stmnt.getVariableType());