opensquat 2.2.2__tar.gz → 2.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {opensquat-2.2.2 → opensquat-2.2.3}/PKG-INFO +1 -1
  2. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/__init__.py +1 -1
  3. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/app.py +7 -4
  4. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/cli.py +12 -2
  5. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/file_input.py +4 -8
  6. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/output.py +4 -5
  7. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/phishing.py +2 -2
  8. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/vt.py +1 -1
  9. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat.egg-info/PKG-INFO +1 -1
  10. {opensquat-2.2.2 → opensquat-2.2.3}/pyproject.toml +1 -1
  11. {opensquat-2.2.2 → opensquat-2.2.3}/LICENSE +0 -0
  12. {opensquat-2.2.2 → opensquat-2.2.3}/README.md +0 -0
  13. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/arg_parser.py +0 -0
  14. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/check_update.py +0 -0
  15. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/ct.py +0 -0
  16. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/dns_resolvers.py +0 -0
  17. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/dns_validator.py +0 -0
  18. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/feed_manager.py +0 -0
  19. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/homograph.py +0 -0
  20. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/port_check.py +0 -0
  21. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/squatting_detector.py +0 -0
  22. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat/validations.py +0 -0
  23. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat.egg-info/SOURCES.txt +0 -0
  24. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat.egg-info/dependency_links.txt +0 -0
  25. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat.egg-info/entry_points.txt +0 -0
  26. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat.egg-info/requires.txt +0 -0
  27. {opensquat-2.2.2 → opensquat-2.2.3}/opensquat.egg-info/top_level.txt +0 -0
  28. {opensquat-2.2.2 → opensquat-2.2.3}/setup.cfg +0 -0
  29. {opensquat-2.2.2 → opensquat-2.2.3}/tests/test_ct.py +0 -0
  30. {opensquat-2.2.2 → opensquat-2.2.3}/tests/test_validations.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensquat
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: openSquat - Detection of domain squatting, typosquatting, IDN homograph attacks, and phishing threats
5
5
  Author-email: Andre Tenreiro <andre@opensquat.com>
6
6
  License-Expression: GPL-3.0-only
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Module: __init__.py
3
3
  """openSquat Version."""
4
- __VERSION__ = "2.2.2"
4
+ __VERSION__ = "2.2.3"
@@ -32,6 +32,7 @@ class Domain:
32
32
  self.domain_total = 0
33
33
  self.keywords_total = 0
34
34
  self.list_domains = []
35
+ self.keyword_domains = {}
35
36
  self.confidence_level = 2
36
37
  self.doppelganger_only = False
37
38
 
@@ -52,7 +53,7 @@ class Domain:
52
53
  """
53
54
  Method to read domain files
54
55
  """
55
- with open(self.domain_filename, mode='r') as file_domains:
56
+ with open(self.domain_filename, mode='r', encoding='utf-8') as file_domains:
56
57
  for mydomains in file_domains:
57
58
  domain = mydomains.replace("\n", "")
58
59
  domain = domain.lower().strip()
@@ -60,7 +61,7 @@ class Domain:
60
61
  if domain and not domain.startswith("#"):
61
62
  self.list_file_domains.append(domain)
62
63
 
63
- with open(self.keywords_filename, mode='r') as file_keywords:
64
+ with open(self.keywords_filename, mode='r', encoding='utf-8') as file_keywords:
64
65
  for line in file_keywords:
65
66
  line = line.strip()
66
67
  if line and not line.startswith("#"):
@@ -101,7 +102,7 @@ class Domain:
101
102
  )
102
103
 
103
104
  result_domains = detector.check(keyword, domains_list, result_buffer)
104
- return result_buffer, result_domains
105
+ return result_buffer, keyword, result_domains
105
106
 
106
107
  def worker(self):
107
108
  """
@@ -119,9 +120,11 @@ class Domain:
119
120
  futs = [executor.submit(worker_func, k_info) for k_info in keyword_infos]
120
121
 
121
122
  for fut in futs:
122
- result_buffer, result_domains = fut.result()
123
+ result_buffer, keyword, result_domains = fut.result()
123
124
  print(result_buffer.getvalue())
124
125
  self.list_domains.extend(result_domains)
126
+ if result_domains:
127
+ self.keyword_domains[keyword] = result_domains
125
128
 
126
129
  return self.list_domains
127
130
 
@@ -55,7 +55,8 @@ def main():
55
55
 
56
56
  start_time_squatting = time.time()
57
57
 
58
- file_content = app.Domain().main(
58
+ domain_scanner = app.Domain()
59
+ file_content = domain_scanner.main(
59
60
  args.keywords,
60
61
  args.confidence,
61
62
  args.domains,
@@ -144,7 +145,16 @@ def main():
144
145
  file_content = list_aux
145
146
  print("[*] Total found:", len(file_content))
146
147
 
147
- output.SaveFile().main(args.output, args.type, file_content)
148
+ if args.type == "json":
149
+ filtered_set = set(file_content)
150
+ json_content = []
151
+ for kw, doms in domain_scanner.keyword_domains.items():
152
+ filtered_doms = [d for d in doms if d in filtered_set]
153
+ if filtered_doms:
154
+ json_content.append({"keyword": kw, "domains": filtered_doms})
155
+ output.SaveFile().main(args.output, args.type, json_content)
156
+ else:
157
+ output.SaveFile().main(args.output, args.type, file_content)
148
158
  end_time_squatting = round(time.time() - start_time_squatting, 2)
149
159
 
150
160
  # Print summary
@@ -44,7 +44,7 @@ class InputFile:
44
44
  )
45
45
  exit(-1)
46
46
 
47
- with open(self.domain_filename, mode='r') as fd_input:
47
+ with open(self.domain_filename, mode='r', encoding='utf-8') as fd_input:
48
48
  for line in fd_input:
49
49
  line = line.strip()
50
50
  # Skip comments and empty lines
@@ -72,14 +72,10 @@ class InputFile:
72
72
  )
73
73
  exit(-1)
74
74
 
75
- with open(self.keywords_filename, mode='r') as fd_input:
75
+ with open(self.keywords_filename, mode='r', encoding='utf-8') as fd_input:
76
76
  for line in fd_input:
77
- if (
78
- (line[0] != "#") and
79
- (line[0] != " ") and
80
- (line[0] != "") and
81
- (line[0] != "\n")
82
- ):
77
+ line = line.strip()
78
+ if line and not line.startswith("#"):
83
79
  self.keywords_total += 1
84
80
 
85
81
  return self.keywords_total
@@ -45,9 +45,8 @@ class SaveFile:
45
45
  Return
46
46
  none
47
47
  """
48
- with open(self.filename, "w") as f_json:
49
- json.dump(self.content, f_json)
50
- f_json.close()
48
+ with open(self.filename, "w", encoding='utf-8') as f_json:
49
+ json.dump(self.content, f_json, indent=2, ensure_ascii=False)
51
50
 
52
51
  def as_csv(self):
53
52
  """
@@ -59,7 +58,7 @@ class SaveFile:
59
58
  Return
60
59
  none
61
60
  """
62
- with open(self.filename, "w") as f_csv:
61
+ with open(self.filename, "w", encoding='utf-8') as f_csv:
63
62
  file_csv = csv.writer(
64
63
  f_csv, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
65
64
  )
@@ -76,7 +75,7 @@ class SaveFile:
76
75
  Return
77
76
  none
78
77
  """
79
- with open(self.filename, "w") as f:
78
+ with open(self.filename, "w", encoding='utf-8') as f:
80
79
  for item in self.content:
81
80
  f.write(item + "\n")
82
81
  f.close()
@@ -58,7 +58,7 @@ class Phishing:
58
58
  i = 0
59
59
 
60
60
  # Open phishing DB
61
- with open(self.keywords_filename, mode='r') as f_key:
61
+ with open(self.keywords_filename, mode='r', encoding='utf-8') as f_key:
62
62
  for keyword in f_key:
63
63
  keyword = keyword.replace("\n", "")
64
64
  keyword = keyword.lower()
@@ -83,7 +83,7 @@ class Phishing:
83
83
  "]" + Style.RESET_ALL,
84
84
  )
85
85
 
86
- with open(self.phishing_filename, mode='r') as f_phishing:
86
+ with open(self.phishing_filename, mode='r', encoding='utf-8') as f_phishing:
87
87
  for site in f_phishing:
88
88
  phishing_site = site.lower()
89
89
  phishing_site = site.replace("\n", "")
@@ -40,7 +40,7 @@ class VirusTotal:
40
40
  )
41
41
  exit(-1)
42
42
 
43
- with open(self.api_key_file, mode='r') as file_vt:
43
+ with open(self.api_key_file, mode='r', encoding='utf-8') as file_vt:
44
44
  for line in file_vt:
45
45
  if (
46
46
  (line[0] != "#") and
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensquat
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: openSquat - Detection of domain squatting, typosquatting, IDN homograph attacks, and phishing threats
5
5
  Author-email: Andre Tenreiro <andre@opensquat.com>
6
6
  License-Expression: GPL-3.0-only
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "opensquat"
7
- version = "2.2.2"
7
+ version = "2.2.3"
8
8
  description = "openSquat - Detection of domain squatting, typosquatting, IDN homograph attacks, and phishing threats"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-only"
File without changes
File without changes
File without changes
File without changes
File without changes