Spaces:
Runtime error
Runtime error
update
Browse filesFiles changed (2)
- app.py+37-2
- smallexe64.exe β harmless.exeRenamed
14 unmodified lines151617181920281 unmodified lines30230330430530630730830931031131231331431531631737 unmodified lines35535635735835936036136236336436536614 unmodified linesimport numpy as npimport pdb# This repository's directoryREPO_DIR = Path(__file__).parentsubprocess.Popen(["uvicorn", "server:app"], cwd=REPO_DIR)281 unmodified linesinteractive=False,)gr.Markdown("# π€ Step 2: Upload a file for scanning")gr.Markdown("## Client side")gr.Markdown("Upload a file you want to scan for malware. ClairVault will encrypt it locally before sending it to the cloud.")file_input = gr.File(label="Upload a file:", file_count = "single", value="./smallexe64.exe")gr.Markdown("# π₯ Step 3: Extract executable file features")b_extract = gr.Button("π₯ Extract features and save")extracted_vector = gr.JSON(label="Extracted vector:",37 unmodified linesencodings_input = gr.Textbox(value=encodings, visible=False)# Button to extract vectorb_extract.click(fn=encode_quantize,inputs=[file_input, eval_key_input, encodings_input],outputs=[extracted_vector],)# Button to encrypt fileb_encrypt_file.click(fn=encrypt_encoded_quantize,14 unmodified lines15161718192021222324252627282930313233343536281 unmodified lines31831932032132232332432532632732832933033133233333433533633733833937 unmodified lines37737837938038138238338438538638738838939039139239339439539639739839940040114 unmodified linesimport numpy as npimport pdbimport jsondef load_data_from_file(filename):"""Load data from a JSON file in the current directory.Parameters:filename (str): The name of the file to load.Returns:data: The data loaded from the file."""with open(filename, 'r') as file:data = json.load(file)return data# This repository's directoryREPO_DIR = Path(__file__).parentsubprocess.Popen(["uvicorn", "server:app"], cwd=REPO_DIR)281 unmodified linesinteractive=False,)#loadmalware_data = load_data_from_file('malware_features.txt')print(data)gr.Markdown("# π€ Step 2: Upload a file for scanning")gr.Markdown("## Client side")gr.Markdown("Upload a file you want to scan for malware. ClairVault will encrypt it locally before sending it to the cloud.")file_input = gr.File(label="Upload a harmless exe file or use default:", file_count = "single", value="./harmless.exe")gr.Markdown("# π₯ Step 3: Extract executable file features")b_extract = gr.Button("π₯ Extract features from harmless file and save")c_extract = gr.Button("Load features from malware file and save")extracted_vector = gr.JSON(label="Extracted vector:",37 unmodified linesencodings_input = gr.Textbox(value=encodings, visible=False)# Button to extract vectorb_extract.click(fn=encode_quantize,inputs=[file_input, eval_key_input, encodings_input],outputs=[extracted_vector],)c_extract.click(fn=encrypt_encoded_quantize,inputs =[malware_data, user_id_input, eval_key_input],outputs=[encrypted_file],)# Button to encrypt fileb_encrypt_file.click(fn=encrypt_encoded_quantize,
app.py+37-2
smallexe64.exe β harmless.exeRenamed