the interface of the KaosCube
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
4.5 KiB

1 year ago
  1. <!doctype html>
  2. <?php
  3. $lang=$_GET['lang'];
  4. if ( in_array ($lang, array('en-US'))){
  5. $loc = "$lang".".utf8";
  6. $loc1 = $lang;
  7. }
  8. else {
  9. $loc = "de-DE";
  10. $loc1 = "de-DE";
  11. }
  12. $color=$_GET['color'];
  13. if (strlen($color) <= 1){
  14. $color = "deeppink";
  15. }
  16. include "Spyc.php";
  17. $localeYaml = Spyc::YAMLLoad('locale.yaml');
  18. $domain = "messages";
  19. setlocale(LC_MESSAGES, $loc);
  20. setlocale(LC_ALL, $loc);
  21. $results = putenv("LC_ALL=$loc");
  22. $results = putenv("LC_MESSAGES=$loc");
  23. $results = bindtextdomain($domain,"./locale");
  24. ?>
  25. <head>
  26. <meta charset="utf-8"/>
  27. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  28. <title><?php echo _($localeYaml['title'][$loc1])?></title>
  29. <link rel="stylesheet" href="css/index.css">
  30. </head>
  31. <style>
  32. body {
  33. background: <?php echo _($color)?>;
  34. }
  35. input[type="text"] {
  36. background: <?php echo _($color)?>;
  37. }
  38. input[type="text"]:focus {
  39. background: <?php echo _($color)?>;
  40. }
  41. </style>
  42. <body>
  43. <center>
  44. <div id="containerdiv">
  45. <a href="/"><p id="linktext"><b><?php echo _($localeYaml['connect'][$loc1])?></b></p></a>
  46. <a href="changeKCPW.php"><p id="linktext"><?php echo _($localeYaml['changePassword'][$loc1])?></p></a>
  47. <a href="info.php"><p id="linktext"><?php echo _($localeYaml['info'][$loc1])?></p></a>
  48. <a href="onion.php"><p id="linktext"><?php echo _($localeYaml['onionFeatures'][$loc1])?></p></a>
  49. <a href="freedom.php"><p id="linktext"><?php echo _($localeYaml['freedom'][$loc1])?></p></a>
  50. </div>
  51. </center>
  52. <?php
  53. $shellcommand2 = "nmcli c show > connections.csv";
  54. $output = shell_exec($shellcommand2);
  55. ?>
  56. <br><br><br><br><br><br>
  57. <center>
  58. <?php echo _($localeYaml['connections'][$loc1])?>
  59. <table id="demo"><tr>
  60. <th></th>
  61. <th></th>
  62. <th></th>
  63. <th></th>
  64. </tr>
  65. <?php
  66. // (A) OPEN CSV FILE
  67. $stream = fopen("connections.csv", "r");
  68. // (B) EXTRACT ROWS & COLS
  69. while (($row = fgets($stream)) !== false) {
  70. echo "<tr>";
  71. $col = preg_split( '/\s{2,}/', $row, -1, PREG_SPLIT_NO_EMPTY );
  72. // var_dump( preg_split( '/\s{2,}/', $row ) );
  73. $n = 0;
  74. $id = 'oi';
  75. foreach ($col as $c)
  76. {
  77. $n+=1;
  78. echo "<td>$c</td>";
  79. if ($n==1)
  80. {
  81. $id=substr($c, 0, -1);
  82. }
  83. }
  84. echo "</tr>";
  85. }
  86. // (C) CLOSE CSV FILE
  87. fclose($stream);
  88. ?></table>
  89. </center>
  90. </br></br></br></br>
  91. <?php
  92. $shellcommand3 = "nmcli dev status > devices.csv";
  93. $output = shell_exec($shellcommand3);
  94. ?>
  95. <br><br><br><br><br><br>
  96. <center>
  97. <?php echo _($localeYaml['devices'][$loc1])?>
  98. <table id="demo"><tr>
  99. <th></th>
  100. <th></th>
  101. <th></th>
  102. <th></th>
  103. </tr>
  104. <?php
  105. // (A) OPEN CSV FILE
  106. $stream = fopen("devices.csv", "r");
  107. // (B) EXTRACT ROWS & COLS
  108. while (($row = fgets($stream)) !== false) {
  109. echo "<tr>";
  110. $col = preg_split( '/\s{2,}/', $row, -1, PREG_SPLIT_NO_EMPTY );
  111. // var_dump( preg_split( '/\s{2,}/', $row ) );
  112. $n = 0;
  113. $id = 'oi';
  114. foreach ($col as $c)
  115. {
  116. $n+=1;
  117. echo "<td>$c</td>";
  118. if ($n==1)
  119. {
  120. $id=substr($c, 0, -1);
  121. }
  122. }
  123. echo "</tr>";
  124. }
  125. // (C) CLOSE CSV FILE
  126. fclose($stream);
  127. ?></table>
  128. </center>
  129. </br></br></br></br>
  130. <?php
  131. $shellcommand2 = "nmcli -t --fields SSID,RATE,BARS,SECURITY dev wifi list > ssids.csv";
  132. $output = shell_exec($shellcommand2);
  133. ?>
  134. <center>
  135. <?php echo _($localeYaml['ssids'][$loc1])?>
  136. <table id="demo"><tr>
  137. <th>SSID</th>
  138. <th>RATE</th>
  139. <th>BARS</th>
  140. <th>SEC</th>
  141. </tr>
  142. <?php
  143. // (A) OPEN CSV FILE
  144. $stream = fopen("ssids.csv", "r");
  145. // (B) EXTRACT ROWS & COLS
  146. while (($row = fgets($stream)) !== false) {
  147. echo "<tr>";
  148. $col = preg_split( '/:/', $row, -1, PREG_SPLIT_NO_EMPTY );
  149. // var_dump( preg_split( '/\s{2,}/', $row ) );
  150. $n = 0;
  151. $id = 'oi';
  152. foreach ($col as $c)
  153. {
  154. $n+=1;
  155. echo "<td>$c</td>";
  156. if ($n==1)
  157. {
  158. $id=substr($c, 0, -1);
  159. }
  160. }
  161. echo "</tr>";
  162. }
  163. // (C) CLOSE CSV FILE
  164. fclose($stream);
  165. ?></table>
  166. </center>
  167. </br></br></br></br>
  168. <footer>
  169. <center>
  170. <a href="mailto:contact@cannabinieri.de"><p id="linktext"><?php echo _($localeYaml['contact'][$loc1])?></p></a>
  171. <p>© 2022 by Cannabinieri </p>
  172. <address>
  173. https://www.cannabinieri.de<br>
  174. E-Mail: contact@cannabinieri.de<br><br>
  175. </address>
  176. </center>
  177. </footer>
  178. </center>
  179. <center>
  180. <div id="containerdiv2">
  181. <a href="?color=deeppink"><p id="linktext"><b>pink</b></p></a>
  182. <a href="?color=lightblue"><p id="linktext">azurro</p></a>
  183. </div>
  184. </center>
  185. </body>
  186. </html>