forked from lastchoice/LongTail-Log-Analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LongTail_rebuild_dashboard_index.pl
executable file
·158 lines (141 loc) · 6.17 KB
/
LongTail_rebuild_dashboard_index.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/perl
sub make_index_file {
my $filename= $_[0];
my $file_date= $_[1];
my $date_dir = $file_date;
$date_dir =~ s/-/\//g;
my $next_file_date= $_[2];
my $prior_file_date= $_[3];
my $first_date=$_[4];
my $last_date=$_[5];
#print "IN make_index_file, writing to $dir/$filename\n";
open (FILE, ">$dir/$filename");
print (FILE "<HTML>\n");
if ($next_file_date eq "LAST"){
# I don't want this to run forever sucking up bandwidth
# print (FILE "<meta http-equiv=\"refresh\" content=\"1 url=/honey/dashboard/index2.shtml\">\n");
print (FILE "\n");
}
else {
print (FILE "<meta http-equiv=\"refresh\" content=\"1 url=/honey/dashboard/index-$next_file_date.shtml\">\n");
}
print (FILE "<link rel=\"stylesheet\" type=\"text/css\" href=\"/honey/LongTail.css\">\n");
print (FILE "<!--#include virtual=\"/honey/header.html\" --> \n");
print (FILE "\n");
print (FILE "<H3>LongTail Log Analysis Dashboard<BR>All SSH Ports</H3>\n");
print (FILE "<P>All hosts, all sites, combined. \n");
print (FILE "Minimum, Average, and Maximum are from the month shown. \n");
# print (FILE "<BR>\n");
# print (FILE "<BR>\n");
if ($next_file_date eq "LAST"){
# print (FILE "<A href=\"/honey/dashboard/index2.shtml\">RESTART Slideshow</A><a href=\"/honey/notes.shtml#2\">[2]</a> \n");
print (FILE "<ul class=\"comicNav\">\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$first_date.shtml\">|<</a></li>\n");
print (FILE "<li><a rel=\"prev\" href=\"/honey/dashboard/manual-index-$prior_file_date.shtml\" accesskey=\"p\">< Prev</a></li>\n");
print (FILE "<li><a href=\"/honey/dashboard/index2.shtml\">RESTART</a></li>\n");
print (FILE "<li><a rel=\"next\" href=\"/honey/dashboard/manual-index-$next_file_date.shtml\" accesskey=\"n\">Next ></a></li>\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$last_date.shtml\">>|</a></li>\n");
print (FILE "</ul>\n");
}
else {
print (FILE "<ul class=\"comicNav\">\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$first_date.shtml\">|<</a></li>\n");
print (FILE "<li><a rel=\"prev\" href=\"/honey/dashboard/manual-index-$prior_file_date.shtml\" accesskey=\"p\">< Prev</a></li>\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$file_date.shtml\">STOP</a></li>\n");
print (FILE "<li><a rel=\"next\" href=\"/honey/dashboard/manual-index-$next_file_date.shtml\" accesskey=\"n\">Next ></a></li>\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$last_date.shtml\">>|</a></li>\n");
print (FILE "</ul>\n");
}
#print (FILE "<BR>\n");
#print (FILE "<BR>\n");
print (FILE "<A href=\"/honey/historical/$date_dir/index.shtml\">\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_number_of_attacks-$file_date.png\">\n");
print (FILE "<BR>\n");
print (FILE "<BR>\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_ips-$file_date.png\">\n");
print (FILE "<BR>\n");
print (FILE "<BR>\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_passwords-$file_date.png\">\n");
print (FILE "<BR>\n");
print (FILE "<BR>\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_usernames-$file_date.png\">\n");
print (FILE "</a>\n");
print (FILE "<!--#include virtual=\"/honey/footer.html\" --> \n");
close (FILE);
open (FILE, ">$dir/manual-$filename");
print (FILE "<HTML>\n");
print (FILE "<link rel=\"stylesheet\" type=\"text/css\" href=\"/honey/LongTail.css\">\n");
print (FILE "<!--#include virtual=\"/honey/header.html\" --> \n");
print (FILE "\n");
print (FILE "<H3>LongTail Log Analysis Dashboard<BR>All SSH Ports</H3>\n");
print (FILE "<P>All hosts, all sites, combined. \n");
print (FILE "Minimum, Average, and Maximum are from the month shown. \n");
# print (FILE "<BR>\n");
# print (FILE "<BR>\n");
#
# Slideshow control buttons
#
print (FILE "<ul class=\"comicNav\">\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$first_date.shtml\">|<</a></li>\n");
print (FILE "<li><a rel=\"prev\" href=\"/honey/dashboard/manual-index-$prior_file_date.shtml\" accesskey=\"p\">< Prev</a></li>\n");
print (FILE "<li><a href=\"/honey/dashboard/index-$file_date.shtml\">Resume</a></li>\n");
print (FILE "<li><a rel=\"next\" href=\"/honey/dashboard/manual-index-$next_file_date.shtml\" accesskey=\"n\">Next ></a></li>\n");
print (FILE "<li><a href=\"/honey/dashboard/manual-index-$last_date.shtml\">>|</a></li>\n");
print (FILE "</ul>\n");
# print (FILE "<BR>\n");
# print (FILE "<BR>\n");
print (FILE "<A href=\"/honey/historical/$date_dir/index.shtml\">\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_number_of_attacks-$file_date.png\">\n");
print (FILE "<BR>\n");
print (FILE "<BR>\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_ips-$file_date.png\">\n");
print (FILE "<BR>\n");
print (FILE "<BR>\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_passwords-$file_date.png\">\n");
print (FILE "<BR>\n");
print (FILE "<BR>\n");
print (FILE "<img src=\"/honey/dashboard/dashboard_usernames-$file_date.png\">\n");
print (FILE "</a>\n");
print (FILE "<!--#include virtual=\"/honey/footer.html\" --> \n");
close (FILE);
}
$dir="/var/www/html/honey/dashboard/";
$counter=0;
chdir ("$dir");
open (LS, "ls dashboard_number_of_attacks-*|");
while (<LS>){
#print;
chomp;
$_ =~ s/dashboard_number_of_attacks-//;
$_ =~ s/.png//;
#print;
$date_array[$counter]=$_;
$counter++;
}
close (LS);
$date_array[$counter]="LAST";
$first_date=$date_array[0];
$last_date=$date_array[$counter-1];
$new_counter=0;
$first=1;
while ($new_counter < $counter){
#print "Date is $date_array[$new_counter]\n";
if ($first ==1){
$prior_date="FIRST";
$next_date=$date_array[$new_counter+1];
$this_date=$date_array[$new_counter];
$index_filename="index2.shtml";
&make_index_file ($index_filename,$this_date,$next_date,$prior_date,$first_date,$last_date);
$first = 0;
$index_filename="index-$this_date.shtml";
&make_index_file ($index_filename,$this_date,$next_date,$prior_date,$first_date,$last_date);
}
else {
$prior_date=$date_array[$new_counter-1];
$next_date=$date_array[$new_counter+1];
$this_date=$date_array[$new_counter];
$index_filename="index-$this_date.shtml";
&make_index_file ($index_filename,$this_date,$next_date,$prior_date,$first_date,$last_date);
}
$new_counter++;
}