Skip to content

Instantly share code, notes, and snippets.

@m8urnett
Created April 30, 2018 23:18
Show Gist options
  • Save m8urnett/a5fda7ae275b13fbf0d525e184bc363f to your computer and use it in GitHub Desktop.
Save m8urnett/a5fda7ae275b13fbf0d525e184bc363f to your computer and use it in GitHub Desktop.
#####################################################################
# FPSEInfo.pl v1.0
# Returns information from the FrontPage server extensions
#
# by Mark Burnett (mb@xato.net)
# Copyright (C)2002 Mark Burnett, All Rights Reservered
#
# This script and accompanying documentation are provided "as is",
# without warranty of any kind, express or implied, including
# but not limited to the implied warranties of merchantability and
# fitness for a particular purpose. You, the end user, are hereby
# granted a limited license to use this software for personal or
# business use. This script, may be freely distributed in its
# unmodified state with any of it's associated files.
#
#####################################################################
use LWP::UserAgent;
use NET::Ping;
if ($#ARGV==-1 || $ARGV[0]=~ m/[\/-][?hH]/) {
print "Usage:\nfpseinfo.pl <IP Address or host name>\n\n";
exit;
}
$host = shift(@ARGV);
my $req = new HTTP::Request POST => "HTTP://".$host."/_vti_bin/shtml.exe/_vti_rpc";
$req->content_type('application/x-www-form-urlencoded');
$req->user_agent('MS-FrontPage/4.0');
$req->content('method=list+services:3.0.0.0000&service_name=/');
my $res = (new LWP::UserAgent)->request($req);
# Note: This code is by no means efficient, it is more of a proof-of-concept
# that I quickly threw together. Output is sometimes screwed up, and it
# definitely could use some work
if ($res->is_success) {
$results="<pre>" . $res->as_string;
$results=~ s/<html><head>/<\/pre><head>/gi;
$results=~ s/<ul>/<table width=80%>/gi;
$results=~ s/<\/ul>/<\/table>/gi;
$results=~ s/<li>//gi;
$results=~ s/\n[BFISTVU][RXW]\|/<\/b><\/td><td>/gi;
$results=~ s/\nvti_/<\/td><\/tr><tr><td><b>/gi;
$results=~ s/meta_info=/<br>meta_info=/gi;
$results=~ s/width=80%><\/td><\/tr>/width=80%><thead><th width=20%>Property<\/th><th width=80%>Value<\/th><\/thead>/gi;
open (OUT, ">$host.htm");
print OUT "<html><head><style>";
print OUT "H1 { font : bold 14pt Verdana, Geneva, Arial, Helvetica, sans-serif; color : #4F4B7A; }\n";
print OUT "H2 { font : bold 10pt Verdana, Geneva, Arial, Helvetica, sans-serif; color : #313131; }\n";
print OUT "BODY { font : 8pt Verdana, Geneva, Arial, Helvetica, sans-serif; color : black; margin-left :6px; margin-right : 6px; }\n";
print OUT "TD { COLOR: Black; FONT: 11px Verdana, arial, geneva, helvetica, sans-serif; border : 0px solid #F3F3F3; vertical-align : top; background-color : #EFF4F3;}\n";
print OUT "TH { COLOR: Black; FONT: bold 11px Verdana, arial, geneva, helvetica, sans-serif; border : 0px solid #F3F3F3; text-align : left; vertical-align : top; background-color : #ced5d1;}\n<\/style>";
print OUT "<h1>FrontPage Server Info</h1>\n";
print OUT "<h2>$host</h2>\n";
print OUT "<h6>by Mark Burnett</h6>\n";
print OUT $results;
my $req = new HTTP::Request POST => "HTTP://".$host."/_vti_bin/shtml.dll/_vti_rpc";
$req->content_type('application/x-www-form-urlencoded');
$req->user_agent('MS-FrontPage/4.0');
$req->content('method=list+documents:3.0.0.0000&service_name=/&listHiddenDocs=true&listExplorerDocs=true&listRecurse=true&listFiles=true&listFolders=true&listLinkInfo=true&listIncludeParent=true&listDerived=false&listBorders=false&listChildWebs=true&initialUrl=.');
my $res = (new LWP::UserAgent)->request($req);
if ($res->is_success) {
$results="<pre>" . $res->as_string;
if ($results!~ m/not\sauthorized/gi) {
$results=~ s/<html><head>/<\/pre><head>/gi;
$results=~ s/<ul>/<table width=80%>/gi;
$results=~ s/<\/ul>/<\/table>/gi;
$results=~ s/<li>//gi;
$results=~ s/\n[BFISTVU][RXW]\|/<\/b><\/td><td>/gi;
$results=~ s/\nvti_/<\/td><\/tr><tr><td><b>/gi;
$results=~ s/width=80%><\/td><\/tr>/width=80%><thead><th width=20%>Property<\/th><th width=80%>Value<\/th><\/thead>/gi;
$results=~ s/meta_info=/<br>meta_info=/gi;
open (OUT, ">$host.dir.htm");
print OUT "<html><head><style>";
print OUT "H1 { font : bold 14pt Verdana, Geneva, Arial, Helvetica, sans-serif; color : #4F4B7A; }\n";
print OUT "H2 { font : bold 10pt Verdana, Geneva, Arial, Helvetica, sans-serif; color : #313131; }\n";
print OUT "BODY { font : 8pt Verdana, Geneva, Arial, Helvetica, sans-serif; color : black; margin-left :6px; margin-right : 6px; }\n";
print OUT "TD { COLOR: Black; FONT: 11px Verdana, arial, geneva, helvetica, sans-serif; border : 0px solid #F3F3F3; vertical-align : top; background-color : #EFF4F3;}\n";
print OUT "TH { COLOR: Black; FONT: bold 11px Verdana, arial, geneva, helvetica, sans-serif; border : 0px solid #F3F3F3; text-align : left; vertical-align : top; background-color : #ced5d1;}\n<\/style>";
print OUT "<h1>FrontPage Server Info</h1>\n";
print OUT "<h2>$host</h2>\n";
print OUT "<h6>by Mark Burnett</h6>\n";
print OUT $results;
}
}
}
elsif ($res->is_error) {
print "An error occurred connecting to the FrontPage server extensions.\n";
print $res->code, " - ", $res->message, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment