1 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm |
2 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-19 09:44:56.678590486 +0000 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-19 09:44:56.678590486 +0000 |
3 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2023-12-31 13:44:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/Controller/Dhcpd.pm 2024-01-22 19:57:00.000000000 +0000 |
4 |
@@ -117,22 +117,41 @@ |
@@ -140,12 +140,12 @@ |
|
$c->render( template => 'dhcpd' ); |
|
|
} |
|
|
|
|
|
- |
|
|
-sub do_winpopup { |
|
|
- # |
|
|
- # call to win pop up |
|
|
- # |
|
|
+sub netmask2cidr { |
|
|
my $c = shift; |
|
|
- my $title = $c->l("dhcpd_GLOBAL_WINPOPUP"); |
|
|
- my $modul = ''; |
|
|
- my $trt = "WINPOPUP"; |
|
|
- $dhcp_data{trt} = $trt; |
|
|
- $dhcp_data{"first"} = ''; |
|
|
- #..... get winpopup details |
|
|
- $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); |
|
|
- $c->render( template => 'dhcpd' ); |
|
|
+ #my ($mask, $network) = @_; |
|
|
+ my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration'); |
|
|
+ my $mask = $nmap_sme->get_value('LocalNetmask'); |
|
|
+ my $network = $nmap_sme->get_prop('InternalInterface','Network'); |
|
|
+ my @octet = split (/\./, $mask); |
|
|
+ my @bits; |
|
|
+ my $binmask; |
|
|
+ my $binoct; |
|
|
+ my $bitcount=0; |
|
|
+ |
|
|
+ foreach (@octet) { |
|
|
+ $binoct = dec2bin($_); |
|
|
+ $binmask = $binmask . substr $binoct, -8; |
|
|
+ } |
|
|
+ |
|
|
+ # let's count the 1s |
|
|
+ @bits = split (//,$binmask); |
|
|
+ foreach (@bits) { |
|
|
+ if ($_ eq "1") { |
|
|
+ $bitcount++; |
|
|
+ } |
|
|
+ } |
|
|
+ |
|
|
+ my $cidr = $network . "/" . $bitcount; |
|
|
+ return $cidr; |
|
|
} |
|
|
|
|
|
+sub dec2bin { |
|
|
+ my $str = unpack("B32", pack("N", shift)); |
|
|
+ return $str; |
|
|
+} |
|
|
+ |
|
|
+ |
|
|
sub do_scan { |
|
|
# |
|
|
# call to show scan results |
|
|
@@ -140,12 +159,13 @@ |
|
5 |
my $c = shift; |
my $c = shift; |
6 |
my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE"); |
my $title = $c->l("dhcpd_SCANNING_NETWORK_TITLE"); |
7 |
my $modul = ''; |
my $modul = ''; |
9 |
+ my $trt = "SCAN"; |
+ my $trt = "SCAN"; |
10 |
$dhcp_data{trt} = $trt; |
$dhcp_data{trt} = $trt; |
11 |
$dhcp_data{"first"} = ''; |
$dhcp_data{"first"} = ''; |
12 |
# ..... get scan results into dhcp_data |
- # ..... get scan results into dhcp_data |
13 |
- dhcp_data{"scanresults"} = get_scan_results($c); |
- dhcp_data{"scanresults"} = get_scan_results($c); |
14 |
- $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); |
- $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data ); |
15 |
+ $dhcp_data{"cidr"} = netmask2cidr($c); |
+ # ..... get scan results into stash for passing to html template |
16 |
+ my @scanresults = get_scan_results($c); |
+ my $dhcp_scanresults = get_scan_results($c); |
17 |
+ $c->stash( title => $title, modul => $modul, dhcp_data => \%dhcp_data, scanresults => @scanresults ); |
+ $c->stash( title => $title, modul => $modul, "dhcp_data" => \%dhcp_data, "scanresults" => $dhcp_scanresults); |
18 |
$c->render( template => 'dhcpd' ); |
$c->render( template => 'dhcpd' ); |
19 |
} |
} |
20 |
|
|
21 |
@@ -314,7 +334,6 @@ |
@@ -332,10 +332,10 @@ |
|
} |
|
|
} |
|
|
|
|
|
- |
|
|
# - 4 expand templates |
|
|
# changed to new sme standard signal-event |
|
|
system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
|
|
@@ -332,10 +351,10 @@ |
|
22 |
my $c = shift; |
my $c = shift; |
23 |
my $ret = delete_all_leases($c); |
my $ret = delete_all_leases($c); |
24 |
if ($ret == 'ok') { |
if ($ret == 'ok') { |
25 |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
26 |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_REMOVED_ALL_LEASES"; |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
27 |
do_leases($c); |
do_leases($c); |
28 |
} |
} |
29 |
- else {dhcp_data{"error"}=$ret;} |
- else {dhcp_data{"error"}=$ret;} |
31 |
return ; |
return ; |
32 |
} |
} |
33 |
|
|
34 |
@@ -352,17 +371,39 @@ |
@@ -352,17 +352,17 @@ |
35 |
# else return "ok" |
# else return "ok" |
36 |
my $ret = delete_lease($c); |
my $ret = delete_lease($c); |
37 |
if ($ret == 'ok') { |
if ($ret == 'ok') { |
38 |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
- dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
39 |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_DELETED_THE_CLIENT"; |
+ $dhcp_data{"success"}="dhcpd_SUCCESSFULLY_SAVED_SETTINGS"; |
40 |
do_leases($c); |
do_leases($c); |
41 |
} |
} |
42 |
- else {dhcp_data{"error"}=$ret;} |
- else {dhcp_data{"error"}=$ret;} |
46 |
|
|
47 |
sub get_scan_results { |
sub get_scan_results { |
48 |
my $c = shift; |
my $c = shift; |
49 |
- #...do it |
#...do it |
50 |
- return "results"; |
- return "results"; |
51 |
+ my $cidr = netmask2cidr($c); |
+ return Scan_Local_Network($c); |
|
+ my $res = execute_nmap($cidr); |
|
|
+ return $res; |
|
|
+} |
|
|
+ |
|
|
+sub execute_nmap { |
|
|
+ my ($ip, $port) = @_; |
|
|
+ my @result; |
|
|
+ my $nmapcmd = qq(/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $ip| \ |
|
|
+ /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"| \ |
|
|
+ /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'| \ |
|
|
+ /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/ /g'); |
|
|
+ |
|
|
+ open my $nmap, '-|', "$nmapcmd" or die "Can't start nmap: $!"; |
|
|
+ |
|
|
+ while (my $line = <$nmap>) { |
|
|
+ chomp $line; |
|
|
+ my @fields = split /\s+/, $line; |
|
|
+ push @result, \@fields; |
|
|
+ } |
|
|
+ |
|
|
+ close $nmap; |
|
|
+ |
|
|
+ return \@result; |
|
52 |
} |
} |
53 |
|
|
54 |
|
|
55 |
@@ -374,13 +415,45 @@ |
@@ -374,13 +374,13 @@ |
56 |
|
|
57 |
sub delete_one_lease { |
sub delete_one_lease { |
58 |
my $c = shift; |
my $c = shift; |
59 |
- # ...do it |
- # ...do it |
60 |
|
+ Perform_Del_Lease($c); |
61 |
|
return "ok"; |
62 |
|
} |
63 |
|
|
64 |
|
sub delete_all_leases { |
65 |
|
my $c = shift; |
66 |
|
- # ...do it |
67 |
|
+ Perform_del_all_Lease($c); |
68 |
|
return "ok"; |
69 |
|
} |
70 |
|
|
71 |
|
@@ -391,6 +391,169 @@ |
72 |
|
return @leases; |
73 |
|
} |
74 |
|
|
75 |
|
+ |
76 |
|
+sub Perform_del_all_Lease ($){ |
77 |
|
+ |
78 |
|
+ system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0 |
79 |
|
+ or die "Error while removing all leases: $!"; |
80 |
|
+ |
81 |
|
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
82 |
|
+ or die "Error while saving settings: $!"; |
83 |
|
+ |
84 |
|
+ return 'ok'; |
85 |
|
+ exit; |
86 |
|
+} |
87 |
|
+ |
88 |
|
+#=============================================================================== |
89 |
|
+#SUBROUTINE: Perform delete lease |
90 |
|
+#=============================================================================== |
91 |
|
+sub Perform_Del_Lease($){ |
92 |
|
+ |
93 |
|
+ ###Pull CGI object from parameters array |
94 |
|
+ my $c = shift; |
95 |
+ |
+ |
96 |
+ ###Pull entry to delete |
+ ###Pull entry to delete |
97 |
+ my $ip = $c->param('host'); |
+ my $ip = $c->param('host'); |
120 |
+ # changed to new sme standard signal-event |
+ # changed to new sme standard signal-event |
121 |
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
122 |
+ or die "Error while saving settings: $!"; |
+ or die "Error while saving settings: $!"; |
123 |
return "ok"; |
+ ###Return action message |
124 |
} |
+ return $c->l('SUCCESSFULLY_DELETED_THE_CLIENT') . ' (' . $name . '/' . $ip .')'; |
125 |
|
+} |
126 |
sub delete_all_leases { |
+ |
127 |
my $c = shift; |
+#=============================================================================== |
128 |
- # ...do it |
+#SUBROUTINE: Scan The Local Network |
129 |
+ system ('/bin/echo "" > /var/lib/dhcpd/dhcpd.leases') ==0 |
+#=============================================================================== |
130 |
+ or die "Error while removing all leases: $!"; |
+sub dec2bin { |
131 |
|
+ my $str = unpack("B32", pack("N", shift)); |
132 |
|
+ return $str; |
133 |
|
+} |
134 |
|
+ |
135 |
|
+sub netmask2cidr { |
136 |
|
+ my ($mask, $network) = @_; |
137 |
|
+ my @octet = split (/\./, $mask); |
138 |
|
+ my @bits; |
139 |
|
+ my $binmask; |
140 |
|
+ my $binoct; |
141 |
|
+ my $bitcount=0; |
142 |
|
+ |
143 |
|
+ foreach (@octet) { |
144 |
|
+ $binoct = dec2bin($_); |
145 |
|
+ $binmask = $binmask . substr $binoct, -8; |
146 |
|
+ } |
147 |
|
+ |
148 |
|
+ # let's count the 1s |
149 |
|
+ @bits = split (//,$binmask); |
150 |
|
+ foreach (@bits) { |
151 |
|
+ if ($_ eq "1") { |
152 |
|
+ $bitcount++; |
153 |
|
+ } |
154 |
|
+ } |
155 |
|
+ my $cidr = $network . "/" . $bitcount; |
156 |
|
+ return $cidr; |
157 |
|
+} |
158 |
|
+ |
159 |
|
+sub get_mac_address { |
160 |
|
+ # From the leases file |
161 |
|
+ my ($ip, $file) = @_; |
162 |
|
+ open(my $fh, '<', $file) or die "Could not open file '$file' $!"; |
163 |
|
+ my $mac_address = undef; |
164 |
|
+ my $lease_block; |
165 |
|
+ while(my $line = <$fh>) { |
166 |
|
+ if($line =~ /lease $ip {/ .. $line =~ /}/) { |
167 |
|
+ $lease_block .= $line; |
168 |
|
+ if($line =~ /}/) { |
169 |
|
+ if($lease_block =~ /hardware ethernet (\S+);/) { |
170 |
|
+ $mac_address = $1; |
171 |
|
+ last; |
172 |
|
+ } else { |
173 |
|
+ $lease_block = ''; |
174 |
|
+ } |
175 |
|
+ } |
176 |
|
+ } |
177 |
|
+ } |
178 |
|
+ close $fh; |
179 |
|
+ return $mac_address; |
180 |
|
+} |
181 |
|
+ |
182 |
|
+sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; |
183 |
|
+ |
184 |
|
+sub get_mac_address_by_ping { |
185 |
|
+ my ($ip) = trim(@_); |
186 |
|
+ # Ping the IP to ensure it's in the ARP table |
187 |
|
+ my $ping_result = `ping -c 1 -W 1 $ip`; |
188 |
|
+ #return $ping_result; |
189 |
|
+ if($ping_result =~ m/1 packets transmitted, 1 received/) { |
190 |
|
+ # Fetch the ARP table and find the line with the IP address |
191 |
|
+ my $mac_result = `nmap -PR -sn $ip`; |
192 |
|
+ #return "*$arp_result *$ip*"; |
193 |
|
+ # If found, return the MAC address |
194 |
|
+ #if ($arp_result =~ m/.*at ((?:[0-9a-f]{2}\:){5}[0-9a-f]{2})/) { |
195 |
|
+ if ($mac_result =~ /MAC Address: (..:..:..:..:..:..) /) { |
196 |
|
+ return $1; |
197 |
|
+ } else { return "mac not in nmap result";} |
198 |
|
+ } else { return "no ping";} |
199 |
|
+ return undef; |
200 |
|
+} |
201 |
|
+ |
202 |
|
+ |
203 |
|
+ |
204 |
|
+sub Scan_Local_Network ($) { |
205 |
+ |
+ |
206 |
+ system ("/sbin/e-smith/signal-event","workgroup-update") == 0 |
+ my $nmap_sme = esmith::ConfigDB->open('/home/e-smith/db/configuration'); |
207 |
+ or die "Error while saving settings: $!"; |
+ my $mask = $nmap_sme->get_value('LocalNetmask'); |
208 |
+ |
+ my $network = $nmap_sme->get_prop('InternalInterface','Network'); |
209 |
return "ok"; |
+ |
210 |
} |
+#we start to calculate the method to find the cidr (we want to use network/cidr with nmap) |
211 |
|
+ my $cidr = netmask2cidr($mask, $network); |
212 |
@@ -498,13 +571,6 @@ |
+ |
213 |
return @results; |
+#ok go to use nmap with nmap -T4 -sP network/cidr |
214 |
} |
+ my @nmap_output= `/usr/bin/nmap --script smb-os-discovery.nse -p U:137,T:139 $cidr| |
215 |
|
+ /bin/grep -Ev "MAC|NetBIOS|OS CPE"| /bin/grep -E "scan|done|Computer|OS"| |
216 |
-sub winpopup{ |
+ /bin/sed -e 's/Nmap scan/-- Scan/g'|/bin/sed -e 's/done/Done/g'| |
217 |
- my $c = shift; |
+ /bin/sed -e 's/Nmap//g'|/bin/sed -e 's/|/ /g'`; |
218 |
- # Message in $c->param("winpopupmsg") |
+ |
219 |
- # .... do it |
+ my @extracted_output; |
220 |
- return TRUE; |
+ my $leasefile = "/var/lib/dhcpd/dhcpd.leases"; |
221 |
-} |
+ foreach my $line (@nmap_output) { |
222 |
- |
+ if ($line =~ m/Scan report for ([\w\.-]+) \(([\d\.\:]+)\)/) { |
223 |
sub do_wol{ |
+ my $ip = $2; |
224 |
my $c = shift; |
+ my $mac = get_mac_address($ip,$leasefile); |
225 |
my $retVal = Perform_Wake_Up($c); |
+ if (!$mac){ |
226 |
@@ -536,4 +602,4 @@ |
+ $mac = get_mac_address_by_ping($ip); |
227 |
|
+ } |
228 |
|
+# if (!$mac) {$mac = "unknown";} |
229 |
|
+ my %pair = ('Network' => $1, 'ip' => $ip, 'mac' => $mac); # $1 => PC Name, $2 => IP Address |
230 |
|
+ push @extracted_output, \%pair; |
231 |
|
+ } |
232 |
|
+ } |
233 |
|
+ return \@extracted_output; |
234 |
|
+} |
235 |
|
+ |
236 |
|
+ |
237 |
|
+ |
238 |
|
#========================================================================= |
239 |
|
# Procedure qui charge le dhcpd.conf |
240 |
|
# retourne un tableau contenant les informations |
241 |
|
@@ -536,4 +699,4 @@ |
242 |
|
|
243 |
1; |
1; |
244 |
|
|
247 |
+ |
+ |
248 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm |
249 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 1970-01-01 01:00:00.000000000 +0100 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 1970-01-01 01:00:00.000000000 +0100 |
250 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 2023-12-30 11:30:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Dhcpd/en.pm 2024-01-20 08:46:00.000000000 +0000 |
251 |
@@ -0,0 +1,109 @@ |
@@ -0,0 +1,109 @@ |
252 |
+package SrvMngr::I18N::Modules::Dhcpd::en; |
+package SrvMngr::I18N::Modules::Dhcpd::en; |
253 |
+use strict; |
+use strict; |
360 |
+1; |
+1; |
361 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep |
362 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-19 09:44:56.680590493 +0000 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-19 09:44:56.680590493 +0000 |
363 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2023-12-31 13:55:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/dhcpd.html.ep 2024-01-20 17:01:00.000000000 +0000 |
364 |
@@ -49,23 +49,30 @@ |
@@ -49,24 +49,26 @@ |
365 |
|
|
366 |
% if ($dhcp_data->{trt} eq 'LEASES') { |
% if ($dhcp_data->{trt} eq 'LEASES') { |
367 |
%= include 'partials/_dhcpd_leases' |
%= include 'partials/_dhcpd_leases' |
368 |
- %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') { |
- %} elsif ($dhcp_data->{trt} eq 'WINPOPUP') { |
369 |
- %= include 'partials/_dhcpd_winpopup' |
- %= include 'partials/_dhcpd_winpopup' |
370 |
%} elsif ($dhcp_data->{trt} eq 'SCAN') { |
%} elsif ($dhcp_data->{trt} eq 'SCAN') { |
371 |
- %= include 'partials/_dhcpd_scan' |
%= include 'partials/_dhcpd_scan' |
|
+ %= include 'partials/_dhcpd_scanresults' |
|
372 |
%} else { #PARAMS |
%} else { #PARAMS |
373 |
% my $ip_regex = '^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$'; |
% my $ip_regex = '^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$'; |
374 |
<table><tr><td> |
- <table><tr><td> |
375 |
- %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
- %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
376 |
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
377 |
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
378 |
+ %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showLeasesSpinner()", id=>"scanLeases" |
- <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
379 |
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLeases" style="display:true"> |
- </button> |
380 |
+ Scanning |
- </td><td> |
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
|
|
</button> |
|
|
+ |
|
|
</td><td> |
|
381 |
- %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3' |
- %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3' |
382 |
- </td><td> |
- </td><td> |
383 |
- %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
- %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
384 |
+ %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showNetworkSpinner()", id=>"scanNetwork" |
- <td> |
385 |
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadNetwork" style="display:true"> |
- </tr> |
386 |
+ Scanning |
+ <table> |
387 |
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
+ <tr> |
388 |
+ </button> |
+ <td> |
389 |
+ |
+ %= button_to $c->l('dhcpd_CONNECTED_IP') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases" |
390 |
+ </td> |
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
391 |
+ <!-- |
+ Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
392 |
<td> |
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
393 |
+ %= button_to $c->l('dhcpd_GLOBAL_WINPOPUP') => '/dhcpd2' |
+ </button> |
394 |
+ </td> |
+ </td><td> |
395 |
+ --> |
+ %= button_to $c->l('dhcpd_SCAN_YOUR_NETWORK') => '/dhcpd3', onclick=>"showSpinnerNetwork()", id=>"scanNetwork" |
396 |
</tr> |
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork" style="display:true"> |
397 |
|
+ Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
398 |
|
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
399 |
|
+ </button> |
400 |
|
+ </td> |
401 |
|
+ </tr> |
402 |
</table> |
</table> |
403 |
<hr /> |
<hr /> |
404 |
@@ -179,10 +186,15 @@ |
<h2> |
405 |
</div> |
@@ -180,10 +182,17 @@ |
406 |
|
|
407 |
%= javascript begin |
%= javascript begin |
408 |
- document.getElementById("load").style.display="none"; |
document.getElementById("load").style.display="none"; |
409 |
- function showSpinner(){ |
- function showSpinner(){ |
410 |
+ document.getElementById("loadLeases").style.display="none"; |
+ document.getElementById("loadingNetwork").style.display="none"; |
411 |
+ document.getElementById("loadNetwork").style.display="none"; |
+ |
412 |
+ function showLeasesSpinner(){ |
+ function showSpinnerLeases(){ |
413 |
document.getElementById("scanLeases").style.display="none"; |
document.getElementById("scanLeases").style.display="none"; |
414 |
- document.getElementById("load").style.display="inline"; |
document.getElementById("load").style.display="inline"; |
|
+ document.getElementById("loadLeases").style.display="inline"; |
|
|
+ } |
|
|
+ function showNetworkSpinner(){ |
|
|
+ document.getElementById("scanNetwork").style.display="none"; |
|
|
+ document.getElementById("loadNetwork").style.display="inline"; |
|
415 |
} |
} |
416 |
|
+ |
417 |
|
+ function showSpinnerNetwork(){ |
418 |
|
+ document.getElementById("scanNetwork").style.display="none"; |
419 |
|
+ document.getElementById("loadingNetwork").style.display="inline"; |
420 |
|
+ } |
421 |
%end |
%end |
422 |
|
|
423 |
|
%= stylesheet begin |
424 |
|
@@ -205,7 +214,6 @@ |
425 |
|
border-color: darkgrey; |
426 |
|
border-image: initial; |
427 |
|
} |
428 |
|
- |
429 |
|
%end |
430 |
|
- |
431 |
|
%end |
432 |
|
+1; |
433 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep |
434 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-19 09:44:56.681590497 +0000 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-19 09:44:56.681590497 +0000 |
435 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2023-12-31 14:11:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_leases.html.ep 2024-01-20 11:29:00.000000000 +0000 |
436 |
@@ -1,8 +1,8 @@ |
@@ -1,17 +1,17 @@ |
437 |
<div id='dhcpd-leases'> |
<div id='dhcpd-leases'> |
438 |
<table><tr><td> |
<table><tr><td> |
439 |
- %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
- %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinner()", id=>"scanLeases" |
440 |
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
- <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
441 |
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
- Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
442 |
+ %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showLeaseSpinner()", id=>"scanLeases" |
- <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
443 |
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadLease" style="display:true"> |
- </button> |
444 |
+ Scanning |
- |
445 |
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
- </td><td> |
446 |
</button> |
- %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4' |
447 |
|
- </td> |
448 |
|
- </tr> |
449 |
|
+ %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd1', onclick=>"showSpinnerLeases()", id=>"scanLeases" |
450 |
|
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="load" style="display:true"> |
451 |
|
+ Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
452 |
|
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
453 |
|
+ </button> |
454 |
|
+ |
455 |
|
+ </td><td> |
456 |
|
+ %= button_to $c->l('dhcpd_REMOVE_ALL_LEASES') => '/dhcpd4' |
457 |
|
+ </td> |
458 |
|
+ </tr> |
459 |
|
</table> |
460 |
|
- <hr /> |
461 |
|
+ |
462 |
|
% my $btn = l('dhcpd_SAVE/RESTART'); |
463 |
|
%= form_for '/dhcpd10' => (method => 'POST') => begin |
464 |
|
<span class=label> |
465 |
@@ -26,7 +26,7 @@ |
@@ -26,7 +26,7 @@ |
466 |
%= submit_button "$btn", class => 'action' |
%= submit_button "$btn", class => 'action' |
467 |
% end |
% end |
494 |
</tr> |
</tr> |
495 |
%} |
%} |
496 |
</tbody> |
</tbody> |
497 |
@@ -78,6 +83,7 @@ |
@@ -110,4 +115,4 @@ |
|
%= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd' |
|
|
|
|
|
%= javascript begin |
|
|
+ document.getElementById("loadLease").style.display="none"; |
|
|
function Wol_confirm(event,msg,current){ |
|
|
const getMAC = /.*MAC\=(.*)\&name.*/; |
|
|
var MAC = current.href.match(getMAC)[1]; |
|
|
@@ -110,4 +116,4 @@ |
|
498 |
%end |
%end |
499 |
|
|
500 |
|
|
501 |
-</div> |
-</div> |
502 |
\ No newline at end of file |
\ No newline at end of file |
503 |
+</div> |
+</div> |
504 |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep |
diff -urN smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep |
505 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 1970-01-01 01:00:00.000000000 +0100 |
--- smeserver-dhcpmanager-2.0.4.old/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep 1970-01-01 01:00:00.000000000 +0100 |
506 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scanresults.html.ep 2023-12-31 13:59:00.000000000 +0000 |
+++ smeserver-dhcpmanager-2.0.4/root/usr/share/smanager/themes/default/templates/partials/_dhcpd_scan.html.ep 2024-01-20 17:30:00.000000000 +0000 |
507 |
@@ -0,0 +1,55 @@ |
@@ -0,0 +1,63 @@ |
508 |
+<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css"> |
+<div id='dhcpd-scan'> |
509 |
+<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
+ <table><tr><td> |
510 |
+<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script> |
+ %= button_to $c->l('dhcpd_REFRESH') => '/dhcpd3', onclick=>"showSpinnerNetwork1()", id=>"scanNetwork1" |
511 |
+ |
+ <button class ="btn btn-primary spinnerButtonOverlay" type = "submit" id="loadingNetwork1" style="display:true"> |
512 |
+<div id='dhcpd-scanresults'> |
+ Scanning <!--%= $c->l('dhcpd_CONNECTED_IP')--> |
513 |
+ |
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> |
514 |
+%#= 1/0 |
+ </button> |
515 |
+ %= $c->l('dhcpd_NETWORK_VALUES_FOUND').$dhcp_data->{"cidr"}; |
+ |
516 |
+ %= form_for '/dhcpd10' => (method => 'POST') => begin |
+ </td> |
517 |
+ <br /> |
+ </tr> |
518 |
+ <table id="scanresults" class="sme-border table-sort"><thead> |
+ |
519 |
|
+ </table> |
520 |
|
+ <table class="sme-border table-sort"><thead> |
521 |
+ <tr> |
+ <tr> |
522 |
+ <th class='sme-border'> |
+ <th class='sme-border'> |
523 |
+ %=l 'dhcpd_NETWORK_NAME' |
+ %=l 'dhcpd_NETWORK_NAME' |
524 |
+ </th> |
+ </th> |
525 |
+ <th class='sme-border'> |
+ <th class='sme-border'> |
528 |
+ <th class='sme-border'> |
+ <th class='sme-border'> |
529 |
+ %=l 'dhcpd_MAC_ADDRESS' |
+ %=l 'dhcpd_MAC_ADDRESS' |
530 |
+ </th> |
+ </th> |
531 |
+ <th class='sme-border'> |
+ |
|
+ %=l 'dhcpd_STATUS_CLICK_FOR_WOL' |
|
|
+ </th> |
|
532 |
+ </tr> |
+ </tr> |
533 |
+ </thead> |
+ </thead> |
534 |
+ <tbody> |
+ <tbody> |
535 |
+ % foreach my $line (@$scanresults) { |
+ % foreach my $ip (@$scanresults) { |
536 |
+ % my @thisline = @$line; |
+ <tr> |
537 |
+ <tr> |
+ %= t td => (class => 'sme-border') => $ip->{Network} |
538 |
+ <td class='sme-border'> |
+ %= t td => (class => 'sme-border') => $ip->{ip} |
539 |
+ %= "$thisline[4]"; |
+ %= t td => (class => 'sme-border') => $ip->{mac} |
540 |
+ </td> |
+ </tr> |
541 |
+ <td class='sme-border'> |
+ %} |
542 |
+ %= "$thisline[5]"; |
+ </tbody> |
|
+ </td> |
|
|
+ <td class='sme-border'> |
|
|
+ </td> |
|
|
+ <td class='sme-border'> |
|
|
+ </td> |
|
|
+ </tr> |
|
|
+ %} |
|
543 |
+ </table> |
+ </table> |
544 |
+ % end |
+ %= hidden_field "hiddenmsg"=>"", id=>"hiddenmsg" |
545 |
|
+ <br /> |
546 |
+ %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd' |
+ %= button_to $c->l('dhcpd_CLICK_HERE_TO_MAIN_PANEL') => '/dhcpd' |
547 |
|
+ |
548 |
|
+ %= javascript begin |
549 |
|
+ function Wol_confirm(event,msg,current){ |
550 |
|
+ const getMAC = /.*MAC\=(.*)\&name.*/; |
551 |
|
+ var MAC = current.href.match(getMAC)[1]; |
552 |
|
+ if (confirm(msg+": MAC: "+MAC)) |
553 |
|
+ { return true;} |
554 |
|
+ else {event.preventDefault();return false;} |
555 |
|
+ } |
556 |
|
+ |
557 |
|
+ |
558 |
|
+ %end |
559 |
|
+ |
560 |
|
+ |
561 |
+</div> |
+</div> |
562 |
+<script> |
+%= javascript begin |
563 |
+$(document).ready(function() { |
+ document.getElementById("loadingNetwork1").style.display="none"; |
564 |
+ $("table.table-sort").each(function() { |
+ |
565 |
+ // Enable DataTable on this table |
+ function showSpinnerNetwork1(){ |
566 |
+ $(this).DataTable(); |
+ document.getElementById("scanNetwork1").style.display="none"; |
567 |
+ }); |
+ document.getElementById("loadingNetwork1").style.display="inline"; |
568 |
+}); |
+ } |
|
+</script> |
|
569 |
+ |
+ |
570 |
|
+%end |