Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- UKPT level
- 화학물질불법유통온라인감시단
- 대외활동
- HTML
- 웹 해킹 입문
- Los
- 파이썬
- nurisec
- 화학물질
- 12기
- 국정원
- suninatas
- 정보보안
- MITRE ATT&CK
- codeup
- 연구모임
- 도구모음
- 경기팀
- 불법유통근절
- 불법유통
- 기타정보
- Service
- 프로젝트
- 화학물질안전원
- 국가정보원
- PHP
- webhacking
- 국가기록원
- 여행
- UKPT
Archives
- Today
- Total
agencies
vul 폴더에 있는 patch 파일을 통해 취약한 코드 있는 여부 확인해보기 본문
# Load and read the provided files to analyze the content
patch_file_path = "test.patch"
old_vul_file_path = "test_OLD.vul"
with open(patch_file_path, 'r') as patch_file:
patch_content = patch_file.readlines()
with open(old_vul_file_path, 'r') as old_vul_file:
old_vul_content = old_vul_file.readlines()
# Extract removed lines (starting with '-') from the patch file
removed_lines = [line[1:].strip() for line in patch_content if line.startswith('-')]
# Prepare to check if these lines exist in the old vulnerability file
old_vul_lines = [line.strip() for line in old_vul_content]
# Identify which removed lines exist in the OLD file
vulnerable_lines = [line for line in removed_lines if line in old_vul_lines]
# Print all removed lines with their status
print("=== Removed Lines Vulnerability Details ===")
for line in removed_lines:
if line in vulnerable_lines:
print(f"VULNERABLE: {line}") # Highlight vulnerable lines
else:
print(f"SAFE: {line}") # Show safe lines
# Print overall status
print("\n=== Overall Status ===")
if vulnerable_lines:
print("Status: Vulnerable (At least one removed line exists in OLD file)")
else:
print("Status: Safe (No removed lines exist in OLD file)")
# Save the results to a CSV file for further analysis
import pandas as pd
# Prepare data for saving
results_data = [{"Removed Line": line, "Status": "Vulnerable" if line in vulnerable_lines else "Safe"}
for line in removed_lines]
# Save the details to a CSV file
results_df = pd.DataFrame(results_data)
results_df.to_csv("removed_lines_vulnerability_results.csv", index=False)
print("\nDetails saved to 'removed_lines_vulnerability_results.csv'.")
'Ⅳ. 기타' 카테고리의 다른 글
backward slicing (추상화:joern) + 전체 소스코드 추상화 (0) | 2024.11.29 |
---|---|
joern 을 통한 취약한 함수에 들어가는 파라미터 backward slicing (0) | 2024.11.27 |
CVE database (구축) : 고도화 (combined -> ) (2) | 2024.11.25 |
deepdfa + linevul 운영(초안)단계 시도해보기! 두번째 (2) | 2024.11.21 |
deepdfa + linevul 운영(초안)단계 시도해보기! (1) | 2024.11.20 |