audit changes

This commit is contained in:
Ubuntu 2024-06-01 11:22:12 +00:00
parent e63179385d
commit c9881ca57d
1 changed files with 14 additions and 12 deletions

View File

@ -186,6 +186,7 @@ def run_audit(msg):
type="script-csv" type="script-csv"
) )
hash2 = "" hash2 = ""
hash2_docx = ""
try: try:
file_to_audit_docx = File.objects.get( file_to_audit_docx = File.objects.get(
script=script_id, script=script_id,
@ -194,9 +195,9 @@ def run_audit(msg):
script_docx = {} script_docx = {}
script_path1 = file_to_audit_docx.file.path script_path1 = file_to_audit_docx.file.path
with open(script_path1, 'rb') as _file: with open(script_path1, 'rb') as _file:
hash2 = uploadDataToIPFSNode(_file) hash2_docx = uploadDataToIPFSNode(_file)
script_docx["script_file_path"] = script_path1 script_docx["script_file_path"] = script_path1
script_docx["script_file"] = hash2 script_docx["script_file"] = hash2_docx
script_docx["type"] = "script-docx" script_docx["type"] = "script-docx"
audit_data["script-docx"] = script_docx audit_data["script-docx"] = script_docx
except: except:
@ -226,9 +227,9 @@ def run_audit(msg):
script_path1 = file_to_audit_docx.file.path script_path1 = file_to_audit_docx.file.path
script_size = file_to_audit_docx.file.size script_size = file_to_audit_docx.file.size
with open(script_path1, 'rb') as _file: with open(script_path1, 'rb') as _file:
hash2 = uploadDataToIPFSNode(_file) hash2_docx = uploadDataToIPFSNode(_file)
script_docx["script_file_path"] = script_path1 script_docx["script_file_path"] = script_path1
script_docx["script_file"] = hash2 script_docx["script_file"] = hash2_docx
script_docx["type"] = "script-docx" script_docx["type"] = "script-docx"
audit_data["script-docx"] = script_docx audit_data["script-docx"] = script_docx
@ -309,14 +310,14 @@ def run_audit(msg):
print("$$$$### after sendmail") print("$$$$### after sendmail")
# user_infos = user_info(tx_hash=Response,service="Script Audit",gas_fee=gasprice) # user_infos = user_info(tx_hash=Response,service="Script Audit",gas_fee=gasprice)
# addition_result = user_infos.update_info(request) # addition_result = user_infos.update_info(request)
hash2 = hash_decrypation(hash2) hash2_docx = hash_decrypation(hash2_docx)
tx_id = Response tx_id = Response
certificate = certificateGenrate(user.username,"script audit",tx_id,projectname=script_file_name,matic=gasprice) certificate = certificateGenrate(user.username,"script audit",tx_id,projectname=script_file_name,matic=gasprice)
to_email = [user.email] to_email = [user.email]
email_code = 'BL1' email_code = 'BL1'
key_value = { key_value = {
"service":"Audited Script", "service":"Audited Script",
"hash": hash2, "hash": hash2_docx,
"public key":blockchain_obj.publicKey, "public key":blockchain_obj.publicKey,
"Transaction Hash": tx_id, "Transaction Hash": tx_id,
} }
@ -336,6 +337,7 @@ def run_audit(msg):
type="audit-report" type="audit-report"
) )
hash2 = "" hash2 = ""
hash2_docx = ""
try: try:
file_to_audit_docx = File.objects.get( file_to_audit_docx = File.objects.get(
script=script_id, script=script_id,
@ -344,9 +346,9 @@ def run_audit(msg):
script_docx = {} script_docx = {}
script_path1 = file_to_audit_docx.file.path script_path1 = file_to_audit_docx.file.path
with open(script_path1, 'rb') as _file: with open(script_path1, 'rb') as _file:
hash2 = uploadDataToIPFSNode(_file) hash2_docx = uploadDataToIPFSNode(_file)
script_docx["script_file_path"] = script_path1 script_docx["script_file_path"] = script_path1
script_docx["script_file"] = hash2 script_docx["script_file"] = hash2_docx
script_docx["type"] = "script-docx" script_docx["type"] = "script-docx"
audit_data["script-docx"] = script_docx audit_data["script-docx"] = script_docx
except: except:
@ -376,9 +378,9 @@ def run_audit(msg):
script_path1 = file_to_audit_docx.file.path script_path1 = file_to_audit_docx.file.path
script_size = file_to_audit_docx.file.size script_size = file_to_audit_docx.file.size
with open(script_path1, 'rb') as _file: with open(script_path1, 'rb') as _file:
hash2 = uploadDataToIPFSNode(_file) hash2_docx = uploadDataToIPFSNode(_file)
script_docx["script_file_path"] = script_path1 script_docx["script_file_path"] = script_path1
script_docx["script_file"] = hash2 script_docx["script_file"] = hash2_docx
script_docx["type"] = "script-docx" script_docx["type"] = "script-docx"
audit_data["script-docx"] = script_docx audit_data["script-docx"] = script_docx
@ -469,14 +471,14 @@ def run_audit(msg):
# user_infos = user_info(tx_hash=Response,service="Script Audit",gas_fee=gasprice) # user_infos = user_info(tx_hash=Response,service="Script Audit",gas_fee=gasprice)
# addition_result = user_infos.update_info(request) # addition_result = user_infos.update_info(request)
hash2 = hash_decrypation(hash2) hash2_docx = hash_decrypation(hash2_docx)
tx_id = Response tx_id = Response
certificate = certificateGenrate(user.username,"script audit",tx_id,projectname=script_file_name,matic=gasprice) certificate = certificateGenrate(user.username,"script audit",tx_id,projectname=script_file_name,matic=gasprice)
to_email = [user.email] to_email = [user.email]
email_code = 'BL1' email_code = 'BL1'
key_value = { key_value = {
"service":"Audited Script", "service":"Audited Script",
"hash": hash2, "hash": hash2_docx,
"public key":blockchain_obj.publicKey, "public key":blockchain_obj.publicKey,
"Transaction Hash": tx_id, "Transaction Hash": tx_id,
} }