Skip to content

Commit

Permalink
Merge pull request #7 from PaloAltoNetworks/feat-arp-entry-exists
Browse files Browse the repository at this point in the history
Feat arp entry exists
  • Loading branch information
adambaumeister authored Sep 12, 2023
2 parents 5cb6800 + 581974d commit f8f1b0f
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 9 deletions.
163 changes: 162 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,164 @@
*.log
uploadable_packs
Packs/AllCustomContent
Packs/AllCustomContent

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def run_readiness_checks(
dp_mp_clock_diff: Optional[int] = None,
ipsec_tunnel_status: Optional[str] = None,
check_session_exists: Optional[str] = None,
arp_entry_exists: Optional[str] = None
):
"""
Run all the readiness checks and return an xsoar-compatible result.
Expand All @@ -95,6 +96,8 @@ def run_readiness_checks(
:arg check_session_exists: Check for the presence of a specific connection.
Session check format is <source>/destination/destination-port
example: 10.10.10.10/8.8.8.8/443
:arg arp_entry_exists: Check for the prescence of a specific ARP entry.
example: 10.0.0.6
"""

if not check_list:
Expand Down Expand Up @@ -144,6 +147,13 @@ def run_readiness_checks(
"session_exist": check_value
})

if arp_entry_exists:
custom_checks.append({
'arp_entry_exist': {
'ip': arp_entry_exists
}
})

check_config = check_list + custom_checks

checks = CheckFirewall(firewall, **SETTINGS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ script:
required: false
secret: false
default: false
- name: arp_entry_exists
isArray: false
description: Check for the existence of a specific IP in the ARP Table.
required: false
secret: false
default: false
- name: check_session_exists
isArray: false
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"startCol": 0
}
],
"maxH": null,
"maxW": 3,
"minH": 1,
"moved": false,
Expand All @@ -67,7 +66,6 @@
"displayType": "ROW",
"h": 2,
"i": "caseinfoid-6aabad20-98b1-11e9-97d7-ed26ef9e46c8",
"maxH": null,
"maxW": 3,
"minH": 1,
"moved": false,
Expand Down Expand Up @@ -111,7 +109,6 @@
"startCol": 0
}
],
"maxH": null,
"maxW": 3,
"minH": 1,
"moved": false,
Expand Down Expand Up @@ -164,7 +161,6 @@
"startCol": 0
}
],
"maxH": null,
"maxW": 3,
"minH": 1,
"moved": false,
Expand All @@ -191,7 +187,6 @@
"startCol": 0
}
],
"maxH": null,
"maxW": 3,
"minH": 1,
"moved": false,
Expand Down Expand Up @@ -225,7 +220,6 @@
"startCol": 0
}
],
"maxH": null,
"maxW": 3,
"minH": 1,
"moved": false,
Expand Down
7 changes: 5 additions & 2 deletions release.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Fixes:
* Fixed Race Condition in run comparison task when File.EntryID not updated in time.
Features:
* Added ARP Table Session Exist check. This allows the user to specify a specific item exists in the
arp table when running the checks.
* Updated the Assurance playbook to run the readiness checks before AND after the upgrade process to ensure
changes in those checks are visualized in the incidents.

0 comments on commit f8f1b0f

Please sign in to comment.