diff --git a/tftpboot/index.php b/tftpboot/index.php
new file mode 100644
index 0000000..b16f393
--- /dev/null
+++ b/tftpboot/index.php
@@ -0,0 +1,186 @@
+ $subtr) {
+ $pos = strpos(strtolower($subtr), strtolower($needles));
+ if ($pos !== FALSE) {
+ return $key;
+ }
+ }
+ return FALSE;
+ } else {
+ return strpos($haystack, $needles);
+ }
+ }
+ return FALSE;
+}
+
+function find_all_files($dir, $file_mask=null, $mode='full'){
+
+ $result = NULL;
+ if (empty($dir) || (!file_exists($dir))) {
+ return $result;
+ }
+
+ $root = scandir($dir);
+ foreach($root as $value) {
+ if($value === '.' || $value === '..') {continue;}
+ if(is_file("$dir/$value")) {
+ $filter = false;
+ if (!empty($file_mask)) {
+ if (is_array($file_mask)) {
+ foreach ($file_mask as $k){
+ if (strpos(strtolower($value), strtolower($k)) !== false) {$filter = true;}
+ }
+ } else {
+ if (strpos(strtolower($value), strtolower($file_mask)) !== false) {$filter = true;}
+ }
+ } else {$filter = true;}
+ if ($filter) {
+ if ($mode=='fileonly'){
+ $result[]="$value";
+ } else {
+ $result[]="$dir/$value";
+ }
+ } else {$result[]=null;}
+ continue;
+ }
+ $sub_fiend = find_all_files("$dir/$value", $file_mask, $mode);
+ if (!empty($sub_fiend)) {
+ foreach($sub_fiend as $sub_value) {
+ if (!empty($sub_value)) {
+ $result[]=$sub_value;
+ }
+ }
+ }
+ }
+ return $result;
+}
+
+$req_file_full_path = '' ;
+$firmware_list = find_all_files($path['firmware']);
+
+if (!empty($req_file)) {
+ $req_data_ar = explode('/', $req_file);
+ $req_file_name = end($req_data_ar);
+ $req_data_len = count($req_data_ar) - 1;
+ if (file_exists($path['tftp'].$req_file_name)) { // file exist $req_file_name need remove "/../...//" -back door
+ $req_file_full_path = $path['tftp'].$req_file_name;
+ } else {
+ $tmp_file = explode('.', $req_file_name);
+ $tmp = end($tmp_file);
+ $pos = strpos($fsufix, '.'.$tmp.';');
+ if ($pos !== false) { // Request Firmware
+ $pos2 = strpos_array($firmware_list, $req_file_name, 'any'); // case unsensitive
+ if ($pos2 !== false) { // Request Firmware
+ $req_file_full_path = $firmware_list[$pos2];
+ }
+ print_r('
Firmware : '. $req_file_full_path. 'END Firmware
');
+ }
+ if (empty($req_file_full_path)) {
+ if (strpos(implode(';', $rings_list), strtolower($req_file_name)) !== FALSE) { // Request ring list
+ $req_file_full_path = $path['ringtones'].'/ringlist.xml'; // hard link
+ }
+ $tmp_file = '';
+
+ if (strpos(strtolower($req_file_name), '.cnf.xml') !== FALSE) { // Request Settings
+ $tmp_file =$path['settings'].'/'.$req_file_name;
+ }
+
+/*
+ if (strpos(strtolower($req_file), '-tones.xml') !== FALSE) { // Request countries
+ $tmp_file = $path['countries'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
+ }
+
+ if (strpos(strtolower($req_file), '-dictionary.') !== FALSE) { // Request countries
+ $tmp_file = $path['languages'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
+ }
+
+ if (strpos_array($req_file, $locale_list, 'any') !== FALSE) {
+ $tmp_file = $path['languages'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
+ }
+
+ if (strpos(strtolower($req_file), '-dictionary.jar') !== FALSE) { // Request countries
+ $tmp_file = $path['languages'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
+ }
+ *
+ */
+ if (strpos_array($req_file, $locale_list, 'any') !== FALSE) {
+ $tmp_file = $path['languages'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
+ }
+ if (strpos(strtolower($req_file), '/desktops/') !== FALSE) { // Request wallpapers
+ $tmp_file = $path['wallpapers'].'/'. $req_data_ar[$req_data_len-1].'/'. $req_data_ar[$req_data_len];
+ }
+
+ if (!empty($tmp_file)) {
+ if (file_exists($tmp_file)) {
+ $req_file_full_path = $tmp_file;
+ }
+ }
+
+ }
+ }
+ if (!empty($req_file_full_path)) {
+ print_r('
Send: '. $req_file_full_path. ' file.
');
+ file_force_download($req_file_full_path);
+ }
+}