assemblyline-v4-service 4.4.0.31__py3-none-any.whl → 4.4.0.33__py3-none-any.whl

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.

Potentially problematic release.


This version of assemblyline-v4-service might be problematic. Click here for more details.

@@ -1 +1 @@
1
- 4.4.0.31
1
+ 4.4.0.33
@@ -30,6 +30,13 @@ PASSWORD_STRIP = [
30
30
  "이에요",
31
31
  ]
32
32
 
33
+ BRACKET_PAIRS = {
34
+ "<": ">",
35
+ "(": ")",
36
+ "[": "]",
37
+ "{": "}",
38
+ }
39
+
33
40
 
34
41
  def set_death_signal(sig=signal.SIGTERM):
35
42
  if 'linux' not in sys.platform:
@@ -66,18 +73,31 @@ class alarm_clock:
66
73
  signal.signal(signal.SIGALRM, self.alarm_default)
67
74
 
68
75
 
76
+ def __extract_passwords_from_lines(texts, password_word, password_regex):
77
+ all_passwords = set()
78
+ password_keyword = f"{password_word}:"
79
+ for line in texts:
80
+ if password_keyword in line.lower():
81
+ new_passwords = re.split(password_regex, line)
82
+ index = line.lower().rindex(password_keyword)
83
+ if index > 0 and line[index - 1] != " ":
84
+ special_char = line[index - 1]
85
+ if special_char in BRACKET_PAIRS:
86
+ special_char = BRACKET_PAIRS[special_char]
87
+ for password in list(new_passwords):
88
+ new_passwords.extend([password[:i] for i, ltr in enumerate(password) if ltr == special_char])
89
+ all_passwords.update(new_passwords)
90
+ return all_passwords
91
+
92
+
69
93
  def extract_passwords(text: str) -> set[str]:
70
94
  passwords: set[str] = set()
71
95
  text_split, text_split_n = set(text.split()), set(text.split("\n"))
72
96
  passwords.update(text_split)
73
97
  passwords.update(re.split(r"\W+", text))
74
98
  for i, r in enumerate(PASSWORD_REGEXES):
75
- for line in text_split:
76
- if PASSWORD_WORDS[i] in line.lower():
77
- passwords.update(re.split(r, line))
78
- for line in text_split_n:
79
- if PASSWORD_WORDS[i] in line.lower():
80
- passwords.update(re.split(r, line))
99
+ passwords.update(__extract_passwords_from_lines(text_split, PASSWORD_WORDS[i], r))
100
+ passwords.update(__extract_passwords_from_lines(text_split_n, PASSWORD_WORDS[i], r))
81
101
  for p in list(passwords):
82
102
  p = p.strip()
83
103
  # We can assume that at least one of the strip_char won't be there, to have the simple space stripping option
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: assemblyline-v4-service
3
- Version: 4.4.0.31
3
+ Version: 4.4.0.33
4
4
  Summary: Assemblyline 4 - Service base
5
5
  Home-page: https://github.com/CybercentreCanada/assemblyline-v4-service/
6
6
  Author: CCCS Assemblyline development team
@@ -1,4 +1,4 @@
1
- assemblyline_v4_service/VERSION,sha256=rLINnlqYAQ2MsS8ZVNxkzFVmHSWYH5oDWvn5BADPof0,9
1
+ assemblyline_v4_service/VERSION,sha256=lgrp1SniI-XfDnj1uOpVGXWCRKA4s-mEict_48tnJu4,9
2
2
  assemblyline_v4_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  assemblyline_v4_service/healthz.py,sha256=3QGBg0EZuXC6UN411HFwpLNEop9UvS9feFhvBUTP-k4,1576
4
4
  assemblyline_v4_service/run_privileged_service.py,sha256=9uTfHetXR5G-EDKMDrgfWUOw34yr64-cj6Cm9eZaCbQ,14547
@@ -12,7 +12,7 @@ assemblyline_v4_service/common/ontology_helper.py,sha256=Wao4VZ_YrlmLd3-CXwqsK6c
12
12
  assemblyline_v4_service/common/request.py,sha256=oe1Z7Y1UVER9PAsL6QmR-Ol-4hx3FqBypoxYrrI0kg4,9700
13
13
  assemblyline_v4_service/common/result.py,sha256=qOwyFP4zJMpngZWDIuc0bFN-tNjLuPP2RDOgkPNwEXI,30349
14
14
  assemblyline_v4_service/common/task.py,sha256=kZyjttJGXebynJ5JMgEOgsHhDZUzMTuqUk-eTnyw87U,12480
15
- assemblyline_v4_service/common/utils.py,sha256=8lkq-BLV2w-tv6hCGlCxUY-6khZKej4MiLxdpeRlXhM,2338
15
+ assemblyline_v4_service/common/utils.py,sha256=71ndFdbdfCeRCM-eYs1htKqJ-1miiWbsF_UgHnKKNZ4,3112
16
16
  assemblyline_v4_service/dev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  assemblyline_v4_service/dev/run_service_once.py,sha256=4gnb09WeKXlyWQKCQdH4SoL4xtfIRWq_9nyIiECrJ7g,10592
18
18
  assemblyline_v4_service/updater/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -21,8 +21,8 @@ assemblyline_v4_service/updater/app.py,sha256=OF-G7J8IYwTjdGw_BI9numBicZBN5lspm8
21
21
  assemblyline_v4_service/updater/gunicorn_config.py,sha256=p3j2KPBeD5jvMw9O5i7vAtlRgPSVVxIG9AO0DfN82J8,1247
22
22
  assemblyline_v4_service/updater/helper.py,sha256=odcgbEe9MtfqKZ6hAPRQGVkn8OEALyn2d7b29oxZ0Mw,9141
23
23
  assemblyline_v4_service/updater/updater.py,sha256=gTFNN8Xow1HnlUcftWG30-ULXK5_FfJynZBnf7i4aIQ,29528
24
- assemblyline_v4_service-4.4.0.31.dist-info/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
25
- assemblyline_v4_service-4.4.0.31.dist-info/METADATA,sha256=6kQM9Ts1l1a8b1oNMYR9j_l4tlUc57O5tV9eOZeycmc,9328
26
- assemblyline_v4_service-4.4.0.31.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
27
- assemblyline_v4_service-4.4.0.31.dist-info/top_level.txt,sha256=Ut5IqePObcxlJ8rv2--dOAzYbxzqlllfiV_51cbqjbA,24
28
- assemblyline_v4_service-4.4.0.31.dist-info/RECORD,,
24
+ assemblyline_v4_service-4.4.0.33.dist-info/LICENCE.md,sha256=NSkYo9EH8h5oOkzg4VhjAHF4339MqPP2cQ8msTPgl-c,1396
25
+ assemblyline_v4_service-4.4.0.33.dist-info/METADATA,sha256=Is5cL_GRzkvYr3AyZ8IoCb9qt2U7GmMkTUeDnkZ8xX8,9328
26
+ assemblyline_v4_service-4.4.0.33.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
27
+ assemblyline_v4_service-4.4.0.33.dist-info/top_level.txt,sha256=Ut5IqePObcxlJ8rv2--dOAzYbxzqlllfiV_51cbqjbA,24
28
+ assemblyline_v4_service-4.4.0.33.dist-info/RECORD,,