[Perl] DH Image Locate 0.3

Iniciado por BigBear, Marzo 31, 2017, 04:25:50 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Un script en Perl para localizar la coordenadas GPS de cualquier imagen que contenga este tag.

Si quieren el programa les redirige a google maps con las coordenadas encontradas.

El codigo :

Código: perl

#!usr/bin/perl
# DH Image Locate 0.3
#(C) Doddy Hackman 2016

use Image::ExifTool;
use Getopt::Long;
use Color::Output;
Color::Output::Init;

GetOptions(
    "dump_all=s"   => \$dump_all,
    "dump_gps_tags=s"  => \$dump_gps_tags,
    "locate=s"   => \$locate
);

head();

if ($dump_all) {

    if ( -f $dump_all ) {
        printear_titulo("[+] Finding information in : ");
        print $dump_all. "\n\n";
        dump_all($dump_all);
    }
    else {
        printear("[-] File not found\n");
    }

}
elsif ($dump_gps_tags) {

    if ( -f $dump_gps_tags ) {
        printear_titulo("[+] Finding GPS tags in : ");
        print $dump_gps_tags. "\n\n";
        dump_gps_tags_and_locate($dump_gps_tags,"0");
    }
    else {
        printear("[-] File not found\n");
    }
}
elsif ($locate) {

    if ( -f $locate ) {
        printear_titulo("[+] Scanning photo : ");
        print $locate. "\n\n";
        dump_gps_tags_and_locate($locate,"1");
    }
    else {
        printear("[-] File not found\n");
    }

} else {
    sintax();
}

copyright();

# Functions

sub dump_all {

    my $imagen_target = $_[0];

    my $datos_imagen       = new Image::ExifTool;
    my $informacion_imagen = $datos_imagen->ImageInfo($imagen_target);

    for my $abriendo_imagen ( $datos_imagen->GetFoundTags("Group0") ) {
        my $valor = $informacion_imagen->{$abriendo_imagen};
        printear("[+] $abriendo_imagen : ");
        print $valor. "\n";
    }

}

sub dump_gps_tags_and_locate {

my $imagen_target = shift;
my $locate = shift;

my $datos_imagen       = new Image::ExifTool;
my $informacion_imagen = $datos_imagen->ImageInfo($imagen_target);

my $latitud = $informacion_imagen->{GPSLatitude};
my $longitud = $informacion_imagen->{GPSLongitude};
my $altitud = $informacion_imagen->{GPSAltitude};
my $fecha = $informacion_imagen->{GPSDateTime};
my $posicion_real = $informacion_imagen->{GPSPosition};

my $finder_ready = 0;


if($latitud ne "") {
printear("[+] Latitude : ");
print $latitud. "\n";
} else {
printear("[-] Latitude : ");
print "Not Found". "\n";
}

if($longitud ne "") {
printear("[+] Longitude : ");
print $longitud. "\n";
} else {
printear("[-] Longitude : ");
print "Not Found". "\n";
}
   
    if($latitud ne "") {
printear("[+] Altitude : ");
print $altitud. "\n";
} else {
printear("[-] Altitude : ");
print "Not Found". "\n";
}
   
    if($fecha ne "") {
printear("[+] DateTime : ");
print $fecha. "\n";
} else {
printear("[-] DateTime : ");
print "Not Found". "\n";
}
   
    if($posicion_real ne "") {
printear("[+] Position : ");
print $posicion_real. "\n";
$finder_ready = 1;
} else {
printear("[-] Position : ");
print "Not Found". "\n";
$finder_ready = 0;
}

if($locate eq "1") {
if($finder_ready eq "1") {
my $gps_split = $posicion_real;
$gps_split =~ s/deg//g;
$gps_split =~ s/'//g;
$gps_split =~ s/"//g;
$gps_split =~ s/W//g;
$gps_split =~ s/N,/-/g;
$gps_split =~ s/  / /g;

my $url = "https://www.google.com.ar/maps/search/".$gps_split."/";

printear_titulo("\n[!] Position Located\n\n");
printear("[+] GPS : ");
print $gps_split."\n";

printear("\n[?] Open in browser [y,n] : ");
chomp(my $rta = <STDIN>);
if($rta=~/y/ig) {
printear_titulo("\n[+] Enjoy the program !\n");
system("start firefox \"" . $url."\"");
} else {
printear("\n[+] GoogleMaps : ");
print $url. "\n";
}

} else {
printear_titulo("\n[-] Position GPS not available");
}
}

}

# More Functions

sub printear {
    cprint( "\x036" . $_[0] . "\x030" );
}

sub printear_logo {
    cprint( "\x037" . $_[0] . "\x030" );
}

sub printear_titulo {
    cprint( "\x0310" . $_[0] . "\x030" );
}

sub sintax {

    printear("[+] Sintax : ");
    print "perl $0 <option> <value>\n";
    printear("\n[+] Options : \n\n");
    print "-dump_all <image> : Get all information of a image\n";
    print "-dump_gps <image> : Get all tags GPS of a image\n";
    print "-locate <image> : Locate Image in GoogleMaps\n";
    printear("\n[+] Example : ");
    print "perl dh_image_locate.pl -dump_all test.jpg\n";
    copyright();
}

sub head {
    printear_logo("\n-- == DH Image Locate 0.3 == --\n\n\n");
}

sub copyright {
    printear_logo("\n\n-- == (C) Doddy Hackman 2016 == --\n\n");
    exit(1);
}

#The End ?


Un video con ejemplos de uso :



Si quieren bajar el programa lo pueden hacer de aca :

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login.

Eso seria todo.

Brillante como siempre @You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login! muchas gracias por el código!

Saludos!
ANTRAX


Ok, gracias por comentar Antrax.

Saludos.