@@ -25,7 +25,7 @@ def initialize(info = {})
25
25
) )
26
26
register_options (
27
27
[
28
- OptString . new ( 'FILE' , [ true , 'The FILE to retreive from the Volume raw device' , "" ] )
28
+ OptString . new ( 'FILE' , [ true , 'The FILE to retreive from the Volume raw device' , nil ] )
29
29
] , self . class )
30
30
end
31
31
@@ -55,15 +55,20 @@ def run
55
55
@handle = r [ 'return' ]
56
56
print_status ( "Successfuly opened #{ drive } " )
57
57
58
- fs = Rex ::Parser ::NTFS . new ( self )
58
+ begin
59
+ fs = Rex ::Parser ::NTFS . new ( self )
59
60
60
- data = fs . file ( file [ 3 , file . length - 3 ] )
61
- file_name = file . split ( "\\ " ) [ -1 ]
62
- print_status ( "Saving file #{ file_name } " )
63
- file_result = ::File . new ( file_name , "w" )
64
- file_result . syswrite ( data )
65
- file_result . close
66
- client . railgun . kernel32 . CloseHandle ( @handle )
61
+ data = fs . file ( file [ 3 , file . length - 3 ] )
62
+ file_name = file . split ( "\\ " ) [ -1 ]
63
+ print_status ( "Saving file #{ file_name } " )
64
+ file_result = ::File . new ( file_name , "w" )
65
+ file_result . syswrite ( data )
66
+ file_result . close
67
+ rescue ::Exception => e
68
+ print_error ( "Post failed : #{ e . backtrace } " )
69
+ ensure
70
+ client . railgun . kernel32 . CloseHandle ( @handle )
71
+ end
67
72
print_status ( "Post Successfuly" )
68
73
end
69
74
0 commit comments