Advertisement
Guest User

Enable Compliance Test Ubiquiti Radio

a guest
Aug 24th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. <?PHP
  2.  
  3. include('../header.php');
  4.  
  5. //This file will enable compliance test on ubiquiti radios, tested up to firmware 5.6.9.
  6.  
  7. //Variables
  8. $username = 'username';
  9. $password = 'password';
  10.  
  11. //Enter your IP's here
  12. $ipsraw =
  13. '172.16.8.21
  14. 172.16.0.197';
  15.  
  16. //Turns the raw IPs in an array
  17. $iparray = explode(PHP_EOL,$ipsraw);
  18.  
  19. //Loop through each IP in the iparray and change to DHCP Mode
  20. foreach ($iparray as $ip) {
  21.     echo "$ip      ";
  22.    
  23. //Login to Device - this uses a proprietary PHP class. You may need to build your own to do SSH.
  24. $sshObj = new LeadISP\SshCmd($username,$password,$ip);
  25.  
  26. //Enters the command to enable Compliance Test: Creates a blank file called "ct"
  27. echo $sshObj->cmd('touch /etc/persistent/ct')['text'];
  28.  
  29. //Saves the changes
  30. echo $sshObj->cmd('cfgmtd -wp /etc')['text'];
  31. echo "<br>";
  32.  
  33. //End Looping through IP's
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement