CapsMAN - Client Name

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?

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)

: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.