├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── critical_report.md │ ├── enhancement_request.md │ └── question.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── LICENSE ├── README.md ├── config.php.pub ├── docs ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── SECURITY.md ├── SUPPORT.md ├── VERSIONING.md └── images │ └── oda-screenshot.jpg ├── includes.php ├── includes ├── db.php ├── functions.php ├── template-loader.php └── template.php ├── index.php ├── install.php ├── mysql.sql ├── pgsql.sql └── templates ├── openda ├── codebase_logo.png ├── footer.php ├── header.php ├── index.php └── style.css └── openda_light ├── codebase_logo.png ├── footer.php ├── header.php ├── index.php └── style.css /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Something isn't working 4 | title: "[Bug]: " 5 | labels: bug 6 | assignees: userjack6880 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Software Version** 27 | [ ] Version 1 Release Candidate 1 28 | [ ] Version 1 Beta 4 29 | [ ] Other 30 | 31 | **Desktop (please complete the following information):** 32 | - OS [e.g. macOS] 33 | - Browser [e.g. Safari] 34 | - Version [e.g. 15.3] 35 | 36 | **Server (please complete the following information):** 37 | - Server OS [e.g. CentOS 7.3] 38 | - Web Server [e.g. Apache 2.4.52] 39 | - PHP Version [e.g. 7.4] 40 | - SQL Variant and Version [e.g. MariaDB 10.2] 41 | 42 | **Additional context** 43 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/critical_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Critical Bug Report 3 | about: Something is critically broken 4 | title: "[Critical Bug]: " 5 | labels: critical, bug 6 | assignees: userjack6880 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Software Version** 27 | [ ] Version 1 Release Candidate 1 28 | [ ] Version 1 Beta 4 29 | [ ] Other 30 | 31 | **Desktop (please complete the following information):** 32 | - OS [e.g. macOS] 33 | - Browser [e.g. Safari] 34 | - Version [e.g. 15.3] 35 | 36 | **Server (please complete the following information):** 37 | - Server OS [e.g. CentOS 7.3] 38 | - Web Server [e.g. Apache 2.4.52] 39 | - PHP Version [e.g. 7.4] 40 | - SQL Variant and Version [e.g. MariaDB 10.2] 41 | 42 | **Additional context** 43 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Enhancement Request 3 | about: New feature or request 4 | title: "[Request]: " 5 | labels: enhancement 6 | assignees: userjack6880 7 | 8 | --- 9 | 10 | **Describe the enhancement request** 11 | A clear and concise description of what you want us to consider. 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Further information is requested 4 | title: "[Question]: " 5 | labels: question, help wanted 6 | assignees: userjack6880 7 | 8 | --- 9 | 10 | **Posit your question!** 11 | What do you need help with? 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Pull Request Template 2 | 3 | ## Description 4 | 5 | Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. 6 | 7 | Fixes # (issue) 8 | 9 | ## Type of change 10 | 11 | Please delete options that are not relevant. 12 | 13 | - [] Bug fix (non-breaking change which fixes an issue) 14 | - [] New feature (non-breaking change which adds functionality) 15 | - [] Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | - [] This change requires a documentation update 17 | 18 | ## How Has This Been Tested? 19 | 20 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration 21 | 22 | **Test Configuration**: 23 | * OS: 24 | * OS Kernel Version: 25 | * WebServer: 26 | * WebServer Version: 27 | * PHP Version: 28 | * SQL Variant: 29 | * SQL Version: 30 | 31 | ## Checklist: 32 | 33 | - [ ] My code follows the style guidelines of this project 34 | - [ ] I have performed a self-review of my own code 35 | - [ ] I have commented my code, particularly in hard-to-understand areas 36 | - [ ] I have made corresponding changes to the documentation 37 | - [ ] My changes generate no new warnings 38 | - [ ] I have added tests that prove my fix is effective or that my feature works 39 | - [ ] New and existing unit tests pass locally with my changes 40 | - [ ] Any dependent changes have been merged and published in downstream modules 41 | - [ ] I have checked my code and corrected any misspellings -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | vendor/ 3 | composer.json 4 | composer.lock 5 | composer.phar 6 | includes/geolite2.mmdb 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Open DMARC Analyzer 2 | ![Open DMARC Analyzer Screenshot](docs/images/oda-screenshot.jpg?raw=true) 3 | 4 | Open DMARC Analyzer is an Open Source DMARC Report Analyzer to be used with DMARC reports that have been parsed by [Open Report Parser](https://github.com/userjack6880/Open-Report-Parser). 5 | 6 | Open DMARC Analyzer was written because there didn't seem to be a full-featured self-hosted report analyzer that provided enough details to make heads or tails of a large volume of DMARC reports that come into medium to large-sized organizations. While other solutions required paid subscriptions or have part of it hosted on AWS, Open DMARC Analyzer will run on any webserver that supports PHP 7.4+ and MariaDB 10.5+. 7 | 8 | Open DMARC Analyzer Version 1 is an [Anomaly \](https://systemanomaly.com/codebase) project by John Bradley (john@systemanomaly.com) 9 | 10 | # Minimum Requirements 11 | - Apache 2 or equivalent 12 | - PHP 5 (PHP 7+ required for phpWhois) 13 | - PHP PDO 14 | - MariaDB 10.5 (or equivalent) *or* PostgreSQL 13 15 | - **A database that is pre-populated with data from [Open Report Parser](https://github.com/userjack6880/Open-Report-Parser)** 16 | 17 | # Dependencies 18 | 19 | One of the following 2 packages are required to be installed. 20 | 21 | **[kevinoo/phpWhois](https://github.com/kevinoo/phpWhois)** 22 | 23 | It is highly recommended that you install this package using composer. Instructions are found on the package's git page. This is required, and will replace most GeoIP data if you disable the MaxMind DB reader package. This package *will* require PHP 7 or newer. 24 | 25 | *PLEASE NOTE: if you are using the jsmitty12/phpWhois package, it does not support PHP 8 properly. Please remove it and use the newer kevinoo/phpWhois package.* 26 | 27 | **[MaxMind DB Reader PHP API](https://github.com/maxmind/MaxMind-DB-Reader-php)** 28 | 29 | A note on this dependency - I've tried to write the one refrence to this external project as optional as possible, and it can almost completely be configured from config.php, due to the limitation of php namespace, I haven't come across a way that won't require you to dig deeper into the code if you happen to chose a compatible library to replace this MaxMind one. If you do wish to replace this library with another compatible one, the line in question is located in `includes\functions.php`: 30 | ```php 31 | $reader = new MaxMind\Db\Reader(GEO_DB); 32 | ``` 33 | 34 | It is highly recommended that you install this package using composer. Instructions are found on the package's git page. 35 | 36 | You will also need the GeoLite2 database from MaxMind (or any other compatible DB). It can be obtained from [here](https://dev.maxmind.com/geoip/geoip2/geolite2/). Open DMARC Analyzer makes use of the GeoLite2 City database. 37 | 38 | The MaxMind library is not distributed with this project, and is ultimately an optional feature to the project as a whole, unless you are using PHP 5. 39 | 40 | # Setting up Open DMARC Analyzer 41 | 42 | Obtaining Open DMARC Analyzer through `git` is probably the easiest way, in addition to doing occasional pulls to get up-to-date versions. 43 | 44 | ``` 45 | git clone https://github.com/userjack6880/Open-DMARC-Analyzer.git 46 | ``` 47 | 48 | Optionally, a [zip file of the latest release](https://github.com/userjack6880/Open-DMARC-Analyzer/releases) can be downloaded. 49 | 50 | Once downloaded and installed in a desired directory, install either jsmitty12's phpWhois package or the MaxMind DB Reader package through composer. Rename `config.php.pub` to `config.php` and edit the configuration for your environment (see the next section on **Configuration Options** for details). Finally, run `install.php` to create the database view used by this software package. 51 | 52 | `install.php` should remove itself and `mysql.sql` once complete. If permissions aren't given, `install.php` may not delete those files. It is recommended to manually delete these. 53 | 54 | # Configuration Options 55 | 56 | **Database Options** 57 | ```php 58 | define('DB_HOST', 'localhost'); 59 | define('DB_USER', 'dmarc'); 60 | define('DB_PASS', 'password'); 61 | define('DB_NAME', 'dmarc'); 62 | define('DB_PORT', '3306'); // default port 3306, 5432 for pgsql 63 | define('DB_TYPE', 'mysql'); // supported mysql and pgsql 64 | ``` 65 | 66 | **Debug Settings** 67 | ```php 68 | define('DEBUG', 1); 69 | ``` 70 | *Not Currently Used* 71 | 72 | **Template Settings** 73 | ```php 74 | define('TEMPLATE','openda'); 75 | ``` 76 | This will load the visual templated located `templates/`. Simply name the directory the template is located in. Do not use a trailing slash. 77 | 78 | **Package Loader** 79 | ```php 80 | define('AUTO_LOADER','vendor/autoload.php'); 81 | ``` 82 | Should not need to change this setting unless using a non-standard composer installation. 83 | 84 | **GeoIP2 Settings** 85 | ```php 86 | define('GEO_ENABLE', 1); 87 | define('GEO_DB', 'includes/geolite2.mmdb'); 88 | ``` 89 | Allows you to select between jsmitty12's phpWhois package and the MaxMind DB Reader package. The default is to use the MaxMind DB Reader package, as it provides the most relevant data to the user. To fall back to the jsmitty12's phpWhois package, change the `GEO_ENABLE` option to `0`. 90 | 91 | The second option, `GEO_DB` is used in conjunction with the MaxMind DB Reader package. The path to the MaxMind GeoIP database is relative to the root of the software package. 92 | 93 | **Date Range** 94 | ```php 95 | define('DATE_RANGE', '-1w'); 96 | ``` 97 | Defines the standard starting date range for data presented. All pages where dates are relevant start at a certain point and end at the time the page is loaded. This option defines where that starting point is, and the increment by which that starting date is changed. 98 | 99 | Valid date signifiers are `m`, `w`, and `d` for "month", "week", and "day". 100 | 101 | # Tested System Configurations 102 | 103 | | OS | HTTP | PHP | SQL | 104 | | --------------- | ------------- | ------ | --------------- | 105 | | Debian 11.6 | Apache 2.4.56 | 8.2.5 | MariaDB 10.5.18 | 106 | | Debian 11.6 | Apache 2.4.56 | 8.2.5 | PostgreSQL 13.9 | 107 | | Debian 11.6 | Apache 2.4.56 | 7.4.33 | MariaDB 10.5.18 | 108 | | Debian 11.6 | Apache 2.4.56 | 7.4.33 | PostgreSQL 13.9 | 109 | | CentOS 7.6.1810 | Apache 2.4.6 | 5.4.16 | MariaDB 5.5.65 | 110 | 111 | If you have a system configuration not listed, and would like to contribue this data, please [provide feedback](https://github.com/userjack6880/Open-Dmarc-Analyzer/issues). 112 | 113 | # Release Cycle and Versioning 114 | 115 | At release, End of Support and End of Life will be determined based on what will be in the next version. Versioning is under the Anomaly Versioning Scheme (2022), as outlined in `VERSIONING` under `docs`. 116 | 117 | # Support 118 | 119 | Support will be provided as outlined in the following schedule. For more details, see `SUPPORT`. 120 | 121 | | Version | Released | End of Support | End of Life | 122 | | ----------------------------------- | ---------------- | ---------------- | ---------------- | 123 | | Version 1 (Stable) | 15 May 2023 | 15 May 2024 | 31 December 2024 | 124 | 125 | # Contributing 126 | 127 | Public contributions are encouraged. Please review `CONTRIBUTING` under `docs` for contributing procedures. Additionally, please take a look at our `CODE_OF_CONDUCT`. By participating in this project you agree to abide by the Code of Conduct. 128 | 129 | # Contributors 130 | 131 | Primary Contributors 132 | - John Bradley - Initial Work 133 | 134 | Thanks to [all who contributed](https://github.com/userjack6880/Open-DMARC-Analyzer/graphs/contributors) and [have given feedback](https://github.com/userjack6880/Open-DMARC-Analyzer/issues?q=is%3Aissue). 135 | 136 | # Licenses and Copyrights 137 | 138 | Copyright © 2023 John Bradley (userjack6880). Open DMARC Analyzer is released under GNU GPLv3. See `LICENSE`. -------------------------------------------------------------------------------- /config.php.pub: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // Database Settings 31 | 32 | define('DB_HOST', 'localhost'); 33 | define('DB_USER', 'dmarc'); 34 | define('DB_PASS', 'password'); 35 | define('DB_NAME', 'dmarc'); 36 | define('DB_PORT', '3306'); // default port 3306, 5432 for pgsql 37 | define('DB_TYPE', 'mysql'); // supported mysql and pgsql 38 | 39 | // Debug Settings 40 | 41 | define('DEBUG', 1); 42 | 43 | // Template Settings 44 | 45 | define('TEMPLATE', 'openda'); 46 | 47 | // Package Loader 48 | define('AUTO_LOADER', 'vendor/autoload.php'); // autoloader for composer installed libraries 49 | 50 | // GeoIP2 Settings 51 | define('GEO_ENABLE', 1); // 0 - disable GeoIP2, 1 - enable GeoIP2 52 | define('GEO_DB', 'includes/geolite2.mmdb'); // location of GeoIP2 database 53 | 54 | // Date Range 55 | 56 | define('DATE_RANGE', '-1w'); 57 | 58 | ?> 59 | -------------------------------------------------------------------------------- /docs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1 4 | - Release! 5 | 6 | ## 1-rc1 7 | - Documentation updates. 8 | - Carried forward backports from beta 4. 9 | 10 | ## 1-β4 11 | - PostgresSQL validation and fixes backported from future Version 2 Alpha 1 branch. 12 | 13 | ## 1-β3 14 | - Tweaks to the `openda` and `openda_light` themes, including table widths and data coloring. 15 | - Issue template fix per issue #78. 16 | 17 | ## 1-β2 18 | - Corrected a divide-by-zero error in `template.php` issue #68. 19 | - Limited width of page to a minimum of 1230px to fix visual element issues. 20 | - Added `openda_light` theme. 21 | 22 | ## 1-β1 23 | - Corrected a geoip/whois bug (thank you [volkermauel](https://github.com/userjack6880/Open-DMARC-Analyzer/commits?author=volkermauel)). 24 | - Corrected template formatting bug with GEOIP disabled. 25 | 26 | ## 1-fc 27 | - Documentation Updates 28 | - Formatting 29 | - Feature Complete Release 30 | 31 | ## 0-α9 32 | - Bugfixes 33 | - Version Update to begin final feature implementation for Version 1 Feature Complete 34 | 35 | ## 0-α8.2 36 | - Added `SECURITY` and `SUPPORT` and updated relevant documentation to reference these. 37 | - Determined date for next Alpha release. 38 | - Added a basic installer 39 | 40 | ## 0-α8.1 41 | 42 | - Added `CODE_OF_CONDUCT.md`, `CONTRIBUTING.md`, pull request template, issue templates, and organized documents into docs folder. 43 | - Added basic installation script to add `report_stats` view from file and attempt to cleanup after itself. 44 | - Further fleshed out `README.md` 45 | - Improved compatibility with older SQL databases that do not support `INET6_ATON` or `INET6_NTOA`. 46 | - Added SQL error output. 47 | 48 | ## 0-α8 49 | 50 | - Rewrite of ODA for performance and visual improvements and feature simplification. 51 | - Begin Documentation Process 52 | 53 | ## 0-α7.3 54 | 55 | - README.md updates 56 | 57 | ## 0-α7.2 58 | 59 | - Added function to change date range increment based on default date range setting. 60 | 61 | ## 0-α7.1 62 | 63 | - PDO Input Sanitization (thanks Matthäus Wander) 64 | - Added IPv6 Support (thanks Matthäus Wander) 65 | 66 | ## 0-α7 67 | - No longer counts forwarded messages that aren't quarantined or rejected against compliance. 68 | - Minor PDO query optimisation. 69 | 70 | ## 0-α6 71 | - Sort index by DMARC policy added. 72 | - Link to domain page from senders page. 73 | - Fixed policy listed on index. 74 | - Added Organization Output 75 | 76 | ## 0-α5 77 | - Fixed behavior of the control that changes the start of the display period to take in account the default date range configured in `config.php`. 78 | - Created the beginnings of the org reports page. It's kinda basic right now. 79 | - Added a bit of color to the DKIM and SPF result columns. 80 | - Added optional GeoIP2 Information on `hosts.php`. 81 | - Fixed a bunch of little things here and there, and added a few comments in areas that needed it. 82 | - Many thanks to Timo N. for making excellent suggestions on improving this project, pointing out things I would've overlooked long into it. 83 | 84 | ## 0-α4 85 | - Added a control to change the start of the display period in 1 week steps. 86 | - Added disposition control to display a single disposition only. 87 | - Added a sender report to show senders for a single domain or what domains a single sender sent as. 88 | - Some code cleanup. 89 | 90 | ## 0-α3 91 | 92 | - Fixed issue where a domain will be listed to have a non-zero volume, but on the domain page will have no reports. This page now properly shows all reports related to a single domain. 93 | - Improved the accuracy of the DMARC compliance graph. No longer does it take the larger of the two alignments, but instead counts a message as complaint if it is either DKIM or SPF aligned. 94 | - Moved away from mysqli to utilize PDO instead. 95 | 96 | ## 0-α2 97 | 98 | - Code now has most useful features now. 99 | 100 | ## 0-α1 101 | 102 | - Project started. It's absolutely terrible and nobody should use this. 103 | -------------------------------------------------------------------------------- /docs/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | The Internet is a vast space with a diverse community of professionals and enthusaists with an equally vast set of interests and opinions. From this deep well of diversity comes a wellspring of fresh and bold ideas that can further humanity as a whole. But it is this same diversity that can lead to communication failures and discontent. 4 | 5 | This document, the Code of Conduct, serves as a general guideline on how the community revolving around this project, and all projects directly under my control, including those here on GitHub, the [System Anomaly](https://systemanomaly.com) website and web persona, personal and public social channels, and any other channels of communication spawned from these. These guidelines apply to everyone from myself at the top all the way down to those wishing to engage with these projects. 6 | 7 | Don't take this necessarially as a list of things which cannot be done. It is simply a guideline, which may be enhanced by a set of rules that apply to specific situations, which will be clearly posted if needed. 8 | 9 | Violations of this code of conduct are primarly enforced where it is applied, however violations outside of these spaces may preclude an individual from participation in these spaces. 10 | 11 | If you believe an individual has violated the Code of Conduct, please send an email to conduct@j3b.in. Please read the section titled **Reporting Guidelines** before doing so, and if you want to know how enforcement is handled, please read the section titled **Enforcement**. 12 | 13 | Thank You 14 | John Bradley 15 | (userjack6880) 16 | 17 | ## The Code 18 | 19 | ### Be Kind 20 | The world can be tough at times, and we do not need to be reminded of this fact through these spaces. A kind, considerate, and welcoming demeanor makes this space a better place, and can make someone's day a little brighter. Welcome those who wish to engage with this space, regardless of identity. This includes, but is not limited to, members of any race, ethnicity, culture, national origin, immigration status, social and economic class, education level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and ability both mental and physical. 21 | 22 | ### Be Respectful 23 | In addition to being kind, throught he course of participation in these spaces, one should be considerate and respectful. Your contributions may be used by others, and you may use others' contributations, and your decisions will affect others. Take this in account when making these decisions. Additionally, you may disagree with the decision, action, or opinion of another individual, and vice-versa. Handle disagreements with respect to the other individual. Do not allow frustration to be an excuse for poor behavior, poor manners, or personal attacks. These spaces are intended to be welcoming, and making someone feel uncomfortable or threatened is not productive. Instead, try to understand where the other person is coming from, and make an attempt to address the issue. 24 | 25 | Additionally, the following actions are not considered kind, respectful, or acceptable: 26 | - Violent threats or language directed against another person. 27 | - Discriminatory jokes and language. 28 | - Posting sexually explicit or violent material. 29 | - Posting, or threatening to post, other people's personally identifying information (PII), also known as "doxing". 30 | - Personal insults, especially using bigoted language such as racist or sexist terms. 31 | - Unwelcomed attention or harassment, sexual or otherwise. No means no. 32 | - Advocating for or encouraging the above behavior. 33 | 34 | ## Enforcement 35 | Breaking these guidelines does not always mean immediate expulsion from participation in these spaces. Infractions are investigated and handled on a case-by-case basis. Enforcement may come in many forms, from initial warnings for minor first-offense, requesting that the offending individual apologize to those who were harmed, to finally explusion for the most egregious violations of the Code of Conduct. 36 | 37 | Those put in charge of enforcement of the Code of Conduct, the Council, have final say in how it is enforced. A formal request for reconsideration is allowed, but reversasl in a decision is not guaranteed. 38 | 39 | ## Council Members 40 | - Chair: John Bradley (john@j3b.in) 41 | 42 | Because these projects are currently small in nature, the council consists of one member. Positions will open up as projects and related communities grow. The Code of Conduct will be updated as needed. 43 | 44 | ## Reporting Guidelines 45 | If you believe someone is violating the Code of Conduct, please email conduct@j3b.in. **All reports will remain confidential**. If a public statement is required in the course of enforcement, any identifying information will remain confidential **unless instructed otherwise** by those individuals. 46 | 47 | **If you believe anyone is in physical danger, please contact law enforcement first**. If you are unsure who needs to be contacted, please include that in your report and we will make an attempt to notify the appropriate agencies. 48 | 49 | If you are unsure if an incident is a violation of the Code of Conduct, report it anyways. Remember, **all reports will remain confidential**, and if a report isn't a violation, no harm will have been done. Likewise, if a violation isn't reported, nothing will be resolved. You will not be negatively looked upon if an incident isn't a violation, and knowing about these incidents will allow us to better adjust the Code of Conduct and processes related to the Code of Conduct as well as adjust specific rules and processes that apply to individual spaces. 50 | 51 | Please include in your report: 52 | - Your contact info, so that we can get in touch with you for a follow up. 53 | - Names, real or otherwise, so as long as it is able to allow us to identify the individual that violated the Code of Conduct. Include any witnesses that can back up your report. 54 | - When and where the incident occured. Please be as specific as possible. Also indicate if the issue is ongoing. 55 | - Your account of what occured, and a copy or link to any publicly available record of what occured. 56 | - Any additional context or information that you believe may be relevant. 57 | 58 | ## What Happens When We Receive a Report 59 | When an incident is reported, the Council will acknolwedge as soon as possible to the individual that submitted the report that we received it an have begun investigations. Once this has occured, the Council will immediately review: 60 | - What happened. 61 | - If this was a violation of the Code of Conduct. 62 | - Who violated the Code of Conduct. 63 | - If this is ongoing or if there is a threat to someone's safety. 64 | 65 | If the violation is ongoing or a threat to safety, the Council will work immediately to resolve the situation as best as possible, and may delay an official response until the situation has been resolved. 66 | 67 | Once there is a clear picture of what occured, an official response will be issued. It may include: 68 | - Nothing, if there is no violation. 69 | - A public and/or private reprimand. 70 | - A request for public and/or private apology. 71 | - Request the violator to take a break from these spaces. 72 | - Temporarially or permanently ban the violator from some or all of these spaces. 73 | 74 | The reporter will be notified of the Council's decision, and any related individuals will be contacted as needed. Public actions are reserved for the most severe violations of the Code of Conduct. 75 | 76 | ## What If a Report Includes a Violation By a Council Member? 77 | Currently, because the council consists solely of one member, it can be a difficult decision to make a report. This is understandable. There is no real good solution to this problem at this time. 78 | 79 | We still request that, if you are comfortable, to report a violation by the Council member, since this will give them an opportunity for self-reflection and self-correction. 80 | 81 | *All decisions* regarding violations by a Council member are considered public, and all reprimands to and apologies by a Council member will be public. Individuals making these reports will remain confidential unless instructed otherwise. -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | # How to contribute to Open DMARC Analyzer 3 | 4 | ## **Bug Reporting** 5 | 6 | - **Please do not report security issues publically on GitHub!** For details, see `SECURITY`. 7 | 8 | - **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/userjack6880/Open-DMARC-Analyzer/issues). 9 | 10 | - If an open issue addressing the problem does not exist, [open a new one](https://github.com/userjack6880/Open-DMARC-Analyzer/issues/new). Be sure to include a title and clear description, and as much relevant information as possible, including error messages, screenshots, or configuration files. **Please sanitize any passwords or sensitive information**. 11 | 12 | ## **Contributing Bugfixes and Patches** 13 | 14 | - Open a new GitHub pull request with the patch. Issue PRs to the main branch for bugfixes and patches. See **Contributing Feature Changes and Additions** for non-fixes. 15 | 16 | - Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. 17 | 18 | - Pull requests will be reviewed and encorporated once it has been tested. 19 | 20 | ## **Contributing Feature Changes and Additions** 21 | 22 | - First issue a feature request under [Issues](https://github.com/userjack6880/Open-DMARC-Analyzer/issues/new) using the appropriate template. 23 | 24 | - Open a new GitHub pull request with the feature change or addition. Issue PRs to the testing branch and include in the PR description the relevant issue number. Changes will be pushed through to the dev branch once it has been tested, and could possibly become part of the main branch. 25 | 26 | ## **Formatting PRs** 27 | 28 | Pull requests that are only formatting and whitespace changes will be rejected. 29 | 30 | ## **Additional Info** 31 | 32 | Open DMARC Analyzer is a continually changing project. Contributions, requests, and bug reports help made it what it is today and continues to be a source of inspiration and continual improvement, and are greatly appreciated. 33 | 34 | Thank You 35 | John Bradley 36 | (userjack6880) 37 | -------------------------------------------------------------------------------- /docs/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | Security is a serious concern for any modern project, open source or otherwise. In general, this policy applies to all projects found under control of [userjack6880](https://github.com/userjack6880) or as part of [System Anomaly](https://systemanomaly.com). If you believe you have found a security vulnerability in any of these projects, please report it as described below. 4 | 5 | ## Reporting a Vulnerability 6 | 7 | **Please Do Not Report Security Issues Publically!** Instead, please send an email to [security@j3b.in](mailto:security@j3b.in), and if possible, use our [PGP Key available from the System Anomaly website](https://systemanomaly.com/pgp/). 8 | 9 | A response should be recieved within 72 hours. If no response is given, please follow up to ensure the original message was received. Please include in your message: 10 | - Type of issue 11 | - Location of the affected source code and path to the affected file(s) 12 | - Any special configuration required to reproduce the issue 13 | - Step-by-step instructions to reproduce the issue 14 | - Proof-of-concept or exploit if possible 15 | - Impact of the issue and how it may be exploited 16 | 17 | ## Supported Versions 18 | 19 | Open DMARC Analyzer Version Security Support 20 | 21 | | Version | End of Life | 22 | | ----------------------------- | ---------------- | 23 | | Version 1 | 31 December 2024 | 24 | | Version 1 Release Candidate 1 | 31 December 2023 | 25 | | Version 1 Beta 4 | 28 April 2023 | 26 | | Version 1 Beta 3 | 15 May 2023 | 27 | | Version 1 Beta 2 | 26 April 2023 | 28 | | Version 1 Beta 1 | 19 April 2023 | 29 | | Version 1 Feature Complete | 29 November 2022 | 30 | | Version 0 Alpha 9 | 4 November 2022 | -------------------------------------------------------------------------------- /docs/SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Software Support Chart 2 | 3 | Due to the limited time available to developrs to maintain support, dates must be set where support must end. The following is a chart outlining the support shedule for Open DMARC Analyzer. 4 | 5 | | Version | Released | End of Support | End of Life | 6 | | ----------------------------------- | ---------------- | ---------------- | ---------------- | 7 | | Version 1 (Stable) | 15 May 2023 | 15 May 2024 | 31 December 2024 | 8 | | Version 1 Release Candidate 1 | 28 April 2023 | 15 May 2023 | 31 December 2023 | 9 | | Version 1 Beta 4 | 26 April 2023 | 28 April 2023 | 15 May 2023 | 10 | | Version 1 Beta 3 | 19 April 2023 | 26 April 2023 | 28 April 2023 | 11 | | Version 1 Beta 2 | 29 November 2022 | 19 April 2023 | 26 April 2023 | 12 | | Version 1 Beta 1 | 4 November 2022 | 29 November 2022 | 19 April 2023 | 13 | | Version 1 Feature Complete | 27 July 2022 | 4 November 2022 | 29 November 2022 | 14 | | Version 0 Alpha 9 | 2 May 2022 | 27 July 2022 | 4 November 2022 | 15 | | Version 0 Alpha 8.2 | 31 March 2022 | 2 May 2022 | 27 July 2022 | 16 | | Version 0 Alpha 8.1 | 30 March 2022 | 31 March 2022 | 2 May 2022 | 17 | | Version 0 Alpha 8 or Older | 29 March 2022 | 30 March 2022 | 30 March 2022 | 18 | 19 | # Support Cycle 20 | 21 | - Pre-stable versions recieve one version cycle of full spport and one cycle of critical support before being considered end of life. Due to the lack of release cycle for these versions, support time can wildly vary. 22 | - The final release candidate will have critical support until the end of a year that the stable version is released. 23 | - All versions of a stable version are considered supported, though it is encouraged to keep updated to the latest stable release. 24 | - Stable versions reach end of life at the end of a year that a new stable version is released. The exception is LTS versions - those will recieve support until the end of a year after a new LTS version is released. 25 | 26 | # Support Levels 27 | 28 | - **Full Support** means that software will recieve regular bug fixes, and security fixes until End of Support, at which time it falls under Critical Support. 29 | 30 | - **Critical Support** means that software will no longer recieve regular bug fixes, but security fixes will still be provided until End of Life. 31 | 32 | - **End of Life** means that there is no more support what-so-ever. Issues, bug reports, and code contributions to these versions will be ignored, rejected, or referred to currently supported versions. 33 | -------------------------------------------------------------------------------- /docs/VERSIONING.md: -------------------------------------------------------------------------------- 1 | # Versioning-Scheme 2 | 3 | This is a general guideline for all projects controlled by John Bradley (userjack6880) or part of the System Anomaly sphere of influence. This scheme shall be called the Anomaly Versioning Scheme (2022). 4 | 5 | ## Overview 6 | ``` 7 | Major - (Stage) SubMajor . Minor 8 | 9 | ex 10 | 11 | Alpha Project: 0-α1.6 Version 0 Alpha 1.6 12 | Feature Complete: 1-fc Version 1 Feature Complete 13 | Beta Project: 1-β4 Version 1 Beta 4 14 | Release Candidate: 5-rc2 Version 5 Release Candidate 2 15 | Stable: 1 Version 1 16 | Stable Update: 1-u3 Version 1 Update 3 17 | ``` 18 | 19 | ## Stages 20 | Project stages are defined as followed: 21 | - Alpha: the project is still in a state where features may be added and serious errors and fixes are not the primary focus of development. This is the "get shit working" stage of development. Alpha versions are not production ready. These versions are denoted with the Greek letter α or the word "Alpha". 22 | - Feature Complete: this project is still not in a state where fixes are the primary focus of development, but no new features are added. Existing features are fleshed out for full functionality before moving onto beta. It's still technically an Alpha version and is not production ready. Usually there will only be one feature complete version. These versions are denoted with "fc" or "Feature Complete". 23 | - Beta: the project has moved onto bug fixes and error correcting. This is where everything is tested and polished. While not considered production ready, these versions can be put into production at the risk of the user, as no new features will be added. These version are denoted with the Greek letter β or the word "Beta". 24 | - Release Candidate: the project is ready for release. It is assumed this version will become a stable release if no major bugs are found. Fixes are only applied to the Beta Stage and pushed back up to a new Release Candidate version. During this stage, documentation is completed. These versions are denoted with "rc" or "Release Candidate". 25 | - Stable: the project is finally released. No major bugs are known, all features are implemented, and the software is production safe. These have no denotations unless an update is issued. 26 | - Stable Update: A major fix was applied or a minor feature update was issued. These are denoted with "u" or "Update". 27 | 28 | ## Major Versions 29 | Major versions are established in one of two ways. Initial project creation has a major version number of 0, but are incremented to version 1 once it becomes feature complete. Feature completeness means that no major features will be added to this version. Additional features are agregated into the next version, which may begin as soon as a version exits alpha and begins beta testing. 30 | 31 | ## Submajor Versions 32 | Submajor version are limited to the stage of development in which the code was changed. Submajor changes also vary depending on stage of development. 33 | 34 | - Alpha submajor versions include significant rewrites of the code or new features added. 35 | - Feature Complete code does not have a submajor. 36 | - Beta submajor versions are included when a major bug is fixed, a feature is fleshed out, or there is a significant rewrite to accomplished either goal. 37 | - Release Candidate submajor versions are issued if a major bug is found and fixed. The first submajor release candidate version will not have a number attached. 38 | - Stable submajor versions are issued if a major bug is found and fixed or a feature is tweaked after release. Stable submajor versions add the stage indicater "u" or "Update". 39 | 40 | ## Minor Versions 41 | Minor versions are updates to submajor versions. Like submajor versions, these also vary depending on stage of development. 42 | 43 | - Alpha minor versions are very minor code changes, like a small tweak to a variable or changing single digit lines. 44 | - Feature Complete code does not have minor versions. 45 | - Beta minor versions are like Alpha minor versions, and are very minor code changes. 46 | - Release Candidate code does not have minor versions. 47 | - Stable code does not have minor versions. 48 | 49 | # Implementation 50 | This versioning system will be implemented on date of publish (29 March, 2022), and projects will be updated accordingly. -------------------------------------------------------------------------------- /docs/images/oda-screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/userjack6880/Open-DMARC-Analyzer/0ac3d054617c4192bc233da1301bb5b1e7068aa0/docs/images/oda-screenshot.jpg -------------------------------------------------------------------------------- /includes.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | include_once 'config.php'; 31 | include_once 'includes/template.php'; 32 | include_once 'includes/db.php'; 33 | include_once 'includes/functions.php'; 34 | include_once 'includes/template-loader.php'; 35 | 36 | ?> -------------------------------------------------------------------------------- /includes/db.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // Connect to DB // 31 | function dbConn() { 32 | try { 33 | if (DB_TYPE == "pgsql") { 34 | $pdo = new PDO("pgsql:host=".DB_HOST.";dbname=".DB_NAME.";port=".DB_PORT, DB_USER, DB_PASS); 35 | } 36 | elseif (DB_TYPE == "mysql") { 37 | $pdo = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME.";port=".DB_PORT, DB_USER, DB_PASS); 38 | } 39 | else { 40 | echo 'Incorrect DB Type: '.DB_TYPE; 41 | } 42 | } 43 | catch (PDOException $e) { 44 | echo 'Connection failed: '.$e->getMessage(); 45 | } 46 | return $pdo; 47 | } 48 | 49 | // Perform a Query 50 | function dbQuery($pdo, $statement, $params) { 51 | if(!isset($statement)) { 52 | echo "No query statement given!"; 53 | die; 54 | } 55 | else { 56 | try { 57 | $query = $pdo->prepare($statement); 58 | if (isset($params)) { 59 | $query->execute($params); 60 | } 61 | else { 62 | $query->execute(); 63 | } 64 | if($query->errorCode() != 0) { 65 | $errors = $query->errorInfo(); 66 | echo " failed: ".$errors[2]."
"; 67 | exit(); 68 | } 69 | } 70 | catch (PDOException $e) { 71 | echo 'Could not perform query: '.$e->getMessage(); 72 | } 73 | 74 | $rows = []; 75 | 76 | while ($row = $query->fetch(PDO::FETCH_ASSOC)) { 77 | array_push($rows, $row); 78 | } 79 | $query = null; 80 | return $rows; 81 | } 82 | } 83 | ?> 84 | -------------------------------------------------------------------------------- /includes/functions.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // Small Functions ------------------------------------------------------------ 31 | 32 | // Date Functions ------------------------------- 33 | function dateWord($date) { 34 | preg_match('/\-\d+(\w)/', $date, $match); 35 | if ($match[1] == 'd') { 36 | $dateWord = "Day"; 37 | } 38 | elseif ($match[1] == 'w') { 39 | $dateWord = "Week"; 40 | } 41 | else { 42 | $dateWord = "Month"; 43 | } 44 | return $dateWord; 45 | } 46 | 47 | function dateNum($date) { 48 | preg_match('/\-(\d+)\w/', $date, $match); 49 | return $match[1]; 50 | } 51 | 52 | function dateLtr($date) { 53 | preg_match('/\-\d+(\w)/', $date, $match); 54 | return $match[1]; 55 | } 56 | 57 | // Convert IP to something Usable --------------- 58 | function get_ip($ip4, $ip6) { 59 | if ($ip4) { 60 | $array['ip'] = long2ip($ip4); 61 | $array['ipv4'] = true; 62 | return $array; 63 | } 64 | else { 65 | $array['ip'] = inet_ntop($ip6); 66 | $array['ipv4'] = false; 67 | return $array; 68 | } 69 | } 70 | 71 | // Page Functions ------------------------------------------------------------- 72 | 73 | // Dashboard ------------------------------------ 74 | function dashboard($dateRange,$domain) { 75 | $pdo = dbConn(); 76 | $startDate = date("Y-m-d H:i:s",strtotime(strtolower("-".dateNum($dateRange)." ".dateWord($dateRange)))); 77 | 78 | // Get broad statistics 79 | $statement = "SELECT t1.domain, total_messages, t1.policy_p, t1.policy_pct, t2.none, t3.quarantine, t4.reject, 80 | t5.dkim_pass as dkim_pass_aligned, t6.dkim_pass as dkim_pass_unaligned, 81 | t7.spf_pass as spf_pass_aligned, t8.spf_pass as spf_pass_unaligned, t9.compliant 82 | FROM ( 83 | SELECT 84 | domain, sum(rcount) AS total_messages, policy_p, policy_pct 85 | FROM report_stats 86 | WHERE mindate BETWEEN :startdate AND NOW() 87 | GROUP BY domain, policy_p, policy_pct 88 | ) t1 89 | LEFT JOIN (SELECT domain, sum(rcount) AS none 90 | FROM report_stats 91 | WHERE mindate BETWEEN :startdate AND NOW() 92 | AND disposition = 'none' GROUP BY disposition, domain) t2 ON t1.domain=t2.domain 93 | LEFT JOIN (SELECT domain, sum(rcount) AS quarantine 94 | FROM report_stats 95 | WHERE mindate BETWEEN :startdate AND NOW() 96 | AND disposition = 'quarantine' GROUP BY disposition, domain) t3 on t1.domain=t3.domain 97 | LEFT JOIN (SELECT domain, sum(rcount) AS reject 98 | FROM report_stats 99 | WHERE mindate BETWEEN :startdate AND NOW() 100 | AND disposition = 'reject' GROUP BY disposition, domain) t4 on t1.domain=t4.domain 101 | LEFT JOIN (SELECT domain, sum(rcount) as dkim_pass 102 | FROM report_stats 103 | WHERE mindate BETWEEN :startdate AND NOW() 104 | AND disposition = 'none' AND dkimresult = 'pass' AND dkim_align = 'pass' GROUP BY domain) t5 on t1.domain=t5.domain 105 | LEFT JOIN (SELECT domain, sum(rcount) as dkim_pass 106 | FROM report_stats 107 | WHERE mindate BETWEEN :startdate AND NOW() 108 | AND disposition = 'none' AND dkimresult = 'pass' AND NOT dkim_align = 'pass' GROUP BY domain) t6 on t1.domain=t6.domain 109 | LEFT JOIN (SELECT domain, sum(rcount) as spf_pass 110 | FROM report_stats 111 | WHERE mindate BETWEEN :startdate AND NOW() 112 | AND disposition = 'none' AND spfresult = 'pass' AND spf_align = 'pass' GROUP BY domain) t7 on t1.domain=t7.domain 113 | LEFT JOIN (SELECT domain, sum(rcount) as spf_pass 114 | FROM report_stats 115 | WHERE mindate BETWEEN :startdate AND NOW() 116 | AND disposition = 'none' AND spfresult = 'pass' AND NOT spf_align = 'pass' GROUP BY domain) t8 on t1.domain=t8.domain 117 | LEFT JOIN (SELECT domain, sum(rcount) as compliant 118 | FROM report_stats 119 | WHERE mindate BETWEEN :startdate AND NOW() 120 | AND disposition = 'none' AND ((spfresult = 'pass' AND spf_align = 'pass') OR (dkimresult = 'pass' AND dkim_align = 'pass')) 121 | GROUP BY domain) t9 on t1.domain=t9.domain"; 122 | if ($domain == "all") { 123 | $params[':startdate'] = $startDate; 124 | } 125 | else { 126 | $statement .= " WHERE t1.domain = :domain"; 127 | $params = array(':startdate' => $startDate, ':domain' => $domain); 128 | } 129 | 130 | $stats = dbQuery($pdo, $statement, $params); 131 | $domain = overview_bar($stats, $domain); 132 | 133 | // individual domain overviews for multi-domain environments 134 | if ($domain == "all") { 135 | domain_overview($stats, $dateRange); 136 | } 137 | 138 | // details if a specific domain is selected 139 | if ($domain != "all") { 140 | // new stat query 141 | $statement = "SELECT ip, ip6, 142 | SUM(rcount) as messages, 143 | SUM(compliant) as compliant, 144 | SUM(none) as none, 145 | SUM(quarantine) as quarantine, 146 | SUM(reject) as reject, 147 | SUM(dkim_pass) as dkim_pass, 148 | SUM(t5.dkim_align) as dkim_align, 149 | SUM(spf_pass) as spf_pass, 150 | SUM(t7.spf_align) as spf_align 151 | FROM rptrecord 152 | LEFT JOIN (SELECT id, rcount AS compliant FROM rptrecord 153 | WHERE disposition = 'none' 154 | AND ((dkimresult = 'pass' AND dkim_align = 'pass') 155 | OR (spfresult = 'pass' AND spf_align = 'pass'))) t0 on rptrecord.id=t0.id 156 | LEFT JOIN (SELECT id, rcount AS none FROM rptrecord WHERE disposition = 'none') t1 ON rptrecord.id=t1.id 157 | LEFT JOIN (SELECT id, rcount AS quarantine FROM rptrecord WHERE disposition = 'quarantine') t2 ON rptrecord.id=t2.id 158 | LEFT JOIN (SELECT id, rcount AS reject FROM rptrecord WHERE disposition = 'reject') t3 ON rptrecord.id=t3.id 159 | LEFT JOIN (SELECT id, rcount AS dkim_pass FROM rptrecord WHERE disposition = 'none' AND dkimresult ='pass' ) t4 ON rptrecord.id=t4.id 160 | LEFT JOIN (SELECT id, rcount AS dkim_align FROM rptrecord 161 | WHERE disposition = 'none' AND dkimresult = 'pass' AND dkim_align = 'pass' ) t5 ON rptrecord.id=t5.id 162 | LEFT JOIN (SELECT id, rcount AS spf_pass FROM rptrecord WHERE disposition = 'none' AND spfresult ='pass' ) t6 ON rptrecord.id=t6.id 163 | LEFT JOIN (SELECT id, rcount AS spf_align FROM rptrecord 164 | WHERE disposition = 'none' AND spfresult = 'pass' AND spf_align = 'pass' ) t7 ON rptrecord.id=t7.id 165 | WHERE serial IN (SELECT serial FROM report WHERE mindate BETWEEN :startdate AND NOW() AND domain = :domain) 166 | GROUP BY ip, ip6 167 | ORDER BY messages DESC"; 168 | $params = array(':startdate' => $startDate, ':domain' => $domain); 169 | $stats = dbQuery($pdo, $statement, $params); 170 | 171 | domain_details($stats, $domain, $dateRange); 172 | } 173 | 174 | $pdo = NULL; 175 | } 176 | 177 | // Get Sender Details --------------------------- 178 | function senderDashboard($dateRange, $domain, $ip) { 179 | if (!isset($ip)) { 180 | echo "

No IP Given

\n"; 181 | return; 182 | } 183 | elseif(!GEO_ENABLE) { 184 | require_once(AUTO_LOADER); 185 | 186 | $whois = new phpWhois\Whois(); 187 | $geo_data = $whois->lookup($ip,false); 188 | } 189 | else { 190 | require_once(AUTO_LOADER); 191 | 192 | $geo = new MaxMind\Db\Reader(GEO_DB); 193 | $geo_data = $geo->get($ip); 194 | 195 | $geo->close(); 196 | } 197 | 198 | $pdo = dbConn(); 199 | $startDate = date("Y-m-d H:i:s",strtotime(strtolower("-".dateNum($dateRange)." ".dateWord($dateRange)))); 200 | 201 | $statement = "SELECT reportid, rcount, mindate, disposition, reason, 202 | dkimdomain, dkimresult, dkim_align, 203 | spfdomain, spfresult, spf_align 204 | FROM report 205 | LEFT JOIN rptrecord ON report.serial=rptrecord.serial 206 | WHERE report.serial in ( 207 | SELECT serial 208 | FROM rptrecord"; 209 | 210 | // determine if ipv4 or ipv6 before proceeding 211 | $ip4 = ip2long($ip); 212 | $is_ip4 = true; 213 | if (!$ip4) { 214 | $ip6 = inet_pton($ip); 215 | $is_ip4 = false; 216 | } 217 | 218 | // proceed with the statment 219 | if ($is_ip4) { 220 | $statement .= " WHERE ip = :ip) 221 | AND ip = :ip"; 222 | $params[':ip'] = $ip4; 223 | } 224 | else { 225 | $statement .= " WHERE ip6 = :ip) 226 | AND ip6 = :ip"; 227 | $params[':ip'] = $ip6; 228 | } 229 | 230 | $statement .= " AND mindate BETWEEN :startdate AND NOW()"; 231 | $params[':startdate'] = $startDate; 232 | 233 | // domain dependent 234 | if ($domain != "all") { 235 | $statement .= " AND domain = :domain"; 236 | $params[':domain'] = $domain; 237 | } 238 | 239 | $statement .= " ORDER BY mindate ASC"; 240 | 241 | $stats = dbQuery($pdo, $statement, $params); 242 | 243 | sender_details($geo_data, $stats, $domain, $dateRange, $ip); 244 | 245 | $pdo = NULL; 246 | } 247 | 248 | // Get Report Details --------------------------------------------------------- 249 | function reportDashboard($report) { 250 | if (!isset($report)) { 251 | echo "

No ReportID Given

\n"; 252 | return; 253 | } 254 | 255 | $pdo = dbConn(); 256 | 257 | $statement = "SELECT mindate, maxdate, domain, org, email, extra_contact_info, 258 | policy_adkim, policy_aspf, policy_p, policy_pct, 259 | ip, ip6, rcount, disposition, reason, 260 | dkimdomain, dkimresult, dkim_align, 261 | spfdomain, spfresult, spf_align 262 | FROM rptrecord 263 | LEFT JOIN report ON rptrecord.serial=report.serial 264 | WHERE reportid = :reportid"; 265 | $params[':reportid'] = $report; 266 | 267 | $data = dbQuery($pdo, $statement, $params); 268 | 269 | report_details($data, $report); 270 | 271 | $pdo = NULL; 272 | } 273 | 274 | // ----- Smaller Fetches ------------------------------------------------------ 275 | 276 | // Get Domains ---------------------------------- 277 | function getDomains($dateRange) { 278 | $pdo = dbConn(); 279 | $startDate = date("Y-m-d H:i:s",strtotime(strtolower("-".dateNum($dateRange)." ".dateWord($dateRange)))); 280 | $statement = "SELECT DISTINCT domain FROM report WHERE mindate BETWEEN :startdate AND NOW()"; 281 | $params[':startdate'] = $startDate; 282 | $domains = dbQuery($pdo, $statement, $params); 283 | foreach ($domains as $key => $domain) { 284 | $domain = array_map('htmlspecialchars', $domain); 285 | $domains[$key] = $domain; 286 | } 287 | $pdo = NULL; 288 | return $domains; 289 | } 290 | 291 | // Get Number of Senders ------------------------ 292 | function getSenderCount($dateRange, $domain) { 293 | $pdo = dbConn(); 294 | $startDate = date("Y-m-d H:i:s",strtotime(strtolower("-".dateNum($dateRange)." ".dateWord($dateRange)))); 295 | $statement = "SELECT ( 296 | (SELECT COUNT(DISTINCT ip) FROM rptrecord WHERE serial IN 297 | (SELECT serial FROM report WHERE mindate BETWEEN :startdate AND NOW() AND domain = :domain)) + 298 | (SELECT COUNT(DISTINCT ip6) FROM rptrecord WHERE serial IN 299 | (SELECT serial FROM report WHERE mindate BETWEEN :startdate AND NOW() AND domain = :domain)) ) 300 | AS count"; 301 | $params = array(':startdate' => $startDate, ':domain' => $domain); 302 | $count = dbQuery($pdo, $statement, $params); 303 | $pdo = NULL; 304 | return $count[0]['count']; 305 | } 306 | ?> 307 | -------------------------------------------------------------------------------- /includes/template-loader.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // real simple, get the name of the running script, and include the equivalent template file 31 | 32 | include_once ('templates/'.TEMPLATE.'/index.php'); 33 | 34 | // If there's more things later I need to load templates, I'll add them here. 35 | 36 | ?> 37 | -------------------------------------------------------------------------------- /includes/template.php: -------------------------------------------------------------------------------- 1 | . 28 | 29 | ---------------------------------------------------------------------------- */ 30 | 31 | // Versioning ----------------------------------------------------------------- 32 | function oda_version() { 33 | 34 | echo "1"; 35 | 36 | } 37 | 38 | // Javascripts ---------------------------------------------------------------- 39 | function javascript() { ?> 40 | \n"; 67 | } 68 | else { 69 | echo "
\n"; 70 | } 71 | 72 | // Show if all domains are being shown or a single domain 73 | echo "
\n"; 74 | if ($page == "index" ) { 75 | if (count($domains) == 1) { 76 | echo "Since $startdate\n"; 77 | } 78 | else if ($domain == "all") { 79 | echo "

All Domains


\n 80 | Since $startdate\n"; 81 | } 82 | else { 83 | echo "

$domain


\n 84 | Since $startdate\n"; 85 | } 86 | } 87 | // Special Cases 88 | if ($page == "sender") { 89 | if ($domain == "all") { 90 | echo "

Sender $ip


\n 91 | ← Back | Since $startdate\n"; 92 | } 93 | else { 94 | echo "

Sender $ip for $domain


\n 95 | ← Back | Since $startdate\n"; 96 | } 97 | } 98 | echo "
\n"; 99 | 100 | // Domain Selection and Date Selection 101 | echo "
\n"; 102 | 103 | if (count($domains) > 1) { 104 | echo "
\n 105 | \n 113 | \n 114 | \n 115 | \n 116 | \n 117 |

\n"; 118 | } 119 | 120 | // date selection -1 unit in config 121 | $datePrev = $dateNum+1; 122 | echo "Range Start: [ ← 1 $dateWord"; 123 | 124 | // date selectoin +1 unit in config 125 | if ($dateNum == 1) { 126 | echo " ]\n"; 127 | } 128 | else { 129 | $dateNext = $dateNum-1; 130 | echo " | 1 $dateWord → ]\n"; 131 | } 132 | 133 | echo "
\n 134 |
\n"; 135 | 136 | } 137 | 138 | else { 139 | return; // if it's not the specified pages, this controlbar is irrelvant 140 | } 141 | } 142 | 143 | // Overview Bar --------------------------------- 144 | function overview_bar($stats, $domain) { 145 | // extract stats 146 | $total = 0; 147 | $policy = ''; 148 | $policy_pct = 0; 149 | $dmarc_none = 0; 150 | $dmarc_quar = 0; 151 | $dmarc_rjct = 0; 152 | $dmarc_comp = 0; 153 | $dkim_pass_aligned = 0; 154 | $dkim_pass_noalign = 0; 155 | $spf_pass_aligned = 0; 156 | $spf_pass_noalign = 0; 157 | 158 | if ($domain == "all") { 159 | $domain_count = 0; 160 | foreach ($stats as $stat) { 161 | $stat = array_map('htmlspecialchars',$stat); 162 | $total = $total+$stat['total_messages']; 163 | if ($stat['none'] > 0) { $dmarc_none = $dmarc_none+$stat['none']; } 164 | if ($stat['quarantine'] > 0) { $dmarc_quar = $dmarc_quar+$stat['quarantine']; } 165 | if ($stat['reject'] > 0) { $dmarc_rjct = $dmarc_rjct+$stat['reject']; } 166 | if ($stat['compliant'] > 0) { $dmarc_comp = $dmarc_comp+$stat['compliant']; } 167 | if ($stat['dkim_pass_aligned'] > 0) { $dkim_pass_aligned = $dkim_pass_aligned+$stat['dkim_pass_aligned']; } 168 | if ($stat['dkim_pass_unaligned'] > 0) { $dkim_pass_noalign = $dkim_pass_noalign+$stat['dkim_pass_unaligned']; } 169 | if ($stat['spf_pass_aligned'] > 0) { $spf_pass_aligned = $spf_pass_aligned+$stat['spf_pass_aligned']; } 170 | if ($stat['spf_pass_unaligned'] > 0) { $spf_pass_noalign = $spf_pass_noalign+$stat['spf_pass_unaligned']; } 171 | $domain_count++; 172 | } 173 | 174 | // clunky, but detects if we have more than one domain, and changes all to a single domain if it's just one 175 | if ($domain_count == 1) { 176 | $domain = $stats[0]['domain']; 177 | $policy = ucfirst($stats[0]['policy_p']); 178 | $policy_pct = $stats[0]['policy_pct']; 179 | } 180 | } 181 | else { 182 | $stats[0] = array_map('htmlspecialchars',$stats[0]); 183 | $total = $stats[0]['total_messages']; 184 | $policy = ucfirst($stats[0]['policy_p']); 185 | $policy_pct = $stats[0]['policy_pct']; 186 | if ($stats[0]['none'] > 0) { $dmarc_none = $stats[0]['none']; } 187 | if ($stats[0]['quarantine'] > 0) { $dmarc_quar = $stats[0]['quarantine']; } 188 | if ($stats[0]['reject'] > 0) { $dmarc_rjct = $stats[0]['reject']; } 189 | if ($stats[0]['compliant'] > 0) { $dmarc_comp = $stats[0]['compliant']; } 190 | if ($stats[0]['dkim_pass_aligned'] > 0) { $dkim_pass_aligned = $stats[0]['dkim_pass_aligned']; } 191 | if ($stats[0]['dkim_pass_unaligned'] > 0) { $dkim_pass_noalign = $stats[0]['dkim_pass_unaligned']; } 192 | if ($stats[0]['spf_pass_aligned'] > 0) { $spf_pass_aligned = $stats[0]['spf_pass_aligned']; } 193 | if ($stats[0]['spf_pass_unaligned'] > 0) { $spf_pass_noalign = $stats[0]['spf_pass_unaligned']; } 194 | } 195 | 196 | // stat calculations 197 | if ($dmarc_none) { 198 | $dmarc_comp_pct = number_format(100 * ($dmarc_comp / $dmarc_none)); 199 | $dkim_comp_pct = number_format(100 * ($dkim_pass_aligned / $dmarc_none)); 200 | $dkim_pass_pct = number_format(100 * (((int)$dkim_pass_aligned + (int)$dkim_pass_noalign) / $dmarc_none)); 201 | $spf_comp_pct = number_format(100 * ($spf_pass_aligned / $dmarc_none)); 202 | $spf_pass_pct = number_format(100 * (((int)$spf_pass_aligned + (int)$spf_pass_noalign) / $dmarc_none)); 203 | } 204 | else { 205 | $dmarc_comp_pct = 0; 206 | $dkim_comp_pct = 0; 207 | $dkim_pass_pct = 0; 208 | $spf_comp_pct = 0; 209 | $spf_pass_pct = 0; 210 | } 211 | 212 | // overview details 213 | echo "
\n 214 |
\n 215 |
\n 216 | Total Messages
\n 217 | $total\n"; 218 | if ($domain != "all") { 219 | echo "
\n$policy_pct% $policy\n"; 220 | } 221 | echo "
\n 222 |
\n 223 |
\n 224 | Accepted
\n 225 | Quarantined
\n 226 | Rejected
\n 227 |
\n 228 |
\n 229 | $dmarc_none
\n 230 | $dmarc_quar
\n 231 | $dmarc_rjct
\n 232 |
\n 233 |
\n 234 |
\n 235 |
\n 236 |
\n 237 | Percent Compliant
\n 238 | $dmarc_comp_pct%
\n 239 | DKIM
\n 240 |
\n 241 |
\n 242 |
\n 243 |
\n 244 | $dkim_comp_pct% Aligned | $dkim_pass_pct% Passed
\n 245 | SPF
\n 246 |
\n 247 |
\n 248 |
\n 249 |
\n 250 | $spf_comp_pct% Aligned | $spf_pass_pct% Passed
\n 251 |
\n 252 |
\n 253 |
\n"; 254 | 255 | // returns a modified domain if only one is detected 256 | return $domain; 257 | } 258 | 259 | // Overview Bar --------------------------------- 260 | function domain_overview($stats, $dateRange) { 261 | foreach ($stats as $stat) { 262 | $stat = array_map('htmlspecialchars',$stat); 263 | // extract stats 264 | $dmarc_none = 0; 265 | $dmarc_quar = 0; 266 | $dmarc_rjct = 0; 267 | $dmarc_comp = 0; 268 | $dkim_pass_aligned = 0; 269 | $dkim_pass_noalign = 0; 270 | $spf_pass_aligned = 0; 271 | $spf_pass_noalign = 0; 272 | 273 | $domain = $stat['domain']; 274 | $total = $stat['total_messages']; 275 | $policy = ucfirst($stat['policy_p']); 276 | $policy_pct = $stat['policy_pct']; 277 | if ($stat['none'] > 0) { $dmarc_none = $stat['none']; } 278 | if ($stat['quarantine'] > 0) { $dmarc_quar = $stat['quarantine']; } 279 | if ($stat['reject'] > 0) { $dmarc_rjct = $stat['reject']; } 280 | if ($stat['compliant'] > 0) { $dmarc_comp = $stat['compliant']; } 281 | if ($stat['dkim_pass_aligned'] > 0) { $dkim_pass_aligned = $stat['dkim_pass_aligned']; } 282 | if ($stat['dkim_pass_unaligned'] > 0) { $dkim_pass_noalign = $stat['dkim_pass_unaligned']; } 283 | if ($stat['spf_pass_aligned'] > 0) { $spf_pass_aligned = $stat['spf_pass_aligned']; } 284 | if ($stat['spf_pass_unaligned'] > 0) { $spf_pass_noalign = $stat['spf_pass_unaligned']; } 285 | 286 | $sender_count = getSenderCount($dateRange, $domain); 287 | 288 | // stat calculations 289 | if ($dmarc_none) { 290 | $dmarc_comp_pct = number_format(100 * ($dmarc_comp / $dmarc_none)); 291 | $dkim_comp_pct = number_format(100 * ($dkim_pass_aligned / $dmarc_none)); 292 | $dkim_pass_pct = number_format(100 * (((int)$dkim_pass_aligned + (int)$dkim_pass_noalign) / $dmarc_none)); 293 | $spf_comp_pct = number_format(100 * ($spf_pass_aligned / $dmarc_none)); 294 | $spf_pass_pct = number_format(100 * (((int)$spf_pass_aligned + (int)$spf_pass_noalign) / $dmarc_none)); 295 | } 296 | else { 297 | $dmarc_comp_pct = 0; 298 | $dkim_comp_pct = 0; 299 | $dkim_pass_pct = 0; 300 | $spf_comp_pct = 0; 301 | $spf_pass_pct = 0; 302 | } 303 | 304 | // overview details 305 | echo "
\n 306 |
\n 307 |
\n 308 |

$domain - $sender_count Senders

\n 309 |
\n 310 |
\n 311 | DMARC Compliance\n 312 |
\n 313 |
\n 314 |
\n 315 | DKIM\n 316 |
\n 317 |
\n 318 |
\n 319 |
\n 320 | SPF\n 321 |
\n 322 |
\n 323 |
\n 324 |
\n 325 |
\n 326 |
\n 327 | \n 328 | \n 329 | \n 330 | \n 331 | \n 339 | \n 347 | \n 348 |
$total Messages$policy_pct% $policy"; 332 | if ($dmarc_quar > 0) { 333 | echo "$dmarc_quar"; 334 | } 335 | else { 336 | echo "$dmarc_quar"; 337 | } 338 | echo " Quarantined"; 340 | if ($dmarc_rjct > 0) { 341 | echo "$dmarc_rjct"; 342 | } 343 | else { 344 | echo "$dmarc_rjct"; 345 | } 346 | echo " Rejected
\n 349 |
\n 350 |
\n 351 |
\n"; 352 | } 353 | } 354 | 355 | // Domain Details ------------------------------- 356 | function domain_details($stats, $domain, $dateRange) { 357 | $entries = count($stats); 358 | $height = $entries * 100; 359 | echo "

Domain Summary

\n 360 |
\n 361 |
\n"; 362 | 363 | foreach ($stats as $stat) { 364 | $compliant = 0; 365 | $none = 0; 366 | $quarantine = 0; 367 | $reject = 0; 368 | $dkim_pass = 0; 369 | $dkim_align = 0; 370 | $spf_pass = 0; 371 | $spf_align = 0; 372 | 373 | // extract stats - this'll be sorted by senderIP 374 | $ip = get_ip($stat['ip'], $stat['ip6']); 375 | $stat = array_map('htmlspecialchars',$stat); 376 | $messages = $stat['messages']; 377 | if ($stat['compliant'] > 0) { $compliant = $stat['compliant']; } 378 | if ($stat['none'] > 0) { $none = $stat['none']; } 379 | if ($stat['quarantine'] > 0) { $quarantine = $stat['quarantine']; } 380 | if ($stat['reject'] > 0) { $reject = $stat['reject']; } 381 | if ($stat['dkim_pass'] > 0) { $dkim_pass = $stat['dkim_pass']; } 382 | if ($stat['dkim_align'] > 0) { $dkim_align = $stat['dkim_align']; } 383 | if ($stat['spf_pass'] > 0) { $spf_pass = $stat['spf_pass']; } 384 | if ($stat['spf_align'] > 0) { $spf_align = $stat['spf_align']; } 385 | 386 | // calculate stats 387 | $dmarc_comp_pct = number_format(100 * ($compliant / $messages)); 388 | if ($none > 0) { 389 | $dkim_comp_pct = number_format(100 * ($dkim_align / $none)); 390 | $dkim_pass_pct = number_format(100 * ($dkim_pass / $none)); 391 | $spf_comp_pct = number_format(100 * ($spf_align / $none)); 392 | $spf_pass_pct = number_format(100 * ($spf_pass / $none)); 393 | } 394 | else { 395 | // sometimes we get entries that are full reject 396 | $dkim_comp_pct = 0; 397 | $dkim_pass_pct = 0; 398 | $spf_comp_pct = 0; 399 | $spf_pass_pct = 0; 400 | } 401 | 402 | // now present 403 | echo "
\n 404 |
\n 405 |

".$ip['ip']."

\n 406 | ".gethostbyaddr($ip['ip'])."\n 407 |
\n 408 |
\n 409 | \n 410 | \n 411 | \n 412 | \n 413 | \n 414 | \n 415 | \n 416 | \n 417 | \n 418 | \n 419 | \n 427 | \n 435 | \n 436 |
MessagesCompliantQuarantinedRejected
$messages$dmarc_comp_pct%"; 420 | if ($quarantine > 0) { 421 | echo "$quarantine"; 422 | } 423 | else { 424 | echo "$quarantine"; 425 | } 426 | echo ""; 428 | if ($quarantine > 0) { 429 | echo "$reject"; 430 | } 431 | else { 432 | echo "$reject"; 433 | } 434 | echo "
\n 437 |
\n 438 |
\n 439 | DKIM\n 440 |
\n 441 |
\n 442 |
\n 443 |
\n 444 | SPF\n 445 |
\n 446 |
\n 447 |
\n 448 |
\n 449 |
\n 450 |
\n"; 451 | } 452 | 453 | echo "
\n 454 |
\n"; 455 | } 456 | 457 | // Sender Details ------------------------------- 458 | function sender_details($geo_data, $stats, $domain, $dateRange, $ip) { 459 | $hostname = gethostbyaddr($ip) ?: ''; 460 | $org = ''; 461 | $city = ''; 462 | $region = ''; 463 | $country = ''; 464 | $lon = ''; 465 | $lat = ''; 466 | 467 | if (GEO_ENABLE) { 468 | if (array_key_exists('city',$geo_data)) { $city = $geo_data['city']['names']['en']; } 469 | if (array_key_exists('subdivisions',$geo_data)) { $region = $geo_data['subdivisions']['0']['names']['en']; } 470 | if (array_key_exists('country',$geo_data)) { $country = $geo_data['country']['names']['en']; } 471 | if (array_key_exists('location',$geo_data)) { 472 | $lat = $geo_data['location']['latitude']; 473 | $lon = $geo_data['location']['longitude']; 474 | } 475 | } 476 | else { 477 | $org = $geo_data['regrinfo']['owner']['organization'] ?: ''; 478 | } 479 | 480 | // present the data, obi-wan 481 | if (GEO_ENABLE) { 482 | echo "
\n 483 |
\n 484 |
\n 485 |
\n"; 486 | } 487 | else { 488 | echo "
\n 489 |
\n 490 |
\n 491 |
\n"; 492 | } 493 | 494 | if ($ip != '') { echo "$ip
\n"; } 495 | if ($hostname != '') { echo "$hostname
\n"; } 496 | if ($org != '') { echo "$org
\n"; } 497 | if ($city != '') { echo "$city
"; } 498 | if ($region != '') { echo "$region
"; } 499 | if ($country != '') { echo "$country
"; } 500 | 501 | echo "
\n"; 502 | 503 | echo "
\n 504 |
\n"; 505 | 506 | // if there's no maxmind data, then there's no map to find 507 | if (GEO_ENABLE) { 508 | echo "
\n 509 | \n 510 |
\n"; 511 | } 512 | 513 | echo "
\n 514 |
\n"; 515 | 516 | if (count($stats) > 0) { 517 | echo "\n 518 | \n 519 | \n 520 | \n 521 | \n 522 | \n 523 | \n 524 | \n 525 | \n 526 | \n 527 | \n"; 528 | } 529 | 530 | foreach ($stats as $stat) { 531 | $stat = array_map('htmlspecialchars',$stat); 532 | $dkimresult = $stat['dkimresult'] ?: 'unknown'; 533 | $dkim_align = $stat['dkim_align'] ?: 'unknown'; 534 | $spfresult = $stat['spfresult'] ?: 'unknown'; 535 | $spf_align = $stat['spf_align'] ?: 'unknown'; 536 | echo "\n 537 | \n 538 | \n 539 | \n 550 | \n 551 | \n"; 556 | } 557 | else { 558 | echo "Not Signed\n"; 559 | } 560 | echo " \n 563 | \n"; 564 | } 565 | 566 | if (count($stats) > 0) { echo "
Report IDMessage CountDispositionReasonDKIMSPF
".$stat['reportid']."".$stat['rcount'].""; 540 | if ($stat['disposition'] == "quarantine") { 541 | echo "".$stat['disposition'].""; 542 | } 543 | elseif ($stat['disposition'] == "reject") { 544 | echo "".$stat['disposition'].""; 545 | } 546 | else { 547 | echo $stat['disposition']; 548 | } 549 | echo "".$stat['reason'].""; 552 | if ($stat['dkimdomain'] != '') { 553 | echo "Signed by ".$stat['dkimdomain']."
\n 554 | Result: $dkimresult | 555 | Alignment: $dkim_align
Envelope from ".$stat['spfdomain']."
\n 561 | Result: $spfresult | 562 | Alignment: $spf_align
\n"; } 567 | 568 | } 569 | 570 | function report_details($data, $report) { 571 | 572 | if ($data[0]['ip6'] != '') { $ip = $data[0]['ip6']; } 573 | $data[0] = array_map('htmlspecialchars',$data[0]); 574 | if ($data[0]['ip6'] != '') { $data[0]['ip6'] = $ip; } 575 | 576 | if ($data[0]['policy_adkim'] == 'r') { $dkim_policy = 'Relaxed'; } 577 | else if ($data[0]['policy_adkim'] == 's') { $dkim_policy = 'Strict'; } 578 | else { $dkim_policy = 'unknown'; } 579 | if ($data[0]['policy_aspf'] == 'r') { $spf_policy = 'Relaxed'; } 580 | else if ($data[0]['policy_aspf'] == 's') { $spf_policy = 'Strict'; } 581 | else { $spf_policy = 'unknown'; } 582 | 583 | // report details 584 | echo "

Details for Report $report

\n 585 |
\n 586 |
\n 587 |
\n 588 |
\n"; 589 | 590 | if ($data[0]['mindate'] != '' 591 | && $data[0]['maxdate'] != '') { echo "Date Range
\n"; } 592 | if ($data[0]['org'] != '') { echo "Reporting Organization
\n"; } 593 | if ($data[0]['email'] != '') { echo "Report Origin Email
\n"; } 594 | if ($data[0]['extra_contact_info'] != '') { echo "Contact Info
\n"; } 595 | if ($data[0]['policy_p'] != '' 596 | && $data[0]['policy_pct'] != '') { echo "DMARC Policy
\n"; } 597 | if ($data[0]['policy_adkim'] != '') { echo "DKIM Policy
\n"; } 598 | if ($data[0]['policy_aspf'] != '') { echo "SPF Policy
\n"; } 599 | 600 | echo "
\n 601 |
\n 602 |
\n 603 |
\n"; 604 | 605 | if ($data[0]['mindate'] != '' 606 | && $data[0]['maxdate'] != '') { echo $data[0]['mindate']." - ".$data[0]['maxdate']."
\n"; } 607 | if ($data[0]['org'] != '') { echo $data[0]['org']."
\n"; } 608 | if ($data[0]['email'] != '') { echo $data[0]['email']."
\n"; } 609 | if ($data[0]['extra_contact_info'] != '') { echo $data[0]['extra_contact_info']."
\n"; } 610 | if ($data[0]['policy_p'] != '' 611 | && $data[0]['policy_pct'] != '') { echo ucfirst($data[0]['policy_p'])." ".$data[0]['policy_pct']."%
\n"; } 612 | if ($data[0]['policy_adkim'] != '') { echo "$dkim_policy
\n"; } 613 | if ($data[0]['policy_aspf'] != '') { echo "$spf_policy
\n"; } 614 | 615 | echo "
\n 616 |
\n 617 |
\n 618 |
\n"; 619 | 620 | echo "\n 621 | \n 622 | \n 623 | \n 624 | \n 625 | \n 626 | \n 627 | \n 628 | \n 629 | \n 630 | \n 631 | \n"; 632 | 633 | foreach ($data as $row) { 634 | $ip = get_ip($row['ip'],$row['ip6']); 635 | $row = array_map('htmlspecialchars',$row); 636 | $dkimresult = $row['dkimresult'] ?: 'unknown'; 637 | $dkim_align = $row['dkim_align'] ?: 'unknown'; 638 | $spfresult = $row['spfresult'] ?: 'unknown'; 639 | $spf_align = $row['spf_align'] ?: 'unknown'; 640 | echo "\n 641 | \n 642 | \n 643 | \n 644 | \n 655 | \n 656 | \n"; 661 | } 662 | else { 663 | echo "Not Signed\n"; 664 | } 665 | echo " \n 668 | \n"; 669 | } 670 | 671 | echo "
Sender IPRFC5322 DomainMessage CountDispositionReasonDKIMSPF
".$ip['ip']."".$row['domain']."".$row['rcount'].""; 645 | if ($row['disposition'] == "quarantine") { 646 | echo "".$row['disposition'].""; 647 | } 648 | elseif ($row['disposition'] == "reject") { 649 | echo "".$row['disposition'].""; 650 | } 651 | else { 652 | echo $row['disposition']; 653 | } 654 | echo "".$row['reason'].""; 657 | if ($row['dkimdomain'] != '') { 658 | echo "Signed by ".$row['dkimdomain']."
\n 659 | Result: $dkimresult | 660 | Alignment: $dkim_align
Envelope from ".$row['spfdomain']."
\n 666 | Result: $spfresult | 667 | Alignment: $spf_align
\n"; 672 | } 673 | ?> 674 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | . 28 | 29 | ---------------------------------------------------------------------------- */ 30 | 31 | // Includes 32 | include_once 'includes.php'; 33 | 34 | // Pull in URI Gets 35 | 36 | // Range ---------------------------------------------------------------------- 37 | if (!empty($_GET['range'])) { 38 | $dateRange = htmlspecialchars($_GET['range']); 39 | } 40 | elseif (isset($_POST['range'])) { 41 | $dateRange = htmlspecialchars($_POST['range']); 42 | } 43 | else { 44 | $dateRange = DATE_RANGE; 45 | } 46 | 47 | // Page ----------------------------------------------------------------------- 48 | if (isset($_GET['page'])) { 49 | $page = htmlspecialchars($_GET['page']); 50 | } 51 | elseif (isset($_POST['page'])) { 52 | $page = htmlspecialchars($_POST['page']); 53 | } 54 | else { 55 | $page = "index"; 56 | } 57 | 58 | // Domain --------------------------------------------------------------------- 59 | if (isset($_GET['domain'])) { 60 | $domain = htmlspecialchars($_GET['domain']); 61 | } 62 | elseif (isset($_POST['domain'])) { 63 | $domain = htmlspecialchars($_POST['domain']); 64 | } 65 | else { 66 | $domain = "all"; 67 | } 68 | 69 | // IPs ------------------------------------------------------------------------ 70 | if (isset($_GET['ip'])) { 71 | $ip = htmlspecialchars($_GET['ip']); 72 | } 73 | elseif (isset($_POST['ip'])) { 74 | $ip = htmlspecialchars($_POST['ip']); 75 | } 76 | else { 77 | $ip = ''; 78 | } 79 | 80 | // ReportID ------------------------------------------------------------------- 81 | if (isset($_GET['report'])) { 82 | $report = htmlspecialchars($_GET['report']); 83 | } 84 | elseif (isset($_POST['report'])) { 85 | $report = htmlspecialchars($_POST['report']); 86 | } 87 | else { 88 | $report = ''; 89 | } 90 | 91 | // End URI gets 92 | 93 | // Page Header 94 | page_header($page, $domain, $dateRange, $ip); 95 | 96 | if ($page == "index") { 97 | dashboard($dateRange, $domain); 98 | } 99 | elseif ($page == "sender") { 100 | senderDashboard($dateRange, $domain, $ip); 101 | } 102 | elseif ($page == "report") { 103 | reportDashboard($report); 104 | } 105 | else { 106 | echo "

Invalid Page

\n"; 107 | } 108 | 109 | // Page Footer 110 | page_footer(); 111 | 112 | ?> 113 | -------------------------------------------------------------------------------- /install.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // Includes 31 | include_once 'includes.php'; 32 | 33 | // Connect to database 34 | 35 | echo "connecting to database..."; 36 | $pdo = dbConn(); 37 | echo " success
"; 38 | 39 | // Read in file and build statement 40 | $statement =''; 41 | 42 | echo "opening file..."; 43 | $lines = file(DB_TYPE.'.sql'); 44 | echo " success
"; 45 | 46 | foreach ($lines as $line) 47 | { 48 | echo "→ $line
"; 49 | // skip comments 50 | if (substr($line, 0, 2) == '--' || $line == '') { continue; } 51 | 52 | // add line to statement 53 | $statement .= $line; 54 | 55 | // check for end of query and run it 56 | if (substr(trim($line), -1, 1) == ';') { 57 | try { 58 | echo "performing query..."; 59 | $query = $pdo->prepare($statement); 60 | $query->execute(); 61 | 62 | if($query->errorCode() != 0) { 63 | $errors = $query->errorInfo(); 64 | echo " failed: ".$errors[2]."
"; 65 | exit(); 66 | } 67 | } 68 | catch (PDOException $e) { 69 | echo " failed: ".$e->getMessage()."
"; 70 | exit(); 71 | } 72 | echo " success
"; 73 | $query = NULL; 74 | $statement = ''; 75 | } 76 | } 77 | 78 | echo "database successfully updated
"; 79 | 80 | // kill the PDO 81 | $pdo = NULL; 82 | 83 | echo "deleting installation files
"; 84 | 85 | if (unlink('mysql.sql') == true) { 86 | echo "DELETED → mysql.sql
"; 87 | } 88 | else { 89 | echo "FAILED → mysql.sql
"; 90 | } 91 | 92 | if (unlink('pgsql.sql') == true) { 93 | echo "DELETED → pgsql.sql
"; 94 | } 95 | else { 96 | echo "FAILED → pgsql.sql
"; 97 | } 98 | 99 | if (unlink(__FILE__) == true) { 100 | echo "DELETED → install.php
"; 101 | } 102 | else { 103 | echo "FAILED → install.php
"; 104 | } 105 | ?> 106 | -------------------------------------------------------------------------------- /mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE VIEW IF NOT EXISTS report_stats AS ( 2 | SELECT 3 | report.serial, domain, rcount, disposition, reason, 4 | policy_p, policy_pct, dkimdomain, dkimresult, dkim_align, 5 | spfdomain, spfresult, spf_align, mindate, maxdate 6 | FROM report RIGHT JOIN rptrecord 7 | ON report.serial=rptrecord.serial 8 | ); 9 | -------------------------------------------------------------------------------- /pgsql.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE VIEW report_stats AS ( 2 | SELECT 3 | report.serial, domain, rcount, disposition, reason, 4 | policy_p, policy_pct, dkimdomain, dkimresult, dkim_align, 5 | spfdomain, spfresult, spf_align, mindate, maxdate 6 | FROM report RIGHT JOIN rptrecord 7 | ON report.serial=rptrecord.serial 8 | ); 9 | -------------------------------------------------------------------------------- /templates/openda/codebase_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/userjack6880/Open-DMARC-Analyzer/0ac3d054617c4192bc233da1301bb5b1e7068aa0/templates/openda/codebase_logo.png -------------------------------------------------------------------------------- /templates/openda/footer.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | ?> 31 | 32 |
33 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /templates/openda/header.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | ?> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 51 | 52 | 55 | <?php page_title($page, $domain); ?> 56 | 57 | 58 | 61 | 62 |
63 | 64 | -------------------------------------------------------------------------------- /templates/openda/index.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // Header 31 | function page_header ($page, $domain, $dateRange, $ip) { include_once("header.php"); } 32 | 33 | // Footer 34 | function page_footer () { include_once("footer.php"); } 35 | 36 | ?> 37 | -------------------------------------------------------------------------------- /templates/openda/style.css: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | 3 | Open DMARC Analyzer - Open Source DMARC Analyzer 4 | Copyright (C) 2023 - John Bradley (userjack6880) 5 | 6 | templates/openda/style.css 7 | CSS file for the Open DMARC Analyzer default template 8 | 9 | Available at: https://github.com/userjack6880/Open-DMARC-Analyzer 10 | 11 | ------------------------------------------------------------------------------- 12 | 13 | This file is part of Open DMARC Analyzer. 14 | 15 | Open DMARC Analyzer is free software: you can redistribute it and/or modify it under 16 | the terms of the GNU General Public License as published by the Free Software 17 | Foundation, either version 3 of the License, or (at your option) any later 18 | version. 19 | 20 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 22 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License along with 25 | this program. If not, see . 26 | 27 | ---------------------------------------------------------------------------- */ 28 | 29 | * { 30 | -moz-box-sizing: border-box; 31 | -webkit-box-sizing: border-box; 32 | box-sizing: border-box; 33 | margin: 0; 34 | padding: 0; 35 | } 36 | 37 | body { 38 | -webkit-font-smoothing: antialiased; 39 | font-smooth: antialiased; 40 | text-align: left; 41 | font-family: Sans-serif; 42 | background-color: #101118; 43 | color: #738290; 44 | } 45 | 46 | a:link { 47 | text-decoration: none; 48 | color: #ABB4BC; 49 | } 50 | 51 | a:visited { 52 | text-decoration: none; 53 | color: #ABB4BC; 54 | } 55 | 56 | a:active { 57 | text-decoration: none; 58 | color: #FFF; 59 | } 60 | 61 | a:hover { 62 | text-decoration: none; 63 | color: #FFF; 64 | } 65 | 66 | #header { 67 | width: 100%; 68 | max-width: 1920px; 69 | margin: 0px auto 0px auto; 70 | padding: 15px; 71 | border: none; 72 | text-align: left; 73 | } 74 | 75 | #controlbar { 76 | width: 100%; 77 | max-width: 1920px; 78 | height: 100px; 79 | margin: 0px auto 0px auto; 80 | padding: 15px; 81 | border: none; 82 | text-align: left; 83 | } 84 | 85 | #controlbarleft { 86 | width: calc(100% - 600px); 87 | margin: 0px auto 0px auto; 88 | padding: 0 0 0 30px; 89 | border: none; 90 | text-align: left; 91 | float: left; 92 | } 93 | 94 | #controlbarright { 95 | width: 585px; 96 | margin: 0px auto 0px auto; 97 | padding: 0 30px 0 0; 98 | border: none; 99 | text-align: right; 100 | float: right; 101 | } 102 | 103 | .dov-bar { 104 | width: 100%; 105 | height: 100px; 106 | margin: 30px auto 0 auto; 107 | padding: 15px; 108 | border: none; 109 | } 110 | 111 | .dov-bar-in { 112 | background-color: #1c1e28; 113 | width: 100%; 114 | height: 100px; 115 | margin: 0 auto 0 auto; 116 | padding: 0; 117 | border: none; 118 | border-radius: 10px; 119 | position: relative; 120 | } 121 | 122 | .dov-bar-in-ip { 123 | width: 100%; 124 | height: 100px; 125 | padding: 0px 20px 0px 20px; 126 | position: relative; 127 | } 128 | 129 | .dov-bar-in-ip > div { 130 | text-align: center; 131 | float: left; 132 | padding: 0px 5px 0px 5px; 133 | position: absolute; 134 | top: 50%; 135 | transform: translateY(-50%); 136 | } 137 | 138 | .geo-left { 139 | width: 500px; 140 | height: 400px; 141 | margin: 0; 142 | padding: 0; 143 | border: none; 144 | text-align: left; 145 | float: left; 146 | position: relative; 147 | } 148 | 149 | .geo-left-inner { 150 | width: 100%; 151 | padding: 15px; 152 | position: absolute; 153 | top: 50%; 154 | transform: translateY(-50%); 155 | font-size: 18px; 156 | font-weight: bold; 157 | } 158 | 159 | .geo-right { 160 | width: calc(100% - 500px); 161 | height: 400px; 162 | margin: 0; 163 | padding: 15px; 164 | border: none; 165 | float: right; 166 | position: relative; 167 | } 168 | 169 | .report-left { 170 | width: 50%; 171 | height: 200px; 172 | margin: 0; 173 | padding: 0; 174 | border: none; 175 | text-align: right; 176 | float: left; 177 | position: relative; 178 | } 179 | 180 | .report-inner { 181 | width: 100%; 182 | padding: 15px; 183 | position: absolute; 184 | top: 50%; 185 | transform: translateY(-50%); 186 | font-size: 18px; 187 | } 188 | 189 | .report-right { 190 | width: 50%; 191 | height: 200px; 192 | margin: 0; 193 | padding: 0; 194 | border: none; 195 | text-align: left; 196 | float: right; 197 | position: relative; 198 | } 199 | 200 | span.dov-bar-small { 201 | font-size: 12px; 202 | } 203 | 204 | h3.dov-bar-in-ip-h3 { 205 | margin: 0; 206 | } 207 | 208 | .dov-bar-in-domain { 209 | width: calc(100% - 400px); 210 | min-width: 600px; 211 | height: 50px; 212 | padding: 10px 10px 10px 20px; 213 | float: left; 214 | } 215 | 216 | .dov-bar-in-dstats-totals { 217 | width: calc(100% - 400px); 218 | min-width: 600px; 219 | height: 50px; 220 | padding: 5px 10px 5px 20px; 221 | float: left; 222 | } 223 | 224 | table.dov { 225 | border: 0; 226 | min-width: 100%; 227 | text-align: left; 228 | } 229 | 230 | tr.dov { 231 | border: 0; 232 | } 233 | 234 | td.dov { 235 | border: 0; 236 | width: 25%; 237 | font-size: 14px; 238 | } 239 | 240 | .dov-bar-in-dstats-alignment { 241 | width: 400px; 242 | height: 100px; 243 | padding: 3px 20px 5px 10px; 244 | float: right; 245 | } 246 | 247 | #overviewbar { 248 | width: 100%; 249 | height: 300px; 250 | margin: 0px auto 0px auto; 251 | padding: 15px; 252 | border: none; 253 | } 254 | 255 | #overviewbarleft { 256 | background-color: #1c1e28; 257 | width: calc(100% - 430px); 258 | min-width: 600px; 259 | height: 300px; 260 | margin: 0px auto 0px auto; 261 | padding: 0; 262 | border: none; 263 | border-radius: 10px; 264 | float: left; 265 | position: relative; 266 | } 267 | 268 | #overviewbarright { 269 | background-color: #1c1e28; 270 | width: 400px; 271 | height: 300px; 272 | margin: 0px auto 0px auto; 273 | padding: 40px; 274 | border: none; 275 | border-radius: 10px; 276 | float: right; 277 | position: relative; 278 | } 279 | 280 | #ovbr-in { 281 | position: absolute; 282 | width: 320px; 283 | margin: 0 auto 0 auto; 284 | top: 50%; 285 | transform: translateY(-50%); 286 | text-align: center; 287 | font-weight: bold; 288 | } 289 | 290 | #overviewinnerleft { 291 | width: calc(100% - 500px); 292 | min-width: 100px; 293 | margin: 0px; 294 | padding: 0 10px 0 0; 295 | border: none; 296 | text-align: center; 297 | float: left; 298 | position: absolute; 299 | top: 50%; 300 | transform: translateY(-50%); 301 | font-weight: bold; 302 | } 303 | 304 | #overviewinnerright { 305 | width: 500px; 306 | margin: 0px; 307 | padding: 0 40px 0 20px; 308 | border: none; 309 | float: right; 310 | position: absolute; 311 | top: 50%; 312 | right: 0; 313 | transform: translateY(-50%); 314 | font-size: 24px; 315 | font-weight: bold; 316 | } 317 | 318 | .ovir-left { 319 | width: 50%; 320 | margin: 0; 321 | padding: 0; 322 | text-align: left; 323 | float: left; 324 | } 325 | 326 | .ovir-right { 327 | width: 50%; 328 | margin: 0; 329 | padding: 0; 330 | text-align: right; 331 | float: right; 332 | } 333 | 334 | .overviewtotal { 335 | font-size: 72px; 336 | } 337 | 338 | select { 339 | width: 400px; 340 | margin: 10px; 341 | padding: 5px 10px 5px 10px; 342 | line-height: 24px; 343 | font-size: 15px; 344 | border: 1px solid #bbb; 345 | } 346 | 347 | h1.dov-bar-head { 348 | font-size: 24px; 349 | color: #738290; 350 | margin: 0; 351 | } 352 | 353 | h1.header { 354 | font-size: 48px; 355 | color: #738290; 356 | } 357 | 358 | #wrapper { 359 | width: 100%; 360 | max-width: 1920px; 361 | margin: 0 auto 0 auto; 362 | padding: 15px; 363 | } 364 | 365 | h2 { 366 | font-size: 24px; 367 | color: #738290; 368 | margin: 0 0 10px 0; 369 | } 370 | 371 | h2.section { 372 | font-size: 24px; 373 | color: #738290; 374 | margin: 30px 0px -25px 25px; 375 | } 376 | 377 | 378 | h3 { 379 | font-size: 20px; 380 | color: #738290; 381 | margin: 10px 0 10px 0; 382 | } 383 | 384 | .centered { 385 | margin: 0px auto 0px auto; 386 | } 387 | 388 | table { 389 | border-collapse: collapse; 390 | border-radius: 15px; 391 | width: 95%; 392 | text-align: center; 393 | } 394 | 395 | table, th, td { 396 | border: 1px solid #2A3035; 397 | } 398 | 399 | th, td { 400 | padding: 0; 401 | } 402 | 403 | td { 404 | font-size: 12px; 405 | } 406 | 407 | /* tr:nth-child(1) { */ 408 | thead { 409 | background-color: #2A3035; 410 | color: #FFF; 411 | } 412 | 413 | span.pass { 414 | color: #708D81; 415 | } 416 | 417 | span.fail { 418 | color: #EB5160; 419 | } 420 | 421 | span.warn { 422 | color: #F1B077; 423 | } 424 | 425 | span.temperror { 426 | color: #F1B077; 427 | } 428 | 429 | span.unknown { 430 | color: #2A3035; 431 | } 432 | 433 | #footer { 434 | width: 100%; 435 | max-width: 1920px; 436 | margin: 0px auto 0px auto; 437 | padding: 15px; 438 | font-size: 10px; 439 | } 440 | 441 | .perc-bar { 442 | background-color: #EB5160; 443 | border-radius: 3px; 444 | display: block; 445 | width: 100%; 446 | height: 10px; 447 | position: relative; 448 | } 449 | 450 | .gray-per { 451 | background-color: #8C98A4; 452 | border-radius: 3px; 453 | height: 10px; 454 | position: absolute; 455 | left: 0; 456 | } 457 | 458 | .green-per { 459 | background-color: #708D81; 460 | border-radius: 3px; 461 | height: 10px; 462 | position: absolute; 463 | left: 0; 464 | } 465 | 466 | .perc-text { 467 | color: #738290; 468 | width: 100%; 469 | text-align: center; 470 | position: relative; 471 | font-size: 10px; 472 | height: 20px; 473 | line-height: 20px; 474 | display: block; 475 | } 476 | 477 | .perc-title { 478 | display: inline-block; 479 | padding-bottom: 8px; 480 | } 481 | 482 | .perc-text > span { 483 | display: inline-block; 484 | vertical-align: middle; 485 | line-height: normal; 486 | } 487 | 488 | span.signed { 489 | color: #fff; 490 | } -------------------------------------------------------------------------------- /templates/openda_light/codebase_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/userjack6880/Open-DMARC-Analyzer/0ac3d054617c4192bc233da1301bb5b1e7068aa0/templates/openda_light/codebase_logo.png -------------------------------------------------------------------------------- /templates/openda_light/footer.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | ?> 31 | 32 |
33 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /templates/openda_light/header.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | ?> 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 51 | 52 | 55 | <?php page_title($page, $domain); ?> 56 | 57 | 58 | 61 | 62 |
63 | 64 | -------------------------------------------------------------------------------- /templates/openda_light/index.php: -------------------------------------------------------------------------------- 1 | . 27 | 28 | ---------------------------------------------------------------------------- */ 29 | 30 | // Header 31 | function page_header ($page, $domain, $dateRange, $ip) { include_once("header.php"); } 32 | 33 | // Footer 34 | function page_footer () { include_once("footer.php"); } 35 | 36 | ?> 37 | -------------------------------------------------------------------------------- /templates/openda_light/style.css: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | 3 | Open DMARC Analyzer - Open Source DMARC Analyzer 4 | Copyright (C) 2023 - John Bradley (userjack6880) 5 | 6 | templates/openda/style.css 7 | CSS file for the Open DMARC Analyzer default template 8 | 9 | Available at: https://github.com/userjack6880/Open-DMARC-Analyzer 10 | 11 | ------------------------------------------------------------------------------- 12 | 13 | This file is part of Open DMARC Analyzer. 14 | 15 | Open DMARC Analyzer is free software: you can redistribute it and/or modify it under 16 | the terms of the GNU General Public License as published by the Free Software 17 | Foundation, either version 3 of the License, or (at your option) any later 18 | version. 19 | 20 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 22 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License along with 25 | this program. If not, see . 26 | 27 | ---------------------------------------------------------------------------- */ 28 | 29 | * { 30 | -moz-box-sizing: border-box; 31 | -webkit-box-sizing: border-box; 32 | box-sizing: border-box; 33 | margin: 0; 34 | padding: 0; 35 | } 36 | 37 | body { 38 | -webkit-font-smoothing: antialiased; 39 | font-smooth: antialiased; 40 | text-align: left; 41 | font-family: Sans-serif; 42 | background-color: #d2d9e8; 43 | color: #1f1f1f; 44 | } 45 | 46 | a:link { 47 | text-decoration: none; 48 | color: #3b3b3b; 49 | } 50 | 51 | a:visited { 52 | text-decoration: none; 53 | color: #3b3b3b; 54 | } 55 | 56 | a:active { 57 | text-decoration: none; 58 | color: #6e6e6e; 59 | } 60 | 61 | a:hover { 62 | text-decoration: none; 63 | color: #6e6e6e; 64 | } 65 | 66 | #header { 67 | width: 100%; 68 | max-width: 1920px; 69 | margin: 0px auto 0px auto; 70 | padding: 15px; 71 | border: none; 72 | text-align: left; 73 | } 74 | 75 | #controlbar { 76 | width: 100%; 77 | max-width: 1920px; 78 | height: 100px; 79 | margin: 0px auto 0px auto; 80 | padding: 15px; 81 | border: none; 82 | text-align: left; 83 | } 84 | 85 | #controlbarleft { 86 | width: calc(100% - 600px); 87 | margin: 0px auto 0px auto; 88 | padding: 0 0 0 30px; 89 | border: none; 90 | text-align: left; 91 | float: left; 92 | } 93 | 94 | #controlbarright { 95 | width: 585px; 96 | margin: 0px auto 0px auto; 97 | padding: 0 30px 0 0; 98 | border: none; 99 | text-align: right; 100 | float: right; 101 | } 102 | 103 | .dov-bar { 104 | width: 100%; 105 | height: 100px; 106 | margin: 30px auto 0 auto; 107 | padding: 15px; 108 | border: none; 109 | } 110 | 111 | .dov-bar-in { 112 | background-color: #e5e9f2; 113 | width: 100%; 114 | height: 100px; 115 | margin: 0 auto 0 auto; 116 | padding: 0; 117 | border: none; 118 | border-radius: 10px; 119 | position: relative; 120 | } 121 | 122 | .dov-bar-in-ip { 123 | width: 100%; 124 | height: 100px; 125 | padding: 0px 20px 0px 20px; 126 | position: relative; 127 | } 128 | 129 | .dov-bar-in-ip > div { 130 | text-align: center; 131 | float: left; 132 | padding: 0px 5px 0px 5px; 133 | position: absolute; 134 | top: 50%; 135 | transform: translateY(-50%); 136 | } 137 | 138 | .geo-left { 139 | width: 500px; 140 | height: 400px; 141 | margin: 0; 142 | padding: 0; 143 | border: none; 144 | text-align: left; 145 | float: left; 146 | position: relative; 147 | } 148 | 149 | .geo-left-inner { 150 | width: 100%; 151 | padding: 15px; 152 | position: absolute; 153 | top: 50%; 154 | transform: translateY(-50%); 155 | font-size: 18px; 156 | font-weight: bold; 157 | } 158 | 159 | .geo-right { 160 | width: calc(100% - 500px); 161 | height: 400px; 162 | margin: 0; 163 | padding: 15px; 164 | border: none; 165 | float: right; 166 | position: relative; 167 | } 168 | 169 | .report-left { 170 | width: 50%; 171 | height: 200px; 172 | margin: 0; 173 | padding: 0; 174 | border: none; 175 | text-align: right; 176 | float: left; 177 | position: relative; 178 | } 179 | 180 | .report-inner { 181 | width: 100%; 182 | padding: 15px; 183 | position: absolute; 184 | top: 50%; 185 | transform: translateY(-50%); 186 | font-size: 18px; 187 | } 188 | 189 | .report-right { 190 | width: 50%; 191 | height: 200px; 192 | margin: 0; 193 | padding: 0; 194 | border: none; 195 | text-align: left; 196 | float: right; 197 | position: relative; 198 | } 199 | 200 | span.dov-bar-small { 201 | font-size: 12px; 202 | } 203 | 204 | h3.dov-bar-in-ip-h3 { 205 | margin: 0; 206 | } 207 | 208 | .dov-bar-in-domain { 209 | width: calc(100% - 400px); 210 | min-width: 600px; 211 | height: 50px; 212 | padding: 10px 10px 10px 20px; 213 | float: left; 214 | } 215 | 216 | .dov-bar-in-dstats-totals { 217 | width: calc(100% - 400px); 218 | min-width: 600px; 219 | height: 50px; 220 | padding: 5px 10px 5px 20px; 221 | float: left; 222 | } 223 | 224 | table.dov { 225 | border: 0; 226 | min-width: 100%; 227 | text-align: left; 228 | } 229 | 230 | tr.dov { 231 | border: 0; 232 | } 233 | 234 | td.dov { 235 | border: 0; 236 | width: 25%; 237 | font-size: 14px; 238 | } 239 | 240 | .dov-bar-in-dstats-alignment { 241 | width: 400px; 242 | height: 100px; 243 | padding: 3px 20px 5px 10px; 244 | float: right; 245 | } 246 | 247 | #overviewbar { 248 | width: 100%; 249 | height: 300px; 250 | margin: 0px auto 0px auto; 251 | padding: 15px; 252 | border: none; 253 | } 254 | 255 | #overviewbarleft { 256 | background-color: #e5e9f2; 257 | width: calc(100% - 430px); 258 | min-width: 600px; 259 | height: 300px; 260 | margin: 0px auto 0px auto; 261 | padding: 0; 262 | border: none; 263 | border-radius: 10px; 264 | float: left; 265 | position: relative; 266 | } 267 | 268 | #overviewbarright { 269 | background-color: #e5e9f2; 270 | width: 400px; 271 | height: 300px; 272 | margin: 0px auto 0px auto; 273 | padding: 40px; 274 | border: none; 275 | border-radius: 10px; 276 | float: right; 277 | position: relative; 278 | } 279 | 280 | #ovbr-in { 281 | position: absolute; 282 | width: 320px; 283 | margin: 0 auto 0 auto; 284 | top: 50%; 285 | transform: translateY(-50%); 286 | text-align: center; 287 | font-weight: bold; 288 | } 289 | 290 | #overviewinnerleft { 291 | width: calc(100% - 500px); 292 | min-width: 100px; 293 | margin: 0px; 294 | padding: 0 10px 0 0; 295 | border: none; 296 | text-align: center; 297 | float: left; 298 | position: absolute; 299 | top: 50%; 300 | transform: translateY(-50%); 301 | font-weight: bold; 302 | } 303 | 304 | #overviewinnerright { 305 | width: 500px; 306 | margin: 0px; 307 | padding: 0 40px 0 20px; 308 | border: none; 309 | float: right; 310 | position: absolute; 311 | top: 50%; 312 | right: 0; 313 | transform: translateY(-50%); 314 | font-size: 24px; 315 | font-weight: bold; 316 | } 317 | 318 | .ovir-left { 319 | width: 50%; 320 | margin: 0; 321 | padding: 0; 322 | text-align: left; 323 | float: left; 324 | } 325 | 326 | .ovir-right { 327 | width: 50%; 328 | margin: 0; 329 | padding: 0; 330 | text-align: right; 331 | float: right; 332 | } 333 | 334 | .overviewtotal { 335 | font-size: 72px; 336 | } 337 | 338 | select { 339 | width: 400px; 340 | margin: 10px; 341 | padding: 5px 10px 5px 10px; 342 | line-height: 24px; 343 | font-size: 15px; 344 | border: 1px solid #bbb; 345 | } 346 | 347 | h1.dov-bar-head { 348 | font-size: 24px; 349 | color: #1f1f1f; 350 | margin: 0; 351 | } 352 | 353 | h1.header { 354 | font-size: 48px; 355 | color: #1f1f1f; 356 | } 357 | 358 | #wrapper { 359 | width: 100%; 360 | max-width: 1920px; 361 | margin: 0 auto 0 auto; 362 | padding: 15px; 363 | } 364 | 365 | h2 { 366 | font-size: 24px; 367 | color: #1f1f1f; 368 | margin: 0 0 10px 0; 369 | } 370 | 371 | h2.section { 372 | font-size: 24px; 373 | color: #1f1f1f; 374 | margin: 30px 0px -25px 25px; 375 | } 376 | 377 | 378 | h3 { 379 | font-size: 20px; 380 | color: #1f1f1f; 381 | margin: 10px 0 10px 0; 382 | } 383 | 384 | .centered { 385 | margin: 0px auto 0px auto; 386 | } 387 | 388 | table { 389 | border-collapse: collapse; 390 | border-radius: 15px; 391 | width: 95%; 392 | text-align: center; 393 | } 394 | 395 | table, th, td { 396 | border: 1px solid #1f1f1f; 397 | } 398 | 399 | th, td { 400 | padding: 0; 401 | } 402 | 403 | td { 404 | font-size: 12px; 405 | } 406 | 407 | /* tr:nth-child(1) { */ 408 | thead { 409 | background-color: #1f1f1f; 410 | color: #FFF; 411 | } 412 | 413 | span.pass { 414 | color: #23845b; 415 | } 416 | 417 | span.fail { 418 | color: #EB5160; 419 | } 420 | 421 | span.warn { 422 | color: #F1B077; 423 | } 424 | 425 | span.temperror { 426 | color: #F1B077; 427 | } 428 | 429 | span.unknown { 430 | color: #2A3035; 431 | } 432 | 433 | #footer { 434 | width: 100%; 435 | max-width: 1920px; 436 | margin: 0px auto 0px auto; 437 | padding: 15px; 438 | font-size: 10px; 439 | } 440 | 441 | .perc-bar { 442 | background-color: #EB5160; 443 | border-radius: 3px; 444 | display: block; 445 | width: 100%; 446 | height: 10px; 447 | position: relative; 448 | } 449 | 450 | .gray-per { 451 | background-color: #8C98A4; 452 | border-radius: 3px; 453 | height: 10px; 454 | position: absolute; 455 | left: 0; 456 | } 457 | 458 | .green-per { 459 | background-color: #708D81; 460 | border-radius: 3px; 461 | height: 10px; 462 | position: absolute; 463 | left: 0; 464 | } 465 | 466 | .perc-text { 467 | color: #738290; 468 | width: 100%; 469 | text-align: center; 470 | position: relative; 471 | font-size: 10px; 472 | height: 20px; 473 | line-height: 20px; 474 | display: block; 475 | } 476 | 477 | .perc-title { 478 | display: inline-block; 479 | padding-bottom: 8px; 480 | } 481 | 482 | .perc-text > span { 483 | display: inline-block; 484 | vertical-align: middle; 485 | line-height: normal; 486 | } 487 | 488 | span.signed { 489 | color: #000; 490 | } --------------------------------------------------------------------------------