Skip to content

Commit 50ac0aa

Browse files
authored
Merge pull request #218 from aniqfakhrul/dev
Dev
2 parents 6705f3e + 4e27814 commit 50ac0aa

25 files changed

Lines changed: 735 additions & 749 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build
88
dist
99
powerview-venv
1010
venv
11+
.venv

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<p align="center">
77

8-
<img src="https://img.shields.io/badge/version-2025.1.7-blue" alt="version 2025.1.7"/>
8+
<img src="https://img.shields.io/badge/version-2025.1.8-blue" alt="version 2025.1.8"/>
99

1010
<a href="https://x.com/aniqfakhrul">
1111
<img src="https://img.shields.io/twitter/follow/aniqfakhrul?style=social"

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
pkgs = nixpkgs.legacyPackages.${system};
2020
powerview = pkgs.python3Packages.buildPythonApplication rec {
2121
pname = "powerview";
22-
version = "2025.1.7";
22+
version = "2025.1.8";
2323
format = "pyproject";
2424

2525
src = pkgs.fetchFromGitHub {

powerview/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22

33
__year__ = datetime.date.today().year
4-
__version__ = f"{__year__}.1.7"
4+
__version__ = f"{__year__}.1.8"
55
__author__ = [
66
"Aniq Fakhrul",
77
"Ali Radzali"

powerview/lib/efs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env python3
2+
from impacket.uuid import uuidtup_to_bin
3+
4+
EFS_UUID = uuidtup_to_bin(('df1941c5-fe89-4e79-bf10-463657acf44d', '1.0'))

powerview/lib/ldap3/extend/__init__.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ def _format_vulnerability(self, vuln_dict):
3131
"""Format a vulnerability dictionary as a string"""
3232
vuln_id = vuln_dict.get('id', 'VULN')
3333
description = vuln_dict.get('description', '')
34-
severity = vuln_dict.get('severity', '').upper()
35-
formatted = f"[{vuln_id}] {description} ({severity})"
34+
sev_colored = vuln_dict.get('severity_colored')
35+
if sev_colored:
36+
formatted = f"[{vuln_id}] {description} ({sev_colored})"
37+
else:
38+
severity = vuln_dict.get('severity', '').upper()
39+
formatted = f"[{vuln_id}] {description} ({severity})"
3640
if 'details' in vuln_dict:
3741
formatted += f" - {vuln_dict['details']}"
3842
return formatted
@@ -60,7 +64,6 @@ def paged_search(self,
6064
no_vuln_check = no_vuln_check or self.no_vuln_check
6165
raw = raw or self.raw
6266

63-
# Save the original formatter
6467
original_formatter = None
6568
if raw and self.server and hasattr(self.server, 'custom_formatter'):
6669
logging.debug("[CustomStandardExtendedOperations] Unsetting custom formatter")
@@ -73,18 +76,15 @@ def paged_search(self,
7376
if cached_results is not None:
7477
logging.debug("[CustomStandardExtendedOperations] Returning cached results for query")
7578

76-
# Mark results as coming from cache
7779
for entry in cached_results:
7880
if 'attributes' in entry:
7981
entry['from_cache'] = True
8082

81-
# Process vulnerabilities for all objects
8283
if not no_vuln_check:
8384
for entry in cached_results:
8485
if 'attributes' in entry:
8586
vulnerabilities = self.vulnerability_detector.detect_vulnerabilities(entry['attributes'])
8687
if vulnerabilities:
87-
# Convert dictionary vulnerabilities to formatted strings
8888
entry['attributes']['vulnerabilities'] = [self._format_vulnerability(v) for v in vulnerabilities]
8989

9090
return cached_results
@@ -131,7 +131,6 @@ def paged_search(self,
131131
if self.use_adws:
132132
results = list(adws_paged_search_generator(self._connection, modified_dn, modified_filter, search_scope, attributes, size_limit, time_limit, types_only, get_operational_attributes, controls, paged_size, paged_criticality))
133133
else:
134-
# Get all results first so we can post-process them
135134
results = list(paged_search_generator(self._connection,
136135
modified_dn,
137136
modified_filter,
@@ -146,29 +145,24 @@ def paged_search(self,
146145
paged_size,
147146
paged_criticality))
148147

149-
# Filter out non-search results
150148
filtered_results = []
151149
for entry in results:
152150
if entry['type'] != 'searchResEntry':
153151
continue
154152

155-
# Strip entries if requested
156153
if strip_entries:
157154
strip_entry(entry)
158155

159156
filtered_results.append(entry)
160157

161-
# Process vulnerabilities for all objects
162158
if not no_vuln_check:
163159
for entry in filtered_results:
164160
if 'attributes' in entry:
165161
vulnerabilities = self.vulnerability_detector.detect_vulnerabilities(entry['attributes'])
166162
if vulnerabilities:
167-
# Convert dictionary vulnerabilities to formatted strings
168163
entry['attributes']['vulnerabilities'] = [self._format_vulnerability(v) for v in vulnerabilities]
169164

170165
if not no_cache:
171-
# Remove from_cache attribute before caching if it exists
172166
for entry in filtered_results:
173167
if 'attributes' in entry and 'from_cache' in entry['attributes']:
174168
del entry['attributes']['from_cache']
@@ -208,37 +202,31 @@ def paged_search(self,
208202
paged_criticality
209203
))
210204

211-
# Filter out non-search results and strip entries if requested
212205
filtered_results = []
213206
for entry in results:
214207
if hasattr(entry, 'type') and entry['type'] != 'searchResEntry':
215208
continue
216209

217-
# Strip entries if requested
218210
if strip_entries:
219211
strip_entry(entry)
220212

221213
filtered_results.append(entry)
222214

223-
# Process vulnerabilities for all objects
224215
if not no_vuln_check:
225216
for entry in filtered_results:
226217
if 'attributes' in entry:
227218
vulnerabilities = self.vulnerability_detector.detect_vulnerabilities(entry['attributes'])
228219
if vulnerabilities:
229-
# Convert dictionary vulnerabilities to formatted strings
230220
entry['attributes']['vulnerabilities'] = [self._format_vulnerability(v) for v in vulnerabilities]
231221

232222
if not no_cache:
233-
# Remove from_cache attribute before caching if it exists
234223
for entry in filtered_results:
235224
if 'attributes' in entry and 'from_cache' in entry['attributes']:
236225
del entry['attributes']['from_cache']
237226

238227
self.storage.cache_results(search_base, search_filter, search_scope, attributes, host=self.server.host, results=filtered_results, raw=raw)
239228
return filtered_results
240229
finally:
241-
# Restore the original formatter
242230
if raw and original_formatter is not None and self.server:
243231
self.server.custom_formatter = original_formatter
244232

powerview/lib/resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def human_readable_time_diff(past_date):
226226
elif diff.days > 0:
227227
return f"{diff.days} day{'s' if diff.days > 1 else ''} ago"
228228
else:
229-
return "today"
229+
return f"today"
230230

231231
@staticmethod
232232
def resolve_generalized_time(ldap_time):

0 commit comments

Comments
 (0)