public function getMarks($mark = 'BOTSLCA')
 {
     $ar_marks = array();
     $ar_domain_id = array();
     $ar_domain = array();
     $organ = json_decode(INPUT::get('data'));
     $ar0 = DB::connection('mysql2')->table('marks')->where('mark_name', 'like', '%' . $organ . '%')->where('mark_name', 'like', '%' . $mark . '%')->select('ID')->get();
     $ar0 = $this->stdToArray($ar0);
     foreach ($ar0 as $val) {
         $ar_marks[] = $val['ID'];
     }
     $ar_marks = array_unique($ar_marks);
     //print_r($ar_marks);
     $ar0 = DB::connection('mysql2')->table('marks_domains')->whereIn('mark_name_id', $ar_marks)->select('domain_name_id')->get();
     $ar0 = $this->stdToArray($ar0);
     foreach ($ar0 as $val) {
         $ar_domain_id[] = $val['domain_name_id'];
     }
     $ar_domain_id = array_unique($ar_domain_id);
     //print_r($ar_domain_id);
     //return response()->json($ar_domain_id)->setStatusCode(200);
     $ar0 = DB::connection('mysql2')->table('domains')->whereIn('ID', $ar_domain_id)->select('domain_name')->get();
     $ar0 = $this->stdToArray($ar0);
     foreach ($ar0 as $val) {
         $ar_domain[] = $val['domain_name'];
     }
     $ar_domain = array_unique($ar_domain);
     //print_r($ar_domain);
     return response()->json($ar_domain)->setStatusCode(200);
 }
Пример #2
0
 public function filter()
 {
     $dns = json_decode(INPUT::get('data'));
     foreach ($dns as $val) {
         $vt = new VirusTotalController();
         $loc = $vt->getInfoByDnsF($val);
         if (empty($loc)) {
             continue;
         }
         foreach ($loc as $location) {
             $ip = $location['ip'];
             $lat = $location['lat'];
             $lon = $location['lon'];
             \DB::collection('mapControlling')->where('dns', $val)->insert(array('dns' => $val, 'ip' => $ip, 'coordinates' => array('lat' => $lat, 'lon' => $lon)));
         }
     }
     //return redirect('proverka')->setStatusCode(200);
 }
Пример #3
0
 public function getInfoByDns()
 {
     $domain = json_decode(INPUT::get('data'));
     $url = "http://www.virustotal.com/vtapi/v2/domain/report";
     $data = array("apikey" => $this->key, "domain" => $domain);
     $res = $this->send($url, $data, false);
     $res = json_decode($res);
     $res = $this->stdToArray($res);
     $ar_ip = array();
     if ($res['response_code'] != 0) {
         $count_detected_urls = count($res['detected_urls']);
         if ($count_detected_urls > 0) {
             $resolutions = $res['resolutions'];
             $resolutions = $this->stdToArray($resolutions);
             foreach ($resolutions as $info) {
                 if (!empty($info['ip_address'])) {
                     $ar_ip[] = $info['ip_address'];
                 }
             }
         }
         $ar_ip = array_unique($ar_ip);
         sort($ar_ip);
     }
     $ar_loc = array();
     foreach ($ar_ip as $ip) {
         $location = GeoIP::getLocation($ip);
         $ar_loc[] = $location;
         //return response()->json($location)->setStatusCode(200);
     }
     //$ar_loc=array_unique($ar_loc);
     return response()->json($ar_loc)->setStatusCode(200);
     //print_r($res);
     ///return response()->json($res)->setStatusCode(200);
 }
Пример #4
0
 public function getRecords()
 {
     $tables = json_decode(INPUT::get('data'));
     $rec = array();
     foreach ($tables as $table) {
         $domains = DB::table($table)->select('dns')->get();
         $domains = array_map(function ($item) {
             return (array) $item;
         }, $domains);
         foreach ($domains as $domain) {
             $domain = $domain['dns'];
             if (preg_match('/\\d*\\.\\d*\\.\\d*\\.\\d*/', $domain) == 1) {
                 continue;
             }
             $tmp = explode('.', $domain);
             $count = count($tmp);
             if ($count > 2) {
                 $domain = $tmp[$count - 2] . '.' . $tmp[$count - 1];
                 if (preg_match('/\\D{1,}/', $domain)) {
                     $rec[] = $domain;
                 }
             }
         }
     }
     $rec = array_unique($rec);
     //return response($tables,200);
     return response()->json($rec)->setStatusCode(200);
 }
Пример #5
0
 public function getDns()
 {
     $dns = json_decode(INPUT::get('data'));
     $ar = array();
     $ar_vm = array();
     $ar_sn = array();
     $ar_vm = DB::connection('fermamongo')->collection('domains')->where('domain', 'like', '%' . $dns . '%')->distinct('vm')->get();
     $ar_vm = array_unique($ar_vm);
     foreach ($ar_vm as $vm) {
         $ar_sn = DB::connection('fermamongo')->collection('domains')->where('domain', 'like', '%' . $dns . '%')->where('vm', $vm)->distinct('snapshot')->get();
         $ar_sn = array_unique($ar_sn);
         $ar[$vm] = $ar_sn;
     }
     return response()->json($ar)->setStatusCode(200);
 }