Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



WebApp Sec: Re: Controlling access to pdf/doc files

Re: Controlling access to pdf/doc files

From: <siput_at_email.com>
Date: Fri, 27 Feb 2004 07:50:19 -0500

I write like this in Perl:
-Open the file
-Write the correct Content-type
-Write to the output

sub download {
# ----------
# download file

   my $type = $in{'type'};
   
   if ($type eq "pdf") {

      open( IN, $PDF_FILE ) or die; #quit on error
      binmode(IN);
      print "Content-type: application/pdf\n\n";
   
   } elsif ($type eq "zip") {
        
      open( IN, $ZIP_FILE ) or die;
      binmode(IN);
      print "Content-type: application/x-zip-compressed\n\n";

   }
   
   while( read( IN, $i, 1024) ) {
      print $i;
   }
   close IN;
   
}

--Suhairi Mohd Jawi

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
Received on Feb 28 2004
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos