Skip to content

Commit

Permalink
feat: Adding Github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifercr07 committed Jun 11, 2024
1 parent 62cab54 commit d972b94
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 11 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/auto-assign-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# .github/workflows/auto-author-assign.yml
name: 'Auto Author Assign'

on:
pull_request_target:
types: [opened, reopened]

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/[email protected]
37 changes: 37 additions & 0 deletions .github/workflows/pre-commit-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: precommit-actions
run-name: ${{ github.actor }} is running precommit actions.
on:
push:
branches-ignore: [main]
pull_request:
branches: [main]
jobs:
build:
name: Lint
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
fetch-depth: 0

- name: Super-linter
uses: super-linter/[email protected] # x-release-please-version
env:
DEFAULT_BRANCH: main
# To report GitHub Actions status checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORE_GITIGNORED_FILES: true
VALIDATE_ALL_CODEBASE: true
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_HTML: true

32 changes: 32 additions & 0 deletions .github/workflows/semantic-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Semantic PRs"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# first type as the one from https://github.com/commitizen/conventional-commit-types/blob/master/index.json
# l10n (localization) is for translations updates
types: |
feat
fix
docs
style
refactor
test
build
ci
chore
revert
l10n
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

A command-line tool designed to detect and purge any and all macros and dynamic content from commonly used office document formats (including MS Office Files, PDFs, etc.).

[![Super-Linter](https://github.com/Anti-Malware-Alliance/ms-office-macro-bleach/actions/workflows/pre-commit-actions.yml/badge.svg)](https://github.com/marketplace/actions/super-linter)

## Supported formats

### Word
Expand Down
29 changes: 18 additions & 11 deletions ms_office_macro_bleach/bleach.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
"""This module removes any and all macros/dynamic content from MS Office files.
VBA and OLE content in MS Office files can, and have sometimes been made to, act as vehicles for malware delivery.
VBA and OLE content in MS Office files can, and have sometimes been made to,
act as vehicles for malware delivery.
Microsoft has previously attempted to protect users from macros by disabling them by default.
Microsoft has previously attempted to protect users from macros by disabling
them by default.
However, anybody is able to enable macros in an MS Office file before sending them on to a potential victim.
However, anybody is able to enable macros in an MS Office file before sending
them on to a potential victim.
This module enables users to simply and safely remove any and all macros/dynamic content from MS Office files.
This module enables users to simply and safely remove any and all
macros/dynamic content from MS Office files.
It converts the given file into a '.zip' archive, unzips it, and deletes the files containing macro data.
It converts the given file into a '.zip' archive, unzips it, and
deletes the files containing macro data.
It then re-zips the unzipped archive and reverts it to its original file format.
It then re-zips the unzipped archive and reverts it to its original
file format.
It is part of a suite of programs developed by the AntiMalware Alliance.
It is part of a suite of programs developed by the AntiMalware
Alliance.
Visit https://github.com/Anti-Malware-Alliance for more details about our organisation and projects.
Visit https://github.com/Anti-Malware-Alliance for more details
about our organisation and projects.
"""
from argparse import ArgumentParser
from os import rename, path, remove
Expand All @@ -23,7 +31,6 @@
from shutil import make_archive, rmtree
from olefile import OleFileIO


ooxml_formats = [
"docx",
"docm",
Expand All @@ -50,7 +57,6 @@

bff_formats = [
"doc",
#"ppt",
"xls",
]

Expand Down Expand Up @@ -155,7 +161,8 @@ def validate_file(file):
def main():
parser = ArgumentParser()
parser.add_argument("file", help="file to be bleached")
parser.add_argument("-c", help="notify if macros or potentially dangerous content is found", action="store_true")
parser.add_argument("-c", help="notify if macros or potentially dangerous "
"content is found", action="store_true")
args = parser.parse_args()

if validate_file(args.file):
Expand Down

0 comments on commit d972b94

Please sign in to comment.