Community discussions

MikroTik App
 
MrHae
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 62
Joined: Wed May 26, 2021 7:40 pm

CapsMAN - Client Name

Wed Nov 10, 2021 10:31 am

Hey Guys,

it's just furstrating to search some Client within the Capsman Registration List.

I've found some Script which shows me which Clients Names are Connected using the internal DHCP Server from the Router.

But i need some Script which shows me the Client name from Connected Clients and another DHCP Server.

I just thought about the same script but instead of looking into the DHCP Server i need something like:

CapsMan Client Connects
search in access list if MAC Address ist already set --> if no
/tool mac-scan ether2
search in this list for mac address --> ip address
send rdns request to some specified DNS Server
store the result name
set the result name to capsmann access list as description

so i have an Automated Registration Table with Name in Description.

Is their some freaky Scripter who can write this?
 
kujo
Member Candidate
Member Candidate
Posts: 169
Joined: Sat Jun 18, 2016 10:17 am
Location: Ukraine
Contact:

Re: CapsMAN - Client Name

Tue Feb 28, 2023 10:19 pm

It's can be done by script that runs periodically with simple logic:
-check all registered clients in the capsman
-find for all wifi clients a dhcp leased address
-edit a wifi client comment
/caps-man registration-table edit 0 comment
But this feature don't work (6.48.6)
 
kujo
Member Candidate
Member Candidate
Posts: 169
Joined: Sat Jun 18, 2016 10:17 am
Location: Ukraine
Contact:

Re: CapsMAN - Client Name

Wed Mar 01, 2023 10:18 pm

:local wifiItem;
:local wifiItemMac;
:local dhcpItem;
:local dhcpIPaddr; 
:local dhcpServer;
:local dhcpName;
:local dhcpStatus;
:local dhcpLastSeen;
:local wifiComment;

:foreach wifiItem in=[/caps-man registration-table find] do={
		:set wifiItemMac [/caps-man registration-table get $wifiItem value-name=mac-address];
		:set dhcpItem [/ip dhcp-server lease find where mac-address=$wifiItemMac];
		:if ($dhcpItem !=  "") do={
			:set dhcpIPaddr [/ip dhcp-server lease get $dhcpItem value-name=active-address];
			:set dhcpName [/ip dhcp-server lease get $dhcpItem value-name=host-name];
			:set dhcpServer [/ip dhcp-server lease get $dhcpItem value-name=server];
			:set dhcpStatus [/ip dhcp-server lease get $dhcpItem value-name=status];
			:set dhcpLastSeen [/ip dhcp-server lease get $dhcpItem value-name=last-seen];
			:set wifiComment ($dhcpIPaddr . "::" . $dhcpName . "::" . \
				$dhcpServer. "::" . $dhcpStatus . "::" . \
				$dhcpLastSeen);
			:put $wifiComment;
			if ([/caps-man access-list find where mac-address=$wifiItemMac] = "") do={
				[/caps-man access-list add mac-address=$wifiItemMac action=accept comment=$wifiComment];
			} else={
				[/caps-man access-list set [/caps-man access-list find where mac-address=$wifiItemMac] comment=$wifiComment];
			}
		};

};

But mikrotik reconnect wifi clients whose access-rules was changed/created.

Who is online

Users browsing this forum: Amazon [Bot], TheCondor and 39 guests