Μετάβαση στο περιεχόμενο
  • ChatBox

    ChatBox

    Chatroom Rules

    • Το GreekHacking.Gr είναι ένα ελληνικό forum και επιτρέπεται μόνο η χρήση της Ελληνική Γλώσσας (ούτε greeklish).
    • Δεν επιτρέπονται οι βρισιές και γενικά η χρήση χυδαίας γλώσσας.
    • Απαγορεύεται αυστηρά το πορνογραφικό, προσβλητικό και βίαιο περιεχόμενο.
    • Μην χρησιμοποιείτε κεφαλαία γράμματα η σύμβολα.
pipis2

Πως να θα βρειτε την θεση καποιου μονο απο μια φωτογραφια![python]

Recommended Posts

L393nd

Πολύ καλό!!!

Edited by L393nd

Μοιράσου αυτή την δημοσίευση


Link to post
Share on other sites

mpampvele12
On 1/1/2016 at 10:49 ΜΜ, pipis2 said:

Λοιπον μετα απο πολυ καιρο ειπα να ανεβασω και παλι ενα θεμα στο φορουμ προκειμενου να μαθω σε οσους ηδη δεν ξερουν πως να εκμεταλευονται τα metadata...
 Πριν αρχισουμε ομως σιγουρα μερικοι απο εσας θα θελετε να μαθετε τι ειναι τα meta data..
 Metadata ειναι καποια δεδομενα τα οποια δεν ειναι πολλες φορες ορατα στους χρηστες και περιγραφουν καποια αλλα δεδομενα.
Εμεις θα εκμεταλευτουμε τα metadata απο φωτογραφιες!
metadata ομως δεν υπαρχουν μονο στις φωτογραφιες αλλα και σε σελιδες κλτ...

Μερικα απτα στοιχεια που θα παρουμε θα ειναι η τοποθεσια, το ονομα αυτου που εχει την καμερα, με ποια καμερα ή κινητο τραβηχτηκε η φωτογραφια και πολλα αλλα!!!
Ας αρχισουμε!!

[hide]Αυτο που θα κανουμε ειναι να γραψουμε ενα απλο προγραμματακι σε python το οποιο θα μας δινει τα metadata μιας φωτογραφιας

Ο κωδικας ειναι γραμενος απο εμενα...δεν εχω παραθεσει σημειωσεις διπλα απτις εντολες καθως ειναι πολυ απλες και κατανοητες σε ολους, ακομα και καποιος που δεν εχει σχεδον καθολου εμπειρια μπορει να κατανοησει το προγραματακι

 

Ο κωδικας:

import argparse
from PIL import Image
from PIL.ExifTags import TAGS

def getMetaData(imgname, out):
		try:
				metaData = {}
				
				imgFile = Image.open(imgname)
				print "getting meta data..."
				info = imgFile._getexif()
				if info:
						print "Found meta data!"
						for (tag, value) in info.items():
								tagname = TAGS.get(tag, tag)
								metaData[tagname] = value
								if not out:
										print tagname, value
						if out:
								print "Outputting to file..."
								with open(out, 'w') as f:
										for (tagname, value) in metaData.items():
												f.write(str(tagname)+"\t"+\
														str(value)+"\n")
		except:
				print "failed"
def Main():
		parser = argparse.ArgumentParser()
		parser.add_argument("img", help="name of an image file.")
		parser.add_argument("--output","-o", help="dump data out to file")
		args = parser.parse_args()
		if args.img:
				getMetaData(args.img, args.output)
		else:
				print parser.usage

if __name__ == '__main__':
		Main()
				

Αφου αντιγραψετε τον κωδικα και τον αποθηκευσεται σαν extractMetaData.py θα τρεξουμε το προγραμματακι μας στο terminal και θα δωσουμε την παρακατω εντολη για να βρουμε τα metadata μιας φωτογραφιας και να τα αποθηκευσει σε ενα .txt αρχειο.

Εαν αποθηκευσαμε το προγραμμα στο Desktop και η εικονα ειναι και αυτη στο desktop η εντολη θα ειναι ετσι:

 

python extractMetaData.py εικονα.jpg -o data.txt

 

διαφορετικα εαν δεν θελουμε τα data σε txt τοτε θα δωσουμε την παρακατω εντολη:

 

python extractMetaData.py εικονα.jpg

[/hide]

Ελπιζω να σας αρεσε!Για βοηθεια αφηστε σχολιο!

 

thnks

Μοιράσου αυτή την δημοσίευση


Link to post
Share on other sites

mpampvele12
On 1/1/2016 at 10:49 PM, pipis2 said:

Well, after a long time I said I would once again raise a topic on the forum to teach those who don't already know how to exploit metadata...
 But before we start, I'm sure some of you will want to know what meta data is...
 Metadata is some data which are often not visible to users and describe some other data.
We will exploit the metadata from photos!
however, metadata does not only exist in photos but also in pages etc...

Some tangible data that we will get will be the location, the name of the person who has the camera, with which camera or mobile phone the photo was taken and much more!!!
Let's start!!

[hide]What we will do is to write a simple program in python that will give us the metadata of a photo

The code is written by me... I have not listed notes next to the tangible commands as they are very simple and understandable to everyone, even someone who has almost no experience can understand the program

 

The code:

 
 

 
		 
				 
				 
				
						 
						     
								  
										 
						 
								 
								  
										   
		
				 
 
		
		
				

 
		
				

After copying the code and saving it as extractMetaData.py, we will run our program in the terminal and give the following command to find the metadata of a photo and save it in a .txt file.

If we saved the program on the Desktop and the icon is also on the desktop, the command will be like this:

 

python extractMetaData.py image.jpg -o data.txt

 

otherwise if we don't want the data in txt then we will give the following command:

 

python extractMetaData.py image.jpg

[hide]

I hope you liked it! For help leave a comment!

 

thnks

Μοιράσου αυτή την δημοσίευση


Link to post
Share on other sites

mpampvele12
On 1/1/2016 at 10:49 ΜΜ, pipis2 said:

Well, after a long time I said I would once again raise a topic on the forum to teach those who don't already know how to exploit metadata...
 But before we start, I'm sure some of you will want to know what meta data is...
 Metadata is some data which are often not visible to users and describe some other data.
We will exploit the metadata from photos!
however, metadata does not only exist in photos but also in pages etc...

Some tangible data that we will get will be the location, the name of the person who has the camera, with which camera or mobile phone the photo was taken and much more!!!
Let's start!!

[hide]What we will do is to write a simple program in python that will give us the metadata of a photo

The code is written by me... I have not listed notes next to the tangible commands as they are very simple and understandable to everyone, even someone who has almost no experience can understand the program

 

The code:

 
 

 
		 
				 
				 
				
						 
						     
								  
										 
						 
								 
								  
										   
		
				 
 
		
		
				

 
		
				

After copying the code and saving it as extractMetaData.py, we will run our program in the terminal and give the following command to find the metadata of a photo and save it in a .txt file.

If we saved the program on the Desktop and the icon is also on the desktop, the command will be like this:

 

python extractMetaData.py image.jpg -o data.txt

 

otherwise if we don't want the data in txt then we will give the following command:

 

python extractMetaData.py image.jpg

[hide]

I hope you liked it! For help leave a comment!

 

thnks

Μοιράσου αυτή την δημοσίευση


Link to post
Share on other sites

mpampvele12
On 1/1/2016 at 10:49 PM, pipis2 said:

Well, after a long time I said I would once again raise a topic on the forum to teach those who don't already know how to exploit metadata...
 But before we start, I'm sure some of you will want to know what meta data is...
 Metadata is some data which are often not visible to users and describe some other data.
We will exploit the metadata from photos!
however, metadata does not only exist in photos but also in pages etc...

Some tangible data that we will get will be the location, the name of the person who has the camera, with which camera or mobile phone the photo was taken and much more!!!
Let's start!!

[hide]What we will do is to write a simple program in python that will give us the metadata of a photo

The code is written by me... I have not listed notes next to the tangible commands as they are very simple and understandable to everyone, even someone who has almost no experience can understand the program

 

The code:

 
 

 
		 
				 
				 
				
						 
						     
								  
										 
						 
								 
								  
										   
		
				 
 
		
		
				

 
		
				

After copying the code and saving it as extractMetaData.py, we will run our program in the terminal and give the following command to find the metadata of a photo and save it in a .txt file.

If we saved the program on the Desktop and the icon is also on the desktop, the command will be like this:

 

python extractMetaData.py image.jpg -o data.txt

 

otherwise if we don't want the data in txt then we will give the following command:

 

python extractMetaData.py image.jpg

[hide]

I hope you liked it! For help leave a comment!

 

euxaristw

Μοιράσου αυτή την δημοσίευση


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Απάντηση στο θέμα...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



ChatBox

ChatBox

Chatroom Rules

  • Το GreekHacking.Gr είναι ένα ελληνικό forum και επιτρέπεται μόνο η χρήση της Ελληνική Γλώσσας (ούτε greeklish).
  • Δεν επιτρέπονται οι βρισιές και γενικά η χρήση χυδαίας γλώσσας.
  • Απαγορεύεται αυστηρά το πορνογραφικό, προσβλητικό και βίαιο περιεχόμενο.
  • Μην χρησιμοποιείτε κεφαλαία γράμματα η σύμβολα.
×
×
  • Create New...