ZKS Posted December 30, 2013 Report Posted December 30, 2013 (edited) Am facut un mic script, pare folositor NL GeoLocation :RST:<?php include_once('get_string_between.php');$ips = $_REQUEST['ips'];$ips = explode("\n", $ips);foreach ($ips as $line) { $ips = explode(":", $line); $ip = $ips[0]; $user = $ips[1]; $pass = $ips[2]; $f = file_get_contents('http://clientn.mask-myip.com/map/whatismyip.php?IP='.$ip); $country = get_string_between($f, "Country: ", "</div>"); $region = get_string_between($f, "Region: ", "</div>"); $city = get_string_between($f, "City: ", "</div>"); $data = "$ip:$user:$pass //Details :$country=>$region=>$city".PHP_EOL; echo "$data<br>";}?>si get_string_between<?php function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); }?> Edited December 30, 2013 by ZKS Quote
GarryOne Posted December 30, 2013 Report Posted December 30, 2013 In primul rand nu functioneaza.Introduc46.55.38.20446.55.38.20446.55.38.204Si primesc in loc46.55.38.203: //Details :-=>-=>-Si pe langa asta, mai am unele mici intrebari1. La ce te referi prin "pass"2. De ce ai baga o simpla functie intr-un fisier separat si sa-l incluzi cand poti sa pui functia direct in fisierul respectiv. Quote
ZKS Posted December 30, 2013 Author Report Posted December 30, 2013 (edited) am rezolvat, m`am grabit si faceam echo doar la ultimul...si da, aveam impreasia ca e ip: pass..cand e ip:user: pass..modific imediat, merci...si functia aia o am asa ca o folosesc mai mereu si asa ramane si codul mai curat//done146.55.38.203:user: pass //Details :UNITED STATES=>ARIZONA=>FT. HUACHUCA Edited December 30, 2013 by ZKS Quote
GarryOne Posted December 30, 2013 Report Posted December 30, 2013 Nu e bun site-ul pe care l-ai ales ca sursa. Incearca cu IP-ul dat de mine sa vezi ca nu merge. Quote
ZKS Posted December 30, 2013 Author Report Posted December 30, 2013 ai dreptate...poate nu are moldova in db glumesc, toata lumea stie de moldova...maine am sa`mi fac ceva timp sa caut un alt site Quote
eusimplu Posted December 30, 2013 Report Posted December 30, 2013 Incearca cu API-ul de geolocation folosit de mine in articolul Geolocation sau Cum aflii tara unui IP. Quote
totti93 Posted December 30, 2013 Report Posted December 30, 2013 Nu inteleg de ce splittezi (explode) acel string in asa fel. Daca o lista are alt format decat pe ce ai mers tu atunci nu va functiona. Fa cu regular expression sa extragi toate IP-urile. Iar acolo in loc de get_string_between() poti folosi tot regular expression. Quote
ZKS Posted December 30, 2013 Author Report Posted December 30, 2013 (edited) da totti93, scriptul l`am facut, pt un user de pe forum, in 20 de min...iar el asa are formatul Edited December 30, 2013 by ZKS Quote
GarryOne Posted January 2, 2014 Report Posted January 2, 2014 Uite si varianta mea.<?php$file = 'vuln.txt';$data = file($file);$content = '';foreach($data as $val) { $ip = trim(end(explode(":", $val))); $location = json_decode(file_get_contents("http://freegeoip.net/json/".$ip)); $content .= trim($val) . " " . $location->country_name . ", " . $location->city . "\n" ;}file_put_contents($file, $content);?> 1 Quote
doiulyka Posted June 2, 2014 Report Posted June 2, 2014 folosesti json_decode destul de greu de instalat mai ales in opensuse. Nu cred ca ajuta prea multa lume. Este destul de complicat sa instalezi devel in unele sisteme. Ai putea incerca ceva cURL. Mult mai practic si functioneaza pe orice sistem cu php-curl Quote
GarryOne Posted June 2, 2014 Report Posted June 2, 2014 folosesti json_decode destul de greu de instalat mai ales in opensuse. Nu cred ca ajuta prea multa lume.E o tampenie, cum sa nu ajute pe multi ca are json_decode. Eu nu am intalnit nici un server php care sa nu aiba functia json_decode. De ce ai folosi cURL cand se poate mai simplu. Quote
doiulyka Posted June 3, 2014 Report Posted June 3, 2014 O sa intalnesti Infine, nu am spus ca nu este OK ceea ce a postat. Facusem ceva de acest gen in curl. Era mult mai practic am cautat sursa sa o postez dar nu mai dau de ea. Ca sa poti folosi functia json_decode ai nevoie de php-devel. Pe sisteme luate prin bruteforce este destul de greu sa instalezi devel.. daca nu ai drept chiar imposibil asa cURL au majoritatea. Avand in vedere ca majoritatea foloseste sursa intr-o masina virtuala este foarte practic si versiunea cu json_decode. Quote