"Fossies" - the Fresh Open Source Software Archive 
Member "mythreads/docs_info/websec-gen.pl" (17 Jan 2002, 3931 Bytes) of package /linux/privat/mythreads-links_1.2.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "websec-gen.pl" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
1.2.0_vs_1.2.1.
1 #!/usr/bin/perl
2 #
3 # $Id: websec-gen.pl,v 1.2 2002-01-17 11:29:28 ldrolez Exp $
4 #
5 # Small Perl script which will convert the list of links on your Mythreads site
6 # to a 'Web Secretary' configuration file.
7 # Do not forget to install websec.php3 somewhere on your site.
8 #
9 # Copyright (C) 2001 Ludovic Drolez
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #
25
26 use LWP::UserAgent;
27
28 # URL were your websec.php3 has been installed
29 # Don't forget the password !
30 $url = "http://www.example.com/websec.php3?pass=something";
31 # ignore URLs containing this (regexp)
32 $ignore = "www.example.com";
33 # Were to write the 'websec' configuration file
34 $outfile="urlnew.list";
35
36 # You can change the default options for
37 # the generated websec config file below
38 open(OUT, ">$outfile");
39 print OUT '
40 #############################################################################################
41 # Default configuration block.
42 #
43 # These configuration values will be used for the sites that follow, unless they are
44 # overridden by the site configuration values. Parameter names are case-sensitive.
45 #
46 # Auth = "none"; or "username:password"
47 # Diff = "webdiff" to detect and highlight differences; or "none" to mail page as is.
48 # HiColor = "blue"; "yellow"; "pink"; or "grey".
49 # Ignore = list of comma-delimited section names containing ignore keywords.
50 # IgnoreURL = list of comma-delimited section names containing ignore URLs.
51 # Tmin = every token containing <= Tmin words will not be highlighted for differences.
52 # Tmax = every token containing >= Tmax words will not be checked for ignore keywords.
53 # Proxy = specify proxy "http://your.proxy.here:portnum" if you are behind one.
54 # Email = email address to send page to.
55 # EmailLink = email address to send URL to.
56 #############################################################################################
57
58 Auth = none
59 Diff = webdiff
60 Hicolor = blue
61 Ignore = General,Date_Time
62 IgnoreURL = Adverts
63 Tmin = 0
64 Tmax = 99999
65 Email = you@example.com
66 EmailLink = you@example.com
67
68 ##########################################################################################
69 # Sites to monitor
70 #
71 # Configuration values for each site is separated by a newline.
72 # Parameter names are case-sensitive.
73 # Parameter values override default values (for given site only) if specified.
74 # URL, Name and Prefix parameters must be specified for each site.
75 ##########################################################################################
76
77 ';
78
79
80 $ua = new LWP::UserAgent;
81 $ua->agent("websec/1.0");
82 $ua->env_proxy;
83 $req = new HTTP::Request('GET', $url);
84 # Try up to 3 times to download URL
85 for(1..3)
86 {
87 $resp = $ua->request($req);
88 if ($resp->is_success) { last; }
89 }
90 # If URL is successfully downloaded
91 if ($resp->is_success)
92 {
93 print "Received HTTP data\n";
94 } else {
95 exit;
96 }
97
98
99
100
101
102
103
104 $count=0;
105 foreach $line (split /\n/,$resp->content) {
106 if ($count) {
107 $url = $line;
108 if ($url =~ m/$ignore/) {
109 # ignore
110 } else {
111 print OUT "URL = $url\n";
112 print OUT "Name = $name\n";
113 $prefix = lc($name);
114 $prefix =~ s/ $//g;
115 $prefix =~ s/[^a-z0-9]/_/g;
116 print OUT "Prefix = $prefix\n\n";
117 }
118 $count=0;
119 } else {
120 $name = $line;
121 $count++;
122 }
123 }
124
125 close(OUT);