-
Notifications
You must be signed in to change notification settings - Fork 62
Adds get_oui and flat ci process to pull OUI data into repo #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
858e56f
Testing oui file pull
d3ff7f3
Test #2
715c229
Test3
c5b25b7
Test4
69a2023
Flat: latest data (2022-09-12T18:38:07.891Z)
flat-data f1fb21b
Test5
7ca58c4
Flat: latest data (2022-09-12T19:24:55.944Z)
flat-data 8fa1f77
TEst postprocess
6968e3b
Test7
eba2690
Updated
70ce8b9
Test9
fc25002
Flat: latest data (2022-09-12T19:42:33.332Z)
flat-data 0d3c354
Test11
d028907
Flat: latest data (2022-09-12T19:46:33.601Z)
flat-data 90cdd15
Updated python file path
f42f966
Update deno path
997c620
Updated
5eb3788
Test local
4df289c
Test13
ca3ab34
Flat: latest data (2022-09-12T20:17:34.717Z)
flat-data bbad67b
Add lower
d7ec05a
Flat: latest data (2022-09-12T20:23:39.725Z)
flat-data ab693f2
Updated docstring
2bd61cf
Flat: latest data (2022-09-12T20:38:29.667Z)
flat-data 988d488
Add cron schedule
f665d4b
Added trailing comma
6ea8659
Flat: latest data (2022-09-12T20:55:56.830Z)
flat-data 6e0849e
Removed oui_mappings from black
97dc5a4
Flat: latest data (2022-09-12T21:02:54.064Z)
flat-data d759ab3
Yamllint fixes
6822149
Flat: latest data (2022-09-13T16:53:54.938Z)
flat-data 82797ca
Test15
6f94787
Flat: latest data (2022-09-13T17:03:53.398Z)
flat-data 272a3f2
Updated to use constants file
d59f9da
Flat: latest data (2022-09-13T18:24:49.653Z)
flat-data dfc467b
Updated tests
c37881b
Blackened
f53fae8
Changed ci time
8ada0a1
Change schedule for flat workflow to run
703693b
Removed print from postprocessing script
c26ea60
Reverted pyproject
587accd
Fixed pyproject
5c6c5c9
Update .github/workflows/oui_filepull.yml
qduk 3088f6c
Typed OUI_mappings dict
7a73e50
Testing creating dictionary
df2f4ae
Flat: latest data (2022-09-21T13:25:20.479Z)
flat-data e8da206
Updated filename in workflow
ea6a87a
Flat: latest data (2022-09-21T13:31:32.443Z)
flat-data 0f250aa
linted
fd0ed42
Fixes
1589795
Flat: latest data (2022-09-21T13:52:01.337Z)
flat-data 997dcb7
Fixed syntax in postproces file
7a42550
Flat: latest data (2022-09-21T13:55:19.286Z)
flat-data 23d1d92
Linted OUI file
6b8f980
Flat: latest data (2022-09-21T13:57:51.812Z)
flat-data 869f8dd
Updated workflow schedule
330f217
linted
069465c
Flat: latest data (2022-09-21T14:07:24.860Z)
flat-data e295cf6
postprocess updates
979b3d2
Flat: latest data (2022-09-21T14:09:38.997Z)
flat-data 1e4a484
Modify flat schedule
ead6c29
Fix my py
8ee1095
linted
1c68134
Removed oui_mappings from bandit
1c1ac36
pylinted
76e5355
Flat: latest data (2022-09-21T17:48:18.614Z)
flat-data 7477cb0
Add new line
382c399
Flat: latest data (2022-09-21T17:51:36.253Z)
flat-data 1999bcb
Remove CI for push to my branch
d4a9701
Reverted tasks python version
6afcfd5
uncomment valid mac decorator
83d70c6
Removed profile decorator
9025e13
Update .github/workflows/oui_filepull.yml
qduk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| skips: [] | ||
| # No need to check for security issues in the test scripts! | ||
| exclude_dirs: | ||
| - "./tests/" | ||
| - "./docs/" | ||
| - "netutils/oui_mappings.py" |
This file contains hidden or 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,27 @@ | ||
| --- | ||
| name: "Flat" | ||
|
|
||
| on: # yamllint disable-line rule:truthy | ||
| pull_request: | ||
| branches: | ||
| - "main" | ||
|
|
||
| jobs: | ||
| scheduled: | ||
| runs-on: "ubuntu-latest" | ||
| steps: | ||
| # This step installs Deno, which is a new Javascript runtime that improves on Node. Can be used for an optional postprocessing step | ||
| - name: "Setup deno" | ||
| uses: "denoland/setup-deno@main" | ||
| with: | ||
| deno-version: "v1.10.x" | ||
| # Check out the repository so it can read the files inside of it and do other operations | ||
| - name: "Check out repo" | ||
| uses: "actions/checkout@v2" | ||
| # The Flat Action step. We fetch the data in the http_url and save it as downloaded_filename | ||
| - name: "Fetch data" | ||
| uses: "githubocto/flat@v3" | ||
| with: | ||
| http_url: "https://standards-oui.ieee.org" | ||
| downloaded_filename: "./netutils/oui_mappings.py" | ||
| postprocess: "./flat_postprocess/oui_postprocess.ts" |
This file contains hidden or 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,23 @@ | ||
| """Python code used to postprocess Flat github action data related to OUI mappings.""" | ||
| import sys | ||
| import re | ||
|
|
||
| HEX_RE = r"^(?P<hex>[A-Fa-f0-9]{6})\s+\(.*\)[^a-zA-Z0-9]+(?P<company>.*)$" | ||
| OUI_MAPPINGS = {} | ||
|
|
||
| if __name__ == "__main__": | ||
| with open(sys.argv[1], "r", encoding="utf-8") as oui_file: | ||
| for line in oui_file: | ||
| if re.search(HEX_RE, line): | ||
| group_regex_values = re.search(HEX_RE, line).groupdict() | ||
| if group_regex_values.get("hex") and group_regex_values.get("company"): | ||
| OUI_MAPPINGS.update({group_regex_values.get("hex").lower(): group_regex_values.get("company")}) | ||
|
|
||
| with open(sys.argv[1], "w", encoding="utf-8") as oui_mappings: | ||
| oui_mappings.write('"""Dictionary object to store OUI information."""\n') | ||
| oui_mappings.write("# pylint: disable=too-many-lines\n") | ||
| oui_mappings.write("import typing\n\n") | ||
| oui_mappings.write("OUI_MAPPINGS: typing.Dict[str, str] = {\n") | ||
| for mac, company in OUI_MAPPINGS.items(): | ||
| oui_mappings.write(f' "{mac}": "{company}",\n') | ||
| oui_mappings.write("}\n") |
This file contains hidden or 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,6 @@ | ||
| // Forwards the execution to the python script | ||
| const py_run = Deno.run({ | ||
| cmd: ['python', './flat_postprocess/oui_postprocess.py'].concat(Deno.args), | ||
| }); | ||
|
|
||
| await py_run.status(); |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the pattern created already uses constants.py, that being said... perhaps we should consider running the load of the json file here and doing it intelligently?
With this pattern, you only load into memory if you actually use the function.