Jump to content

Radio Country Selection Hack


winter_soldier

Recommended Posts

Dirty hack in the interface (Configuration module) to select a country code, to re-assert the correct channels and frequencies for your currently occupied country.

I noticed the team have patched the Network panel to dynamically display the channel array in a nice dropdown box.

I assume you already know linux and how to patch code, or can take this patch and make your own modifications; standard disclaimer: use at you own risk, simples!

diff -Npaur pineapple/modules/Configuration/api/module.php pineapple-new/modules/Configuration/api/module.php
--- pineapple/modules/Configuration/api/module.php    2016-09-15 13:57:11.000000000 +0100
+++ pineapple-new/modules/Configuration/api/module.php    2016-09-15 13:55:39.000000000 +0100
@@ -49,6 +49,13 @@ class Configuration extends SystemModule
                 $this->disableLandingPage();
                 break;
 
+        case 'changeRegion':
+                $this->changeRegion();
+                break;
+
+            case 'getCurrentRegion':
+                $this->getCurrentRegion();
+                break;
         }
     }
 
@@ -135,4 +142,16 @@ class Configuration extends SystemModule
         $this->response = array("success" => false);
     }
 
+    private function getCurrentRegion()
+    {
+        $currentRegion = exec('iw reg get|head -n 2|tail -n 1|cut -b 9-10');
+        $this->response = array("currentRegion" => $currentRegion);
+    }
+
+    private function changeRegion()
+    {
+        $region = escapeshellarg($this->request->Region);
+        exec("iw reg set {$region}");
+        $this->response = array("success" => true);
+    }
 }

diff -Npaur pineapple/modules/Configuration/js/module.js pineapple-new/modules/Configuration/js/module.js
--- pineapple/modules/Configuration/js/module.js    2016-09-15 13:55:39.000000000 +0100
+++ pineapple-new/modules/Configuration/js/module.js    2016-09-15 13:55:39.000000000 +0100
@@ -7,6 +7,8 @@ registerController("ConfigurationGeneral
     $scope.newPasswordRepeat = "";
     $scope.showPasswordSuccess = false;
     $scope.showPasswordError = false;
+    $scope.customRegion="";
+    $scope.currentRegion="";
 
     $scope.timeZones = [
         { value: 'GMT+12', description: "(GMT-12:00) Eniwetok, Kwajalein" },
@@ -36,6 +38,15 @@ registerController("ConfigurationGeneral
         { value: 'GMT-12', description: "(GMT+12) Auckland, Wellington, Fiji, Kamchatka" }
     ];
 
+        $scope.getCurrentRegion = (function() {
+                $api.request({
+                        module: "Configuration",
+                       action: "getCurrentRegion"
+                }, function(response) {
+                        $scope.currentRegion = response.currentRegion;
+               });
+        });
+
 
     $scope.getCurrentTimeZone = (function() {
         $api.request({
@@ -137,6 +148,25 @@ registerController("ConfigurationGeneral
         });
     });
 
+        $scope.changeRegion = (function() {
+        var tmpRegion;
+        if ($scope.customRegion.trim() !== "") {
+                        tmpRegion = $scope.customRegion;
+                }
+                $api.request({
+                        module: "Configuration",
+                        action: "changeRegion",
+                        Region: tmpRegion,
+
+                }, function(response) {
+                        if (response.success !== undefined) {
+                                $scope.getCurrentRegion();
+                $scope.customRegion="00";
+                        }
+                });
+        });
+
+    $scope.getCurrentRegion();
     $scope.getCurrentTimeZone();
 }]);
 
@@ -195,4 +225,4 @@ registerController('ConfigurationLanding
     });
 
     $scope.getLandingPageStatus();
-}]);
\ No newline at end of file
+}]);
diff -Npaur pineapple/modules/Configuration/module.html pineapple-new/modules/Configuration/module.html
--- pineapple/modules/Configuration/module.html    2016-09-15 13:55:39.000000000 +0100
+++ pineapple-new/modules/Configuration/module.html    2016-09-15 13:55:39.000000000 +0100
@@ -43,7 +43,23 @@
                         </div>
                     </div>
                 </form>
-
+                <br/>
+        <form class="form-horizontal">
+            <div class="form-group">
+            <label class="col-sm-2 control-label">Region:</label>
+            <div class="col-sm-3">
+            <input type="text" class="form-control" ng-model="currentRegion" disabled>
+            </div></div>
+            <div class="form-group">
+            <label for="Region" class="col-sm-2 control-label">Region Code</label>
+            <div class="col-sm-5">
+            <input type="text" class="form-control" placeholder="00" ng-model="customRegion">
+            </div></div>
+            <div class="form-group">
+            <div class="col-sm-offset-2 col-sm-10">
+            <button type="submit" class="btn btn-default" ng-click="changeRegion()">Change Region</button>
+            </div></div>
+        </form>
                 <br/>
                 <br/>
 
@@ -101,4 +117,4 @@
             </div>
         </div>
     </div>
-</div>
\ No newline at end of file
+</div>

 

Edited by winter_soldier
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...