├── .github ├── CODEOWNERS ├── FUNDING.yml └── workflows │ ├── cd.yml │ └── ci.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── angular.json ├── docker-compose.yml ├── nginx.conf ├── package-lock.json ├── package.json ├── sample-files ├── complex-pfsense.xml ├── opnsense.xml ├── output-opnsense.json ├── output-pfsense.json ├── pfsense-2.xml ├── pfsense-3.xml └── pfsense.xml ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── header │ │ ├── header.component.html │ │ ├── header.component.scss │ │ ├── header.component.spec.ts │ │ └── header.component.ts │ ├── info │ │ ├── info.component.html │ │ ├── info.component.scss │ │ ├── info.component.spec.ts │ │ └── info.component.ts │ ├── mappings │ │ ├── opnsense.interface.ts │ │ ├── pfsense-complex.interface.ts │ │ └── pfsense.interface.ts │ ├── services │ │ ├── converter.service.spec.ts │ │ └── converter.service.ts │ └── upload │ │ ├── upload.component.html │ │ ├── upload.component.scss │ │ ├── upload.component.spec.ts │ │ └── upload.component.ts ├── assets │ └── .gitkeep ├── favicon.ico ├── index.html ├── main.ts └── styles.scss ├── tsconfig.app.json ├── tsconfig.json └── tsconfig.spec.json /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/articles/about-code-owners 2 | # These owners will be the default owners for everything in 3 | # the repo. Unless a later match takes precedence, they 4 | # will be requested for review when someone opens a PR. 5 | * @mwood77 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [mwood77]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: mwood77 # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: ['https://www.paypal.com/paypalme/kklarkson'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/cd.yml: -------------------------------------------------------------------------------- 1 | name: cd 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - 'main' 8 | tags: 9 | - "v*.*.*" 10 | release: 11 | types: [published] 12 | 13 | jobs: 14 | build_push_to_registry: 15 | name: Build/Push Image to Docker Hub 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Check out the repo 19 | uses: actions/checkout@v4 20 | 21 | - name: Set up QEMU 22 | uses: docker/setup-qemu-action@v3 23 | 24 | - name: Set up Docker Buildx 25 | uses: docker/setup-buildx-action@v3 26 | 27 | - name: Log in to Docker Hub 28 | uses: docker/login-action@v3 29 | with: 30 | username: ${{ secrets.DOCKERHUB_USERNAME }} 31 | password: ${{ secrets.DOCKERHUB_TOKEN }} 32 | 33 | - name: Extract metadata (tags, labels) for Docker 34 | id: meta 35 | uses: docker/metadata-action@v5 36 | with: 37 | images: ${{ secrets.DOCKERHUB_USERNAME }}/pf2opn 38 | tags: | 39 | type=schedule 40 | type=ref,event=branch 41 | type=ref,event=pr 42 | type=semver,pattern={{version}} 43 | type=semver,pattern={{version}} 44 | type=semver,pattern={{major}}.{{minor}} 45 | type=semver,pattern={{major}} 46 | type=sha 47 | 48 | - name: Build and push Docker image 49 | uses: docker/build-push-action@v5 50 | with: 51 | context: . 52 | file: Dockerfile 53 | platforms: linux/amd64,linux/arm64 54 | push: true 55 | tags: ${{ steps.meta.outputs.tags }} 56 | labels: ${{ steps.meta.outputs.labels }} 57 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | pull_request: 5 | workflow_dispatch: 6 | 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | 16 | - name: Setup Node Environment 17 | uses: actions/setup-node@v4 18 | 19 | - name: Install Dependencies 20 | run: npm ci 21 | 22 | - name: Build project 23 | run: npm run build 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | .angular 4 | .vscode 5 | dist -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:21.1-alpine3.18 AS build 2 | WORKDIR /usr/src/app 3 | COPY package.json package-lock.json ./ 4 | RUN npm install 5 | COPY . . 6 | RUN npm run build --prod 7 | 8 | FROM nginx:1.25-alpine3.18-slim 9 | COPY nginx.conf /etc/nginx/nginx.conf 10 | COPY --from=build /usr/src/app/dist/pf2open /usr/share/nginx/html -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution-NonCommercial 4.0 International Public License 2 | 3 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 4 | 5 | Section 1 – Definitions. 6 | 7 | Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 8 | Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 9 | Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 10 | Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 11 | Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 12 | Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 13 | Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 14 | Licensor means the individual(s) or entity(ies) granting rights under this Public License. 15 | NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. 16 | Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 17 | Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 18 | You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 19 | Section 2 – Scope. 20 | 21 | License grant. 22 | Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 23 | reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and 24 | produce, reproduce, and Share Adapted Material for NonCommercial purposes only. 25 | Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 26 | Term. The term of this Public License is specified in Section 6(a). 27 | Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 28 | Downstream recipients. 29 | Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 30 | No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 31 | No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 32 | Other rights. 33 | 34 | Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 35 | Patent and trademark rights are not licensed under this Public License. 36 | To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. 37 | Section 3 – License Conditions. 38 | 39 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 40 | 41 | Attribution. 42 | 43 | If You Share the Licensed Material (including in modified form), You must: 44 | 45 | retain the following if it is supplied by the Licensor with the Licensed Material: 46 | identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 47 | a copyright notice; 48 | a notice that refers to this Public License; 49 | a notice that refers to the disclaimer of warranties; 50 | a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 51 | indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 52 | indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 53 | You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 54 | If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 55 | If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. 56 | Section 4 – Sui Generis Database Rights. 57 | 58 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 59 | 60 | for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; 61 | if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and 62 | You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 63 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 64 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 65 | 66 | Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. 67 | To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. 68 | The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 69 | Section 6 – Term and Termination. 70 | 71 | This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 72 | Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 73 | 74 | automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 75 | upon express reinstatement by the Licensor. 76 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 77 | For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 78 | Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 79 | Section 7 – Other Terms and Conditions. 80 | 81 | The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 82 | Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. 83 | Section 8 – Interpretation. 84 | 85 | For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 86 | To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 87 | No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 88 | Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 89 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. 90 | 91 | Creative Commons may be contacted at creativecommons.org. 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pf2open 2 | 3 | A simple pfsense to opnsense config mapper. 4 | 5 | ### Run it with docker: 6 | ``` 7 | docker run --name pf2opn -p 4200:80 -d mwood77/pf2opn:main 8 | ``` 9 | 10 | ### Use it on the web: 11 | - [`https://www.pf2opn.com`](https://www.pf2opn.com) 12 | 13 | ### Want to contirute? 14 | - Read the [prerequisites](#prerequisites) and then proceed to [installation & running locally for development](#installation--running-locally-for-development) 15 | 16 | ## Development 17 | 18 | ### Prerequisites 19 | 20 | 1. Clone this repository 21 | 1. Download [NodeJS](https://nodejs.org/en) 22 | 1. Download [Angular's cli](https://angular.io/guide/setup-local#install-the-angular-cli) 23 | 24 | ### Installation & Running locally for development 25 | 26 | 1. `cd` into this repository 27 | 1. Run `npm i` to install project dependencies 28 | 1. Run `npm run start` to spool up a development server 29 | 1. Navigate to [`localhost:4200`](localhost:4200) to see the website. The application will automatically reload if you change any of the source files. 30 | 31 | ## Deployment 32 | 33 | > [!IMPORTANT] 34 | > These images are built in production mode. They are not suitable for development. 35 | 36 | ### Prerequisites (for Docker/Podman) 37 | 38 | 1. Clone this repository 39 | 2. Install [Docker](https://docs.docker.com/engine/install/) or [Podman](https://podman.io/docs/installation) 40 | 41 | ### Deployment via Docker or Podman 42 | 43 | 1. `cd` into this repository 44 | 1. Run `docker compose up` 45 | 1. Navigate to [`localhost:4200`](localhost:4200) to see the website. 46 | 47 | #### Alternative: 48 | 1. Build docker image: 49 | ``` 50 | docker build -t pf2opn . 51 | ``` 52 | 1. Run docker image: 53 | ``` 54 | docker run -p 4200:80 -d pf2opn 55 | ``` 56 | 1. Navigate to [`localhost:4200`](localhost:4200) to see the website. 57 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "pf2open": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/pf2open", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": [ 24 | "zone.js" 25 | ], 26 | "tsConfig": "tsconfig.app.json", 27 | "inlineStyleLanguage": "scss", 28 | "assets": [ 29 | "src/favicon.ico", 30 | "src/assets" 31 | ], 32 | "styles": [ 33 | "@angular/material/prebuilt-themes/purple-green.css", 34 | "src/styles.scss" 35 | ], 36 | "scripts": [] 37 | }, 38 | "configurations": { 39 | "production": { 40 | "budgets": [ 41 | { 42 | "type": "initial", 43 | "maximumWarning": "500kb", 44 | "maximumError": "1mb" 45 | }, 46 | { 47 | "type": "anyComponentStyle", 48 | "maximumWarning": "2kb", 49 | "maximumError": "4kb" 50 | } 51 | ], 52 | "outputHashing": "all" 53 | }, 54 | "development": { 55 | "buildOptimizer": false, 56 | "optimization": false, 57 | "vendorChunk": true, 58 | "extractLicenses": false, 59 | "sourceMap": true, 60 | "namedChunks": true 61 | } 62 | }, 63 | "defaultConfiguration": "production" 64 | }, 65 | "serve": { 66 | "builder": "@angular-devkit/build-angular:dev-server", 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "pf2open:build:production" 70 | }, 71 | "development": { 72 | "browserTarget": "pf2open:build:development" 73 | } 74 | }, 75 | "defaultConfiguration": "development" 76 | }, 77 | "extract-i18n": { 78 | "builder": "@angular-devkit/build-angular:extract-i18n", 79 | "options": { 80 | "browserTarget": "pf2open:build" 81 | } 82 | }, 83 | "test": { 84 | "builder": "@angular-devkit/build-angular:karma", 85 | "options": { 86 | "polyfills": [ 87 | "zone.js", 88 | "zone.js/testing" 89 | ], 90 | "tsConfig": "tsconfig.spec.json", 91 | "inlineStyleLanguage": "scss", 92 | "assets": [ 93 | "src/favicon.ico", 94 | "src/assets" 95 | ], 96 | "styles": [ 97 | "@angular/material/prebuilt-themes/purple-green.css", 98 | "src/styles.scss" 99 | ], 100 | "scripts": [] 101 | } 102 | } 103 | } 104 | } 105 | }, 106 | "cli": { 107 | "analytics": false 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.9' 2 | 3 | # docker|podman run --name pf2opn -p 4200:80 -d pf2opn 4 | services: 5 | pf2opn: 6 | container_name: pf2opn 7 | name: pf2opn 8 | image: pf2opn 9 | build: 10 | context: . 11 | dockerfile: Dockerfile 12 | ports: 13 | - '4200:80' -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | events{} 2 | 3 | http { 4 | 5 | include /etc/nginx/mime.types; 6 | 7 | server { 8 | listen 80; 9 | server_name localhost; 10 | root /usr/share/nginx/html; 11 | index index.html; 12 | 13 | location / { 14 | try_files $uri $uri/ /index.html; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pf2open", 3 | "version": "0.2.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "watch": "ng build --watch --configuration development", 9 | "test": "ng test" 10 | }, 11 | "private": true, 12 | "dependencies": { 13 | "@angular/animations": "^16.2.0", 14 | "@angular/cdk": "^16.2.10", 15 | "@angular/common": "^16.2.0", 16 | "@angular/compiler": "^16.2.0", 17 | "@angular/core": "^16.2.0", 18 | "@angular/forms": "^16.2.0", 19 | "@angular/material": "^16.2.10", 20 | "@angular/platform-browser": "^16.2.0", 21 | "@angular/platform-browser-dynamic": "^16.2.0", 22 | "@angular/router": "^16.2.0", 23 | "@types/flat": "^5.0.4", 24 | "fast-xml-parser": "^4.4.1", 25 | "flat": "^6.0.1", 26 | "rxjs": "~7.8.0", 27 | "tslib": "^2.3.0", 28 | "uuid": "^9.0.1", 29 | "xml-formatter": "^3.6.2", 30 | "zone.js": "~0.13.0" 31 | }, 32 | "devDependencies": { 33 | "@angular-devkit/build-angular": "^16.2.16", 34 | "@angular/cli": "^16.2.8", 35 | "@angular/compiler-cli": "^16.2.0", 36 | "@types/jasmine": "~4.3.0", 37 | "@types/node": "^20.8.9", 38 | "@types/uuid": "^9.0.6", 39 | "jasmine-core": "~4.6.0", 40 | "karma": "~6.4.0", 41 | "karma-chrome-launcher": "~3.2.0", 42 | "karma-coverage": "~2.2.0", 43 | "karma-jasmine": "~5.1.0", 44 | "karma-jasmine-html-reporter": "~2.1.0", 45 | "typescript": "~5.1.3" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /sample-files/opnsense.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22.1 4 | 5 | 12345678-1234-1234-1234-1234567890ab 6 | 7 | 8 | my-opnsense-firewall 9 | localdomain 10 | Pacific/Honolulu 11 | English 12 | 13 | 14 | 15 | 1 16 | 192.168.1.1 17 | 24 18 | LAN interface 19 | 20 | 21 | 1 22 | 203.0.113.1 23 | 30 24 | 203.0.113.2 25 | WAN interface 26 | 27 | 28 | 29 | 30 | 31 | 12345678-1234-1234-1234-1234567890cd 32 | pass 33 | 1 34 | wan 35 | Allow SSH Inbound 36 | tcp 37 | 38 | 1 39 | 40 | 41 |
203.0.113.1
42 | 22 43 |
44 |
45 |
46 |
47 |
48 | -------------------------------------------------------------------------------- /sample-files/output-opnsense.json: -------------------------------------------------------------------------------- 1 | { 2 | "?xml": "", 3 | "opnsense": { 4 | "version": 22.1, 5 | "config-apply": { 6 | "uuid": "12345678-1234-1234-1234-1234567890ab" 7 | }, 8 | "system": { 9 | "hostname": "my-opnsense-firewall", 10 | "domain": "localdomain", 11 | "timezone": "Pacific/Honolulu", 12 | "language": "English" 13 | }, 14 | "interfaces": { 15 | "lan": { 16 | "enable": 1, 17 | "ipaddr": "192.168.1.1", 18 | "subnet": 24, 19 | "descr": "LAN interface" 20 | }, 21 | "wan": { 22 | "enable": 1, 23 | "ipaddr": "203.0.113.1", 24 | "subnet": 30, 25 | "gateway": "203.0.113.2", 26 | "descr": "WAN interface" 27 | } 28 | }, 29 | "firewall": { 30 | "rules": { 31 | "rule": { 32 | "uuid": "12345678-1234-1234-1234-1234567890cd", 33 | "type": "pass", 34 | "enabled": 1, 35 | "interface": "wan", 36 | "descr": "Allow SSH Inbound", 37 | "protocol": "tcp", 38 | "source": { 39 | "any": 1 40 | }, 41 | "destination": { 42 | "address": "203.0.113.1", 43 | "port": 22 44 | } 45 | } 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /sample-files/output-pfsense.json: -------------------------------------------------------------------------------- 1 | { 2 | "?xml": "", 3 | "pfsense": { 4 | "version": "2.5.1", 5 | "lastchange": "Wed Oct 26 14:30:15 UTC 2023", 6 | "system": { 7 | "hostname": "my-pfsense-firewall", 8 | "domain": "localdomain", 9 | "timezone": "UTC", 10 | "language": "English" 11 | }, 12 | "interfaces": { 13 | "lan": { 14 | "if": "em0", 15 | "descr": "LAN", 16 | "ipaddr": "192.168.1.1", 17 | "subnet": 24, 18 | "gateway": "none", 19 | "isdhcp": false 20 | }, 21 | "wan": { 22 | "if": "em1", 23 | "descr": "WAN", 24 | "ipaddr": "203.0.113.1", 25 | "subnet": 30, 26 | "gateway": "203.0.113.2", 27 | "isdhcp": false 28 | } 29 | }, 30 | "nat": { 31 | "outbound": { 32 | "mode": "automatic" 33 | } 34 | }, 35 | "firewall": { 36 | "rule": { 37 | "if": "WAN", 38 | "descr": "Allow SSH Inbound", 39 | "proto": "tcp", 40 | "src": "any", 41 | "dst": "203.0.113.1", 42 | "dstport": 22 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /sample-files/pfsense-2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11.1 4 | 5 | pfsense_ng 6 | 7 | 8 | 9 | vfs.forcesync 10 | default 11 | 12 | 13 | 14 | debug.pfftpproxy 15 | default 16 | 17 | 18 | 19 | vfs.read_max 20 | default 21 | 22 | 23 | 24 | net.inet.ip.portrange.first 25 | default 26 | 27 | 28 | 29 | net.inet.tcp.blackhole 30 | default 31 | 32 | 33 | 34 | net.inet.udp.blackhole 35 | default 36 | 37 | 38 | 39 | net.inet.ip.random_id 40 | default 41 | 42 | 43 | 44 | net.inet.tcp.drop_synfin 45 | default 46 | 47 | 48 | 49 | net.inet.ip.redirect 50 | default 51 | 52 | 53 | 54 | net.inet6.ip6.redirect 55 | default 56 | 57 | 58 | 59 | net.inet6.ip6.use_tempaddr 60 | default 61 | 62 | 63 | 64 | net.inet6.ip6.prefer_tempaddr 65 | default 66 | 67 | 68 | 69 | net.inet.tcp.syncookies 70 | default 71 | 72 | 73 | 74 | net.inet.tcp.recvspace 75 | default 76 | 77 | 78 | 79 | net.inet.tcp.sendspace 80 | default 81 | 82 | 83 | 84 | net.inet.ip.fastforwarding 85 | default 86 | 87 | 88 | 89 | net.inet.tcp.delayed_ack 90 | default 91 | 92 | 93 | 94 | net.inet.udp.maxdgram 95 | default 96 | 97 | 98 | 99 | net.link.bridge.pfil_onlyip 100 | default 101 | 102 | 103 | net.link.bridge.pfil_member 104 | 0 105 | 106 | 107 | 108 | 109 | net.link.bridge.pfil_bridge 110 | default 111 | 112 | 113 | 114 | net.link.tap.user_open 115 | default 116 | 117 | 118 | 119 | kern.randompid 120 | default 121 | 122 | 123 | 124 | net.inet.ip.intr_queue_maxlen 125 | default 126 | 127 | 128 | 129 | hw.syscons.kbd_reboot 130 | default 131 | 132 | 133 | 134 | net.inet.tcp.inflight.enable 135 | default 136 | 137 | 138 | 139 | net.inet.tcp.log_debug 140 | default 141 | 142 | 143 | 144 | net.inet.icmp.icmplim 145 | default 146 | 147 | 148 | 149 | net.inet.tcp.tso 150 | default 151 | 152 | 153 | 154 | net.inet.udp.checksum 155 | default 156 | 157 | 158 | 159 | kern.ipc.maxsockbuf 160 | default 161 | 162 | 163 | 164 | normal 165 | pfSense 166 | localdomain 167 | 8.8.8.8 168 | 8.8.4.4 169 | 170 | all 171 | 172 | system 173 | 1998 174 | 175 | 176 | admins 177 | 178 | system 179 | 1999 180 | 0 181 | page-all 182 | 183 | 184 | admin 185 | 186 | system 187 | admins 188 | 189 | 0 190 | user-shell-access 191 | 192 | 193 | 194 | 2001 195 | 2000 196 | America/New_York 197 | 300 198 | 0.pfsense.pool.ntp.org 199 | 200 | https 201 | 202 | 203 | 204 | 2 205 | 206 | yes 207 | 208 | 209 | 210 | adp 211 | 212 | monthly 213 | 214 | 215 | 216 | enabled 217 | coretemp 218 | 219 | 220 | 221 | 222 | 223 | https://snapshots.pfsense.org/FreeBSD_releng/10.1/i386/pfSense_HEAD/.updaters/ 224 | 225 | 226 | 227 | 228 | 229 | 230 | 9600 231 | serial 232 | 233 | adp 234 | adp 235 | 236 | 237 | 238 | 239 | pppoe0 240 | 241 | 242 | 243 | 244 | pppoe 245 | 246 | 247 | 248 | bridge0 249 | 250 | 192.168.1.1 251 | 24 252 | 253 | 254 | 255 | 256 | em2 257 | 258 | 259 | 192.168.2.1 260 | 24 261 | 262 | 263 | 264 | ath0 265 | 266 | hostap 267 | 11ng 268 | off 269 | 270 | 11 271 | 272 | 99 273 | 274 | fcc 275 | US 276 | anywhere 277 | 278 | 279 | 1 280 | 2 281 | WPA-PSK 282 | CCMP 283 | 60 284 | 3600 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 0 299 | 0 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | em1 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 192.168.1.100 318 | 192.168.1.245 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 00:00:00:00:00:79 339 | 192.168.1.52 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 00:00:00:00:00:78 355 | 192.168.1.53 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 00:00:00:00:00:77 371 | 192.168.1.55 372 | sselph-macbookpro 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 00:00:00:00:00:76 387 | 192.168.1.60 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 00:00:00:00:00:75 403 | 192.168.1.65 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 00:00:00:00:00:74 419 | 192.168.1.66 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 192.168.2.100 437 | 192.168.2.200 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | public 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 500 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | wanip 489 | 39435 490 | 491 | tcp/udp 492 | 192.168.1.53 493 | 39435 494 | wan 495 | 496 | nat_5287b17ca685f1.94949666 497 | 498 | 499 | admin@192.168.1.105 500 | 501 | 502 | 503 | admin@192.168.1.55 504 | 505 | 1412311184 506 | 507 | 508 | 509 | 510 | 511 | 512 | wanip 513 | 46933 514 | 515 | tcp/udp 516 | 192.168.1.53 517 | 46933 518 | wan 519 | 520 | nat_53b7134db01b68.47907148 521 | 522 | 523 | admin@192.168.1.55 524 | 525 | 526 | 527 | admin@192.168.1.55 528 | 529 | 1412311185 530 | 531 | 532 | 533 | 534 | 535 | 536 | wanip 537 | 2222 538 | 539 | tcp 540 | 192.168.1.53 541 | 22 542 | wan 543 | 544 | nat_5287b192a847a4.34260688 545 | 546 | 547 | admin@192.168.1.105 548 | 549 | 550 | 551 | admin@192.168.1.105 552 | 553 | 1412311186 554 | 555 | 556 | automatic 557 | 558 | 559 | 560 | 561 | 562 | pass 563 | wan 564 | inet 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | keep state 573 | 574 | tcp/udp 575 | 576 | 577 | 578 | 579 |
192.168.1.53
580 | 39435 581 |
582 | 583 | nat_5287b17ca685f1.94949666 584 | 585 | 586 | NAT Port Forward 587 | 588 | 589 | 590 | admin@192.168.1.55 591 | 592 | 1412311184 593 |
594 | 595 | 596 | 597 | 598 | wan 599 | tcp 600 | 601 |
192.168.1.53
602 | 22 603 |
604 | 605 | nat_5287b192a847a4.34260688 606 | 607 | 608 | NAT Port Forward 609 | 610 | 1412311185 611 |
612 | 613 | 614 | 615 | 616 | wan 617 | tcp/udp 618 | 619 |
192.168.1.53
620 | 46933 621 |
622 | 623 | nat_53b7134db01b68.47907148 624 | 625 | 626 | NAT Port Forward 627 | 628 | 1412311192 629 |
630 | 631 | pass 632 | inet 633 | 634 | lan 635 | 636 | lan 637 | 638 | 639 | 640 | 641 | 1412311186 642 | 643 | 644 | 645 | pass 646 | lan 647 | inet6 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | keep state 656 | 657 | 658 | lan 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | admin@192.168.1.105 667 | 668 | 1412311187 669 | 670 | 671 | 672 | 1412311188 673 | block 674 | opt1 675 | inet 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | keep state 684 | 685 | tcp 686 | 687 | opt1 688 | 689 | 690 |
192.168.2.1
691 | MgmtPorts 692 |
693 | 694 | 695 | 696 | admin@192.168.1.55 697 | 698 | 699 | 700 | admin@192.168.1.55 701 | 702 |
703 | 704 | 705 | 1412311189 706 | block 707 | opt1 708 | inet 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | keep state 717 | 718 | 719 | opt1 720 | 721 | 722 | lan 723 | 724 | 725 | 726 | 727 | admin@192.168.1.55 728 | 729 | 730 | 731 | admin@192.168.1.55 732 | 733 | 734 | 735 | 736 | 1412311190 737 | pass 738 | opt1 739 | inet 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | keep state 748 | 749 | tcp/udp 750 | 751 | opt1 752 | 753 | 754 | 755 | 756 | 757 | 758 | Opt1Block 759 | 760 | 761 | admin@192.168.1.55 762 | 763 | 764 | 765 | admin@192.168.1.55 766 | 767 | 768 | 769 | 770 | 1412311191 771 | pass 772 | opt1 773 | inet 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | keep state 782 | 783 | 784 | opt1 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | admin@192.168.1.55 793 | 794 | 795 | 796 | admin@192.168.1.55 797 | 798 | 799 |
800 | 801 | 802 | wan 803 | wan 804 | CODELQ 805 | 200 806 | Kb 807 | on 808 | 809 | 810 | 811 | 812 | 813 | MgmtPorts 814 |
443 80 22
815 | 816 | port 817 | 818 |
819 |
820 | 821 | 822 | 823 | 1,31 824 | 0-5 825 | * 826 | * 827 | * 828 | root 829 | /usr/bin/nice -n20 adjkerntz -a 830 | 831 | 832 | 1 833 | 3 834 | 1 835 | * 836 | * 837 | root 838 | /usr/bin/nice -n20 /etc/rc.update_bogons.sh 839 | 840 | 841 | */60 842 | * 843 | * 844 | * 845 | * 846 | root 847 | /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout 848 | 849 | 850 | 1 851 | 1 852 | * 853 | * 854 | * 855 | root 856 | /usr/bin/nice -n20 /etc/rc.dyndns.update 857 | 858 | 859 | */60 860 | * 861 | * 862 | * 863 | * 864 | root 865 | /usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 virusprot 866 | 867 | 868 | 30 869 | 12 870 | * 871 | * 872 | * 873 | root 874 | /usr/bin/nice -n20 /etc/rc.update_urltables 875 | 876 | 877 | 878 | 879 | lan 880 | 00:00:00:00:00:79 881 | 882 | 883 | 884 | lan 885 | 00:00:00:00:00:b7 886 | 887 | 888 | 889 | 890 | 891 | traffic 892 | 893 | absolute 894 | 895 | 896 | 897 | ICMP 898 | icmp 899 | 900 | 901 | 902 | 903 | TCP 904 | tcp 905 | 906 | 907 | 908 | 909 | HTTP 910 | http 911 | 912 | 913 | / 914 | 915 | 200 916 | 917 | 918 | 919 | HTTPS 920 | https 921 | 922 | 923 | / 924 | 925 | 200 926 | 927 | 928 | 929 | SMTP 930 | send 931 | 932 | 933 | 934 | 220 * 935 | 936 | 937 | 938 | 939 | system_information-container:col1:show,captive_portal_status-container:col1:close,carp_status-container:col1:close,cpu_graphs-container:col1:close,gmirror_status-container:col1:close,installed_packages-container:col1:close,interface_statistics-container:col1:close,interfaces-container:col2:show,ipsec-container:col2:close,load_balancer_status-container:col2:close,log-container:col2:close,picture-container:col2:close,rss-container:col2:close,services_status-container:col2:close,traffic_graphs-container:col2:close,dyn_dns_status-container:col2:show,openvpn-container:col2:none,smart_status-container:col2:show,gateways-container:col2:show,thermal_sensors-container:col2:close,wake_on_lan-container:col2:none 940 | 941 | 942 | 943 | 944 | admin@192.168.1.55 945 | 946 | 947 | 948 | 949 | 950 | Opt1Block 951 | on 952 | 953 | 45164 954 | 955 | bittorrent 956 | action 957 | block 958 | 959 | 960 | smtp 961 | action 962 | block 963 | 964 | 965 | 966 | 967 | 968 | Download 969 | 1 970 | 971 | 972 | 973 | 974 | 975 | 1 976 | 2 977 | Mb 978 | none 979 | 980 | 981 | on 982 | 983 | dstaddress 984 | 24 985 | 986 | 0 987 | 988 | 989 | Upload 990 | 2 991 | 992 | 993 | 994 | 995 | 996 | 100 997 | 200 998 | Kb 999 | none 1000 | 1001 | 1002 | on 1003 | 1004 | srcaddress 1005 | 24 1006 | 1007 | 0 1008 | 1009 | 1010 | 1011 | 1012 | 0 1013 | pppoe 1014 | pppoe0 1015 | em0 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | noip-free 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | wan 1030 | 1031 | 1032 | 1033 | 1034 | wan 1035 | 1036 | 1037 | 1 1038 | 1039 | 1040 | 1041 | 1042 | wan 1043 | dynamic 1044 | WAN_PPPOE 1045 | 1 1046 | inet 1047 | 1048 | 1049 | 8.8.8.8 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | wan 1060 | lan 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | Shellcmd 1077 | 1078 | 1079 | Services 1080 | 1081 | https://packages.pfsense.org/packages/config/shellcmd/shellcmd.xml 1082 | 0.5 1083 | Beta 1084 | 2.2 1085 | markjcrane@gmail.com 1086 | shellcmd.xml 1087 | https://files.pfsense.org/packages/10/All/ 1088 | 1089 | 1090 | Shellcmd 1091 | shellcmd settings. 1092 |
Services
1093 | shellcmd.xml 1094 | /packages/shellcmd/shellcmd.php 1095 |
1096 | 1097 | Settings 1098 | /pkg_edit.php?xml=shellcmd.xml&id=0 1099 | 1100 | 1101 |
1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | opt2,opt3 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | rstp 1117 | 1118 | 1119 | 1120 | bridge0 1121 | 1122 | 1123 | 1124 |
1125 | (1-1/1) 1126 | Powered by Redmine © 2006-2023 Jean-Philippe Lang 1127 | -------------------------------------------------------------------------------- /sample-files/pfsense.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.5.1 4 | Wed Oct 26 14:30:15 UTC 2023 5 | 6 | my-pfsense-firewall 7 | localdomain 8 | UTC 9 | English 10 | 11 | 12 | 13 | em0 14 | LAN 15 | 192.168.1.1 16 | 24 17 | 203.0.113.2 18 | false 19 | 20 | 21 | em1 22 | LAN 23 | 192.168.1.2 24 | 24 25 | 203.0.113.2 26 | false 27 | 28 | 29 | em2 30 | LAN 31 | 192.168.1.3 32 | 24 33 | 203.0.113.2 34 | false 35 | 36 | 37 | em3 38 | WAN 39 | 203.0.113.1 40 | 30 41 | something.co 42 | false 43 | 44 | 45 | em4 46 | WAN 47 | 203.0.113.2 48 | 30 49 | something.co 50 | false 51 | 52 | 53 | em5 54 | WAN 55 | 203.0.113.3 56 | 30 57 | something.co 58 | false 59 | 60 | 61 | 62 | 63 | automatic 64 | 65 | 66 | 67 | 68 | WAN 69 | Allow SSH Inbound 70 | tcp 71 | any 72 | 203.0.113.1 73 | 22 74 | 75 | 76 | LAN 77 | Some other rule 78 | tcp 79 | any 80 | 203.0.113.2 81 | 22 82 | 83 | 84 | LAN 85 | Some other rule 2 86 | tcp 87 | any 88 | 203.0.113.3 89 | 22 90 | 91 | 92 | WAN 93 | Some other rule 3 94 | tcp 95 | any 96 | 203.0.113.4 97 | 22 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = [ 5 | { path: '**', redirectTo: '' } 6 | ]; 7 | 8 | @NgModule({ 9 | imports: [RouterModule.forRoot(routes)], 10 | exports: [RouterModule] 11 | }) 12 | export class AppRoutingModule { } 13 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .spacer { 2 | height: 3rem; 3 | } -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(() => TestBed.configureTestingModule({ 7 | imports: [RouterTestingModule], 8 | declarations: [AppComponent] 9 | })); 10 | 11 | it('should create the app', () => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.componentInstance; 14 | expect(app).toBeTruthy(); 15 | }); 16 | 17 | it(`should have as title 'pf2open'`, () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app.title).toEqual('pf2open'); 21 | }); 22 | 23 | it('should render title', () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | fixture.detectChanges(); 26 | const compiled = fixture.nativeElement as HTMLElement; 27 | expect(compiled.querySelector('.content span')?.textContent).toContain('pf2open app is running!'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'pf2open'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 7 | import { HeaderComponent } from './header/header.component'; 8 | import { FormsModule } from '@angular/forms'; 9 | 10 | // Material 11 | import { MatToolbarModule } from '@angular/material/toolbar'; 12 | import { MatCardModule } from '@angular/material/card'; 13 | import { MatExpansionModule } from '@angular/material/expansion' 14 | import { MatIconModule } from '@angular/material/icon' 15 | import { MatSliderModule } from '@angular/material/slider' 16 | import { MatButtonToggleModule } from '@angular/material/button-toggle' 17 | import { MatButtonModule } from '@angular/material/button'; 18 | import { MatDialogModule } from '@angular/material/dialog'; 19 | import { MatSelectModule } from '@angular/material/select'; 20 | import { MatInputModule } from '@angular/material/input'; 21 | import { MatProgressBarModule } from '@angular/material/progress-bar'; 22 | import { MatSlideToggleModule } from '@angular/material/slide-toggle'; 23 | import { UploadComponent } from './upload/upload.component'; 24 | import { InfoComponent } from './info/info.component'; 25 | 26 | @NgModule({ 27 | declarations: [ 28 | AppComponent, 29 | HeaderComponent, 30 | UploadComponent, 31 | InfoComponent 32 | ], 33 | imports: [ 34 | BrowserModule, 35 | AppRoutingModule, 36 | BrowserAnimationsModule, 37 | // Material 38 | MatToolbarModule, 39 | MatCardModule, 40 | MatExpansionModule, 41 | MatIconModule, 42 | MatSliderModule, 43 | MatButtonToggleModule, 44 | FormsModule, 45 | MatButtonModule, 46 | MatDialogModule, 47 | MatSelectModule, 48 | MatInputModule, 49 | MatProgressBarModule, 50 | MatSlideToggleModule 51 | ], 52 | providers: [], 53 | bootstrap: [AppComponent] 54 | }) 55 | export class AppModule { } 56 | -------------------------------------------------------------------------------- /src/app/header/header.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | PF2OPN - a pfsense to opnsense converter 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | v{{ version }} 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/app/header/header.component.scss: -------------------------------------------------------------------------------- 1 | @use '@angular/material' as mat; 2 | 3 | .toolbar { 4 | @include mat.elevation(6); 5 | position: fixed; 6 | top: 0; 7 | left: 0; 8 | right: 0; 9 | z-index: 5; 10 | } 11 | 12 | .toolbar-spacer { 13 | flex: 1 1 auto; 14 | } 15 | 16 | .secondary-toolbar { 17 | @include mat.elevation(2); 18 | display: flex; 19 | flex-direction: row; 20 | flex-wrap: wrap; 21 | justify-content: flex-start; 22 | column-gap: 17px; 23 | -webkit-transform: translateY(100%); //if your div is 200px, this will move it down by 200px, if it is 100px it will down by 100px etc 24 | transform: translateY(100%); //if your div is 200px, this will move it down by 200px, if it is 100px it will down by 100px etc 25 | margin-top: -10px; 26 | z-index: 3; 27 | 28 | .mat-toolbar-row, .menu-button { 29 | padding-top: 15px; 30 | } 31 | 32 | } 33 | 34 | .apps { 35 | @include mat.elevation(0); 36 | } -------------------------------------------------------------------------------- /src/app/header/header.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HeaderComponent } from './header.component'; 4 | 5 | describe('HeaderComponent', () => { 6 | let component: HeaderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [HeaderComponent] 12 | }); 13 | fixture = TestBed.createComponent(HeaderComponent); 14 | component = fixture.componentInstance; 15 | fixture.detectChanges(); 16 | }); 17 | 18 | it('should create', () => { 19 | expect(component).toBeTruthy(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/app/header/header.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import packageJson from '../../../package.json'; 3 | 4 | @Component({ 5 | selector: 'app-header', 6 | templateUrl: './header.component.html', 7 | styleUrls: ['./header.component.scss'] 8 | }) 9 | export class HeaderComponent { 10 | version = packageJson.version; 11 | } 12 | -------------------------------------------------------------------------------- /src/app/info/info.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Source Code 5 | 6 | 7 | 8 | 9 |
10 | The conversion happens on your machine, in-browser, using JavaScript. No data is sent to any server. 11 |
12 |
13 |
14 | You can view the source code here: 15 |
16 | - 17 | https://github.com/mwood77/pf2opn 18 | 19 |
20 |
21 |
22 | You can run this as a container on your own machine here: 23 |
24 | - 25 | https://hub.docker.com/r/mwood77/pf2opn 26 | 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 |
35 | 36 | Consider Donating 37 | 38 | 39 |
Donations help with development and hosting costs.
40 |
41 | 42 | GitHub Sponsor 43 | 44 | 45 |

46 | 47 | 48 | ko-fi 49 | 50 |
51 |
52 |
53 | 54 |
55 |
-------------------------------------------------------------------------------- /src/app/info/info.component.scss: -------------------------------------------------------------------------------- 1 | mat-card { 2 | margin: 1rem; 3 | } 4 | 5 | hr { 6 | width: 98% 7 | } 8 | 9 | .contianer { 10 | margin-top: 1.5rem; 11 | } 12 | 13 | 14 | .text { 15 | color: whitesmoke; 16 | } 17 | 18 | .horizontal-spacer { 19 | width: 2rem; 20 | } 21 | 22 | .center { 23 | display: flex; 24 | justify-content: center; 25 | align-items: center; 26 | } -------------------------------------------------------------------------------- /src/app/info/info.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { InfoComponent } from './info.component'; 4 | 5 | describe('InfoComponent', () => { 6 | let component: InfoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [InfoComponent] 12 | }); 13 | fixture = TestBed.createComponent(InfoComponent); 14 | component = fixture.componentInstance; 15 | fixture.detectChanges(); 16 | }); 17 | 18 | it('should create', () => { 19 | expect(component).toBeTruthy(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/app/info/info.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-info', 5 | templateUrl: './info.component.html', 6 | styleUrls: ['./info.component.scss'] 7 | }) 8 | export class InfoComponent { 9 | 10 | showInfoCard = true; 11 | showDonations = true; 12 | 13 | kofiURL = 'https://ko-fi.com/mwood77' 14 | githubURL = 'https://github.com/sponsors/mwood77' 15 | 16 | openSite(URL: string): void { 17 | window.open(URL, '_blank'); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/app/mappings/opnsense.interface.ts: -------------------------------------------------------------------------------- 1 | export interface opnRoot { 2 | opnsense?: Opnsense; 3 | } 4 | 5 | export interface Opnsense { 6 | version?: number; 7 | 'config-apply'?: Configapply; 8 | system?: System; 9 | interfaces?: Interfaces; 10 | firewall?: Firewall; 11 | dhcpd?: Dhcpd; 12 | dhcpdv6?: DhcpdV6; 13 | nat?: any; 14 | filter?: any; 15 | aliases?: any; 16 | } 17 | 18 | export interface Alias { 19 | [x: string]: any; 20 | enabled?: string; 21 | name?: string; 22 | type?: string; 23 | proto?: any; 24 | interface?: any, 25 | counters?: number | string; 26 | updatefreq?: any; 27 | content?: string; 28 | categories?: any 29 | description?: string; 30 | detail?: string; 31 | } 32 | 33 | export interface Firewall { 34 | rules?: Rule[]; 35 | } 36 | 37 | export interface Rule { 38 | uuid?: string; 39 | type?: string; 40 | enabled?: number; 41 | interface?: string; 42 | descr?: string; 43 | protocol?: string; 44 | source?: Source; 45 | destination?: Destination; 46 | [x: string]: any; 47 | } 48 | 49 | export interface Destination { 50 | address?: string; 51 | port?: number | string; 52 | } 53 | 54 | export interface Source { 55 | any?: number | string | undefined; 56 | } 57 | 58 | export interface Dhcpd { 59 | dhcpd?: Lan2[]; 60 | } 61 | export interface DhcpdV6 { 62 | dhcpdV6?: Lan2[]; 63 | } 64 | export interface Interfaces { 65 | lan?: NetworkController[]; 66 | wan?: NetworkController[]; 67 | opt?: NetworkController[] 68 | } 69 | 70 | export interface NetworkController { 71 | enable?: string | number; 72 | if?: string; 73 | descr?: string; 74 | 'alias-address'?: string; 75 | 'alias-subnet'?: number; 76 | spoofmac?: string; 77 | ipaddr?: string; 78 | subnet?: number; 79 | gateway?: string; 80 | ipaddrv6?: string; 81 | subnetv6?: string; 82 | gatewayv6?: string; 83 | dhcphostname?: string; 84 | dhcprejectfrom?: string; 85 | adv_dhcp_pt_timeout?: string; 86 | adv_dhcp_pt_retry?: string; 87 | adv_dhcp_pt_select_timeout?: string; 88 | adv_dhcp_pt_reboot?: string; 89 | adv_dhcp_pt_backoff_cutoff?: string; 90 | adv_dhcp_pt_initial_interval?: string; 91 | adv_dhcp_pt_values?: string; 92 | adv_dhcp_send_options?: string; 93 | adv_dhcp_request_options?: string; 94 | adv_dhcp_required_options?: string; 95 | adv_dhcp_option_modifiers?: string; 96 | adv_dhcp_config_advanced?: string; 97 | adv_dhcp_config_file_override?: string; 98 | adv_dhcp_config_file_override_path?: string; 99 | [x: string]: any; 100 | } 101 | 102 | export interface Lan2 { 103 | range?: Range; 104 | defaultleasetime?: string; 105 | maxleasetime?: string; 106 | netmask?: string; 107 | failover_peerip?: string; 108 | domain?: string; 109 | domainsearchlist?: string; 110 | ddnsdomain?: string; 111 | tftp?: string; 112 | ldap?: string; 113 | filename?: string; 114 | rootpath?: string; 115 | numberoptions?: string; 116 | netboot?: string; 117 | winsserver?: string; 118 | dnsserver?: string[]; 119 | nextserver?: string; 120 | staticmap?: Staticmap; 121 | } 122 | 123 | export interface Range { 124 | from?: string; 125 | to?: string; 126 | } 127 | 128 | export interface Staticmap { 129 | mac?: string; 130 | cid?: string; 131 | ipaddr?: string; 132 | hostname?: string; 133 | descr?: string; 134 | filename?: string; 135 | rootpath?: string; 136 | defaultleasetime?: string; 137 | maxleasetime?: string; 138 | gateway?: string; 139 | domain?: string; 140 | domainsearchlist?: string; 141 | ddnsdomain?: string; 142 | ddnsdomainprimary?: string; 143 | ddnsdomainkeyname?: string; 144 | ddnsdomainkey?: string; 145 | tftp?: string; 146 | ldap?: string; 147 | } 148 | 149 | export interface System { 150 | [x: string]: any; 151 | hostname?: string; 152 | domain?: string; 153 | timezone?: string; 154 | language?: string; 155 | user?: User; 156 | disablenatreflection?: string; 157 | disablesegmentationoffloading?: string; 158 | disablelargereceiveoffloading?: string; 159 | ipv6allow?: string; 160 | } 161 | 162 | export interface User { 163 | [x: string]: any; 164 | name?: string; 165 | descr?: string; 166 | scope?: string; 167 | groupname?: string; 168 | password?: string; 169 | uid?: number; 170 | priv?: string; 171 | 'md5-hash'?: string; 172 | expires?: string; 173 | authorizedkeys?: string; 174 | ipsecpsk?: string; 175 | 'bcrypt-hash'?: string; 176 | 'sha512-hash'?: string; 177 | } 178 | 179 | export interface Configapply { 180 | uuid?: string; 181 | } -------------------------------------------------------------------------------- /src/app/mappings/pfsense-complex.interface.ts: -------------------------------------------------------------------------------- 1 | export interface pfRoot { 2 | pfsense?: Pfsense; 3 | } 4 | 5 | export interface Pfsense { 6 | version?: number; 7 | lastchange?: string; 8 | theme?: string; 9 | sysctl?: Sysctl; 10 | system?: System; 11 | interfaces?: Interfaces; 12 | staticroutes?: string; 13 | dhcpd?: Dhcpd; 14 | dnsmasq?: Dnsmasq; 15 | snmpd?: Snmpd; 16 | diag?: Diag; 17 | bridge?: string; 18 | syslog?: Syslog; 19 | nat?: Nat; 20 | filter?: Filter; 21 | shaper?: string; 22 | ipsec?: Ipsec; 23 | aliases?: Aliases; 24 | proxyarp?: string; 25 | cron?: Cron; 26 | wol?: string; 27 | rrd?: Rrd; 28 | load_balancer?: string; 29 | widgets?: Widgets; 30 | revision?: Revision; 31 | openvpn?: Openvpn; 32 | dnshaper?: string; 33 | cert?: Cert[]; 34 | installedpackages?: Installedpackages; 35 | ppps?: string; 36 | gateways?: Gateways; 37 | dyndnses?: Dyndnses; 38 | ezshaper?: Ezshaper; 39 | ca?: Ca; 40 | ovpnserver?: Ovpnserver; 41 | dhcrelay?: string; 42 | crl?: Crl; 43 | bridges?: Bridges; 44 | dhcpdv6?: Dhcpd; 45 | dhcrelay6?: string; 46 | ntpd?: string; 47 | firewall: Firewall; 48 | } 49 | 50 | export interface Firewall { 51 | rule: Rule[]; 52 | } 53 | 54 | export interface Bridges { 55 | bridged?: Bridged; 56 | } 57 | 58 | export interface Bridged { 59 | members?: string; 60 | descr?: string; 61 | maxaddr?: string; 62 | timeout?: string; 63 | maxage?: string; 64 | fwdelay?: string; 65 | hellotime?: string; 66 | priority?: string; 67 | proto?: string; 68 | holdcnt?: string; 69 | ifpriority?: string; 70 | ifpathcost?: string; 71 | bridgeif?: string; 72 | } 73 | 74 | export interface Crl { 75 | refid?: string; 76 | descr?: string; 77 | caref?: string; 78 | method?: string; 79 | serial?: number; 80 | lifetime?: number; 81 | '#text'?: number; 82 | } 83 | 84 | export interface Ovpnserver { 85 | step1?: Step12; 86 | step6?: Step6; 87 | step9?: Step9; 88 | step10?: Step10; 89 | step11?: Step11; 90 | } 91 | 92 | export interface Step11 { 93 | ovpnrule?: string; 94 | ovpnallow?: string; 95 | } 96 | 97 | export interface Step10 { 98 | protocol?: string; 99 | localport?: number; 100 | descr?: string; 101 | tlsauth?: string; 102 | gentlskey?: string; 103 | dhkey?: number; 104 | crypto?: string; 105 | engine?: string; 106 | tunnelnet?: string; 107 | localnet?: string; 108 | dynip?: string; 109 | addrpool?: string; 110 | nbttype?: number; 111 | interface?: string; 112 | digest?: string; 113 | advanced?: string; 114 | } 115 | 116 | export interface Step9 { 117 | certname?: string; 118 | keylength?: number; 119 | lifetime?: number; 120 | country?: string; 121 | state?: string; 122 | city?: string; 123 | organization?: string; 124 | email?: string; 125 | authcertname?: string; 126 | } 127 | 128 | export interface Step6 { 129 | authcertca?: string; 130 | } 131 | 132 | export interface Step12 { 133 | type?: string; 134 | } 135 | 136 | export interface Ca { 137 | refid?: string; 138 | descr?: string; 139 | crt?: string; 140 | prv?: string; 141 | serial?: number; 142 | } 143 | 144 | export interface Ezshaper { 145 | step1?: Step1; 146 | step3?: Step3; 147 | step5?: Step5; 148 | step7?: string; 149 | step2?: Step2; 150 | } 151 | 152 | export interface Step2 { 153 | downloadscheduler?: string; 154 | conn0uploadscheduler?: string; 155 | conn0upload?: number; 156 | conn0uploadspeed?: string; 157 | conn0download?: number; 158 | conn0downloadspeed?: string; 159 | conn0interface?: string; 160 | } 161 | 162 | export interface Step5 { 163 | enable?: string; 164 | bandwidthunit?: string; 165 | bittorrent?: string; 166 | } 167 | 168 | export interface Step3 { 169 | enable?: string; 170 | provider?: string; 171 | download?: number; 172 | downloadspeed?: string; 173 | conn0upload?: number; 174 | conn0uploadspeed?: string; 175 | } 176 | 177 | export interface Step1 { 178 | numberofconnections?: number; 179 | } 180 | 181 | export interface Dyndnses { 182 | dyndns?: Dyndns; 183 | } 184 | 185 | export interface Dyndns { 186 | type?: string; 187 | username?: string; 188 | password?: string; 189 | host?: string; 190 | mx?: string; 191 | verboselog?: string; 192 | enable?: string; 193 | interface?: string; 194 | zoneid?: string; 195 | ttl?: string; 196 | updateurl?: string; 197 | resultmatch?: string; 198 | requestif?: string; 199 | descr?: string; 200 | id?: number; 201 | } 202 | 203 | export interface Gateways { 204 | gateway_item?: Gatewayitem; 205 | } 206 | 207 | export interface Gatewayitem { 208 | interface?: string; 209 | gateway?: string; 210 | name?: string; 211 | weight?: number; 212 | ipprotocol?: string; 213 | descr?: string; 214 | monitor_disable?: string; 215 | defaultgw?: string; 216 | } 217 | 218 | export interface Installedpackages { 219 | squid?: Squid; 220 | squidcache?: Squidcache; 221 | squidguardgeneral?: Squidguardgeneral; 222 | squidguarddefault?: Squidguarddefault; 223 | miniupnpd?: Miniupnpd; 224 | freeradius?: Freeradius; 225 | freeradiusclients?: Freeradiusclients; 226 | bandwidthd?: Bandwidthd; 227 | lcdproc?: Lcdproc; 228 | lcdprocscreens?: Lcdprocscreens; 229 | darkstat?: Darkstat; 230 | snortglobal?: Snortglobal; 231 | package?: Package[]; 232 | menu?: Menu[]; 233 | service?: Service[]; 234 | vpn_openvpn_export?: Vpnopenvpnexport; 235 | } 236 | 237 | export interface Vpnopenvpnexport { 238 | serverconfig?: Serverconfig; 239 | defaultsettings?: string; 240 | } 241 | 242 | export interface Serverconfig { 243 | item?: Item5; 244 | } 245 | 246 | export interface Item5 { 247 | pass?: string; 248 | proxypass?: string; 249 | server?: number; 250 | useaddr?: string; 251 | useaddr_hostname?: string; 252 | verifyservercn?: string; 253 | blockoutsidedns?: string; 254 | legacy?: string; 255 | randomlocalport?: string; 256 | usepkcs11?: string; 257 | pkcs11providers?: string; 258 | usetoken?: string; 259 | usepass?: string; 260 | useproxy?: string; 261 | useproxytype?: string; 262 | proxyaddr?: string; 263 | proxyport?: string; 264 | useproxypass?: string; 265 | proxyuser?: string; 266 | advancedoptions?: string; 267 | } 268 | 269 | export interface Service { 270 | name?: string; 271 | rcfile?: string; 272 | executable?: string; 273 | description?: string; 274 | } 275 | 276 | export interface Menu { 277 | name?: string; 278 | tooltiptext?: string; 279 | section?: string; 280 | url?: string; 281 | } 282 | 283 | export interface Package { 284 | name?: string; 285 | website?: string; 286 | descr?: string; 287 | version?: string; 288 | configurationfile?: string; 289 | tabs?: Tabs; 290 | include_file?: string; 291 | internal_name?: string; 292 | pkginfolink?: string; 293 | after_install_info?: string; 294 | } 295 | 296 | export interface Tabs { 297 | tab?: Tab[]; 298 | } 299 | 300 | export interface Tab { 301 | text?: string; 302 | url?: string; 303 | active?: string; 304 | name?: string; 305 | tabgroup?: string; 306 | } 307 | 308 | export interface Snortglobal { 309 | snort_config_ver?: string; 310 | snortdownload?: string; 311 | snortcommunityrules?: string; 312 | emergingthreats?: string; 313 | emergingthreats_pro?: string; 314 | clearblocks?: string; 315 | oinkmastercode?: string; 316 | etpro_code?: string; 317 | rm_blocked?: string; 318 | autorulesupdate7?: string; 319 | rule_update_starttime?: string; 320 | forcekeepsettings?: string; 321 | last_rule_upd_status?: string; 322 | last_rule_upd_time?: number; 323 | whitelist?: string; 324 | suppress?: Suppress; 325 | dashboard_widget?: string; 326 | auto_manage_sids?: string; 327 | enable_log_mgmt?: string; 328 | alert_log_limit_size?: number; 329 | alert_log_retention?: number; 330 | appid_stats_log_limit_size?: number; 331 | appid_stats_log_retention?: number; 332 | event_pkts_log_limit_size?: number; 333 | event_pkts_log_retention?: number; 334 | sid_changes_log_limit_size?: number; 335 | sid_changes_log_retention?: number; 336 | stats_log_limit_size?: number; 337 | stats_log_retention?: number; 338 | verbose_logging?: string; 339 | openappid_detectors?: string; 340 | } 341 | 342 | export interface Suppress { 343 | item?: Item4; 344 | } 345 | 346 | export interface Item4 { 347 | uuid?: string; 348 | name?: string; 349 | descr?: string; 350 | suppresspassthru?: string; 351 | } 352 | 353 | export interface Darkstat { 354 | config?: Config11; 355 | } 356 | 357 | export interface Config11 { 358 | interface_array?: string; 359 | } 360 | 361 | export interface Lcdprocscreens { 362 | config?: Config10; 363 | } 364 | 365 | export interface Config10 { 366 | scr_version?: string; 367 | scr_time?: string; 368 | scr_uptime?: string; 369 | scr_hostname?: string; 370 | scr_system?: string; 371 | scr_disk?: string; 372 | scr_load?: string; 373 | scr_states?: string; 374 | scr_carp?: string; 375 | scr_ipsec?: string; 376 | scr_slbd?: string; 377 | scr_interfaces?: string; 378 | scr_mbuf?: string; 379 | scr_cpufrequency?: string; 380 | scr_traffic?: string; 381 | scr_traffic_interface?: string; 382 | } 383 | 384 | export interface Lcdproc { 385 | config?: Config9; 386 | } 387 | 388 | export interface Config9 { 389 | enable?: string; 390 | comport?: string; 391 | size?: string; 392 | driver?: string; 393 | connection_type?: string; 394 | refresh_frequency?: number; 395 | port_speed?: number; 396 | brightness?: number; 397 | offbrightness?: number; 398 | contrast?: number; 399 | backlight?: string; 400 | outputleds?: string; 401 | } 402 | 403 | export interface Bandwidthd { 404 | config?: Config8; 405 | } 406 | 407 | export interface Config8 { 408 | enable?: string; 409 | active_interface?: string; 410 | skipintervals?: string; 411 | graphcutoff?: number; 412 | promiscuous?: string; 413 | outputcdf?: string; 414 | recovercdf?: string; 415 | outputpostgresql?: string; 416 | postgresqlhost?: string; 417 | postgresqldatabase?: string; 418 | postgresqlusername?: string; 419 | sensorid?: string; 420 | drawgraphs?: string; 421 | meta_refresh?: number; 422 | graph_log_info?: string; 423 | advfilter?: string; 424 | postgresqlpasswordenc?: string; 425 | } 426 | 427 | export interface Freeradiusclients { 428 | config?: Config7; 429 | } 430 | 431 | export interface Config7 { 432 | client?: string; 433 | shortname?: string; 434 | sharedsecret?: string; 435 | description?: string; 436 | } 437 | 438 | export interface Freeradius { 439 | config?: Config6; 440 | } 441 | 442 | export interface Config6 { 443 | username?: string; 444 | password?: string; 445 | ip?: string; 446 | multiconnet?: number; 447 | expiration?: string; 448 | sessiontime?: string; 449 | onlinetime?: string; 450 | description?: string; 451 | vlanid?: string; 452 | additionaloptions?: string; 453 | } 454 | 455 | export interface Miniupnpd { 456 | config?: Config5; 457 | } 458 | 459 | export interface Config5 { 460 | enable?: string; 461 | enable_upnp?: string; 462 | enable_natpmp?: string; 463 | iface_array?: string; 464 | download?: string; 465 | upload?: string; 466 | overridewanip?: string; 467 | upnpqueue?: string; 468 | logpackets?: string; 469 | sysuptime?: string; 470 | permdefault?: string; 471 | } 472 | 473 | export interface Squidguarddefault { 474 | config?: Config4; 475 | } 476 | 477 | export interface Config4 { 478 | dest?: string; 479 | notallowingip?: string; 480 | deniedmessage?: string; 481 | redirect_mode?: string; 482 | redirect?: string; 483 | safesearch?: string; 484 | rewrite?: string; 485 | enablelog?: string; 486 | } 487 | 488 | export interface Squidguardgeneral { 489 | config?: Config3; 490 | } 491 | 492 | export interface Config3 { 493 | squidguard_enable?: string; 494 | enable_guilog?: string; 495 | enable_log?: string; 496 | log_rotation?: string; 497 | blacklist?: string; 498 | blacklist_proxy?: string; 499 | blacklist_url?: string; 500 | } 501 | 502 | export interface Squidcache { 503 | config?: Config2; 504 | } 505 | 506 | export interface Config2 { 507 | harddisk_cache_size?: number; 508 | harddisk_cache_system?: string; 509 | harddisk_cache_location?: string; 510 | memory_cache_size?: number; 511 | minimum_object_size?: number; 512 | maximum_object_size?: number; 513 | level1_subdirs?: number; 514 | memory_replacement_policy?: string; 515 | cache_replacement_policy?: string; 516 | cache_swap_low?: number; 517 | cache_swap_high?: number; 518 | donotcache?: string; 519 | enable_offline?: string; 520 | } 521 | 522 | export interface Squid { 523 | config?: Config; 524 | } 525 | 526 | export interface Config { 527 | active_interface?: string; 528 | allow_interface?: string; 529 | transparent_proxy?: string; 530 | private_subnet_proxy_off?: string; 531 | defined_ip_proxy_off?: string; 532 | defined_ip_proxy_off_dest?: string; 533 | log_enabled?: string; 534 | log_dir?: string; 535 | log_rotate?: number; 536 | proxy_port?: number; 537 | icp_port?: string; 538 | visible_hostname?: string; 539 | admin_email?: string; 540 | error_language?: string; 541 | disable_xforward?: string; 542 | disable_via?: string; 543 | uri_whitespace?: string; 544 | dns_nameservers?: string; 545 | disable_squidversion?: string; 546 | custom_options?: string; 547 | } 548 | 549 | export interface Cert { 550 | refid?: string; 551 | descr?: string; 552 | crt?: string; 553 | prv?: string; 554 | caref?: string; 555 | type?: string; 556 | } 557 | 558 | export interface Openvpn { 559 | 'openvpn-server'?: Openvpnserver[]; 560 | 'openvpn-csc'?: Openvpncsc[]; 561 | } 562 | 563 | export interface Openvpncsc { 564 | custom_options?: string; 565 | common_name?: string; 566 | block?: string; 567 | description?: string; 568 | tunnel_network?: string; 569 | local_network?: string; 570 | local_networkv6?: string; 571 | remote_network?: string; 572 | remote_networkv6?: string; 573 | gwredir?: string; 574 | push_reset?: string; 575 | netbios_enable?: string; 576 | netbios_ntype?: number; 577 | netbios_scope?: string; 578 | } 579 | 580 | export interface Openvpnserver { 581 | vpnid?: number; 582 | mode?: string; 583 | protocol?: string; 584 | dev_mode?: string; 585 | ipaddr?: string; 586 | interface?: string; 587 | local_port?: number; 588 | description?: string; 589 | custom_options?: string; 590 | tls?: string; 591 | caref?: string; 592 | crlref?: string; 593 | certref?: string; 594 | dh_length?: number; 595 | cert_depth?: number; 596 | crypto?: string; 597 | digest?: string; 598 | engine?: string; 599 | tunnel_network?: string; 600 | tunnel_networkv6?: string; 601 | remote_network?: string; 602 | remote_networkv6?: string; 603 | gwredir?: string; 604 | local_network?: string; 605 | local_networkv6?: string; 606 | maxclients?: number | string; 607 | compression?: string; 608 | passtos?: string; 609 | client2client?: string; 610 | dynamic_ip?: string; 611 | pool_enable?: string; 612 | topology?: string; 613 | serverbridge_dhcp?: string; 614 | serverbridge_interface?: string; 615 | serverbridge_dhcp_start?: string; 616 | serverbridge_dhcp_end?: string; 617 | netbios_enable?: string; 618 | netbios_ntype?: number; 619 | netbios_scope?: string; 620 | no_tun_ipv6?: string; 621 | verbosity_level?: number; 622 | topology_subnet?: string; 623 | } 624 | 625 | export interface Revision { 626 | time?: number; 627 | description?: string; 628 | username?: string; 629 | } 630 | 631 | export interface Widgets { 632 | sequence?: string; 633 | trafficgraphs?: string; 634 | traffic_graphs?: Trafficgraphs; 635 | 'log-0'?: Log0; 636 | } 637 | 638 | export interface Log0 { 639 | filterlogentries?: number; 640 | } 641 | 642 | export interface Trafficgraphs { 643 | refreshinterval?: number; 644 | invert?: boolean; 645 | size?: number; 646 | backgroundupdate?: boolean; 647 | filter?: string; 648 | } 649 | 650 | export interface Rrd { 651 | enable?: string; 652 | category?: string; 653 | style?: string; 654 | period?: string; 655 | } 656 | 657 | export interface Cron { 658 | item?: Item3[]; 659 | } 660 | 661 | export interface Item3 { 662 | minute?: number | string; 663 | hour?: number | string; 664 | mday?: number | string; 665 | month?: string; 666 | wday?: string; 667 | who?: string; 668 | command?: string; 669 | } 670 | 671 | export interface Aliases { 672 | alias?: Alias; 673 | } 674 | 675 | export interface Alias { 676 | enabled?: string; 677 | name?: string; 678 | type?: string; 679 | proto?: any; 680 | interface?: any, 681 | counters?: number | string; 682 | updatefreq?: any; 683 | categories?: any 684 | descr?: string; 685 | address?: string; 686 | detail?: string; 687 | } 688 | 689 | export interface Ipsec { 690 | preferoldsa?: string; 691 | client?: Client; 692 | mobilekey?: Mobilekey; 693 | phase1?: Phase1; 694 | logging?: Logging; 695 | } 696 | 697 | export interface Logging { 698 | dmn?: number; 699 | mgr?: number; 700 | ike?: number; 701 | chd?: number; 702 | job?: number; 703 | cfg?: number; 704 | knl?: number; 705 | net?: number; 706 | asn?: number; 707 | enc?: number; 708 | imc?: number; 709 | imv?: number; 710 | pts?: number; 711 | tls?: number; 712 | esp?: number; 713 | lib?: number; 714 | } 715 | 716 | export interface Phase1 { 717 | disabled?: string; 718 | encryption?: Encryption; 719 | } 720 | 721 | export interface Encryption { 722 | item?: Item2; 723 | } 724 | 725 | export interface Item2 { 726 | 'encryption-algorithm'?: string; 727 | 'hash-algorithm'?: string; 728 | dhgroup?: string; 729 | } 730 | 731 | export interface Mobilekey { 732 | ident?: string; 733 | 'pre-shared-key'?: string; 734 | } 735 | 736 | export interface Client { 737 | user_source?: string; 738 | group_source?: string; 739 | } 740 | 741 | export interface Filter { 742 | rule?: Rule2[]; 743 | } 744 | 745 | export interface Rule2 { 746 | id?: string; 747 | type?: string; 748 | interface?: string; 749 | tag?: string; 750 | tagged?: string; 751 | max?: string; 752 | 'max-src-nodes'?: string; 753 | 'max-src-conn'?: string; 754 | 'max-src-states'?: string; 755 | statetimeout?: string; 756 | statetype?: string; 757 | os?: string; 758 | protocol?: string; 759 | source?: Source2; 760 | destination?: Destination2; 761 | descr?: string; 762 | tracker?: number; 763 | 'associated-rule-id'?: string; 764 | disabled?: string; 765 | ipprotocol?: string; 766 | updated?: Updated; 767 | created?: Updated; 768 | enabled?: string; 769 | } 770 | 771 | export interface Destination2 { 772 | address?: string; 773 | port?: number | string; 774 | any?: string; 775 | } 776 | 777 | export interface Source2 { 778 | any?: string; 779 | network?: string; 780 | } 781 | 782 | export interface Nat { 783 | rule?: Rule[]; 784 | outbound?: Outbound; 785 | separator?: string; 786 | } 787 | 788 | export interface Outbound { 789 | mode?: string; 790 | } 791 | 792 | export interface Rule { 793 | source?: Source; 794 | destination?: Destination; 795 | protocol?: string; 796 | target?: string; 797 | 'local-port'?: number; 798 | interface?: string; 799 | descr?: string; 800 | 'associated-rule-id'?: string; 801 | updated?: Updated; 802 | created?: Updated; 803 | tracker?: number; 804 | disabled?: string; 805 | proto?: string; 806 | src?: string; 807 | dst?: string; 808 | dstport?: number; 809 | } 810 | 811 | export interface Updated { 812 | time?: number; 813 | username?: string; 814 | } 815 | 816 | export interface Destination { 817 | network?: string; 818 | port?: number | string; 819 | address?: string; 820 | } 821 | 822 | export interface Source { 823 | any?: string | number | undefined; 824 | } 825 | 826 | export interface Syslog { 827 | nentries?: number; 828 | sourceip?: string; 829 | ipproto?: string; 830 | reverse?: string; 831 | } 832 | 833 | export interface Diag { 834 | ipv6nat?: string; 835 | } 836 | 837 | export interface Snmpd { 838 | syslocation?: string; 839 | syscontact?: string; 840 | rocommunity?: string; 841 | modules?: Modules; 842 | pollport?: number; 843 | trapserver?: string; 844 | trapserverport?: string; 845 | trapstring?: string; 846 | bindip?: string; 847 | enable?: string; 848 | } 849 | 850 | export interface Modules { 851 | mibii?: string; 852 | netgraph?: string; 853 | pf?: string; 854 | hostres?: string; 855 | ucd?: string; 856 | regex?: string; 857 | } 858 | 859 | export interface Dnsmasq { 860 | hosts?: Host[]; 861 | custom_options?: string; 862 | regdhcp?: string; 863 | regdhcpstatic?: string; 864 | dhcpfirst?: string; 865 | enable?: string; 866 | interface?: string; 867 | no_private_reverse?: string; 868 | } 869 | 870 | export interface Host { 871 | host?: string; 872 | domain?: string; 873 | ip?: string; 874 | descr?: string; 875 | aliases?: string; 876 | } 877 | 878 | export interface Dhcpd { 879 | lan?: Lan2; 880 | } 881 | 882 | export interface Lan2 { 883 | range?: Range; 884 | defaultleasetime?: string; 885 | maxleasetime?: string; 886 | netmask?: string; 887 | failover_peerip?: string; 888 | gateway?: string; 889 | domain?: string; 890 | domainsearchlist?: string; 891 | ddnsdomain?: string; 892 | tftp?: string; 893 | ldap?: string; 894 | filename?: string; 895 | rootpath?: string; 896 | numberoptions?: string; 897 | netboot?: string; 898 | winsserver?: string; 899 | dnsserver?: string[]; 900 | nextserver?: string; 901 | staticmap?: Staticmap; 902 | } 903 | 904 | export interface Staticmap { 905 | mac?: string; 906 | cid?: string; 907 | ipaddr?: string; 908 | hostname?: string; 909 | descr?: string; 910 | filename?: string; 911 | rootpath?: string; 912 | defaultleasetime?: string; 913 | maxleasetime?: string; 914 | gateway?: string; 915 | domain?: string; 916 | domainsearchlist?: string; 917 | ddnsdomain?: string; 918 | ddnsdomainprimary?: string; 919 | ddnsdomainkeyname?: string; 920 | ddnsdomainkey?: string; 921 | tftp?: string; 922 | ldap?: string; 923 | } 924 | 925 | export interface Range { 926 | from?: string; 927 | to?: string; 928 | } 929 | 930 | export interface Interfaces { 931 | wan?: NetworkController[]; 932 | lan?: NetworkController[]; 933 | opt?: NetworkController; 934 | } 935 | 936 | 937 | 938 | export interface Lan { 939 | enable?: string; 940 | if?: string; 941 | descr?: string; 942 | spoofmac?: string; 943 | ipaddr?: string; 944 | subnet?: number; 945 | gateway?: string; 946 | ipaddrv6?: string; 947 | subnetv6?: string; 948 | gatewayv6?: string; 949 | } 950 | 951 | export interface NetworkController { 952 | enable?: string; 953 | if?: string; 954 | descr?: string; 955 | 'alias-address'?: string; 956 | 'alias-subnet'?: number; 957 | spoofmac?: string; 958 | ipaddr?: string; 959 | subnet?: number; 960 | gateway?: string; 961 | ipaddrv6?: string; 962 | subnetv6?: string; 963 | gatewayv6?: string; 964 | dhcphostname?: string; 965 | dhcprejectfrom?: string; 966 | adv_dhcp_pt_timeout?: string; 967 | adv_dhcp_pt_retry?: string; 968 | adv_dhcp_pt_select_timeout?: string; 969 | adv_dhcp_pt_reboot?: string; 970 | adv_dhcp_pt_backoff_cutoff?: string; 971 | adv_dhcp_pt_initial_interval?: string; 972 | adv_dhcp_pt_values?: string; 973 | adv_dhcp_send_options?: string; 974 | adv_dhcp_request_options?: string; 975 | adv_dhcp_required_options?: string; 976 | adv_dhcp_option_modifiers?: string; 977 | adv_dhcp_config_advanced?: string; 978 | adv_dhcp_config_file_override?: string; 979 | adv_dhcp_config_file_override_path?: string; 980 | } 981 | 982 | export interface System { 983 | optimization?: string; 984 | hostname?: string; 985 | domain?: string; 986 | group?: Group[]; 987 | user?: User; 988 | nextuid?: number; 989 | nextgid?: number; 990 | timezone?: string; 991 | 'time-update-interval'?: string; 992 | timeservers?: string; 993 | webgui?: Webgui; 994 | disablenatreflection?: string; 995 | disablesegmentationoffloading?: string; 996 | disablelargereceiveoffloading?: string; 997 | ipv6allow?: string; 998 | ssh?: Ssh; 999 | maximumstates?: string; 1000 | maximumtableentries?: string; 1001 | reflectiontimeout?: string; 1002 | enablesshd?: string; 1003 | dns1gwint?: string; 1004 | dns2gwint?: string; 1005 | dns3gwint?: string; 1006 | dns4gwint?: string; 1007 | firmware?: Firmware; 1008 | gitsync?: Gitsync; 1009 | language?: string; 1010 | dns1gw?: string; 1011 | dns2gw?: string; 1012 | dns3gw?: string; 1013 | dns4gw?: string; 1014 | dnsserver?: string[]; 1015 | disablechecksumoffloading?: string; 1016 | already_run_config_upgrade?: string; 1017 | crypto_hardware?: string; 1018 | } 1019 | 1020 | export interface Gitsync { 1021 | repositoryurl?: string; 1022 | branch?: string; 1023 | } 1024 | 1025 | export interface Firmware { 1026 | alturl?: Alturl; 1027 | } 1028 | 1029 | export interface Alturl { 1030 | enable?: string; 1031 | firmwareurl?: string; 1032 | } 1033 | 1034 | export interface Ssh { 1035 | port?: number; 1036 | } 1037 | 1038 | export interface Webgui { 1039 | protocol?: string; 1040 | 'ssl-certref'?: string; 1041 | port?: string; 1042 | max_procs?: number; 1043 | loginautocomplete?: string; 1044 | dashboardcolumns?: number; 1045 | } 1046 | 1047 | export interface User { 1048 | name?: string; 1049 | descr?: string; 1050 | scope?: string; 1051 | groupname?: string; 1052 | password?: string; 1053 | uid?: number; 1054 | priv?: string; 1055 | 'md5-hash'?: string; 1056 | expires?: string; 1057 | authorizedkeys?: string; 1058 | ipsecpsk?: string; 1059 | 'bcrypt-hash'?: string; 1060 | 'sha512-hash'?: string; 1061 | } 1062 | 1063 | export interface Group { 1064 | name?: string; 1065 | description?: string; 1066 | scope?: string; 1067 | gid?: number; 1068 | member?: number; 1069 | priv?: string; 1070 | } 1071 | 1072 | export interface Sysctl { 1073 | item?: Item[]; 1074 | } 1075 | 1076 | export interface Item { 1077 | descr?: string; 1078 | tunable?: string; 1079 | value?: string; 1080 | } -------------------------------------------------------------------------------- /src/app/mappings/pfsense.interface.ts: -------------------------------------------------------------------------------- 1 | export interface pfRoot { 2 | pfsense: Pfsense; 3 | } 4 | 5 | export interface Pfsense { 6 | version: string; 7 | lastchange: string; 8 | system: System; 9 | interfaces: Interfaces; 10 | nat: Nat; 11 | firewall: Firewall; 12 | } 13 | 14 | export interface Firewall { 15 | rule: Rule[]; 16 | } 17 | 18 | export interface Rule { 19 | [x: string]: any; 20 | if: string; 21 | descr: string; 22 | proto: string; 23 | src: string; 24 | dst: string; 25 | dstport: number; 26 | } 27 | 28 | export interface Nat { 29 | outbound: Outbound; 30 | } 31 | 32 | export interface Outbound { 33 | mode: string; 34 | } 35 | 36 | export interface Interfaces { 37 | lan: Lan[]; 38 | wan: Wan[]; 39 | } 40 | 41 | export interface Lan { 42 | enable: string; 43 | if: string; 44 | descr: string; 45 | spoofmac: string; 46 | ipaddr: string; 47 | subnet: number; 48 | gateway: string; 49 | ipaddrv6: string; 50 | subnetv6: string; 51 | gatewayv6: string; 52 | } 53 | 54 | export interface Wan { 55 | enable: string; 56 | if: string; 57 | descr: string; 58 | 'alias-address': string; 59 | 'alias-subnet': number; 60 | spoofmac: string; 61 | ipaddr: string; 62 | dhcphostname: string; 63 | dhcprejectfrom: string; 64 | adv_dhcp_pt_timeout: string; 65 | adv_dhcp_pt_retry: string; 66 | adv_dhcp_pt_select_timeout: string; 67 | adv_dhcp_pt_reboot: string; 68 | adv_dhcp_pt_backoff_cutoff: string; 69 | adv_dhcp_pt_initial_interval: string; 70 | adv_dhcp_pt_values: string; 71 | adv_dhcp_send_options: string; 72 | adv_dhcp_request_options: string; 73 | adv_dhcp_required_options: string; 74 | adv_dhcp_option_modifiers: string; 75 | adv_dhcp_config_advanced: string; 76 | adv_dhcp_config_file_override: string; 77 | adv_dhcp_config_file_override_path: string; 78 | } 79 | 80 | export interface System { 81 | hostname: string; 82 | domain: string; 83 | timezone: string; 84 | language: string; 85 | } -------------------------------------------------------------------------------- /src/app/services/converter.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ConverterService } from './converter.service'; 4 | 5 | describe('ConverterService', () => { 6 | let service: ConverterService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(ConverterService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/converter.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject, Observable } from 'rxjs'; 3 | import { 4 | pfRoot, 5 | Rule as pfRule, 6 | User as pfUser, 7 | Alias as pfAlias, 8 | } from '../mappings/pfsense-complex.interface'; 9 | import { 10 | opnRoot, 11 | Rule as opnRule, 12 | Opnsense, 13 | System as opnSystem, 14 | Alias as opnAlias, 15 | User, 16 | } from '../mappings/opnsense.interface'; 17 | import { v1 as uuidv1 } from 'uuid' 18 | import { XMLParser, XMLBuilder } from 'fast-xml-parser'; 19 | import xmlFormat from 'xml-formatter'; 20 | 21 | @Injectable({ 22 | providedIn: 'root' 23 | }) 24 | export class ConverterService { 25 | 26 | displayConversionCard$ = new BehaviorSubject(false); 27 | conversionAvailable$ = new BehaviorSubject(false); 28 | 29 | constructor() { } 30 | 31 | cancel() { 32 | this.displayConversionCard$.next(false); 33 | } 34 | 35 | async convert(file: File, pretty?: boolean) { 36 | this.displayConversionCard$.next(false); 37 | this.displayConversionCard$.next(true); 38 | 39 | this.conversionAvailable$.next(false); 40 | 41 | const reader = new FileReader(); 42 | reader.readAsText(file); 43 | 44 | // bypass scope in FileReader.onload 45 | const that = this; 46 | 47 | return new Observable((subscriber: any) => { 48 | reader.onload = function (event) { 49 | 50 | // Correctly handle CDATA tags 51 | const parserOoptions = { 52 | numberParseOptions: {hex: false, leadingZeros: true} 53 | } 54 | 55 | const parser = new XMLParser(parserOoptions); 56 | if (reader.result !== null) { 57 | const parsedXmlToJson = parser.parse(reader.result.toString()); 58 | const opnJson = that.mapPFtoOPN(parsedXmlToJson); 59 | 60 | if (opnJson instanceof Error) { 61 | subscriber.next(); 62 | subscriber.error(opnJson); // bubble error message up to the calling method 63 | } 64 | 65 | const opnXml = that.jsonToXML(opnJson as opnRoot, pretty); 66 | 67 | that.conversionAvailable$.next(true); 68 | subscriber.next(opnXml); // opnXml object will be returned to the calling method 69 | subscriber.complete(); // Complete the subscriber 70 | } else { 71 | subscriber.error(new Error('File is empty')); 72 | } 73 | }; 74 | }) 75 | } 76 | 77 | mapPFtoOPN(input: pfRoot) { 78 | 79 | if (input.pfsense == null) return this.throwIncompatibleFileError('pfsense object is null'); 80 | 81 | const pfSystem = input.pfsense.system; 82 | const rules: opnRule[] = []; 83 | let aliases = undefined; 84 | const system: opnSystem = { 85 | hostname: '', 86 | domain: '', 87 | timezone: '', 88 | language: '' 89 | }; 90 | 91 | // @todo - unsure if custom mapping of rules are needed 92 | const pfRuleIter = input.pfsense.firewall; 93 | if (pfRuleIter) { 94 | for (const [key, value] of Object.entries(pfRuleIter)) { 95 | if (key === 'rule') { 96 | if (value instanceof Array) { 97 | value.forEach((rule: pfRule) => { 98 | rules.push({ 99 | uuid: uuidv1(), 100 | type: 'pass', 101 | enabled: 0, 102 | interface: 'lan', 103 | descr: 'generated-rule-from-pf2opn', 104 | protocol: rule.proto as string, 105 | source: { 106 | any: rule.src === 'any' ? 1 : 0, 107 | }, 108 | destination: { 109 | address: rule.dst, 110 | port: rule.dstport, 111 | }, 112 | ...rule 113 | }); 114 | }); 115 | } else { 116 | rules.push({ 117 | uuid: uuidv1(), 118 | type: 'pass', 119 | enabled: 0, 120 | interface: 'lan', 121 | descr: 'generated-rule-from-pf2opn', 122 | protocol: value.proto as string, 123 | source: { 124 | any: value.src === 'any' ? 1 : 0, 125 | }, 126 | destination: { 127 | address: value.dst as string, 128 | port: value.dstport as number, 129 | }, 130 | }); 131 | } 132 | } 133 | } 134 | } 135 | 136 | const pfAliases = input.pfsense.aliases; 137 | if (pfAliases) { 138 | let mappedAlias = Array(); 139 | 140 | for (const [key, value] of Object.entries(pfAliases)) { 141 | if (key === 'alias' && value instanceof Array) { 142 | value.forEach((alias: pfAlias) => { 143 | mappedAlias.push(this.mapAliasEntity(alias)); 144 | }); 145 | } 146 | if (key === 'alias' && !(value instanceof Array)) { 147 | mappedAlias.push(this.mapAliasEntity(value)); 148 | } 149 | }; 150 | 151 | aliases = mappedAlias 152 | } 153 | 154 | if (pfSystem) { 155 | system.hostname = pfSystem.hostname; 156 | system.domain = pfSystem.domain; 157 | system.timezone = pfSystem.timezone; 158 | let mappedUsers = Array(); 159 | 160 | const deDupeSystem = new Set(Object.values(system)) 161 | for (const [key, value] of Object.entries(pfSystem)) { 162 | 163 | // Map over user(s) 164 | if (key == 'user') { 165 | Array.isArray(value) ? 166 | value.forEach((u: pfUser) => mappedUsers.push(this.mapUserEntity(u))) : 167 | mappedUsers.push(this.mapUserEntity(value)); 168 | } 169 | 170 | if (!deDupeSystem.has(value)) { 171 | system[key] = value; 172 | } 173 | } 174 | 175 | // flatten users into distinct elements 176 | system.user = mappedUsers.flatMap((u: User) => u); 177 | } 178 | 179 | // @ts-ignore 180 | const opnsense: Opnsense = { 181 | version: 1, 182 | ...input.pfsense, 183 | system, 184 | aliases 185 | } 186 | 187 | const opnsenseJson: opnRoot = { 188 | opnsense, 189 | } 190 | 191 | return opnsenseJson; 192 | } 193 | 194 | jsonToXmlCustomArray(array: Array, nodeName: string) { 195 | const arrayBuilder = new XMLBuilder({ 196 | format: true, 197 | arrayNodeName: nodeName, 198 | }); 199 | 200 | return arrayBuilder.build(array); 201 | } 202 | 203 | jsonToXML(opnJson: opnRoot, pretty?: boolean) { 204 | 205 | const shouldPretty = 206 | pretty != undefined ? 207 | pretty : true; 208 | 209 | const builder = new XMLBuilder({ 210 | format: shouldPretty, 211 | // Correctly encode handled CDATA tags 212 | cdataPropName: 'CDATA', 213 | }); 214 | 215 | // This is a terrible hack because fast-xml-parser doesn't respect arrays...or I cannot 216 | // figure out how to make it respect them properly without destroying the entire XML response... 217 | if (opnJson.opnsense?.aliases) { 218 | const additionalArrays = this.jsonToXmlCustomArray(opnJson.opnsense.aliases, 'alias'); 219 | 220 | delete opnJson.opnsense.aliases; 221 | const result = builder.build(opnJson); 222 | 223 | const split = result.toString().split(""); 224 | const splitWithAliases = [split[0]+'', `${additionalArrays}`, split[1]]; 225 | const concatenatedResult = splitWithAliases.join(''); 226 | 227 | if (shouldPretty) { 228 | return xmlFormat(concatenatedResult, {}); 229 | } 230 | return concatenatedResult.replaceAll('\n', ''); 231 | } 232 | 233 | const result = builder.build(opnJson); 234 | return result; 235 | } 236 | 237 | private throwIncompatibleFileError(message: string): Error { 238 | return new Error('Incompatible file type\nMessage: ' + message); 239 | } 240 | 241 | private mapUserEntity(u: pfUser): User { 242 | let user: User = { 243 | password: '', 244 | ...u 245 | } 246 | 247 | if (u['bcrypt-hash']) { 248 | user.password = u['bcrypt-hash']; 249 | delete user['bcrypt-hash']; 250 | } 251 | 252 | if (u['md5-hash']) { 253 | user.password = u['md5-hash']; 254 | delete user['md5-hash']; 255 | } 256 | 257 | if (u['sha512-hash']) { 258 | user.password = u['sha512-hash']; 259 | delete user['sha512-hash']; 260 | } 261 | 262 | return user; 263 | } 264 | 265 | private mapAliasEntity(a: pfAlias) { 266 | const modifiedAddress = 267 | a?.address != undefined 268 | ? a?.address.toString().replaceAll(' ', '\n') 269 | : ''; 270 | 271 | const aElement = { 272 | enabled: a.enabled, 273 | name: a.name, 274 | type: a.type, 275 | proto: a.proto, 276 | interface: a.interface, 277 | counters: a.counters, 278 | updatefreq: a.updatefreq, 279 | content: modifiedAddress, 280 | categories: a.categories, 281 | description: a.descr, 282 | detail: a.detail 283 | } 284 | 285 | return aElement; 286 | } 287 | } 288 | -------------------------------------------------------------------------------- /src/app/upload/upload.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | Upload 8 | Select your pfsense config file 9 | 10 | 11 | 12 | 14 |
15 | 18 | 19 |
20 | 21 | 24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 |
32 |

33 | You have selected an unsupported file type. Please select a pfsense config file (XML). 34 |

35 |
36 |
37 |
38 |
39 | 40 | 41 | 42 | 43 |
44 |

Test this configuration in a development environment before deploying to mission critical services!

45 |
46 |
47 |

48 | There is no warranty, expressed or implied, associated with this tool. 49 | There is no liability for any damage, physical or otherwise, caused by this product. 50 |

51 |

Only you are responsible for your own actions.

52 |
53 |
54 |
55 |
56 | 57 | 58 | 59 | 60 | Opnsense Conversion 61 | 62 | 63 | 64 |
65 | 66 |
67 | 72 | 73 |
74 | 75 | 76 |
77 | 78 | 79 |
80 |
81 |
82 | 85 |
86 | 87 |
88 | 89 |
90 |

Having trouble with whitespace during import?

91 |
92 |
93 | 96 |
97 | 98 | 99 |
100 | 
101 | {{ this.renderedXML }}
102 | 
103 |
104 | 105 | 106 |
107 |
108 |

Are you sure you uploaded a pfsense config file?

109 |
110 | 111 |
112 | {{ this.renderedXML }}
113 | 
114 |
115 | 116 |
117 |
118 | 119 |
-------------------------------------------------------------------------------- /src/app/upload/upload.component.scss: -------------------------------------------------------------------------------- 1 | .contianer { 2 | margin-top: 1.5rem; 3 | } 4 | 5 | mat-card { 6 | margin: 1rem; 7 | } 8 | 9 | pre { 10 | overflow-x: auto; 11 | tab-size: 4; 12 | background: black; 13 | color: white; 14 | padding: 20px; 15 | } 16 | 17 | form * { 18 | display: block; 19 | margin: 10px; 20 | } 21 | 22 | .error-code { 23 | color: red; 24 | } 25 | 26 | .full-screen-spacer { 27 | flex: 1 1 auto; 28 | } 29 | 30 | .text { 31 | color: whitesmoke; 32 | } 33 | 34 | .progress-bar { 35 | display: flex; 36 | align-content: center; 37 | align-items: center; 38 | height: 60px; 39 | } 40 | 41 | .center { 42 | display: flex; 43 | justify-content: center; 44 | align-items: center; 45 | } 46 | 47 | .horizontal-spacer { 48 | width: 2rem; 49 | } 50 | 51 | .upload-card { 52 | margin-top: 1rem; 53 | margin-bottom: 0.6rem; 54 | margin-left: 1rem; 55 | } 56 | 57 | .upload-button { 58 | height: 3rem; 59 | width: 50%; 60 | 61 | .upload-button-text { 62 | font-size: 1rem; 63 | // margin-top: 0.6rem; 64 | // margin-bottom: 0.6rem; 65 | } 66 | } 67 | 68 | .cancel-button { 69 | height: 3rem; 70 | width: 10%; 71 | 72 | .cancel-button-text { 73 | font-size: 1rem; 74 | // margin-top: 0.6rem; 75 | // margin-bottom: 0.6rem; 76 | } 77 | } 78 | 79 | .file-input { 80 | display: none; 81 | } 82 | 83 | 84 | .caution-card { 85 | color: #1c1e21; 86 | background-color: #ffba00; 87 | 88 | .mat-card-subtitle { 89 | color: #1c1e21; 90 | } 91 | 92 | .bold { 93 | font-size: 15px; 94 | font-weight: 800; 95 | } 96 | } 97 | 98 | .unsupported-card { 99 | color: whitesmoke; 100 | background-color: #ff4d00; 101 | 102 | .mat-card-subtitle { 103 | color: whitesmoke; 104 | } 105 | 106 | .unsupported-content { 107 | padding: 1vh 0; 108 | } 109 | 110 | .unsupported { 111 | font-size: 15px; 112 | font-weight: 800; 113 | } 114 | } -------------------------------------------------------------------------------- /src/app/upload/upload.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { UploadComponent } from './upload.component'; 4 | 5 | describe('UploadComponent', () => { 6 | let component: UploadComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [UploadComponent] 12 | }); 13 | fixture = TestBed.createComponent(UploadComponent); 14 | component = fixture.componentInstance; 15 | fixture.detectChanges(); 16 | }); 17 | 18 | it('should create', () => { 19 | expect(component).toBeTruthy(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/app/upload/upload.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; 2 | import { ProgressBarMode } from '@angular/material/progress-bar'; 3 | import { ConverterService } from '../services/converter.service'; 4 | 5 | @Component({ 6 | selector: 'app-upload', 7 | templateUrl: './upload.component.html', 8 | styleUrls: ['./upload.component.scss'] 9 | }) 10 | export class UploadComponent implements OnInit, OnDestroy { 11 | 12 | displayConversionCard: Boolean; 13 | conversionAvailable: Boolean; 14 | progressMode: ProgressBarMode = 'indeterminate'; 15 | progressValue: number = 0; 16 | progressColor: string = 'accent'; 17 | 18 | fileName = ''; 19 | unsupportedFile = false; 20 | renderedXML: any = null; 21 | renderedNotPrettyXML: any = null; 22 | conversionError = false; 23 | 24 | constructor(private converterService: ConverterService) { 25 | this.displayConversionCard = this.converterService.displayConversionCard$.getValue(); 26 | this.conversionAvailable = this.converterService.conversionAvailable$.getValue(); 27 | } 28 | 29 | reset(event: any) { 30 | this.fileName = ''; 31 | event.target.files = null; 32 | this.unsupportedFile = false; 33 | this.progressMode = 'indeterminate'; 34 | this.conversionError = false; 35 | this.progressColor = 'accent'; 36 | this.converterService.cancel(); 37 | } 38 | 39 | incrementProgress() { 40 | this.progressValue = 0; 41 | for (let i = 0; i <= 100; i++) { 42 | setTimeout(() => { 43 | this.progressValue = i; 44 | }, 250); 45 | } 46 | } 47 | 48 | 49 | download() { 50 | var element = document.createElement('a'); 51 | element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.renderedXML)); 52 | element.setAttribute('download', 'pf2opn-generated-opnsense-config.xml'); 53 | 54 | element.style.display = 'none'; 55 | document.body.appendChild(element); 56 | 57 | element.click(); 58 | 59 | document.body.removeChild(element); 60 | } 61 | 62 | downloadNoPretty() { 63 | var element = document.createElement('a'); 64 | element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.renderedNotPrettyXML)); 65 | element.setAttribute('download', 'unformatted-pf2opn-generated-opnsense-config.xml'); 66 | 67 | element.style.display = 'none'; 68 | document.body.appendChild(element); 69 | 70 | element.click(); 71 | 72 | document.body.removeChild(element); 73 | } 74 | 75 | async onFileSelected(event: any) { 76 | const file: File = event.target.files[0]; 77 | this.fileName = file.name; 78 | this.progressColor = 'accent'; 79 | 80 | if (file && file.type.match('text/xml')) { 81 | this.unsupportedFile = false; 82 | 83 | (await this.converterService.convert(file)).subscribe( 84 | res => { 85 | this.progressMode = 'determinate'; 86 | this.incrementProgress(); 87 | this.renderedXML = res; 88 | this.conversionError = false 89 | }, 90 | err => { 91 | this.renderedXML = err; 92 | console.error('something went boom: ' + err); 93 | this.conversionError = true 94 | this.progressColor = 'warn'; 95 | }, 96 | ); 97 | (await this.converterService.convert(file, false)).subscribe( 98 | res => { 99 | this.progressMode = 'determinate'; 100 | this.incrementProgress(); 101 | this.renderedNotPrettyXML = res; 102 | this.conversionError = false 103 | }, 104 | err => { 105 | this.renderedNotPrettyXML = err; 106 | console.error('something went boom: ' + err); 107 | this.conversionError = true 108 | this.progressColor = 'warn'; 109 | }, 110 | ); 111 | } else { 112 | this.unsupportedFile = true; 113 | this.converterService.cancel(); 114 | } 115 | } 116 | 117 | ngOnInit() { 118 | this.converterService.displayConversionCard$.subscribe((e) => { 119 | this.displayConversionCard = e; 120 | }) 121 | this.converterService.conversionAvailable$.subscribe((e) => { 122 | this.conversionAvailable = e; 123 | }) 124 | } 125 | 126 | ngOnDestroy() { 127 | this.converterService.displayConversionCard$.unsubscribe(); 128 | this.converterService.conversionAvailable$.unsubscribe(); 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mwood77/pf2opn/846fa8d207bb6a30c47b23c11f5d2430b1e27666/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mwood77/pf2opn/846fa8d207bb6a30c47b23c11f5d2430b1e27666/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | pf2open 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app/app.module'; 4 | 5 | 6 | platformBrowserDynamic().bootstrapModule(AppModule) 7 | .catch(err => console.error(err)); 8 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | // /* You can add global styles to this file, and also import other style files */ 2 | 3 | // html, body { height: 100%; } 4 | // body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | 6 | html, body { height: 100%; width:100%; background-color: #303030;} 7 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 8 | .spacer{ height: 20px; } 9 | 10 | a { 11 | color: #FFFFFF 12 | } -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": ["node", "flat"] 7 | }, 8 | "files": [ 9 | "src/main.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitOverride": true, 10 | "noPropertyAccessFromIndexSignature": true, 11 | "noImplicitReturns": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "sourceMap": true, 14 | "declaration": false, 15 | "downlevelIteration": true, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "node", 18 | "importHelpers": true, 19 | "target": "ES2022", 20 | "module": "ES2022", 21 | "useDefineForClassFields": false, 22 | "lib": [ 23 | "ES2022", 24 | "dom" 25 | ], 26 | "esModuleInterop": true, 27 | "allowSyntheticDefaultImports": true, 28 | "resolveJsonModule": true 29 | }, 30 | "angularCompilerOptions": { 31 | "enableI18nLegacyMessageIdFormat": false, 32 | "strictInjectionParameters": true, 33 | "strictInputAccessModifiers": true, 34 | "strictTemplates": true 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "include": [ 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | --------------------------------------------------------------------------------