('binary' encoding is not supported, stored as-is) In-Reply-To: <20030527112322.24904.qmailat_private> I received so many individual responses requesting a copy of the script, I thought that I'd just post it to the list... The only requirements to run this script are that ActiveState's Perl and MS Word should be installed on the computer. So far, I've only received on piece of feedback, and I am looking into it. Comments and feedback are appreciated. Harlan ----------------------------------------------------- #! c:\perl\bin\perl.exe # Primarily for Word documents # ref: http://msdn.microsoft.com/library/default.asp?url= # /library/en-us/office97/html/output/F1/D4/S5A92C.asp use strict; use Win32::OLE; use Win32::OLE::Variant; use Win32::OLE::Enum; my $file = shift || die "You must enter a filename.\n"; die "$file not found.\n" unless (-e $file); my $wd; if ($wd = Win32::OLE->GetObject($file)) { my $path = $wd->Invoke('Path'); print "Document Path: ".$path."\n"; # Check to see if the document is passworded print "\n"; my $pass = $wd->Invoke('HasPassword'); print "The document "; ($pass)?(print "is "):(print "is NOT "); print "passworded.\n"; print "\n"; # Is FastSave enabled? my $fs = $wd->Invoke('AllowFastSave'); print "FastSave "; ($fs)?(print "is "):(print "is NOT "); print "enabled.\n"; print "\n"; # Does the document have a routing slip? my $track = $wd->Invoke('HasRoutingSlip'); print "The document "; ($track)?(print "has "):(print "does NOT have "); print "a routing slip.\n"; print "\n"; # Check Templates my $temps = $wd->Invoke('Templates'); print "Templates: ".$temps->{Count}."\n"; if ($temps->{Count} > 0) { foreach my $t (in $temps) { print "Template: ".$t->{FullName}; } } print "\n"; # check BuiltInDocumentProperties my $prop = $wd->Invoke('BuiltInDocumentProperties'); if ($prop->{Count} > 0) { print "Built-in Document Properties\n"; printf "%-40s %-20s\n","Property","Value"; printf "%-40s %-20s\n","-" x 10,"-" x 10; foreach my $p (in $prop) { printf "%-40s %-20s\n",$p->{Name},$p->{Value} if ($p->{Value} ne ""); } } print "\n"; # Check CustomDocumentProperties my $prop = $wd->Invoke('CustomDocumentProperties'); if ($prop->{Count} > 0) { print "Custom Document Properties\n"; printf "%-40s %-20s\n","Property","Value"; printf "%-40s %-20s\n","-" x 10,"-" x 10; foreach my $p (in $prop) { # print $p->{Name}." => ".$p->{Value}."\n"; printf "%-40s %-20s\n",$p->{Name},$p->{Value}; } } print "\n"; # Versions my $ver = $wd->Invoke('Versions'); print "There are ".$ver->{Count}." version(s).\n"; if ($ver->{Count} > 0) { printf "%-20s %-20s\n", "Savedby","Date"; foreach my $v (in $ver) { printf "%-20s %-20s\n", $v->{SavedBy},$v->{Date}; } } print "\n"; # Check for revision tracking my $track = $wd->Invoke('TrackRevisions'); if ($track) { print "Revision Tracking is enabled.\n"; # Retrieve a collection of revision objects my $revs = $wd->Invoke('Revisions'); print "There are ".$revs->{Count}." revisions.\n\n"; foreach my $r (in $revs) { printf "%-40s %-20s\n",$r->{Author},$r->{Date}; } } else { print "Revision Tracking is NOT enabled.\n"; } print "\n"; # Check for hyperlinks if (my $hyperlinks = $wd->Invoke('HyperLinks')) { my $num = $hyperlinks->{Count}; print "There are ".$num." hyperlinks in the document.\n"; if ($num > 0) { foreach my $link (in $hyperlinks) { print "Link: ".$link->{Address}."\n"; } } } print "\n"; # Check for comments if (my $comm = $wd->Invoke('Comments')) { print "There are ".$comm->{Count}." comments in the document.\n"; if ($comm->{Count} > 0) { foreach my $c (in $comm) { print "Author: ".$c->{Author}."\n"; } } } print "\n"; # Check for InLine Shapes if (my $inline = $wd->Invoke('InlineShapes')) { print "There are ".$inline->{Count}." inline shapes in the document.\n"; } print "\n"; # Check for Shapes if (my $shapes = $wd->Invoke('Shapes')) { print "There are ".$shapes->{Count}." shapes in the document.\n"; } print "\n"; # Analyze file for hidden text or text w/ a white font # set up tags my $whitefont = 0; my $hiddentext = 0; my $words = $wd->Invoke('Words'); # print "There are ".$words->{Count}." words in the document.\n"; print "Analyzing document. Please wait...\n"; foreach my $word (in $words) { $whitefont = 1 if ($word->{Font}->{ColorIndex} == 8); $hiddentext = 1 if ($word->{Font}->{Hidden}); } # Report white font text print "White Font Text: "; ($whitefont)?(print "YES"):(print "NO"); print "\n"; # Report hidden text print "Hidden Text : "; ($hiddentext)?(print "YES"):(print "NO"); print "\n"; } else { my $err = Win32::FormatMessage Win32::GetLastError(); print "Error initializing $file: $err\n"; } ----------------------------------------------------------------- This list is provided by the SecurityFocus ARIS analyzer service. For more information on this free incident handling, management and tracking system please see: http://aris.securityfocus.com
This archive was generated by hypermail 2b30 : Fri May 30 2003 - 08:06:05 PDT