-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathextract_metadata.py
More file actions
32 lines (18 loc) · 895 Bytes
/
extract_metadata.py
File metadata and controls
32 lines (18 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This is one of the imoportant code
# it extracts the metadata from the pdf file and can reveal important information of the system.
# it can be useful in cyber forensics
# using new module of python pypdf
# importing the pypdf module for metadata extraction:))
import pyPdf
def main():
# setting the location of the pdf here from which metadata is to be extracted
filen = <LOCATION_OF_THE_PDF> # provide the file location here
pdfFile = pyPdf.PdfFileReader(file(filen,'rb')) # opening the pdf file here
data = pdfFile.getDocumentInfo() # saving the metadata info in data variable using defined function
print "(:-------#####------Extracted Metadata of the file-------#######--------:)"
for metadata in data:
print metadata+ ":" +data[metadata]
if __name__ == '__main__':
main() # calling the main driver function
# program ends
# happy hacking