Skip to content

Commit

Permalink
fix PEP 257
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Tenreiro committed Jul 23, 2020
1 parent 05d79f3 commit 6d64f2f
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 64 deletions.
2 changes: 2 additions & 0 deletions opensquat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# -*- coding: utf-8 -*-
# Module: __init__.py
__VERSION__ = "version 1.91"
25 changes: 12 additions & 13 deletions opensquat/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
openSquat
# Module: app.py
"""openSquat
(c) CERT-MZ
Expand All @@ -18,8 +18,9 @@


class Domain:

"""The Domain class with handle all the functions related to
the domain verifications
the domain verifications.
To use:
Domain().main(keywords, confidence, domains)
Expand All @@ -40,6 +41,7 @@ class Domain:
"""

def __init__(self):
"""Initiator."""
self.URL = (
"https://raw.githubusercontent.com/CERT-MZ/projects"
"/master/Domain-squatting/"
Expand Down Expand Up @@ -90,15 +92,14 @@ def domain_contains(keyword, domain):
return False

def download(self):
"""Download the latest newly registered domains and save locally
"""Download the latest newly registered domains and save locally.
Args:
none
Return:
none
"""

if self.period == "day":
self.URL_file = "domain-names.txt"
elif self.period == "week":
Expand Down Expand Up @@ -152,7 +153,7 @@ def download(self):
return True

def set_filename(self, filename):
"""Method to set the filename
"""Method to set the filename.
Args:
keywords_filename
Expand All @@ -164,7 +165,7 @@ def set_filename(self, filename):
self.keywords_filename = filename

def set_searchPeriod(self, search_period):
"""Method to set the search_period
"""Method to set the search_period.
Args:
search_period
Expand All @@ -175,15 +176,14 @@ def set_searchPeriod(self, search_period):
self.period = search_period

def set_dns_provider(self, provider):
"""Method to set the search_period
"""Method to set the search_period.
Args:
dns provider
Return:
none
"""

if (provider == "cloudflare"):
self.dns_validation = True
self.dns_provider = "cloudflare"
Expand All @@ -195,7 +195,7 @@ def set_dns_provider(self, provider):
self.dns_provider = None

def print_info(self):
"""Method to print some configuration information
"""Method to print some configuration information.
Args:
none
Expand All @@ -211,15 +211,14 @@ def print_info(self):

def check_squatting(self):
"""Method that will compute all the similarity calculations between
the keywords and domain names
the keywords and domain names.
Args:
none
Return:
list_domains: list containing all the flagged domains
"""

f_key = open(self.keywords_filename, "r")
f_dom = open(self.domain_filename, "r")

Expand Down Expand Up @@ -488,7 +487,7 @@ def main(
dns_provider,
doppelganger_only=False,
):
"""Method to call the class functions
"""Method to call the class functions.
Args:
none
Expand Down
13 changes: 5 additions & 8 deletions opensquat/arg_parser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Module: arg_parser.py
"""
openSquat
"""openSquat
(c) CERT-MZ | Andre Tenreiro | [email protected]
Expand All @@ -16,7 +15,7 @@


def validate_period(search_period):
"""Validate period
"""Validate period.
Args:
period: string containing the searchable period, either day or week.
Expand All @@ -35,7 +34,7 @@ def validate_period(search_period):


def validate_type(file_type):
"""Validate file_type
"""Validate file_type.
Args:
file_type: string containing file type, can only be txt, json or csv.
Expand All @@ -54,8 +53,7 @@ def validate_type(file_type):


def validate_confidence(confidence_level):

"""Validate confidence_level
"""Validate confidence_level.
Args:
confidence_level: int containing confidence_level, can only be an int
Expand All @@ -76,15 +74,14 @@ def validate_confidence(confidence_level):


def get_args():
"""Parser main function
"""Parser main function.
Args:
none
Return:
args: returns arguments
"""

# Parser
parser = argparse.ArgumentParser(description="openSquat")
parser.add_argument(
Expand Down
14 changes: 12 additions & 2 deletions opensquat/ct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
""" Certificate transparency """
# -*- coding: utf-8 -*-
# Module: ct.py
"""openSquat
(c) CERT-MZ
* https://www.cert.mz
* https://github.com/atenreiro/opensquat
software licensed under GNU version 3
"""
import requests
from bs4 import BeautifulSoup, NavigableString

Expand All @@ -18,7 +28,7 @@ def __init__(


class CRTSH:
""" Class responsible for checking given domain for CT logs """
"""Class responsible for checking given domain for CT logs"""

URL = "https://crt.sh/"

Expand Down
9 changes: 4 additions & 5 deletions opensquat/dns_resolvers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Module: doh_resolver.py
"""
openSquat
# Module: dns_resolvers.py
"""openSquat
(c) CERT-MZ
Expand All @@ -25,6 +24,7 @@ class Quad9:
dns_resp: (string) DNS response
"""
def __init__(self):
"""initiator."""
self.resolver = "9.9.9.9"
self.dns_resp = None
self.domain = None
Expand All @@ -51,7 +51,6 @@ def dns_query(self):
self.dns_resp = "malicious"
else:
self.dns_resp = "NXDOMAIN"
pass
except dns.resolver.NoAnswer:
self.dns_resp = "NoAnswer"
pass
Expand All @@ -64,7 +63,7 @@ def dns_query(self):
return self.dns_resp

def main(self, domain):
"""main function that will call other functions
"""main function that will call other functions.
Args:
domain: the domain name (duh)
Expand Down
8 changes: 3 additions & 5 deletions opensquat/file_input.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Module: input.py
"""
openSquat
# Module: file_input.py
"""openSquat
(c) CERT-MZ
Expand Down Expand Up @@ -51,15 +50,14 @@ def count_domains(self):

def count_keywords(self):
"""Count number of keywords from the keyword file
the counter will ignore the chars "#", "\n" and " "
the counter will ignore the chars "#", "\n" and " ".
Args:
none
Return:
none
"""

if not os.path.isfile(self.keywords_filename):
print(
"[*] File",
Expand Down
24 changes: 12 additions & 12 deletions opensquat/homograph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Module: homograph.py
"""!
openSquat
"""openSquat
(c) CERT-MZ
Expand All @@ -13,13 +13,13 @@


def check_homograph(domain):
"""Check if domain contain homograph character
"""Check if domain contain homograph character.
Args:
none
Args:
none
Return:
none
Return:
none
"""
homograph_domain = bool(confusables.is_dangerous(domain))
Expand All @@ -31,13 +31,13 @@ def check_homograph(domain):


def homograph_to_latin(domain):
"""Convert homograph domain to LATIN characters
"""Convert homograph domain to LATIN characters.
Args:
none
Args:
none
Return:
none
Return:
none
"""
homoglyphs = hg.Homoglyphs(languages={"en"}, strategy=hg.STRATEGY_LOAD)
Expand Down
15 changes: 6 additions & 9 deletions opensquat/output.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Module: output.py
"""
openSquat
"""openSquat
(c) CERT-MZ
Expand All @@ -16,7 +15,7 @@


class SaveFile:
"""The SaveFile is responsible for the file saving operations
"""The SaveFile is responsible for the file saving operations.
To use:
Domain().main(keywords, confidence, domains)
Expand All @@ -35,8 +34,7 @@ def __init__(self):
self.content = []

def as_json(self):
"""
save to json
"""save to json.
Args:
none
Expand All @@ -50,8 +48,7 @@ def as_json(self):
print("[*] file saved:", self.filename)

def as_csv(self):
"""
save to csv
"""save to csv.
Args:
none
Expand All @@ -68,7 +65,7 @@ def as_csv(self):
print("[*] file saved:", self.filename)

def as_text(self):
"""save to plain text
"""save to plain text.
Args:
none
Expand All @@ -92,7 +89,7 @@ def set_filetype(self, file_type):
self.type = file_type

def main(self, file_name, file_type, file_content):
"""main function that will call other functions
"""main function that will call other functions.
Args:
file_name: file name (duh)
Expand Down
8 changes: 4 additions & 4 deletions opensquat/phishing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Module: phishing.py
"""
openSquat
"""openSquat
(c) CERT-MZ
Expand All @@ -18,7 +17,8 @@


class Phishing:
"""Class: Phishing

"""Class Phishing.
To use:
Phishing().main(keyword)
Expand Down Expand Up @@ -142,7 +142,7 @@ def update_db(self):
return True

def main(self, keywords):
"""main function that will call other functions
"""main function that will call other functions.
Args:
keyword: keyword to search for(duh)
Expand Down
Loading

0 comments on commit 6d64f2f

Please sign in to comment.