Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!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 ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement