-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into jks
- Loading branch information
Showing
32 changed files
with
827 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,9 @@ jobs: | |
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install hub tool | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y hub | ||
- name: Upload Assets | ||
uses: samsung/supplychainassurance/.github/actions/[email protected] | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ | |
'__version__' | ||
] | ||
|
||
__version__ = "1.5.8" | ||
__version__ = "1.5.9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import io | ||
import logging | ||
from abc import ABC | ||
from typing import List | ||
|
||
import docx | ||
|
||
from credsweeper.credentials import Candidate | ||
from credsweeper.deep_scanner.abstract_scanner import AbstractScanner | ||
from credsweeper.file_handler.data_content_provider import DataContentProvider | ||
from credsweeper.file_handler.string_content_provider import StringContentProvider | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class DocxScanner(AbstractScanner, ABC): | ||
"""Implements docx scanning""" | ||
|
||
def data_scan( | ||
self, # | ||
data_provider: DataContentProvider, # | ||
depth: int, # | ||
recursive_limit_size: int) -> List[Candidate]: | ||
"""Tries to scan DOCX text with splitting by lines""" | ||
candidates: List[Candidate] = [] | ||
|
||
try: | ||
docx_lines: List[str] = [] | ||
|
||
doc = docx.Document(io.BytesIO(data_provider.data)) | ||
for paragraph in doc.paragraphs: | ||
for line in paragraph.text.splitlines(): | ||
if line: | ||
docx_lines.append(line) | ||
|
||
string_data_provider = StringContentProvider(lines=docx_lines, | ||
file_path=data_provider.file_path, | ||
file_type=data_provider.file_type, | ||
info=f"{data_provider.info}|DOCX") | ||
candidates = self.scanner.scan(string_data_provider) | ||
except Exception as docx_exc: | ||
logger.debug(f"{data_provider.file_path}:{docx_exc}") | ||
return candidates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.