mirror of
https://github.com/MattKeeley/Spoofy.git
synced 2026-02-03 13:33:24 +00:00
Merge pull request #30 from MattKeeley/29-logic-needs-updates
New Updates To Spoofy Logic
This commit is contained in:
129
LICENSE
129
LICENSE
@@ -1,116 +1,53 @@
|
||||
CC0 1.0 Universal
|
||||
Creative Commons Attribution-NonCommercial 4.0 International Public License
|
||||
|
||||
Statement of Purpose
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator and
|
||||
subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
Section 1 – Definitions.
|
||||
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for the
|
||||
purpose of contributing to a commons of creative, cultural and scientific
|
||||
works ("Commons") that the public can reliably and without fear of later
|
||||
claims of infringement build upon, modify, incorporate in other works, reuse
|
||||
and redistribute as freely as possible in any form whatsoever and for any
|
||||
purposes, including without limitation commercial purposes. These owners may
|
||||
contribute to the Commons to promote the ideal of a free culture and the
|
||||
further production of creative, cultural and scientific works, or to gain
|
||||
reputation or greater distribution for their Work in part through the use and
|
||||
efforts of others.
|
||||
b. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||
|
||||
For these and/or other purposes and motivations, and without any expectation
|
||||
of additional consideration or compensation, the person associating CC0 with a
|
||||
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
||||
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
||||
and publicly distribute the Work under its terms, with knowledge of his or her
|
||||
Copyright and Related Rights in the Work and the meaning and intended legal
|
||||
effect of CC0 on those rights.
|
||||
c. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not limited
|
||||
to, the following:
|
||||
d. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
||||
and translate a Work;
|
||||
e. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
||||
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
f. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
iii. publicity and privacy rights pertaining to a person's image or likeness
|
||||
depicted in a Work;
|
||||
g. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
||||
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
h. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
||||
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data in
|
||||
a Work;
|
||||
i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
||||
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation thereof,
|
||||
including any amended or successor version of such directive); and
|
||||
j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
||||
|
||||
vii. other similar, equivalent or corresponding rights throughout the world
|
||||
based on applicable law or treaty, and any national implementations thereof.
|
||||
Section 2 – Scope.
|
||||
a. License grant.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
||||
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
||||
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
||||
and Related Rights and associated claims and causes of action, whether now
|
||||
known or unknown (including existing as well as future claims and causes of
|
||||
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
||||
duration provided by applicable law or treaty (including future time
|
||||
extensions), (iii) in any current or future medium and for any number of
|
||||
copies, and (iv) for any purpose whatsoever, including without limitation
|
||||
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
||||
the Waiver for the benefit of each member of the public at large and to the
|
||||
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
||||
shall not be subject to revocation, rescission, cancellation, termination, or
|
||||
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
||||
by the public as contemplated by Affirmer's express Statement of Purpose.
|
||||
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason be
|
||||
judged legally invalid or ineffective under applicable law, then the Waiver
|
||||
shall be preserved to the maximum extent permitted taking into account
|
||||
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
||||
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
||||
non transferable, non sublicensable, non exclusive, irrevocable and
|
||||
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
||||
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
||||
provided by applicable law or treaty (including future time extensions), (iii)
|
||||
in any current or future medium and for any number of copies, and (iv) for any
|
||||
purpose whatsoever, including without limitation commercial, advertising or
|
||||
promotional purposes (the "License"). The License shall be deemed effective as
|
||||
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
||||
License for any reason be judged legally invalid or ineffective under
|
||||
applicable law, such partial invalidity or ineffectiveness shall not
|
||||
invalidate the remainder of the License, and in such case Affirmer hereby
|
||||
affirms that he or she will not (i) exercise any of his or her remaining
|
||||
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
||||
and causes of action with respect to the Work, in either case contrary to
|
||||
Affirmer's express Statement of Purpose.
|
||||
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
Term. The term of this Public License is specified in Section 6(a).
|
||||
|
||||
b. Affirmer offers the Work as-is and makes no representations or warranties
|
||||
of any kind concerning the Work, express, implied, statutory or otherwise,
|
||||
including without limitation warranties of title, merchantability, fitness
|
||||
for a particular purpose, non infringement, or the absence of latent or
|
||||
other defects, accuracy, or the present or absence of errors, whether or not
|
||||
discoverable, all to the greatest extent permissible under applicable law.
|
||||
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
||||
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without limitation
|
||||
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
||||
disclaims responsibility for obtaining any necessary consents, permissions
|
||||
or other rights required for any use of the Work.
|
||||
Downstream recipients.
|
||||
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to this
|
||||
CC0 or use of the Work.
|
||||
A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
||||
|
||||
For more information, please see
|
||||
<http://creativecommons.org/publicdomain/zero/1.0/>
|
||||
B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
||||
|
||||
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
||||
|
||||
Patent and trademark rights are not licensed under this Public License.
|
||||
|
||||
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases, the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
|
||||
|
||||
6
MANIFEST.in
Normal file
6
MANIFEST.in
Normal file
@@ -0,0 +1,6 @@
|
||||
# Exclude the entire files directory
|
||||
exclude files/*
|
||||
|
||||
# Include essential files like README and LICENSE
|
||||
include LICENSE
|
||||
include README.md
|
||||
Binary file not shown.
@@ -40,116 +40,85 @@ class Spoofing:
|
||||
try:
|
||||
if self.pct and int(self.pct) != 100:
|
||||
return 3
|
||||
elif self.spf_record is None:
|
||||
if self.p is None:
|
||||
if self.spf_record is None:
|
||||
return 0 if self.p is None else 4 if self.p == "none" else 8
|
||||
if self.spf_dns_queries > 10 and self.p is None:
|
||||
return 0
|
||||
elif self.p == "none":
|
||||
return 4
|
||||
else:
|
||||
return 8
|
||||
elif self.spf_dns_queries > 10 and self.p is None:
|
||||
if self.spf_all == "2many":
|
||||
return 3 if self.p == "none" else 8
|
||||
if self.spf_all and self.p is None:
|
||||
return 0
|
||||
elif self.spf_all == "2many":
|
||||
if self.spf_all == "-all":
|
||||
if self.p == "none":
|
||||
return 3
|
||||
else:
|
||||
if self.sp == "none":
|
||||
if self.aspf in ["r", "s"]:
|
||||
return 1
|
||||
return 7
|
||||
if self.sp in ["quarantine", "reject"]:
|
||||
if self.aspf == "r":
|
||||
return 2
|
||||
if self.aspf == "s":
|
||||
return 8
|
||||
elif self.spf_all and self.p is None:
|
||||
return 0
|
||||
elif self.spf_all == "-all":
|
||||
if self.p and self.aspf and self.sp == "none":
|
||||
return 1
|
||||
elif self.aspf is None and self.sp == "none":
|
||||
return 1
|
||||
elif (
|
||||
self.p == "none"
|
||||
and (self.aspf == "r" or self.aspf is None)
|
||||
and self.sp is None
|
||||
):
|
||||
return 5
|
||||
return 4
|
||||
elif (
|
||||
self.p == "none"
|
||||
and self.aspf == "r"
|
||||
and (self.sp == "reject" or self.sp == "quarantine")
|
||||
):
|
||||
return 2
|
||||
elif (
|
||||
self.p == "none"
|
||||
and self.aspf is None
|
||||
and (self.sp == "reject" or self.sp == "quarantine")
|
||||
):
|
||||
return 5
|
||||
elif self.p == "none" and self.aspf is None and self.sp == "none":
|
||||
return 7
|
||||
else:
|
||||
if self.p in ["quarantine", "reject"]:
|
||||
if self.sp == "none":
|
||||
if self.aspf in [
|
||||
"r",
|
||||
"s",
|
||||
]:
|
||||
return 8
|
||||
elif self.spf_all == "~all":
|
||||
if self.p == "none" and self.sp == "reject" or self.sp == "quarantine":
|
||||
return 2
|
||||
elif self.p == "none" and self.sp is None:
|
||||
return 1
|
||||
return 8
|
||||
if self.spf_all == "?all":
|
||||
if not self.dmarc_record:
|
||||
return 0
|
||||
elif self.p == "none" and self.sp == "none":
|
||||
return 7
|
||||
elif (
|
||||
(self.p == "reject" or self.p == "quarantine")
|
||||
and self.aspf is None
|
||||
and self.sp == "none"
|
||||
):
|
||||
return 1
|
||||
elif (
|
||||
(self.p == "reject" or self.p == "quarantine")
|
||||
and self.aspf
|
||||
and self.sp == "none"
|
||||
):
|
||||
return 1
|
||||
else:
|
||||
if self.p == "none" and self.aspf == "r":
|
||||
return 0
|
||||
if self.p == "none" and self.sp == "none" and self.aspf in ["r", "s"]:
|
||||
return 4
|
||||
if self.p == "none" and self.sp in ["quarantine", "reject"]:
|
||||
return 5
|
||||
return 8
|
||||
elif self.spf_all == "?all":
|
||||
if self.spf_all == "+all":
|
||||
return 4
|
||||
if self.spf_all == "~all":
|
||||
if self.p == "none":
|
||||
if self.sp == "none":
|
||||
return 7 if self.aspf in ["r", "s"] else 0
|
||||
if self.sp in ["quarantine", "reject"]:
|
||||
return 2
|
||||
return 2 if self.aspf in ["r", "s"] else 8
|
||||
|
||||
if self.p in ["quarantine", "reject"]:
|
||||
if self.sp == "none":
|
||||
return 8 if self.aspf in ["r", "s"] else 1
|
||||
return 8
|
||||
if not self.spf_all:
|
||||
if not self.dmarc_record:
|
||||
return 0
|
||||
if (
|
||||
(self.p == "reject" or self.p == "quarantine")
|
||||
and self.aspf
|
||||
self.p in ["quarantine", "reject"]
|
||||
and self.sp == "none"
|
||||
and self.aspf in ["r", "s"]
|
||||
):
|
||||
return 6
|
||||
elif (
|
||||
(self.p == "reject" or self.p == "quarantine")
|
||||
and self.aspf is None
|
||||
and self.sp == "none"
|
||||
):
|
||||
return 6
|
||||
elif self.p == "none" and self.aspf == "r" and self.sp is None:
|
||||
return 0
|
||||
elif self.p == "none" and self.aspf == "r" and self.sp == "none":
|
||||
return 7
|
||||
elif (
|
||||
self.p == "none" and self.aspf == "s" or None and self.sp == "none"
|
||||
):
|
||||
return 7
|
||||
elif self.p == "none" and self.aspf == "s" or None and self.sp is None:
|
||||
return 6
|
||||
elif (
|
||||
self.p == "none"
|
||||
and self.aspf
|
||||
and (self.sp == "reject" or self.sp == "quarantine")
|
||||
):
|
||||
return 5
|
||||
elif self.p == "none" and self.aspf is None and self.sp == "reject":
|
||||
return 5
|
||||
else:
|
||||
return 1
|
||||
if self.p == "none" and self.sp in ["none", "quarantine", "reject"]:
|
||||
return 4 if self.aspf == "s" else 5
|
||||
return 8
|
||||
else:
|
||||
if not self.spf_record:
|
||||
if not self.dmarc_record:
|
||||
return 0
|
||||
if self.p == "none" and self.sp == "none" and self.aspf in ["r", "s"]:
|
||||
return 2
|
||||
return 4 if self.p == "none" else 8
|
||||
return 8
|
||||
except Exception:
|
||||
# If you are here, this means you caught a domain with a syntax error!
|
||||
spf_valid = validate_record_syntax(self.spf_record, "SPF")
|
||||
dmarc_valid = validate_record_syntax(self.dmarc_record, "DMARC")
|
||||
|
||||
if (not spf_valid and not dmarc_valid) or (spf_valid and not dmarc_valid):
|
||||
return 0
|
||||
elif not spf_valid and dmarc_valid and self.p == "none":
|
||||
return 3
|
||||
else:
|
||||
return 8
|
||||
return 3 if not spf_valid and dmarc_valid and self.p == "none" else 8
|
||||
|
||||
def evaluate_spoofing(self):
|
||||
"""Evaluates and returns whether spoofing is possible and the type of spoofing."""
|
||||
@@ -159,7 +128,7 @@ class Spoofing:
|
||||
2: f"Organizational domain spoofing possible for {self.domain}.",
|
||||
3: f"Spoofing might be possible for {self.domain}.",
|
||||
4: f"Spoofing might be possible (Mailbox dependent) for {self.domain}.",
|
||||
5: f"Organizational domain spoofing might be possible for {self.domain}.",
|
||||
5: f"Organizational domain spoofing might be possible (Mailbox dependent) for {self.domain}.",
|
||||
6: f"Subdomain spoofing might be possible (Mailbox dependent) for {self.domain}.",
|
||||
7: f"Subdomain spoofing is possible and organizational domain spoofing might be possible for {self.domain}.",
|
||||
8: f"Spoofing is not possible for {self.domain}.",
|
||||
|
||||
434
test.py
434
test.py
@@ -3,132 +3,426 @@ from modules.spoofing import Spoofing
|
||||
|
||||
|
||||
class TestSpoofy(unittest.TestCase):
|
||||
def test_spoofing_is_possible(self):
|
||||
def test_case_0(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_0.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
p="none",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 include:fake.gov",
|
||||
spf_all="~all",
|
||||
spf_dns_queries=3,
|
||||
domain="test_case_0.com",
|
||||
dmarc_record="No DMARC",
|
||||
p=None,
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 0)
|
||||
|
||||
def test_subdomain_spoofing(self):
|
||||
def test_case_1(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_1.com",
|
||||
dmarc_record="v=DMARC1; p=reject;",
|
||||
domain="test_case_1.com",
|
||||
dmarc_record="p=none, sp=none, aspf=r",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 include:fakest.domain.com",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=3,
|
||||
spf_dns_queries=0,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 1)
|
||||
|
||||
def test_organizational_domain_spoofing(self):
|
||||
def test_case_2(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_2.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
domain="test_case_2.com",
|
||||
dmarc_record="p=none, sp=quarantine, aspf=r",
|
||||
p="none",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 include:fakest.domain.com include:faker.domain.com",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=2,
|
||||
sp="reject",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 2)
|
||||
|
||||
def test_spoofing_might_be_possible(self):
|
||||
def test_case_3(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_3.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
domain="test_case_3.com",
|
||||
dmarc_record="p=none",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 include:fakest.domain.com",
|
||||
spf_all="~all",
|
||||
spf_dns_queries=1,
|
||||
sp="quarantine",
|
||||
pct=90,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 3)
|
||||
|
||||
def test_spoofing_might_be_possible_mbd(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_4.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 include:fakest.domain.com",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=1,
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 4)
|
||||
|
||||
def test_org_domain_spoofing_might_be_possible(self):
|
||||
def test_case_4(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_5.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
domain="test_case_4.com",
|
||||
dmarc_record="p=none",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 include:fakest.domain.com",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=1,
|
||||
sp="reject",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 4)
|
||||
|
||||
def test_case_5(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_5.com",
|
||||
dmarc_record="p=none, sp=quarantine",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 5)
|
||||
|
||||
def test_subdomain_spoofing_might_be_possible_mbd(self):
|
||||
def test_case_7(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_6.com",
|
||||
dmarc_record="v=DMARC1; p=reject;",
|
||||
p="reject",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 include:fakest.domain.com",
|
||||
spf_all="?all",
|
||||
spf_dns_queries=1,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 6)
|
||||
|
||||
def test_subdomain_spoofing_and_org_spoofing_might_be_possible(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_7.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
domain="test_case_7.com",
|
||||
dmarc_record="p=none, sp=none, aspf=r",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 include:fakest.domain.com",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 ~all",
|
||||
spf_all="~all",
|
||||
spf_dns_queries=3,
|
||||
spf_dns_queries=0,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 7)
|
||||
|
||||
def test_spoofing_not_possible(self):
|
||||
def test_case_8(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_8.com",
|
||||
dmarc_record="v=DMARC1; p=none;",
|
||||
domain="test_case_8.com",
|
||||
dmarc_record="p=none, sp=reject, aspf=s",
|
||||
p="none",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 include:domain.com",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=1,
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_9(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_9.com",
|
||||
dmarc_record="p=none",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 4)
|
||||
|
||||
def test_case_10(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_10.com",
|
||||
dmarc_record="p=none, aspf=r",
|
||||
p="none",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 4)
|
||||
|
||||
def test_case_11(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_11.com",
|
||||
dmarc_record="p=none, aspf=s",
|
||||
p="none",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 4)
|
||||
|
||||
def test_case_12(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_12.com",
|
||||
dmarc_record="p=none, sp=quarantine",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 5)
|
||||
|
||||
def test_case_13(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_13.com",
|
||||
dmarc_record="p=none, sp=reject",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 5)
|
||||
|
||||
def test_case_14(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_14.com",
|
||||
dmarc_record="p=none, sp=none",
|
||||
p="none",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 7)
|
||||
|
||||
def test_case_15(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_15.com",
|
||||
dmarc_record="p=quarantine",
|
||||
p="quarantine",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_16(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_16.com",
|
||||
dmarc_record="p=reject",
|
||||
p="reject",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp=None,
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_17(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_17.com",
|
||||
dmarc_record="p=quarantine, sp=quarantine",
|
||||
p="quarantine",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_18(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_18.com",
|
||||
dmarc_record="p=quarantine, sp=reject",
|
||||
p="quarantine",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_19(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_19.com",
|
||||
dmarc_record="p=reject, sp=quarantine",
|
||||
p="reject",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_20(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_20.com",
|
||||
dmarc_record="p=reject, sp=reject",
|
||||
p="reject",
|
||||
aspf=None,
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_21(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_21.com",
|
||||
dmarc_record="p=none, sp=quarantine, aspf=s",
|
||||
p="none",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_22(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_22.com",
|
||||
dmarc_record="p=none, sp=reject, aspf=s",
|
||||
p="none",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_23(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_23.com",
|
||||
dmarc_record="p=quarantine, sp=none, aspf=s",
|
||||
p="quarantine",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_24(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_24.com",
|
||||
dmarc_record="p=quarantine, sp=quarantine, aspf=r",
|
||||
p="quarantine",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_25(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_25.com",
|
||||
dmarc_record="p=reject, sp=reject, aspf=s",
|
||||
p="reject",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_26(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_26.com",
|
||||
dmarc_record="p=reject, sp=none, aspf=s",
|
||||
p="reject",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_27(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_27.com",
|
||||
dmarc_record="p=reject, sp=quarantine, aspf=r",
|
||||
p="reject",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_28(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_28.com",
|
||||
dmarc_record="p=reject, sp=quarantine, aspf=s",
|
||||
p="reject",
|
||||
aspf="s",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="quarantine",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_29(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_29.com",
|
||||
dmarc_record="p=reject, sp=reject, aspf=r",
|
||||
p="reject",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 -all",
|
||||
spf_all="-all",
|
||||
spf_dns_queries=0,
|
||||
sp="reject",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 8)
|
||||
|
||||
def test_case_30(self):
|
||||
spoofing = Spoofing(
|
||||
domain="test_case_30.com",
|
||||
dmarc_record="p=none, sp=none, aspf=r",
|
||||
p="none",
|
||||
aspf="r",
|
||||
spf_record="v=spf1 ?all",
|
||||
spf_all="?all",
|
||||
spf_dns_queries=0,
|
||||
sp="none",
|
||||
pct=100,
|
||||
)
|
||||
self.assertEqual(spoofing.spoofable, 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user