diff --git a/lib/msf/core/post/file.rb b/lib/msf/core/post/file.rb index 5da2f65177..00e0ddcb11 100644 --- a/lib/msf/core/post/file.rb +++ b/lib/msf/core/post/file.rb @@ -33,6 +33,15 @@ module File end end + # + # Returns a MD5 checksum of a given remote file + # + + def file_remote_digestmd5(file2md5) + chksum = Digest::MD5.hexdigest(read_file(file2md5)) + return chksum + end + # # Returns a SHA1 checksum of a given local file # @@ -47,6 +56,15 @@ module File end end + # + # Returns a SHA1 checksum of a given remote file + # + + def file_remote_digestsha1(file2sha1) + chksum = Digest::SHA1.hexdigest(read_file(file2sha1)) + return chksum + end + # # Returns a SHA256 checksum of a given local file # @@ -61,6 +79,15 @@ module File end end + # + # Returns a SHA2 checksum of a given remote file + # + + def file_remote_digestsha2(file2sha2) + chksum = Digest::SHA256.hexdigest(read_file(file2sha2)) + return chksum + end + # # Platform-agnostic file read. Returns contents of remote file +file_name+ # as a String.