https://github.com/tester1010101/get-rules-groups
:snowflake: Firewall Groups & Rules Dumper — Converts "Allow" rules to applicable commands, for Windows (PowerShell) :open_umbrella:
https://github.com/tester1010101/get-rules-groups
11 advanced converter dump export firewall group groups multiple rules single windows
Last synced: 3 months ago
JSON representation
:snowflake: Firewall Groups & Rules Dumper — Converts "Allow" rules to applicable commands, for Windows (PowerShell) :open_umbrella:
- Host: GitHub
- URL: https://github.com/tester1010101/get-rules-groups
- Owner: tester1010101
- Created: 2021-12-30T23:21:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-28T21:15:01.000Z (over 3 years ago)
- Last Synced: 2025-05-19T00:16:29.817Z (about 1 year ago)
- Topics: 11, advanced, converter, dump, export, firewall, group, groups, multiple, rules, single, windows
- Language: PowerShell
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Get-Rules & Groups (v1.2) :recycle: :beginner:
* :diamond_shape_with_a_dot_inside: Dumps ALL ("Allow") **Firewall Rules** from Windows Defender Firewall with Advanced Security.
* :diamond_shape_with_a_dot_inside: Reconverts them into applicables one through "netsh advfirewall firewall add rule".
* :diamond_shape_with_a_dot_inside: Will get dumped & converted in: %USERPROFILE%\Rules\FWCommands.txt
* :diamond_shape_with_a_dot_inside: Prompts user to open the dump/rules location, for analysis/learning/re-apply/backups.
* ## :open_file_folder: To-do: Add to extraction/conversion: Deny rules :no_entry: ##
* ## :warning: Packages in rules won't be applied/converted/extracted to rules (to-do) ##

## Instructions:
* __Right-click the script, run in PowerShell__ :repeat_one:
> Get-Rules Block :cinema:
> 1. Creates the Rules folder in %USERPROFILE%\Rules if not present
> 2. Dumps all "allowed" firewall rules into a textfile at %USERPROFILE%\Rules\FW-Rules.txt
> 3. Stock the rules into a variable from the file dumped (user can use custom file/path)
> 4. Parse each rules ending at '(?<=Action: Allow)'
> 5. Create a .txt of each rules at %USERPROFILE%\Rules\$i.txt
> 6. Increment until none left

> Conversion (Rules, Groups) :arrows_counterclockwise:
> 1. Gets the last item of the rules dumped, then starts the loop until last rule
> 2. Starting from rule #1, it'll extract all rule's parameters into variables
> 3. Then create a netsh command to re-enter it as needed, with rule's variables
> 4. Each set of variables creates a command which is added to a command file
> 5. Final textfile contains all commands ready to be applied, in the 'netsh' format.



I created this dumper to easily re-create multiple rules I needed. Be sure to note the packages or you may be missing some stuff, lemme know if anything is wrong!
With the "Export Policy" option, you can't select which to export/import, (like the predefined firewall rules) you have to overwrite the whole set :x: