Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
namaek2 committed Oct 22, 2024
1 parent 76094b8 commit 2aa1bb3
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ManageObfuscate(

private fun runPythonScript(venvPath: String, scriptName: String, outFolder: String, fractionValue: Double) {
indicator.fraction = fractionValue
runScript(venvPath, scriptName, outFolder)
runScript(venvPath, scriptName, outFolder)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ class TasksManager(private val project : Project, private val javaFilesPath: Str
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class TaintBombFactory : ToolWindowFactory {

add(label1)
add(label2)
add(label3)
add(JButton(MyBundle.message("obfuscate")).apply {
addActionListener {
label1.text = MyBundle.message("obfuscateLabel1")
Expand Down
30 changes: 15 additions & 15 deletions src/main/resources/pyscripts/check_hash
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
levelObfuscate df3e9c6175b535514c07ea6061303c9fbf40fd776925332f55c164dbcb180ce8
stringSearch 8dc84922fd69bb92025511adbcf887974c56bde488d816c2c9c83cdd94edf32e
identifierObfuscate 0519214c4dd4c61293e2c86588c44a30e4146fe12fb27bf482292c1d9f927c01
operationExtract 05b3dfccd79506187c80aa5e5b1c96b67df2a943bd2c36255143eba9c52054f3
levelObfuscate 1bbd5d71ba1d4d4ca5ac674fefd05733c38af61801bfe5f0c04147c7be5e5415
stringSearch 5af52c8abaa493742d68c0e40b134b9a8306b9825d6465aef0936f7684304b3f
identifierObfuscate 221cc8954d669f6de44de3d700ab8c5e0e2469970a66a69c8bc13c7c50e3d4dd
operationExtract d7403d7230c09f5c70dc50aabf3fdc6acc278c45c68dd3647a11101dd410b989
sensitivityDB 114428aaacb60ef2761b43f277ac113e5d8795e3ab1aa1eb4fd5348b0e429a74
checkJavaSyntax 1e96d6e7a8bf6b614414ef0256f4f1353a3b6d1e02942485160ecc2ba70b1dae
main 3cf561fc3ac76352484d027fe5e8455797d94554ed753f8e3ed0cc69ca6f2a11
main 2381121f8961dd7afaeed8d905d04954afdb234143ace3899768b233faf3f497
methodEndLineFinder 5b668701f888cefd4fe498559f1720c8c72df5326bcb4f1b8b4cd8fab4b376e7
stringEncrypt faaa8b43ddf71a7704446789b47f4c76b497b4c293efa5e3e20b5cfbdbbb0415
keyObfuscate 1d2bdb00b37b9abe83727120d3fdb6ca3fdc573f8f2b17c8be72907b116b39c6
stringEncrypt fb92bf1893c3332eaf291b699da824b4e55210fc43ebb31f6b21976796015912
keyObfuscate 7d5814f39d6e16534014af79b03b83606996c03385cc7b6ca288aef0c90b0aca
methodSplit c36dc229b56ab4f7bf97315ed4fe2741f41f06ff245e55d29a2f32db9d743ea2
applyObfuscated 2409645cd1ddba08bc6e70a41e62e8baaaee1059ea47fbdcc5dd18190870bc5c
makeMD 5b64d6d3b4272377d447099a51ec8b0834078501b501e10213f4bbd9ef792834
stringObfuscate e0330033d7875f45ffab166cb47cacf32259f6fc85978572bb0114bf186abbdf
stringObfuscate 04086bb5f551dc4a3c1eb293f665ef7999a6132a6cd2f2c55dd1fdd2c5661d02
stringInsert 1885e745c9852c09e969f045ba3c3ae455e5e54c369d564544d17de296b2e16c
analysisResultManager b8636306e651ad95489fd0c35ad31646143419d0ce8a75a89b2e41f0e2718807
removeComments 114f4a55457aa8003398e1fb0573d18502f5a3eeb034b714a8f585db3e1f3558
operationDB 7936f515a55c3cba4e0f3121fd72b9e75f130f352149601e75cd3fe6b4787fef
taintAnalysis 84ca9cb78e37541c93da49a52691f39cb797ac9a0b7d6edf7ee246728c788094
operationObfuscate 1940f12427200757a983b0d0d2cee9f5a6ffee14fe336d169237694335f40ca0
obfuscateTool 978d1b9139be74ca5248f17ad0e4b6b3bcb5e760e158262e28538e7b5819602e
dumbDB 6b8f1afe72bb2452c7ea217f4505d8a94961506287e41febaa13e4011d4773a9
installScripts f2a0c628c886d4109030c2b43046e0cde6a71fbf4dee6796ae8ece64ecf5d947
dummyInsert f1749613de15174b32e2847a8af91e05353323409729ba93b02d150e2310ca66
operationDB 4fc96d38c69faeb5533d79e85510f650e7aace0ca42fbbcad178e396ba25627d
taintAnalysis ea80312c9b6584f454d81ca18134bb6f30a1a8c4697827d5b223884f28daccb6
operationObfuscate 3d5162a56578741e064a78f82e39cb97431121aa2d48a3d9ed11b4e9ebe760fb
obfuscateTool c2e77a55b48a55ce989b4b57a6371e8622f643845eb651dcf033b91229073db0
dumbDB 59a3511f2db29d9e5d1ae8ba56bf3bbed9eae981104788b98a5c05dc692d8d50
installScripts 804deeb11520684d669657799a72dd732f2dba663e265857b599cbf9560e0723
dummyInsert 928a33f2b149a95cdb9abed695798e9661a0e40ddac3e61a242091484120a53a
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/dumbDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ def get_unique_random_number(self):
}
}
"""
]
]
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/dummyInsert.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ def __add_dummy_if(self):


def get_obfuscated_code(self):
return self.obfuscated_code
return self.obfuscated_code
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/identifierObfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,4 +700,4 @@ def replacer(match):
if __name__ == '__main__':
import sys

ob_identifier(sys.argv[1], sys.argv[1])
ob_identifier(sys.argv[1], sys.argv[1])
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/installScripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def install(package):

if __name__ == '__main__':
install('pycryptodome')
install('javalang')
install('javalang')
10 changes: 5 additions & 5 deletions src/main/resources/pyscripts/keyObfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def __decrypt(self, data, key, rounds=16):
block = self.__inverse_feistel_network(block, round_key)
decrypted.extend(block)
return bytes(decrypted).rstrip(b'\x00')


def __key_encrypt(self, aes_key, key2):
enc2_aes_key = self.__encrypt(aes_key, key2)
return enc2_aes_key
enc2_aes_key = self.__encrypt(aes_key, key2)
return enc2_aes_key


def __key_decrypt(self, enc2_aes_key, key2):
enc_aes_key = self.__decrypt(enc2_aes_key, key2)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/levelObfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ def check_level(self, json):
if __name__ == '__main__':
import sys

LevelObfuscation(sys.argv[1])
LevelObfuscation(sys.argv[1])
22 changes: 11 additions & 11 deletions src/main/resources/pyscripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ def main(output_folder) :
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 현재 시각을 'YYYY-MM-DD HH:MM:SS' 형식으로 저장

with open(output_folder + "/analysis_result.md", "w") as md_file:
md_file.write("# Taint Analysis Result\n")
md_file.write("## Summary\n")
md_file.write("No taint flows were detected during the analysis.\n\n")
md_file.write("## Details\n")
md_file.write("- **Analysis Time**: {}\n".format(current_time)) # 실제 시간 출력
md_file.write("- **Output Folder**: {}\n\n".format(output_folder))
md_file.write("The taint analysis did not identify any potential issues or vulnerabilities in the given codebase.\n")
md_file.write("If you believe there should be taint flows detected, please review the input code or adjust the analysis parameters.\n")
md_file.write("\n---\n")
md_file.write("# Taint Analysis Result\n")
md_file.write("## Summary\n")
md_file.write("No taint flows were detected during the analysis.\n\n")
md_file.write("## Details\n")
md_file.write("- **Analysis Time**: {}\n".format(current_time)) # 실제 시간 출력
md_file.write("- **Output Folder**: {}\n\n".format(output_folder))
md_file.write("The taint analysis did not identify any potential issues or vulnerabilities in the given codebase.\n")
md_file.write("If you believe there should be taint flows detected, please review the input code or adjust the analysis parameters.\n")
md_file.write("\n---\n")
else:
print_result(priority_flow)
create_result(output_folder, tainted.flows)
Expand All @@ -82,6 +82,6 @@ def main(output_folder) :

if __name__ == '__main__':
import sys

output_folder = sys.argv[1]
main(output_folder)
main(output_folder)
10 changes: 3 additions & 7 deletions src/main/resources/pyscripts/obfuscateTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ def parse_java_files(folder_path):
try:
tree = javalang.parse.parse(source_code)
java_files.append((file_path, tree, source_code))

except javalang.parser.JavaParserError as e:
print(f"Error parsing file {file_path}: {e}")
except javalang.parser.JavaSyntaxError as e:
print(f"Syntax error in file {file_path}: {e}")
except SyntaxError as e: # 문법 오류는 파이썬의 SyntaxError로 처리
print(f"Syntax error in file {file_path}: {e}")
print(f"Syntax error in file {file_path}: {e}")
except javalang.parser.JavaSyntaxError as e:
print(f"Java syntax error in file {file_path}: {e}")

return java_files

Expand Down Expand Up @@ -83,4 +80,3 @@ def convert_unicode_literals(folder_path):
with open(file_path, 'w', encoding='utf-8') as file:
file.write(content)


2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/operationDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def __init__(self):

def op_db(self):
return self.__op
# return json.dumps(self.__op, ensure_ascii=False)
# return json.dumps(self.__op, ensure_ascii=False)
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/operationExtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def extract_all_conditions(self):
expressions = [self.find_if_conditions(), self.find_for_conditions(), self.find_while_conditions(),
self.find_do_while_conditions()]
print(f"expressions : {expressions}")
return expressions
return expressions
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/operationObfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ def replace_expression(self, source_code, original_list,obfuscate_list):
# 현재 단계의 난독화된 결과로 업데이트
result = temp_result

return result
return result
7 changes: 3 additions & 4 deletions src/main/resources/pyscripts/stringEncrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def encrypt_string(self, plain_text, key):
padded_text = pad(plain_text.encode('utf-8'), AES.block_size)
encrypted_text = cipher.encrypt(padded_text)
return base64.b64encode(encrypted_text).decode('utf-8')


# 암호화
def encrypt_string_literals(self, string_literals):
def encrypt_string_literals(self, string_literals):
encrypted_Literals = []

for p, c, strings,_ in string_literals:
aes_key = os.urandom(16)
enc_aes_key = os.urandom(8)
Expand All @@ -35,4 +35,3 @@ def encrypt_string_literals(self, string_literals):

return encrypted_Literals


4 changes: 2 additions & 2 deletions src/main/resources/pyscripts/stringObfuscate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, output_folder, keyDecryptJava, stringDecryptJava):

encrypted_strings = StringEncrypt(searched_strings.Literals)
print("string encrypt complete")

random_classes = ObfuscateTool.random_class(searched_strings.class_names, 2)
StringInsert(searched_strings.Literals, encrypted_strings.encrypted_Literals, random_classes, output_folder,
keyDecryptJava, stringDecryptJava)
Expand All @@ -26,4 +26,4 @@ def __init__(self, output_folder, keyDecryptJava, stringDecryptJava):
keyDecryptJava = sys.argv[2]
stringDecryptJava = sys.argv[3]

StringObfuscate(output_folder, keyDecryptJava, stringDecryptJava)
StringObfuscate(output_folder, keyDecryptJava, stringDecryptJava)
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/stringSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ def __process_annotation_element(self, element):
def __track_variable_declarations(self, node):
if isinstance(node, javalang.tree.VariableDeclarator) and isinstance(node.initializer, javalang.tree.Literal):
if node.initializer.value.startswith('"') and node.initializer.value.endswith('"'):
self.value_map[node.name] = node.initializer.value
self.value_map[node.name] = node.initializer.value
2 changes: 1 addition & 1 deletion src/main/resources/pyscripts/taintAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,4 @@ def __if_ternary(self, node, class_method, var_name, count, current_count):
pass

except Exception:
pass
pass

0 comments on commit 2aa1bb3

Please sign in to comment.