diff options
| author | 何勇 <[email protected]> | 2024-08-21 07:56:30 +0000 |
|---|---|---|
| committer | 何勇 <[email protected]> | 2024-08-21 07:56:30 +0000 |
| commit | 61df337ee00db0cbca3acdfe48d654797ecc6da6 (patch) | |
| tree | 80628769b155b7fbf2e2194c1d6cadb8d9241174 | |
| parent | 18409b02c61f4ddbf965dde3b97734b3c69c5fd1 (diff) | |
替换 FlaskService.py
| -rw-r--r-- | FlaskService.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/FlaskService.py b/FlaskService.py index 0833591..b3f7c2b 100644 --- a/FlaskService.py +++ b/FlaskService.py @@ -25,8 +25,11 @@ def upload_file(): filepath = os.path.join(app.config['UPLOAD_FOLDER'], file.filename) file.save(filepath) + appsketch_api = request.form.get('url', 'default_value') + pcap_file_id = request.form.get('id', 'default_value') + # Use PcapNGFormatAnalys.py - modified_filepath = modify_file_with_script(filepath) + modified_filepath = modify_file_with_script(filepath, appsketch_api, pcap_file_id) # Delete uploaded and modified files after response @@ -42,11 +45,11 @@ def upload_file(): # Provide modified file download return send_file(modified_filepath, as_attachment=True) -def modify_file_with_script(input_filepath): +def modify_file_with_script(input_filepath, appsketch_api, pcap_file_id): modified_filepath = os.path.join(app.config['MODIFIED_FOLDER'], os.path.basename(input_filepath)) # Use PcapNGFormatAnalys.py to add Remark script_path = 'PcapNGFormatAnalys.py' - subprocess.run(['python', script_path, input_filepath, modified_filepath]) + subprocess.run(['python3', script_path, input_filepath, modified_filepath, appsketch_api, pcap_file_id]) return modified_filepath if __name__ == '__main__': |
