From 8d19bca2a9300912677d8fc253b5db8948a2e3b7 Mon Sep 17 00:00:00 2001 From: Stephen Haywood Date: Thu, 12 Jan 2012 12:47:29 -0500 Subject: [PATCH] Added remote digest methods --- lib/msf/core/post/file.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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.