1 |
michel |
1.1 |
diff -urN smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/xt_geoip smeserver-xt_geoip-1.0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/xt_geoip |
2 |
|
|
--- smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/xt_geoip 2019-04-10 18:04:05.000000000 +0400 |
3 |
michel |
1.2 |
+++ smeserver-xt_geoip-1.0.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/xt_geoip 2019-04-21 21:19:38.819847189 +0400 |
4 |
michel |
1.1 |
@@ -65,6 +65,11 @@ |
5 |
|
|
</entry> |
6 |
|
|
|
7 |
|
|
<entry> |
8 |
|
|
+ <base>ERR_COUNTRY_MAX: {$ctr}</base> |
9 |
|
|
+ <trans>Country code(s) maximum reached: {$ctr}</trans> |
10 |
|
|
+ </entry> |
11 |
|
|
+ |
12 |
|
|
+ <entry> |
13 |
|
|
<base>LABEL_BADCOUNTRIES</base> |
14 |
|
|
<trans>New country codes to be used :</trans> |
15 |
|
|
</entry> |
16 |
|
|
@@ -89,4 +94,39 @@ |
17 |
|
|
<trans>GeoIP table is updated every week, but you can ...</trans> |
18 |
|
|
</entry> |
19 |
|
|
|
20 |
|
|
+ <entry> |
21 |
|
|
+ <base>IPT_LIST</base> |
22 |
|
|
+ <trans>Geoip ban</trans> |
23 |
|
|
+ </entry> |
24 |
|
|
+ |
25 |
|
|
+ <entry> |
26 |
|
|
+ <base>SSH_LIST</base> |
27 |
|
|
+ <trans>Ssh errors</trans> |
28 |
|
|
+ </entry> |
29 |
|
|
+ |
30 |
|
|
+ <entry> |
31 |
|
|
+ <base>STATS_GENERATED</base> |
32 |
|
|
+ <trans>Statistics generated</trans> |
33 |
|
|
+ </entry> |
34 |
|
|
+ |
35 |
|
|
+ <entry> |
36 |
|
|
+ <base>END_OF_STATS</base> |
37 |
|
|
+ <trans>End of Statistics</trans> |
38 |
|
|
+ </entry> |
39 |
|
|
+ |
40 |
|
|
+ <entry> |
41 |
|
|
+ <base>INVALID_STATS_TYPE</base> |
42 |
|
|
+ <trans>Invalid type of statistics</trans> |
43 |
|
|
+ </entry> |
44 |
|
|
+ |
45 |
|
|
+ <entry> |
46 |
|
|
+ <base>STATS_DESCRIPTION</base> |
47 |
|
|
+ <trans><![CDATA[ <h3>Statistics for Xt_GeoIP</h3><ul> |
48 |
|
|
+ <li>For 3 periods : Day, Week and Month</li> |
49 |
|
|
+ <li>Banned Ips by country sorted by number</li> |
50 |
|
|
+ <li>Ssh errors by country sorted by number</li> |
51 |
|
|
+ </ul><p><i>XX means Country not found !</i></p> ]]> |
52 |
|
|
+ </trans> |
53 |
|
|
+ </entry> |
54 |
|
|
+ |
55 |
|
|
</lexicon> |
56 |
|
|
diff -urN smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/xt_geoip smeserver-xt_geoip-1.0.1/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/xt_geoip |
57 |
|
|
--- smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/xt_geoip 2019-04-10 18:04:05.000000000 +0400 |
58 |
michel |
1.2 |
+++ smeserver-xt_geoip-1.0.1/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/xt_geoip 2019-04-21 21:19:38.819847189 +0400 |
59 |
michel |
1.1 |
@@ -60,6 +60,12 @@ |
60 |
|
|
</entry> |
61 |
|
|
|
62 |
|
|
<entry> |
63 |
|
|
+ <base>ERR_COUNTRY_MAX: {$ctr}</base> |
64 |
|
|
+ <trans>Code pays, maximum atteint: {$ctr}</trans> |
65 |
|
|
+ </entry> |
66 |
|
|
+ |
67 |
|
|
+ |
68 |
|
|
+ <entry> |
69 |
|
|
<base>LABEL_BADCOUNTRIES</base> |
70 |
|
|
<trans>Nouveaux codes pays à utiliser :</trans> |
71 |
|
|
</entry> |
72 |
|
|
@@ -89,5 +95,40 @@ |
73 |
|
|
<trans>Aucun changement... pas de mise à jour ! |
74 |
|
|
</trans> |
75 |
|
|
</entry> |
76 |
|
|
+ |
77 |
|
|
+ <entry> |
78 |
|
|
+ <base>IPT_LIST</base> |
79 |
|
|
+ <trans>Geoip stop</trans> |
80 |
|
|
+ </entry> |
81 |
|
|
+ |
82 |
|
|
+ <entry> |
83 |
|
|
+ <base>SSH_LIST</base> |
84 |
|
|
+ <trans>Ssh erreurs</trans> |
85 |
|
|
+ </entry> |
86 |
|
|
+ |
87 |
|
|
+ <entry> |
88 |
|
|
+ <base>STATS_GENERATED</base> |
89 |
|
|
+ <trans>Statistiques générées</trans> |
90 |
|
|
+ </entry> |
91 |
|
|
+ |
92 |
|
|
+ <entry> |
93 |
|
|
+ <base>END_OF_STATS</base> |
94 |
|
|
+ <trans>Fin des Statistiques</trans> |
95 |
|
|
+ </entry> |
96 |
|
|
+ |
97 |
|
|
+ <entry> |
98 |
|
|
+ <base>INVALID_STATS_TYPE</base> |
99 |
|
|
+ <trans>Type de statistiques invalide</trans> |
100 |
|
|
+ </entry> |
101 |
|
|
+ |
102 |
|
|
+ <entry> |
103 |
|
|
+ <base>STATS_DESCRIPTION</base> |
104 |
|
|
+ <trans><![CDATA[ <h3>Statistiques pour Xtables GeoIP</h3><ul> |
105 |
|
|
+ <li>Pour 3 périodes : Jour, Semaine et Mois</li> |
106 |
|
|
+ <li>Ips bloqués par pays triés par score</li> |
107 |
|
|
+ <li>Erreurs Ssh par pays triées par score </li> |
108 |
|
|
+ </ul><p><i>XX signifie Pays non trouvé !</i></p> ]]> |
109 |
|
|
+ </trans> |
110 |
|
|
+ </entry> |
111 |
|
|
|
112 |
|
|
</lexicon> |
113 |
|
|
diff -urN smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/web/functions/xt_geoip smeserver-xt_geoip-1.0.1/root/etc/e-smith/web/functions/xt_geoip |
114 |
|
|
--- smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/web/functions/xt_geoip 2019-04-10 18:04:05.000000000 +0400 |
115 |
michel |
1.2 |
+++ smeserver-xt_geoip-1.0.1/root/etc/e-smith/web/functions/xt_geoip 2019-04-21 21:19:38.819847189 +0400 |
116 |
michel |
1.1 |
@@ -68,9 +68,10 @@ |
117 |
|
|
footer="/etc/e-smith/web/common/foot.tmpl"> |
118 |
|
|
|
119 |
|
|
<page name="First" |
120 |
|
|
- pre-event="print_status_message()"> |
121 |
|
|
+ pre-event="print_status_message()"> |
122 |
|
|
+ # post-event="wherenext('Second')" > |
123 |
|
|
+ # Ssh Ipt Second |
124 |
|
|
<description>XT_GEOIP_STATUS_DESCRIPTION</description> |
125 |
|
|
- |
126 |
|
|
<field |
127 |
|
|
type="literal" |
128 |
|
|
id="geoip" |
129 |
|
|
@@ -98,9 +99,15 @@ |
130 |
|
|
value="get_stat_geoip()"> |
131 |
|
|
<label> </label> |
132 |
|
|
</field> |
133 |
|
|
+ |
134 |
|
|
+ <field type="literal" id="client_label" value=""> |
135 |
|
|
+ <description>STATS_DESCRIPTION</description> |
136 |
|
|
+ </field> |
137 |
|
|
+ |
138 |
|
|
+ <subroutine src="print_custom_button('IPT_LIST', 'Stats', 'ipt')"/> |
139 |
|
|
+ <subroutine src="print_custom_button('SSH_LIST', 'Stats', 'ssh')"/> |
140 |
|
|
|
141 |
|
|
<subroutine src="print_button('NEXT')" /> |
142 |
|
|
- |
143 |
|
|
</page> |
144 |
|
|
|
145 |
|
|
<page name="Second" |
146 |
|
|
@@ -144,5 +151,14 @@ |
147 |
|
|
<subroutine src="print_button('SAVE')" /> |
148 |
|
|
|
149 |
|
|
</page> |
150 |
|
|
+ |
151 |
|
|
+ |
152 |
|
|
+ <page name="Stats" |
153 |
|
|
+ pre-event="generateStats" |
154 |
|
|
+ post-event="wherenext('First')" > |
155 |
|
|
+ <subroutine src="print_button('NEXT')"/> |
156 |
|
|
+ </page> |
157 |
|
|
+ |
158 |
|
|
+ |
159 |
|
|
|
160 |
|
|
</form> |
161 |
|
|
diff -urN smeserver-xt_geoip-1.0.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm smeserver-xt_geoip-1.0.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm |
162 |
|
|
--- smeserver-xt_geoip-1.0.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm 2019-04-10 18:04:05.000000000 +0400 |
163 |
michel |
1.2 |
+++ smeserver-xt_geoip-1.0.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/xt_geoip.pm 2019-04-21 21:22:29.486625737 +0400 |
164 |
michel |
1.1 |
@@ -27,7 +27,7 @@ |
165 |
|
|
must_exist |
166 |
|
|
); |
167 |
|
|
|
168 |
|
|
-our $VERSION = sprintf '%d.%03d', q$Revision: 0.01 $ =~ /: (\d+).(\d+)/; |
169 |
|
|
+our $VERSION = sprintf '%d.%03d', q$Revision: 0.02 $ =~ /: (\d+).(\d+)/; |
170 |
|
|
|
171 |
|
|
our $db = esmith::ConfigDB->open || die "Couldn't open ConfigDB\n"; |
172 |
|
|
|
173 |
|
|
@@ -81,7 +81,7 @@ |
174 |
|
|
my $self = esmith::FormMagick->new(); |
175 |
|
|
$self->{calling_package} = (caller)[0]; |
176 |
|
|
bless $self; |
177 |
|
|
- #$self->debug(1); |
178 |
|
|
+# $self->debug(1); |
179 |
|
|
return $self; |
180 |
|
|
} |
181 |
|
|
|
182 |
|
|
@@ -213,12 +213,65 @@ |
183 |
|
|
my $listerr = ""; |
184 |
|
|
my @mq_bcs = split /[,:]/, $q->param("masq_badcountries"); |
185 |
|
|
if (@mq_bcs) { |
186 |
|
|
+ my $ctr = @mq_bcs; |
187 |
|
|
+ return $self->localise('ERR_COUNTRY_MAX: {$ctr}', {ctr=> "$ctr"}) if ($ctr > 50); |
188 |
|
|
+ |
189 |
|
|
foreach my $bcs (@mq_bcs) { |
190 |
|
|
- my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; |
191 |
|
|
- if (! -f $file) { $listerr .= $bcs . ","; } |
192 |
|
|
+ my $file = "/usr/share/xt_geoip/LE/" . $bcs . ".iv4"; |
193 |
|
|
+ if (! -f $file) { $listerr .= $bcs . ","; } |
194 |
|
|
} |
195 |
|
|
return $self->localise('ERR_COUNTRY_NOT_EXIST: {$listerr}', {listerr=> "$listerr"}) if $listerr; |
196 |
|
|
} |
197 |
|
|
return 'OK'; |
198 |
|
|
} |
199 |
|
|
+ |
200 |
|
|
+#Subroutine to display buttons |
201 |
|
|
+sub print_custom_button |
202 |
|
|
+{ |
203 |
|
|
+ my ($fm,$desc,$url,$type) = @_; |
204 |
|
|
+ my $q = $fm->{cgi}; |
205 |
|
|
+ $url="xt_geoip?page=0&page_stack=&Next=Next&type=".$type."&wherenext=".$url; |
206 |
|
|
+ print " <tr>\n <td colspan='2'>\n"; |
207 |
|
|
+ print $q->p($q->a({href => $url, -class => "button-like"},$fm->localise($desc))); |
208 |
|
|
+ print qq(</tr>\n); |
209 |
|
|
+ return undef; |
210 |
|
|
+} |
211 |
|
|
+ |
212 |
|
|
+#Subroutine to list statistics |
213 |
|
|
+sub generateStats |
214 |
|
|
+{ |
215 |
|
|
+ my $self = shift; |
216 |
|
|
+ my $q = $self->{cgi}; |
217 |
|
|
+ |
218 |
|
|
+ # Untaint $name before use in system() |
219 |
|
|
+ my $stats_type = $q->param ('type'); |
220 |
|
|
+ $stats_type =~ /(.+)/; $stats_type = $1; |
221 |
|
|
+ if ($stats_type ne "ipt" && $stats_type ne "ssh") |
222 |
|
|
+ { |
223 |
|
|
+ print $q->p($q->b($self->localise('INVALID_STATS_TYPE'). |
224 |
|
|
+ $stats_type)); |
225 |
|
|
+ return ''; |
226 |
|
|
+ } else { |
227 |
|
|
+ # my $now_string = $self->gen_locale_date_string(); |
228 |
|
|
+ my $file = "/var/lib/xt_geoip/extA_" . $stats_type . "_country.lst"; |
229 |
|
|
+ my $filetime = ( -e $file ) ? (stat($file))[9] : 0; |
230 |
|
|
+ my $date_string = strftime("%Y/%m/%d %H:%M", localtime( $filetime )) || ''; |
231 |
|
|
+ print $q->h3($self->localise('STATS_GENERATED'), "[", $stats_type, "]", $date_string); |
232 |
|
|
+ |
233 |
|
|
+ open( XTGEOIPSTATS, $file ); |
234 |
|
|
+ print "<pre>\n"; |
235 |
|
|
+ |
236 |
|
|
+ while (<XTGEOIPSTATS>) |
237 |
|
|
+ { |
238 |
|
|
+ print; |
239 |
|
|
+ } |
240 |
|
|
+ |
241 |
|
|
+ close XTGEOIPSTATS; |
242 |
|
|
+ print "</pre>\n"; |
243 |
|
|
+ |
244 |
|
|
+ print $q->h3($self->localise('END_OF_STATS')); |
245 |
|
|
+ return ''; |
246 |
|
|
+ } |
247 |
|
|
+} |
248 |
|
|
+ |
249 |
|
|
1; |