CoolFace
Apppublic

Deeps-2005/java-ssl-scanner

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
patcher.cpython-310.pyc17 linesDownload Raw Back to __pycache__
1o

2:�Kh��@s.ddlZddlZddlZdedefdd�ZdS)�N�code�returnc3CsFtjddddd��}|�|�|j}Wd�n1swYtj�tj�t��}tj�	|ddd	�}tj�	|dd�}zYz-t4jd5d|�tj�|��d|gt6j
t7j
d
d
d�}|j|jd�WWtj�|�rjt�|�SSt8jy�}zdd|j����d�WYd}~Wtj�|�r�t�|�SSd}~wwtj�|�r�t�|�ww)z�9    Runs AutoPatcher.java against the provided Java code using AST patching10    and returns a dict with both the patched code and patch logs.11    Fz.java�wzutf-8)�delete�suffix�mode�encodingNz..�
java_analyzerzjavaparser-core-3.26.4.jar�javaz-cpZAutoPatcherT)�stdout�stderr�text�check)�patched_code�12patch_logs�zPatch failed:13)�tempfile�NamedTemporaryFile�write�name�os�path�abspath�dirname�__file__�join�14subprocess�run�pathsep�PIPErr�exists�remove�CalledProcessError�strip)rZ	temp_fileZ15input_path�	base_path�javaparser_jarZpatcher_classpath�result�e�r(�D:\jsse\backend\patcher.py�patch_java_codesL16����17�������r*)rrr�str�dictr*r(r(r(r)�<module>s