dissect.target 3.16.dev15__py3-none-any.whl → 3.16.dev17__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.
- dissect/target/helpers/cyber.py +46 -14
- dissect/target/loaders/cyber.py +7 -2
- dissect/target/plugins/apps/webserver/apache.py +5 -5
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/METADATA +1 -1
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/RECORD +10 -10
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/COPYRIGHT +0 -0
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/LICENSE +0 -0
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/WHEEL +0 -0
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/entry_points.txt +0 -0
- {dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/top_level.txt +0 -0
dissect/target/helpers/cyber.py
CHANGED
@@ -63,46 +63,48 @@ class Color(Enum):
|
|
63
63
|
|
64
64
|
|
65
65
|
class CyberIO(StringIO):
|
66
|
-
def __init__(self, color: Optional[Color] = None,
|
66
|
+
def __init__(self, color: Optional[Color] = None, run_at_end: bool = False, **kwargs):
|
67
67
|
self._color = color
|
68
|
-
self._mask_space = mask_space
|
69
68
|
self._run_at_end = run_at_end
|
69
|
+
self._kwargs = kwargs
|
70
70
|
super().__init__()
|
71
71
|
|
72
72
|
def write(self, s: str) -> int:
|
73
73
|
if self._run_at_end:
|
74
74
|
super().write(s)
|
75
75
|
else:
|
76
|
-
cyber_print(s, self._color, self.
|
76
|
+
cyber_print(s, self._color, **self._kwargs)
|
77
77
|
return len(s)
|
78
78
|
|
79
79
|
|
80
80
|
@contextmanager
|
81
|
-
def cyber(color: Optional[Color] = Color.YELLOW,
|
82
|
-
stream = CyberIO(color,
|
81
|
+
def cyber(color: Optional[Color] = Color.YELLOW, run_at_end: bool = False, **kwargs) -> Iterator[None]:
|
82
|
+
stream = CyberIO(color, run_at_end, **kwargs)
|
83
83
|
with redirect_stdout(stream):
|
84
84
|
yield
|
85
85
|
|
86
86
|
if run_at_end:
|
87
|
-
cyber_print(stream.getvalue(), color,
|
87
|
+
cyber_print(stream.getvalue(), color, **kwargs)
|
88
88
|
|
89
89
|
|
90
|
-
def cyber_print(buf: str, color: Optional[Color] = None,
|
90
|
+
def cyber_print(buf: str, color: Optional[Color] = None, **kwargs) -> None:
|
91
91
|
if not buf or buf == "\n":
|
92
92
|
sys.__stdout__.write(buf)
|
93
93
|
return
|
94
94
|
|
95
95
|
if not CAN_CYBER:
|
96
96
|
sys.__stdout__.write("you're not cybering hard enough\n")
|
97
|
+
sys.__stdout__.write(buf)
|
98
|
+
return
|
97
99
|
|
98
100
|
if os.getenv("CYBER") == "💊":
|
99
|
-
matrix(buf, color,
|
101
|
+
matrix(buf, color, **kwargs)
|
100
102
|
else:
|
101
|
-
nms(buf, color,
|
103
|
+
nms(buf, color, **kwargs)
|
102
104
|
|
103
105
|
|
104
106
|
# https://github.com/bartobri/libnms
|
105
|
-
def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False) -> None:
|
107
|
+
def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False, mask_indent: bool = True, **kwargs) -> None:
|
106
108
|
orig_row, orig_col = (0, 0)
|
107
109
|
with _set_terminal():
|
108
110
|
max_rows, max_cols = _get_win_size()
|
@@ -118,6 +120,7 @@ def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False) -> No
|
|
118
120
|
character_state = []
|
119
121
|
|
120
122
|
try:
|
123
|
+
is_indent = True
|
121
124
|
# Write initial mask
|
122
125
|
for char, has_ansi, end_ansi in characters:
|
123
126
|
# Initialize the character state with a mask and reveal time
|
@@ -129,7 +132,16 @@ def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False) -> No
|
|
129
132
|
mask = random.choice(NMS_MASK_TABLE)
|
130
133
|
character_state.append((char, mask, reveal_time, has_ansi))
|
131
134
|
|
132
|
-
if
|
135
|
+
if char != " ":
|
136
|
+
is_indent = False
|
137
|
+
|
138
|
+
if (
|
139
|
+
("\n" in char or "\r\n" in char)
|
140
|
+
or (not mask_space and char == " " and not is_indent and not mask_indent)
|
141
|
+
or (not mask_indent and is_indent)
|
142
|
+
):
|
143
|
+
if "\n" in char:
|
144
|
+
is_indent = True
|
133
145
|
sys.__stdout__.write(char)
|
134
146
|
continue
|
135
147
|
|
@@ -141,11 +153,21 @@ def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False) -> No
|
|
141
153
|
_clear_input()
|
142
154
|
time.sleep(1)
|
143
155
|
|
156
|
+
is_indent = True
|
144
157
|
for _ in range((NMS_JUMBLE_SECONDS * 1000) // NMS_JUMBLE_LOOP_SPEED):
|
145
158
|
_cursor_move(orig_row, orig_col)
|
146
159
|
|
147
160
|
for char, _, _, _ in character_state:
|
148
|
-
if
|
161
|
+
if char != " ":
|
162
|
+
is_indent = False
|
163
|
+
|
164
|
+
if (
|
165
|
+
("\n" in char or "\r\n" in char)
|
166
|
+
or (not mask_space and char == " ")
|
167
|
+
or (not mask_indent and is_indent)
|
168
|
+
):
|
169
|
+
if "\n" in char:
|
170
|
+
is_indent = True
|
149
171
|
sys.__stdout__.write(char)
|
150
172
|
continue
|
151
173
|
|
@@ -160,8 +182,18 @@ def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False) -> No
|
|
160
182
|
_cursor_move(orig_row, orig_col)
|
161
183
|
revealed = True
|
162
184
|
|
185
|
+
is_indent = True
|
163
186
|
for i, (char, mask, time_remaining, has_ansi) in enumerate(character_state):
|
164
|
-
if
|
187
|
+
if char != " ":
|
188
|
+
is_indent = False
|
189
|
+
|
190
|
+
if (
|
191
|
+
("\n" in char or "\r\n" in char)
|
192
|
+
or (not mask_space and char == " " and not is_indent and not mask_indent)
|
193
|
+
or (not mask_indent and is_indent)
|
194
|
+
):
|
195
|
+
if "\n" in char:
|
196
|
+
is_indent = True
|
165
197
|
sys.__stdout__.write(char)
|
166
198
|
continue
|
167
199
|
|
@@ -207,7 +239,7 @@ def nms(buf: str, color: Optional[Color] = None, mask_space: bool = False) -> No
|
|
207
239
|
|
208
240
|
|
209
241
|
# https://github.com/jsbueno/terminal_matrix
|
210
|
-
def matrix(buf: str, color: Optional[Color] = None,
|
242
|
+
def matrix(buf: str, color: Optional[Color] = None, **kwargs) -> None:
|
211
243
|
orig_row, orig_col = (0, 0)
|
212
244
|
with _set_terminal():
|
213
245
|
max_rows, max_cols = _get_win_size()
|
dissect/target/loaders/cyber.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import os
|
2
|
+
import textwrap
|
1
3
|
from pathlib import Path
|
2
4
|
|
3
5
|
from dissect.target import Target
|
@@ -30,8 +32,11 @@ class CyberLoader(Loader):
|
|
30
32
|
return False
|
31
33
|
|
32
34
|
def map(self, target: Target) -> None:
|
33
|
-
|
34
|
-
|
35
|
+
cols, _ = os.get_terminal_size()
|
36
|
+
width = HEADER.index("\n", 1)
|
37
|
+
header = textwrap.indent(HEADER, " " * ((cols - width) // 2))
|
38
|
+
with cyber(mask_space=True, mask_indent=False):
|
39
|
+
print(header)
|
35
40
|
|
36
41
|
target.props["cyber"] = True
|
37
42
|
return self._real.map(target)
|
@@ -158,16 +158,16 @@ class ApachePlugin(WebserverPlugin):
|
|
158
158
|
|
159
159
|
Apache has three default access log formats, which this plugin can all parse automatically. These are::
|
160
160
|
|
161
|
-
LogFormat "%v:%p %h %l %u %t
|
162
|
-
LogFormat "%h %l %u %t
|
163
|
-
LogFormat "%h %l %u %t
|
161
|
+
LogFormat "%v:%p %h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" vhost_combined
|
162
|
+
LogFormat "%h %l %u %t \\"%r\\" %>s %O \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined
|
163
|
+
LogFormat "%h %l %u %t \\"%r\\" %>s %O" common
|
164
164
|
|
165
165
|
For the definitions of each format string, see https://httpd.apache.org/docs/2.4/mod/mod_log_config.html#formats
|
166
166
|
|
167
167
|
For Apache, the error logs by default follow the following format::
|
168
168
|
|
169
|
-
ErrorLogFormat
|
170
|
-
"""
|
169
|
+
ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\\ %a] %M% ,\\ referer\\ %{Referer}i"
|
170
|
+
"""
|
171
171
|
|
172
172
|
__namespace__ = "apache"
|
173
173
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dissect.target
|
3
|
-
Version: 3.16.
|
3
|
+
Version: 3.16.dev17
|
4
4
|
Summary: This module ties all other Dissect modules together, it provides a programming API and command line tools which allow easy access to various data sources inside disk images or file collections (a.k.a. targets)
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
6
6
|
License: Affero General Public License v3
|
@@ -43,7 +43,7 @@ dissect/target/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
43
43
|
dissect/target/helpers/cache.py,sha256=_0w_iPD1OM066Ueyadb70erQW05jNnpJe-bDDN1UyXc,8444
|
44
44
|
dissect/target/helpers/config.py,sha256=6917CZ6eDHaK_tOoiVEIndyhRXO6r6eCBIleq6f47PQ,2346
|
45
45
|
dissect/target/helpers/configutil.py,sha256=u8pG_6dznwnQwj7JpSH54NcYwLAhFkgdyixoBVTDWM0,22587
|
46
|
-
dissect/target/helpers/cyber.py,sha256=
|
46
|
+
dissect/target/helpers/cyber.py,sha256=Ki5oSU0GgQxjgC_yWoeieGP7GOY5blQCzNX7vy7Pgas,16782
|
47
47
|
dissect/target/helpers/descriptor_extensions.py,sha256=uT8GwznfDAiIgMM7JKKOY0PXKMv2c0GCqJTCkWFgops,2605
|
48
48
|
dissect/target/helpers/docs.py,sha256=J5U65Y3yOTqxDEZRCdrEmO63XQCeDzOJea1PwPM6Cyc,5146
|
49
49
|
dissect/target/helpers/fsutil.py,sha256=jGinb11-w6TvbzH7z-9F6J09X5CY3_yxBoNsKxsFAXE,18637
|
@@ -74,7 +74,7 @@ dissect/target/loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
74
74
|
dissect/target/loaders/ad1.py,sha256=1_VmPZckDzXVvNF-HNtoUZqabnhCKBLUD3vVaitHQ00,571
|
75
75
|
dissect/target/loaders/asdf.py,sha256=dvPPDBrnz2JPXpCbqsu-NgQWIdVGMOit2KAdhIO1iiQ,972
|
76
76
|
dissect/target/loaders/cb.py,sha256=EGhdytBKBdofTd89juavDZZbmupEZmMBadeUXvVIK20,6612
|
77
|
-
dissect/target/loaders/cyber.py,sha256=
|
77
|
+
dissect/target/loaders/cyber.py,sha256=Ip2hI7L98ZP7gUZuHQr0GxBdmbTzD-PntXmLJ5KpBuQ,1533
|
78
78
|
dissect/target/loaders/dir.py,sha256=nEJepNGI4EEP7MX3X15xysH9agKDmlKjfyd1DDulieU,4968
|
79
79
|
dissect/target/loaders/hyperv.py,sha256=_IOUJEO0BXaCBZ6sjIX0DZTkG9UNW5Vs9VcNHYv073w,5928
|
80
80
|
dissect/target/loaders/itunes.py,sha256=69aMTQiiGYpmD_EYSmf9mO1re8C3jAZIEStmwlMxdAk,13146
|
@@ -137,7 +137,7 @@ dissect/target/plugins/apps/vpn/wireguard.py,sha256=45WvCqQQGrG3DVDH5ghcsGpM_Bom
|
|
137
137
|
dissect/target/plugins/apps/webhosting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
138
138
|
dissect/target/plugins/apps/webhosting/cpanel.py,sha256=OeFQnu9GmpffIlFyK-AR2Qf8tjyMhazWEAUyccDU5y0,2979
|
139
139
|
dissect/target/plugins/apps/webserver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
140
|
-
dissect/target/plugins/apps/webserver/apache.py,sha256=
|
140
|
+
dissect/target/plugins/apps/webserver/apache.py,sha256=ekvztMgL5h-KPCaaRtDxZXX8gEZfJVLjjVjlYgJc9O0,14924
|
141
141
|
dissect/target/plugins/apps/webserver/caddy.py,sha256=qZsAK_tILGvroV4SWkDKc-Otwd41bUEtv9H9TuHmt-0,6422
|
142
142
|
dissect/target/plugins/apps/webserver/citrix.py,sha256=FEPdBteEJeeGg3B95W_27O9wLJVhenEc5A5fSLDmK18,3044
|
143
143
|
dissect/target/plugins/apps/webserver/iis.py,sha256=UwRVzLqnKScijdLoZFfpkSUzKTQosicZpn16q__4QBU,14669
|
@@ -323,10 +323,10 @@ dissect/target/volumes/luks.py,sha256=OmCMsw6rCUXG1_plnLVLTpsvE1n_6WtoRUGQbpmu1z
|
|
323
323
|
dissect/target/volumes/lvm.py,sha256=wwQVR9I3G9YzmY6UxFsH2Y4MXGBcKL9aayWGCDTiWMU,2269
|
324
324
|
dissect/target/volumes/md.py,sha256=j1K1iKmspl0C_OJFc7-Q1BMWN2OCC5EVANIgVlJ_fIE,1673
|
325
325
|
dissect/target/volumes/vmfs.py,sha256=-LoUbn9WNwTtLi_4K34uV_-wDw2W5hgaqxZNj4UmqAQ,1730
|
326
|
-
dissect.target-3.16.
|
327
|
-
dissect.target-3.16.
|
328
|
-
dissect.target-3.16.
|
329
|
-
dissect.target-3.16.
|
330
|
-
dissect.target-3.16.
|
331
|
-
dissect.target-3.16.
|
332
|
-
dissect.target-3.16.
|
326
|
+
dissect.target-3.16.dev17.dist-info/COPYRIGHT,sha256=m-9ih2RVhMiXHI2bf_oNSSgHgkeIvaYRVfKTwFbnJPA,301
|
327
|
+
dissect.target-3.16.dev17.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
328
|
+
dissect.target-3.16.dev17.dist-info/METADATA,sha256=YywPJw6suKORoLTsaNaA_ubrqmzRQJtwCuVQC1qEC7s,11113
|
329
|
+
dissect.target-3.16.dev17.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
330
|
+
dissect.target-3.16.dev17.dist-info/entry_points.txt,sha256=tvFPa-Ap-gakjaPwRc6Fl6mxHzxEZ_arAVU-IUYeo_s,447
|
331
|
+
dissect.target-3.16.dev17.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
|
332
|
+
dissect.target-3.16.dev17.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
{dissect.target-3.16.dev15.dist-info → dissect.target-3.16.dev17.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|